/* Tapxel Platform's web pages. Tokens follow the app's frontend/css/app.css: warm near-black, cream
   ink, amber accent, one dark theme. Secondary text uses --ink-dim: the app's --ink-mute falls short
   of a readable contrast at these sizes. */
:root {
  --bg: #0a0704;
  --bg-2: #110d09;
  --bg-3: #19140e;
  --panel-solid: #16110c;
  --raise: rgba(255, 242, 222, .045);
  --raise-2: rgba(255, 242, 222, .08);
  --line: rgba(244, 232, 212, .08);
  --line-2: rgba(244, 232, 212, .15);
  --ink: #f4e8d4;
  --ink-dim: #b8a890;
  --amber: #f4b942;
  --jade: #7fb38a;
  --rose: #e07a6c;
  --accent: var(--amber);
  --accent-ink: #160f05;
  --bad-ink: #f4b3a8;
  --r: 12px;
  --r-lg: 18px;
  --bar: 52px;
  --sans: 'Be Vietnam Pro', 'Segoe UI', system-ui, sans-serif;
  --serif: 'Fraunces', Georgia, serif;
  --mono: Consolas, ui-monospace, Menlo, monospace;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; min-height: 100vh; background: var(--bg); color: var(--ink); font: 14px/1.55 var(--sans); -webkit-font-smoothing: antialiased; }
[hidden] { display: none !important; }
h1, h2 { font-family: var(--serif); font-weight: 600; margin: 0; letter-spacing: .005em; }
h1 { font-size: 26px; line-height: 1.2; }
h2 { font-size: 19px; line-height: 1.25; }
h3 { font: 600 14px/1.35 var(--sans); margin: 0; }
p { margin: 0; }
a { color: var(--amber); text-decoration: none; }
a:hover { text-decoration: underline; }
code, .mono { font-family: var(--mono); font-size: 12.5px; }
svg { display: block; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
::selection { background: rgba(244, 185, 66, .35); }
::placeholder { color: #94866f; opacity: 1; }

.hint { color: var(--ink-dim); font-size: 12.5px; }
.lead { color: var(--ink-dim); margin-top: 4px; max-width: 72ch; }
.sub { display: block; font-size: 12px; color: var(--ink-dim); }
.any { overflow-wrap: anywhere; }
.nowrap { white-space: nowrap; }
.grow { flex: 1; min-width: 0; }

/* top bar */
.topbar { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 12px; min-height: var(--bar); padding: 8px 20px;
  background: #0d0a07; border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.mark { width: 22px; height: 22px; flex: none; background: url("brand/mark.svg") center/contain no-repeat; }
.wordmark { font: 700 15px/1 var(--serif); letter-spacing: .2em; }
.wordmark .dot { color: var(--amber); }
.brand-sub { font-size: 12.5px; color: var(--ink-dim); white-space: nowrap; }
.who { font-size: 12.5px; color: var(--ink-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* layout: a top bar over a side list and the working area */
.shell { display: grid; grid-template-columns: 224px minmax(0, 1fr); }
.sidenav { position: sticky; top: var(--bar); align-self: start; height: calc(100vh - var(--bar)); overflow-y: auto; padding: 12px 10px 24px;
  border-right: 1px solid var(--line); }
.sidenav h4 { margin: 16px 10px 6px; font-size: 12px; font-weight: 600; color: var(--ink-dim); }
.sidenav h4:first-child { margin-top: 4px; }
.sidenav a { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 7px 10px; border-radius: 8px; color: var(--ink-dim); font-size: 13.5px; }
.sidenav a:hover { background: var(--raise); color: var(--ink); text-decoration: none; }
.sidenav a.on { background: var(--raise-2); color: var(--ink); }
.sidenav .count { flex: none; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--amber); color: var(--accent-ink); font-size: 11.5px; font-weight: 700; line-height: 20px; text-align: center; }
.content { min-width: 0; max-width: 1280px; padding: 24px 28px 72px; }
.head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 10px 16px; margin-bottom: 16px; }
.head > * { min-width: 0; max-width: 100%; }
.stack > * + * { margin-top: 16px; }
.cols { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); align-items: start; }
.cols > * { min-width: 0; margin-top: 0; }

.card { background: var(--panel-solid); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 18px 20px; min-width: 0; }
.card > h2, .card > h3 { margin-bottom: 10px; }
.card > h2 + .hint, .card > h3 + .hint { margin-top: -6px; margin-bottom: 10px; }

/* tabs */
.tabs { display: flex; gap: 2px; margin: 14px 0 18px; overflow-x: auto; border-bottom: 1px solid var(--line); scrollbar-width: none; }
.tabs a { flex: none; padding: 8px 12px; color: var(--ink-dim); border-bottom: 2px solid transparent; margin-bottom: -1px; font-weight: 500; }
.tabs a:hover { color: var(--ink); text-decoration: none; }
.tabs a.on { color: var(--ink); border-bottom-color: var(--amber); }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 38px; padding: 6px 16px; border-radius: 10px; font: 600 13.5px/1.25 var(--sans);
  background: var(--raise-2); border: 1px solid var(--line-2); color: var(--ink); cursor: pointer; text-align: center; }
.btn:hover:not(:disabled) { background: rgba(255, 242, 222, .12); border-color: rgba(244, 232, 212, .25); text-decoration: none; }
.btn:disabled { opacity: .5; cursor: default; }
.btn.primary { background: var(--accent); border-color: transparent; color: var(--accent-ink); }
.btn.primary:hover:not(:disabled) { background: #f7c864; border-color: transparent; }
.btn.danger { background: rgba(224, 122, 108, .14); border-color: rgba(224, 122, 108, .4); color: var(--bad-ink); }
.btn.danger:hover:not(:disabled) { background: rgba(224, 122, 108, .24); border-color: rgba(224, 122, 108, .55); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--ink-dim); }
.btn.ghost:hover:not(:disabled) { background: var(--raise); border-color: transparent; color: var(--ink); }
.btn.sm { min-height: 30px; padding: 4px 11px; font-size: 12.5px; border-radius: 8px; }
.btn.full { width: 100%; }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 14px; }
/* Side by side when the table has room, stacked when it has not; a button's label never breaks. */
.row-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.row-actions .btn, td > .btn { white-space: nowrap; }

