@import url('https://fonts.googleapis.com/css2?family=Instrument+Serif&family=Geist:wght@400;500;600;700&family=Geist+Mono:wght@400;500&display=swap');

/* ===================== TOKENS ===================== */
:root {
  --bg: #f6f5f2;
  --paper: #ffffff;
  --ink: #0e1116;
  --ink-2: #3d4552;
  --muted: #6b7280;
  --line: rgba(14,17,22,.08);
  --line-2: rgba(14,17,22,.05);
  --accent: #1f6f5c;
  --accent-2: #0b3d2e;
  --gold: #b78a2f;
  --coral: #c8553d;
  --sky: #5c8fb8;
  --shadow-lg: 0 30px 60px -30px rgba(14,17,22,.18), 0 12px 30px -18px rgba(14,17,22,.12);
  --shadow-sm: 0 1px 2px rgba(14,17,22,.04), 0 6px 20px -12px rgba(14,17,22,.08);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out: cubic-bezier(0.4, 0, 0.2, 1);
  --duration-fast: 150ms;
  --duration-normal: 250ms;
  --duration-slow: 400ms;
}

/* ===================== RESET ===================== */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--ink); font-family: 'Geist', ui-sans-serif, system-ui, sans-serif; font-size: 14px; line-height: 1.55; -webkit-font-smoothing: antialiased; letter-spacing: -.005em; }
a { color: inherit; text-decoration: none; }
button { cursor: pointer; font-family: inherit; }
input, textarea, select { font-family: inherit; font-size: inherit; }

/* ===================== TYPOGRAPHY ===================== */
.serif { font-family: 'Instrument Serif', serif; font-weight: 400; letter-spacing: -.01em; }
.mono { font-family: 'Geist Mono', ui-monospace, monospace; }

/* ===================== APP SHELL ===================== */
.app { width: 1440px; margin: 0 auto; display: grid; grid-template-columns: 260px 1fr; min-height: 100vh; background: var(--bg); position: relative; }
.app::before { content: ""; position: absolute; inset: 0; pointer-events: none; background: radial-gradient(1200px 500px at 80% -10%, rgba(31,111,92,.06), transparent 60%), radial-gradient(900px 400px at -10% 110%, rgba(183,138,47,.06), transparent 60%); }
.app.login-mode { grid-template-columns: 1fr; }

