@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');

/* ═══════════════════════════════════════════════
   DESIGN TOKENS
   ═══════════════════════════════════════════════ */
:root {
  --bg: #f6f6f3;
  --panel: #ffffff;
  --ink: #0f1115;
  --ink2: #3c3f46;
  --mute: #7a7e87;
  --line: #ececea;
  --line2: #e4e4e0;
  --accent: #1c1d20;
  --green: #1a7f5a;
  --green-bg: #e7f3ec;
  --amber: #a25f00;
  --amber-bg: #fbf0d9;
  --red: #a31f1f;
  --red-bg: #fbe7e3;
  --blue: #2942d6;
  --blue-bg: #e7eaff;
  --violet: #5b3ee0;
  --font-sans: 'Geist', -apple-system, sans-serif;
  --font-serif: 'Instrument Serif', serif;
  --font-mono: 'Geist Mono', monospace;
  --radius-sm: 5px;
  --radius-md: 8px;
  --radius-lg: 10px;
  --radius-xl: 12px;
  --radius-2xl: 16px;
  --radius-3xl: 18px;
  --radius-full: 999px;
  --shadow-sm: 0 1px 2px rgba(15,17,21,.04);
  --shadow-md: 0 1px 0 rgba(15,17,21,.02), 0 4px 12px -4px rgba(15,17,21,.1);
  --shadow-lg: 0 1px 0 rgba(15,17,21,.02), 0 10px 30px -18px rgba(15,17,21,.18);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
  --duration-fast: 120ms;
  --duration-normal: 200ms;
  --duration-slow: 350ms;
}

/* ═══════════════════════════════════════════════
   RESET & BASE
   ═══════════════════════════════════════════════ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
  background: var(--bg);
  font-family: var(--font-sans);
  color: var(--ink);
  font-size: 13.5px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
input, button, select, textarea { font-family: inherit; font-size: inherit; }
button { cursor: pointer; border: none; background: none; }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }

/* ═══════════════════════════════════════════════
   LAYOUT
   ═══════════════════════════════════════════════ */
.shell { width: 1440px; margin: 0 auto; display: flex; min-height: 100vh; }
.shell-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.content-area { flex: 1; min-height: 0; }

/* ═══════════════════════════════════════════════
   SIDEBAR
   ═══════════════════════════════════════════════ */
