/* steel_counter UI theme.
   Mirrors the CRATUS VMS admin panel design system (neumorphic dark surfaces,
   amber accent, Roboto / Rubik / Azeret Mono). All colours, radii and shadows
   come from vms-tokens.css, which is a verbatim copy of the VMS tokens file:
   change tokens there (in VMS), never here. */
@import url("https://fonts.googleapis.com/css2?family=Azeret+Mono:wght@400;500;600;700&family=Roboto:wght@400;500;700&family=Rubik:wght@300;400;500;600&display=swap");

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-size: 13px; line-height: 1.45; min-height: 100vh; display: flex; flex-direction: column;
       -webkit-font-smoothing: antialiased; }
a { color: var(--amber); text-decoration: none; } a:hover { color: var(--amber-hi); }
code { font-family: var(--font-mono); font-size: 11px; color: var(--amber-hi); }
kbd { font-family: var(--font-mono); font-size: 10px; background: var(--bg-el); border: 1px solid var(--border);
      border-radius: 4px; padding: 0 5px; color: var(--txt2); }

/* ---- neumorphic surfaces --------------------------------------------- */
.neu { box-shadow: var(--shadow-neu); }
.neu-soft { box-shadow: var(--shadow-neu-soft); }
.neu-inset { box-shadow: var(--shadow-neu-inset); }
.glow-amber { text-shadow: 0 0 8px rgba(243, 151, 25, .4); }

