/* Chainforge — Licence administration prototype (snyx showcase; reconstructed from client work, synthetic data).
   Two fidelities from one stylesheet: [data-fidelity="wire"] is the annotated wireframe that went for approval,
   [data-fidelity="ui"] is the same screens with the production palette switched on. Only the token block changes. */

:root {
  --font: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", Helvetica, Arial, sans-serif;
  --fs-xs: 11px; --fs-sm: 12.5px; --fs-md: 14px; --fs-lg: 16px; --fs-xl: 22px;
  --radius: 4px;
  --side-w: 208px; --top-h: 54px;
  --shadow-2: 0 14px 40px rgba(20, 28, 42, .22);
}

/* wireframe tokens: greys, hairlines, no brand colour anywhere */
body[data-fidelity="wire"] {
  --bar: #5a6474; --bar-ink: #ffffff;
  --brand: #4a5464; --brand-2: #5d6879; --brand-bg: #eef0f3; --brand-line: #ccd2da;
  --paper: #ffffff; --ground: #f4f5f7; --line: #d6dae1; --line-2: #e8eaee;
  --ink: #2c3340; --ink-2: #5b6474; --muted: #8b93a1;
  --ok: #5a6474; --ok-bg: #eef0f3; --ok-line: #ccd2da;
  --warn: #6b6155; --warn-bg: #f4f1ec; --warn-line: #ddd5c9;
  --bad: #71585a; --bad-bg: #f6efef; --bad-line: #ddc9cb;
  --chart: #c3c9d2;
  --radius: 2px;
}
/* production tokens */
body[data-fidelity="ui"] {
  --bar: #1a2b45; --bar-ink: #ffffff;
  --brand: #1f5fd0; --brand-2: #2c72ea; --brand-bg: #eef3fd; --brand-line: #c6d7f6;
  --paper: #ffffff; --ground: #f4f6fa; --line: #dbe1ea; --line-2: #eaeef4;
  --ink: #172032; --ink-2: #4a5568; --muted: #7d8699;
  --ok: #1b7a4b; --ok-bg: #eaf7f0; --ok-line: #b2ddc5;
  --warn: #9a6a08; --warn-bg: #fdf6e6; --warn-line: #ecd7a4;
  --bad: #b8392f; --bad-bg: #fdf0ee; --bad-line: #eec4be;
  --chart: #6b97e6;
  --radius: 5px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body { font-family: var(--font); font-size: var(--fs-md); color: var(--ink); background: var(--ground);
       display: flex; flex-direction: column; -webkit-font-smoothing: antialiased; }
button, input, select { font: inherit; color: inherit; }
.ic { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.7;
      stroke-linecap: round; stroke-linejoin: round; }
:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--brand-line); border-radius: 3px; }
[hidden] { display: none !important; }

/* ------------------------------------------------------------ chrome */
.topbar { height: var(--top-h); flex: none; background: var(--bar); color: var(--bar-ink); display: flex;
          align-items: center; gap: 18px; padding: 0 16px; }
.brand { display: flex; align-items: center; gap: 9px; font-weight: 700; white-space: nowrap; }
.brand span:last-child { font-weight: 400; opacity: .7; font-size: var(--fs-sm); }
.brand-mark { width: 18px; height: 18px; border-radius: 4px; background: rgba(255,255,255,.35); }
.gsearch { flex: 1; max-width: 460px; display: flex; align-items: center; gap: 8px; height: 32px; padding: 0 11px;
           border-radius: var(--radius); background: rgba(255,255,255,.14); color: rgba(255,255,255,.75); }