.sb { width: 260px; background: linear-gradient(180deg, #fbfbf9, #f4f4f1); border-right: 1px solid var(--line2); position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; padding: 18px 14px; flex-shrink: 0; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 10px; padding: 6px 8px 18px; }
.brand .m { width: 30px; height: 30px; border-radius: 9px; background: radial-gradient(circle at 30% 30%, #fff, #d6d6cf 70%); border: 1px solid #d6d6cf; display: grid; place-items: center; font-family: var(--font-serif); font-size: 18px; color: var(--ink); }
.brand .nm { font-weight: 600; letter-spacing: -.01em; font-size: 15px; }
.brand .sub { font-family: var(--font-serif); font-size: 13.5px; color: var(--mute); font-style: italic; margin-left: 2px; }
.brand .workspace { font-size: 11px; color: var(--mute); font-family: var(--font-mono); margin-top: 2px; }
.sb-cta { display: flex; align-items: center; gap: 8px; background: var(--ink); color: #fff; border-radius: var(--radius-lg); padding: 9px 12px; font-weight: 500; font-size: 13px; justify-content: center; margin-bottom: 14px; cursor: pointer; border: 1px solid #000; transition: background var(--duration-fast) var(--ease-out); }
.sb-cta:hover { background: #222; }
.sb-cta .k { margin-left: auto; font-family: var(--font-mono); font-size: 11px; color: #a5a5a5; background: #26272b; padding: 1px 6px; border-radius: var(--radius-sm); }
.group { font-size: 11px; font-weight: 500; color: var(--mute); padding: 6px 10px; text-transform: uppercase; letter-spacing: .08em; }
.nv { display: flex; flex-direction: column; gap: 1px; margin-bottom: 18px; }
.nv a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--radius-md); color: var(--ink2); text-decoration: none; font-size: 13px; font-weight: 500; transition: background var(--duration-fast) var(--ease-out); }
.nv a:hover { background: rgba(0,0,0,.04); }
.nv a.act { background: #fff; color: var(--ink); box-shadow: var(--shadow-sm), 0 0 0 1px var(--line); }
.nv a .ico { width: 18px; display: inline-flex; justify-content: center; color: var(--mute); }
.nv a.act .ico { color: var(--ink); }
.nv a .ct { margin-left: auto; font-family: var(--font-mono); font-size: 11px; color: var(--mute); }
.nv a.act .ct { color: var(--ink); }
.sb-foot { margin-top: auto; border-top: 1px solid var(--line); padding-top: 12px; display: flex; gap: 10px; align-items: center; position: relative; }
.av { width: 34px; height: 34px; border-radius: var(--radius-lg); background: linear-gradient(135deg, #e8e6dc, #cfcdc3); display: grid; place-items: center; font-weight: 600; font-size: 12px; color: var(--ink2); flex-shrink: 0; }
.who .n { font-weight: 600; font-size: 13px; }
.who .r { font-size: 11.5px; color: var(--mute); }
.who-cog { margin-left: auto; color: var(--mute); cursor: pointer; padding: 4px 8px; border-radius: var(--radius-sm); transition: background var(--duration-fast); }
.who-cog:hover { background: rgba(0,0,0,.06); }
.sb-dropdown { position: absolute; bottom: 52px; right: 0; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); padding: 4px; min-width: 160px; z-index: 100; display: none; }
.sb-dropdown.open { display: block; }
.sb-dropdown button { display: flex; align-items: center; gap: 8px; width: 100%; padding: 8px 12px; border-radius: var(--radius-md); font-size: 13px; color: var(--ink2); font-weight: 500; }
.sb-dropdown button:hover { background: var(--bg); }
.sb-dropdown button svg { color: var(--mute); }

/* ═══════════════════════════════════════════════
   TOPBAR
   ═══════════════════════════════════════════════ */
.topbar { background: rgba(246,246,243,.85); backdrop-filter: saturate(160%) blur(10px); border-bottom: 1px solid var(--line); padding: 14px 32px; display: flex; align-items: center; gap: 14px; position: sticky; top: 0; z-index: 20; }
.crumbs { font-size: 12.5px; color: var(--mute); display: flex; align-items: center; gap: 8px; }
.crumbs b { color: var(--ink); font-weight: 500; }
.crumbs .slash { opacity: .5; }
.search { margin-left: auto; width: 380px; display: flex; align-items: center; gap: 8px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 8px 12px; color: var(--mute); font-size: 13px; cursor: text; }
.search .k { margin-left: auto; font-family: var(--font-mono); font-size: 11px; color: var(--mute); background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 1px 6px; }
.icb { width: 36px; height: 36px; border-radius: var(--radius-lg); background: #fff; border: 1px solid var(--line); display: grid; place-items: center; color: var(--ink2); position: relative; cursor: pointer; transition: background var(--duration-fast); }
.icb:hover { background: var(--bg); }
.icb .notif-dot { position: absolute; top: 7px; right: 7px; width: 8px; height: 8px; background: var(--red); border-radius: 50%; box-shadow: 0 0 0 2px #fff; }

/* ═══════════════════════════════════════════════
   HERO
   ═══════════════════════════════════════════════ */
.hero { padding: 28px 32px 12px; position: relative; z-index: 10; }
.eyebrow { display: inline-flex; align-items: center; gap: 8px; font-size: 12px; color: var(--mute); background: #fff; border: 1px solid var(--line); padding: 4px 10px 4px 6px; border-radius: var(--radius-full); }
.eyebrow .pill { background: var(--green-bg); color: var(--green); padding: 1px 8px; border-radius: var(--radius-full); font-weight: 600; font-size: 11px; }
.h1 { font-size: 30px; font-weight: 600; letter-spacing: -.02em; margin-top: 14px; color: var(--ink); display: flex; align-items: baseline; gap: 12px; }
.h1 em { font-family: var(--font-serif); font-style: italic; font-weight: 400; color: var(--ink2); }
.h-sub { color: var(--mute); font-size: 14px; margin-top: 8px; max-width: 680px; }
.hero-row { display: flex; gap: 24px; align-items: flex-end; justify-content: space-between; margin-top: 18px; }
.seg { display: inline-flex; background: #fff; border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 3px; gap: 2px; }
.seg span { padding: 6px 12px; font-size: 12.5px; color: var(--mute); border-radius: 7px; cursor: pointer; font-weight: 500; transition: all var(--duration-fast) var(--ease-out); }
.seg span:hover { color: var(--ink2); }
.seg span.on { background: var(--ink); color: #fff; }

/* ═══════════════════════════════════════════════
   BUTTONS
   ═══════════════════════════════════════════════ */
.btn { border: 1px solid var(--line); background: #fff; color: var(--ink); padding: 8px 14px; border-radius: var(--radius-lg); font-weight: 500; font-size: 13px; cursor: pointer; display: inline-flex; align-items: center; gap: 7px; transition: all var(--duration-fast) var(--ease-out); }
.btn:hover { background: var(--bg); }
.btn-d { background: var(--ink); color: #fff; border-color: #000; }
.btn-d:hover { background: #222; }
.btn-danger { border-color: var(--red); color: var(--red); }
.btn-danger:hover { background: var(--red-bg); }
.btn-sm { padding: 5px 10px; font-size: 12px; border-radius: var(--radius-md); }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-ghost:hover { background: rgba(0,0,0,.04); }

/* ═══════════════════════════════════════════════
   STAT CARDS
   ═══════════════════════════════════════════════ */
.grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr 1fr; gap: 14px; padding: 18px 32px 0; }
.stat { background: #fff; border: 1px solid var(--line); border-radius: var(--radius-2xl); padding: 18px 20px; position: relative; overflow: hidden; }
.stat .lbl { font-size: 12.5px; color: var(--mute); display: flex; align-items: center; gap: 8px; font-weight: 500; }
.stat .v { font-size: 30px; font-weight: 600; margin-top: 10px; letter-spacing: -.02em; font-feature-settings: "tnum"; }
.stat .v em { font-family: var(--font-serif); font-weight: 400; color: var(--mute); font-size: 18px; font-style: italic; margin-left: 6px; }
.stat .delta { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; background: var(--green-bg); color: var(--green); padding: 3px 8px; border-radius: var(--radius-full); font-weight: 600; margin-top: 10px; }
.stat .delta.amb { background: var(--amber-bg); color: var(--amber); }
.stat .delta.red { background: var(--red-bg); color: var(--red); }
.stat .delta.blue { background: var(--blue-bg); color: var(--blue); }
.stat .foot { margin-top: 10px; color: var(--mute); font-size: 11.5px; display: flex; justify-content: space-between; }
.stat.hero-stat { background: linear-gradient(160deg, #0f1115, #1f2127); color: #fff; border-color: #0f1115; }
.stat.hero-stat .lbl { color: #a5a8b0; }
.stat.hero-stat .v em { color: #a5a8b0; }
.stat.hero-stat .delta { background: rgba(255,255,255,.08); color: #bff0d4; }
.stat.hero-stat .foot { color: #a5a8b0; }
.stat.hero-stat .spark { position: absolute; right: 18px; bottom: 14px; opacity: .85; }

/* ═══════════════════════════════════════════════
   SECTION HEADER + TABS
   ═══════════════════════════════════════════════ */
.section { padding: 24px 32px 0; }
.sh { display: flex; align-items: center; gap: 14px; border-bottom: 1px solid var(--line); padding-bottom: 0; }
.sh .tabs { display: flex; gap: 4px; }
.sh .tabs .t { padding: 10px 14px; font-size: 13px; color: var(--mute); font-weight: 500; border-bottom: 2px solid transparent; cursor: pointer; display: inline-flex; gap: 8px; align-items: center; transition: color var(--duration-fast); }
.sh .tabs .t:hover { color: var(--ink2); }
.sh .tabs .t .ct { font-family: var(--font-mono); font-size: 11px; background: var(--bg); border: 1px solid var(--line); padding: 1px 6px; border-radius: var(--radius-sm); color: var(--mute); }
.sh .tabs .t.on { color: var(--ink); border-bottom-color: var(--ink); }
.sh .tabs .t.on .ct { background: var(--ink); color: #fff; border-color: var(--ink); }
.sh .sp { flex: 1; }
.sh .meta { font-size: 12px; color: var(--mute); }

/* ═══════════════════════════════════════════════
   FILTER TOOLBAR
   ═══════════════════════════════════════════════ */
.toolbar { display: flex; gap: 8px; align-items: center; padding: 14px 0 6px; flex-wrap: wrap; }
.chipf { display: inline-flex; align-items: center; gap: 6px; background: #fff; border: 1px solid var(--line); border-radius: 9px; padding: 6px 11px; font-size: 12.5px; color: var(--ink2); cursor: pointer; position: relative; transition: border-color var(--duration-fast); }
.chipf:hover { border-color: var(--ink2); }
.chipf b { color: var(--ink); font-weight: 600; }
.chipf .x { color: var(--mute); font-size: 11px; cursor: pointer; }
.chipf-count { background: transparent; border: none; color: var(--mute); cursor: default; }
.chipf-count:hover { border-color: transparent; }

/* ═══════════════════════════════════════════════
   DATA TABLE
   ═══════════════════════════════════════════════ */
.tbl { background: #fff; border: 1px solid var(--line); border-radius: var(--radius-2xl); overflow-x: auto; overflow-y: hidden; }
.tbl .tfoot { position: sticky; left: 0; }
table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; }
thead th { position: sticky; top: 0; background: #fafaf7; text-align: left; padding: 12px 16px; font-size: 11.5px; font-weight: 500; color: var(--mute); text-transform: uppercase; letter-spacing: .06em; border-bottom: 1px solid var(--line); cursor: default; white-space: nowrap; }
thead th.sortable { cursor: pointer; }
thead th.sortable:hover { color: var(--ink); }
thead th .sort-arrow { margin-left: 4px; font-size: 10px; }
tbody td { padding: 16px; border-bottom: 1px solid #f3f3ef; color: var(--ink2); vertical-align: middle; }
tbody tr { transition: background var(--duration-fast); cursor: pointer; }
tbody tr:hover { background: #fbfbf7; }
tbody tr.sel { background: #fbfaf2; }
tbody tr.sel td:first-child { box-shadow: inset 3px 0 0 var(--ink); }
tbody tr:last-child td { border-bottom: none; }
.rid { font-family: var(--font-mono); font-size: 12px; color: var(--ink); font-weight: 500; }
.rmt { color: var(--mute); font-size: 12px; margin-top: 3px; }
.cust { display: flex; align-items: center; gap: 10px; }
.cust .a { width: 32px; height: 32px; border-radius: var(--radius-lg); background: linear-gradient(135deg, #e8e6dc, #d4d2c5); display: grid; place-items: center; font-weight: 600; font-size: 11.5px; color: var(--ink2); flex-shrink: 0; }
.cust .nm { font-weight: 600; color: var(--ink); line-height: 1.2; }
.cust .em { color: var(--mute); font-size: 11.5px; font-family: var(--font-mono); }
.amt { font-family: var(--font-mono); font-weight: 600; color: var(--ink); text-align: right; font-feature-settings: "tnum"; }
.amt.neg { color: var(--red); }
.tfoot { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px; background: #fafaf7; border-top: 1px solid var(--line); font-size: 12.5px; color: var(--mute); }
.pg-nav { display: inline-flex; gap: 6px; align-items: center; }
.pg-nav b { font-family: var(--font-mono); color: var(--ink); }
.pg-nav span { cursor: pointer; padding: 2px 4px; border-radius: 4px; }
.pg-nav span:hover { color: var(--ink); background: rgba(0,0,0,.04); }
.pg-nav span.disabled { opacity: .4; pointer-events: none; }

/* ═══════════════════════════════════════════════
   PILLS / BADGES
   ═══════════════════════════════════════════════ */
.pill { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: var(--radius-full); font-size: 11.5px; font-weight: 500; border: 1px solid transparent; white-space: nowrap; }
.pill .d { width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex-shrink: 0; }
.pill.cr { background: var(--blue-bg); color: var(--blue); }
.pill.rf { background: var(--red-bg); color: var(--red); }
.pill.pr { background: #efece2; color: #5a5237; }
.pill.tx { background: #eef0f4; color: #3c4156; }
.pill.warn { background: var(--amber-bg); color: var(--amber); }
.pill.ok { background: var(--green-bg); color: var(--green); }
.pill.info { background: var(--blue-bg); color: var(--blue); }
.pill.neut { background: #f1efe8; color: #4a4a44; }
.pill.err { background: var(--red-bg); color: var(--red); }

/* ═══════════════════════════════════════════════
   DETAIL PANEL
   ═══════════════════════════════════════════════ */
.panel { background: #fff; border: 1px solid var(--line); border-radius: var(--radius-3xl); box-shadow: var(--shadow-lg); overflow: hidden; position: sticky; top: 88px; }
.ph { padding: 18px 20px; background: linear-gradient(180deg, #fbfaf4, #fff); border-bottom: 1px solid var(--line); display: flex; gap: 12px; align-items: flex-start; }
.ph .a { width: 44px; height: 44px; border-radius: var(--radius-xl); background: linear-gradient(135deg, #1c1d20, #3a3d44); color: #fff; display: grid; place-items: center; font-weight: 600; font-size: 14px; font-family: var(--font-mono); flex-shrink: 0; }
.ph .t { font-size: 16px; font-weight: 600; letter-spacing: -.01em; }
.ph .s { font-size: 12.5px; color: var(--mute); margin-top: 2px; }
.ph .s b { color: var(--ink); font-weight: 500; }
.ph .x { margin-left: auto; color: var(--mute); cursor: pointer; padding: 4px; border-radius: var(--radius-sm); }
.ph .x:hover { background: rgba(0,0,0,.06); color: var(--ink); }
.pmeta { display: grid; grid-template-columns: 1fr 1fr; border-bottom: 1px solid var(--line); }
.pmeta div { padding: 14px 20px; }
.pmeta div + div { border-left: 1px solid var(--line); }
.pmeta .l { font-size: 11px; color: var(--mute); text-transform: uppercase; letter-spacing: .06em; }
.pmeta .v { font-size: 14px; font-weight: 600; margin-top: 4px; letter-spacing: -.01em; font-feature-settings: "tnum"; }
.pmeta .v.red { color: var(--red); }
.psec { padding: 18px 20px; border-bottom: 1px solid var(--line); }
.psec h3 { font-size: 11.5px; color: var(--mute); text-transform: uppercase; letter-spacing: .06em; font-weight: 600; margin-bottom: 12px; display: flex; align-items: center; gap: 8px; }
.psec h3 .ct { font-family: var(--font-mono); background: var(--bg); border: 1px solid var(--line); padding: 1px 7px; border-radius: var(--radius-sm); color: var(--ink2); font-weight: 500; text-transform: none; letter-spacing: 0; }
.li { border: 1px solid var(--line); border-radius: var(--radius-xl); padding: 12px 14px; display: flex; justify-content: space-between; margin-bottom: 8px; background: #fdfdf9; }
.li .lt { color: var(--ink); font-weight: 600; font-size: 13px; }
.li .ls { color: var(--mute); font-size: 11.5px; margin-top: 3px; }
.li .v { font-family: var(--font-mono); font-weight: 600; color: var(--red); }
.tot { display: flex; flex-direction: column; gap: 8px; }
.tot .r { display: flex; justify-content: space-between; font-size: 13px; color: var(--ink2); font-family: var(--font-mono); }
.tot .r b { color: var(--ink); }
.tot .r.big { font-size: 16px; border-top: 1px dashed var(--line); padding-top: 10px; margin-top: 4px; }
.tot .r.big b { font-size: 18px; letter-spacing: -.01em; }
.tot .r.big em { font-family: var(--font-serif); font-style: italic; color: var(--mute); font-size: 13px; font-weight: 400; margin-right: 6px; }
.pfoot { padding: 16px 20px; display: flex; gap: 8px; justify-content: flex-end; background: #fbfaf4; }

/* ═══════════════════════════════════════════════
   TIMELINE
   ═══════════════════════════════════════════════ */
.tl { display: flex; flex-direction: column; gap: 14px; position: relative; padding-left: 6px; }
.tl::before { content: ''; position: absolute; left: 9px; top: 6px; bottom: 6px; width: 1px; background: var(--line); }
.ev { display: flex; gap: 14px; position: relative; z-index: 1; }
.ev .b { width: 18px; height: 18px; border-radius: 50%; background: #fff; border: 1.5px solid var(--ink); display: grid; place-items: center; flex-shrink: 0; font-size: 10px; color: var(--ink); }
.ev .b.gr { border-color: var(--green); color: var(--green); }
.ev .b.gy { border-color: var(--mute); color: var(--mute); }
.ev .t { font-weight: 600; color: var(--ink); font-size: 13px; }
.ev .m { color: var(--mute); font-size: 12px; margin-top: 2px; }
.ev .m kbd { font-family: var(--font-mono); font-size: 11px; background: var(--bg); border: 1px solid var(--line); padding: 1px 5px; border-radius: 4px; color: var(--ink2); }

/* ═══════════════════════════════════════════════
   BODY LAYOUT (table + panel)
   ═══════════════════════════════════════════════ */
.body-split { padding: 6px 32px 40px; display: grid; grid-template-columns: 1fr 440px; gap: 18px; align-items: start; }
.body-full { padding: 6px 32px 40px; }

/* ═══════════════════════════════════════════════
   MODAL
   ═══════════════════════════════════════════════ */
.modal-overlay { position: fixed; inset: 0; background: rgba(15,17,21,.4); z-index: 1000; display: flex; align-items: center; justify-content: center; animation: fadeIn var(--duration-normal) var(--ease-out); }
.modal-panel { background: var(--panel); border-radius: var(--radius-3xl); box-shadow: 0 24px 48px -12px rgba(15,17,21,.25); max-width: 520px; width: 100%; animation: scaleIn var(--duration-slow) var(--ease-out); overflow: hidden; }
.modal-header { padding: 20px 24px 0; display: flex; justify-content: space-between; align-items: center; }
.modal-header h2 { font-size: 18px; font-weight: 600; letter-spacing: -.01em; }
.modal-header .x { color: var(--mute); cursor: pointer; padding: 4px; border-radius: var(--radius-sm); }
.modal-header .x:hover { background: rgba(0,0,0,.06); color: var(--ink); }
.modal-body { padding: 16px 24px; }
.modal-footer { padding: 16px 24px; display: flex; gap: 8px; justify-content: flex-end; background: #fafaf7; border-top: 1px solid var(--line); }

/* ═══════════════════════════════════════════════
   TOAST
   ═══════════════════════════════════════════════ */
#toast-container { position: fixed; top: 20px; right: 20px; z-index: 2000; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.toast { padding: 12px 18px; border-radius: var(--radius-lg); font-size: 13px; font-weight: 500; display: flex; align-items: center; gap: 10px; pointer-events: auto; animation: slideDown var(--duration-slow) var(--ease-out); box-shadow: var(--shadow-lg); }
.toast.success { background: var(--green); color: #fff; }
.toast.error { background: var(--red); color: #fff; }
.toast.info { background: var(--ink); color: #fff; }

/* ═══════════════════════════════════════════════
   DROPDOWN
   ═══════════════════════════════════════════════ */
.dropdown-panel { position: absolute; top: 100%; left: 0; margin-top: 4px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); padding: 4px; min-width: 180px; z-index: 50; display: none; }
.dropdown-panel.open { display: block; animation: fadeIn var(--duration-fast) var(--ease-out); }
.dropdown-panel .opt { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: var(--radius-md); font-size: 13px; color: var(--ink2); cursor: pointer; font-weight: 500; white-space: nowrap; }
.dropdown-panel .opt:hover { background: var(--bg); }
.dropdown-panel .opt.selected { color: var(--ink); font-weight: 600; }

/* ═══════════════════════════════════════════════
   FORMS
   ═══════════════════════════════════════════════ */
.form-group { margin-bottom: 14px; }
.form-group label { display: block; font-size: 12px; color: var(--mute); font-weight: 500; text-transform: uppercase; letter-spacing: .06em; margin-bottom: 6px; }
.form-group input, .form-group select, .form-group textarea { width: 100%; padding: 9px 12px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius-md); font-size: 13.5px; color: var(--ink); outline: none; transition: border-color var(--duration-fast); }
.form-group input:focus, .form-group select:focus, .form-group textarea:focus { border-color: var(--ink); }
.form-group textarea { resize: vertical; min-height: 80px; }
.form-group select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%237a7e87' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 32px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* ═══════════════════════════════════════════════
   LOGIN
   ═══════════════════════════════════════════════ */
.login-wrapper { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--bg); }
.login-card { width: 440px; }
.login-brand { text-align: center; margin-bottom: 32px; }
.login-brand .m { width: 48px; height: 48px; border-radius: 14px; background: radial-gradient(circle at 30% 30%, #fff, #d6d6cf 70%); border: 1px solid #d6d6cf; display: inline-grid; place-items: center; font-family: var(--font-serif); font-size: 26px; color: var(--ink); margin-bottom: 12px; }
.login-brand h1 { font-size: 24px; font-weight: 600; letter-spacing: -.02em; }
.login-brand h1 em { font-family: var(--font-serif); font-style: italic; font-weight: 400; color: var(--ink2); margin-left: 4px; }
.login-brand p { color: var(--mute); font-size: 14px; margin-top: 4px; }
.user-cards { display: flex; flex-direction: column; gap: 8px; margin-bottom: 24px; }
.user-card { display: flex; align-items: center; gap: 12px; padding: 12px 16px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-xl); cursor: pointer; transition: all var(--duration-fast) var(--ease-out); }
.user-card:hover { border-color: var(--ink2); box-shadow: var(--shadow-sm); }
.user-card.selected { border-color: var(--ink); box-shadow: 0 0 0 1px var(--ink); }
.user-card .av { width: 40px; height: 40px; font-size: 14px; }
.user-card .info .name { font-weight: 600; font-size: 14px; }
.user-card .info .role { font-size: 12px; color: var(--mute); }
.login-form { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-2xl); padding: 20px; }
.login-form .btn-d { width: 100%; justify-content: center; margin-top: 8px; padding: 10px; }

/* ═══════════════════════════════════════════════
   PLACEHOLDER SCREEN
   ═══════════════════════════════════════════════ */
.placeholder-screen { display: flex; align-items: center; justify-content: center; min-height: 400px; }
.placeholder-card { text-align: center; padding: 40px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-2xl); max-width: 400px; }
.placeholder-card h2 { font-size: 20px; font-weight: 600; margin-bottom: 8px; }
.placeholder-card p { color: var(--mute); font-size: 14px; }

/* ═══════════════════════════════════════════════
   FOOTER
   ═══════════════════════════════════════════════ */
.footer { padding: 22px 32px; color: var(--mute); font-size: 12px; border-top: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; }
.footer em { font-family: var(--font-serif); font-style: italic; color: var(--ink2); }

/* ═══════════════════════════════════════════════
   CHARTS (CSS/SVG)
   ═══════════════════════════════════════════════ */
.bar-chart { display: flex; align-items: flex-end; gap: 8px; height: 200px; padding: 20px 0; }
.bar-chart .bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; }
.bar-chart .bar { width: 100%; border-radius: 6px 6px 0 0; min-height: 4px; transition: height var(--duration-slow) var(--ease-out); }
.bar-chart .bar.positive { background: var(--green); }
.bar-chart .bar.negative { background: var(--red); }
.bar-chart .bar.neutral { background: var(--ink); }
.bar-chart .bar-label { font-size: 11px; color: var(--mute); text-align: center; white-space: nowrap; }
.bar-chart .bar-value { font-family: var(--font-mono); font-size: 11px; font-weight: 600; color: var(--ink); }

.donut-container { display: flex; align-items: center; gap: 24px; }
.donut-legend { display: flex; flex-direction: column; gap: 8px; }
.donut-legend .leg-item { display: flex; align-items: center; gap: 8px; font-size: 12.5px; }
.donut-legend .leg-dot { width: 10px; height: 10px; border-radius: 3px; flex-shrink: 0; }
.donut-legend .leg-val { font-family: var(--font-mono); font-weight: 600; margin-left: auto; }

/* ═══════════════════════════════════════════════
   INTEGRATION CARDS
   ═══════════════════════════════════════════════ */
.int-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; padding: 18px 32px; }
.int-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-2xl); padding: 20px; cursor: pointer; transition: all var(--duration-fast) var(--ease-out); }
.int-card:hover { box-shadow: var(--shadow-md); }
.int-card.expanded { cursor: default; }
.int-card .int-header { display: flex; align-items: center; gap: 12px; }
.int-card .int-icon { width: 40px; height: 40px; border-radius: var(--radius-lg); background: var(--bg); border: 1px solid var(--line); display: grid; place-items: center; color: var(--ink2); }
.int-card .int-info h3 { font-size: 15px; font-weight: 600; }
.int-card .int-info .int-type { font-size: 12px; color: var(--mute); }
.int-card .int-stats { display: flex; gap: 16px; margin-top: 14px; }
.int-card .int-stat { font-size: 12px; color: var(--mute); }
.int-card .int-stat b { color: var(--ink); font-family: var(--font-mono); }
.int-detail { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line); }
.int-detail .int-section { margin-bottom: 14px; }
.int-detail .int-section h4 { font-size: 11.5px; color: var(--mute); text-transform: uppercase; letter-spacing: .06em; font-weight: 600; margin-bottom: 8px; }
.int-mini-table { width: 100%; font-size: 12px; }
.int-mini-table th { text-align: left; font-weight: 500; color: var(--mute); padding: 6px 8px; border-bottom: 1px solid var(--line); font-size: 11px; text-transform: uppercase; letter-spacing: .06em; }
.int-mini-table td { padding: 6px 8px; border-bottom: 1px solid #f3f3ef; color: var(--ink2); }

/* ═══════════════════════════════════════════════
   PLAN CARDS
   ═══════════════════════════════════════════════ */
.plan-list { display: flex; flex-direction: column; gap: 10px; }
.plan-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-2xl); padding: 18px 20px; cursor: pointer; transition: all var(--duration-fast) var(--ease-out); }
.plan-card:hover { box-shadow: var(--shadow-md); }
.plan-card.sel { border-color: var(--ink); box-shadow: 0 0 0 1px var(--ink); }
.plan-card.inactive { opacity: .65; }
.plan-card .plan-top { display: flex; align-items: center; justify-content: space-between; }
.plan-card .plan-name { font-size: 16px; font-weight: 600; }
.plan-card .plan-meta { display: flex; gap: 16px; margin-top: 10px; font-size: 12.5px; color: var(--mute); }
.plan-card .plan-meta b { color: var(--ink); font-family: var(--font-mono); }

/* ═══════════════════════════════════════════════
   MINI TABLES (in detail panels)
   ═══════════════════════════════════════════════ */
.mini-tbl { width: 100%; font-size: 12.5px; }
.mini-tbl th { text-align: left; font-weight: 500; color: var(--mute); padding: 6px 0; border-bottom: 1px solid var(--line); font-size: 11px; text-transform: uppercase; letter-spacing: .06em; }
.mini-tbl td { padding: 8px 0; border-bottom: 1px solid #f3f3ef; color: var(--ink2); }
.mini-tbl tr:last-child td { border-bottom: none; }
.mini-tbl .link { color: var(--blue); cursor: pointer; }
.mini-tbl .link:hover { text-decoration: underline; }

/* ═══════════════════════════════════════════════
   REPORT CARDS / EXPORT LIST
   ═══════════════════════════════════════════════ */
.report-stat-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 24px; }
.report-stat-row .stat { margin: 0; }
.aging-cards { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; margin-bottom: 20px; }
.aging-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-xl); padding: 14px; text-align: center; cursor: pointer; transition: all var(--duration-fast); }
.aging-card:hover { border-color: var(--ink2); }
.aging-card.sel { border-color: var(--ink); box-shadow: 0 0 0 1px var(--ink); }
.aging-card .ac-label { font-size: 11px; color: var(--mute); text-transform: uppercase; letter-spacing: .06em; font-weight: 500; }
.aging-card .ac-val { font-size: 20px; font-weight: 600; margin-top: 4px; font-feature-settings: "tnum"; }
.aging-card .ac-count { font-size: 12px; color: var(--mute); font-family: var(--font-mono); margin-top: 2px; }
.export-list { display: flex; flex-direction: column; gap: 10px; }
.export-item { display: flex; align-items: center; gap: 16px; padding: 16px 20px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-xl); }
.export-item .ei-info { flex: 1; }
.export-item .ei-name { font-weight: 600; font-size: 14px; }
.export-item .ei-desc { color: var(--mute); font-size: 12.5px; margin-top: 2px; }
.export-item .ei-format { font-family: var(--font-mono); font-size: 11px; color: var(--mute); background: var(--bg); border: 1px solid var(--line); padding: 2px 8px; border-radius: var(--radius-sm); }

/* ═══════════════════════════════════════════════
   EMPTY STATE
   ═══════════════════════════════════════════════ */
.empty-state { text-align: center; padding: 48px 24px; }
.empty-state .empty-icon { width: 48px; height: 48px; margin: 0 auto 16px; background: var(--bg); border-radius: var(--radius-xl); display: grid; place-items: center; color: var(--mute); }
.empty-state h3 { font-size: 15px; font-weight: 600; margin-bottom: 4px; }
.empty-state p { color: var(--mute); font-size: 13px; margin-bottom: 16px; }

/* ═══════════════════════════════════════════════
   ANIMATIONS
   ═══════════════════════════════════════════════ */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slideDown { from { opacity: 0; transform: translateY(-12px); } to { opacity: 1; transform: translateY(0); } }
@keyframes scaleIn { from { opacity: 0; transform: scale(.96); } to { opacity: 1; transform: scale(1); } }
@keyframes slideInRight { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: translateX(0); } }
.fadeIn { animation: fadeIn var(--duration-normal) var(--ease-out) both; }
.slideUp { animation: slideUp var(--duration-slow) var(--ease-out) both; }
.slideDown { animation: slideDown var(--duration-slow) var(--ease-out) both; }
.scaleIn { animation: scaleIn var(--duration-slow) var(--ease-out) both; }
.slideInRight { animation: slideInRight var(--duration-slow) var(--ease-out) both; }
.stagger { animation-delay: var(--delay, 0ms); }

/* ═══════════════════════════════════════════════
   CHECKBOX
   ═══════════════════════════════════════════════ */
input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--ink); cursor: pointer; }

/* ═══════════════════════════════════════════════
   UTILITIES
   ═══════════════════════════════════════════════ */
.flex { display: flex; }
.flex-col { display: flex; flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-4 { gap: 4px; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.gap-24 { gap: 24px; }
.text-right { text-align: right; }
.text-center { text-align: center; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mt-4 { margin-top: 4px; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.font-mono { font-family: var(--font-mono); }
.font-serif { font-family: var(--font-serif); }
.color-mute { color: var(--mute); }
.color-green { color: var(--green); }
.color-red { color: var(--red); }
.color-blue { color: var(--blue); }
.w-full { width: 100%; }

/* ═══════════════════════════════════════════════
   LIFECYCLE VISUAL
   ═══════════════════════════════════════════════ */
.lifecycle { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 12px; }
.lifecycle .lc-step { padding: 4px 10px; border-radius: var(--radius-full); font-size: 11px; font-weight: 500; border: 1px solid var(--line); color: var(--mute); background: var(--bg); }
.lifecycle .lc-step.active { background: var(--ink); color: #fff; border-color: var(--ink); }

/* ═══════════════════════════════════════════════
   LOADING SKELETON
   ═══════════════════════════════════════════════ */
@keyframes shimmer { 0% { background-position: -200% 0; } 100% { background-position: 200% 0; } }
.skeleton { background: linear-gradient(90deg, var(--line) 25%, #f0f0ed 50%, var(--line) 75%); background-size: 200% 100%; animation: shimmer 1.5s ease-in-out infinite; border-radius: var(--radius-md); }
.skeleton-text { height: 14px; margin-bottom: 8px; }
.skeleton-text.short { width: 60%; }
.skeleton-card { height: 120px; border-radius: var(--radius-2xl); }
.skeleton-row { height: 52px; margin-bottom: 2px; }