/* ---- status ribbon (48 px) ------------------------------------------- */
.ribbon { position: sticky; top: 0; z-index: var(--z-statusbar); display: flex; align-items: center; gap: 12px; height: 48px;
          padding: 0 16px; background: linear-gradient(180deg, #000 0%, #1A1C1E 100%); border-bottom: 1px solid #0a0a0a; }
.lockup { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; }
.lockup img { height: 28px; width: auto; filter: drop-shadow(0 0 6px rgba(243, 151, 25, .4)); }
.lockup span { font-family: var(--font-display); font-weight: 600; letter-spacing: .16em; color: var(--amber); font-size: 17px;
               line-height: 1; text-shadow: var(--glow-orange); white-space: nowrap; }
.ribbon .sep { width: 1px; align-self: stretch; margin: 10px 0; background: var(--border); }
.chip { font-family: var(--font-mono); font-size: 8.5px; font-weight: 600; letter-spacing: .1em; color: var(--txt3);
        background: var(--bg-card); border-radius: 999px; padding: 3px 8px; box-shadow: var(--shadow-neu-inset); white-space: nowrap; }
.grow { flex: 1; }
.ribbon .who { text-align: right; line-height: 1.2; }
.ribbon .who b { display: block; font-family: var(--font-display); font-weight: 500; font-size: 11px; color: var(--txt); }
.ribbon .who span { font-family: var(--font-mono); font-size: 8.5px; letter-spacing: .08em; color: var(--txt3); }
.signout { display: inline-flex; align-items: center; gap: 7px; background: none; border: 0; color: var(--txt2); cursor: pointer;
           font-family: var(--font-display); font-weight: 500; font-size: 10px; letter-spacing: .1em; text-transform: uppercase;
           padding: 6px 12px; border-radius: 6px; transition: color .1s; }
.signout:hover { color: var(--red); }

/* ---- level nav (46 px) ----------------------------------------------- */
.levelnav { position: sticky; top: 48px; z-index: var(--z-nav); display: flex; align-items: stretch; gap: 2px; height: 46px;
            padding: 0 24px; background: linear-gradient(180deg, #1A1C1E 0%, #141517 100%); border-bottom: 1px solid #0a0a0a;
            overflow-x: auto; scrollbar-width: none; }
.levelnav::-webkit-scrollbar { display: none; }
.levelnav button { position: relative; display: flex; align-items: center; gap: 7px; white-space: nowrap; padding: 0 18px;
                   background: none; border: 0; cursor: pointer; font-family: var(--font-display); font-size: 11px; font-weight: 500;
                   letter-spacing: .1em; text-transform: uppercase; color: var(--txt2); transition: color .1s; }
.levelnav button:hover { color: var(--txt); }
.levelnav button svg { opacity: .7; }
.levelnav button.on { color: var(--amber); text-shadow: 0 0 8px rgba(243, 151, 25, .4); }
.levelnav button.on svg { opacity: 1; }
.levelnav button.on::after { content: ""; position: absolute; left: 14px; right: 14px; bottom: -1px; height: 2px; background: var(--amber);
                             box-shadow: var(--glow-orange); }

/* ---- page frame ------------------------------------------------------ */
main { flex: 1; width: 100%; max-width: 1560px; margin: 0 auto; padding: 8px 24px 40px; }
.page { display: none; } .page.on { display: block; }
.grid { display: grid; grid-template-columns: 360px minmax(0, 1fr); gap: 18px; align-items: start; margin-top: 18px; }
.stack > * + * { margin-top: 18px; }
.eyebrow { display: flex; align-items: center; gap: 10px; margin: 22px 0 12px; font-family: var(--font-display); font-weight: 500;
           font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--txt2); white-space: nowrap; }
.eyebrow::after { content: ""; flex: 1; height: 1px; min-width: 16px; background: var(--border); }

/* ---- cards ----------------------------------------------------------- */
.card { position: relative; background: var(--bg-card); border-radius: var(--rl); box-shadow: var(--shadow-neu); }
.card > .ch { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 18px 12px;
              border-bottom: 1px solid var(--border); }
.card > .cb { padding: 16px 18px; }
.ct { font-family: var(--font-display); font-weight: 500; font-size: 11px; letter-spacing: .18em; text-transform: uppercase;
      color: var(--txt); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card.hair::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 2px;
                     background: linear-gradient(90deg, transparent 8%, var(--amber) 50%, transparent 92%); border-radius: 10px 10px 0 0; }

/* ---- form controls --------------------------------------------------- */
label.f { display: flex; flex-direction: column; gap: 6px; margin-top: 12px; font-family: var(--font-sans); font-size: 11px; font-weight: 500;
          letter-spacing: .06em; text-transform: uppercase; color: var(--txt2); }
label.f:first-child { margin-top: 0; }
input, select, textarea { font: inherit; color: var(--txt); }
.in, select.in, textarea.in { width: 100%; height: 38px; border: 0; border-radius: 8px; background: var(--bg-card); box-shadow: var(--shadow-neu-inset);
       font-family: var(--font-mono); font-size: 12px; padding: 0 14px; outline: none; text-transform: none; letter-spacing: 0; }
textarea.in { height: auto; padding: 12px 14px; line-height: 1.5; resize: vertical; }
.in:focus { box-shadow: var(--shadow-neu-inset), 0 0 0 2px rgba(243, 151, 25, .25); }
.in:disabled { opacity: .5; }
select.in { appearance: none; -webkit-appearance: none; padding-right: 34px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23a4a8ad' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; }
.in::placeholder { color: var(--txtl); }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.top { align-items: flex-start; }
.row > .fill { flex: 1; min-width: 120px; }
.check { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; margin-top: 12px; font-size: 12px; color: var(--txt2); }
.check input { display: none; }
.check .sw { position: relative; width: 42px; height: 22px; border-radius: 999px; background: var(--bg-card); box-shadow: var(--shadow-neu-inset); flex: none; }
.check .sw::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: var(--txt3);
                    box-shadow: var(--shadow-neu-soft); transition: left .15s ease-out, background .15s; }
.check input:checked + .sw::after { left: 23px; background: var(--amber); box-shadow: var(--glow-orange); }

/* ---- buttons --------------------------------------------------------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0; cursor: pointer; white-space: nowrap;
       background: var(--bg-card); color: var(--txt); box-shadow: var(--shadow-neu); border-radius: 8px; padding: 10px 18px;
       font-family: var(--font-display); font-weight: 500; font-size: 13px; letter-spacing: .02em; line-height: 1;
       transition: box-shadow .1s ease-out, color .1s; -webkit-tap-highlight-color: transparent; }
.btn:active:not(:disabled) { box-shadow: var(--shadow-neu-inset); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.sm { padding: 7px 14px; font-size: 12px; border-radius: 6px; }
.btn.lg { padding: 14px 22px; font-size: 14px; }
.btn.block { width: 100%; }
.btn.primary { color: var(--amber); } .btn.primary:hover:not(:disabled) { color: var(--amber-hi); }
.btn.cta { color: var(--amber); box-shadow: var(--shadow-neu), var(--glow-orange); } .btn.cta:hover:not(:disabled) { color: var(--amber-hi); }
.btn.cta:active:not(:disabled) { box-shadow: var(--shadow-neu-inset); }
.btn.ghost { color: var(--txt2); box-shadow: var(--shadow-neu-soft); } .btn.ghost:hover:not(:disabled) { color: var(--txt); }
.btn.ghost.on { color: var(--amber); }
.btn.danger { color: var(--red); } .btn.ok { color: var(--green); } .btn.info { color: var(--cyan); }
.btn svg { flex: none; }

/* ---- badges ---------------------------------------------------------- */
.badge { display: inline-flex; align-items: center; gap: 6px; font-family: var(--font-mono); font-weight: 600; font-size: 9px; letter-spacing: .12em;
         text-transform: uppercase; padding: 3px 10px; border-radius: 999px; border: 1px solid var(--border); background: var(--bg-el); color: var(--txt2);
         white-space: nowrap; }
.badge.ok { background: rgba(0, 212, 92, .1); color: var(--green); border-color: rgba(0, 212, 92, .3); }
.badge.warn { background: rgba(243, 195, 25, .1); color: var(--yellow); border-color: rgba(243, 195, 25, .3); }
.badge.bad { background: rgba(255, 79, 97, .1); color: var(--red); border-color: rgba(255, 79, 97, .3); }
.badge.info { background: rgba(63, 169, 245, .1); color: var(--cyan); border-color: rgba(63, 169, 245, .3); }
.badge.amber { background: var(--amber-glow-color); color: var(--amber); border-color: rgba(243, 151, 25, .3); }
.badge .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.ok .dot { box-shadow: var(--glow-success); animation: pulse-green 2s infinite; }

.mut { color: var(--txt2); } .dim { color: var(--txt3); } .ok { color: var(--green); } .warn { color: var(--yellow); } .bad { color: var(--red); }
.mono { font-family: var(--font-mono); } .small { font-size: 11px; }
.hint { font-size: 11px; color: var(--txt3); margin-top: 10px; line-height: 1.5; }

/* ---- tables ---------------------------------------------------------- */
table { width: 100%; border-collapse: collapse; font-size: 12px; }
th { text-align: left; font-family: var(--font-mono); font-weight: 600; font-size: 9px; letter-spacing: .12em; text-transform: uppercase;
     color: var(--txt3); padding: 8px 8px; border-bottom: 1px solid var(--border); white-space: nowrap; }
td { padding: 8px 8px; border-bottom: 1px solid rgba(44, 46, 51, .6); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
td.n, th.n { text-align: right; font-family: var(--font-mono); }
.tablewrap { overflow-x: auto; }
.tablewrap table { min-width: 560px; }
td.note { min-width: 220px; }

/* ---- count page ------------------------------------------------------ */
.pick { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 12px; }
.pick .btn { flex-direction: column; gap: 8px; padding: 18px 10px; font-size: 12px; letter-spacing: .08em; text-transform: uppercase; }
#drop { margin-top: 12px; border-radius: 8px; padding: 14px; text-align: center; color: var(--txt3); font-size: 11px; box-shadow: var(--shadow-neu-inset); cursor: pointer; }
#drop.over { color: var(--amber); box-shadow: var(--shadow-neu-inset), 0 0 0 2px rgba(243, 151, 25, .35); }
#fileinfo { font-family: var(--font-mono); font-size: 10px; color: var(--txt2); margin-top: 10px; word-break: break-all; }
details.fold > summary { cursor: pointer; list-style: none; display: flex; align-items: center; justify-content: space-between; gap: 10px;
                         padding: 14px 18px 12px; }
details.fold > summary::-webkit-details-marker { display: none; }
details.fold > summary::after { content: "+"; font-family: var(--font-mono); color: var(--txt3); font-size: 14px; }
details.fold[open] > summary { border-bottom: 1px solid var(--border); }
details.fold[open] > summary::after { content: "–"; }
details.fold > .cb { padding: 16px 18px; }

#stage { position: relative; height: 68vh; min-height: 380px; background: var(--bg-base); border-radius: var(--rl); overflow: hidden;
         box-shadow: var(--shadow-neu-inset); }
#stage canvas { position: absolute; left: 0; top: 0; touch-action: none; }
#stagebar { position: absolute; left: 0; right: 0; bottom: 0; padding: 6px 12px; background: rgba(10, 11, 13, .88); font-family: var(--font-mono);
            font-size: 9px; letter-spacing: .06em; color: var(--txt3); display: flex; gap: 14px; flex-wrap: wrap; }
.tools { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; align-items: center; }
.tools .sp { flex: 1; }

.score { display: flex; gap: 28px; align-items: flex-start; flex-wrap: wrap; }
.big { font-family: var(--font-display); font-size: 46px; font-weight: 600; line-height: 1; color: var(--amber); text-shadow: 0 0 14px rgba(243, 151, 25, .35); }
.big small { font-family: var(--font-sans); font-size: 11px; font-weight: 500; letter-spacing: .1em; text-transform: uppercase; color: var(--txt3); text-shadow: none; margin-left: 6px; }
.big.plain { color: var(--txt); text-shadow: none; }
.score table { max-width: 260px; }

.verdict { margin-top: 16px; padding: 14px 16px; border-radius: 8px; box-shadow: var(--shadow-neu-inset); }
.verdict .q { font-family: var(--font-display); font-weight: 500; font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--txt2); margin-bottom: 10px; }
.verdict .row .in { width: 130px; flex: none; }
.verdict.is-correct { box-shadow: var(--shadow-neu-inset), 0 0 0 1px rgba(0, 212, 92, .35); }
.verdict.is-wrong { box-shadow: var(--shadow-neu-inset), 0 0 0 1px rgba(255, 79, 97, .35); }