/* ===================== SIDEBAR ===================== */
.sidebar { position: sticky; top: 0; height: 100vh; padding: 22px 18px; border-right: 1px solid var(--line); background: rgba(255,255,255,.55); backdrop-filter: blur(12px); display: flex; flex-direction: column; z-index: 5; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 12px; padding: 4px 6px 20px 6px; border-bottom: 1px solid var(--line); }
.brand .mark { width: 36px; height: 36px; border-radius: 12px; background: radial-gradient(circle at 30% 30%, #3fa48b, #1f6f5c 60%, #0b3d2e); display: grid; place-items: center; color: #fff; font-family: 'Instrument Serif', serif; font-size: 20px; box-shadow: inset 0 0 0 1px rgba(255,255,255,.15), 0 6px 18px -8px rgba(31,111,92,.55); }
.brand .n { font-family: 'Instrument Serif', serif; font-size: 20px; line-height: 1; }
.brand .s { font-size: 11px; color: var(--muted); margin-top: 3px; letter-spacing: .02em; }

.side-section { margin-top: 18px; }
.side-title { font-size: 10.5px; text-transform: uppercase; letter-spacing: .12em; color: var(--muted); padding: 0 8px 6px; }
.side-item { display: flex; align-items: center; gap: 11px; padding: 9px 10px; border-radius: 10px; color: var(--ink-2); font-size: 13.5px; font-weight: 500; cursor: pointer; position: relative; border: 1px solid transparent; transition: background var(--duration-fast) var(--ease-out), color var(--duration-fast) var(--ease-out), box-shadow var(--duration-fast) var(--ease-out); }
.side-item:hover { background: rgba(14,17,22,.04); color: var(--ink); }
.side-item.active { background: #ffffff; color: var(--ink); box-shadow: var(--shadow-sm); border: 1px solid var(--line); }
.side-item.active::before { content: ""; position: absolute; left: -18px; top: 12px; bottom: 12px; width: 2px; background: var(--accent); border-radius: 2px; }
.side-item svg { width: 16px; height: 16px; color: currentColor; flex: none; }
.side-item .b { margin-left: auto; font-size: 10.5px; background: rgba(31,111,92,.1); color: var(--accent); padding: 1px 7px; border-radius: 999px; font-weight: 600; }

.sidebar-footer { margin-top: auto; padding-top: 16px; border-top: 1px solid var(--line); display: flex; align-items: center; gap: 12px; }
.sidebar-footer .logout-btn { margin-left: auto; cursor: pointer; color: var(--muted); transition: color var(--duration-fast); }
.sidebar-footer .logout-btn:hover { color: var(--coral); }
.av { width: 36px; height: 36px; border-radius: 12px; background: linear-gradient(135deg, #1f6f5c, #0b3d2e); color: #fff; display: grid; place-items: center; font-weight: 600; font-size: 12.5px; box-shadow: var(--shadow-sm); flex-shrink: 0; }
.who { font-size: 13px; font-weight: 600; }
.who small { display: block; color: var(--muted); font-weight: 400; font-size: 11.5px; margin-top: 1px; }

/* ===================== MAIN ===================== */
.main { position: relative; z-index: 1; }
.topbar { position: sticky; top: 0; z-index: 20; padding: 16px 32px; display: flex; align-items: center; gap: 16px; background: rgba(246,245,242,.75); backdrop-filter: blur(16px); border-bottom: 1px solid var(--line); }
.search { flex: 1; max-width: 460px; display: flex; align-items: center; gap: 10px; background: rgba(255,255,255,.8); border: 1px solid var(--line); border-radius: 12px; padding: 8px 12px; color: var(--muted); }
.search input { border: none; background: transparent; outline: none; font: inherit; color: var(--ink); width: 100%; }
.search input:focus { outline: none; }
.kbd { font-family: 'Geist Mono'; font-size: 10.5px; color: var(--muted); background: rgba(14,17,22,.04); border: 1px solid var(--line); border-radius: 6px; padding: 1px 6px; }
.top-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.ibtn { width: 38px; height: 38px; border-radius: 12px; background: rgba(255,255,255,.7); border: 1px solid var(--line); display: grid; place-items: center; color: var(--ink-2); cursor: pointer; position: relative; transition: background var(--duration-fast) var(--ease-out), transform var(--duration-fast) var(--ease-out), box-shadow var(--duration-fast) var(--ease-out); }
.ibtn:hover { background: #fff; transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.ibtn .dot { position: absolute; top: 8px; right: 8px; width: 7px; height: 7px; border-radius: 999px; background: var(--coral); box-shadow: 0 0 0 2px #fff; }

/* ===================== BUTTONS ===================== */
.btn { display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 14px; border-radius: 12px; font-weight: 500; font-size: 13px; border: 1px solid var(--line); background: rgba(255,255,255,.8); color: var(--ink); cursor: pointer; transition: background var(--duration-fast) var(--ease-out), transform var(--duration-fast) var(--ease-out), box-shadow var(--duration-fast) var(--ease-out); white-space: nowrap; }
.btn:hover { background: #fff; transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.btn.dark { background: var(--ink); color: #fff; border-color: var(--ink); }
.btn.dark:hover { background: #000; }
.btn.accent { background: var(--accent); color: #fff; border-color: var(--accent); box-shadow: 0 8px 20px -12px rgba(31,111,92,.6); }
.btn.accent:hover { background: var(--accent-2); }
.btn.coral { background: var(--coral); color: #fff; border-color: var(--coral); box-shadow: 0 8px 20px -12px rgba(200,85,61,.6); }
.btn.coral:hover { background: #a5432f; }
.btn:disabled, .btn.disabled { opacity: .5; pointer-events: none; }
.btn-loading { position: relative; color: transparent !important; pointer-events: none; }
.btn-loading::after { content: ""; position: absolute; width: 16px; height: 16px; border: 2px solid rgba(255,255,255,.3); border-top-color: #fff; border-radius: 50%; animation: spin .6s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ===================== PAGE ===================== */
.page { padding: 22px 32px 44px; }
.crumbs { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12.5px; }
.crumbs .now { color: var(--ink); }
.crumbs .sep { opacity: .5; }
.crumbs span.link { cursor: pointer; }
.crumbs span.link:hover { color: var(--accent); }

.hero { display: flex; align-items: flex-end; gap: 24px; margin: 14px 0 26px; padding-bottom: 20px; border-bottom: 1px solid var(--line); }
.hero h1 { margin: 0; font-family: 'Instrument Serif', serif; font-size: 44px; line-height: 1.05; letter-spacing: -.02em; }
.hero .id { color: var(--muted); font-family: 'Geist Mono'; font-size: 12px; margin-top: 6px; }
.hero .tags { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.hero-cta { margin-left: auto; display: flex; gap: 10px; align-items: center; flex-shrink: 0; }
.status-lg { display: flex; align-items: center; gap: 12px; background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 10px 14px; box-shadow: var(--shadow-sm); }
.status-lg .pulse { width: 10px; height: 10px; border-radius: 999px; background: var(--accent); }
.status-lg .t { font-size: 12px; color: var(--muted); }
.status-lg .v { font-weight: 600; font-size: 13px; }

/* ===================== TAGS & PILLS ===================== */
.tag { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; padding: 5px 10px; border-radius: 999px; background: rgba(255,255,255,.7); border: 1px solid var(--line); color: var(--ink-2); }
.tag .d { width: 6px; height: 6px; border-radius: 999px; background: var(--accent); }
.tag.gold .d { background: var(--gold); }
.tag.sky .d { background: var(--sky); }
.pill { font-size: 11px; padding: 3px 10px; border-radius: 999px; font-weight: 600; display: inline-flex; align-items: center; gap: 6px; transition: transform var(--duration-fast); }
.pill:hover { transform: scale(1.03); }
.pill .d { width: 6px; height: 6px; border-radius: 999px; background: currentColor; }
.p-ok { background: rgba(31,111,92,.10); color: var(--accent); }
.p-warn { background: rgba(183,138,47,.12); color: var(--gold); }
.p-bad { background: rgba(200,85,61,.10); color: var(--coral); }
.p-info { background: rgba(92,143,184,.12); color: var(--sky); }
.p-neutral { background: rgba(14,17,22,.05); color: var(--ink-2); }

/* ===================== KPI ===================== */
.kpi-strip { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 22px; }
.kpi { background: #fff; border: 1px solid var(--line); border-radius: 20px; padding: 20px; box-shadow: var(--shadow-sm); position: relative; overflow: hidden; transition: transform var(--duration-fast) var(--ease-out), box-shadow var(--duration-fast) var(--ease-out); }
.kpi:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.kpi::after { content: ""; position: absolute; right: -30px; top: -30px; width: 120px; height: 120px; border-radius: 50%; background: radial-gradient(circle, rgba(31,111,92,.08), transparent 70%); }
.kpi.g2::after { background: radial-gradient(circle, rgba(200,85,61,.08), transparent 70%); }
.kpi.g3::after { background: radial-gradient(circle, rgba(92,143,184,.10), transparent 70%); }
.kpi.g4::after { background: radial-gradient(circle, rgba(183,138,47,.10), transparent 70%); }
.kpi .lbl { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 8px; }
.kpi .lbl svg { width: 14px; height: 14px; }
.kpi .val { font-family: 'Instrument Serif', serif; font-size: 44px; line-height: 1; letter-spacing: -.02em; margin-top: 12px; display: flex; align-items: baseline; gap: 6px; }
.kpi .val .u { font-family: 'Geist'; font-size: 14px; color: var(--muted); font-weight: 500; }
.spark { margin-top: 14px; height: 32px; position: relative; }
.spark svg { width: 100%; height: 100%; }
.kpi .foot { display: flex; justify-content: space-between; align-items: center; margin-top: 10px; font-size: 11.5px; color: var(--muted); }
.kpi .foot .delta { color: var(--accent); font-weight: 600; }
.kpi .foot .delta.warn { color: var(--coral); }

/* ===================== ROWS / GRIDS ===================== */
.row { display: grid; gap: 14px; margin-bottom: 22px; }
.row.a { grid-template-columns: 1.6fr 1fr; }
.row.b { grid-template-columns: 1fr 1fr; }

/* ===================== PANEL ===================== */
.panel { background: #fff; border: 1px solid var(--line); border-radius: 22px; box-shadow: var(--shadow-sm); overflow: hidden; transition: transform var(--duration-fast) var(--ease-out), box-shadow var(--duration-fast) var(--ease-out); }
.panel .ph { display: flex; align-items: center; justify-content: space-between; padding: 18px 22px; border-bottom: 1px solid var(--line-2); }
.panel .ph h3 { margin: 0; font-family: 'Instrument Serif', serif; font-size: 22px; letter-spacing: -.01em; line-height: 1.1; }
.panel .ph .s { font-size: 12px; color: var(--muted); margin-top: 2px; }
.panel .pb { padding: 20px 22px; }

/* ===================== SEGMENTED CONTROL ===================== */
.seg { display: inline-flex; background: rgba(14,17,22,.05); border-radius: 10px; padding: 3px; gap: 2px; }
.seg button { border: 0; background: transparent; font: inherit; font-size: 12px; color: var(--muted); padding: 5px 10px; border-radius: 7px; font-weight: 500; cursor: pointer; transition: background var(--duration-fast), color var(--duration-fast), box-shadow var(--duration-fast); }
.seg button.on { background: #fff; color: var(--ink); box-shadow: var(--shadow-sm); }

/* ===================== FLOW VIZ ===================== */
.flow { position: relative; height: 460px; border-radius: 16px; overflow: hidden; background: radial-gradient(circle at 30% 30%, rgba(92,143,184,.15), transparent 60%), radial-gradient(circle at 70% 70%, rgba(31,111,92,.12), transparent 60%), linear-gradient(180deg, #f9f8f4, #efeee9); border: 1px solid var(--line-2); }
.flow svg { width: 100%; height: 100%; }
.flow .legend { position: absolute; left: 18px; bottom: 18px; background: rgba(255,255,255,.85); backdrop-filter: blur(10px); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; font-size: 11.5px; color: var(--ink-2); min-width: 220px; }
.legend .scale { height: 8px; border-radius: 999px; background: linear-gradient(90deg, #0b3d2e, #1f6f5c, #5c8fb8, #b78a2f, #c8553d); margin-top: 8px; }
.legend .sl { display: flex; justify-content: space-between; color: var(--muted); margin-top: 5px; font-family: 'Geist Mono'; font-size: 10.5px; }
.flow .tools { position: absolute; right: 16px; top: 16px; display: flex; flex-direction: column; gap: 8px; }
.flow .tools .ibtn { background: rgba(255,255,255,.9); }
.flow .stats { position: absolute; right: 16px; bottom: 16px; display: flex; gap: 10px; }
.flow .stat { background: rgba(255,255,255,.85); backdrop-filter: blur(10px); border: 1px solid var(--line); border-radius: 12px; padding: 8px 12px; }
.flow .stat .k { font-size: 10.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }
.flow .stat .v { font-family: 'Instrument Serif', serif; font-size: 20px; line-height: 1; margin-top: 2px; }

/* ===================== KEY-VALUE ===================== */
.kv { display: flex; justify-content: space-between; padding: 12px 0; border-bottom: 1px dashed var(--line); font-size: 13.5px; }
.kv:last-child { border-bottom: 0; }
.kv .k { color: var(--muted); }
.kv .v { font-weight: 600; }
.kv .v .mono { color: var(--ink-2); font-weight: 500; }

/* ===================== DO SLICES ===================== */
.slices { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.slice { border: 1px solid var(--line); border-radius: 16px; padding: 14px; background: linear-gradient(180deg, #fff, #fafaf7); }
.slice .sh { display: flex; justify-content: space-between; font-size: 11.5px; color: var(--muted); margin-bottom: 10px; }
.slice .sh .z { font-family: 'Geist Mono'; }
.disc { aspect-ratio: 1/1; border-radius: 50%; position: relative; overflow: hidden; box-shadow: inset 0 0 0 1px rgba(0,0,0,.04), 0 10px 30px -18px rgba(0,0,0,.25); }
.disc.top { background: radial-gradient(circle at 50% 50%, #eef7ff 0%, #cfe6f7 20%, #9dc2df 45%, #6ea1c7 70%, #3f7ba9 100%); }
.disc.mid { background: radial-gradient(circle at 50% 50%, #e8f2ea 0%, #b8d8bf 22%, #7fbb90 50%, #4a9160 78%, #1f6f5c 100%); }
.disc.bot { background: radial-gradient(circle at 50% 50%, #f6e9c8 0%, #e3c47a 30%, #c89b3e 60%, #8c6a26 100%); }
.disc .pct { position: absolute; inset: auto 0 0 0; bottom: 12px; text-align: center; color: #fff; font-family: 'Instrument Serif', serif; font-size: 22px; text-shadow: 0 1px 6px rgba(0,0,0,.35); }
.disc .lbl { position: absolute; top: 10px; left: 10px; font-family: 'Geist Mono'; font-size: 10px; color: rgba(255,255,255,.9); background: rgba(0,0,0,.25); padding: 2px 6px; border-radius: 6px; }

/* ===================== SHEAR CHART ===================== */
.chart { height: 240px; padding: 6px 4px 0; }
.chart svg { width: 100%; height: 100%; }
.axl { fill: #94a3a5; font-size: 10px; font-family: 'Geist Mono'; }

.metric-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 14px; }
.metric { padding: 12px 14px; border: 1px solid var(--line); border-radius: 14px; background: linear-gradient(180deg, #fff, #fafaf7); }
.metric .k { font-size: 11.5px; color: var(--muted); }
.metric .v { font-family: 'Instrument Serif', serif; font-size: 26px; line-height: 1; margin-top: 6px; }
.metric .sub { font-size: 11.5px; color: var(--accent); margin-top: 4px; font-weight: 600; }

/* ===================== TABLE ===================== */
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 14px 22px; font-size: 13.5px; border-bottom: 1px solid var(--line-2); }
th { color: var(--muted); font-weight: 500; font-size: 11px; text-transform: uppercase; letter-spacing: .1em; background: #fbfaf6; }
th.sortable { cursor: pointer; user-select: none; }
th.sortable:hover { color: var(--ink); }
td.num { font-family: 'Geist Mono'; text-align: right; }
tr:hover td { background: rgba(31,111,92,.02); }
tr.clickable { cursor: pointer; }
tr.clickable:hover td { background: rgba(31,111,92,.04); }

/* ===================== CTA ROW ===================== */
.cta-row { display: flex; justify-content: space-between; align-items: center; background: linear-gradient(135deg, #0e1116, #1c2530); color: #fff; border-radius: 22px; padding: 22px 26px; margin-top: 8px; box-shadow: var(--shadow-lg); }
.cta-row h4 { margin: 0; font-family: 'Instrument Serif', serif; font-size: 24px; letter-spacing: -.01em; }
.cta-row p { margin: 4px 0 0; color: rgba(255,255,255,.65); font-size: 13px; }
.cta-row .btn.dark { background: rgba(255,255,255,.1); border-color: rgba(255,255,255,.2); color: #fff; }
.cta-row .btn.dark:hover { background: rgba(255,255,255,.16); }
.cta-row .btn.accent { background: #3fa48b; border-color: #3fa48b; color: #0e1116; }

/* ===================== FOOTER ===================== */
.page-footer { padding: 22px 32px; color: var(--muted); font-size: 12px; display: flex; justify-content: space-between; border-top: 1px solid var(--line); }

/* ===================== LOGIN ===================== */
.login-container { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 40px; }
.login-brand { display: flex; align-items: center; gap: 14px; margin-bottom: 40px; }
.login-brand .mark { width: 48px; height: 48px; border-radius: 16px; background: radial-gradient(circle at 30% 30%, #3fa48b, #1f6f5c 60%, #0b3d2e); display: grid; place-items: center; color: #fff; font-family: 'Instrument Serif', serif; font-size: 26px; box-shadow: inset 0 0 0 1px rgba(255,255,255,.15), 0 6px 18px -8px rgba(31,111,92,.55); }
.login-title { font-family: 'Instrument Serif', serif; font-size: 32px; margin: 0 0 8px; }
.login-sub { color: var(--muted); font-size: 14px; margin: 0 0 32px; }
.user-cards { display: flex; gap: 16px; margin-bottom: 32px; }
.user-card { width: 200px; padding: 20px; border-radius: 16px; border: 2px solid var(--line); background: #fff; cursor: pointer; text-align: center; transition: border-color var(--duration-fast), transform var(--duration-fast), box-shadow var(--duration-fast); }
.user-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-sm); border-color: var(--accent); }
.user-card.selected { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(31,111,92,.15), var(--shadow-sm); }
.user-card .av { margin: 0 auto 12px; width: 48px; height: 48px; font-size: 16px; border-radius: 14px; }
.user-card .name { font-weight: 600; font-size: 14px; }
.user-card .role-label { font-size: 12px; color: var(--muted); margin-top: 4px; }
.login-form { width: 400px; background: #fff; border-radius: 20px; padding: 28px; border: 1px solid var(--line); box-shadow: var(--shadow-sm); }
.login-form .field { margin-bottom: 16px; }
.login-form label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 6px; font-weight: 500; }
.login-form input { width: 100%; padding: 10px 14px; border: 1px solid var(--line); border-radius: 10px; font-size: 14px; background: var(--bg); }
.login-form input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(31,111,92,.1); }
.login-form .btn { width: 100%; justify-content: center; height: 42px; margin-top: 8px; }

/* ===================== TOAST ===================== */
.toast-container { position: fixed; bottom: 24px; right: 24px; z-index: 9999; display: flex; flex-direction: column-reverse; gap: 10px; }
.toast { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-radius: 14px; background: #fff; border: 1px solid var(--line); box-shadow: var(--shadow-lg); font-size: 13.5px; min-width: 300px; max-width: 440px; transform: translateX(120%); transition: transform var(--duration-normal) var(--ease-out); }
.toast.show { transform: translateX(0); }
.toast .toast-icon { width: 20px; height: 20px; flex-shrink: 0; }
.toast .toast-close { margin-left: auto; cursor: pointer; color: var(--muted); padding: 4px; }
.toast .toast-close:hover { color: var(--ink); }
.toast.success .toast-icon { color: var(--accent); }
.toast.warning .toast-icon { color: var(--gold); }
.toast.error .toast-icon { color: var(--coral); }
.toast.info .toast-icon { color: var(--sky); }

/* ===================== MODAL ===================== */
.modal-overlay { position: fixed; inset: 0; background: rgba(14,17,22,.4); backdrop-filter: blur(4px); z-index: 9998; display: grid; place-items: center; opacity: 0; transition: opacity var(--duration-normal); }
.modal-overlay.show { opacity: 1; }
.modal-card { background: #fff; border-radius: 22px; padding: 28px; min-width: 420px; max-width: 560px; box-shadow: var(--shadow-lg); transform: scale(.95); transition: transform var(--duration-normal) var(--ease-out); }
.modal-overlay.show .modal-card { transform: scale(1); }
.modal-card h3 { margin: 0 0 12px; font-family: 'Instrument Serif', serif; font-size: 24px; }
.modal-card .modal-body { color: var(--ink-2); font-size: 14px; line-height: 1.6; margin-bottom: 20px; }
.modal-card .modal-actions { display: flex; gap: 10px; justify-content: flex-end; }

/* ===================== DROPDOWN ===================== */
.dropdown-wrap { position: relative; display: inline-block; }
.dropdown-trigger { cursor: pointer; }
.dropdown-panel { position: absolute; top: calc(100% + 4px); left: 0; background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-sm); min-width: 180px; z-index: 100; display: none; padding: 4px; }
.dropdown-panel.open { display: block; }
.dropdown-option { padding: 8px 12px; border-radius: 8px; font-size: 13px; cursor: pointer; color: var(--ink-2); }
.dropdown-option:hover { background: rgba(31,111,92,.06); color: var(--ink); }
.dropdown-option.active { background: rgba(31,111,92,.08); color: var(--accent); font-weight: 600; }

/* ===================== FORM FIELDS ===================== */
.form-field { margin-bottom: 18px; }
.form-field label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 6px; font-weight: 500; text-transform: uppercase; letter-spacing: .05em; }
.form-field input, .form-field select, .form-field textarea { width: 100%; padding: 10px 14px; border: 1px solid var(--line); border-radius: 10px; font-size: 14px; background: #fff; color: var(--ink); transition: border-color var(--duration-fast), box-shadow var(--duration-fast); }
.form-field input:focus, .form-field select:focus, .form-field textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(31,111,92,.1); }
.form-field textarea { min-height: 80px; resize: vertical; }
.form-field .hint { font-size: 11.5px; color: var(--muted); margin-top: 4px; }
.form-field .unit { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); font-size: 12px; color: var(--muted); font-family: 'Geist Mono'; }
.form-field .input-wrap { position: relative; }
.form-field .input-wrap input { padding-right: 48px; }
.form-field.error input, .form-field.error select { border-color: var(--coral); }
.form-field .error-msg { font-size: 11.5px; color: var(--coral); margin-top: 4px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

/* ===================== CARDS ===================== */
.card { background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 18px; box-shadow: var(--shadow-sm); cursor: pointer; transition: transform var(--duration-fast) var(--ease-out), box-shadow var(--duration-fast) var(--ease-out), border-color var(--duration-fast); }
.card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.card.selected { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(31,111,92,.15), var(--shadow-sm); }
.card.card-error { border-color: rgba(200,85,61,.3); background: linear-gradient(180deg, #fff, rgba(200,85,61,.03)); }
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; }

/* ===================== EMPTY STATE ===================== */
.empty-state { text-align: center; padding: 60px 20px; color: var(--muted); }
.empty-state svg { width: 48px; height: 48px; margin-bottom: 16px; opacity: .5; }
.empty-state h4 { font-family: 'Instrument Serif', serif; font-size: 22px; color: var(--ink); margin: 0 0 8px; }
.empty-state p { font-size: 14px; margin: 0 0 20px; }

/* ===================== TOGGLE ===================== */
.toggle { width: 40px; height: 22px; border-radius: 11px; background: var(--line); position: relative; cursor: pointer; transition: background var(--duration-fast); border: none; padding: 0; }
.toggle::after { content: ""; width: 18px; height: 18px; border-radius: 50%; background: #fff; position: absolute; top: 2px; left: 2px; transition: transform var(--duration-fast); box-shadow: var(--shadow-sm); }
.toggle.active { background: var(--accent); }
.toggle.active::after { transform: translateX(18px); }

/* ===================== INLINE EDIT ===================== */
.inline-edit input, .inline-edit select { padding: 6px 10px; border: 1px solid var(--accent); border-radius: 8px; font-size: 13px; }

/* ===================== ANIMATIONS ===================== */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }
.fade-in { animation: fadeIn var(--duration-normal) var(--ease-out) both; }
.slide-up { animation: slideUp var(--duration-normal) var(--ease-out) both; }
.stagger > * { animation: slideUp var(--duration-slow) var(--ease-out) both; }
.stagger > *:nth-child(1) { animation-delay: 0ms; }
.stagger > *:nth-child(2) { animation-delay: 60ms; }
.stagger > *:nth-child(3) { animation-delay: 120ms; }
.stagger > *:nth-child(4) { animation-delay: 180ms; }
.stagger > *:nth-child(5) { animation-delay: 240ms; }
.stagger > *:nth-child(6) { animation-delay: 300ms; }

/* ===================== SCHEMATIC ===================== */
.schematic-container { background: linear-gradient(180deg, #f9f8f4, #efeee9); border: 1px solid var(--line-2); border-radius: 16px; padding: 20px; min-height: 400px; display: grid; place-items: center; }

/* ===================== VIEW ONLY PILL ===================== */
.view-only-pill { background: rgba(92,143,184,.12); color: var(--sky); font-size: 11px; padding: 3px 10px; border-radius: 999px; font-weight: 600; margin-left: 12px; }

/* ===================== SCROLLBAR ===================== */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(14,17,22,.12); border-radius: 3px; }

/* ===================== PAGE TITLE ===================== */
.page-title { font-family: 'Instrument Serif', serif; font-size: 32px; margin: 14px 0 22px; letter-spacing: -.02em; }

/* ===================== SECTION HEADER ===================== */
.section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.section-header h2 { font-family: 'Instrument Serif', serif; font-size: 24px; margin: 0; letter-spacing: -.01em; }

/* ===================== TWO COL ===================== */
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; }
.two-col.wide-left { grid-template-columns: 1.5fr 1fr; }
.two-col.wide-right { grid-template-columns: 1fr 1.5fr; }
