/* 0Tell Admin console — design tokens and components translated 1:1 from
   the approved workspace design (docs/0tell-admin-workspace UI.zip):
   isabelline canvas, eerie-black ink, brunswick-green primary, prussian-blue
   frame, earth-yellow warning, rosewood critical, 6px radius everywhere. */

:root {
  --canvas: #F2EDE9;
  --ink: #1E1C1B;
  --primary: #1E5953;
  --primary-dark: #16443F;
  --primary-edge: #2B736B;
  --accent: #58A89F;
  --frame: #1B2A3D;
  --warning: #D4A14A;
  --critical: #590202;
  --radius: 6px;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-sans);
  background: var(--canvas);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  font-size: 14px;
  line-height: 1.45;
}
::selection { background: rgba(30, 89, 83, .2); color: var(--ink); }
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--canvas); }
::-webkit-scrollbar-thumb { background: rgba(27, 42, 61, .25); border-radius: 6px; }
::-webkit-scrollbar-thumb:hover { background: rgba(27, 42, 61, .5); }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--primary); }
.mono { font-family: var(--font-mono); }
.tnum { font-variant-numeric: tabular-nums; }
.hidden { display: none !important; }
.ic { width: 16px; height: 16px; flex-shrink: 0; display: inline-block; vertical-align: middle; }
.ic-sm { width: 14px; height: 14px; }
.ic-xs { width: 12px; height: 12px; }
.ic-lg { width: 20px; height: 20px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- top bar ---------- */
.topbar { position: sticky; top: 0; z-index: 40; background: var(--frame); color: #fff; border-bottom: 1px solid rgba(27,42,61,.4); box-shadow: 0 1px 2px rgba(0,0,0,.05); }
.topbar-inner { display: flex; align-items: center; justify-content: space-between; padding: 10px 14px; gap: 8px; }
.topbar-left { display: flex; align-items: center; gap: 12px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.brand-mark { width: 28px; height: 28px; border-radius: var(--radius); background: var(--primary); border: 1px solid var(--primary-edge); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; letter-spacing: .05em; color: #fff; }
.brand-name { font-size: 16px; font-weight: 700; letter-spacing: -.01em; color: #fff; user-select: none; }
.env-badge { display: none; align-items: center; gap: 6px; padding: 2px 8px; font-size: 12px; font-weight: 600; border-radius: var(--radius); border: 1px solid; }
.env-badge.prod { background: rgba(89,2,2,.3); color: #FFD5D5; border-color: var(--critical); }
.env-badge.stage { background: rgba(212,161,74,.3); color: #FFF2D6; border-color: var(--warning); }
.env-badge .ic { color: var(--warning); animation: pulse 2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .45; } }
.icon-btn { background: none; border: 0; padding: 6px; border-radius: var(--radius); color: rgba(255,255,255,.8); cursor: pointer; display: inline-flex; }
.icon-btn:hover { color: #fff; background: rgba(255,255,255,.1); }
.top-search { position: relative; flex: 1; max-width: 448px; margin: 0 12px; }
.top-search .ic { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: rgba(255,255,255,.5); }
.top-search input { width: 100%; padding: 6px 12px 6px 32px; font-size: 12px; background: rgba(255,255,255,.1); color: #fff; border: 1px solid rgba(255,255,255,.2); border-radius: var(--radius); outline: none; }
.top-search input::placeholder { color: rgba(255,255,255,.5); }
.top-search input:disabled { cursor: not-allowed; }
.topbar-right { display: flex; align-items: center; gap: 8px; position: relative; }
.staff-pill { display: flex; align-items: center; gap: 8px; padding: 6px; border-radius: var(--radius); background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.2); color: #fff; cursor: pointer; text-align: left; }
.staff-pill:hover { background: rgba(255,255,255,.15); }
.avatar { width: 24px; height: 24px; border-radius: var(--radius); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 11px; flex-shrink: 0; }
.avatar.gold { background: var(--warning); color: var(--ink); }
.avatar.navy { background: var(--frame); color: #fff; font-family: var(--font-mono); }
.staff-pill-text { display: none; }
.staff-pill-name { font-size: 12px; font-weight: 600; display: flex; align-items: center; gap: 4px; line-height: 1.2; }
.staff-pill-name .ic { color: var(--accent); }
.staff-pill-role { font-size: 10px; color: rgba(255,255,255,.7); font-family: var(--font-mono); line-height: 1; }
.staff-pill > .ic { color: rgba(255,255,255,.6); }
.dropdown { position: absolute; right: 0; top: calc(100% + 6px); width: 256px; background: #fff; color: var(--ink); border-radius: var(--radius); border: 1px solid rgba(27,42,61,.25); box-shadow: 0 20px 25px -5px rgba(0,0,0,.1), 0 8px 10px -6px rgba(0,0,0,.1); padding: 6px 0; z-index: 50; }
.dropdown-head { padding: 6px 12px 8px; border-bottom: 1px solid rgba(27,42,61,.1); background: rgba(242,237,233,.6); }
.dropdown-head strong { display: block; font-size: 12px; }
.dropdown-head span { display: block; font-size: 11px; color: rgba(30,28,27,.7); word-break: break-all; }
.dropdown-head .mfa { margin-top: 4px; display: flex; align-items: center; gap: 6px; font-size: 10px; font-family: var(--font-mono); color: var(--primary); }
.dropdown-item { width: 100%; text-align: left; padding: 8px 12px; font-size: 12px; display: flex; align-items: center; gap: 8px; background: none; border: 0; cursor: pointer; }
.dropdown-item:hover { background: var(--canvas); }

/* ---------- frame ---------- */
.frame { display: flex; height: calc(100vh - 53px); overflow: hidden; }
.sidebar { width: 256px; background: var(--canvas); border-right: 1px solid rgba(27,42,61,.15); display: flex; flex-direction: column; justify-content: space-between; flex-shrink: 0; height: 100%; user-select: none; }
.sidebar-desktop { display: none; }
.sidebar-scroll { padding: 12px; overflow-y: auto; display: flex; flex-direction: column; gap: 24px; }
.nav-label { padding: 0 12px 4px; font-size: 11px; font-weight: 600; color: rgba(30,28,27,.6); text-transform: uppercase; letter-spacing: .05em; }
.nav { display: flex; flex-direction: column; gap: 4px; }
.nav-item { width: 100%; display: flex; align-items: center; justify-content: space-between; padding: 8px 12px; font-size: 12px; font-weight: 500; border-radius: var(--radius); border: 0; background: none; color: var(--ink); cursor: pointer; transition: background-color .15s; text-align: left; }
.nav-item:hover { background: rgba(27,42,61,.1); }
.nav-item .nav-main { display: flex; align-items: center; gap: 10px; }
.nav-item .ic { color: var(--frame); }
.nav-item.active { background: var(--primary); color: #fff; font-weight: 600; box-shadow: 0 1px 2px rgba(0,0,0,.05); }
.nav-item.active .ic { color: #fff; }
.nav-tag { padding: 2px 6px; font-size: 10px; font-family: var(--font-mono); font-weight: 700; border-radius: var(--radius); background: rgba(27,42,61,.1); color: rgba(27,42,61,.7); }
.nav-item.active .nav-tag { background: rgba(255,255,255,.2); color: #fff; }
.sidebar-foot { padding: 12px; border-top: 1px solid rgba(27,42,61,.15); background: rgba(255,255,255,.4); display: flex; flex-direction: column; gap: 8px; }
.scope-card { padding: 8px; border-radius: var(--radius); background: #fff; border: 1px solid rgba(27,42,61,.15); font-size: 11px; }
.scope-row { display: flex; align-items: center; justify-content: space-between; color: var(--frame); font-weight: 500; }
.scope-row span { display: flex; align-items: center; gap: 4px; }
.scope-row .ic { color: var(--primary); }
.scope-row strong { color: var(--ink); font-weight: 600; }
.scope-ok { font-size: 10px; font-family: var(--font-mono); color: var(--primary); }
.scope-card p { margin: 4px 0 0; font-size: 10px; color: rgba(30,28,27,.7); line-height: 1.55; }
.sidebar-version { font-size: 10px; color: rgba(30,28,27,.5); text-align: center; font-family: var(--font-mono); }
.main { flex: 1; overflow-y: auto; padding: 16px 16px 80px; }
.main-inner { max-width: 1280px; margin: 0 auto; display: flex; flex-direction: column; gap: 24px; }

/* drawer (mobile) */
.drawer { position: fixed; inset: 0; z-index: 50; background: rgba(30,28,27,.6); backdrop-filter: blur(4px); display: flex; }
.drawer .sidebar { width: 288px; box-shadow: 0 25px 50px -12px rgba(0,0,0,.25); }

/* mobile bottom nav */
.bottom-nav { position: fixed; bottom: 0; left: 0; right: 0; z-index: 40; background: var(--frame); color: #fff; border-top: 1px solid rgba(27,42,61,.4); padding: 4px 8px; box-shadow: 0 -4px 6px rgba(0,0,0,.08); }
.bottom-nav-inner { display: flex; align-items: center; justify-content: space-around; height: 56px; }
.bottom-item { flex: 1; min-width: 50px; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; background: none; border: 0; color: rgba(255,255,255,.7); cursor: pointer; border-radius: var(--radius); padding: 4px 0; }
.bottom-item:hover { color: #fff; }
.bottom-item.active { color: var(--accent); font-weight: 700; }
.bottom-item span { font-size: 10px; margin-top: 2px; letter-spacing: -.01em; }

/* ---------- page furniture ---------- */
.page-head { display: flex; flex-direction: column; gap: 12px; padding-bottom: 12px; border-bottom: 1px solid rgba(27,42,61,.15); }
.page-head h1 { margin: 0; font-size: 20px; font-weight: 700; letter-spacing: -.02em; }
.page-head p { margin: 2px 0 0; font-size: 12px; color: rgba(30,28,27,.7); }
.section { display: flex; flex-direction: column; gap: 12px; }
.section-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }
.section-title { margin: 0; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; display: flex; align-items: center; gap: 6px; }
.section-title .ic { color: var(--primary); }
.section-note { font-size: 11px; color: rgba(30,28,27,.6); }
.card { background: #fff; border-radius: var(--radius); border: 1px solid rgba(27,42,61,.15); overflow: hidden; box-shadow: 0 1px rgba(0,0,0,.05); }
.card-pad { padding: 16px; }
.table-wrap { overflow-x: auto; }
table.grid { width: 100%; border-collapse: collapse; text-align: left; font-size: 12px; }
table.grid thead { background: var(--canvas); border-bottom: 1px solid rgba(27,42,61,.15); }
table.grid th { padding: 10px 14px; font-weight: 600; white-space: nowrap; }
table.grid td { padding: 10px 14px; vertical-align: middle; }
table.grid tbody tr + tr { border-top: 1px solid rgba(27,42,61,.1); }
table.grid tbody tr:hover { background: rgba(242,237,233,.6); }
table.grid .right { text-align: right; }
.cell-person { display: flex; align-items: center; gap: 10px; }
.cell-sub { display: block; font-size: 10px; color: rgba(30,28,27,.5); font-family: var(--font-mono); }
.cell-mono { font-family: var(--font-mono); color: rgba(30,28,27,.8); white-space: nowrap; }
.cell-muted { font-family: var(--font-mono); color: rgba(30,28,27,.6); font-variant-numeric: tabular-nums; }
.cell-strong { font-weight: 600; color: var(--ink); }
.cell-time { font-size: 11px; color: rgba(30,28,27,.8); white-space: nowrap; }
.cell-strong-navy { font-weight: 700; color: var(--frame); }
.cell-target { font-family: var(--font-mono); font-size: 11px; font-weight: 600; color: var(--critical); }
.cell-reason { font-size: 11px; color: rgba(30,28,27,.8); max-width: 320px; }
.cell-actor-role { display: block; font-size: 10px; color: var(--primary); font-family: var(--font-mono); }
.cell-owner { font-family: var(--font-mono); font-size: 11px; color: var(--primary); font-weight: 600; }
.cell-cap { font-family: var(--font-mono); font-size: 11px; color: var(--frame); }
.cell-cap.dim { color: rgba(30,28,27,.4); }
.empty { padding: 32px; text-align: center; font-size: 12px; color: rgba(30,28,27,.6); }
.role-pill { font-family: var(--font-mono); font-size: 12px; font-weight: 700; color: var(--primary); background: rgba(30,89,83,.1); padding: 2px 8px; border-radius: var(--radius); white-space: nowrap; }
.you-tag { font-size: 10px; font-family: var(--font-mono); color: rgba(30,28,27,.5); }

/* badges */
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 2px 8px; font-size: 12px; border-radius: var(--radius); white-space: nowrap; letter-spacing: -.01em; font-variant-numeric: tabular-nums; border: 1px solid; font-weight: 600; }
.badge.success { background: rgba(30,89,83,.1); color: var(--primary); border-color: rgba(30,89,83,.3); }
.badge.warning { background: rgba(212,161,74,.15); color: #8F641B; border-color: rgba(212,161,74,.4); }
.badge.critical { background: rgba(89,2,2,.1); color: var(--critical); border-color: rgba(89,2,2,.3); }
.badge.info { background: rgba(27,42,61,.1); color: var(--frame); border-color: rgba(27,42,61,.25); }
.badge.neutral { background: rgba(30,28,27,.05); color: var(--ink); border-color: rgba(30,28,27,.2); font-weight: 500; }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; font-weight: 500; border-radius: var(--radius); transition: all .15s; cursor: pointer; white-space: nowrap; user-select: none; border: 1px solid transparent; text-decoration: none; }
.btn:active { transform: scale(.98); }
.btn:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.btn-sm { font-size: 12px; padding: 6px 10px; height: 32px; min-width: 32px; }
.btn-md { font-size: 14px; padding: 8px 14px; height: 36px; min-width: 36px; }
.btn-lg { font-size: 15px; padding: 10px 20px; height: 44px; width: 100%; }
.btn-primary { background: var(--primary); color: #fff; border-color: var(--primary-dark); box-shadow: 0 1px 2px rgba(0,0,0,.05); }
.btn-primary:hover:not(:disabled) { background: var(--primary-dark); }
.btn-secondary { background: #fff; color: var(--ink); border-color: rgba(27,42,61,.25); box-shadow: 0 1px 2px rgba(0,0,0,.05); }
.btn-secondary:hover:not(:disabled) { background: var(--canvas); }
.btn-critical { background: var(--critical); color: #fff; border-color: #430101; }
.btn-critical:hover:not(:disabled) { background: #430101; }
.btn-warning { background: var(--warning); color: var(--ink); border-color: #B3832B; font-weight: 600; }
.btn-warning:hover:not(:disabled) { background: #BC8C36; }
.btn-ghost { background: transparent; color: var(--frame); }
.btn-ghost:hover:not(:disabled) { background: rgba(27,42,61,.1); }
.link-btn { background: none; border: 0; padding: 0; color: var(--primary); font-size: 12px; font-weight: 500; cursor: pointer; }
.link-btn:hover { text-decoration: underline; }

/* filter bar */
.filter-bar { display: flex; flex-direction: column; gap: 12px; background: #fff; padding: 12px; border-radius: var(--radius); border: 1px solid rgba(27,42,61,.15); box-shadow: 0 1px rgba(0,0,0,.05); }
.filter-search { position: relative; flex: 1; max-width: 384px; }
.filter-search .ic { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: rgba(30,28,27,.4); }
.filter-search input { width: 100%; padding: 6px 12px 6px 32px; font-size: 12px; background: var(--canvas); border: 1px solid rgba(27,42,61,.2); border-radius: var(--radius); outline: none; }
.filter-search input:focus, .filter-select:focus { box-shadow: 0 0 0 1px var(--primary); }
.filter-right { display: flex; align-items: center; gap: 8px; }
.filter-right span { font-size: 12px; font-weight: 500; color: rgba(30,28,27,.7); }
.filter-select { padding: 4px 10px; font-size: 12px; background: var(--canvas); border: 1px solid rgba(27,42,61,.2); border-radius: var(--radius); outline: none; }
.load-more { display: flex; justify-content: center; padding: 12px; border-top: 1px solid rgba(27,42,61,.1); }

/* forms */
.form { display: flex; flex-direction: column; gap: 16px; font-size: 12px; }
.field label { display: block; font-weight: 600; margin-bottom: 4px; }
.field .hint { margin-top: 4px; font-size: 11px; color: rgba(30,28,27,.6); }
.input, .select, .textarea { width: 100%; padding: 6px 12px; background: #fff; border: 1px solid rgba(27,42,61,.25); border-radius: var(--radius); font-size: 12px; outline: none; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary); }
.textarea { min-height: 64px; resize: vertical; }
.input-lg { padding: 9px 12px; font-size: 14px; }
.code-input { font-family: var(--font-mono); font-size: 22px; letter-spacing: .35em; text-align: center; padding: 10px 12px; }
.note { padding: 12px; background: rgba(27,42,61,.05); border: 1px solid rgba(27,42,61,.15); border-radius: var(--radius); font-size: 11px; color: rgba(30,28,27,.8); line-height: 1.55; }
.note strong { color: var(--frame); }
.note.warn { background: rgba(212,161,74,.12); border-color: rgba(212,161,74,.4); }
.note.bad { background: rgba(89,2,2,.07); border-color: rgba(89,2,2,.3); color: var(--critical); }
.form-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 8px; padding-top: 8px; border-top: 1px solid rgba(27,42,61,.1); }
.form-actions.split { justify-content: space-between; }
.error-text { font-size: 12px; color: var(--critical); font-weight: 500; }
.secret-box { font-family: var(--font-mono); font-size: 15px; font-weight: 600; letter-spacing: .08em; word-spacing: .3em; background: var(--canvas); border: 1px solid rgba(27,42,61,.2); border-radius: var(--radius); padding: 12px; text-align: center; word-break: break-word; }
.secret-box.big { font-size: 22px; letter-spacing: .12em; }
.row-actions { display: flex; flex-wrap: wrap; gap: 8px; }

/* modal */
.overlay { position: fixed; inset: 0; z-index: 60; display: flex; align-items: flex-start; justify-content: center; padding: 16px; background: rgba(30,28,27,.6); backdrop-filter: blur(4px); overflow-y: auto; }
.modal { width: 100%; max-width: 512px; background: #fff; border-radius: var(--radius); border: 1px solid rgba(27,42,61,.25); box-shadow: 0 20px 25px -5px rgba(0,0,0,.1), 0 8px 10px -6px rgba(0,0,0,.1); margin: 32px 0; overflow: hidden; }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 16px; border-bottom: 1px solid rgba(27,42,61,.15); background: rgba(242,237,233,.6); }
.modal-head h2 { margin: 0; font-size: 16px; font-weight: 600; }
.modal-head p { margin: 2px 0 0; font-size: 12px; color: rgba(30,28,27,.7); }
.modal-close { background: none; border: 0; padding: 6px; border-radius: var(--radius); color: rgba(30,28,27,.6); cursor: pointer; display: inline-flex; }
.modal-close:hover { color: var(--ink); background: rgba(27,42,61,.1); }
.modal-body { padding: 16px; max-height: calc(85vh - 120px); overflow-y: auto; }

/* auth screens */
.auth-wrap { min-height: calc(100vh - 53px); display: flex; align-items: flex-start; justify-content: center; padding: 48px 16px; }
.auth-card { width: 100%; max-width: 420px; }
.auth-card .modal { margin: 0; }
.auth-card .modal-body { max-height: none; overflow: visible; }
.auth-foot { margin-top: 16px; text-align: center; font-size: 11px; color: rgba(30,28,27,.55); line-height: 1.55; }
.steps { display: flex; gap: 6px; margin-bottom: 16px; }
.steps span { flex: 1; height: 4px; border-radius: 2px; background: rgba(27,42,61,.15); }
.steps span.on { background: var(--primary); }

/* placeholder pages */
.stage-card { display: flex; gap: 14px; align-items: flex-start; }
.stage-icon { width: 40px; height: 40px; border-radius: var(--radius); background: rgba(30,89,83,.1); color: var(--primary); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.stage-card h2 { margin: 0 0 4px; font-size: 14px; }
.stage-card p { margin: 0; font-size: 12px; color: rgba(30,28,27,.75); line-height: 1.6; }
.stage-card ul { margin: 8px 0 0; padding-left: 18px; font-size: 12px; color: rgba(30,28,27,.8); line-height: 1.7; }

/* toast */
.toast { position: fixed; right: 16px; bottom: 80px; z-index: 70; background: var(--ink); color: #fff; font-size: 12px; padding: 8px 12px; border-radius: var(--radius); box-shadow: 0 10px 15px -3px rgba(0,0,0,.2); max-width: calc(100vw - 32px); }
.toast.bad { background: var(--critical); }
.loading { padding: 24px; text-align: center; font-size: 12px; color: rgba(30,28,27,.6); }

/* ---------- breakpoints (Tailwind sm/md/lg) ---------- */
@media (min-width: 640px) {
  .topbar-inner { padding: 10px 24px; }
  .env-badge { display: inline-flex; }
  .staff-pill { padding: 4px 10px; }
  .staff-pill-text { display: block; }
  .page-head { flex-direction: row; align-items: center; justify-content: space-between; }
  .filter-bar { flex-direction: row; align-items: center; justify-content: space-between; }
  .main { padding: 24px 24px 80px; }
}
@media (min-width: 768px) {
  .sidebar-desktop { display: flex; }
  .bottom-nav, .menu-toggle { display: none !important; }
  .main { padding-bottom: 32px; }
  .toast { bottom: 16px; }
}
@media (min-width: 1024px) {
  .main { padding: 32px; }
}