/* ---- history --------------------------------------------------------- */
.runs { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 16px; }
.run { cursor: pointer; overflow: hidden; border-radius: var(--rl); background: var(--bg-card); box-shadow: var(--shadow-neu); transition: box-shadow .1s; }
.run:active { box-shadow: var(--shadow-neu-inset); }
.run img { width: 100%; aspect-ratio: 4/3; object-fit: cover; display: block; background: #000; }
.run .b { padding: 10px 14px 12px; font-size: 11px; color: var(--txt2); }
.run .b b { font-family: var(--font-display); font-size: 17px; font-weight: 500; color: var(--txt); }
.toolbar { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-top: 18px; }
.toolbar select { width: auto; min-width: 160px; }

/* ---- accuracy -------------------------------------------------------- */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 16px; margin-top: 18px; }
.kpi { padding: 16px 18px; }
.kpi .l { font-family: var(--font-display); font-weight: 500; font-size: 10px; letter-spacing: .16em; text-transform: uppercase; color: var(--txt3); }
.kpi .v { font-family: var(--font-display); font-weight: 600; font-size: 32px; margin-top: 8px; color: var(--txt); }
.kpi .v.good { color: var(--green); text-shadow: var(--glow-success); } .kpi .v.amber { color: var(--amber); text-shadow: 0 0 10px rgba(243, 151, 25, .35); }
.kpi .s { font-family: var(--font-mono); font-size: 9px; letter-spacing: .06em; color: var(--txt3); margin-top: 6px; }
.bar { height: 6px; border-radius: 3px; background: var(--bg-base); box-shadow: var(--shadow-neu-inset); overflow: hidden; min-width: 80px; }
.bar > i { display: block; height: 100%; background: var(--green); box-shadow: var(--glow-success); }