.gsearch input { flex: 1; border: 0; outline: 0; background: none; color: #fff; font-size: var(--fs-sm); }
.gsearch input::placeholder { color: rgba(255,255,255,.55); }
.topbar__right { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.switch { display: flex; border: 1px solid rgba(255,255,255,.3); border-radius: var(--radius); overflow: hidden; }
.sw { background: none; border: 0; color: rgba(255,255,255,.75); padding: 5px 11px; font-size: var(--fs-sm); cursor: pointer; }
.sw + .sw { border-left: 1px solid rgba(255,255,255,.3); }
.sw.is-on { background: rgba(255,255,255,.22); color: #fff; font-weight: 600; }
.annbtn { display: flex; align-items: center; gap: 7px; background: none; border: 1px solid rgba(255,255,255,.3);
          border-radius: var(--radius); color: rgba(255,255,255,.85); padding: 5px 11px; font-size: var(--fs-sm); cursor: pointer; }
.annbtn.is-on { background: rgba(255,255,255,.22); color: #fff; }
.me { width: 30px; height: 30px; border-radius: 50%; background: rgba(255,255,255,.22); display: grid; place-items: center;
      font-size: var(--fs-xs); font-weight: 700; }

.app { flex: 1; min-height: 0; display: flex; }
.side { width: var(--side-w); flex: none; background: var(--paper); border-right: 1px solid var(--line); padding: 10px 0; }
.nav-btn { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; background: none; border: 0;
           padding: 9px 16px; cursor: pointer; font-size: var(--fs-md); color: var(--ink-2); border-left: 3px solid transparent; }
.nav-btn:hover { background: var(--ground); color: var(--ink); }
.nav-btn.is-on { background: var(--brand-bg); color: var(--brand); font-weight: 600; border-left-color: var(--brand); }
.nav-n { margin-left: auto; font-size: var(--fs-xs); color: var(--muted); font-variant-numeric: tabular-nums; }

.main { flex: 1; min-width: 0; overflow: auto; }
.anno-stage { position: relative; padding: 20px 24px 40px; }

/* ------------------------------------------------------------ page furniture */
.page-head { display: flex; align-items: flex-start; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head h1 { font-size: var(--fs-xl); font-weight: 600; }
.page-head p { color: var(--muted); font-size: var(--fs-sm); margin-top: 3px; max-width: 70ch; line-height: 1.5; }
.page-head .acts { margin-left: auto; display: flex; gap: 9px; }
.back { display: inline-flex; align-items: center; gap: 5px; background: none; border: 0; color: var(--brand);
        cursor: pointer; font-size: var(--fs-sm); padding: 0; margin-bottom: 10px; }

.btn { display: inline-flex; align-items: center; gap: 7px; height: 34px; padding: 0 13px; border-radius: var(--radius);
       border: 1px solid transparent; cursor: pointer; font-size: var(--fs-sm); font-weight: 600; white-space: nowrap; }
.btn.solid { background: var(--brand); color: #fff; }
.btn.solid:hover { background: var(--brand-2); }
.btn.quiet { background: var(--paper); border-color: var(--line); color: var(--ink-2); }
.btn.quiet:hover { background: var(--ground); }
.btn.danger { background: var(--paper); border-color: var(--bad-line); color: var(--bad); }
.btn:disabled { opacity: .45; cursor: not-allowed; }

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; margin-bottom: 20px; }
.tile { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.tile b { display: block; font-size: 26px; font-weight: 600; line-height: 1.15; }
.tile span { font-size: var(--fs-xs); color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }
.tile small { display: block; font-size: var(--fs-sm); color: var(--ink-2); margin-top: 6px; }

.panel { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 18px; }
.panel-hd { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line-2); }
.panel-hd h2 { font-size: var(--fs-md); font-weight: 600; }
.panel-hd .acts { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.panel-bd { padding: 16px; }

table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: .07em; color: var(--muted);
     font-weight: 600; padding: 9px 16px; border-bottom: 1px solid var(--line-2); white-space: nowrap; }
th.num, td.num { text-align: right; font-variant-numeric: tabular-nums; }
td { padding: 11px 16px; border-bottom: 1px solid var(--line-2); font-size: var(--fs-sm); color: var(--ink-2); }
tr:last-child td { border-bottom: 0; }
tbody tr.clickable { cursor: pointer; }
tbody tr.clickable:hover { background: var(--ground); }
td b { color: var(--ink); font-weight: 600; }
.pill { display: inline-flex; align-items: center; gap: 5px; font-size: var(--fs-xs); font-weight: 600; padding: 2px 8px;
        border-radius: 10px; border: 1px solid; }
.pill.ok { background: var(--ok-bg); border-color: var(--ok-line); color: var(--ok); }
.pill.warn { background: var(--warn-bg); border-color: var(--warn-line); color: var(--warn); }
.pill.bad { background: var(--bad-bg); border-color: var(--bad-line); color: var(--bad); }
.pill.flat { background: var(--ground); border-color: var(--line); color: var(--ink-2); }

.meter { height: 6px; border-radius: 3px; background: var(--line-2); overflow: hidden; min-width: 90px; }
.meter i { display: block; height: 100%; background: var(--chart); }
.meter i.over { background: var(--bad); }
.seatline { display: flex; align-items: center; gap: 9px; }
.seatline span { font-size: var(--fs-xs); color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }

/* assign form */
.assign { display: grid; grid-template-columns: 1fr 300px; gap: 20px; }
.field { display: block; margin-bottom: 14px; }
.field > span { display: block; font-size: var(--fs-sm); color: var(--ink-2); margin-bottom: 5px; }
.field select, .field input { width: 100%; height: 36px; padding: 0 10px; border: 1px solid var(--line);
                              border-radius: var(--radius); background: var(--paper); }
.stepper { display: flex; align-items: center; gap: 0; border: 1px solid var(--line); border-radius: var(--radius);
           width: 150px; overflow: hidden; }
.stepper button { width: 38px; height: 36px; background: var(--ground); border: 0; cursor: pointer; display: grid;
                  place-items: center; color: var(--ink-2); }
.stepper button:hover { background: var(--line-2); }
.stepper input { flex: 1; width: 100%; border: 0; text-align: center; height: 36px; font-variant-numeric: tabular-nums;
                 background: var(--paper); }
.picklist { border: 1px solid var(--line); border-radius: var(--radius); max-height: 208px; overflow-y: auto; }
.pickrow { display: flex; align-items: center; gap: 9px; width: 100%; background: none; border: 0; padding: 8px 11px;
           border-bottom: 1px solid var(--line-2); cursor: pointer; text-align: left; font-size: var(--fs-sm); }
.pickrow:last-child { border-bottom: 0; }
.pickrow:hover { background: var(--ground); }
.box { width: 15px; height: 15px; border: 1.5px solid var(--muted); border-radius: 2px; display: grid; place-items: center;
       flex: none; color: #fff; }
.box .ic { width: 11px; height: 11px; stroke-width: 3.2; opacity: 0; }
.pickrow.is-on .box { background: var(--brand); border-color: var(--brand); }
.pickrow.is-on .box .ic { opacity: 1; }
.pickrow .who { flex: 1; min-width: 0; }
.pickrow .who b { display: block; color: var(--ink); }
.pickrow .who span { color: var(--muted); font-size: var(--fs-xs); }

.summary { background: var(--ground); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }
.summary h3 { font-size: var(--fs-sm); font-weight: 600; margin-bottom: 10px; }
.summary dl { display: grid; grid-template-columns: 1fr auto; gap: 7px 10px; font-size: var(--fs-sm); }
.summary dt { color: var(--muted); }
.summary dd { text-align: right; font-variant-numeric: tabular-nums; }
.summary dd.bad { color: var(--bad); font-weight: 700; }
.alert { display: flex; gap: 9px; padding: 10px 12px; border-radius: var(--radius); font-size: var(--fs-sm);
         line-height: 1.5; margin-top: 12px; }
.alert.warn { background: var(--warn-bg); border: 1px solid var(--warn-line); color: var(--warn); }
.alert.bad { background: var(--bad-bg); border: 1px solid var(--bad-line); color: var(--bad); }
.alert.ok { background: var(--ok-bg); border: 1px solid var(--ok-line); color: var(--ok); }

/* ------------------------------------------------------------ annotations */
.anno-pin { position: absolute; width: 24px; height: 24px; border-radius: 50%; background: var(--bad); color: #fff;
            font-size: var(--fs-xs); font-weight: 700; display: grid; place-items: center; z-index: 12; cursor: pointer;
            border: 2px solid var(--paper); box-shadow: 0 1px 4px rgba(0,0,0,.2); }
.anno-pin.is-on { outline: 3px solid var(--bad-line); }
.anno-rail { width: 300px; flex: none; background: var(--paper); border-left: 1px solid var(--line); overflow-y: auto; }
.anno-rail h2 { font-size: var(--fs-sm); font-weight: 600; padding: 14px 16px 10px; display: flex; align-items: center; gap: 8px; }
.anno-rail h2 button { margin-left: auto; background: none; border: 0; cursor: pointer; color: var(--muted); display: grid; }
.anno-rail p.intro { padding: 0 16px 12px; font-size: var(--fs-xs); color: var(--muted); line-height: 1.6; }
.anno-item { display: flex; gap: 10px; width: 100%; text-align: left; background: none; border: 0;
             border-top: 1px solid var(--line-2); padding: 12px 16px; cursor: pointer; font-size: var(--fs-sm);
             color: var(--ink-2); line-height: 1.5; }
.anno-item:hover, .anno-item.is-on { background: var(--ground); }
.anno-item b { flex: none; width: 22px; height: 22px; border-radius: 50%; background: var(--bad); color: #fff;
               font-size: var(--fs-xs); display: grid; place-items: center; }

/* ------------------------------------------------------------ modal + toasts */
.modal-wrap { position: fixed; inset: 0; z-index: 60; background: rgba(20,28,42,.4); display: grid; place-items: center; padding: 20px; }
.modal { background: var(--paper); border-radius: var(--radius); box-shadow: var(--shadow-2); width: 430px; max-width: 100%; padding: 20px; }
.modal h2 { font-size: var(--fs-lg); font-weight: 600; margin-bottom: 4px; }
.modal p.sub { color: var(--muted); font-size: var(--fs-sm); margin-bottom: 14px; }
.modal-foot { display: flex; gap: 9px; justify-content: flex-end; margin-top: 16px; }

.toasts { position: fixed; right: 18px; bottom: 18px; z-index: 90; display: flex; flex-direction: column; gap: 8px; }
.toast { background: var(--bar); color: var(--bar-ink); padding: 10px 14px; border-radius: var(--radius);
         font-size: var(--fs-sm); box-shadow: var(--shadow-2); max-width: 380px; animation: toast-in .16s ease-out; }
.toast.is-out { opacity: 0; transform: translateY(6px); transition: .4s; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

@media (max-width: 1100px) { .assign { grid-template-columns: 1fr; } .anno-rail { width: 250px; } }
@media (max-width: 820px) {
  .side { display: none; }
  .anno-rail { display: none; }
  .gsearch { display: none; }
}
