/* ==========================================================================
   Kiosk Wall — admin portal
   --------------------------------------------------------------------------
   Palette is the brief's: white surfaces, #194d6d for every action and accent,
   near-black type on light, white on dark. Inter throughout. The neutral ramp
   is tinted very slightly toward the brand blue so greys sit beside it without
   looking muddy.
   ========================================================================== */

[hidden] { display: none !important; }

:root {
  --brand: #194d6d;
  --brand-dark: #123a53;
  --brand-tint: #eaf1f6;
  --brand-tint-strong: #d3e2ec;

  --ink: #000000;
  --ink-soft: #33424d;
  --ink-mute: #64748b;
  --ink-faint: #8b98a5;

  --surface: #ffffff;
  --canvas: #f6f8f9;
  --line: #dde4e9;
  --line-soft: #eaeef1;

  --ok: #147a63;
  --ok-bg: #e6f6f1;
  --warn: #8a5a00;
  --warn-bg: #fdf3e0;
  --bad: #a52a1f;
  --bad-bg: #fdeeec;
  --bad-line: #f4c9c3;

  --ring: 0 0 0 3px rgba(25, 77, 109, 0.24);
  --sh-1: 0 1px 2px rgba(16, 32, 44, 0.06);
  --sh-2: 0 4px 12px -3px rgba(16, 32, 44, 0.12);
  --sh-3: 0 18px 46px -12px rgba(16, 32, 44, 0.24);

  --radius: 10px;
}

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

html, body { margin: 0; min-height: 100%; }