/* ---- providers / prompts --------------------------------------------- */
.prov { padding: 14px 16px; border-radius: 8px; box-shadow: var(--shadow-neu-inset); margin-top: 14px; }
.prov:first-child { margin-top: 0; }
.prov h3 { margin: 0 0 10px; display: flex; align-items: center; gap: 10px; font-family: var(--font-display); font-weight: 500; font-size: 13px;
           letter-spacing: .1em; text-transform: uppercase; }
pre { background: var(--bg-base); border-radius: 8px; padding: 12px; font-family: var(--font-mono); font-size: 10px; overflow: auto; max-height: 320px;
      white-space: pre-wrap; box-shadow: var(--shadow-neu-inset); color: var(--txt2); }

/* ---- toast + banner -------------------------------------------------- */
#toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: var(--z-toast); display: none; max-width: min(92vw, 520px);
         background: var(--bg-card); border-left: 3px solid var(--green); border-radius: 8px; padding: 12px 18px; box-shadow: var(--shadow-neu), var(--glow-success);
         font-family: var(--font-display); font-size: 12px; color: var(--txt); }
#toast.err { border-left-color: var(--red); box-shadow: var(--shadow-neu), var(--glow-danger); }
#authbanner { display: none; background: var(--red-dim); color: var(--red); text-align: center; padding: 8px 16px; font-size: 12px; border-bottom: 1px solid rgba(255, 79, 97, .3); }
.empty { padding: 40px 16px; text-align: center; color: var(--txt3); font-size: 12px; }

