/* What the administrative area adds to kartora's design system: a grid of tiles that are all one size, a table
   whose numbers stand in line and whose words never leave their cell, the bars of how far the families have come,
   and the list of what happened. Everything is drawn in the design system's own tokens. To be carried into
   `design/` with the rest of MVP 2.0. */

/* ---------- tiles: every one the same width and height, whatever it says */
.adm-tiles {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-3);
}
@container app (min-width: 720px) {
  .adm-tiles {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
  .adm-tiles--three {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
.adm-tile {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  min-width: 0;
  min-height: 7.25rem;
  padding: var(--space-4);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  color: inherit;
  text-decoration: none;
}
a.adm-tile:hover {
  border-color: var(--line-strong);
}
.adm-tile--danger {
  border-color: var(--danger);
  background: var(--danger-soft);
}
.adm-tile--warning {
  border-color: var(--warning);
  background: var(--warning-soft);
}
.adm-tile__label {
  font-size: var(--text-sm);
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.adm-tile__value {
  font-family: var(--font-display);
  font-size: var(--title);
  font-weight: 700;
  line-height: 1.15;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.adm-tile__value small {
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: 400;
  color: var(--muted);
}
.adm-tile__note {
  margin-top: auto;
  font-size: var(--text-xs);
  color: var(--muted);
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ---------- two things side by side, one under the other on a narrow screen */
.adm-two {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-6);
  align-items: start;
}
@container app (min-width: 900px) {
  .adm-two {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }
}
.adm-panel {
  min-width: 0;
  padding: var(--space-4);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}
.adm-panel__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-3);
}
.adm-panel__head h2,
.adm-panel__head h3 {
  margin: 0;
  font-size: var(--text-md);
  font-family: var(--font-display);
}

/* ---------- what asks for an eye */
.adm-attention {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
.adm-attention a {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--line);
  border-left-width: 4px;
  border-radius: var(--radius-md);
  background: var(--surface);
  color: inherit;
  text-decoration: none;
  min-height: var(--touch);
}
.adm-attention a:hover {
  background: var(--surface-2);
}
.adm-attention .is-danger {
  border-left-color: var(--danger);
}
.adm-attention .is-warning {
  border-left-color: var(--warning);
}
.adm-attention .is-info {
  border-left-color: var(--info);
}
.adm-attention span:first-child {
  flex: 1;
  min-width: 0;
}

/* ---------- how far the families have come: a bar a step */
.adm-funnel {
  display: grid;
  grid-template-columns: minmax(7rem, max-content) minmax(0, 1fr) max-content;
  gap: var(--space-2) var(--space-3);
  align-items: center;
  font-size: var(--text-sm);
}
.adm-funnel__bar {
  height: 0.75rem;
  border-radius: var(--radius-pill);
  background: var(--surface-3);
  overflow: hidden;
}
.adm-funnel__fill {
  height: 100%;
  border-radius: var(--radius-pill);
  background: var(--accent);
  min-width: 2px;
}
.adm-funnel__n {
  font-variant-numeric: tabular-nums;
  text-align: right;
  white-space: nowrap;
}
.adm-funnel__n small {
  color: var(--muted);
}

/* ---------- what happened: a line a happening */
.adm-feed {
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: var(--text-sm);
}
.adm-feed li {
  display: grid;
  grid-template-columns: 6.5rem minmax(0, 1fr);
  gap: var(--space-3);
  padding: var(--space-2) 0;
  border-bottom: 1px solid var(--line);
}
.adm-feed li:last-child {
  border-bottom: 0;
}
.adm-feed time {
  color: var(--muted);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.adm-feed p {
  margin: 0;
  overflow-wrap: anywhere;
}

/* ---------- a table: numbers in line, words kept inside their cell */
.adm-table th {
  white-space: nowrap;
}
.adm-table td {
  vertical-align: top;
  /* A long word breaks, but a cell is never squeezed to a letter a line: the table slides inside its frame. */
  overflow-wrap: break-word;
}
.adm-table .is-num {
  text-align: right;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.adm-table .is-tight {
  white-space: nowrap;
}
.adm-table .is-wide {
  min-width: 16rem;
}
.adm-table small {
  display: block;
  color: var(--muted);
  font-size: var(--text-xs);
}
@media (max-width: 640px) {
  .adm-table .is-num {
    text-align: left;
  }
  .adm-table .is-wide {
    min-width: 0;
  }
}
.adm-flags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1);
}

/* ---------- a message someone wrote */
.adm-message {
  padding: var(--space-4);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}
.adm-message--handled {
  background: transparent;
}
.adm-message__head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2) var(--space-3);
}
.adm-message__head time {
  margin-left: auto;
  color: var(--muted);
  font-size: var(--text-sm);
  white-space: nowrap;
}
.adm-message__words {
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  max-width: 46rem;
}
.adm-message__foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
}

/* ---------- the setup's steps of one student: a dot a step */
.adm-steps {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1);
}
.adm-step {
  font-size: var(--text-xs);
  padding: 2px var(--space-2);
  border-radius: var(--radius-pill);
  border: 1px solid var(--line);
  color: var(--muted);
  white-space: nowrap;
}
.adm-step--done {
  background: var(--success-soft);
  border-color: transparent;
  color: var(--ink);
}
.adm-step--open {
  border-color: var(--accent);
  color: var(--ink);
}

/* ---------- the library's pictures */
.adm-pictures {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(10rem, 1fr));
  gap: var(--space-3);
}
.adm-picture {
  margin: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.adm-picture img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  background: var(--surface-3);
}
.adm-picture figcaption {
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-xs);
  line-height: 1.35;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.adm-picture figcaption span:first-child {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.adm-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
}

/* A text in a tile's place of a number may take two lines. */
.adm-tile__value--words {
  white-space: normal;
  font-size: var(--text-lg);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
/* A row of choices wider than a phone is slid sideways inside itself, never the page. */
.adm-toolbar > * {
  min-width: 0;
  max-width: 100%;
}
.adm-toolbar .k-seg {
  overflow-x: auto;
  scrollbar-width: none;
}
