/*
 * The admin page, in devkore.com's look: a near-black ground, warm white
 * text, lime for what you act on, Barlow headlines, Geist for everything else
 * and Geist Mono for labels. Corners are small and borders are hairlines.
 *
 * The first six tokens are the site's own (DK.Web: tailwind.config.js and
 * src/index.css). Amber and red are not Kore colors; the site has no warning
 * or danger color, and a page that can hang up on someone needs both.
 *
 * Where this page departs from the site, it is for legibility. The numbers
 * are WCAG contrast, measured on the rendered page:
 *
 *   - Small labels are warm white at 62%, which is 6.7:1 or better. The
 *     site's are at 30%, which is 2.5:1.
 *   - A field's border is warm white at 38% (3.5:1), not 10% (1.3:1).
 *   - Purple is 3.3:1 as text on a panel, so text in purple is mixed 70/30
 *     with warm white (6:1 where it is used) and the pure purple is kept for
 *     rules and the logo.
 *   - Body text is Geist 400, not 300, which is thin at these sizes.
 *
 * The rest needed nothing: warm white is 12.9:1 or better and lime 7.6:1 or
 * better wherever they are text, the dark text on lime is 11.7:1 and on the
 * red of End call 5.5:1.
 */

:root {
  --ground: #121217;
  --panel: #1d1d22;
  --warm: #f0ece2;
  --lime: #aadd00;
  --ink: #111110;
  --purple: #7c5cbf;
  --amber: #f0b429;
  --red: #e85d4a;

  --rule: color-mix(in srgb, var(--warm) 8%, transparent);
  --rule-strong: color-mix(in srgb, var(--warm) 16%, transparent);
  --field: color-mix(in srgb, var(--warm) 38%, transparent);
  --text-soft: color-mix(in srgb, var(--warm) 80%, transparent);
  --text-faint: color-mix(in srgb, var(--warm) 62%, transparent);
  --purple-text: color-mix(in srgb, var(--purple) 70%, var(--warm));
  /* A row set into a panel. */
  --row: color-mix(in srgb, var(--warm) 4%, var(--panel));
  --lime-wash: color-mix(in srgb, var(--lime) 8%, transparent);
  --lime-rule: color-mix(in srgb, var(--lime) 22%, transparent);
  --red-wash: color-mix(in srgb, var(--red) 14%, transparent);

  --font-display: Barlow, ui-sans-serif, system-ui, sans-serif;
  --font-body: Geist, ui-sans-serif, system-ui, sans-serif;
  --font-mono: 'Geist Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  --bar: 3.75rem;
  --gap: 1.5rem;

  color-scheme: dark;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

::selection {
  background: var(--lime);
  color: var(--ink);
}

html {
  background: var(--ground);
}

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--ground);
  color: var(--warm);
  font-family: var(--font-body);
  font-size: 0.9375rem;
  font-weight: 400;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1,
h2,
h3,
h4 {
  margin: 0;
}

h1,
h2 {
  font-family: var(--font-display);
  font-weight: 900;
  letter-spacing: -0.035em;
  line-height: 1.05;
  text-wrap: balance;
}

h1 {
  font-size: 2.5rem;
}

h2 {
  font-size: 1.625rem;
}

p,
ul,
ol,
dl,
dd {
  margin: 0;
}

ul,
ol {
  padding: 0;
  list-style: none;
}

code {
  font-family: var(--font-mono);
  font-size: 0.875em;
}

button,
input {
  font: inherit;
  color: inherit;
}

:focus-visible {
  outline: 2px solid var(--lime);
  outline-offset: 3px;
}

/* ── The bar across the top ─────────────────────────────────────────────── */

.bar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--ground);
  border-bottom: 0.5px solid var(--rule-strong);
}

.bar__inner {
  display: flex;
  align-items: center;
  gap: 1rem;
  height: var(--bar);
  max-width: 90rem;
  margin: 0 auto;
  padding: 0 var(--gap);
}

.logo {
  display: block;
  width: auto;
  height: 1.375rem;
}

.bar__name {
  padding-left: 1rem;
  border-left: 0.5px solid var(--rule-strong);
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-faint);
}

.bar__fill {
  flex: 1;
}

/* ── Small parts used everywhere ────────────────────────────────────────── */

.eyebrow {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-faint);
}

.eyebrow + h1,
.eyebrow + h2 {
  margin-top: 0.625rem;
}

.lead {
  margin-top: 0.625rem;
  font-size: 0.875rem;
  color: var(--text-soft);
}

.hint {
  margin-top: 0.875rem;
  font-size: 0.8125rem;
  color: var(--text-faint);
}