body {
  background: var(--canvas);
  color: var(--ink);
  font: 400 14px/1.55 "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* Hide the shell until the session check resolves, so a signed-in
   administrator never sees the sign-in form flash past. */
body.is-booting { visibility: hidden; }

h1, h2, h3 { margin: 0; letter-spacing: -0.015em; color: var(--ink); }
h1 { font-size: 26px; font-weight: 600; }
h2 { font-size: 17px; font-weight: 600; }
p { margin: 0; }

button, input, textarea, select { font: inherit; color: inherit; }
button:not(:disabled) { cursor: pointer; }

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

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.lede { color: var(--ink-mute); }
.hint { color: var(--ink-faint); font-size: 12.5px; margin-bottom: 12px; }
.spacer { flex: 1; }
code { font-family: ui-monospace, "SFMono-Regular", Menlo, monospace; font-size: 0.92em; }

/* --------------------------------------------------------------------------
   Controls
   ----------------------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 38px;
  padding: 8px 15px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: none;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
  transition: background 140ms ease, border-color 140ms ease, color 140ms ease;
}

.btn:focus-visible,
.iconbtn:focus-visible,
.tab:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible { outline: 0; box-shadow: var(--ring); }

.btn--primary { background: var(--brand); color: #fff; }
.btn--primary:hover:not(:disabled) { background: var(--brand-dark); }

.btn--quiet { border-color: var(--line); background: var(--surface); color: var(--ink-soft); box-shadow: var(--sh-1); }
.btn--quiet:hover:not(:disabled) { background: var(--brand-tint); border-color: var(--brand-tint-strong); color: var(--brand); }

.btn--danger { border-color: var(--bad-line); background: var(--bad-bg); color: var(--bad); }
.btn--danger:hover:not(:disabled) { background: #fbe0dc; }

.btn--block { width: 100%; }
.btn--sm { min-height: 32px; padding: 5px 11px; font-size: 12.5px; }
.btn:disabled { opacity: 0.55; cursor: default; }

.iconbtn {
  display: grid; place-items: center;
  width: 38px; height: 38px;
  border: 0; border-radius: 8px;
  background: none; color: var(--ink-mute); font-size: 22px; line-height: 1;
}
.iconbtn:hover { background: var(--line-soft); color: var(--ink); }

.mark {
  display: grid; place-items: center;
  width: 40px; height: 40px;
  border-radius: 10px;
  background: var(--brand); color: #fff;
  font-weight: 700; font-size: 13px; letter-spacing: 0.04em;
}

.avatar {
  display: grid; place-items: center;
  flex: 0 0 34px; height: 34px;
  border-radius: 50%;
  background: var(--brand-tint); color: var(--brand);
  font-weight: 600; font-size: 12px;
}

/* --------------------------------------------------------------------------
   Sign in
   ----------------------------------------------------------------------- */

.signin {
  min-height: 100dvh;
  display: grid;
  place-content: center;
  gap: 20px;
  padding: 28px;
  background:
    radial-gradient(circle at 15% 10%, var(--brand-tint), transparent 42%),
    linear-gradient(160deg, #fbfcfd, var(--canvas));
}

.signin__brand { display: flex; align-items: center; gap: 12px; }
.signin__wordmark { display: grid; }
.signin__wordmark strong { font-size: 16px; font-weight: 600; }
.signin__wordmark small { color: var(--ink-mute); font-size: 12px; }

.signin__card {
  width: min(420px, 100%);
  display: grid;
  gap: 16px;
  padding: 32px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: var(--sh-3);
}

.signin__card h1 { font-size: 22px; }
.signin__card .lede { margin-top: -10px; }

.callout {
  display: grid; gap: 4px;
  padding: 12px 14px;
  border-radius: 8px;
  font-size: 13px;
}
.callout--info { background: var(--brand-tint); color: var(--brand-dark); }
.callout p { color: inherit; }

/* --------------------------------------------------------------------------
   Shell: app bar, context bar, content
   ----------------------------------------------------------------------- */

.shell { min-height: 100dvh; display: flex; flex-direction: column; }

/* App bar ---------------------------------------------------------------- */

.appbar {
  position: sticky; top: 0; z-index: 30;
  display: grid;
  grid-template-columns: minmax(150px, 1fr) auto minmax(150px, 1fr);
  align-items: center;
  gap: 20px;
  padding: 12px 28px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.appbar__brand { display: flex; align-items: center; gap: 11px; text-decoration: none; color: inherit; }
.appbar__wordmark { display: grid; }
.appbar__wordmark strong { font-size: 15px; font-weight: 600; letter-spacing: -0.01em; }
.appbar__wordmark small { color: var(--ink-mute); font-size: 11px; }

/* Pill navigation. The active tab is filled; the rest are outlined, which
   reads as a set of equal choices rather than a list with one highlight. */
.tabs { display: flex; align-items: center; gap: 12px; justify-self: center; }

.tab {
  min-height: 44px;
  padding: 10px 30px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink-soft);
  font-size: 15px;
  font-weight: 500;
  white-space: nowrap;
  transition: background 150ms ease, color 150ms ease, border-color 150ms ease;
}

.tab:hover:not(.is-active) { background: var(--brand-tint); border-color: var(--brand-tint-strong); color: var(--brand); }
.tab.is-active { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 600; }
.tab:focus-visible { outline: 0; box-shadow: var(--ring); }

/* Account -------------------------------------------------------------- */

.account { position: relative; justify-self: end; }

.account__btn {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 10px;
  border: 0; border-radius: 9px;
  background: none;
  text-align: right;
}
.account__btn:hover { background: var(--canvas); }
.account__btn:focus-visible { outline: 0; box-shadow: var(--ring); }

.account__copy { display: grid; min-width: 0; }
.account__copy strong { font-size: 15px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.account__copy small { color: var(--ink-mute); font-size: 12px; text-transform: capitalize; }

.account__chev { width: 18px; height: 18px; fill: none; stroke: var(--ink-mute); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.account__btn[aria-expanded="true"] .account__chev { transform: rotate(180deg); }

.account__menu {
  position: absolute; right: 0; top: calc(100% + 8px);
  z-index: 40;
  min-width: 190px;
  display: grid;
  padding: 6px;
  border: 1px solid var(--line); border-radius: 10px;
  background: var(--surface);
  box-shadow: var(--sh-3);
}

.account__item {
  padding: 10px 12px;
  border: 0; border-radius: 7px;
  background: none;
  color: var(--ink-soft);
  font-size: 13.5px; font-weight: 500;
  text-align: left;
}
.account__item:hover { background: var(--brand-tint); color: var(--brand); }

/* Context bar ----------------------------------------------------------- */

.crumbbar {
  position: sticky; top: 69px; z-index: 25;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  min-height: 46px;
  padding: 6px 28px;
  background: var(--brand);
  color: #fff;
}

.crumbbar__trail { display: flex; align-items: center; gap: 10px; min-width: 0; }
.crumbbar__trail strong { font-size: 14.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.crumbbar__home { width: 18px; height: 18px; fill: currentColor; }
.crumbbar__sep { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; opacity: 0.7; }

.crumbbar__picker { flex: 0 1 280px; min-width: 0; }
.crumbbar__picker select {
  width: 100%;
  min-height: 34px;
  padding: 5px 10px;
  border: 1px solid rgba(255, 255, 255, 0.36);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  font-size: 13px;
  box-shadow: none;
}
/* Native option lists render on the OS surface, so they need readable colours
   of their own rather than inheriting the bar's white-on-brand. */
.crumbbar__picker select option { color: var(--ink); background: var(--surface); }
.crumbbar__picker select:focus-visible { outline: 0; box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.42); }

/* Content --------------------------------------------------------------- */

.content { flex: 1; width: min(1440px, 100%); margin: 0 auto; padding: 26px 28px 72px; }
.pagehead { margin-bottom: 20px; display: grid; gap: 5px; }

.view { animation: rise 180ms ease; }
@keyframes rise { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: none; } }

/* --------------------------------------------------------------------------
   Toasts
   ----------------------------------------------------------------------- */

.toasts { display: grid; gap: 8px; margin-bottom: 16px; }
.toasts:empty { display: none; }

.toast {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 11px 14px;
  border: 1px solid transparent; border-radius: 8px;
  font-size: 13.5px;
  animation: rise 160ms ease;
}
.toast--success { background: var(--ok-bg); border-color: #bfe5d9; color: var(--ok); }
.toast--error { background: var(--bad-bg); border-color: var(--bad-line); color: var(--bad); }
.toast--info { background: var(--brand-tint); border-color: var(--brand-tint-strong); color: var(--brand-dark); }

.message { min-height: 0; margin: 0; font-size: 13px; }
.message:empty { display: none; }
.message--error { color: var(--bad); }

/* --------------------------------------------------------------------------
   Bars and blanks
   ----------------------------------------------------------------------- */

.bar { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.bar__count { color: var(--ink-mute); font-size: 13px; }
.bar__tools { display: flex; align-items: center; gap: 10px; }

.search input, .bar__tools select, .picker select, .panel__actions select {
  min-height: 38px; padding: 8px 11px;
  border: 1px solid var(--line); border-radius: 8px;
  background: var(--surface); box-shadow: var(--sh-1);
}
.search input { width: 210px; }

.selectbar {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  margin-bottom: 14px; padding: 10px 14px;
  border: 1px solid var(--brand-tint-strong); border-radius: 8px;
  background: var(--brand-tint); color: var(--brand-dark);
}
.selectbar__actions { display: flex; flex-wrap: wrap; gap: 8px; }
.selectbar .btn { min-height: 32px; padding: 5px 11px; font-size: 12.5px; }

.blank {
  display: grid; place-items: center; gap: 8px;
  padding: 56px 24px;
  border: 1px dashed var(--line); border-radius: 12px;
  background: var(--surface); text-align: center;
}
.blank p { color: var(--ink-mute); margin-bottom: 8px; }

/* --------------------------------------------------------------------------
   Cards
   ----------------------------------------------------------------------- */

.grid { display: grid; gap: 16px; }
.grid--projects { grid-template-columns: repeat(auto-fill, minmax(304px, 1fr)); }
.grid--media { grid-template-columns: repeat(auto-fill, minmax(232px, 1fr)); }

.card {
  display: flex; flex-direction: column;
  border: 1px solid var(--line); border-radius: 12px;
  background: var(--surface); box-shadow: var(--sh-1);
  overflow: hidden;
  transition: box-shadow 160ms ease, transform 160ms ease, border-color 160ms ease;
}
.card:hover { box-shadow: var(--sh-2); border-color: var(--brand-tint-strong); }

.card__body { display: grid; gap: 10px; padding: 18px; }
.card__top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.card__desc { color: var(--ink-mute); font-size: 13px; min-height: 20px; }

.card__meta { display: grid; gap: 7px; padding-top: 12px; border-top: 1px solid var(--line-soft); font-size: 12px; }
.card__row { display: flex; align-items: center; justify-content: space-between; gap: 10px; color: var(--ink-mute); }
.card__row strong { color: var(--ink-soft); font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.card__actions { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 4px; }
.card__actions .btn { min-height: 32px; padding: 5px 11px; font-size: 12.5px; }

.tag {
  display: inline-flex; align-items: center; gap: 6px;
  flex: 0 0 auto;
  padding: 3px 9px; border-radius: 999px;
  font-size: 11px; font-weight: 600; letter-spacing: 0.01em;
}
.tag::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.tag--active { background: var(--ok-bg); color: var(--ok); }
.tag--archived { background: var(--line-soft); color: var(--ink-mute); }
.tag--draft { background: var(--warn-bg); color: var(--warn); }

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

.mediacard { position: relative; }
.mediacard[draggable="true"] { cursor: grab; }
.mediacard.is-dragging { opacity: 0.4; }
.mediacard.is-dropbefore { box-shadow: -3px 0 0 0 var(--brand); }
.mediacard.is-dropafter { box-shadow: 3px 0 0 0 var(--brand); }
.mediacard.is-selected { border-color: var(--brand); box-shadow: 0 0 0 1px var(--brand); }

.mediacard__thumb {
  position: relative;
  aspect-ratio: 4 / 3;
  background: var(--line-soft);
}
.mediacard__thumb img,
.mediacard__thumb video { width: 100%; height: 100%; object-fit: cover; display: block; }

.mediacard__pick {
  position: absolute; top: 10px; left: 10px;
  width: 20px; height: 20px;
  accent-color: var(--brand);
  cursor: pointer;
}
.mediacard__thumb .tag { position: absolute; top: 10px; right: 10px; background: rgba(255,255,255,0.94); }
.mediacard__count {
  position: absolute; bottom: 10px; right: 10px;
  padding: 2px 8px; border-radius: 999px;
  background: rgba(12, 22, 30, 0.72); color: #fff;
  font-size: 11px; font-weight: 500;
}

.mediacard__caption {
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
  color: var(--ink-mute); font-size: 13px; min-height: 20px;
}

/* --------------------------------------------------------------------------
   Panels and forms
   ----------------------------------------------------------------------- */

.panel { border: 1px solid var(--line); border-radius: 12px; background: var(--surface); box-shadow: var(--sh-1); }
.panel--narrow { max-width: 560px; }

.panel__head {
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  padding: 18px 22px;
  border-bottom: 1px solid var(--line-soft);
}
.panel__head p { color: var(--ink-mute); font-size: 13px; }
.panel__actions { display: flex; align-items: center; gap: 8px; }

.settings { display: grid; grid-template-columns: 176px minmax(0, 880px); align-items: start; gap: 20px; }

.settings__nav {
  position: sticky; top: 88px;
  display: grid; gap: 2px; padding: 8px;
  border: 1px solid var(--line); border-radius: 10px; background: var(--surface);
}
.settings__nav a { padding: 8px 11px; border-radius: 7px; color: var(--ink-soft); font-weight: 500; text-decoration: none; font-size: 13px; }
.settings__nav a:hover { background: var(--brand-tint); color: var(--brand); }

.settings__body { display: grid; gap: 16px; }

.fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; padding: 20px 22px; }
.panel > .fields { padding: 20px 22px; }
.field--wide { grid-column: 1 / -1; }

.field { display: grid; gap: 6px; margin: 0; font-size: 13px; font-weight: 500; color: var(--ink-soft); }
.field > span:first-child { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.field small { color: var(--ink-faint); font-weight: 400; }

.field input,
.field textarea,
.field select {
  width: 100%;
  min-height: 38px;
  padding: 8px 11px;
  border: 1px solid var(--line); border-radius: 8px;
  background: var(--surface); color: var(--ink);
  box-shadow: var(--sh-1);
  font-weight: 400;
}
.field textarea { resize: vertical; line-height: 1.5; }
.field input[type="color"] { height: 40px; padding: 4px; cursor: pointer; }
.field select[multiple] { min-height: 120px; padding: 6px; }

.suffixed { display: flex; }
.suffixed input { border-radius: 8px 0 0 8px; }
.suffixed > span {
  display: grid; place-items: center; min-width: 52px;
  padding: 0 10px;
  border: 1px solid var(--line); border-left: 0; border-radius: 0 8px 8px 0;
  background: var(--canvas); color: var(--ink-mute); font-size: 12.5px; font-weight: 400;
}

/* Live sample of whichever family is typed into a font field. */
.preview {
  padding: 7px 11px;
  border: 1px dashed var(--line); border-radius: 7px;
  background: var(--canvas);
  color: var(--ink-soft); font-size: 15px; font-weight: 400;
}

.stickybar {
  position: sticky; bottom: 14px;
  display: flex; justify-content: flex-end; gap: 10px;
  padding: 11px;
  border: 1px solid var(--line); border-radius: 10px;
  background: rgba(255, 255, 255, 0.95);
  box-shadow: var(--sh-2);
  backdrop-filter: blur(8px);
}

.switch {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 13px 14px;
  border: 1px solid var(--line); border-radius: 10px;
}
.switch > span { display: grid; }
.switch small { color: var(--ink-mute); }
.switch input { width: 40px; height: 20px; accent-color: var(--brand); }

/* Brand asset preview -------------------------------------------------- */

.asset {
  display: grid; gap: 10px; justify-items: start;
  padding: 14px;
  border: 1px dashed var(--line); border-radius: 10px;
  background: var(--canvas);
}
.asset img {
  max-width: 220px; max-height: 90px;
  background: #fff; padding: 6px; border-radius: 6px; border: 1px solid var(--line);
  object-fit: contain;
}
.asset__controls { display: flex; gap: 8px; }
.asset small { color: var(--ink-faint); font-weight: 400; }

/* Dropzone and source list --------------------------------------------- */

.dropzone {
  display: grid; place-items: center; gap: 6px;
  padding: 26px;
  border: 1.5px dashed var(--line); border-radius: 10px;
  background: var(--canvas); text-align: center;
}
.dropzone.is-over { border-color: var(--brand); background: var(--brand-tint); }
.dropzone strong { font-weight: 600; }
.dropzone small { color: var(--ink-mute); }

.sources { display: grid; gap: 8px; margin: 12px 0 0; padding: 0; list-style: none; }

.source {
  display: flex; align-items: center; gap: 12px;
  padding: 8px 10px;
  border: 1px solid var(--line); border-radius: 8px;
  background: var(--surface);
}
.source__thumb {
  flex: 0 0 46px; width: 46px; height: 46px;
  border-radius: 6px; object-fit: cover; background: var(--line-soft);
}
.source__label { flex: 1; min-width: 0; font-size: 12.5px; color: var(--ink-mute); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.source__tools { display: flex; gap: 4px; }
.source__tools button {
  width: 30px; height: 30px;
  border: 1px solid var(--line); border-radius: 6px;
  background: var(--surface); color: var(--ink-mute); font-size: 13px; line-height: 1;
}
.source__tools button:hover:not(:disabled) { background: var(--brand-tint); color: var(--brand); }
.source__tools button:disabled { opacity: 0.35; }
.source--pending { border-style: dashed; border-color: var(--brand-tint-strong); background: var(--brand-tint); }

.addurl { display: flex; gap: 8px; margin-top: 10px; }
.addurl input {
  flex: 1; min-height: 38px; padding: 8px 11px;
  border: 1px solid var(--line); border-radius: 8px; background: var(--surface);
}

/* --------------------------------------------------------------------------
   Preview
   ----------------------------------------------------------------------- */

.device { padding: 22px; background: var(--canvas); }

/* The stage is measured by the script, which then sets explicit pixel
   dimensions on the frame. Pure CSS could not do this: `aspect-ratio` plus
   `max-height` clamps the height while leaving the width at 100%, so switching
   to portrait changed nothing visible — the frame just stayed full-width and
   72vh tall. */
.device__stage { display: grid; place-items: center; min-height: 220px; }

.device iframe {
  display: block;
  border: 10px solid #101c24;
  border-radius: 14px;
  background: #fff;
  box-shadow: var(--sh-2);
  transition: width 200ms ease, height 200ms ease;
}

/* --------------------------------------------------------------------------
   Users table
   ----------------------------------------------------------------------- */

.tablecard { border: 1px solid var(--line); border-radius: 12px; background: var(--surface); box-shadow: var(--sh-1); overflow: auto; }

table { width: 100%; border-collapse: collapse; text-align: left; }
/* Sortable column header. The arrows show the current direction, and the
   inactive state stays low-contrast so the active column reads at a glance. */
.sorter {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 0; border: 0; background: none;
  color: inherit; font: inherit; letter-spacing: inherit; text-transform: inherit;
}
.sorter:hover { color: var(--brand); }
.sorter:focus-visible { outline: 0; box-shadow: var(--ring); border-radius: 4px; }

.sorter__arrows { display: grid; gap: 2px; }
.sorter__arrows::before,
.sorter__arrows::after {
  content: "";
  width: 0; height: 0;
  border-left: 3.5px solid transparent;
  border-right: 3.5px solid transparent;
  opacity: 0.4;
}
.sorter__arrows::before { border-bottom: 4px solid currentColor; }
.sorter__arrows::after  { border-top: 4px solid currentColor; }

.sorter[data-dir="asc"]  .sorter__arrows::before,
.sorter[data-dir="desc"] .sorter__arrows::after { opacity: 1; }
.sorter[data-dir] { color: var(--brand); }

th {
  padding: 11px 16px;
  background: var(--canvas);
  color: var(--ink-mute);
  font-size: 11px; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase;
  white-space: nowrap;
}
td { padding: 13px 16px; border-top: 1px solid var(--line-soft); color: var(--ink-soft); vertical-align: middle; font-size: 13.5px; }
tbody tr:hover { background: #fbfcfd; }

.identity { display: flex; align-items: center; gap: 10px; }
.identity > span:last-child { display: grid; }
.identity strong { font-weight: 600; color: var(--ink); }
.identity small { color: var(--ink-faint); font-size: 11px; }

.rolechip {
  display: inline-flex; padding: 3px 9px; border-radius: 999px;
  background: var(--brand-tint); color: var(--brand-dark);
  font-size: 11px; font-weight: 600; text-transform: capitalize;
}
.rolechip--super { background: var(--brand); color: #fff; }

.linkbtn { border: 0; background: none; padding: 6px 8px; border-radius: 6px; color: var(--brand); font-weight: 500; }
.linkbtn:hover { background: var(--brand-tint); }

.perms { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; margin: 0; padding: 0; border: 0; }
.perms legend { padding: 0; margin-bottom: 9px; font-weight: 600; font-size: 13px; }
.perms label {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 11px; border: 1px solid var(--line); border-radius: 9px;
  font-size: 13px;
}
.perms label:hover { border-color: var(--brand-tint-strong); background: #fbfcfd; }
.perms input { margin-top: 2px; accent-color: var(--brand); }
.perms span { display: grid; }
.perms small { color: var(--ink-mute); }

/* --------------------------------------------------------------------------
   Dialogs
   ----------------------------------------------------------------------- */

.modal {
  width: min(640px, calc(100vw - 28px));
  max-width: none;
  max-height: calc(100dvh - 40px);
  padding: 0;
  border: 0; border-radius: 14px;
  background: var(--surface);
  box-shadow: var(--sh-3);
}
.modal--wide { width: min(760px, calc(100vw - 28px)); }
.modal--slim { width: min(440px, calc(100vw - 28px)); }
.modal::backdrop { background: rgba(10, 20, 27, 0.55); backdrop-filter: blur(2px); }

.modal__card { display: flex; flex-direction: column; max-height: calc(100dvh - 40px); }
.modal__card > header,
.modal__card > footer {
  display: flex; align-items: center; gap: 10px;
  padding: 16px 20px;
  flex: none;
}
.modal__card > header { justify-content: space-between; border-bottom: 1px solid var(--line-soft); }
.modal__card > footer { justify-content: flex-end; border-top: 1px solid var(--line-soft); background: var(--canvas); }
.modal__body { display: grid; gap: 16px; padding: 20px; overflow: auto; }
.modal__body > .fields { padding: 0; }

/* --------------------------------------------------------------------------
   Responsive
   --------------------------------------------------------------------------
   There is no off-canvas drawer and no hamburger. The pill navigation simply
   scrolls sideways on narrow screens, which removes an entire class of bug:
   the old build shipped mobile-only toggle buttons that stayed visible on the
   desktop because a later `.iconbtn { display: grid }` rule outranked the
   `.only-mobile { display: none }` that was meant to hide them.
   ----------------------------------------------------------------------- */

@media (max-width: 1180px) {
  .appbar { padding: 12px 18px; gap: 12px; }
  .tab { padding: 10px 20px; font-size: 14px; }
  .crumbbar, .content { padding-left: 18px; padding-right: 18px; }
  .settings { grid-template-columns: 148px minmax(0, 1fr); }
}

@media (max-width: 940px) {
  .appbar {
    grid-template-columns: 1fr auto;
    grid-template-areas: "brand account" "tabs tabs";
    row-gap: 10px;
  }
  .appbar__brand { grid-area: brand; }
  .account { grid-area: account; }

  .tabs {
    grid-area: tabs;
    justify-self: stretch;
    overflow-x: auto;
    padding-bottom: 2px;
    gap: 8px;
    scrollbar-width: none;
  }
  .tabs::-webkit-scrollbar { display: none; }
  .tab { flex: 0 0 auto; }

  /* The bar is two rows tall here, so the context strip can no longer be
     pinned beneath a fixed offset. */
  .crumbbar { position: static; }
}

@media (max-width: 820px) {
  .appbar__wordmark { display: none; }
  .crumbbar { flex-wrap: wrap; }
  .crumbbar__picker { flex: 1 1 100%; }

  .content { padding: 20px 14px 56px; }
  .crumbbar { padding-left: 14px; padding-right: 14px; }
  .appbar { padding: 12px 14px; }

  .settings { grid-template-columns: 1fr; }
  .settings__nav { position: static; display: flex; overflow-x: auto; }

  .fields, .perms { grid-template-columns: 1fr; }
  .field--wide { grid-column: auto; }

  .bar { flex-direction: column; align-items: stretch; }
  .bar__tools { flex-direction: column; align-items: stretch; }
  .search input { width: 100%; }

  .grid--projects, .grid--media { grid-template-columns: 1fr; }
}

@media (max-width: 520px) {
  h1 { font-size: 22px; }
  .account__copy { display: none; }
  .modal__card > footer { flex-direction: column-reverse; align-items: stretch; }
  .modal__card > footer .btn { width: 100%; }
  .modal__card > footer .spacer { display: none; }
  .signin__card { padding: 24px 20px; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}
