/* The super-admin portal.
 *
 * Its own stylesheet, not app.css: the practice-side sheet derives every token
 * from a practice's three theme colours, and there is no practice here. Slate
 * rather than a practice's red, so it is obvious at a glance which side of the
 * fence a screen belongs to. */

:root {
  --ink: #16181d;
  --ink-soft: #5b616e;
  --ink-faint: #8b909c;
  --bg: #f3f4f6;
  --surface: #ffffff;
  --line: #e2e4e9;
  --line-soft: #eef0f3;
  --accent: #2f4a6d;
  --accent-ink: #ffffff;
  --accent-soft: #eaeff6;
  --ok: #1f6f43;
  --ok-soft: #e6f4ec;
  --warn: #8a4b12;
  --warn-soft: #fdf0e2;
  --error: #97231f;
  --error-soft: #fbebea;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 18, 23, 0.06), 0 1px 8px rgba(16, 18, 23, 0.04);
}

:root[data-theme="dark"] {
  --ink: #e8eaee;
  --ink-soft: #a3a9b6;
  --ink-faint: #7b8290;
  --bg: #14161b;
  --surface: #1c1f26;
  --line: #2b2f39;
  --line-soft: #23272f;
  --accent: #7fa3d1;
  --accent-ink: #10131a;
  --accent-soft: #212b3a;
  --ok: #6fc294;
  --ok-soft: #1b2c23;
  --warn: #d9a066;
  --warn-soft: #2c2318;
  --error: #e58b86;
  --error-soft: #2e1e1e;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); }

code {
  font: 13px/1.4 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color: var(--ink-soft);
}

/* ------------------------------------------------------------- top bar -- */

.topbar {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 0 20px;
  height: 56px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 10;
}

.topbar__brand { display: flex; align-items: baseline; gap: 8px; text-decoration: none; }
.topbar__mark { font-weight: 650; color: var(--ink); letter-spacing: -0.01em; }
.topbar__tag {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 2px 6px;
  border-radius: 4px;
}

.topbar__nav { display: flex; gap: 4px; flex: 1; flex-wrap: wrap; }
.topbar__link {
  padding: 6px 10px;
  border-radius: 6px;
  text-decoration: none;
  color: var(--ink-soft);
  font-size: 14px;
}
.topbar__link:hover { background: var(--line-soft); color: var(--ink); }
.topbar__link.is-current { background: var(--accent-soft); color: var(--accent); font-weight: 550; }

.topbar__right { display: flex; align-items: center; gap: 12px; }
.topbar__who { font-size: 13px; color: var(--ink-soft); }
/* Text, not a glyph: ◐ and ☾ render inconsistently across the platforms this
 * is opened on, and one of them came out as a stray chevron. */
.topbar__theme {
  background: none;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 4px 9px;
  font: inherit;
  font-size: 12px;
  cursor: pointer;
  color: var(--ink-soft);
}
.topbar__theme:hover { color: var(--ink); border-color: var(--accent); }

/* -------------------------------------------------------------- layout -- */

.shell { max-width: 1080px; margin: 0 auto; padding: 28px 20px 48px; }
.stack { display: flex; flex-direction: column; gap: 20px; }

.page__head { display: flex; flex-direction: column; gap: 4px; }
.page__title { margin: 0; font-size: 24px; font-weight: 650; letter-spacing: -0.02em; }
.page__subtitle { margin: 0; color: var(--ink-soft); max-width: 68ch; }
.back { font-size: 13px; text-decoration: none; color: var(--ink-soft); }
.back:hover { color: var(--accent); }

.section-title {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--ink-faint);
  margin-bottom: -12px;
}

.footer {
  border-top: 1px solid var(--line);
  padding: 16px 20px 32px;
  color: var(--ink-faint);
  font-size: 13px;
  text-align: center;
}

/* --------------------------------------------------------------- cards -- */

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
}
.card--flush { padding: 0; overflow: hidden; }
.card__title { margin: 0 0 16px; font-size: 16px; font-weight: 600; }
.card__title--inset { padding: 16px 20px 0; margin-bottom: 0; }

.note {
  margin: 16px 0 0;
  padding-top: 14px;
  border-top: 1px solid var(--line-soft);
  color: var(--ink-soft);
  font-size: 13px;
  max-width: 78ch;
}
.muted { color: var(--ink-soft); }

/* ---------------------------------------------------------------- rows -- */

.row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--line-soft);
  text-decoration: none;
  color: inherit;
}
.row:last-child { border-bottom: 0; }
.row--link:hover { background: var(--line-soft); }
.row--foot { justify-content: flex-end; font-size: 13px; }

.row__main { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; min-width: 0; }
.row__name { font-weight: 550; }
.row__meta { color: var(--ink-faint); font-size: 13px; white-space: nowrap; }
.row__meta--inline { white-space: normal; }
.row__actions { display: flex; align-items: center; gap: 8px; }
.row__actions form { margin: 0; }

/* --------------------------------------------------------------- tiles -- */

.tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
}
.tiles--inline { margin-bottom: 4px; }

