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

:root {
  --bg: #f6f5f1;
  --surface: #ffffff;
  --ink: #0f1115;
  --ink-2: #3a3d44;
  --muted: #878b94;
  --line: #ececec;
  --line-2: #f2f1ec;
  --accent: #0f1115;
  --gold: #bf8a3e;
  --crit: #c0392b;
  --warm: #e87b35;
  --emer: #1f7a4d;
  --chip: #f1efe9;

  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out: cubic-bezier(0.45, 0, 0.55, 1);
  --duration-fast: 150ms;
  --duration-normal: 250ms;
  --duration-slow: 400ms;

  --radius-sm: 5px;
  --radius-md: 9px;
  --radius-lg: 11px;
  --radius-xl: 14px;
  --radius-2xl: 18px;
  --radius-3xl: 20px;
  --radius-full: 99px;

  --shadow-sm: 0 1px 2px rgba(0,0,0,0.03);
  --shadow-md: 0 4px 12px -4px rgba(15,17,21,0.12);
  --shadow-lg: 0 12px 32px -16px rgba(15,17,21,0.15);
  --shadow-xl: 0 20px 48px -20px rgba(15,17,21,0.2);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
  background: var(--bg);
  font-family: 'Geist', -apple-system, sans-serif;
  color: var(--ink);
  font-size: 13.5px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
.serif { font-family: 'Instrument Serif', serif; font-weight: 400; letter-spacing: -.01em; }
.mono  { font-family: 'Geist Mono', monospace; }
.muted { color: var(--muted); }

/* Shell */
.shell { width: 1440px; margin: 0 auto; display: flex; min-height: 100vh; background: var(--bg); }

/* Sidebar */
.sidebar { width: 248px; flex-shrink: 0; position: sticky; top: 0; height: 100vh; padding: 22px 16px; display: flex; flex-direction: column; border-right: 1px solid var(--line-2); background: var(--bg); z-index: 10; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 22px; }
.brand-mark { width: 30px; height: 30px; border-radius: 9px; background: radial-gradient(circle at 30% 30%, #2a2d35, #0f1115); display: flex; align-items: center; justify-content: center; color: #fff; font-weight: 600; font-size: 14px; box-shadow: inset 0 1px 0 rgba(255,255,255,.15), 0 1px 2px rgba(0,0,0,.2); }
.brand-name { font-weight: 600; font-size: 14px; letter-spacing: -.01em; }
.brand-name small { display: block; color: var(--muted); font-weight: 400; font-size: 11px; margin-top: 1px; letter-spacing: 0; }

.nav-cap { font-size: 10.5px; text-transform: uppercase; letter-spacing: .12em; color: var(--muted); padding: 14px 10px 6px; font-weight: 500; }
.nav { display: flex; flex-direction: column; gap: 1px; }
.nav a { display: flex; align-items: center; gap: 11px; padding: 8px 10px; border-radius: 9px; color: var(--ink-2); text-decoration: none; font-size: 13px; font-weight: 450; cursor: pointer; transition: background var(--duration-fast) var(--ease-out); }
.nav a:hover { background: rgba(15,17,21,.04); }
.nav a.on { background: var(--ink); color: #fff; }
.nav a .bg { margin-left: auto; font-size: 11px; background: rgba(255,255,255,.14); color: #fff; padding: 1px 7px; border-radius: 99px; }
.nav a:not(.on) .bg { background: var(--chip); color: var(--ink-2); }
.nav .ic { width: 15px; height: 15px; opacity: .85; flex-shrink: 0; }

.side-foot { margin-top: auto; padding: 14px 10px; border-top: 1px solid var(--line-2); }
.side-foot .me { display: flex; gap: 10px; align-items: center; }
.side-foot .av { width: 32px; height: 32px; border-radius: 50%; color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 600; font-size: 11px; border: 2px solid #fff; box-shadow: 0 1px 2px rgba(0,0,0,.1); flex-shrink: 0; }
.side-foot .nm { font-size: 12.5px; font-weight: 500; }
.side-foot .rl { font-size: 11px; color: var(--muted); }
.side-foot .logout-btn { margin-top: 10px; width: 100%; height: 32px; padding: 0 12px; border-radius: 9px; font-size: 12px; font-weight: 500; display: flex; align-items: center; gap: 8px; cursor: pointer; border: 1px solid var(--line); background: #fff; color: var(--ink-2); font-family: inherit; transition: all var(--duration-fast) var(--ease-out); }
.side-foot .logout-btn:hover { background: #fafafa; color: var(--crit); }

/* Main column */
.main { flex: 1; min-width: 0; padding: 18px 28px 40px; }

/* Topbar */
.topbar { display: flex; align-items: center; gap: 14px; padding: 6px 0 16px; }
.crumbs { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 7px; }
.crumbs a { color: var(--muted); text-decoration: none; cursor: pointer; }
.crumbs a:hover { color: var(--ink); }
.crumbs .now { color: var(--ink); font-weight: 500; }
.crumbs .sep { opacity: .4; }
.topbar .grow { flex: 1; }
.search { width: 340px; height: 38px; background: #fff; border: 1px solid var(--line); border-radius: 11px; display: flex; align-items: center; padding: 0 12px; gap: 9px; box-shadow: var(--shadow-sm); }
.search input { border: none; background: transparent; outline: none; flex: 1; font-family: inherit; font-size: 13px; color: var(--ink); }
.search input:focus { outline: none; }
.kbd { font-size: 10.5px; background: var(--chip); color: var(--muted); padding: 2px 6px; border-radius: 5px; font-family: 'Geist Mono', monospace; }
.top-icon { width: 38px; height: 38px; border-radius: 11px; background: #fff; border: 1px solid var(--line); display: flex; align-items: center; justify-content: center; cursor: pointer; position: relative; box-shadow: var(--shadow-sm); transition: background var(--duration-fast) var(--ease-out); }
.top-icon:hover { background: #fafafa; }
.notif-dot { position: absolute; top: 9px; right: 10px; width: 7px; height: 7px; border-radius: 50%; background: var(--crit); border: 2px solid #fff; }

/* Buttons */
.btn { height: 38px; padding: 0 16px; border-radius: 11px; font-size: 13px; font-weight: 500; display: inline-flex; align-items: center; gap: 8px; cursor: pointer; border: 1px solid var(--line); background: #fff; color: var(--ink); font-family: inherit; box-shadow: var(--shadow-sm); transition: all var(--duration-fast) var(--ease-out); white-space: nowrap; }
.btn:hover { background: #fafafa; transform: translateY(-1px); box-shadow: var(--shadow-md); }
.btn.dark { background: var(--ink); color: #fff; border-color: var(--ink); box-shadow: 0 1px 0 rgba(255,255,255,.1) inset, 0 4px 12px -4px rgba(15,17,21,.4); }
.btn.dark:hover { background: #222; transform: translateY(-1px); }
.btn.gold { background: linear-gradient(180deg,#d4a566,#bf8a3e); color: #fff; border-color: #a87832; }
.btn.gold:hover { transform: translateY(-1px); }
.btn.danger { color: var(--crit); border-color: rgba(192,57,43,.3); }
.btn.danger:hover { background: #fef2f0; }
.btn.sm { height: 30px; padding: 0 12px; font-size: 12px; }
.btn svg { flex-shrink: 0; }

/* Chips */
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 11px; border-radius: 99px; font-size: 11.5px; font-weight: 500; background: var(--chip); color: var(--ink-2); border: 1px solid rgba(0,0,0,.04); }
.chip.crit { background: #fbeae6; color: #a23121; border-color: rgba(192,57,43,.18); }
.chip.crit::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--crit); box-shadow: 0 0 0 3px rgba(192,57,43,.18); animation: pulse 2s ease infinite; }
.chip.warm { background: #fdf1e6; color: #a8541d; border-color: rgba(232,123,53,.18); }
.chip.high { background: #fdf1e6; color: #a8541d; border-color: rgba(232,123,53,.18); }
.chip.cool { background: #eaf1f3; color: #2c5563; border-color: rgba(44,85,99,.14); }
.chip.emer { background: #e8f3ec; color: var(--emer); border-color: rgba(31,122,77,.18); }
.chip.medium { background: #fdf8e6; color: #7a6520; border-color: rgba(191,138,62,.18); }
.chip.dot::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .8; }

/* Hero */
.hero { background: linear-gradient(180deg,#ffffff 0%,#fbfaf6 100%); border: 1px solid var(--line); border-radius: 20px; padding: 26px 28px; box-shadow: 0 1px 0 rgba(0,0,0,.02), var(--shadow-lg); position: relative; overflow: hidden; }
.hero::before { content: ''; position: absolute; top: -30px; right: -30px; width: 280px; height: 280px; border-radius: 50%; background: radial-gradient(circle,rgba(192,57,43,.07),transparent 60%); }
.hero-top { display: flex; align-items: flex-start; gap: 18px; position: relative; }
.hero-tags { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.hero h1 { font-size: 38px; line-height: 1.05; letter-spacing: -.02em; margin-bottom: 8px; }
.hero h1 .ref { color: var(--muted); font-family: 'Geist Mono', monospace; font-size: 18px; letter-spacing: 0; margin-left: 8px; font-weight: 400; }
.hero p.lede { font-size: 14px; color: var(--ink-2); max-width: 680px; line-height: 1.6; }
.hero p.lede b { font-weight: 600; color: var(--ink); }
.hero-actions { margin-left: auto; display: flex; gap: 8px; flex-shrink: 0; }
.hero-stats { display: grid; grid-template-columns: repeat(4,1fr); gap: 0; margin-top: 24px; border-top: 1px solid var(--line-2); padding-top: 20px; position: relative; }
.hero-stat { padding: 0 20px; border-right: 1px solid var(--line-2); }
.hero-stat:first-child { padding-left: 0; }
.hero-stat:last-child { border-right: none; }
.hero-stat .lbl { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; font-weight: 500; margin-bottom: 8px; }
.hero-stat .v { font-size: 24px; font-family: 'Instrument Serif', serif; letter-spacing: -.01em; line-height: 1; }
.hero-stat .v.mono { font-family: 'Geist Mono', monospace; font-size: 20px; font-weight: 500; }
.hero-stat .sub { font-size: 11.5px; color: var(--muted); margin-top: 6px; }
.hero-stat .delta { display: inline-flex; align-items: center; gap: 3px; font-size: 11px; font-weight: 500; margin-left: 7px; }
.delta.up { color: var(--crit); }
.delta.dn { color: var(--emer); }

/* Grid */
.grid { display: grid; grid-template-columns: 1fr 348px; gap: 22px; margin-top: 22px; }

/* Panels */
.panel { background: #fff; border: 1px solid var(--line); border-radius: 18px; box-shadow: 0 1px 0 rgba(0,0,0,.015); transition: box-shadow var(--duration-normal) var(--ease-out); }
.panel:hover { box-shadow: 0 2px 8px rgba(0,0,0,.04); }
.panel-h { display: flex; align-items: center; padding: 18px 22px 14px; gap: 12px; }
.panel-h .ttl { font-size: 14px; font-weight: 600; letter-spacing: -.005em; }
.panel-h .sub { font-size: 11.5px; color: var(--muted); margin-top: 1px; }
.panel-h .right { margin-left: auto; font-size: 11.5px; color: var(--muted); display: flex; align-items: center; gap: 8px; }
.live-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--emer); box-shadow: 0 0 0 3px rgba(31,122,77,.15); animation: pulse 2s ease infinite; }
.panel-b { padding: 6px 22px 22px; }

/* Risk profile */
.risk-wrap { display: grid; grid-template-columns: 300px 1fr; gap: 28px; align-items: center; padding: 8px 0; }
.score-frame { position: relative; width: 280px; height: 280px; margin: 0 auto; display: flex; align-items: center; justify-content: center; }
.score-frame svg { position: absolute; inset: 0; }
.score-center { text-align: center; position: relative; z-index: 2; }
.score-center .tier { font-size: 10.5px; letter-spacing: .18em; text-transform: uppercase; color: var(--crit); font-weight: 600; margin-bottom: 6px; }
.score-center .num { font-family: 'Instrument Serif', serif; font-size: 96px; line-height: 1; color: var(--ink); letter-spacing: -.04em; }
.score-center .of { font-family: 'Geist Mono', monospace; font-size: 13px; color: var(--muted); margin-top: 4px; }
.score-center .delta-pill { display: inline-flex; align-items: center; gap: 5px; margin-top: 14px; padding: 4px 10px; background: #fbeae6; color: #a23121; font-size: 11.5px; border-radius: 99px; font-weight: 500; border: 1px solid rgba(192,57,43,.18); }

.signal-stack { display: flex; flex-direction: column; gap: 14px; }
.sig { display: grid; grid-template-columns: 130px 1fr 100px; gap: 18px; align-items: center; padding: 14px 0; border-bottom: 1px solid var(--line-2); }
.sig:last-child { border-bottom: none; }
.sig .nm { font-size: 13px; font-weight: 500; }
.sig .nm small { display: block; font-size: 11.5px; color: var(--muted); font-weight: 400; margin-top: 2px; }
.sig .meter { height: 6px; background: var(--line-2); border-radius: 99px; overflow: hidden; position: relative; }
.sig .meter > div { height: 100%; border-radius: 99px; }
.sig .meter .marker { position: absolute; top: -3px; width: 2px; height: 12px; background: var(--ink); opacity: .25; }
.sig .val { text-align: right; font-family: 'Geist Mono', monospace; font-size: 18px; font-weight: 500; letter-spacing: -.01em; }
.sig .val .qual { display: block; font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase; font-weight: 600; margin-top: 2px; }
.val.crit .qual { color: var(--crit); }
.val.warm .qual { color: var(--warm); }
.val.emer .qual { color: var(--emer); }

/* Subscriber grid */
.sub-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 0; }
.sub-cell { padding: 14px 18px; border-right: 1px solid var(--line-2); }
.sub-cell:nth-child(3n) { border-right: none; }
.sub-cell:nth-child(n+4) { border-top: 1px solid var(--line-2); }
.sub-cell .lbl { font-size: 10.5px; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); font-weight: 500; margin-bottom: 6px; }
.sub-cell .v { font-size: 14px; font-weight: 500; }
.sub-cell .v small { display: block; color: var(--muted); font-weight: 400; font-size: 11.5px; margin-top: 2px; }
.sub-cell .v .ok { color: var(--emer); font-weight: 600; }

/* Section divider */
.section-divider { display: flex; align-items: center; gap: 12px; margin: 34px 0 14px; }
.section-divider h2 { font-family: 'Instrument Serif', serif; font-size: 26px; letter-spacing: -.015em; font-weight: 400; }
.section-divider .hr { flex: 1; height: 1px; background: var(--line-2); }
.section-divider .ct { font-size: 11.5px; color: var(--muted); }

/* Offers */
.auto-banner { display: flex; gap: 14px; padding: 16px 18px; background: linear-gradient(135deg,#fbf6ee,#f6efe1); border: 1px solid #ecdfc4; border-radius: 14px; align-items: center; margin-bottom: 18px; }
.auto-banner .b-ic { width: 42px; height: 42px; border-radius: 12px; background: linear-gradient(180deg,#d4a566,#bf8a3e); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 18px; box-shadow: inset 0 1px 0 rgba(255,255,255,.3), 0 4px 10px -4px rgba(191,138,62,.5); flex-shrink: 0; }
.auto-banner .tx { flex: 1; font-size: 13px; color: #5a4a2d; }
.auto-banner .tx b { font-weight: 600; color: #3a2e15; }

.offer-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.offer { position: relative; border: 1px solid var(--line); border-radius: 14px; padding: 18px; background: #fff; cursor: pointer; transition: all var(--duration-fast) var(--ease-out); }
.offer:hover { border-color: #d4d4d4; transform: translateY(-1px); box-shadow: 0 8px 24px -12px rgba(15,17,21,.15); }
.offer.pick { border-color: var(--ink); box-shadow: 0 0 0 3px rgba(15,17,21,.08), 0 8px 24px -12px rgba(15,17,21,.2); background: linear-gradient(180deg,#fbfaf6,#fff); }
.offer .top { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 10px; }
.offer .ic { width: 34px; height: 34px; border-radius: 10px; background: var(--chip); display: flex; align-items: center; justify-content: center; font-size: 15px; flex-shrink: 0; }
.offer.pick .ic { background: var(--ink); color: #fff; }
.offer .nm { font-size: 13.5px; font-weight: 600; line-height: 1.3; }
.offer .nm small { display: block; color: var(--muted); font-weight: 400; font-size: 11.5px; margin-top: 2px; }
.offer .badge { margin-left: auto; font-size: 10px; background: #e8f3ec; color: var(--emer); padding: 2px 8px; border-radius: 99px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; white-space: nowrap; }
.offer .desc { font-size: 12.5px; color: var(--ink-2); line-height: 1.55; margin-bottom: 14px; }
.offer .metrics { display: grid; grid-template-columns: repeat(3,1fr); gap: 8px; padding-top: 12px; border-top: 1px dashed var(--line-2); }
.offer .metrics .m .ml { font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; font-weight: 500; }
.offer .metrics .m .mv { font-family: 'Geist Mono', monospace; font-size: 14px; font-weight: 500; margin-top: 2px; }

/* Notes timeline */
.tl { position: relative; padding-left: 6px; }
.tl .item { display: flex; gap: 14px; padding: 14px 0; position: relative; }
.tl .item:not(:last-child)::before { content: ''; position: absolute; left: 14px; top: 36px; bottom: -2px; width: 1px; background: var(--line-2); }
.tl .av { width: 28px; height: 28px; border-radius: 50%; color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 600; font-size: 11px; flex-shrink: 0; z-index: 1; border: 2px solid #fff; box-shadow: 0 0 0 1px var(--line); }
.tl .head { display: flex; align-items: baseline; gap: 8px; margin-bottom: 4px; flex-wrap: wrap; }
.tl .who { font-size: 13px; font-weight: 600; }
.tl .when { font-size: 11.5px; color: var(--muted); }
.tl .role { font-size: 10.5px; background: var(--chip); color: var(--ink-2); padding: 1px 7px; border-radius: 5px; font-weight: 500; }
.tl .txt { font-size: 13px; color: var(--ink-2); line-height: 1.6; }

/* Right rail */
.rail { display: flex; flex-direction: column; gap: 18px; }
.rail .panel { padding: 0; }
.rail-h { padding: 16px 18px 4px; }
.rail-h .ttl { font-size: 13px; font-weight: 600; }
.rail-h .sub { font-size: 11px; color: var(--muted); margin-top: 1px; }

/* Workflow */
.wf { padding: 10px 18px 18px; }
.wf-step { display: flex; gap: 12px; padding: 10px 0; position: relative; }
.wf-step:not(:last-child)::after { content: ''; position: absolute; left: 11px; top: 32px; bottom: -2px; width: 2px; background: var(--line-2); }
.wf-step.done:not(:last-child)::after { background: var(--emer); opacity: .4; }
.wf-step .ind { width: 22px; height: 22px; border-radius: 50%; background: #fff; border: 1.5px solid var(--line); display: flex; align-items: center; justify-content: center; flex-shrink: 0; font-size: 11px; font-weight: 600; color: var(--muted); position: relative; z-index: 1; margin-top: 1px; }
.wf-step.done .ind { background: var(--emer); border-color: var(--emer); color: #fff; }
.wf-step.now .ind { background: var(--ink); border-color: var(--ink); color: #fff; box-shadow: 0 0 0 4px rgba(15,17,21,.08); }
.wf-step .nm { font-size: 13px; font-weight: 500; }
.wf-step.now .nm { font-weight: 600; }
.wf-step .mt { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.wf-step.done .nm { color: var(--ink-2); }

/* SLA card */
.sla-card { margin: 0 18px 18px; padding: 16px; border-radius: 14px; background: linear-gradient(135deg,#fdf1e6,#fbe6d0); border: 1px solid #f2d6b0; }
.sla-card.breached { background: linear-gradient(135deg,#fbeae6,#f8d4cc); border-color: rgba(192,57,43,.25); }
.sla-card .lbl { font-size: 10.5px; text-transform: uppercase; letter-spacing: .1em; color: #9a5d20; font-weight: 600; margin-bottom: 6px; }
.sla-card.breached .lbl { color: var(--crit); }
.sla-card .tm { font-family: 'Instrument Serif', serif; font-size: 30px; color: #5a3210; letter-spacing: -.02em; line-height: 1; }
.sla-card.breached .tm { color: var(--crit); }
.sla-card .bar { height: 5px; background: rgba(154,93,32,.18); border-radius: 99px; margin-top: 14px; overflow: hidden; }
.sla-card .bar > div { height: 100%; background: linear-gradient(90deg,#d4a566,#bf8a3e); border-radius: 99px; }
.sla-card.breached .bar > div { background: linear-gradient(90deg,var(--warm),var(--crit)); }
.sla-card .mt { font-size: 11.5px; color: #7a4a18; margin-top: 8px; display: flex; justify-content: space-between; }

/* Owner */
.owner { display: flex; gap: 12px; align-items: center; margin: 0 18px 18px; padding: 14px; border-radius: 14px; background: var(--bg); border: 1px solid var(--line-2); }
.owner .av { width: 38px; height: 38px; border-radius: 50%; color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 600; font-size: 13px; flex-shrink: 0; }
.owner .nm { font-size: 13px; font-weight: 600; }
.owner .rl { font-size: 11.5px; color: var(--muted); }

/* Linked records */
.linked { padding: 0 18px 18px; display: flex; flex-direction: column; gap: 8px; }
.lk { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px; background: var(--bg); font-size: 12.5px; cursor: pointer; transition: background var(--duration-fast) var(--ease-out); }
.lk:hover { background: #efece4; }
.lk .lic { width: 24px; height: 24px; border-radius: 7px; background: #fff; border: 1px solid var(--line); display: flex; align-items: center; justify-content: center; font-size: 12px; flex-shrink: 0; }
.lk .lt { font-weight: 500; }
.lk .ls { font-size: 11px; color: var(--muted); }
.lk .ar { margin-left: auto; color: var(--muted); }

/* Toast */
.toast-container { position: fixed; top: 20px; right: 20px; z-index: 10000; display: flex; flex-direction: column; gap: 8px; }
.toast { padding: 12px 18px; border-radius: 11px; font-size: 13px; font-weight: 500; color: #fff; box-shadow: var(--shadow-lg); display: flex; align-items: center; gap: 10px; animation: toastIn var(--duration-normal) var(--ease-out); max-width: 380px; }
.toast.success { background: var(--emer); }
.toast.error { background: var(--crit); }
.toast.info { background: var(--ink); }
@keyframes toastIn { from { opacity: 0; transform: translateY(-8px) scale(0.95); } to { opacity: 1; transform: translateY(0) scale(1); } }
.toast.toast-out { animation: toastOut var(--duration-fast) var(--ease-out) forwards; }
@keyframes toastOut { to { opacity: 0; transform: translateY(-8px) scale(0.95); } }

/* Modal */
.modal-backdrop { position: fixed; inset: 0; background: rgba(15,17,21,.4); z-index: 9000; display: flex; align-items: center; justify-content: center; animation: fadeIn var(--duration-normal) var(--ease-out); }
.modal-box { background: #fff; border-radius: 20px; padding: 28px; min-width: 400px; max-width: 520px; box-shadow: var(--shadow-xl); animation: modalIn var(--duration-normal) var(--ease-out); }
.modal-box h3 { font-size: 18px; font-weight: 600; margin-bottom: 16px; }
.modal-box .modal-body { font-size: 13.5px; color: var(--ink-2); line-height: 1.6; margin-bottom: 20px; }
.modal-box .modal-body textarea { width: 100%; height: 100px; border: 1px solid var(--line); border-radius: 11px; padding: 12px; font-family: inherit; font-size: 13px; resize: vertical; outline: none; }
.modal-box .modal-body textarea:focus { border-color: var(--ink); box-shadow: 0 0 0 3px rgba(15,17,21,.06); }
.modal-box .modal-body input[type="text"],
.modal-box .modal-body input[type="number"],
.modal-box .modal-body select {
  width: 100%; height: 38px; border: 1px solid var(--line); border-radius: 11px; padding: 0 12px; font-family: inherit; font-size: 13px; outline: none;
}
.modal-box .modal-body input:focus,
.modal-box .modal-body select:focus { border-color: var(--ink); box-shadow: 0 0 0 3px rgba(15,17,21,.06); }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes modalIn { from { opacity: 0; transform: scale(0.95) translateY(8px); } to { opacity: 1; transform: scale(1) translateY(0); } }

/* Dropdown */
.dd-panel { position: absolute; top: 100%; left: 0; margin-top: 4px; background: #fff; border: 1px solid var(--line); border-radius: 11px; box-shadow: var(--shadow-lg); z-index: 100; min-width: 180px; padding: 4px; display: none; }
.dd-panel.open { display: block; animation: fadeIn var(--duration-fast) var(--ease-out); }
.dd-opt { padding: 8px 12px; border-radius: 7px; font-size: 13px; cursor: pointer; transition: background var(--duration-fast); }
.dd-opt:hover { background: var(--chip); }
.dd-opt.active { background: var(--ink); color: #fff; }
.dd-trigger { position: relative; display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }

/* Tables */
.data-table { width: 100%; border-collapse: collapse; }
.data-table thead th { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 500; padding: 10px 14px; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; cursor: default; }
.data-table thead th.sortable { cursor: pointer; }
.data-table thead th.sortable:hover { color: var(--ink); }
.data-table thead th .sort-icon { display: inline-block; margin-left: 4px; opacity: .4; }
.data-table thead th.sorted .sort-icon { opacity: 1; color: var(--ink); }
.data-table tbody tr { border-bottom: 1px solid var(--line-2); transition: background var(--duration-fast); }
.data-table tbody tr:hover { background: rgba(15,17,21,.02); }
.data-table tbody tr.clickable { cursor: pointer; }
.data-table tbody tr.clickable:hover { background: rgba(15,17,21,.04); }
.data-table tbody td { padding: 12px 14px; font-size: 13px; vertical-align: middle; }

/* Login */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--bg); }
.login-card { width: 480px; background: #fff; border-radius: 20px; padding: 40px; box-shadow: var(--shadow-lg); border: 1px solid var(--line); }
.login-card h1 { font-family: 'Instrument Serif', serif; font-size: 32px; margin-bottom: 4px; }
.login-card .sub { color: var(--muted); font-size: 14px; margin-bottom: 28px; }
.login-card .user-cards { display: flex; gap: 12px; margin-bottom: 24px; }
.login-card .user-card { flex: 1; padding: 14px; border: 1px solid var(--line); border-radius: 14px; cursor: pointer; text-align: center; transition: all var(--duration-fast) var(--ease-out); }
.login-card .user-card:hover { border-color: #d4d4d4; transform: translateY(-2px); box-shadow: var(--shadow-md); }
.login-card .user-card.selected { border-color: var(--ink); box-shadow: 0 0 0 3px rgba(15,17,21,.08); }
.login-card .user-card .uc-av { width: 48px; height: 48px; border-radius: 50%; margin: 0 auto 10px; color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 600; font-size: 16px; }
.login-card .user-card .uc-name { font-size: 13px; font-weight: 600; }
.login-card .user-card .uc-role { font-size: 11px; color: var(--muted); margin-top: 2px; }
.login-card .form-group { margin-bottom: 16px; }
.login-card label { display: block; font-size: 12px; font-weight: 500; color: var(--ink-2); margin-bottom: 6px; }
.login-card input { width: 100%; height: 42px; border: 1px solid var(--line); border-radius: 11px; padding: 0 14px; font-family: inherit; font-size: 13.5px; outline: none; transition: border-color var(--duration-fast); }
.login-card input:focus { border-color: var(--ink); box-shadow: 0 0 0 3px rgba(15,17,21,.06); }
.login-card input.error { border-color: var(--crit); }
.login-card .error-msg { font-size: 12px; color: var(--crit); margin-top: 6px; }
.login-card .login-btn { width: 100%; height: 44px; margin-top: 8px; }

/* Metric strip */
.metric-strip { display: grid; gap: 18px; margin-bottom: 22px; }
.metric-strip.cols-4 { grid-template-columns: repeat(4,1fr); }
.metric-card { background: #fff; border: 1px solid var(--line); border-radius: 18px; padding: 20px 22px; }
.metric-card .mc-label { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 500; margin-bottom: 8px; }
.metric-card .mc-value { font-size: 28px; font-family: 'Instrument Serif', serif; letter-spacing: -.01em; line-height: 1; }
.metric-card .mc-sub { font-size: 11.5px; color: var(--muted); margin-top: 6px; }

/* Approval cards */
.approval-list { display: flex; flex-direction: column; gap: 14px; }
.approval-card { background: #fff; border: 1px solid var(--line); border-radius: 18px; padding: 22px; transition: all var(--duration-fast) var(--ease-out); }
.approval-card:hover { box-shadow: var(--shadow-md); }
.approval-card.approved { border-color: rgba(31,122,77,.3); background: linear-gradient(180deg,#f7faf8,#fff); }
.approval-card.rejected { opacity: .6; }
.approval-card .ac-top { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }
.approval-card .ac-av { width: 36px; height: 36px; border-radius: 50%; color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 600; font-size: 12px; flex-shrink: 0; }
.approval-card .ac-info { flex: 1; }
.approval-card .ac-case { font-family: 'Geist Mono', monospace; font-size: 13px; font-weight: 500; }
.approval-card .ac-agent { font-size: 12px; color: var(--muted); }
.approval-card .ac-body { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; margin-bottom: 14px; }
.approval-card .ac-field .af-label { font-size: 10.5px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 500; margin-bottom: 4px; }
.approval-card .ac-field .af-value { font-size: 13px; font-weight: 500; }
.approval-card .ac-notes { font-size: 12.5px; color: var(--ink-2); line-height: 1.5; margin-bottom: 14px; padding: 10px 14px; background: var(--bg); border-radius: 10px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.approval-card .ac-actions { display: flex; gap: 8px; }

/* Integration cards */
.integration-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 18px; margin-bottom: 22px; }
.int-card { background: #fff; border: 1px solid var(--line); border-radius: 18px; padding: 22px; }
.int-card .ic-top { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; }
.int-card .ic-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.int-card .ic-dot.healthy { background: var(--emer); box-shadow: 0 0 0 3px rgba(31,122,77,.15); }
.int-card .ic-dot.degraded { background: var(--warm); box-shadow: 0 0 0 3px rgba(232,123,53,.15); }
.int-card .ic-dot.down { background: var(--crit); box-shadow: 0 0 0 3px rgba(192,57,43,.15); }
.int-card .ic-name { font-size: 14px; font-weight: 600; }
.int-card .ic-status { margin-left: auto; }
.int-card .ic-metrics { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 16px; }
.int-card .ic-metric .im-label { font-size: 10.5px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 500; margin-bottom: 4px; }
.int-card .ic-metric .im-value { font-family: 'Geist Mono', monospace; font-size: 16px; font-weight: 500; }
.int-card .ic-actions { display: flex; gap: 8px; }

/* Config forms */
.config-form { display: flex; flex-direction: column; gap: 22px; }
.config-panel { background: #fff; border: 1px solid var(--line); border-radius: 18px; padding: 22px; }
.config-panel .cp-title { font-size: 14px; font-weight: 600; margin-bottom: 16px; }
.config-panel .cp-row { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }
.config-panel .cp-row:last-child { margin-bottom: 0; }
.config-panel .cp-label { font-size: 12px; font-weight: 500; color: var(--ink-2); min-width: 160px; }
.config-panel .cp-input { flex: 1; }
.config-panel .cp-input input,
.config-panel .cp-input select { width: 100%; height: 38px; border: 1px solid var(--line); border-radius: 11px; padding: 0 12px; font-family: inherit; font-size: 13px; outline: none; }
.config-panel .cp-input input:focus,
.config-panel .cp-input select:focus { border-color: var(--ink); box-shadow: 0 0 0 3px rgba(15,17,21,.06); }
.config-panel .cp-input input.error { border-color: var(--crit); }
.config-panel .cp-hint { font-size: 11px; color: var(--muted); margin-top: 4px; }
.config-panel .cp-error { font-size: 11px; color: var(--crit); margin-top: 4px; }

/* Weight bar */
.weight-bar { display: flex; height: 8px; border-radius: 99px; overflow: hidden; gap: 2px; }
.weight-bar > div { height: 100%; border-radius: 99px; }

/* Toggle switch */
.toggle { position: relative; width: 40px; height: 22px; background: var(--line); border-radius: 99px; cursor: pointer; transition: background var(--duration-fast); flex-shrink: 0; }
.toggle.on { background: var(--emer); }
.toggle::after { content: ''; position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; background: #fff; border-radius: 50%; box-shadow: var(--shadow-sm); transition: transform var(--duration-fast); }
.toggle.on::after { transform: translateX(18px); }

/* Filter bar */
.filter-bar { display: flex; gap: 10px; align-items: center; margin-bottom: 18px; flex-wrap: wrap; }
.filter-bar .filter-group { position: relative; }
.filter-bar .filter-label { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; font-weight: 500; margin-bottom: 4px; }

/* Progress bar inline */
.progress-bar { height: 6px; background: var(--line-2); border-radius: 99px; overflow: hidden; width: 80px; display: inline-block; vertical-align: middle; margin-right: 8px; }
.progress-bar > div { height: 100%; border-radius: 99px; }

/* Empty state */
.empty-state { text-align: center; padding: 48px 24px; }
.empty-state .es-icon { font-size: 40px; margin-bottom: 14px; opacity: .4; }
.empty-state .es-title { font-size: 16px; font-weight: 600; margin-bottom: 6px; }
.empty-state .es-sub { font-size: 13px; color: var(--muted); }

/* Skeleton loading */
.skeleton { background: linear-gradient(90deg, var(--line-2) 25%, #e8e7e2 37%, var(--line-2) 63%); background-size: 200% 100%; animation: shimmer 1.5s infinite; border-radius: 9px; }
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* Animations */
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .5; } }

.fade-in { animation: fadeSlideIn var(--duration-normal) var(--ease-out) both; }
@keyframes fadeSlideIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
.stagger-1 { animation-delay: 60ms; }
.stagger-2 { animation-delay: 120ms; }
.stagger-3 { animation-delay: 180ms; }
.stagger-4 { animation-delay: 240ms; }
.stagger-5 { animation-delay: 300ms; }
.stagger-6 { animation-delay: 360ms; }
.stagger-7 { animation-delay: 420ms; }
.stagger-8 { animation-delay: 480ms; }

/* Bar chart */
.bar-chart-wrap { padding: 14px 0; }
.bar-row { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.bar-row .bar-label { width: 120px; font-size: 12px; font-weight: 500; text-align: right; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-row .bar-track { flex: 1; height: 20px; background: var(--line-2); border-radius: 99px; overflow: hidden; }
.bar-row .bar-fill { height: 100%; border-radius: 99px; transition: width var(--duration-slow) var(--ease-out); }
.bar-row .bar-val { width: 50px; font-family: 'Geist Mono', monospace; font-size: 12px; font-weight: 500; }

/* Audit footer */
.audit-footer { display: flex; align-items: center; gap: 14px; padding: 14px 22px; border-top: 1px solid var(--line-2); font-size: 11.5px; color: var(--muted); }

/* Screen header */
.screen-header { display: flex; align-items: center; gap: 14px; margin-bottom: 22px; }
.screen-header h1 { font-family: 'Instrument Serif', serif; font-size: 28px; letter-spacing: -.02em; }
.screen-header .sh-actions { margin-left: auto; display: flex; gap: 8px; }

/* Coaching badge in table */
.coaching-badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 99px; font-size: 10.5px; font-weight: 600; background: #fdf1e6; color: var(--warm); border: 1px solid rgba(232,123,53,.18); cursor: pointer; }

/* Error log */
.error-log { width: 100%; border-collapse: collapse; }
.error-log thead th { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 500; padding: 10px 14px; text-align: left; border-bottom: 1px solid var(--line); }
.error-log tbody td { padding: 10px 14px; font-size: 12.5px; border-bottom: 1px solid var(--line-2); }
.error-log .err-type { font-weight: 500; color: var(--warm); }

/* Validation result */
.validation-result { display: flex; align-items: center; gap: 8px; padding: 12px 16px; border-radius: 11px; font-size: 13px; font-weight: 500; }
.validation-result.pass { background: #e8f3ec; color: var(--emer); }
.validation-result.fail { background: #fbeae6; color: var(--crit); }

/* Approval routing rules (read-only) */
.rules-display { padding: 14px 18px; background: var(--bg); border-radius: 11px; font-size: 12.5px; color: var(--ink-2); line-height: 1.7; }
.rules-display li { margin-bottom: 6px; list-style: disc; margin-left: 18px; }