.error {
  margin-top: 0.75rem;
  padding: 0.5rem 0.75rem;
  border: 0.5px solid color-mix(in srgb, var(--red) 55%, transparent);
  border-radius: 4px;
  background: var(--red-wash);
  font-size: 0.875rem;
}

.notice {
  max-width: 30rem;
  margin: 4rem auto;
  padding: 0 var(--gap);
  text-align: center;
  color: var(--text-soft);
}

.panel {
  padding: 1.5rem;
  border: 0.5px solid var(--rule);
  border-radius: 10px;
  background: var(--panel);
}

.panel__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
  padding: 0.25rem 0.625rem;
  border: 0.5px solid var(--rule-strong);
  border-radius: 3px;
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-soft);
  white-space: nowrap;
}

.dot {
  width: 0.4375rem;
  height: 0.4375rem;
  border-radius: 50%;
  background: var(--amber);
}

.status[data-state='good'] {
  border-color: var(--lime-rule);
}

.status[data-state='good'] .dot {
  background: var(--lime);
  box-shadow: 0 0 8px color-mix(in srgb, var(--lime) 60%, transparent);
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.6875rem 1.375rem;
  border: 1px solid transparent;
  border-radius: 4px;
  background: var(--lime);
  color: var(--ink);
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1.2;
  white-space: nowrap;
  cursor: pointer;
  transition: filter 0.15s ease, transform 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.button:hover:not(:disabled),
.plus:hover:not(:disabled) {
  filter: brightness(1.08);
  transform: translateY(-1px);
}

.button:active:not(:disabled),
.plus:active:not(:disabled) {
  transform: translateY(1px) scale(0.98);
}

.button--ghost {
  border-color: var(--field);
  background: transparent;
  color: var(--warm);
}

.button--ghost:hover:not(:disabled) {
  border-color: var(--lime);
  color: var(--lime);
  filter: none;
}

.button--danger {
  background: var(--red);
}

.button--small {
  padding: 0.4375rem 0.875rem;
  font-size: 0.8125rem;
}

.button:disabled,
.plus:disabled {
  opacity: 0.5;
  cursor: default;
}

/* A text button, underlined the way the site's quiet links are. */
.quiet {
  padding: 0 0 0.125rem;
  border: 0;
  border-bottom: 1px solid var(--rule-strong);
  background: none;
  font-size: 0.8125rem;
  color: var(--text-soft);
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.quiet:hover {
  border-color: var(--warm);
  color: var(--warm);
}

.field {
  display: block;
  min-width: 0;
}

.field__label {
  display: block;
  margin-bottom: 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-faint);
}

input {
  width: 100%;
  height: 2.75rem;
  padding: 0 0.875rem;
  border: 1px solid var(--field);
  border-radius: 4px;
  background: transparent;
  font-size: 0.9375rem;
  transition: border-color 0.15s ease;
}

input::placeholder {
  color: var(--text-faint);
  opacity: 0.85;
}

input:hover {
  border-color: color-mix(in srgb, var(--warm) 60%, transparent);
}

input:focus-visible {
  border-color: var(--lime);
  outline-offset: 1px;
}

/* ── Signing in ─────────────────────────────────────────────────────────── */

.door {
  display: grid;
  place-items: center;
  min-height: calc(100dvh - var(--bar));
  padding: var(--gap);
}

.door__panel {
  width: 100%;
  max-width: 26rem;
  padding: 2.25rem 2rem 2rem;
  border-color: var(--rule-strong);
  box-shadow:
    inset 0 1px 0 color-mix(in srgb, var(--warm) 6%, transparent),
    0 24px 48px -32px rgb(0 0 0 / 0.65);
}

.door__panel .field {
  margin-top: 1.5rem;
}

.door__panel .button {
  width: 100%;
  margin-top: 1.5rem;
}

/* ── The two columns ────────────────────────────────────────────────────── */

.desk {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 24rem;
  align-items: start;
  gap: var(--gap);
  max-width: 90rem;
  margin: 0 auto;
  padding: var(--gap);
}

.desk__main,
.desk__side {
  display: grid;
  gap: var(--gap);
  min-width: 0;
}

/* ── The call and its captions ──────────────────────────────────────────── */

.dial {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.25rem 0.625rem;
  margin-top: 0.625rem;
}

.dial__label {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-faint);
}

.dial__number {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
  color: var(--lime);
  text-decoration: none;
  white-space: nowrap;
}

.dial__number:hover {
  text-decoration: underline;
  text-underline-offset: 0.2em;
}

.call {
  display: flex;
  flex-direction: column;
  /* The call on one screen, the captions taking what the rest leaves, with the top of the minutes showing below. */
  height: calc(100dvh - var(--bar) - var(--gap) - 6.5rem);
  min-height: 30rem;
}

