/* Kite Manufacturing — one theme for website app surfaces (front end, back office, manager console).
   Accent presets via html[data-accent]; light / dark via html.dark. Icons are 2D text symbols (.ic). */
:root {
  --bg: #f4f6f9; --surface: #ffffff; --surface-2: #f8fafc; --inner: #eef2f6; --border: #e3e8ef; --border-strong: #cfd8e3;
  --text: #0f172a; --text-2: #334155; --muted: #64748b;
  --accent: #059669; --accent-strong: #047857; --on-accent: #ffffff;
  --accent-soft: color-mix(in srgb, var(--accent) 11%, transparent);
  --good: #15803d; --warn: #b45309; --bad: #dc2626; --info: #0369a1; --violet: #6d28d9;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .06);
  --shadow: 0 1px 3px rgba(15, 23, 42, .06), 0 6px 16px -8px rgba(15, 23, 42, .12);
  --shadow-lg: 0 24px 60px -12px rgba(15, 23, 42, .35);
  --r: 12px; --r-sm: 8px; --hd: 3.5rem; --side: 15.5rem; --bn: 0px;
  --sym: "Segoe UI Symbol", "Apple Symbols", "Noto Sans Symbols 2", "Noto Sans Symbols", "DejaVu Sans", system-ui, sans-serif;
  color-scheme: light;
}
html[data-accent="indigo"] { --accent: #4f46e5; --accent-strong: #4338ca; }
html[data-accent="blue"] { --accent: #2563eb; --accent-strong: #1d4ed8; }
html[data-accent="teal"] { --accent: #0f766e; --accent-strong: #115e59; }
html[data-accent="orange"] { --accent: #c2410c; --accent-strong: #9a3412; }
html[data-accent="rose"] { --accent: #be123c; --accent-strong: #9f1239; }
html[data-accent="graphite"] { --accent: #334155; --accent-strong: #1e293b; }
html[data-accent="plum"] { --accent: #7e2e7e; --accent-strong: #641f64; --accent-2: #c0843f; }
html[data-accent="gold"] { --accent: #a16207; --accent-strong: #854d0e; }
html[data-accent="violet"] { --accent: #6d28d9; --accent-strong: #5b21b6; }
html.dark {
  --bg: #0b1017; --surface: #121923; --surface-2: #161f2b; --inner: #1b2533; --border: #243142; --border-strong: #33445a;
  --text: #e8eef6; --text-2: #c3cfdd; --muted: #8b9bb0;
  --accent: #34d399; --accent-strong: #6ee7b7; --on-accent: #052e20;
  --good: #4ade80; --warn: #fbbf24; --bad: #f87171; --info: #60a5fa; --violet: #a78bfa;
  --shadow-sm: none; --shadow: 0 1px 0 rgba(255,255,255,.02), 0 8px 24px -12px rgba(0,0,0,.6); --shadow-lg: 0 24px 60px -12px rgba(0,0,0,.7);
  color-scheme: dark;
}
html.dark[data-accent="indigo"] { --accent: #a5b4fc; --accent-strong: #c7d2fe; --on-accent: #1e1b4b; }
html.dark[data-accent="blue"] { --accent: #93c5fd; --accent-strong: #bfdbfe; --on-accent: #0c1e3e; }
html.dark[data-accent="teal"] { --accent: #5eead4; --accent-strong: #99f6e4; --on-accent: #042f2e; }
html.dark[data-accent="orange"] { --accent: #fdba74; --accent-strong: #fed7aa; --on-accent: #431407; }
html.dark[data-accent="rose"] { --accent: #fda4af; --accent-strong: #fecdd3; --on-accent: #4c0519; }
html.dark[data-accent="graphite"] { --accent: #cbd5e1; --accent-strong: #e2e8f0; --on-accent: #0f172a; }
html.dark[data-accent="plum"] { --accent: #e3a6e3; --accent-strong: #f0c9f0; --on-accent: #3b0d3b; }
html.dark[data-accent="gold"] { --accent: #fcd34d; --accent-strong: #fde68a; --on-accent: #422006; }
html.dark[data-accent="violet"] { --accent: #c4b5fd; --accent-strong: #ddd6fe; --on-accent: #2e1065; }

/* Dark sidebar variant (html[data-side="dark"]) — premium look for light mode */
html[data-side="dark"]:not(.dark) .side { background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 22%, #14101c), #121019 60%); border-right-color: #231d2e; scrollbar-color: #3a3148 transparent; }
html[data-side="dark"]:not(.dark) .side h6 { color: #9d93ad; }
html[data-side="dark"]:not(.dark) .side a { color: #d9d2e4; }
html[data-side="dark"]:not(.dark) .side a:hover { background: rgba(255,255,255,.06); color: #fff; }
html[data-side="dark"]:not(.dark) .side a .ic { background: rgba(255,255,255,.07); color: #c9bfd8; }
html[data-side="dark"]:not(.dark) .side a.active { background: rgba(255,255,255,.11); color: #fff; }
html[data-side="dark"]:not(.dark) .side a.active .ic { background: var(--accent); color: var(--on-accent); box-shadow: 0 0 0 1px rgba(255,255,255,.18); }
html[data-side="dark"]:not(.dark) .side .nav-count { color: #b3a9c2; }

* { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 14.5px; -webkit-text-size-adjust: 100%; }
body { font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif; background: var(--bg); color: var(--text); min-height: 100vh; -webkit-font-smoothing: antialiased; line-height: 1.45; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; }
a { color: var(--accent-strong); text-decoration: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
::selection { background: var(--accent-soft); }
.ic { font-family: var(--sym); font-variant-emoji: text; font-style: normal; line-height: 1; display: inline-block; text-align: center; }
.mono { font-family: 'JetBrains Mono', ui-monospace, monospace; font-size: .92em; }
.muted { color: var(--muted); }
.small { font-size: .76rem; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.grow { flex: 1; min-width: 0; }
.row { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.stack > * + * { margin-top: .75rem; }
.hidden { display: none !important; }
.c { text-align: center; }
.good-t { color: var(--good); } .bad-t { color: var(--bad); } .warn-t { color: var(--warn); }

/* ------------------------------------------------------------- header */
.hd { position: sticky; top: 0; z-index: 50; height: var(--hd); display: flex; align-items: center; gap: .6rem; padding: 0 1rem; background: color-mix(in srgb, var(--surface) 88%, transparent); backdrop-filter: saturate(1.4) blur(10px); border-bottom: 1px solid var(--border); }
.brand { display: flex; align-items: center; gap: .6rem; min-width: 0; color: inherit; }
.brand-logo { width: 2.1rem; height: 2.1rem; border-radius: 9px; background: var(--accent); color: var(--on-accent); display: grid; place-items: center; font-size: 1.05rem; flex-shrink: 0; font-weight: 800; }
.brand-text { min-width: 0; }
.brand-text h1 { font-size: .92rem; font-weight: 800; letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-text p { font-size: .68rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 18rem; }
.hd-search { display: flex; align-items: center; gap: .5rem; margin-left: 1rem; padding: .42rem .7rem; min-width: 15rem; border-radius: 9px; background: var(--inner); border: 1px solid var(--border); color: var(--muted); font-size: .8rem; }
.hd-search kbd { margin-left: auto; font-family: inherit; font-size: .66rem; border: 1px solid var(--border-strong); border-radius: 5px; padding: 0 .3rem; }
.hd-actions { display: flex; align-items: center; gap: .35rem; margin-left: auto; flex-shrink: 0; }
.icon-btn { position: relative; width: 2.25rem; height: 2.25rem; border-radius: 9px; display: inline-grid; place-items: center; color: var(--text-2); border: 1px solid transparent; font-size: 1rem; }
.icon-btn:hover { background: var(--inner); border-color: var(--border); }
.badge { position: absolute; top: .1rem; right: .1rem; min-width: 1.05rem; height: 1.05rem; padding: 0 .25rem; border-radius: 9px; background: var(--bad); color: #fff; font-size: .6rem; font-weight: 800; display: grid; place-items: center; }
.menu-btn { display: none; }
.sync-dot { width: .5rem; height: .5rem; border-radius: 50%; background: var(--muted); display: inline-block; }
.sync-dot.ok { background: var(--good); } .sync-dot.warn { background: var(--warn); }
.user-pill { display: inline-flex; align-items: center; gap: .4rem; padding: .25rem .55rem .25rem .3rem; border-radius: 20px; background: var(--inner); font-size: .74rem; font-weight: 700; }
.user-pill .av { width: 1.5rem; height: 1.5rem; border-radius: 50%; background: var(--accent); color: var(--on-accent); display: grid; place-items: center; font-size: .66rem; font-weight: 800; }

/* -------------------------------------------------------------- shell */
.shell { display: flex; min-height: calc(100vh - var(--hd)); }
.side { width: var(--side); flex-shrink: 0; background: var(--surface); border-right: 1px solid var(--border); padding: .7rem .55rem 2rem; position: sticky; top: var(--hd); height: calc(100vh - var(--hd)); overflow-y: auto; scrollbar-width: thin; }
.side h6 { font-size: .6rem; letter-spacing: .09em; text-transform: uppercase; color: var(--muted); padding: .9rem .6rem .3rem; font-weight: 800; }
.side a { display: flex; align-items: center; gap: .6rem; padding: .42rem .55rem; border-radius: 8px; font-size: .8rem; font-weight: 600; color: var(--text-2); }
.side a:hover { background: var(--inner); color: var(--text); }
.side a .ic { width: 1.6rem; height: 1.6rem; border-radius: 7px; display: grid; place-items: center; background: var(--inner); color: var(--muted); font-size: .9rem; flex-shrink: 0; }
.side a.active { background: var(--accent-soft); color: var(--accent-strong); font-weight: 750; }
.side a.active .ic { background: var(--accent); color: var(--on-accent); }
.side .nav-count { margin-left: auto; font-size: .64rem; font-weight: 800; color: var(--muted); }
.main { flex: 1; min-width: 0; padding: 1.4rem 1.6rem 3rem; max-width: 1500px; }
.scrim { display: none; }
.bottom-nav { display: none; }

/* -------------------------------------------------------- page header */
.ph { display: flex; align-items: flex-end; gap: 1rem; margin-bottom: 1.2rem; flex-wrap: wrap; }
.ph .eyebrow { font-size: .68rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--accent-strong); margin-bottom: .2rem; }
.ph h2 { font-size: 1.4rem; font-weight: 800; letter-spacing: -.02em; }
.ph p { font-size: .82rem; color: var(--muted); margin-top: .25rem; max-width: 62rem; }
.ph .acts { display: flex; gap: .45rem; flex-wrap: wrap; margin-left: auto; }

/* ----------------------------------------------------- buttons & chips */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; min-height: 2.15rem; padding: .4rem .85rem; border-radius: 9px; border: 1px solid var(--border-strong); background: var(--surface); font-weight: 650; font-size: .79rem; white-space: nowrap; color: var(--text); box-shadow: var(--shadow-sm); transition: background .12s, border-color .12s; }
.btn:hover { border-color: var(--accent); background: var(--surface-2); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn .ic { font-size: .9rem; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn.primary:hover { background: var(--accent-strong); border-color: var(--accent-strong); }
.btn.danger { color: var(--bad); }
.btn.danger:hover { border-color: var(--bad); background: color-mix(in srgb, var(--bad) 7%, transparent); }
.btn.sm { min-height: 1.8rem; padding: .22rem .55rem; font-size: .72rem; border-radius: 7px; }
.btn.ghost { background: transparent; border-color: transparent; box-shadow: none; }
.btn.ghost:hover { background: var(--inner); }
.btn.block { width: 100%; }
.chip { display: inline-flex; align-items: center; gap: .25rem; font-size: .67rem; font-weight: 750; padding: .12rem .5rem; border-radius: 20px; border: 1px solid var(--border); background: var(--inner); color: var(--text-2); white-space: nowrap; line-height: 1.5; }
.chip:empty { display: none; }
.chip.green { color: var(--good); border-color: color-mix(in srgb, var(--good) 35%, transparent); background: color-mix(in srgb, var(--good) 9%, transparent); }
.chip.amber { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 35%, transparent); background: color-mix(in srgb, var(--warn) 9%, transparent); }
.chip.red { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 35%, transparent); background: color-mix(in srgb, var(--bad) 9%, transparent); }
.chip.blue { color: var(--info); border-color: color-mix(in srgb, var(--info) 35%, transparent); background: color-mix(in srgb, var(--info) 9%, transparent); }
.chip.purple { color: var(--violet); border-color: color-mix(in srgb, var(--violet) 35%, transparent); background: color-mix(in srgb, var(--violet) 9%, transparent); }

/* -------------------------------------------------------- cards & kpis */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); box-shadow: var(--shadow); padding: 1rem 1.1rem; min-width: 0; }
.card h3 { font-size: .88rem; font-weight: 800; margin-bottom: .75rem; display: flex; align-items: center; gap: .5rem; }
.card h3 .ic { color: var(--accent-strong); }
.card h3 .grow + * { font-weight: 600; }
.grid { display: grid; gap: 1rem; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.span2 { grid-column: span 2; }
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(12rem, 1fr)); gap: .8rem; margin-bottom: 1.1rem; }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); padding: .85rem 1rem; box-shadow: var(--shadow); position: relative; overflow: hidden; min-width: 0; }
.kpi::before { content: ''; position: absolute; left: 0; top: .9rem; bottom: .9rem; width: 3px; border-radius: 0 3px 3px 0; background: var(--border-strong); }
.kpi.good::before { background: var(--good); } .kpi.warn::before { background: var(--warn); } .kpi.bad::before { background: var(--bad); } .kpi.accent::before { background: var(--accent); }
.kpi .l { font-size: .68rem; font-weight: 750; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.kpi .v { font-size: 1.35rem; font-weight: 850; margin-top: .3rem; font-variant-numeric: tabular-nums; letter-spacing: -.02em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kpi .s { font-size: .72rem; color: var(--muted); margin-top: .15rem; }
.kpi.warn .v { color: var(--warn); } .kpi.bad .v { color: var(--bad); } .kpi.good .v { color: var(--good); }
.bar { height: .45rem; background: var(--inner); border-radius: 9px; overflow: hidden; min-width: 4rem; }
.bar > i { display: block; height: 100%; background: var(--accent); border-radius: 9px; }
.bar.warn > i { background: var(--warn); } .bar.bad > i { background: var(--bad); } .bar.good > i { background: var(--good); }
.list-row { display: flex; align-items: center; gap: .6rem; padding: .55rem 0; border-top: 1px solid var(--border); font-size: .82rem; }
.list-row:first-child { border-top: 0; }
.list-row .ic { width: 1.8rem; height: 1.8rem; border-radius: 8px; background: var(--inner); display: grid; place-items: center; color: var(--text-2); flex-shrink: 0; }
.empty { padding: 2rem 1rem; text-align: center; color: var(--muted); font-size: .84rem; }
.empty .ic { display: block; font-size: 1.6rem; margin-bottom: .4rem; opacity: .6; }
.callout { border: 1px solid color-mix(in srgb, var(--info) 30%, transparent); background: color-mix(in srgb, var(--info) 7%, transparent); color: var(--text-2); border-radius: var(--r-sm); padding: .6rem .8rem; font-size: .8rem; }
.callout.warn { border-color: color-mix(in srgb, var(--warn) 35%, transparent); background: color-mix(in srgb, var(--warn) 8%, transparent); }

/* -------------------------------------------------------------- tables */
.tbl-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--r); background: var(--surface); box-shadow: var(--shadow); }
.card .tbl-wrap { box-shadow: none; }
table.tbl { width: 100%; border-collapse: collapse; font-size: .8rem; }
.tbl th { text-align: left; font-size: .66rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 800; padding: .6rem .75rem; background: var(--surface-2); border-bottom: 1px solid var(--border); white-space: nowrap; }
.tbl td { padding: .6rem .75rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl tbody tr:hover td { background: color-mix(in srgb, var(--accent) 3.5%, transparent); }
.tbl tfoot td { font-weight: 800; background: var(--surface-2); border-top: 1px solid var(--border); }
.tbl .acts { white-space: nowrap; text-align: right; }
.tbl .acts .btn + .btn { margin-left: .25rem; }
.tbl input, .tbl select { width: 100%; min-width: 4.5rem; padding: .38rem .5rem; border: 1px solid var(--border-strong); border-radius: 7px; background: var(--surface); font-size: .82rem; }
.toolbar { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; margin-bottom: .8rem; }
.toolbar input[type=search], .toolbar select, .toolbar input[type=date], .toolbar input[type=month] { min-height: 2.15rem; padding: .38rem .65rem; border: 1px solid var(--border-strong); border-radius: 9px; background: var(--surface); font-size: .8rem; }
.toolbar input[type=search] { min-width: 15rem; }
.tabs { display: flex; gap: .3rem; overflow-x: auto; margin-bottom: 1rem; padding-bottom: 2px; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button { flex-shrink: 0; padding: .38rem .85rem; border-radius: 20px; border: 1px solid var(--border); background: var(--surface); font-size: .76rem; font-weight: 700; color: var(--muted); }
.tabs button:hover { color: var(--text); }
.tabs button.on { background: var(--text); color: var(--surface); border-color: var(--text); }
.seg { display: inline-flex; background: var(--inner); border-radius: 9px; padding: 3px; gap: 2px; }
.seg button { padding: .3rem .7rem; border-radius: 7px; font-size: .75rem; font-weight: 700; color: var(--muted); }
.seg button.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }

/* ---------------------------------------------------------------- forms */
.form { display: grid; grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr)); gap: .85rem 1rem; }
.fld { display: flex; flex-direction: column; gap: .3rem; min-width: 0; }
.fld.wide { grid-column: 1 / -1; }
.fld label { font-size: .72rem; font-weight: 700; color: var(--text-2); }
.fld label .req { color: var(--bad); }
.fld input, .fld select, .fld textarea { min-height: 2.35rem; padding: .48rem .65rem; border: 1px solid var(--border-strong); border-radius: 9px; background: var(--surface); font-size: .86rem; width: 100%; }
.fld input:focus, .fld select:focus, .fld textarea:focus, .tbl input:focus, .tbl select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.fld textarea { min-height: 4.5rem; resize: vertical; }
.fld .hint { font-size: .68rem; color: var(--muted); }
.fld.chk { flex-direction: row; align-items: center; gap: .55rem; }
.fld.chk input { width: 1.1rem; height: 1.1rem; min-height: 0; accent-color: var(--accent); flex-shrink: 0; }
.checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(13rem, 1fr)); gap: .35rem .8rem; }
.checks label { display: flex; gap: .45rem; align-items: center; font-size: .8rem; font-weight: 600; color: var(--text); padding: .3rem .4rem; border-radius: 7px; }
.checks label:hover { background: var(--inner); }
.checks input { accent-color: var(--accent); width: 1rem; height: 1rem; }
.checks .grp { grid-column: 1 / -1; font-size: .64rem; font-weight: 800; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); margin-top: .5rem; }
.err-text { color: var(--bad); font-size: .78rem; font-weight: 650; }
.err-text:empty { display: none; }

.switch { position: relative; width: 2.55rem; height: 1.45rem; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch span { position: absolute; inset: 0; border-radius: 20px; background: var(--border-strong); transition: .15s; cursor: pointer; }
.switch span::after { content: ''; position: absolute; width: 1.05rem; height: 1.05rem; left: .2rem; top: .2rem; border-radius: 50%; background: #fff; transition: .15s; box-shadow: 0 1px 2px rgba(0,0,0,.3); }
.switch input:checked + span { background: var(--accent); }
.switch input:checked + span::after { transform: translateX(1.1rem); }
.switch input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------------------------------------------------------------- modal */
.modal-bg { position: fixed; inset: 0; background: rgba(8, 12, 20, .5); z-index: 200; display: flex; align-items: flex-start; justify-content: center; padding: 4vh 1rem; overflow-y: auto; animation: fade .12s ease; }
.modal { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; width: 100%; max-width: 44rem; box-shadow: var(--shadow-lg); display: flex; flex-direction: column; animation: pop .16s ease; }
.modal.wide { max-width: 74rem; }
.modal.narrow { max-width: 26rem; }
.modal-hd { display: flex; align-items: center; gap: .6rem; padding: .95rem 1.15rem; border-bottom: 1px solid var(--border); }
.modal-hd h3 { font-size: 1rem; font-weight: 800; flex: 1; min-width: 0; }
.modal-bd { padding: 1.05rem 1.15rem; }
.modal-ft { display: flex; justify-content: flex-end; gap: .5rem; padding: .85rem 1.15rem; border-top: 1px solid var(--border); flex-wrap: wrap; background: var(--surface-2); border-radius: 0 0 16px 16px; }
.x { width: 2rem; height: 2rem; border-radius: 8px; font-size: 1.05rem; color: var(--muted); display: grid; place-items: center; }
.x:hover { background: var(--inner); color: var(--text); }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(6px) scale(.99); } }

/* ---------------------------------------------------------------- toast */
.toasts { position: fixed; right: 1rem; top: calc(var(--hd) + .6rem); z-index: 300; display: flex; flex-direction: column; gap: .5rem; pointer-events: none; }
.toast { pointer-events: auto; display: flex; gap: .6rem; align-items: center; background: var(--text); color: var(--surface); border-radius: 10px; padding: .6rem .9rem; font-size: .82rem; font-weight: 600; box-shadow: var(--shadow-lg); max-width: 26rem; animation: pop .16s ease; }
.toast .ic { color: #4ade80; }
.toast.err .ic { color: #f87171; } .toast.warn .ic { color: #fbbf24; }
.toast button { color: inherit; font-weight: 800; text-decoration: underline; margin-left: .4rem; }

/* ----------------------------------------------------- popover panels */
.panel { position: fixed; top: calc(var(--hd) + .3rem); right: .8rem; width: min(24rem, calc(100vw - 1.6rem)); max-height: 70vh; overflow-y: auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); box-shadow: var(--shadow-lg); z-index: 150; padding: .6rem .8rem; animation: pop .14s ease; }
.panel h4 { font-size: .8rem; font-weight: 800; padding: .3rem 0 .5rem; }
.panel .list-row { cursor: pointer; }
.panel .list-row:hover { background: var(--inner); margin: 0 -.5rem; padding-left: .5rem; padding-right: .5rem; border-radius: 8px; }
.cmdk { position: fixed; inset: 0; z-index: 250; background: rgba(8,12,20,.45); display: flex; justify-content: center; align-items: flex-start; padding: 10vh 1rem; }
.cmdk-box { width: 100%; max-width: 36rem; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow-lg); overflow: hidden; animation: pop .14s ease; }
.cmdk-box input { width: 100%; padding: 1rem 1.1rem; border: 0; border-bottom: 1px solid var(--border); background: transparent; font-size: 1rem; outline: none; }
.cmdk-list { max-height: 55vh; overflow-y: auto; padding: .4rem; }
.cmdk-item { display: flex; align-items: center; gap: .65rem; padding: .55rem .65rem; border-radius: 8px; font-size: .84rem; cursor: pointer; }
.cmdk-item .ic { width: 1.7rem; height: 1.7rem; border-radius: 7px; background: var(--inner); display: grid; place-items: center; color: var(--text-2); }
.cmdk-item small { color: var(--muted); margin-left: auto; font-size: .7rem; }
.cmdk-item.on { background: var(--accent-soft); }
.cmdk-sec { font-size: .62rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); padding: .55rem .65rem .2rem; }

/* ------------------------------------------------------ domain widgets */
.stages { display: flex; flex-wrap: wrap; gap: .3rem; }
.stages span { font-size: .67rem; font-weight: 700; padding: .2rem .5rem; border-radius: 6px; background: var(--inner); border: 1px solid var(--border); color: var(--muted); }
.stages span.done { background: color-mix(in srgb, var(--good) 10%, transparent); color: var(--good); border-color: color-mix(in srgb, var(--good) 30%, transparent); }
.stages span.cur { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
.ind-card { border: 1px solid var(--border); border-radius: var(--r); padding: 1rem; background: var(--surface); display: flex; flex-direction: column; gap: .55rem; box-shadow: var(--shadow); }
.ind-card.on { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.ind-ic { width: 2.4rem; height: 2.4rem; border-radius: 10px; background: var(--accent-soft); color: var(--accent-strong); display: grid; place-items: center; font-size: 1.2rem; flex-shrink: 0; }
.feat-row { display: flex; align-items: center; gap: .8rem; padding: .7rem .1rem; border-top: 1px solid var(--border); cursor: pointer; }
.feat-row:first-of-type { border-top: 0; }
.feat-row > .ic { width: 2rem; height: 2rem; border-radius: 8px; background: var(--inner); display: grid; place-items: center; color: var(--text-2); font-size: 1rem; flex-shrink: 0; }
.feat-row b { font-size: .84rem; } .feat-row small { display: block; font-size: .73rem; color: var(--muted); }
.lock { position: fixed; inset: 0; z-index: 400; background: var(--bg); display: grid; place-items: center; padding: 1rem; }
.lock .card { width: 100%; max-width: 21rem; text-align: center; padding: 1.6rem; }
.lock input { width: 100%; text-align: center; font-size: 1.5rem; letter-spacing: .5em; padding: .65rem; border: 1px solid var(--border-strong); border-radius: 10px; background: var(--surface); margin: .9rem 0 .6rem; }
.pinpad { display: grid; grid-template-columns: repeat(3, 1fr); gap: .45rem; margin: .5rem 0 .9rem; }
.pinpad button { padding: .75rem 0; border-radius: 10px; background: var(--inner); font-size: 1.1rem; font-weight: 700; }
.pinpad button:active { background: var(--accent-soft); }
.label-sheet { display: grid; grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr)); gap: .6rem; }
.label { border: 1px dashed var(--border-strong); border-radius: 8px; padding: .6rem .7rem; font-size: .74rem; line-height: 1.5; background: var(--surface); }

/* network tree */
.tree { font-size: .82rem; }
.tree ul { list-style: none; margin-left: 1.1rem; padding-left: .9rem; border-left: 1px dashed var(--border-strong); }
.tree > ul { margin-left: 0; padding-left: 0; border-left: 0; }
.tree li { margin: .4rem 0; }
.node { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; padding: .55rem .7rem; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); box-shadow: var(--shadow-sm); }
.node .lvl { font-size: .62rem; font-weight: 800; padding: .1rem .45rem; border-radius: 5px; background: var(--accent-soft); color: var(--accent-strong); text-transform: uppercase; letter-spacing: .04em; }
.node .meta { display: flex; gap: .9rem; flex-wrap: wrap; font-size: .72rem; color: var(--muted); }
.node .meta b { color: var(--text); font-weight: 750; }

/* pipeline board */
.board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(15rem, 1fr); gap: .8rem; overflow-x: auto; padding-bottom: .5rem; }
.col { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r); padding: .6rem; min-height: 8rem; }
.col h5 { font-size: .7rem; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); display: flex; justify-content: space-between; padding: .2rem .2rem .5rem; }
.lead { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: .6rem .7rem; margin-bottom: .5rem; box-shadow: var(--shadow-sm); font-size: .78rem; }
.lead b { font-size: .83rem; display: block; }

/* POS */
.pos { display: grid; grid-template-columns: minmax(0, 1fr) 24rem; gap: 1rem; align-items: start; }
.pos-search { display: flex; gap: .5rem; margin-bottom: .7rem; }
.pos-search input { flex: 1; min-height: 2.7rem; padding: .5rem .8rem; border: 1px solid var(--border-strong); border-radius: 10px; background: var(--surface); font-size: .95rem; }
.pos-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(10rem, 1fr)); gap: .6rem; }
.tile { text-align: left; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: .75rem; box-shadow: var(--shadow-sm); display: flex; flex-direction: column; gap: .3rem; min-height: 6.4rem; transition: border-color .12s, transform .08s; }
.tile:hover { border-color: var(--accent); }
.tile:active { transform: scale(.98); }
.tile b { font-size: .8rem; line-height: 1.3; }
.tile .pr { margin-top: auto; font-weight: 850; font-size: .95rem; }
.tile .st { font-size: .68rem; color: var(--muted); }
.tile.out { opacity: .55; }
.cart { position: sticky; top: calc(var(--hd) + 1rem); background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow); display: flex; flex-direction: column; max-height: calc(100vh - var(--hd) - 2rem); }
.cart-hd { padding: .8rem 1rem; border-bottom: 1px solid var(--border); display: flex; flex-direction: column; gap: .5rem; }
.cart-lines { flex: 1; overflow-y: auto; padding: .3rem 1rem; min-height: 6rem; }
.cline { display: grid; grid-template-columns: 1fr auto auto; gap: .5rem; align-items: center; padding: .55rem 0; border-bottom: 1px solid var(--border); font-size: .8rem; }
.qty { display: inline-flex; align-items: center; border: 1px solid var(--border-strong); border-radius: 8px; overflow: hidden; }
.qty button { width: 1.9rem; height: 1.9rem; font-weight: 800; }
.qty button:hover { background: var(--inner); }
.qty input { width: 2.8rem; text-align: center; border: 0; border-left: 1px solid var(--border); border-right: 1px solid var(--border); height: 1.9rem; background: transparent; }
.cart-ft { padding: .8rem 1rem 1rem; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: .55rem; }
.tot { display: flex; justify-content: space-between; font-size: .8rem; color: var(--text-2); }
.tot.big { font-size: 1.25rem; font-weight: 850; color: var(--text); }
.paymodes { display: grid; grid-template-columns: repeat(4, 1fr); gap: .35rem; }
.paymodes button { padding: .5rem .2rem; border-radius: 9px; border: 1px solid var(--border-strong); font-size: .74rem; font-weight: 750; background: var(--surface); }
.paymodes button.on { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.charge { min-height: 3rem; font-size: 1rem; font-weight: 850; }
.pos-mini { display: none; }
.cline.cl2 { display: block; padding: .6rem 0; }
.cl-top { display: flex; gap: .6rem; align-items: flex-start; }
.cl-name { flex: 1; min-width: 0; line-height: 1.3; }
.cl-name b { font-size: .84rem; }
.cl-chips { display: flex; flex-wrap: wrap; gap: .25rem; margin-top: .2rem; }
.cl-amt { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; display: flex; flex-direction: column; align-items: flex-end; }
.cl-amt b { font-size: .88rem; }
.cl-bot { display: flex; align-items: center; gap: .35rem; margin-top: .35rem; flex-wrap: wrap; }
.cl-staffs { display: flex; flex-wrap: wrap; gap: .3rem; flex: 1; min-width: 0; align-items: center; }
.cl-who { display: inline-flex; align-items: center; gap: .2rem; background: var(--inner); border-radius: 20px; padding: .1rem .15rem .1rem .5rem; max-width: 100%; min-width: 0; }
.cl-staff { border: 0; background: transparent; font-size: .74rem; font-weight: 650; max-width: 9.5rem; min-width: 0; padding: .2rem .1rem; text-overflow: ellipsis; }
.cl-acts { display: inline-flex; gap: .15rem; margin-left: auto; align-items: center; }
.cl-acts .qty button { width: 1.7rem; height: 1.7rem; }
.cl-in { border: 1px solid var(--border-strong); border-radius: 7px; padding: .2rem .35rem; background: var(--surface); font-size: .76rem; min-height: 1.8rem; }
.cl-edit { display: flex; flex-wrap: wrap; gap: .45rem .8rem; margin-top: .45rem; padding: .5rem .6rem; background: var(--surface-2); border: 1px solid var(--border); border-radius: 9px; font-size: .72rem; font-weight: 700; color: var(--muted); }
.cl-edit label { display: inline-flex; align-items: center; gap: .3rem; }
.cl-edit .cl-note { flex: 1 1 100%; }
.cl-edit .cl-note input { flex: 1; min-width: 0; }
.cl-tier { display: flex; flex-direction: column; gap: .2rem; }
.cl-tier .bar { height: .3rem; }

/* charts */
.chart { position: relative; width: 100%; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart .gl { stroke: var(--border); stroke-width: 1; }
.chart .ax { fill: var(--muted); font-size: 10px; font-family: inherit; }
.chart .mk { fill: var(--accent); }
.chart .mk:hover, .chart .mk.hl { fill: var(--accent-strong); }
.chart .ln { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .hit { fill: transparent; cursor: default; }
.tip { position: fixed; z-index: 500; pointer-events: none; background: var(--text); color: var(--surface); font-size: .74rem; font-weight: 600; padding: .35rem .55rem; border-radius: 7px; box-shadow: var(--shadow-lg); white-space: nowrap; }
.hbar { display: grid; grid-template-columns: minmax(6rem, 11rem) 1fr auto; gap: .45rem .7rem; align-items: center; font-size: .78rem; }
.hbar .track { height: .6rem; background: var(--inner); border-radius: 4px; overflow: hidden; }
.hbar .track i { display: block; height: 100%; background: var(--accent); border-radius: 0 4px 4px 0; }
.hbar .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-2); }

/* ------------------------------------------------------------ responsive */
@media (max-width: 1100px) {
  .pos { grid-template-columns: minmax(0, 1fr) 20rem; }
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hd-search { min-width: 0; }
  .hd-search span.lbl, .hd-search kbd { display: none; }
}
@media (max-width: 900px) {
  :root { --bn: 3.9rem; }
  .menu-btn { display: inline-grid; }
  .side { position: fixed; left: 0; top: var(--hd); z-index: 60; transform: translateX(-102%); transition: transform .2s ease; height: calc(100vh - var(--hd)); padding-bottom: calc(2rem + var(--bn)); }
  body.nav-open .side { transform: none; box-shadow: var(--shadow-lg); }
  body.nav-open .scrim { display: block; position: fixed; inset: var(--hd) 0 0 0; background: rgba(8,12,20,.4); z-index: 55; }
  .main { padding: 1rem .9rem calc(2rem + var(--bn)); }
  .hd { padding: 0 .5rem; gap: .35rem; }
  .hd-search { margin-left: auto; padding: 0; width: 2.25rem; height: 2.25rem; justify-content: center; border-color: transparent; background: transparent; font-size: 1rem; color: var(--text-2); }
  .hd-actions { margin-left: 0; }
  .brand { flex: 1; }
  .brand-logo { width: 1.95rem; height: 1.95rem; }
  .hide-sm { display: none !important; }
  .g2, .g3 { grid-template-columns: minmax(0, 1fr); }
  .span2 { grid-column: auto; }
  .bottom-nav { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; position: fixed; left: 0; right: 0; bottom: 0; height: var(--bn); padding-bottom: env(safe-area-inset-bottom); background: var(--surface); border-top: 1px solid var(--border); z-index: 70; }
  .bottom-nav a, .bottom-nav button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .15rem; font-size: .62rem; font-weight: 700; color: var(--muted); }
  .bottom-nav .ic { font-size: 1.15rem; }
  .bottom-nav .active { color: var(--accent-strong); }
  .toolbar input[type=search] { min-width: 0; flex: 1 1 100%; }
  .ph h2 { font-size: 1.2rem; }
  .ph .acts { margin-left: 0; width: 100%; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .6rem; }
  .kpi { padding: .7rem .8rem; }
  .kpi .v { font-size: 1.1rem; }
  /* tablets keep the menu and the bill side by side */
  .pos { grid-template-columns: minmax(0, 1fr) 19rem; gap: .75rem; }
  .pos .cart { top: calc(var(--hd) + .6rem); max-height: calc(100vh - var(--hd) - var(--bn) - 1.2rem); }
  .pos-grid { grid-template-columns: repeat(auto-fill, minmax(8.6rem, 1fr)); }
  .board { grid-auto-columns: minmax(78vw, 1fr); }
}
@media (max-width: 760px) {
  .pos { grid-template-columns: minmax(0, 1fr); }
  .pos .cart { position: fixed; left: 0; right: 0; bottom: var(--bn); top: auto; z-index: 65; border-radius: 16px 16px 0 0; max-height: calc(100vh - var(--hd) - var(--bn) - 1rem); transform: translateY(calc(100% - 3.6rem)); transition: transform .2s ease; }
  .pos .cart.open { transform: none; box-shadow: var(--shadow-lg); }
  .pos-mini { display: flex; align-items: center; gap: .6rem; padding: .8rem 1rem; font-weight: 800; cursor: pointer; border-bottom: 1px solid var(--border); }
  .pos-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); padding-bottom: 4.5rem; }
}
@media (max-width: 720px) {
  /* tables become stacked cards */
  .tbl-wrap.rsp { border: 0; background: transparent; box-shadow: none; overflow: visible; }
  .rsp table.tbl, .rsp .tbl tbody, .rsp .tbl tr, .rsp .tbl td { display: block; width: 100%; }
  .rsp .tbl thead { display: none; }
  .rsp .tbl tbody tr { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); margin-bottom: .6rem; padding: .35rem .8rem; box-shadow: var(--shadow); }
  .rsp .tbl tbody tr:hover td { background: transparent; }
  .rsp .tbl td { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: .42rem 0; border-bottom: 1px dashed var(--border); text-align: right; }
  .rsp .tbl td:last-child { border-bottom: 0; }
  .rsp .tbl td::before { content: attr(data-l); font-size: .66rem; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); text-align: left; flex-shrink: 0; }
  .rsp .tbl td[data-l=""]::before { display: none; }
  .rsp .tbl td:first-child { display: block; text-align: left; font-size: .88rem; }
  .rsp .tbl td:first-child::before { display: none; }
  .rsp .tbl td.acts { justify-content: flex-end; flex-wrap: wrap; gap: .3rem; padding-top: .55rem; }
  .rsp .tbl td.acts .btn + .btn { margin-left: 0; }
  .rsp .tbl tfoot { display: block; }
  .rsp .tbl tfoot tr { display: flex; flex-wrap: wrap; gap: .3rem 1rem; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r); padding: .6rem .8rem; }
  .rsp .tbl tfoot td { display: inline-flex; gap: .4rem; border: 0; padding: 0; background: transparent; }
  .rsp .tbl tfoot td:empty { display: none; }
  .rsp .tbl tfoot td[data-l]::before { content: attr(data-l); font-size: .66rem; color: var(--muted); text-transform: uppercase; }
  .modal-bg { padding: 0; align-items: stretch; }
  .modal, .modal.wide, .modal.narrow { max-width: none; min-height: 100%; border-radius: 0; border: 0; }
  .modal-hd { position: sticky; top: 0; background: var(--surface); z-index: 2; }
  .modal-bd { flex: 1; padding: .9rem; }
  .modal-ft { position: sticky; bottom: 0; border-radius: 0; padding-bottom: calc(.85rem + env(safe-area-inset-bottom)); }
  .modal-ft .btn { flex: 1; min-height: 2.6rem; }
  .form { grid-template-columns: minmax(0, 1fr); }
  .btn { min-height: 2.4rem; }
  .btn.sm { min-height: 2rem; }
  .toasts { left: .8rem; right: .8rem; }
  .toast { max-width: none; }
  .hbar { grid-template-columns: minmax(5rem, 8rem) 1fr auto; }
}
@media print {
  .hd, .side, .toolbar, .tabs, .no-print, .bottom-nav { display: none !important; }
  .main { padding: 0; }
  body { background: #fff; }
}

/* calendar blocks (salon / appointments) */
.cal-blk { position: absolute; border-radius: 8px; border: 0; border-left: 4px solid var(--c); background: color-mix(in srgb, var(--c) 15%, var(--surface)); text-align: left; padding: .22rem .4rem; font-size: .7rem; line-height: 1.25; overflow: hidden; color: var(--text); display: flex; flex-direction: column; gap: .05rem; box-shadow: var(--shadow-sm); z-index: 1; }
.cal-blk:hover { z-index: 2; box-shadow: var(--shadow); background: color-mix(in srgb, var(--c) 24%, var(--surface)); }
.cal-blk > * { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
.cal-blk.short { flex-direction: row; align-items: center; gap: .3rem; }
.cal-blk.short span { font-size: .65rem; color: var(--muted); }
.cal-blk.done { opacity: .55; }

/* rewards tiers */
.tier-card { border-top: 3px solid var(--c); background: linear-gradient(180deg, color-mix(in srgb, var(--c) 7%, var(--surface)), var(--surface) 55%); }
.tier-badge { width: 2rem; height: 2rem; border-radius: 50%; display: grid; place-items: center; background: color-mix(in srgb, var(--c) 16%, transparent); color: var(--c); font-size: 1rem; }
.tier-strip { display: flex; align-items: center; gap: .8rem; flex-wrap: wrap; padding: .7rem .9rem; }
.tier-strip .grow { min-width: 10rem; display: flex; flex-direction: column; gap: .2rem; }
button.kpi { font: inherit; color: inherit; width: 100%; }
button.kpi:hover { border-color: var(--accent); }