.tile {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 16px 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  text-decoration: none;
  color: inherit;
  box-shadow: var(--shadow);
}
.tile:hover { border-color: var(--accent); }
.tile--flat { box-shadow: none; background: var(--line-soft); border-color: transparent; }
.tile--flat:hover { border-color: transparent; }
.tile__value { font-size: 26px; font-weight: 650; letter-spacing: -0.02em; }
.tile__of { font-size: 16px; font-weight: 500; color: var(--ink-faint); }
.tile__label { font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-faint); }

/* -------------------------------------------------------------- badges -- */

.badge {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 550;
  letter-spacing: 0.01em;
  background: var(--line-soft);
  color: var(--ink-soft);
  white-space: nowrap;
}
.badge--num { font-variant-numeric: tabular-nums; background: var(--accent-soft); color: var(--accent); }
.badge--soft { background: var(--accent-soft); color: var(--accent); }
.badge--muted { background: var(--line-soft); color: var(--ink-faint); }
.badge--ok { background: var(--ok-soft); color: var(--ok); }
.badge--warn { background: var(--warn-soft); color: var(--warn); }
/* An expired trial is not a warning, it is a practice that cannot log in. */
.badge--error { background: var(--error-soft); color: var(--error); }

/* --------------------------------------------------------------- forms -- */

.form { display: flex; flex-direction: column; gap: 16px; }
.form--inline { flex-flow: row wrap; align-items: flex-end; gap: 12px; margin-top: 16px; }
.form__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}

.field { display: flex; flex-direction: column; gap: 6px; }
.field__label { font-size: 13px; font-weight: 550; }
/* Notes sit BELOW the input, not inside the label. Every label is then one
 * line tall, so the inputs across a grid row line up — a two-line note used
 * to push its own input down and leave the row ragged. */
.field__note { color: var(--ink-faint); font-size: 12px; line-height: 1.45; }
.field__input {
  font: inherit;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  width: 100%;
}
.field__input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
  border-color: var(--accent);
}
.field__input--code {
  font: 13px/1.6 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  resize: vertical;
}

.button-row { display: flex; gap: 10px; flex-wrap: wrap; }

.btn {
  font: inherit;
  font-weight: 550;
  padding: 8px 14px;
  border-radius: 8px;
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--line-soft);
  color: var(--ink);
}
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn--primary { background: var(--accent); color: var(--accent-ink); }
.btn--outline { background: var(--surface); border-color: var(--line); color: var(--ink); }
.btn--ghost { background: none; color: var(--ink-soft); }
.btn--ghost:hover { background: var(--line-soft); color: var(--ink); }
.btn--sm { padding: 5px 10px; font-size: 13px; }
.btn--block { width: 100%; }

/* -------------------------------------------------------------- tables -- */

.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th {
  text-align: left;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-faint);
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.table td { padding: 10px 14px; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
.table tr:last-child td { border-bottom: 0; }
.nowrap { white-space: nowrap; }

/* --------------------------------------------------------------- chips -- */

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  padding: 5px 11px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-soft);
  text-decoration: none;
  font-size: 13px;
}
.chip:hover { border-color: var(--accent); color: var(--accent); }
.chip.is-current { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.chip__count { opacity: 0.7; font-variant-numeric: tabular-nums; }

/* --------------------------------------------------------------- flash -- */

.flash {
  padding: 11px 14px;
  border-radius: 8px;
  border: 1px solid transparent;
  font-size: 14px;
}
.flash--success { background: var(--ok-soft); border-color: var(--ok); color: var(--ok); }
.flash--error { background: var(--error-soft); border-color: var(--error); color: var(--error); }

/* -------------------------------------------------------------- signin -- */

.signin { min-height: 70vh; display: grid; place-items: center; }
.card--signin { width: min(380px, 100%); display: flex; flex-direction: column; gap: 16px; }
.signin__title { margin: 0; font-size: 20px; font-weight: 650; }
.signin__sub { margin: 0; color: var(--ink-soft); font-size: 13px; }

/* The browser only implements `[hidden] { display: none }`, which any class
 * setting `display` then outranks — the bug that put every hidden button in
 * the practice-side app on screen. Settled here before it can happen again. */
[hidden] { display: none !important; }

/* A warning flash, and an informational one. The portal's actions reach other
 * people's practices, so "this is fine" and "read this first" must not look
 * the same. */
.flash--warn { background: var(--warn-soft); border-color: var(--warn); color: var(--warn); }
.flash--info { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }

/* A card header that carries an action on the right. */
.row--head { padding: 16px 20px; border-bottom: 1px solid var(--line); }
.card__title--flush { margin: 0; }

.note--top { margin-top: 0; padding-top: 0; border-top: 0; }

.btn--link {
  background: none;
  border: 0;
  padding: 8px 0;
  color: var(--ink-soft);
  text-decoration: underline;
  cursor: pointer;
}
.btn--link:hover { color: var(--error); }

/* An editor that opens below a table it belongs to, separated so the heading
 * does not read as another table row. */
.form--panel {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 2px solid var(--line);
}