/* ---- login ----------------------------------------------------------- */
.login-wrap { flex: 1; display: flex; align-items: center; justify-content: center; padding: 24px; position: relative; overflow: hidden; }
.login-bg { position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(ellipse 60% 45% at 50% 18%, rgba(243, 151, 25, .12), transparent 70%),
              radial-gradient(ellipse 50% 40% at 15% 90%, rgba(63, 169, 245, .08), transparent 70%); }
.login-grid { position: absolute; inset: 0; pointer-events: none; opacity: .5;
  background-image: linear-gradient(var(--border) 1px, transparent 1px), linear-gradient(90deg, var(--border) 1px, transparent 1px);
  background-size: 64px 64px; -webkit-mask-image: radial-gradient(ellipse at center, #000 0%, transparent 70%); mask-image: radial-gradient(ellipse at center, #000 0%, transparent 70%); }
.login-card { position: relative; z-index: 1; width: 404px; max-width: calc(100vw - 32px); overflow: hidden; border-radius: 12px; background: var(--bg-card); box-shadow: var(--shadow-neu); }
.login-card::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 2px; background: linear-gradient(90deg, transparent 8%, var(--amber) 50%, transparent 92%); }
.login-head { padding: 32px 28px 24px; text-align: center; border-bottom: 1px solid var(--border); }
.login-head .lockup { margin-bottom: 16px; }
.login-head .lockup img { height: 22px; } .login-head .lockup span { font-size: 15px; }
.login-head h1 { margin: 0; font-family: var(--font-display); font-weight: 500; font-size: 17px; }
.login-head p { margin: 4px 0 0; font-size: 11px; color: var(--txt2); }
.login-card form { padding: 24px 28px 28px; display: flex; flex-direction: column; gap: 16px; }
.login-card .err { min-height: 16px; font-size: 11px; color: var(--red); }

/* ---- small screens --------------------------------------------------- */
@media (max-width: 960px) {
  .grid { grid-template-columns: minmax(0, 1fr); }
  main { padding: 4px 14px 90px; }
  .levelnav { padding: 0 8px; }
  .levelnav button { padding: 0 14px; }
  #stage { height: 56vh; min-height: 300px; }
  .big { font-size: 38px; }
}
@media (max-width: 640px) {
  .ribbon { padding: 0 10px; gap: 8px; }
  .ribbon .who, .ribbon .chip, .ribbon .sep.opt { display: none; }
  .lockup span { font-size: 14px; }
  .signout span { display: none; }
  .card > .ch, .card > .cb, details.fold > summary, details.fold > .cb { padding-left: 14px; padding-right: 14px; }
  .pick .btn { padding: 22px 8px; font-size: 13px; }
  .tools .btn.sm { padding: 9px 12px; }
  #toast { bottom: 76px; }
}
@media (pointer: coarse) {
  .btn { min-height: 44px; } .in { height: 44px; font-size: 16px; }  /* 16px stops iOS zooming on focus */
  textarea.in { height: auto; }
  .btn.sm { min-height: 40px; }
}
