/* Work frame: top bar, left menu, wide content. Used by admin and (later) the student dashboard. */
body.app {
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr;
  background: var(--concrete);
}

.app-bar {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.625rem 1.25rem;
  background: var(--blue);
  color: #fff;
  border-bottom: 6px solid var(--hivis);
}

.app-bar .brand {
  color: #fff;
  font-family: var(--font-head);
  font-size: 1.25rem;
  font-weight: 600;
  text-decoration: none;
}

.app-area {
  padding-left: 1rem;
  border-left: 1px solid rgb(255 255 255 / 0.35);
}

.app-user {
  margin-left: auto;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.app-bar-btn {
  min-height: 40px;
  padding: 0.25rem 0.875rem;
  border: 1px solid rgb(255 255 255 / 0.6);
  border-radius: var(--radius);
  background: transparent;
  color: #fff;
  font-family: var(--font-head);
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.app-bar-btn:hover {
  background: var(--blue-deep);
}

.app-layout {
  display: grid;
  grid-template-columns: 15rem 1fr;
  min-height: 0;
}

.app-menu {
  padding: 1rem 0;
  background: var(--paper);
  border-right: 1px solid var(--line);
}

.app-menu a {
  display: block;
  padding: 0.75rem 1.25rem 0.75rem 1rem;
  border-left: 4px solid transparent;
  color: var(--ink);
  font-family: var(--font-head);
  font-size: 1.125rem;
  font-weight: 600;
  text-decoration: none;
}

.app-menu a:hover {
  background: var(--concrete);
}

.app-menu a[aria-current="page"] {
  border-left-color: var(--hivis);
  background: var(--concrete);
}

.app-main {
  min-width: 0;
  padding: 2rem;
}

.app-main > * + * {
  margin-top: 1.5rem;
}

.page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.page-head h1 {
  font-size: 2.25rem;
}

.app-main h2 {
  font-size: 1.5rem;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 1rem;
}

.check {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 44px;
  cursor: pointer;
}

.check input {
  width: 20px;
  height: 20px;
  accent-color: var(--blue);
}

/* panels and forms */
.panel {
  padding: 1.5rem;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.panel > * + * {
  margin-top: 1.25rem;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr));
  gap: 1rem;
  align-items: end;
}

.field select,
.field input {
  width: 100%;
  min-height: 48px;
  padding: 0.5rem 0.75rem;
  border: 2px solid var(--ink);
  border-radius: var(--radius);
  background: #fff;
  font: inherit;
  color: inherit;
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.btn-danger {
  background: transparent;
  border-color: var(--red);
  color: var(--red);
}

.btn-danger:hover {
  background: var(--red);
  border-color: var(--red);
  color: #fff;
}

.btn-small {
  min-height: 40px;
  padding: 0.25rem 0.75rem;
  font-size: 1rem;
}

/* tables */
.table-wrap {
  overflow-x: auto;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 0.75rem 1rem;
  text-align: left;
  vertical-align: middle;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

tbody tr:last-child td {
  border-bottom: 0;
}

th {
  font-family: var(--font-head);
  font-weight: 600;
  background: var(--concrete);
}

td.num,
th.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

td.wrap {
  white-space: normal;
  min-width: 14rem;
}

td.row-actions {
  text-align: right;
}

td.row-actions .btn + .btn,
td.row-actions .btn + span {
  margin-left: 0.5rem;
}

.empty {
  padding: 2rem 1.5rem;
  color: var(--muted);
}

/* status: text with a colour band, never colour alone */
.status {
  display: inline-block;
  padding-left: 0.5rem;
  border-left: 6px solid var(--muted);
}

.status.is-good {
  border-left-color: var(--green);
}

.status.is-wait {
  border-left-color: var(--hivis);
}

.status.is-bad {
  border-left-color: var(--red);
}

/* revenue figures */
.figures {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr));
  gap: 1rem;
  margin: 0;
}

.figures div {
  padding: 1rem 1.25rem;
  background: var(--paper);
  border: 1px solid var(--line);
  border-left: 10px solid var(--ink);
}

.figures .is-good {
  border-left-color: var(--green);
}

.figures .is-bad {
  border-left-color: var(--red);
}

.figures .is-wait {
  border-left-color: var(--hivis);
}

.figures dt {
  color: var(--muted);
}

.figures dd {
  margin: 0;
  font-family: var(--font-head);
  font-size: 2rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.details {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 0.5rem 1.5rem;
  margin: 0;
}

.details dt {
  color: var(--muted);
}

.details dd {
  margin: 0;
}

@media (max-width: 900px) {
  .app-layout {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
  }

  .app-menu {
    display: flex;
    padding: 0;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    overflow-x: auto;
  }

  .app-menu a {
    border-left: 0;
    border-bottom: 4px solid transparent;
    padding: 0.75rem 1rem;
  }

  .app-menu a[aria-current="page"] {
    border-bottom-color: var(--hivis);
  }

  .app-main {
    padding: 1.25rem 1rem;
  }

  .app-area,
  .app-user {
    display: none;
  }

  .app-bar-btn {
    margin-left: auto;
  }

  .page-head h1 {
    font-size: 1.75rem;
  }
}

/* marking written answers */
.muted {
  color: var(--muted);
}

.mark-item {
  margin: 0;
  padding: 1rem 0 0;
  border: 0;
  border-top: 1px solid var(--line);
}

.mark-item > * + * {
  margin-top: 0.75rem;
}

.mark-item legend {
  float: left;
  width: 100%;
  padding: 0;
  font-family: var(--font-head);
  font-size: 1.125rem;
  font-weight: 600;
  line-height: 1.3;
}

.mark-item legend + * {
  clear: both;
}

.mark-item .answer {
  padding: 0.75rem 1rem;
  background: var(--concrete);
  border-left: 6px solid var(--blue);
  white-space: pre-wrap;
}

.mark-item .model {
  color: var(--muted);
  font-size: 0.9375rem;
}

.mark-choice {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
}
