/* CG software demos — shared product UI. Quiet, dense, legible. */
@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap");

:root {
  --accent: #1238C8;
  --accent-soft: color-mix(in srgb, var(--accent) 9%, #fff);
  --bg: #F6F7F9;
  --surface: #fff;
  --ink: #111827;
  --ink-2: #374151;
  --muted: #6B7280;
  --faint: #9CA3AF;
  --line: #E5E7EB;
  --line-2: #F0F1F3;
  --hover: #F9FAFB;
  --r: 8px;
  --side: 232px;
  --strip: 34px;
  --top: 60px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body { font: 13.5px/1.45 Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif; color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased; font-feature-settings: "cv11", "ss01"; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; }
a { color: inherit; text-decoration: none; }
.i { flex-shrink: 0; display: block; }
.grow { flex: 1; }
.muted { color: var(--muted); }
.mono { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 12px; color: var(--muted); }
.num, .r { font-variant-numeric: tabular-nums; }
.r { text-align: right; }
.lnk { color: var(--accent); font-weight: 500; }
.lnk:hover { text-decoration: underline; }
.lnk.sm { font-size: 12.5px; }
.count { display: inline-block; min-width: 18px; padding: 0 5px; border-radius: 9px; background: var(--line-2); color: var(--muted); font-size: 11px; font-weight: 600; line-height: 18px; text-align: center; }
.hint { color: var(--faint); font-size: 12px; }

/* Demo strip */
.strip { position: fixed; inset: 0 0 auto; height: var(--strip); z-index: 60; display: flex; align-items: center; gap: 14px; padding: 0 16px; background: #111827; color: #D1D5DB; font-size: 12px; }
.strip b { color: #fff; font-weight: 600; }
.strip-btn, .strip-link { display: inline-flex; align-items: center; gap: 6px; color: #D1D5DB; font-weight: 500; }
.strip-btn:hover, .strip-link:hover { color: #fff; }
.strip-cta { background: #fff; color: #111827; font-weight: 600; padding: 4px 10px; border-radius: 5px; }
.strip-cta:hover { background: #E5E7EB; }

/* Shell */
.shell { display: flex; min-height: 100vh; padding-top: var(--strip); }
.side { position: fixed; top: var(--strip); bottom: 0; left: 0; width: var(--side); background: var(--surface); border-right: 1px solid var(--line); display: flex; flex-direction: column; z-index: 20; }
.brand { display: flex; align-items: center; gap: 10px; height: var(--top); padding: 0 16px; border-bottom: 1px solid var(--line-2); }
.mark { width: 30px; height: 30px; border-radius: 7px; background: var(--accent); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 12px; letter-spacing: -.02em; flex-shrink: 0; }
.brand-txt { display: flex; flex-direction: column; min-width: 0; line-height: 1.2; }
.brand-name { font-weight: 700; font-size: 14px; letter-spacing: -.01em; }
.brand-ws { font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav { flex: 1; overflow-y: auto; padding: 10px 10px 16px; }
.nav-label { font-size: 11px; font-weight: 600; color: var(--faint); text-transform: uppercase; letter-spacing: .06em; padding: 14px 8px 6px; }
.nav-item { display: flex; align-items: center; gap: 10px; height: 34px; padding: 0 10px; border-radius: 6px; color: var(--ink-2); font-weight: 500; }
.nav-item .i { color: var(--faint); }
.nav-item:hover { background: var(--hover); color: var(--ink); }
.nav-item.on { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.nav-item.on .i { color: var(--accent); }
.nav-badge { margin-left: auto; font-size: 11px; font-weight: 600; color: var(--muted); background: var(--line-2); border-radius: 9px; padding: 0 7px; line-height: 18px; }
.nav-item.on .nav-badge { background: #fff; color: var(--accent); }
.side-foot { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-top: 1px solid var(--line-2); }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: #E5E7EB; color: var(--ink-2); display: grid; place-items: center; font-size: 11.5px; font-weight: 600; flex-shrink: 0; }
.who { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.who-name { font-weight: 600; font-size: 12.5px; }
.who-role { font-size: 11.5px; color: var(--muted); }

.main { flex: 1; min-width: 0; margin-left: var(--side); display: flex; flex-direction: column; }
.top { position: sticky; top: var(--strip); z-index: 15; height: var(--top); display: flex; align-items: center; gap: 10px; padding: 0 28px; background: rgba(246,247,249,.92); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.top-title { display: flex; align-items: baseline; gap: 12px; min-width: 0; margin-right: auto; }
.top h1 { font-size: 17px; font-weight: 650; letter-spacing: -.015em; white-space: nowrap; }
.top-sub { color: var(--muted); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.content { padding: 24px 28px 48px; }

/* Global search */
.gsearch { position: relative; display: flex; align-items: center; gap: 8px; width: 260px; height: 34px; padding: 0 10px; background: var(--surface); border: 1px solid var(--line); border-radius: 7px; color: var(--faint); }
.gsearch:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.gsearch input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--ink); }
.gs-results { display: none; position: absolute; top: 38px; right: 0; width: 380px; max-height: 420px; overflow: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: 0 12px 32px -8px rgba(17,24,39,.18); padding: 6px; z-index: 30; }
.gs-results.open { display: block; }
.gs-hit { width: 100%; display: grid; grid-template-columns: 76px 1fr; column-gap: 10px; text-align: left; padding: 8px 10px; border-radius: 6px; }
.gs-hit:hover { background: var(--hover); }
.gs-kind { grid-row: span 2; font-size: 11px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; padding-top: 2px; }
.gs-t { font-weight: 600; color: var(--ink); }
.gs-s { font-size: 12px; color: var(--muted); }
.gs-empty { padding: 14px; color: var(--muted); }

/* Buttons */
.btn { display: inline-flex; align-items: center; gap: 7px; height: 34px; padding: 0 13px; border-radius: 7px; border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); font-weight: 550; white-space: nowrap; transition: background .12s, border-color .12s; }
.btn:hover { background: var(--hover); border-color: #D1D5DB; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: color-mix(in srgb, var(--accent) 88%, #000); border-color: transparent; }
.btn-danger { background: #DC2626; border-color: #DC2626; color: #fff; }
.btn-danger:hover { background: #B91C1C; border-color: #B91C1C; }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-ghost:hover { background: var(--line-2); border-color: transparent; }
.btn-sm { height: 30px; padding: 0 10px; font-size: 12.5px; }
.icon-btn { width: 30px; height: 30px; display: inline-grid; place-items: center; border-radius: 6px; color: var(--muted); }
.icon-btn:hover { background: var(--line-2); color: var(--ink); }
.icon-btn.sm { width: 24px; height: 24px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

/* Pills */
.pill { display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 8px; border-radius: 11px; font-size: 12px; font-weight: 550; white-space: nowrap; }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .85; }
.pill-gray { background: #F3F4F6; color: #4B5563; }
.pill-blue { background: #EFF4FF; color: #1D4ED8; }
.pill-green { background: #ECFDF3; color: #047857; }
.pill-amber { background: #FFF7E6; color: #B45309; }
.pill-red { background: #FEF2F2; color: #B91C1C; }
.pill-violet { background: #F5F3FF; color: #6D28D9; }
.pill-teal { background: #EFFCFB; color: #0F766E; }
.pill-rose { background: #FFF1F3; color: #BE123C; }

/* Cards, KPIs */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; margin-bottom: 20px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px; }
.kpi[role="link"] { cursor: pointer; }
.kpi[role="link"]:hover { border-color: #D1D5DB; }
.kpi-l { font-size: 12.5px; color: var(--muted); font-weight: 500; }
.kpi-v { font-size: 24px; font-weight: 650; letter-spacing: -.02em; margin-top: 4px; font-variant-numeric: tabular-nums; }
.kpi-s { font-size: 12px; color: var(--muted); margin-top: 2px; }
.kpi-red .kpi-v { color: #B91C1C; }
.kpi-amber .kpi-v { color: #B45309; }
.kpi-green .kpi-v { color: #047857; }
.delta { font-size: 11.5px; font-weight: 600; margin-right: 4px; }
.delta.up { color: #047857; }
.delta.down { color: #B91C1C; }

.grid { display: grid; gap: 16px; }
.g-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g-21 { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.g-12 { grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); }
.grid + .grid, .kpis + .grid { margin-top: 16px; }
.panel-h { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 14px 16px 0; }
.panel-h h3 { font-size: 13.5px; font-weight: 650; }
.panel-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.panel-b { padding: 12px 16px 16px; }
.panel-b > .tbl.mini { margin: 0 -16px -16px; width: calc(100% + 32px); }

/* Toolbar, tabs, search */
.toolbar { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.search { display: flex; align-items: center; gap: 8px; width: 280px; height: 34px; padding: 0 10px; background: var(--surface); border: 1px solid var(--line); border-radius: 7px; color: var(--faint); }
.search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.search input { flex: 1; min-width: 0; border: 0; outline: 0; background: none; color: var(--ink); }
.filter { height: 34px; padding: 0 30px 0 10px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='none' stroke='%236B7280' stroke-width='2'%3E%3Cpath d='m3 4.5 3 3 3-3'/%3E%3C/svg%3E") no-repeat right 10px center; appearance: none; color: var(--ink-2); font-weight: 500; }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 14px; overflow-x: auto; }
.tab { display: inline-flex; align-items: center; gap: 6px; padding: 9px 12px; margin-bottom: -1px; border-bottom: 2px solid transparent; color: var(--muted); font-weight: 550; white-space: nowrap; }
.tab:hover { color: var(--ink); }
.tab.on { color: var(--ink); border-bottom-color: var(--accent); }
.tab.on .count { background: var(--accent-soft); color: var(--accent); }

/* Tables */
.table-card { overflow: hidden; }
.table-scroll { overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; }
.tbl th { position: sticky; top: 0; background: #FAFAFB; border-bottom: 1px solid var(--line); text-align: left; padding: 0; font-weight: 500; white-space: nowrap; }
.tbl th.r { text-align: right; }
.th { width: 100%; display: inline-flex; align-items: center; gap: 4px; padding: 9px 14px; font-size: 12px; color: var(--muted); font-weight: 550; text-align: inherit; justify-content: inherit; }
th.r .th { justify-content: flex-end; }
.th:hover, .th.on { color: var(--ink); }
.arrow { font-size: 11px; }
.tbl td { padding: 11px 14px; border-bottom: 1px solid var(--line-2); vertical-align: middle; white-space: nowrap; }
.tbl tbody tr { cursor: pointer; }
.tbl tbody tr:hover td { background: var(--hover); }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl .cell-t { font-weight: 550; color: var(--ink); }
.tbl .cell-s { font-size: 12px; color: var(--muted); }
.tbl .two { display: flex; flex-direction: column; line-height: 1.3; }
.tbl.mini th { padding: 8px 16px; font-size: 12px; color: var(--muted); font-weight: 550; }
.tbl.mini td { padding: 9px 16px; }
.tfoot { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12.5px; background: #FAFAFB; }
.tfoot b { color: var(--ink); font-weight: 600; }
.empty { padding: 40px 16px; text-align: center; color: var(--muted); }
.empty.sm { padding: 18px 0; }
.bar-inline { display: inline-block; width: 64px; height: 6px; border-radius: 3px; background: var(--line-2); overflow: hidden; vertical-align: middle; margin-right: 8px; }
.bar-inline i { display: block; height: 100%; background: var(--accent); }

/* Charts */
.bars { position: relative; margin: 8px 0 0 44px; }
.bars-grid { position: absolute; inset: 0 0 22px; }
.gl { position: absolute; left: 0; right: 0; border-top: 1px dashed var(--line); }
.gl span { position: absolute; right: calc(100% + 8px); top: -8px; font-size: 11px; color: var(--faint); white-space: nowrap; }
.bars-cols { position: absolute; inset: 0; display: flex; gap: 10px; }
.bc { flex: 1; display: flex; flex-direction: column; align-items: stretch; justify-content: flex-end; min-width: 0; }
.bar { position: relative; background: color-mix(in srgb, var(--accent) 22%, #fff); border-radius: 4px 4px 0 0; min-height: 2px; margin: 0 12%; transition: background .15s; }
.bar.cur { background: var(--accent); }
.bc:hover .bar { background: color-mix(in srgb, var(--accent) 70%, #fff); }
.bv { position: absolute; bottom: calc(100% + 4px); left: 50%; transform: translateX(-50%); font-size: 11px; font-weight: 600; color: var(--ink-2); white-space: nowrap; opacity: 0; transition: opacity .15s; }
.bc:hover .bv, .bar.cur .bv { opacity: 1; }
.bl { height: 22px; line-height: 22px; text-align: center; font-size: 11.5px; color: var(--muted); }
.hbars { display: flex; flex-direction: column; gap: 12px; }
.hb-top { display: flex; justify-content: space-between; gap: 12px; font-size: 12.5px; margin-bottom: 5px; }
.hb-l { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hb-v { font-weight: 600; font-variant-numeric: tabular-nums; }
.hb-track { height: 6px; background: var(--line-2); border-radius: 3px; overflow: hidden; }
.hb-fill { height: 100%; background: var(--accent); border-radius: 3px; }
.hb-s { font-size: 11.5px; color: var(--muted); margin-top: 3px; }
.split-bar { display: flex; height: 10px; border-radius: 5px; overflow: hidden; gap: 2px; background: var(--line-2); }
.split-legend { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 8px 16px; margin-top: 14px; }
.sl { display: flex; align-items: center; gap: 8px; font-size: 12.5px; }
.sl i { width: 8px; height: 8px; border-radius: 2px; }
.sl-l { color: var(--ink-2); }
.sl-v { margin-left: auto; font-weight: 600; font-variant-numeric: tabular-nums; }
.sb-gray { background: #9CA3AF; } .sb-blue { background: #3B6FE8; } .sb-green { background: #10B981; } .sb-amber { background: #F59E0B; }
.sb-red { background: #EF4444; } .sb-violet { background: #8B5CF6; } .sb-teal { background: #14B8A6; } .sb-rose { background: #F43F5E; }
.feed { list-style: none; }
.feed li { display: grid; grid-template-columns: 10px 1fr auto; gap: 10px; align-items: baseline; padding: 7px 0; border-bottom: 1px solid var(--line-2); font-size: 12.5px; }
.feed li:last-child { border-bottom: 0; }
.feed-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--faint); transform: translateY(-1px); }
.feed-t { color: var(--ink-2); }
.feed-w { color: var(--faint); font-size: 11.5px; white-space: nowrap; }

/* Board */
.board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(250px, 1fr); gap: 12px; overflow-x: auto; padding-bottom: 8px; align-items: start; }
.col { background: #EEF0F3; border-radius: var(--r); display: flex; flex-direction: column; min-height: 200px; transition: background .12s; }
.col.drop-over { background: var(--accent-soft); outline: 2px dashed color-mix(in srgb, var(--accent) 45%, #fff); }
.col-head { display: flex; align-items: center; gap: 8px; padding: 10px 10px 8px 12px; font-weight: 600; }
.col-dot { width: 8px; height: 8px; border-radius: 50%; padding: 0; background: currentColor; }
.col-sum { font-size: 12px; color: var(--muted); font-weight: 600; font-variant-numeric: tabular-nums; }
.col-body { display: flex; flex-direction: column; gap: 8px; padding: 0 8px 10px; }
.col-empty { color: var(--faint); font-size: 12px; text-align: center; padding: 16px 0; }
.bcard { background: var(--surface); border: 1px solid var(--line); border-radius: 7px; padding: 10px 12px; cursor: grab; box-shadow: 0 1px 2px rgba(17,24,39,.04); }
.bcard:hover { border-color: #D1D5DB; }
.bcard.dragging { opacity: .45; }
.bc-t { font-weight: 600; line-height: 1.3; }
.bc-s { color: var(--muted); font-size: 12px; margin-top: 2px; }
.bc-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 10px; font-size: 12px; color: var(--muted); }
.bc-v { font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums; }
.chip { display: inline-flex; align-items: center; height: 20px; padding: 0 7px; border-radius: 4px; background: var(--line-2); color: var(--ink-2); font-size: 11.5px; font-weight: 500; }
.chip.warn { background: #FFF7E6; color: #B45309; }
.chip.bad { background: #FEF2F2; color: #B91C1C; }
.mini-av { width: 22px; height: 22px; border-radius: 50%; background: #E5E7EB; color: var(--ink-2); display: inline-grid; place-items: center; font-size: 10px; font-weight: 600; }

/* Calendar */
.cal-bar .cal-label { font-weight: 600; font-size: 14px; margin-left: 4px; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); overflow: hidden; }
.seg .icon-btn { border-radius: 0; width: 32px; height: 32px; }
.seg-text button { height: 32px; padding: 0 12px; font-weight: 550; color: var(--muted); }
.seg-text button.on { background: var(--accent-soft); color: var(--accent); }
.legend { display: flex; flex-wrap: wrap; gap: 14px; margin: -2px 0 12px; font-size: 12px; color: var(--ink-2); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; border: 0 !important; }
.legend i.ev-blue { background: #3B6FE8; } .legend i.ev-green { background: #10B981; } .legend i.ev-violet { background: #8B5CF6; } .legend i.ev-amber { background: #F59E0B; } .legend i.ev-teal { background: #14B8A6; } .legend i.ev-rose { background: #F43F5E; } .legend i.ev-red { background: #EF4444; } .legend i.ev-gray { background: #9CA3AF; }
.cal { overflow: auto; max-height: calc(100vh - var(--strip) - var(--top) - 140px); }
.cal-head, .cal-body { display: grid; min-width: fit-content; }
.cal-head { position: sticky; top: 0; z-index: 3; background: var(--surface); border-bottom: 1px solid var(--line); }
.ch { display: flex; align-items: baseline; justify-content: center; gap: 6px; padding: 10px 6px; border-left: 1px solid var(--line-2); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ch-w { color: var(--muted); font-weight: 500; font-size: 12px; }
.ch.today .ch-d { background: var(--accent); color: #fff; border-radius: 11px; padding: 0 7px; }
.cal-body { position: relative; }
.cal-gutter div { white-space: nowrap; font-size: 11px; color: var(--faint); text-align: right; padding-right: 8px; transform: translateY(-7px); }
.cal-gutter div:first-child { visibility: hidden; }
.cal-col { position: relative; border-left: 1px solid var(--line-2); background-image: repeating-linear-gradient(to bottom, transparent 0, transparent 51px, var(--line-2) 51px, var(--line-2) 52px); cursor: copy; }
.cal-col.today { background-color: color-mix(in srgb, var(--accent) 3%, #fff); }
.cal-col.drop-over { background-color: var(--accent-soft); }
.ev { position: absolute; border-radius: 5px; padding: 4px 7px; font-size: 12px; line-height: 1.25; overflow: hidden; cursor: pointer; border-left: 3px solid; }
.ev:hover { filter: brightness(.97); z-index: 2; }
.ev.dragging { opacity: .5; }
.ev-t { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ev-s { opacity: .85; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ev-blue { background: #EFF4FF; border-color: #3B6FE8; color: #1E3A8A; }
.ev-green { background: #ECFDF3; border-color: #10B981; color: #065F46; }
.ev-violet { background: #F5F3FF; border-color: #8B5CF6; color: #4C1D95; }
.ev-amber { background: #FFF7E6; border-color: #F59E0B; color: #78350F; }
.ev-teal { background: #EFFCFB; border-color: #14B8A6; color: #134E4A; }
.ev-rose { background: #FFF1F3; border-color: #F43F5E; color: #881337; }
.ev-gray { background: #F3F4F6; border-color: #9CA3AF; color: #374151; }
.ev-red { background: #FEF2F2; border-color: #EF4444; color: #7F1D1D; }
.now { position: absolute; left: 56px; right: 0; height: 0; border-top: 2px solid #EF4444; z-index: 2; pointer-events: none; }
.now::before { content: ""; position: absolute; left: -5px; top: -6px; width: 10px; height: 10px; border-radius: 50%; background: #EF4444; }

/* Drawer */
.scrim { position: fixed; inset: var(--strip) 0 0 0; background: rgba(17,24,39,.28); z-index: 40; animation: fade .15s ease; }
.drawer { position: fixed; top: var(--strip); right: 0; bottom: 0; width: min(560px, 100vw); background: var(--surface); z-index: 41; display: flex; flex-direction: column; box-shadow: -20px 0 50px -20px rgba(17,24,39,.3); animation: slide .2s cubic-bezier(.2,.8,.2,1); }
.drawer > .form { display: flex; flex-direction: column; height: 100%; }
@keyframes slide { from { transform: translateX(24px); opacity: 0; } }
@keyframes fade { from { opacity: 0; } }
.dr-head { padding: 14px 22px 16px; border-bottom: 1px solid var(--line); }
.dr-nav { display: flex; align-items: center; gap: 4px; margin: 0 -8px 6px 0; }
.dr-nav .icon-btn:first-child { margin-left: -8px; }
.dr-kicker { font-size: 12px; color: var(--muted); font-weight: 500; }
.dr-head h2 { font-size: 19px; font-weight: 650; letter-spacing: -.015em; line-height: 1.25; }
.dr-sub { color: var(--muted); margin-top: 2px; }
.dr-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 14px; }
.status-select { position: relative; display: inline-flex; align-items: center; height: 30px; border-radius: 15px; padding: 0 28px 0 22px; font-weight: 600; font-size: 12.5px; }
.status-select::before { content: ""; position: absolute; left: 10px; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.status-select::after { content: ""; position: absolute; right: 11px; top: 11px; width: 5px; height: 5px; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(45deg); pointer-events: none; }
.status-select select { appearance: none; border: 0; background: transparent; color: inherit; font-weight: 600; cursor: pointer; outline: 0; }
.dr-body { flex: 1; overflow-y: auto; padding: 18px 22px 28px; }
.dr-summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; margin-bottom: 18px; }
.sum { background: #FAFAFB; padding: 10px 12px; }
.sum-l { font-size: 11.5px; color: var(--muted); }
.sum-v { font-size: 16px; font-weight: 650; margin-top: 2px; font-variant-numeric: tabular-nums; }
.sum-v.red { color: #B91C1C; } .sum-v.green { color: #047857; }
.dl { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 20px; }
.dl-row.wide { grid-column: 1 / -1; }
.dl dt { font-size: 12px; color: var(--muted); margin-bottom: 2px; }
.dl dd { font-weight: 500; word-break: break-word; }
.sec { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; margin: 24px 0 8px; display: flex; align-items: center; gap: 8px; }
.lines { width: 100%; border-collapse: collapse; font-size: 13px; }
.lines th { text-align: left; font-size: 11.5px; font-weight: 550; color: var(--muted); padding: 6px 0; border-bottom: 1px solid var(--line); }
.lines td { padding: 8px 0; border-bottom: 1px solid var(--line-2); }
.lines th.r, .lines td.r { text-align: right; padding-left: 12px; }
.lines tfoot td { border: 0; padding: 4px 0; color: var(--muted); }
.lines tfoot td.r { color: var(--ink-2); }
.lines tfoot tr:first-child td { padding-top: 10px; }
.lines tfoot .grand td { color: var(--ink); font-weight: 650; font-size: 14px; padding-top: 8px; border-top: 1px solid var(--line); }
.rel { margin-top: 8px; }
.rel-head { display: flex; align-items: center; justify-content: space-between; }
.rel-head .sec { margin-bottom: 8px; }
.rel-list { border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.rel-row { width: 100%; display: flex; align-items: center; gap: 12px; text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line-2); }
.rel-row:last-child { border-bottom: 0; }
.rel-row:hover { background: var(--hover); }
.rel-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.rel-t { font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rel-s { font-size: 12px; color: var(--muted); }
.rel-m { font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.rel-empty { color: var(--faint); font-size: 12.5px; padding: 4px 0; }
.note { background: #FAFAFB; border: 1px solid var(--line); border-radius: var(--r); padding: 12px 14px; margin-top: 16px; color: var(--ink-2); }
.note.warn { background: #FFFBEB; border-color: #FDE68A; color: #92400E; }

/* Forms */
.fgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 16px; }
.fld.wide { grid-column: 1 / -1; }
.fld label { display: block; font-size: 12.5px; font-weight: 550; color: var(--ink-2); margin-bottom: 5px; }
.req { color: #DC2626; }
.fld input:not([type="checkbox"]), .fld select, .fld textarea, .le-row input { width: 100%; height: 36px; padding: 0 10px; border: 1px solid #D1D5DB; border-radius: 7px; background: var(--surface); outline: 0; transition: border-color .12s, box-shadow .12s; }
.fld textarea { height: auto; padding: 8px 10px; resize: vertical; }
.fld input:focus, .fld select:focus, .fld textarea:focus, .le-row input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.fld.err input, .fld.err select, .fld.err textarea { border-color: #DC2626; }
.ferr { color: #B91C1C; font-size: 12px; margin-top: 4px; }
.fhelp { color: var(--muted); font-size: 12px; margin-top: 4px; }
.affix { display: flex; align-items: center; position: relative; }
.affix .pre, .affix .post { position: absolute; color: var(--muted); font-size: 13px; pointer-events: none; }
.affix .pre { left: 10px; }
.affix .post { right: 10px; }
.affix .pre + input { padding-left: 22px !important; }
.check { display: inline-flex !important; align-items: center; gap: 8px; font-weight: 500 !important; cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: var(--accent); }
.dr-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 22px; border-top: 1px solid var(--line); background: #FAFAFB; }
.lines-ed { border: 1px solid var(--line); border-radius: var(--r); padding: 10px; }
.le-row { display: grid; grid-template-columns: minmax(0, 1fr) 64px 92px 92px 30px; gap: 6px; align-items: center; margin-bottom: 6px; }
.le-row input { height: 32px; }
.le-head { font-size: 11.5px; color: var(--muted); font-weight: 550; margin-bottom: 4px; }
.le-amt { font-weight: 550; font-variant-numeric: tabular-nums; }
.le-tot { margin-top: 6px; }

/* Modal */
.modal { position: fixed; z-index: 51; top: 50%; left: 50%; transform: translate(-50%, -50%); width: min(440px, calc(100vw - 32px)); max-height: calc(100vh - 64px); display: flex; flex-direction: column; background: var(--surface); border-radius: 10px; box-shadow: 0 30px 60px -20px rgba(17,24,39,.4); animation: fade .15s ease; }
.modal.wide { width: min(820px, calc(100vw - 32px)); }
#modal .scrim { z-index: 50; }
.modal-head { display: flex; align-items: center; gap: 8px; padding: 16px 20px 0; }
.modal-head h3 { font-size: 16px; font-weight: 650; }
.modal-body { padding: 10px 20px 18px; color: var(--ink-2); overflow-y: auto; }
.modal-body p + p { margin-top: 8px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 20px; border-top: 1px solid var(--line); background: #FAFAFB; border-radius: 0 0 10px 10px; }
.doc-wrap { background: var(--bg); padding: 20px; margin-top: 14px; }

/* Printable document */
.print-doc { background: #fff; color: #111827; max-width: 720px; margin: 0 auto; padding: 44px 48px; border: 1px solid var(--line); border-radius: 4px; font-size: 13px; }
.doc-top { display: flex; justify-content: space-between; gap: 24px; margin-bottom: 36px; }
.doc-co { font-weight: 700; font-size: 16px; }
.doc-small { color: #6B7280; font-size: 12px; line-height: 1.55; }
.doc-title { font-size: 26px; font-weight: 700; letter-spacing: -.02em; text-align: right; }
.doc-meta { display: grid; grid-template-columns: auto auto; gap: 2px 16px; margin-top: 8px; font-size: 12px; justify-content: end; }
.doc-meta span:nth-child(odd) { color: #6B7280; }
.doc-to { margin-bottom: 26px; }
.doc-to h5 { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: #6B7280; margin-bottom: 4px; }
.doc-foot { margin-top: 32px; padding-top: 14px; border-top: 1px solid var(--line); color: #6B7280; font-size: 11.5px; line-height: 1.6; }
.doc-paid { display: inline-block; border: 2px solid #047857; color: #047857; font-weight: 700; letter-spacing: .1em; padding: 2px 10px; border-radius: 4px; transform: rotate(-4deg); margin-top: 10px; }

/* Settings */
.settings { display: flex; flex-direction: column; gap: 16px; max-width: 880px; }
.set-sec { display: grid; grid-template-columns: 240px 1fr; gap: 24px; padding: 20px; }
.set-h h3 { font-size: 14px; font-weight: 650; }
.set-h p { color: var(--muted); font-size: 12.5px; margin-top: 4px; }
.set-actions { display: flex; justify-content: flex-end; }
.set-sec.danger .set-h h3 { color: #B91C1C; }

/* Toasts */
.toasts { position: fixed; right: 20px; bottom: 20px; z-index: 70; display: flex; flex-direction: column; gap: 8px; }
.toast { display: flex; align-items: center; gap: 8px; background: #111827; color: #fff; padding: 10px 14px; border-radius: 8px; font-weight: 500; box-shadow: 0 10px 30px -10px rgba(0,0,0,.4); animation: slide .2s ease; transition: opacity .3s, transform .3s; }
.toast .i { color: #34D399; }
.toast.out { opacity: 0; transform: translateY(6px); }

/* Print */
@media print {
  body.printing > *:not(#modal) { display: none !important; }
  body.printing #modal .scrim, body.printing .modal-head { display: none !important; }
  body.printing .modal { position: static; transform: none; box-shadow: none; width: auto; max-height: none; }
  body.printing .doc-wrap { background: none; padding: 0; margin: 0; }
  body.printing .print-doc { border: 0; padding: 0; max-width: none; }
}

/* Narrow screens */
@media (max-width: 900px) {
  :root { --side: 0px; }
  .side { position: static; width: auto; height: auto; flex-direction: row; align-items: center; border-right: 0; border-bottom: 1px solid var(--line); overflow-x: auto; }
  .shell { flex-direction: column; }
  .brand { border: 0; height: 52px; }
  .nav { display: flex; padding: 0 8px; overflow: visible; }
  .nav-label, .side-foot, .nav-badge { display: none; }
  .nav-item { white-space: nowrap; }
  .main { margin-left: 0; }
  .top { position: static; padding: 0 16px; }
  .gsearch { display: none; }
  .content { padding: 16px; }
  .g-2, .g-3, .g-21, .g-12 { grid-template-columns: 1fr; }
  .set-sec { grid-template-columns: 1fr; }
  .strip > span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .strip-link { display: none; }
}
.fld select { appearance: none; padding-right: 30px !important; background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='none' stroke='%236B7280' stroke-width='2'%3E%3Cpath d='m3 4.5 3 3 3-3'/%3E%3C/svg%3E") no-repeat right 10px center; }
.show-more { display: block; width: 100%; padding: 11px; border-top: 1px solid var(--line); color: var(--accent); font-weight: 550; background: #fff; }
.show-more:hover { background: var(--hover); }