.calls:not(:empty) {
  display: grid;
  gap: 0.75rem;
  margin-top: 1.25rem;
}

.oncall {
  padding: 0.875rem 1rem;
  border: 0.5px solid var(--rule-strong);
  border-radius: 8px;
  background: var(--row);
}

.oncall__line,
.row__line {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.clock {
  font-family: var(--font-mono);
  font-size: 0.875rem;
  font-variant-numeric: tabular-nums;
  color: var(--text-soft);
}

.steps {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
  margin-top: 0.875rem;
}

.steps li {
  display: flex;
  align-items: baseline;
  gap: 0.4375rem;
  max-width: 100%;
  padding: 0.25rem 0.625rem;
  border: 0.5px solid var(--rule-strong);
  border-radius: 3px;
  font-size: 0.8125rem;
  color: var(--text-faint);
}

.steps li::before {
  content: attr(data-number);
  font-family: var(--font-mono);
  font-size: 0.6875rem;
}

.steps span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.steps li[data-step='done'] {
  color: var(--text-soft);
}

.steps li[data-step='open'] {
  border-color: var(--lime);
  background: var(--lime);
  color: var(--ink);
  font-weight: 500;
}

.captions {
  flex: 1;
  min-height: 0;
  margin-top: 1.25rem;
  padding: 0.5rem 1.125rem;
  overflow-y: auto;
  border: 0.5px solid var(--rule);
  border-radius: 8px;
  background: var(--ground);
}

.empty {
  max-width: 28rem;
  margin: 3rem auto;
  text-align: center;
  font-size: 0.875rem;
  color: var(--text-faint);
}

.line {
  display: grid;
  grid-template-columns: 5.25rem minmax(0, 1fr);
  gap: 0.75rem;
  padding: 0.5rem 0;
}

.line__time {
  padding-top: 0.3125rem;
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  font-variant-numeric: tabular-nums;
  color: var(--text-faint);
}

.line__body {
  font-size: 1rem;
  overflow-wrap: anywhere;
}

.line__who {
  margin-right: 0.5rem;
  font-weight: 600;
}

.line__more {
  display: block;
  margin-top: 0.125rem;
  font-size: 0.8125rem;
  color: var(--text-faint);
}

.line[data-kind='said'] .line__who {
  color: var(--purple-text);
}

/* The voice is still on this line. */
.line[data-open] .line__text::after {
  content: '';
  display: inline-block;
  width: 0.4375rem;
  height: 0.4375rem;
  margin-left: 0.375rem;
  border-radius: 50%;
  background: var(--lime);
  animation: speaking 1s ease-in-out infinite;
}

@keyframes speaking {
  0%,
  100% {
    opacity: 0.25;
  }
  50% {
    opacity: 1;
  }
}

.line[data-kind='did'] .line__body,
.line[data-kind='note'] .line__body {
  font-size: 0.875rem;
  color: var(--text-soft);
}

.line[data-kind='did'] .line__body {
  padding-left: 0.75rem;
  border-left: 2px solid var(--purple);
}

.line[data-kind='note'] .line__body {
  color: var(--text-faint);
}

/* ── Lists in the side column ───────────────────────────────────────────── */

.add {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr) auto;
  align-items: end;
  gap: 0.625rem;
  margin-top: 1.25rem;
}

.plus {
  display: grid;
  place-items: center;
  width: 2.75rem;
  height: 2.75rem;
  padding: 0;
  border: 0;
  border-radius: 4px;
  background: var(--lime);
  color: var(--ink);
  cursor: pointer;
  transition: filter 0.15s ease, transform 0.15s ease;
}

.plus svg {
  width: 1.125rem;
  height: 1.125rem;
}

.rows {
  display: grid;
  gap: 0.5rem;
  margin-top: 1.25rem;
}

.rows:empty {
  display: none;
}

.row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.625rem 0.75rem;
  border: 0.5px solid var(--rule-strong);
  border-radius: 8px;
  background: var(--row);
}

.row--stack {
  display: block;
  padding: 0.75rem 0.875rem;
}

.row__text {
  display: grid;
  flex: 1;
  min-width: 0;
}

.row__title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.35;
}

.row__sub {
  font-size: 0.8125rem;
  font-variant-numeric: tabular-nums;
  color: var(--text-faint);
}

.row__sub[data-busy]::before {
  content: '';
  display: inline-block;
  width: 0.625rem;
  height: 0.625rem;
  margin-right: 0.4375rem;
  border: 2px solid var(--lime);
  border-right-color: transparent;
  border-radius: 50%;
  vertical-align: -1px;
  animation: turning 0.8s linear infinite;
}

@keyframes turning {
  to {
    transform: rotate(360deg);
  }
}

