/* Admin UI and viewer token page. Fonts and icons are served locally (see fonts/, icons.svg). */

@font-face { font-family: "Poppins"; font-weight: 400; font-display: swap; src: url("fonts/poppins-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Poppins"; font-weight: 500; font-display: swap; src: url("fonts/poppins-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "Poppins"; font-weight: 600; font-display: swap; src: url("fonts/poppins-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Poppins"; font-weight: 700; font-display: swap; src: url("fonts/poppins-latin-700-normal.woff2") format("woff2"); }

:root {
  --color-primary: #e04507;
  --color-primary-hover: #c93d05;
  --color-bg: #e5ddc1;
  --color-card: #fbf8ef;
  --color-surface: #f8f2de;
  --color-sidebar: #1a1a1a;
  --color-sidebar-active: #2a2a2a;
  --color-text: #1a1a1a;
  --color-text-secondary: #555;
  --color-text-muted: #8a8a8a;
  --color-border: #e2dac3;
  --color-border-light: #ece5d0;
  --color-success: #15803d;
  --color-success-muted: #e3f5e8;
  --color-error: #dc2626;
  --color-error-muted: #fbe3d9;
  --color-warning: #92600a;
  --color-warning-muted: #fef9e6;
  --font: "Poppins", "Segoe UI", system-ui, -apple-system, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", Consolas, "SF Mono", monospace;
  --radius-card: 10px;
  --radius-control: 8px;
  color-scheme: light;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--color-bg); color: var(--color-text); font: 13px/1.5 var(--font); }
a { color: var(--color-primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 18px; font-weight: 600; margin: 0; line-height: 1.3; }
h2 { font-size: 14px; font-weight: 600; margin: 0 0 8px; }
p { margin: 0 0 10px; }
code, .mono { font-family: var(--mono); }
.muted { color: var(--color-text-muted); }
.secondary { color: var(--color-text-secondary); }
.help { font-size: 11px; color: var(--color-text-muted); margin: 6px 0 0; }
.tiny { font-size: 10px; }
.nowrap { white-space: nowrap; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 2px; }

.icon { width: 14px; height: 14px; flex: none; fill: none; stroke: currentColor; stroke-width: 2;
        stroke-linecap: round; stroke-linejoin: round; vertical-align: -2px; }

/* ---------- Layout ---------- */
.shell { display: grid; grid-template-columns: 240px minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  display: flex; flex-direction: column; gap: 22px;
  background: var(--color-sidebar); color: #fff; padding: 22px 16px 16px;
}
.brand { display: flex; align-items: center; gap: 12px; color: #fff; }
.brand:hover { text-decoration: none; }
.logo-tile {
  width: 40px; height: 40px; flex: none; border-radius: 9px; display: grid; place-items: center;
  background: var(--color-primary); color: #fff; font-weight: 700; font-size: 20px;
}
.brand-name { display: block; font-weight: 700; font-size: 12.5px; line-height: 1.25; letter-spacing: .04em; text-transform: uppercase; }
.brand-sub { display: block; color: var(--color-primary); font-size: 10.5px; font-weight: 500; margin-top: 2px; }
.nav-label { font-size: 9.5px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--color-text-muted); margin: 0 0 6px 10px; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px;
  color: #d6d6d6; font-size: 12.5px; font-weight: 500;
}
.nav a:hover { background: var(--color-sidebar-active); color: #fff; text-decoration: none; }
.nav a[aria-current="page"] { background: var(--color-sidebar-active); color: var(--color-primary); }
.nav .icon { width: 16px; height: 16px; }
.sidebar-foot { margin-top: auto; padding-top: 14px; border-top: 1px solid #2e2e2e; font-size: 10.5px; color: var(--color-text-muted); }
.sidebar-user { display: flex; align-items: center; gap: 8px; color: #e6e6e6; font-size: 11.5px; margin-bottom: 8px; min-width: 0; }
.sidebar-user span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-foot form { margin: 0 0 12px; }
.signout { display: inline-flex; align-items: center; gap: 6px; background: none; border: 0; padding: 0;
           color: var(--color-text-muted); font: inherit; font-size: 11px; cursor: pointer; }
.signout:hover { color: #fff; }

.main { min-width: 0; }
.page-header { padding: 22px 0 4px; }
.page-header.band { background: var(--color-surface); border-bottom: 1px solid var(--color-border); padding-bottom: 18px; }
.page-header-inner, .content { max-width: 1080px; margin: 0 auto; padding-inline: 24px; }
.page-header-inner { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px; }
.breadcrumb { display: flex; align-items: center; gap: 4px; font-size: 10.5px; color: var(--color-text-muted); margin-bottom: 4px; }
.breadcrumb a { color: var(--color-text-muted); }
.breadcrumb .icon { width: 11px; height: 11px; }
.subtitle { font-size: 11.5px; color: var(--color-text-secondary); margin: 2px 0 0; }
.content { padding-block: 24px; display: flex; flex-direction: column; gap: 16px; }

/* ---------- Cards and eyebrows ---------- */
.card { background: var(--color-card); border: 1px solid var(--color-border); border-radius: var(--radius-card); padding: 16px; }
.eyebrow {
  display: flex; align-items: center; gap: 7px; margin: 0 0 12px; padding-bottom: 8px;
  border-bottom: 1px solid var(--color-border-light);
  font-size: 10.5px; font-weight: 600; letter-spacing: .09em; text-transform: uppercase; color: var(--color-text-muted);
}
.eyebrow > .icon { color: var(--color-primary); width: 13px; height: 13px; }
.eyebrow .spacer { flex: 1; }
.eyebrow .badge { text-transform: none; letter-spacing: 0; }

details.card > summary { list-style: none; cursor: pointer; }
details.card > summary::-webkit-details-marker { display: none; }
details.card:not([open]) > summary.eyebrow { border-bottom: 0; padding-bottom: 0; margin-bottom: 0; }
.chev {
  margin-left: auto; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center;
  border: 1px solid var(--color-border); color: var(--color-text-secondary); background: var(--color-card);
  transition: transform .15s;
}
details[open] > summary .chev { transform: rotate(180deg); }
summary:hover .chev { border-color: var(--color-text-muted); }

/* ---------- Forms ---------- */
label, .label { display: block; font-size: 11px; font-weight: 500; color: var(--color-text-secondary); margin-bottom: 4px; }
input[type=text], input[type=password], input[type=search], input:not([type]), select {
  width: 100%; padding: 8px 10px; font: inherit; font-size: 12.5px; color: var(--color-text);
  background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-control);
}
input[type=file] {
  width: 100%; font: inherit; font-size: 12px; color: var(--color-text-secondary);
  background: var(--color-surface); border: 1px dashed var(--color-border); border-radius: var(--radius-control); padding: 8px;
}
input[type=file]::file-selector-button {
  font: inherit; font-weight: 600; font-size: 11.5px; margin-right: 10px; padding: 5px 12px; cursor: pointer;
  background: var(--color-card); color: var(--color-text); border: 1px solid var(--color-border); border-radius: 6px;
}
input:focus, select:focus { outline: none; border-color: var(--color-primary); box-shadow: 0 0 0 3px rgb(224 69 7 / .12); }
::placeholder { color: var(--color-text-muted); }
.row { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.row .grow { flex: 1 1 240px; min-width: 0; }
.field + .field { margin-top: 12px; }
.form-actions { margin-top: 14px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; white-space: nowrap;
  padding: 8px 16px; font: inherit; font-size: 12px; font-weight: 600; line-height: 1.4; cursor: pointer;
  color: var(--color-text); background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-control);
}
.btn:hover { border-color: var(--color-text-muted); text-decoration: none; }
.btn-primary { color: #fff; background: var(--color-primary); border-color: var(--color-primary); }
.btn-primary:hover { background: var(--color-primary-hover); border-color: var(--color-primary-hover); }
.btn:disabled, .btn[aria-disabled=true] { opacity: .5; cursor: not-allowed; }
.btn-primary:disabled:hover { background: var(--color-primary); }
.btn-danger { color: #fff; background: var(--color-error); border-color: var(--color-error); }
.btn-block { width: 100%; }
.btn-sm { padding: 4px 10px; font-size: 11px; }
.link-action {
  display: inline-flex; align-items: center; gap: 4px; background: none; border: 0; padding: 0; cursor: pointer;
  font: inherit; font-size: 11.5px; font-weight: 500; color: var(--color-primary);
}
.link-action:hover { text-decoration: none; opacity: .85; }
.link-action.danger { color: var(--color-error); }
.jump { font-size: 11.5px; border-bottom: 1px dotted currentColor; }
.jump:hover { text-decoration: none; }

.pills { display: flex; flex-wrap: wrap; gap: 6px; }
.pill { margin: 0; cursor: pointer; }
.pill input { position: absolute; opacity: 0; pointer-events: none; }
.pill span {
  display: inline-block; padding: 5px 12px; border-radius: 999px; font-size: 11.5px; font-weight: 500;
  background: var(--color-surface); border: 1px solid var(--color-border); color: var(--color-text-secondary);
}
.pill:hover span { border-color: var(--color-text-muted); }
.pill input:checked + span { background: var(--color-primary); border-color: var(--color-primary); color: #fff; }
.pill input:focus-visible + span { outline: 2px solid var(--color-primary); outline-offset: 2px; }

/* ---------- Status ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 999px;
  font-size: 10.5px; font-weight: 500; white-space: nowrap; line-height: 1.6;
}
.badge .icon { width: 11px; height: 11px; }
.badge.green  { background: #e6fef0; color: #15803d; }
.badge.orange { background: #fef0e6; color: #9a3f12; }
.badge.blue   { background: #e6f0fe; color: #1e40af; }
.badge.purple { background: #f3e6fe; color: #7c2d92; }
.badge.pink   { background: #fee6f0; color: #be185d; }
.badge.teal   { background: #e6fefb; color: #0f766e; }
.badge.amber  { background: #fef9e6; color: #92600a; }
.badge.indigo { background: #eae6fe; color: #4338ca; }
.badge.red    { background: #fee2e2; color: #dc2626; }
.badge.grey   { background: var(--color-border-light); color: var(--color-text-secondary); }

.banner { display: flex; align-items: flex-start; gap: 8px; padding: 10px 12px; border-radius: var(--radius-control); font-size: 12px; }
.banner .icon { margin-top: 2px; }
.banner.error { background: var(--color-error-muted); color: var(--color-error); }
.banner.success { background: var(--color-success-muted); color: var(--color-success); }
.banner.info { background: var(--color-surface); color: var(--color-text-secondary); border: 1px solid var(--color-border); }
.tag-warn { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 6px;
            background: var(--color-warning-muted); color: var(--color-warning); font-size: 11px; font-weight: 500; }
.tag-warn .icon { width: 12px; height: 12px; }

.progress { display: flex; align-items: center; gap: 12px; padding: 10px 12px; margin-top: 12px;
            background: var(--color-surface); border: 1px solid var(--color-border-light); border-radius: var(--radius-control); }
.ring { width: 44px; height: 44px; flex: none; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 4; }
.ring .track { stroke: var(--color-border); }
.ring .arc { stroke: var(--color-primary); stroke-linecap: round; transition: stroke-dashoffset .2s; }
.progress.indeterminate .ring { animation: spin 1.1s linear infinite; }
@keyframes spin { to { transform: rotate(270deg); } }
.progress-label { font-size: 12.5px; font-weight: 600; }
.progress-sub { font-size: 10.5px; color: var(--color-text-muted); }
@media (prefers-reduced-motion: reduce) { .progress.indeterminate .ring { animation: none; } }

/* ---------- Copy boxes ---------- */
.copy-box { display: flex; flex-wrap: wrap; gap: 8px; align-items: stretch; }
.copy-box code {
  flex: 1 1 280px; min-width: 0; overflow-wrap: anywhere; padding: 8px 10px; font-size: 12px;
  background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-control);
}
.copy-box code.secret { font-size: 15px; font-weight: 600; letter-spacing: .03em; color: var(--color-text); }

/* ---------- Tables and lists ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--color-border-light); border-radius: var(--radius-control); }
table { width: 100%; border-collapse: collapse; font-size: 12px; }
th { background: var(--color-surface); text-align: left; font-size: 10px; font-weight: 600; text-transform: uppercase;
     letter-spacing: .07em; color: var(--color-text-muted); padding: 8px 10px; white-space: nowrap; }
td { padding: 9px 10px; border-top: 1px solid var(--color-border-light); vertical-align: middle; }
td form { margin: 0; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; padding: 8px 10px; font-size: 11.5px;
           background: var(--color-surface); border-radius: var(--radius-control); }
.list li + li { margin-top: 6px; }
.scroll { max-height: 280px; overflow-y: auto; scrollbar-width: thin; scrollbar-color: var(--color-border) transparent; }
.scroll::-webkit-scrollbar { width: 6px; }
.scroll::-webkit-scrollbar-thumb { background: var(--color-border); border-radius: 3px; }
.empty { text-align: center; padding: 28px 12px; color: var(--color-text-muted); font-size: 12px; }
.empty .icon { width: 22px; height: 22px; color: var(--color-border); display: block; margin: 0 auto 8px; }

/* ---------- Home: application cards ---------- */
.search { position: relative; width: min(280px, 100%); }
.search .icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--color-text-muted); }
.search input { border-radius: 999px; padding-left: 34px; background: var(--color-card); }
.app-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.app-card { display: flex; flex-direction: column; gap: 10px; color: var(--color-text); transition: border-color .15s, box-shadow .15s; }
.app-card:hover { text-decoration: none; border-color: var(--color-primary); box-shadow: 0 2px 10px rgb(26 26 26 / .06); }
.app-card h2 { font-size: 13.5px; margin: 0; overflow-wrap: anywhere; }
.app-card .badges { display: flex; flex-wrap: wrap; gap: 6px; }
.app-card hr { border: 0; border-top: 1px solid var(--color-border-light); margin: auto 0 0; width: 100%; }
.app-card .meta { display: flex; justify-content: space-between; gap: 8px; font-size: 10.5px; color: var(--color-text-muted); }
.app-card .meta span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Sign-in and viewer token page ---------- */
.centered { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.auth-card { width: 100%; max-width: 380px; padding: 28px; }
.auth-card .logo-tile { margin-bottom: 16px; }
.auth-card h1 { margin-bottom: 4px; }
.auth-card .subtitle { margin-bottom: 18px; }
.auth-card .banner { margin-bottom: 14px; }
.auth-foot { text-align: center; font-size: 10.5px; color: var(--color-text-secondary); margin-top: 14px; }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) { .app-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 860px) {
  .shell { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto 1fr; }
  .sidebar { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 12px 20px; padding: 12px 16px; }
  .brand-sub, .nav-label { display: none; }
  .nav { flex-direction: row; flex-wrap: wrap; }
  .sidebar-foot { margin: 0 0 0 auto; padding: 0; border: 0; display: flex; align-items: center; gap: 12px; }
  .sidebar-foot form { margin: 0; }
  .sidebar-user, .sidebar-foot .copyright { display: none; }
  .page-header { padding: 18px 0 4px; }
  .page-header-inner, .content { padding-inline: 16px; }
  .content { padding-block: 16px; }
}
@media (max-width: 620px) { .app-grid { grid-template-columns: 1fr; } }