/* forms */
input:not([type=checkbox]):not([type=radio]), select, textarea { width: 100%; min-height: 38px; padding: 8px 12px; border-radius: 10px; background: var(--bg);
  border: 1px solid var(--line-2); color: var(--ink); font: inherit; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }
input:disabled, select:disabled, textarea:disabled, input:read-only:not([type=checkbox]):not([type=radio]) { color: var(--ink-dim); }
textarea { display: block; min-height: 96px; resize: vertical; font: 12.5px/1.5 var(--mono); }
select { appearance: none; padding-right: 30px; background: var(--bg) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M3 4.5l3 3 3-3' fill='none' stroke='%23b8a890' stroke-width='1.5'/%3E%3C/svg%3E") right 10px center/12px no-repeat; }
select { max-width: 100%; }
select option { background: #1d1710; }
input[type=checkbox] { width: 16px; height: 16px; margin: 0; flex: none; accent-color: var(--amber); }
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field > .label { font-size: 12.5px; font-weight: 500; color: var(--ink-dim); }
.check { display: flex; align-items: center; gap: 8px; min-height: 38px; align-self: start; margin-top: 24px; }
.form-grid { display: grid; gap: 12px 14px; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.form-grid .wide { grid-column: 1 / -1; }
.form-err { margin-top: 10px; color: var(--bad-ink); font-size: 13px; }
.inline-form { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px; }
.inline-form .field { flex: 1 1 150px; max-width: 280px; }
details.more { margin-top: 12px; }
details.more > summary { cursor: pointer; font-weight: 600; color: var(--amber); padding: 4px 0; }
details.more[open] > summary { margin-bottom: 10px; }

/* tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { padding: 7px 10px; border-bottom: 1px solid var(--line-2); color: var(--ink-dim); font-size: 12px; font-weight: 500; text-align: left; white-space: nowrap; }
td { padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
tbody tr:last-child td { border-bottom: 0; }
th:first-child, td:first-child { padding-left: 0; }
th:last-child, td:last-child { padding-right: 0; }
th.num, td.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
tr.alert td { background: rgba(224, 122, 108, .07); }
/* Names come from people and may hold a long word: it breaks rather than push the table wider. */
td.name { min-width: 140px; overflow-wrap: anywhere; }
td.url { min-width: 160px; overflow-wrap: anywhere; }
td.scope { min-width: 120px; overflow-wrap: anywhere; }
td.rule { min-width: 180px; }
.empty { padding: 10px 0; color: var(--ink-dim); }
.facts { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.fact { padding: 10px 12px; border-radius: 10px; background: var(--raise); min-width: 0; }
.fact .k { font-size: 12px; color: var(--ink-dim); }
.fact .v { margin-top: 2px; font-weight: 600; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }

/* status */
.chip { display: inline-flex; align-items: center; min-height: 22px; padding: 1px 9px; border-radius: 6px; font-size: 11.5px; font-weight: 500; white-space: nowrap;
  background: var(--raise-2); color: var(--ink-dim); border: 1px solid var(--line); }
.chip.ok { color: var(--jade); border-color: rgba(127, 179, 138, .35); background: rgba(127, 179, 138, .1); }
.chip.warn { color: var(--amber); border-color: rgba(244, 185, 66, .35); background: rgba(244, 185, 66, .1); }
.chip.bad { color: var(--bad-ink); border-color: rgba(224, 122, 108, .35); background: rgba(224, 122, 108, .12); }
.notice { padding: 10px 14px; border-radius: 10px; font-size: 13px; background: rgba(244, 185, 66, .1); border: 1px solid rgba(244, 185, 66, .28); color: #f6d9a0; }
.notice.bad { background: rgba(224, 122, 108, .12); border-color: rgba(224, 122, 108, .32); color: var(--bad-ink); }
.notice.ok { background: rgba(127, 179, 138, .1); border-color: rgba(127, 179, 138, .32); color: #b0d6b9; }
.problem { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }

/* dialogs */
dialog.dlg { width: min(540px, calc(100vw - 32px)); max-height: calc(100vh - 32px); padding: 0; background: #18120c; color: var(--ink); border: 1px solid var(--line-2); border-radius: 16px; box-shadow: 0 30px 80px rgba(0, 0, 0, .6); }
dialog.dlg.wide { width: min(860px, calc(100vw - 32px)); }
dialog.dlg::backdrop { background: rgba(5, 3, 2, .68); }
.dlg-in { padding: 20px 22px; }
.dlg-in > h2 { margin-bottom: 8px; }
.dlg-body { color: var(--ink-dim); margin-bottom: 12px; }
.dlg-body > * + * { margin-top: 8px; }
.dlg-foot { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.dlg .secret { font: 13px/1.5 var(--mono); }
.dlg textarea.secret { min-height: 74px; }

/* messages */
.toasts { position: fixed; right: 20px; bottom: 20px; z-index: 90; display: flex; flex-direction: column; gap: 8px; align-items: flex-end; pointer-events: none; }
.toast { max-width: 420px; padding: 11px 14px; border-radius: 10px; background: #2a2016; border: 1px solid var(--line-2); box-shadow: 0 14px 40px rgba(0, 0, 0, .5); font-size: 13px; }
.toast.ok { border-color: rgba(127, 179, 138, .5); }
.toast.bad { border-color: rgba(224, 122, 108, .55); color: var(--bad-ink); }

/* sign-in */
.signin { max-width: 420px; margin: 0 auto; padding: 8vh 16px 40px; }
.signin h1 { margin-bottom: 4px; }
.signin .card { margin-top: 18px; }
.signin form > * + * { margin-top: 12px; }
.signin .actions { margin-top: 14px; }
.local-note { margin-top: 12px; font-size: 12.5px; color: var(--ink-dim); }

@media (max-width: 860px) {
  .shell { display: block; }
  .sidenav { position: sticky; top: var(--bar); z-index: 20; height: auto; display: flex; gap: 2px; padding: 6px 12px; overflow-x: auto; background: #0d0a07; border-right: 0; border-bottom: 1px solid var(--line); scrollbar-width: none; }
  .sidenav h4 { display: none; }
  .sidenav a { flex: none; white-space: nowrap; padding: 6px 10px; }
  .content { padding: 18px 16px 56px; }
  .card { padding: 16px; }
  .cols { grid-template-columns: minmax(0, 1fr); }
  .topbar { padding: 8px 16px; }
  .toasts { left: 16px; right: 16px; bottom: 16px; align-items: stretch; }
  .toast { max-width: none; }
}
@media (max-width: 560px) {
  body { font-size: 15px; }
  /* 16 px keeps iOS from zooming into a field on focus. */
  input:not([type=checkbox]):not([type=radio]), select { font-size: 16px; min-height: 44px; }
  textarea { font-size: 16px; }
  .btn { min-height: 44px; }
  .btn.sm { min-height: 36px; }
  .inline-form .field { max-width: none; flex-basis: 100%; }
  .who { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