.badge {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: 2.25rem;
  height: 2.25rem;
  border: 0.5px solid var(--lime-rule);
  border-radius: 8px;
  background: var(--lime-wash);
  color: var(--lime);
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 800;
  line-height: 1;
}

.badge--live {
  border-color: var(--lime);
  background: var(--lime);
  color: var(--ink);
}

.tag {
  flex-shrink: 0;
  padding: 0.1875rem 0.5rem;
  border: 0.5px solid var(--rule-strong);
  border-radius: 3px;
  font-family: var(--font-mono);
  font-size: 0.625rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-faint);
}

.icon {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: 2rem;
  height: 2rem;
  padding: 0;
  border: 0;
  border-radius: 4px;
  background: none;
  color: var(--text-faint);
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.icon:hover {
  background: var(--rule);
  color: var(--warm);
}

.icon svg {
  width: 1rem;
  height: 1rem;
}

.items {
  display: grid;
  gap: 0.25rem;
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 0.5px solid var(--rule-strong);
  font-size: 0.875rem;
  color: var(--text-soft);
  counter-reset: item;
}

.items li {
  display: grid;
  grid-template-columns: 1.375rem minmax(0, 1fr);
  align-items: baseline;
  counter-increment: item;
}

.items li::before {
  content: counter(item);
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  color: var(--text-faint);
}

.facts {
  margin-top: 1.25rem;
  font-size: 0.875rem;
}

.facts dt:not(:first-child) {
  margin-top: 1rem;
}

.facts dt {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-faint);
}

.facts dd {
  display: flex;
  align-items: baseline;
  gap: 0.625rem;
  margin-top: 0.25rem;
  overflow-wrap: anywhere;
}

.facts dd .quiet {
  flex-shrink: 0;
}

/* ── Minutes ────────────────────────────────────────────────────────────── */

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1.25rem;
}

.tabs button {
  padding: 0.375rem 0.75rem;
  border: 1px solid var(--field);
  border-radius: 4px;
  background: none;
  font-size: 0.8125rem;
  color: var(--text-soft);
  cursor: pointer;
}

.tabs button:hover {
  color: var(--warm);
}

.tabs button[aria-selected='true'] {
  border-color: var(--lime);
  background: var(--lime);
  color: var(--ink);
  font-weight: 500;
}

.past__more {
  margin-top: 0.75rem;
}

.past__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 1.25rem;
}

/* Minutes or captions: which part of the chosen call the sheet shows. */
.reads {
  display: flex;
  gap: 1.25rem;
}

.reads button {
  padding: 0 0 0.375rem;
  border: 0;
  border-bottom: 2px solid transparent;
  background: none;
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-faint);
  cursor: pointer;
}

.reads button:hover {
  color: var(--warm);
}

.reads button[aria-selected='true'] {
  border-color: var(--lime);
  color: var(--warm);
}

.sheet {
  display: grid;
  gap: 0.75rem;
  max-height: 32rem;
  margin-top: 0.75rem;
  padding: 1.25rem 1.5rem 1.5rem;
  overflow: auto;
  border: 0.5px solid var(--rule);
  border-radius: 8px;
  background: var(--ground);
  line-height: 1.6;
  overflow-wrap: anywhere;
  color: var(--text-soft);
}

.sheet h3 {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--warm);
}

.sheet h4 {
  margin-top: 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  font-weight: 400;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--lime);
}

.sheet ul {
  display: grid;
  gap: 0.375rem;
}

.sheet li {
  padding-left: 0.875rem;
  border-left: 2px solid var(--rule-strong);
}

/* A finished call's captions read as the live ones do. */
.sheet[data-reading='captions'] {
  gap: 0;
  padding-block: 0.5rem;
  color: var(--warm);
}

/* ── Narrow screens: one column, the call first ─────────────────────────── */

@media (max-width: 64rem) {
  .desk {
    grid-template-columns: minmax(0, 1fr);
  }

  .call {
    height: auto;
    min-height: 0;
  }

  .captions {
    flex: none;
    height: 24rem;
    max-height: 60dvh;
  }
}

@media (max-width: 40rem) {
  :root {
    --gap: 1rem;
  }

  .panel {
    padding: 1.25rem 1rem;
  }

  .bar__name {
    display: none;
  }

  .line {
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
  }

  .oncall__line {
    flex-wrap: wrap;
  }

  .sheet {
    padding: 1rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
  }

  .button:hover:not(:disabled),
  .button:active:not(:disabled),
  .plus:hover:not(:disabled),
  .plus:active:not(:disabled) {
    transform: none;
  }

  .line[data-open] .line__text::after {
    animation: none;
    opacity: 1;
  }

  .row__sub[data-busy]::before {
    animation: none;
    border-right-color: var(--lime);
  }
}
