/* Quilbo ERP: app styles (from the Phase 1 mock-ups). Desktop-first. */
@font-face { font-family: Inter; src: url("fonts/inter-latin.260c81a4759b.woff2") format('woff2'); font-weight: 400 800;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215; }
@font-face { font-family: Inter; src: url("fonts/inter-latin-ext.1ad231aac0a8.woff2") format('woff2'); font-weight: 400 800;
  unicode-range: U+0100-02BA, U+20A0-20AB, U+20AD-20C4, U+2113; }

:root {
  --ink: #1b2559;        /* Quilbo ink: brand, primary actions */
  --ink-2: #33438f;
  --ink-soft: #e9ecf8;
  --gold: #d9952b;       /* the nib: brand accent */
  --bg: #f3f4f8;
  --card: #ffffff;
  --line: #e2e5ee;
  --line-2: #eef0f5;
  --text: #1d2230;
  --muted: #687083;
  --ok: #127a55;     --ok-bg: #e3f5ec;
  --warn: #9a5b00;   --warn-bg: #fff3d6;
  --bad: #b42318;    --bad-bg: #fde8e6;
  --rx: #6a3fb5;     --rx-bg: #efe8fb;   /* Schedule H1 / X */
  --info: #1e5aa8;   --info-bg: #e5effb;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; }
body { font: 13px/1.4 Inter, 'Liberation Sans', sans-serif; color: var(--text); background: var(--bg);
  font-feature-settings: 'tnum' 1, 'cv11' 1; -webkit-font-smoothing: antialiased; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.muted { color: var(--muted); }
.small { font-size: 11.5px; }
b, strong { font-weight: 650; }

/* ── app frame ─────────────────────────────────────────── */
.app { display: grid; grid-template-columns: 216px 1fr; grid-template-rows: 52px 1fr 34px; height: 100vh; }
.topbar { grid-column: 1 / 3; display: flex; align-items: center; gap: 16px; padding: 0 18px 0 16px;
  background: var(--ink); color: #fff; }
.brand { display: flex; align-items: center; gap: 9px; width: 184px; font-weight: 750; font-size: 19px; letter-spacing: -.3px; }
.brand small { font-size: 10px; font-weight: 600; letter-spacing: .6px; color: #c9cfee; margin-left: 2px; text-transform: uppercase; }
.branch { display: flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: 8px; background: rgba(255,255,255,.08); font-weight: 600; }
.branch span { color: #c9cfee; font-weight: 500; }
.gsearch { flex: 1; max-width: 460px; display: flex; align-items: center; gap: 8px; padding: 7px 12px; border-radius: 8px;
  background: rgba(255,255,255,.1); color: #c9cfee; }
.gsearch kbd { margin-left: auto; }
.topbar .tbr { margin-left: auto; display: flex; align-items: center; gap: 14px; color: #dfe3f7; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 99px; font-size: 12px; font-weight: 600; }
.pill.online { background: rgba(18,122,85,.25); color: #9ff0c9; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--gold); color: var(--ink); display: grid; place-items: center; font-weight: 750; }

.sidebar { background: #fff; border-right: 1px solid var(--line); padding: 12px 10px; display: flex; flex-direction: column; gap: 2px; }
.sidebar .sec { margin: 12px 10px 4px; font-size: 10.5px; font-weight: 700; letter-spacing: .7px; color: #9aa1b2; text-transform: uppercase; }
.nav { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 7px; color: #3a4152; font-weight: 550; }
.nav svg { width: 17px; height: 17px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.nav.on { background: var(--ink-soft); color: var(--ink); font-weight: 650; }
.nav .count { margin-left: auto; font-size: 11px; font-weight: 700; padding: 0 7px; border-radius: 99px; background: var(--warn-bg); color: var(--warn); }
.nav .count.bad { background: var(--bad-bg); color: var(--bad); }
.sidebar .foot { margin-top: auto; padding: 10px; font-size: 11.5px; color: var(--muted); border-top: 1px solid var(--line-2); }

main { overflow: auto; padding: 16px 20px; display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.keys { grid-column: 1 / 3; display: flex; align-items: center; gap: 18px; padding: 0 18px; background: #fff;
  border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; }
.keys .k { display: flex; align-items: center; gap: 6px; }
kbd { display: inline-block; min-width: 22px; padding: 1px 6px; border-radius: 5px; border: 1px solid #cfd4e0; border-bottom-width: 2px;
  background: #fafbfd; color: #3a4152; font: 600 11px Inter, sans-serif; text-align: center; }
.topbar kbd { background: rgba(255,255,255,.12); border-color: rgba(255,255,255,.25); color: #e4e7f7; }

/* ── building blocks ───────────────────────────────────── */
.titlebar { display: flex; align-items: center; gap: 12px; }
.titlebar h1 { margin: 0; font-size: 19px; font-weight: 720; letter-spacing: -.2px; }
.titlebar .sub { color: var(--muted); }
.titlebar .acts { margin-left: auto; display: flex; gap: 8px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; }
.card > .hd { display: flex; align-items: center; gap: 10px; padding: 11px 14px; border-bottom: 1px solid var(--line-2); font-weight: 650; }
.card > .hd .r { margin-left: auto; font-weight: 500; color: var(--muted); font-size: 12px; }
.pad { padding: 12px 14px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 8px 14px; border-radius: 8px;
  border: 1px solid var(--line); background: #fff; font-weight: 600; color: var(--text); white-space: nowrap; }
.btn.primary { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn.gold { background: var(--gold); border-color: var(--gold); color: #1b1404; }
.btn.big { padding: 12px 16px; font-size: 14.5px; border-radius: 9px; }
.btn kbd { background: rgba(255,255,255,.15); border-color: rgba(255,255,255,.3); color: inherit; }
.btn:not(.primary):not(.gold) kbd { background: #f3f4f8; }
.tag { display: inline-flex; align-items: center; gap: 4px; padding: 1px 7px; border-radius: 5px; font-size: 11px; font-weight: 700; white-space: nowrap; }
.tag.rx { background: var(--rx-bg); color: var(--rx); }
.tag.ok { background: var(--ok-bg); color: var(--ok); }
.tag.warn { background: var(--warn-bg); color: var(--warn); }
.tag.bad { background: var(--bad-bg); color: var(--bad); }
.tag.info { background: var(--info-bg); color: var(--info); }
.tag.plain { background: var(--line-2); color: #4a5163; }

.banner { display: flex; align-items: center; gap: 10px; padding: 9px 14px; border-radius: 9px; font-weight: 550; }
.banner.rx { background: var(--rx-bg); color: #4b2a85; border: 1px solid #ddd0f5; }
.banner.ok { background: var(--ok-bg); color: #0d5c40; border: 1px solid #c4ead7; }
.banner.warn { background: var(--warn-bg); color: #7a4800; border: 1px solid #f5dfa6; }
.banner .acts { margin-left: auto; display: flex; gap: 8px; }
.banner .btn { padding: 5px 10px; }

.fields { display: grid; gap: 10px 14px; }
.field label { display: block; font-size: 11px; font-weight: 650; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; margin-bottom: 3px; }
.field .v { padding: 7px 10px; border: 1px solid var(--line); border-radius: 7px; background: #fff; min-height: 33px; display: flex; align-items: center; gap: 8px; }
.field .v.ro { background: #f7f8fb; color: #3a4152; }
.field .v.need { border-color: #c9b3ef; box-shadow: 0 0 0 3px #f1eafd; }
.field .v .hint { margin-left: auto; color: var(--muted); font-size: 11.5px; }

/* grid tables */
table.grid { width: 100%; border-collapse: separate; border-spacing: 0; }
table.grid th { position: sticky; top: 0; background: #f7f8fb; color: var(--muted); font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .4px; text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); }
table.grid td { padding: 6px 10px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
table.grid tr.sel td { background: #f4f6fd; }
table.grid tr.sel td:first-child { box-shadow: inset 3px 0 0 var(--ink); }
table.grid tr.warnrow td { background: #fffaf0; }
table.grid tr.dim td { color: #a0a6b4; }
table.grid td.item b { display: block; }
table.grid td.item .small { color: var(--muted); }
table.grid th.num { text-align: right; }

.kv { display: grid; grid-template-columns: 1fr auto; gap: 6px 12px; }
.kv .num { font-weight: 550; }
.kv .sep { grid-column: 1 / 3; border-top: 1px dashed var(--line); margin: 3px 0; }
.net { display: flex; align-items: baseline; justify-content: space-between; padding: 12px 14px; background: var(--ink); color: #fff; border-radius: 10px; }
.net .l { font-weight: 600; color: #c9cfee; }
.net .v { font-size: 30px; font-weight: 780; letter-spacing: -.5px; }

.seg { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.seg div { border: 1px solid var(--line); border-radius: 8px; padding: 8px 4px; text-align: center; font-weight: 650; background: #fff; }
.seg div .small { display: block; font-weight: 500; color: var(--muted); }
.seg div.on { border-color: var(--ink); background: var(--ink-soft); color: var(--ink); box-shadow: 0 0 0 2px #c8cff0 inset; }

.bar { height: 8px; border-radius: 99px; background: var(--line-2); overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: 99px; }

.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.kpi { padding: 14px 16px; }
.kpi .l { color: var(--muted); font-weight: 600; font-size: 12px; }
.kpi .v { font-size: 26px; font-weight: 760; letter-spacing: -.5px; margin: 4px 0 2px; }
.kpi .s { font-size: 12px; color: var(--muted); }
.up { color: var(--ok); font-weight: 650; }

.alert { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-bottom: 1px solid var(--line-2); }
.alert:last-child { border-bottom: 0; }
.alert .ic { width: 32px; height: 32px; border-radius: 8px; display: grid; place-items: center; flex: none; font-weight: 800; }
.alert .t { flex: 1; }
.alert .t .small { color: var(--muted); }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); padding: 0 6px; }
.tabs div { padding: 10px 12px; font-weight: 600; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs div.on { color: var(--ink); border-bottom-color: var(--ink); }
.chk { width: 15px; height: 15px; border-radius: 4px; border: 1.5px solid #b8bfcf; display: inline-block; vertical-align: middle; }
.chk.on { background: var(--ink); border-color: var(--ink); position: relative; }
.chk.on::after { content: ''; position: absolute; left: 4px; top: 1px; width: 4px; height: 8px; border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg); }

/* icons drawn in CSS/SVG (Inter has no check mark or search glyph) */
.ck { display: inline-block; width: 11px; height: 6px; border: solid currentColor; border-width: 0 0 2px 2px; transform: rotate(-45deg) translateY(-2px); margin: 0 3px 0 1px; }
.ico { width: 15px; height: 15px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; flex: none; }
.field .v { white-space: nowrap; overflow: hidden; }
.field .v .hint { font-size: 11px; }

/* ── the working app ───────────────────────────────────── */
a { color: inherit; text-decoration: none; }
a.link, .link { color: var(--ink-2); font-weight: 600; cursor: pointer; }
a.link:hover { text-decoration: underline; }
.nav:hover:not(.on) { background: #f5f6fa; }
.branch a { color: #c9cfee; font-weight: 500; }
.btn { cursor: pointer; font: inherit; font-weight: 600; }
.btn:hover { filter: brightness(.97); }
.btn.primary:hover { background: var(--ink-2); }
.btn.danger { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn.small { padding: 5px 10px; font-size: 12px; }
.btn[disabled] { opacity: .55; cursor: default; }
button.btn { line-height: 1.4; }
.topbar .avatar { cursor: pointer; }
.usermenu { position: relative; }
.usermenu .menu { display: none; position: absolute; right: 0; top: 38px; background: #fff; color: var(--text); border: 1px solid var(--line);
  border-radius: 10px; box-shadow: 0 18px 40px -12px rgba(27,37,89,.35); min-width: 220px; z-index: 50; padding: 6px; }
.usermenu:focus-within .menu, .usermenu.open .menu { display: block; }
.usermenu .menu a, .usermenu .menu button { display: block; width: 100%; text-align: left; padding: 8px 10px; border-radius: 7px; border: 0; background: none; font: inherit; color: inherit; cursor: pointer; }
.usermenu .menu a:hover, .usermenu .menu button:hover { background: var(--bg); }
.usermenu .menu .who { padding: 8px 10px 10px; border-bottom: 1px solid var(--line-2); margin-bottom: 4px; }

input, select, textarea { font: inherit; color: inherit; }
.in, .field input, .field select, .field textarea { width: 100%; padding: 7px 10px; border: 1px solid #d5d9e4; border-radius: 7px; background: #fff; min-height: 34px; outline: none; }
.in:focus, .field input:focus, .field select:focus, .field textarea:focus { border-color: var(--ink-2); box-shadow: 0 0 0 3px #e3e7fa; }
.field input.need { border-color: #c9b3ef; box-shadow: 0 0 0 3px #f1eafd; }
.field .help { font-size: 11.5px; color: var(--muted); margin-top: 3px; }
.field.inline { display: flex; align-items: center; gap: 8px; }
.field.inline label { margin: 0; text-transform: none; font-size: 13px; color: var(--text); letter-spacing: 0; font-weight: 550; }
.field.inline input { width: auto; min-height: 0; }
form.stack { display: flex; flex-direction: column; gap: 12px; }
.formgrid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px 16px; }
.formgrid .wide { grid-column: 1 / -1; }
.error { background: var(--bad-bg); color: var(--bad); border: 1px solid #f6cdc8; padding: 9px 12px; border-radius: 8px; font-weight: 600; }
.flash { position: fixed; left: 50%; top: 64px; transform: translateX(-50%); z-index: 100; display: flex; flex-direction: column; gap: 6px; }
.flash div { padding: 10px 16px; border-radius: 9px; font-weight: 600; box-shadow: 0 12px 30px -10px rgba(27,37,89,.4); animation: fade 5s forwards; }
.flash .success { background: #0f6b4b; color: #fff; }
.flash .error { background: var(--bad); color: #fff; }
@keyframes fade { 0%, 85% { opacity: 1 } 100% { opacity: 0; visibility: hidden } }
.toolbar { display: flex; align-items: center; gap: 8px; }
.toolbar .in { width: 280px; }
.empty { padding: 40px 20px; text-align: center; color: var(--muted); }
.empty b { display: block; color: var(--text); font-size: 15px; margin-bottom: 6px; }
table.grid tbody tr.click { cursor: pointer; }
table.grid tbody tr.click:hover td { background: #f8f9fd; }
.tabs a { padding: 10px 12px; font-weight: 600; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs a.on { color: var(--ink); border-bottom-color: var(--ink); }
.tabs a .tag { margin-left: 4px; }
.scroll { overflow: auto; }
.cols2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.cols3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }

/* remote support banner: Quilbo staff are inside a client's account */
.supportbar { grid-column: 1 / 3; display: flex; align-items: center; gap: 12px; padding: 6px 18px; background: var(--gold); color: #2b1d02; font-weight: 650; }
.supportbar form { margin-left: auto; }
.app.with-support { grid-template-rows: 52px 34px 1fr 34px; }
.trialbar { padding: 8px 14px; border-radius: 9px; background: var(--info-bg); color: var(--info); font-weight: 600; display: flex; gap: 10px; align-items: center; }

/* chart */
.bars { display: flex; align-items: flex-end; gap: 6px; height: 150px; padding: 8px 4px 0; }
.bars .b { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; height: 100%; gap: 4px; }
.bars .b i { display: block; width: 100%; background: #c9d0ef; border-radius: 4px 4px 0 0; min-height: 2px; }
.bars .b.today i { background: var(--ink); }
.bars .b span { font-size: 10.5px; color: var(--muted); }

/* billing / purchase entry */
.entry td { padding: 5px 8px; }
.entry input.cell { width: 100%; border: 1px solid transparent; border-radius: 6px; padding: 5px 6px; background: transparent; text-align: right; font-weight: 650; }
.entry input.cell.l { text-align: left; }
.entry input.cell:hover { border-color: var(--line); }
.entry input.cell:focus { border-color: var(--ink-2); background: #fff; box-shadow: 0 0 0 3px #e3e7fa; outline: none; }
.entry select.cell { border: 1px solid transparent; background: transparent; padding: 4px; border-radius: 6px; font-weight: 550; max-width: 150px; }
.entry select.cell:focus { border-color: var(--ink-2); outline: none; }
.search { display: flex; align-items: center; gap: 8px; padding: 2px 10px; border: 2px solid var(--ink); border-radius: 7px; background: #fff; }
.search input { border: 0; outline: none; flex: 1; font-weight: 600; padding: 5px 0; min-width: 0; background: transparent; }
.search .hint { color: var(--muted); font-size: 11.5px; white-space: nowrap; }
.drop { position: absolute; background: #fff; border: 1px solid #cfd4e2; border-radius: 10px; box-shadow: 0 18px 40px -12px rgba(27,37,89,.35);
  overflow: hidden; z-index: 40; }
.drop table td, .drop table th { padding: 6px 12px; white-space: nowrap; }
.drop tr.opt { cursor: pointer; }
.drop td.grp { padding: 6px 12px; background: #f6f3fd; color: #4b2a85; font-weight: 650; font-size: 12px; border-top: 1px solid var(--line-2); }
.drop .ft { display: flex; gap: 16px; padding: 7px 12px; background: #f7f8fb; color: var(--muted); font-size: 11.5px; border-top: 1px solid var(--line); }
.drop .none { padding: 14px; color: var(--muted); }
.seg div { cursor: pointer; user-select: none; }
.x { border: 0; background: none; color: #b0b6c4; cursor: pointer; font-size: 16px; line-height: 1; padding: 2px 6px; border-radius: 5px; }
.x:hover { color: var(--bad); background: var(--bad-bg); }
.modal-bg { position: fixed; inset: 0; background: rgba(20,26,60,.35); display: grid; place-items: center; z-index: 90; }
.modal { background: #fff; border-radius: 14px; width: 560px; max-width: 94vw; box-shadow: 0 30px 70px -20px rgba(20,26,60,.5); }
.modal .hd { padding: 14px 18px; border-bottom: 1px solid var(--line-2); font-weight: 700; font-size: 15px; display: flex; }
.modal .bd { padding: 16px 18px; }
.modal .ft { padding: 12px 18px; border-top: 1px solid var(--line-2); display: flex; justify-content: flex-end; gap: 8px; }
.toast { position: fixed; left: 50%; bottom: 52px; transform: translateX(-50%); background: #0f6b4b; color: #fff; padding: 12px 18px; border-radius: 10px;
  font-weight: 650; box-shadow: 0 18px 40px -12px rgba(0,0,0,.4); z-index: 95; display: flex; gap: 14px; align-items: center; }
.toast.bad { background: var(--bad); }
.toast a { color: #fff; text-decoration: underline; }

/* sign-in pages */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr; }
.auth .side { background: var(--ink); color: #fff; padding: 48px 56px; display: flex; flex-direction: column; gap: 22px; }
.auth .side h2 { font-size: 34px; line-height: 1.15; letter-spacing: -.8px; margin: 40px 0 0; max-width: 480px; }
.auth .side p { color: #c9cfee; font-size: 15px; max-width: 460px; line-height: 1.55; }
.auth .side ul { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 10px; color: #e4e7f7; font-size: 14px; }
.auth .side li::before { content: ''; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--gold); margin-right: 10px; }
.auth .formside { display: grid; place-items: center; padding: 40px; }
.auth .box { width: 400px; display: flex; flex-direction: column; gap: 14px; }
.auth h1 { margin: 0; font-size: 24px; letter-spacing: -.4px; }
.auth .brandrow { display: flex; align-items: center; gap: 10px; font-weight: 760; font-size: 22px; }

/* the Master Admin console */
.console .topbar { background: #11163a; }
.console .sidebar { background: #171d47; border-right: 0; color: #c9cfee; }
.console .nav { color: #c9cfee; }
.console .nav:hover:not(.on) { background: rgba(255,255,255,.06); }
.console .nav.on { background: rgba(255,255,255,.12); color: #fff; }
.console .sidebar .sec { color: #7d86b8; }
.console .sidebar .foot { color: #7d86b8; border-top-color: rgba(255,255,255,.08); }
.console .brand small { color: var(--gold); }
.console .app { grid-template-rows: 52px 1fr; }
.check { display: flex; gap: 12px; align-items: center; padding: 10px 14px; border-bottom: 1px solid var(--line-2); }
.check .ic { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; flex: none; font-weight: 800; font-size: 12px; }
.check .ic.ok { background: var(--ok-bg); color: var(--ok); }
.check .ic.bad { background: var(--bad-bg); color: var(--bad); }
.msg { max-width: 72%; padding: 10px 14px; border-radius: 12px; background: #f3f4f8; }
.msg.us { margin-left: auto; background: var(--ink-soft); }
.msg .meta { font-size: 11px; color: var(--muted); margin-bottom: 4px; }
.msg p { margin: 0; white-space: pre-wrap; }
pre.trace { white-space: pre-wrap; font-size: 11px; background: #0f1330; color: #d6dbf5; padding: 12px; border-radius: 8px; max-height: 320px; overflow: auto; }
details summary { cursor: pointer; }
.secret { font: 700 18px ui-monospace, monospace; letter-spacing: 1px; background: #fff; border: 1px dashed var(--gold); padding: 6px 12px; border-radius: 8px; }
