:root {
  /* ink / sumi (GenGateway brand) */
  --ink-950: #14121f;
  --ink-900: #1c1930;
  --ink-800: #272242;
  --ink-700: #342d55;
  --sumi: #17161d;
  /* indigo / violet primary */
  --indigo-700: #4338ca;
  --indigo-600: #4f46e5;
  --indigo-500: #6366f1;
  --indigo-100: #e8e7fd;
  --indigo-50: #f2f1fe;
  --violet-500: #8b5cf6;
  --violet-100: #efe9ff;
  /* status */
  --amber-600: #b45309;
  --amber-500: #f59e0b;
  --amber-100: #fef3c7;
  --red-600: #dc2626;
  --red-500: #ef4444;
  --red-100: #fee2e2;
  --emerald-600: #059669;
  --emerald-500: #10b981;
  --emerald-100: #d1fae5;
  /* neutrals */
  --slate-900: #1a1c25;
  --slate-800: #2a2d3a;
  --slate-700: #45495a;
  --slate-600: #5c6172;
  --slate-500: #7b8195;
  --slate-400: #a2a8ba;
  --slate-300: #cfd4e0;
  --slate-200: #e6e9f1;
  --slate-100: #f1f3f8;
  --slate-50: #f8f9fc;
  --white: #fff;
  --shadow-sm: 0 1px 2px rgba(20,18,31,.05), 0 4px 14px rgba(20,18,31,.04);
  --shadow-md: 0 12px 32px rgba(20,18,31,.10);
  --shadow-lg: 0 24px 60px rgba(20,18,31,.18);
  --r-sm: 8px; --r-md: 12px; --r-lg: 18px; --r-xl: 24px;
  --sb-w: 268px;
}

* { box-sizing: border-box; }
html { background: var(--slate-100); scroll-behavior: smooth; }
body {
  margin: 0; color: var(--slate-900); background: var(--slate-100);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans JP", "Hiragino Sans", "Yu Gothic UI", sans-serif;
  font-size: 14px; line-height: 1.55; -webkit-font-smoothing: antialiased;
}
button, input, textarea, select { color: inherit; font: inherit; }
button { border: 0; cursor: pointer; background: none; }
:focus-visible { outline: 3px solid rgba(99,102,241,.3); outline-offset: 2px; }
.svg-defs { position: absolute; width: 0; height: 0; }
.icon { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; flex: none; }
h1,h2,h3,h4,p { margin: 0; }
mark { background: transparent; color: inherit; }

/* ===================== SHELL ===================== */
.app-shell { display: flex; min-height: 100vh; }

/* ---------- Sidebar ---------- */
.sidebar {
  width: var(--sb-w); flex: none; background: linear-gradient(185deg, var(--ink-950), var(--ink-900) 55%, var(--ink-800));
  color: #e9e8f5; display: flex; flex-direction: column; padding: 20px 16px; gap: 16px;
  position: sticky; top: 0; height: 100vh;
}
.brand { display: flex; align-items: center; gap: 11px; padding: 4px 6px; }
.brand-mark {
  width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center;
  background: linear-gradient(150deg, var(--indigo-500), var(--violet-500)); color: #fff;
  font-weight: 800; font-size: 20px; box-shadow: 0 6px 16px rgba(99,102,241,.4);
}
.brand-text strong { display: block; font-size: 17px; letter-spacing: .3px; }
.brand-text small { color: #9a97bd; font-size: 11px; }
.env-pill {
  align-self: flex-start; display: inline-flex; align-items: center; gap: 7px;
  background: rgba(139,92,246,.16); color: #d7ccff; border: 1px solid rgba(139,92,246,.3);
  padding: 4px 11px; border-radius: 999px; font-size: 11.5px; font-weight: 600;
}
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--slate-400); flex: none; }
.dot.ok { background: var(--emerald-500); box-shadow: 0 0 0 3px rgba(16,185,129,.2); }
.env-pill .dot { background: var(--violet-500); }

.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-group-label {
  font-size: 10.5px; letter-spacing: 1px; text-transform: uppercase; color: #7d7aa0;
  margin: 14px 8px 6px; display: flex; justify-content: space-between; align-items: baseline; font-weight: 700;
}
.nav-group-label span { text-transform: none; letter-spacing: 0; color: #605d80; font-weight: 500; }
.nav-item {
  display: flex; align-items: center; gap: 11px; padding: 10px 12px; border-radius: 10px;
  color: #c6c3e0; font-weight: 500; font-size: 13.5px; text-align: left; transition: background .15s, color .15s;
}
.nav-item .icon { width: 19px; height: 19px; color: #9a97c4; }
.nav-item:hover { background: rgba(255,255,255,.05); color: #fff; }
.nav-item.active { background: linear-gradient(100deg, rgba(99,102,241,.9), rgba(139,92,246,.75)); color: #fff; box-shadow: var(--shadow-sm); }
.nav-item.active .icon { color: #fff; }
.nav-item span:not(.nav-badge) { flex: 1; }
.nav-badge { background: rgba(255,255,255,.16); color: #fff; font-size: 11px; font-weight: 700; padding: 1px 8px; border-radius: 999px; }
.nav-badge.danger { background: var(--red-500); }

.sidebar-spacer { flex: 1; }
.gate-card { background: rgba(255,255,255,.05); border: 1px solid rgba(255,255,255,.08); border-radius: 14px; padding: 13px; }
.gate-head { display: flex; align-items: center; gap: 9px; margin-bottom: 10px; }
.gate-mark { width: 30px; height: 30px; border-radius: 8px; background: rgba(139,92,246,.2); color: #d7ccff; display: grid; place-items: center; font-weight: 700; }
.gate-head strong { display: block; font-size: 13px; color: #fff; }
.gate-head small { color: #9a97bd; font-size: 11px; }
.gate-head .dot { margin-left: auto; }
.gate-stat { display: flex; justify-content: space-between; font-size: 12px; color: #b9b6d8; margin-bottom: 6px; }
.gate-stat strong { color: #fff; }
.microbar { height: 5px; border-radius: 999px; background: rgba(255,255,255,.1); overflow: hidden; margin-bottom: 8px; }
.microbar span { display: block; height: 100%; background: linear-gradient(90deg, var(--indigo-500), var(--violet-500)); border-radius: 999px; }
.gate-card .muted { color: #7d7aa0; font-size: 11px; }

.user-card { display: flex; align-items: center; gap: 10px; padding: 10px; background: rgba(255,255,255,.04); border-radius: 12px; }
.avatar { width: 36px; height: 36px; border-radius: 10px; background: linear-gradient(150deg, var(--indigo-600), var(--violet-500)); color: #fff; display: grid; place-items: center; font-weight: 700; }
.user-card strong { display: block; font-size: 13px; color: #fff; }
.user-card small { color: #9a97bd; font-size: 11px; }
.icon-btn { margin-left: auto; color: #9a97bd; padding: 4px; border-radius: 8px; }
.icon-btn:hover { background: rgba(255,255,255,.08); color: #fff; }

/* ---------- Main ---------- */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; gap: 16px; padding: 18px 30px;
  background: rgba(255,255,255,.85); backdrop-filter: blur(8px); border-bottom: 1px solid var(--slate-200);
  position: sticky; top: 0; z-index: 20;
}
.crumb { font-size: 11px; letter-spacing: 1.2px; color: var(--indigo-600); font-weight: 700; }
.topbar h1 { font-size: 20px; font-weight: 750; letter-spacing: .2px; }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.role-switch { display: inline-flex; background: var(--slate-100); border: 1px solid var(--slate-200); border-radius: 999px; padding: 3px; }
.role { padding: 6px 15px; border-radius: 999px; font-size: 12.5px; font-weight: 600; color: var(--slate-600); transition: background .15s, color .15s; }
.role.active { background: var(--white); color: var(--indigo-700); box-shadow: var(--shadow-sm); }
/* role toggle inside the (dark) sidebar */
.sidebar-role { display: flex; width: 100%; align-self: stretch; background: rgba(255,255,255,.07); border-color: rgba(255,255,255,.12); }
.sidebar-role .role { flex: 1; text-align: center; color: #c6c3e0; }
.sidebar-role .role:hover { color: #fff; }
.sidebar-role .role.active { background: #fff; color: var(--indigo-700); }
.mode-chip { display: inline-flex; align-items: center; gap: 7px; font-size: 12px; font-weight: 600; color: var(--indigo-700); background: var(--indigo-50); border: 1px solid var(--indigo-100); padding: 6px 13px; border-radius: 999px; }
.mode-chip .dot { background: var(--indigo-500); }
.mobile-menu { display: none; color: var(--slate-700); }

/* ---- Employee mode: hide admin menu + recolor sidebar ---- */
.nav-group { display: contents; }
.app-shell:not(.employee-mode) .entry-group { display: none; }
.app-shell.employee-mode .admin-group { display: none; }
.app-shell.employee-mode .sidebar { background: linear-gradient(185deg, #064e3b, #065f46 52%, #0f766e); }
.app-shell.employee-mode .nav-item.active { background: linear-gradient(100deg, #10b981, #14b8a6); box-shadow: 0 6px 16px rgba(16,185,129,.35); }
.app-shell.employee-mode .sidebar-role .role.active { color: #047857; }
.app-shell.employee-mode .brand-mark { background: linear-gradient(150deg, #10b981, #0d9488); box-shadow: 0 6px 16px rgba(16,185,129,.4); }
.app-shell.employee-mode .gate-mark { background: rgba(16,185,129,.22); color: #a7f3d0; }
.app-shell.employee-mode .microbar span { background: linear-gradient(90deg, #10b981, #14b8a6); }
.app-shell.employee-mode .avatar { background: linear-gradient(150deg, #10b981, #0d9488); }
.app-shell.employee-mode .mode-chip { color: var(--emerald-600); background: var(--emerald-100); border-color: #a7f3d0; }
.app-shell.employee-mode .mode-chip .dot { background: var(--emerald-500); }

.demo-notice {
  display: flex; align-items: center; gap: 12px; margin: 18px 30px 0;
  background: var(--indigo-50); border: 1px solid var(--indigo-100); color: var(--slate-700);
  padding: 11px 15px; border-radius: 12px; font-size: 12.5px;
}
.demo-notice .icon { color: var(--indigo-600); flex: none; }
.demo-notice span { flex: 1; }
.demo-notice button { color: var(--slate-500); padding: 4px; border-radius: 6px; }
.demo-notice button:hover { background: rgba(0,0,0,.05); }

.view { display: none; padding: 22px 30px 44px; animation: fade .25s ease; }
.view.active { display: block; }
@keyframes fade { from { opacity: 0; transform: translateY(6px);} to { opacity: 1; transform: none; } }

/* ---------- Common blocks ---------- */
.panel { background: var(--white); border: 1px solid var(--slate-200); border-radius: var(--r-lg); box-shadow: var(--shadow-sm); padding: 20px; }
.panel-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.kicker { font-size: 10.5px; letter-spacing: 1.2px; color: var(--slate-500); font-weight: 700; }
.panel-head h3 { font-size: 15.5px; font-weight: 700; margin-top: 3px; }
.chip { font-size: 11.5px; color: var(--slate-600); background: var(--slate-100); border: 1px solid var(--slate-200); padding: 4px 10px; border-radius: 999px; font-weight: 600; white-space: nowrap; }
.eyebrow { font-size: 11px; letter-spacing: 1.4px; color: var(--indigo-600); font-weight: 700; }
.intro { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; margin-bottom: 20px; }
.intro h2 { font-size: 22px; font-weight: 780; margin-top: 6px; letter-spacing: .2px; }
.intro p { color: var(--slate-600); margin-top: 6px; max-width: 640px; }
.intro b { color: var(--slate-800); }

.btn { display: inline-flex; align-items: center; gap: 7px; padding: 9px 16px; border-radius: 10px; font-weight: 650; font-size: 13px; transition: transform .06s, box-shadow .15s, background .15s; }
.btn:active { transform: translateY(1px); }
.btn .icon { width: 17px; height: 17px; }
.btn-primary { background: linear-gradient(100deg, var(--indigo-600), var(--violet-500)); color: #fff; box-shadow: 0 6px 16px rgba(99,102,241,.32); }
.btn-primary:hover { box-shadow: 0 8px 22px rgba(99,102,241,.42); }
.btn-soft { background: var(--indigo-50); color: var(--indigo-700); border: 1px solid var(--indigo-100); }
.btn-soft:hover { background: var(--indigo-100); }
.btn-light { background: var(--white); color: var(--slate-800); border: 1px solid var(--slate-300); }
.btn-light:hover { border-color: var(--slate-400); }
.btn-ink { background: var(--sumi); color: #fff; }
.btn-ink:hover { background: #000; }
.btn-ghost { background: transparent; color: var(--slate-600); }
.btn.sm { padding: 7px 12px; font-size: 12px; }
.btn.full { width: 100%; justify-content: center; }
.text-btn { display: inline-flex; align-items: center; gap: 5px; color: var(--indigo-600); font-weight: 650; font-size: 12.5px; }
.text-btn .icon { width: 15px; height: 15px; }

/* ===================== DASHBOARD ===================== */
.alert-band {
  display: flex; align-items: center; gap: 14px; padding: 15px 18px; border-radius: 14px; margin-bottom: 18px;
  background: linear-gradient(100deg, #fff5f5, #fee2e2); border: 1px solid #fbcaca;
}
.alert-ic { width: 40px; height: 40px; border-radius: 11px; background: var(--red-500); color: #fff; display: grid; place-items: center; flex: none; box-shadow: 0 6px 14px rgba(239,68,68,.35); }
.alert-body { flex: 1; }
.alert-body strong { color: var(--red-600); font-size: 14.5px; }
.alert-body p { color: var(--slate-700); font-size: 12.5px; margin-top: 2px; }
.alert-body b { color: var(--slate-900); }

.kpi-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 14px; margin-bottom: 18px; }
.kpi { background: var(--white); border: 1px solid var(--slate-200); border-radius: 16px; padding: 16px; box-shadow: var(--shadow-sm); }
.kpi-head { display: flex; align-items: center; justify-content: space-between; color: var(--slate-600); font-size: 12px; font-weight: 600; }
.kpi-ic { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; }
.kpi-ic .icon { width: 17px; height: 17px; }
.kpi-ic.indigo { background: var(--indigo-100); color: var(--indigo-600); }
.kpi-ic.violet { background: var(--violet-100); color: var(--violet-500); }
.kpi-ic.amber { background: var(--amber-100); color: var(--amber-600); }
.kpi-ic.red { background: var(--red-100); color: var(--red-600); }
.kpi-ic.ink { background: #e7e6ee; color: var(--sumi); }
.kpi-val { display: block; font-size: 30px; font-weight: 800; letter-spacing: -.5px; margin: 8px 0 4px; }
.kpi-val span { font-size: 15px; font-weight: 600; color: var(--slate-500); margin-left: 2px; }
.kpi-foot { font-size: 11.5px; color: var(--slate-500); display: flex; align-items: center; gap: 4px; }
.kpi-foot .icon { width: 14px; height: 14px; }
.kpi-foot.up { color: var(--emerald-600); }

.dash-grid { display: grid; grid-template-columns: 1.15fr 1fr; gap: 16px; }
.dash-grid.lower { margin-top: 16px; }

.purpose-wrap { display: flex; align-items: center; gap: 22px; }
.donut {
  --a:22;--b:18;--c:16;--d:14;--e:12;--f:10;--g:8;
  width: 150px; height: 150px; border-radius: 50%; flex: none; position: relative;
  background: conic-gradient(
    var(--indigo-600) 0 calc(var(--a)*1%),
    var(--violet-500) 0 calc((var(--a)+var(--b))*1%),
    #38bdf8 0 calc((var(--a)+var(--b)+var(--c))*1%),
    var(--emerald-500) 0 calc((var(--a)+var(--b)+var(--c)+var(--d))*1%),
    var(--amber-500) 0 calc((var(--a)+var(--b)+var(--c)+var(--d)+var(--e))*1%),
    #f472b6 0 calc((var(--a)+var(--b)+var(--c)+var(--d)+var(--e)+var(--f))*1%),
    var(--slate-400) 0 100%);
}
.donut-hole { position: absolute; inset: 26px; background: var(--white); border-radius: 50%; display: grid; place-items: center; text-align: center; box-shadow: inset 0 0 0 1px var(--slate-100); }
.donut-hole strong { font-size: 22px; font-weight: 800; }
.donut-hole span { font-size: 11px; color: var(--slate-500); }
.legend { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 8px 16px; flex: 1; }
.legend li { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--slate-700); }
.legend li b { margin-left: auto; font-weight: 700; color: var(--slate-900); }
.sw { width: 11px; height: 11px; border-radius: 3px; flex: none; }
.sw.c1 { background: var(--indigo-600); } .sw.c2 { background: var(--violet-500); } .sw.c3 { background: #38bdf8; }
.sw.c4 { background: var(--emerald-500); } .sw.c5 { background: var(--amber-500); } .sw.c6 { background: #f472b6; } .sw.c7 { background: var(--slate-400); }
.sw.b-warn { background: var(--amber-500); } .sw.b-block { background: var(--red-500); }

.insight { display: flex; gap: 10px; margin-top: 16px; padding: 12px 14px; background: var(--indigo-50); border-radius: 12px; border: 1px solid var(--indigo-100); }
.insight .icon { color: var(--indigo-600); flex: none; margin-top: 1px; }
.insight p { font-size: 12.5px; color: var(--slate-700); }
.insight b { color: var(--indigo-700); }

.bars { display: flex; align-items: flex-end; gap: 12px; height: 150px; padding: 8px 4px 0; }
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 3px; height: 100%; position: relative; }
.bar { width: 60%; border-radius: 5px 5px 2px 2px; }
.bar.b-warn { background: linear-gradient(var(--amber-500), #fbbf24); }
.bar.b-block { background: var(--red-500); width: 44%; }
.bar-col small { position: absolute; bottom: -20px; font-size: 11px; color: var(--slate-500); }
.legend-inline { display: flex; gap: 18px; margin: 30px 0 14px; font-size: 12px; color: var(--slate-600); }
.legend-inline span { display: flex; align-items: center; gap: 6px; }
.legend-inline i { width: 11px; height: 11px; border-radius: 3px; }

.dept-list { display: flex; flex-direction: column; gap: 9px; }
.dept-row { display: flex; align-items: center; gap: 12px; font-size: 12.5px; color: var(--slate-700); }
.dept-row span:first-child { width: 56px; flex: none; }
.mini-track { flex: 1; height: 7px; border-radius: 999px; background: var(--slate-100); overflow: hidden; }
.mini-track span { display: block; height: 100%; background: linear-gradient(90deg, var(--amber-500), var(--red-500)); border-radius: 999px; }
.dept-row b { width: 26px; text-align: right; font-weight: 700; }

.ai-mini-list { display: flex; flex-direction: column; gap: 10px; }
.ai-mini { display: flex; align-items: center; gap: 11px; padding: 10px 12px; border: 1px solid var(--slate-200); border-radius: 12px; }
.ai-logo { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; font-weight: 800; font-size: 12px; color: #fff; flex: none; }
.ai-logo.gpt { background: #10a37f; } .ai-logo.claude { background: #d97757; } .ai-logo.gemini { background: #4285f4; } .ai-logo.free { background: var(--slate-400); }
.ai-mini strong { display: block; font-size: 13px; }
.ai-mini small { font-size: 11.5px; color: var(--slate-500); }
.ai-mini .tag { margin-left: auto; }
.tag { font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: 999px; }
.tag.ok { background: var(--emerald-100); color: var(--emerald-600); }
.tag.warn { background: var(--amber-100); color: var(--amber-600); }
.tag.danger { background: var(--red-100); color: var(--red-600); }

.event-list { display: flex; flex-direction: column; gap: 4px; }
.event { display: flex; gap: 11px; padding: 9px 6px; border-radius: 10px; }
.event:hover { background: var(--slate-50); }
.ev-ic { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; flex: none; }
.ev-ic .icon { width: 16px; height: 16px; }
.ev-ic.amber { background: var(--amber-100); color: var(--amber-600); }
.ev-ic.ink { background: #e7e6ee; color: var(--sumi); }
.ev-ic.red { background: var(--red-100); color: var(--red-600); }
.ev-ic.indigo { background: var(--indigo-100); color: var(--indigo-600); }
.event p { font-size: 12.5px; color: var(--slate-700); }
.event b { color: var(--slate-900); }
.event small { font-size: 11px; color: var(--slate-500); }

/* ===================== AI SETTINGS ===================== */
.risk-summary { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; flex-wrap: wrap; }
.rs { display: flex; align-items: center; gap: 10px; padding: 12px 18px; border-radius: 14px; border: 1px solid var(--slate-200); background: var(--white); box-shadow: var(--shadow-sm); }
.rs strong { font-size: 24px; font-weight: 800; }
.rs span { font-size: 12px; color: var(--slate-600); }
.rs.danger { border-left: 4px solid var(--red-500); } .rs.danger strong { color: var(--red-600); }
.rs.warn { border-left: 4px solid var(--amber-500); } .rs.warn strong { color: var(--amber-600); }
.rs.ok { border-left: 4px solid var(--emerald-500); } .rs.ok strong { color: var(--emerald-600); }
.rs-note { flex: 1; min-width: 260px; display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--slate-500); }
.rs-note .icon { color: var(--slate-400); flex: none; }

.ai-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.ai-card { background: var(--white); border: 1px solid var(--slate-200); border-radius: 16px; padding: 18px; box-shadow: var(--shadow-sm); position: relative; overflow: hidden; }
.ai-card.risk-red { border-top: 4px solid var(--red-500); }
.ai-card.risk-amber { border-top: 4px solid var(--amber-500); }
.ai-card.risk-green { border-top: 4px solid var(--emerald-500); }
.ai-card-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.ai-card-head .ai-logo { width: 44px; height: 44px; border-radius: 12px; font-size: 14px; }
.ai-card-head h3 { font-size: 16px; }
.ai-card-head small { font-size: 12px; color: var(--slate-500); }
.risk-badge { margin-left: auto; display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.risk-badge.red { background: var(--red-100); color: var(--red-600); }
.risk-badge.amber { background: var(--amber-100); color: var(--amber-600); }
.risk-badge.green { background: var(--emerald-100); color: var(--emerald-600); }
.ai-attrs { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.ai-attr { background: var(--slate-50); border: 1px solid var(--slate-100); border-radius: 10px; padding: 9px 12px; }
.ai-attr small { display: block; font-size: 11px; color: var(--slate-500); }
.ai-attr strong { font-size: 12.5px; }
.ai-attr strong.bad { color: var(--red-600); }
.ai-attr strong.good { color: var(--emerald-600); }
.danger-note { display: flex; gap: 9px; padding: 11px 13px; background: #fff5f5; border: 1px solid #fbcaca; border-radius: 11px; margin-bottom: 14px; }
.danger-note .icon { color: var(--red-500); flex: none; margin-top: 1px; width: 17px; height: 17px; }
.danger-note p { font-size: 12px; color: var(--slate-700); }
.danger-note b { color: var(--red-600); }
.danger-note .fix { color: var(--slate-500); }
.ai-card-foot { display: flex; align-items: center; gap: 12px; padding-top: 4px; }
.ai-card-foot .status-label { font-size: 12px; color: var(--slate-600); font-weight: 600; margin-right: auto; }

/* switch */
.switch { position: relative; width: 42px; height: 24px; flex: none; }
.switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.switch .track { position: absolute; inset: 0; background: var(--slate-300); border-radius: 999px; transition: background .18s; }
.switch .track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; background: #fff; border-radius: 50%; box-shadow: var(--shadow-sm); transition: transform .18s; }
.switch input:checked + .track { background: var(--indigo-600); }
.switch input:checked + .track::after { transform: translateX(18px); }
.switch-lbl { display: inline-flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--slate-700); font-weight: 600; }

/* ===================== POLICY ===================== */
.policy-toolbar { display: flex; align-items: flex-end; gap: 18px; flex-wrap: wrap; background: var(--white); border: 1px solid var(--slate-200); border-radius: 14px; padding: 14px 18px; box-shadow: var(--shadow-sm); margin-bottom: 18px; }
.fld { display: flex; flex-direction: column; gap: 5px; }
.fld span { font-size: 11.5px; color: var(--slate-600); font-weight: 600; }
.fld select { padding: 9px 12px; border: 1px solid var(--slate-300); border-radius: 10px; background: var(--white); min-width: 200px; }
.strength { display: flex; flex-direction: column; gap: 6px; min-width: 260px; }
.strength span { font-size: 11.5px; color: var(--slate-600); font-weight: 600; }
.strength input[type=range] { width: 100%; accent-color: var(--indigo-600); }
.strength b { font-size: 12.5px; color: var(--indigo-700); }
.apply-tmpl { margin-left: auto; }
#apply-tmpl { margin-left: auto; }

.policy-layout { display: grid; grid-template-columns: 230px 1fr 320px; gap: 16px; align-items: start; }
.policy-cards { display: flex; flex-direction: column; gap: 8px; }
.pcard { display: flex; align-items: center; gap: 11px; padding: 13px 14px; border-radius: 13px; border: 1px solid var(--slate-200); background: var(--white); text-align: left; transition: border-color .15s, box-shadow .15s; }
.pcard span { width: 28px; height: 28px; border-radius: 8px; background: var(--slate-100); display: grid; place-items: center; font-weight: 800; color: var(--slate-500); flex: none; }
.pcard strong { display: block; font-size: 13px; }
.pcard small { font-size: 11px; color: var(--slate-500); }
.pcard:hover { border-color: var(--indigo-300, #c7c4f5); }
.pcard.active { border-color: var(--indigo-500); box-shadow: 0 0 0 3px var(--indigo-50); }
.pcard.active span { background: var(--indigo-600); color: #fff; }

.policy-body { min-height: 400px; }
.pbody-head { margin-bottom: 6px; }
.pbody-head h3 { font-size: 17px; font-weight: 750; }
.pbody-head p { font-size: 12.5px; color: var(--slate-600); margin-top: 4px; }
.pol-item { border: 1px solid var(--slate-200); border-radius: 14px; padding: 15px 16px; margin-top: 14px; }
.pol-item.on { border-color: var(--indigo-200, #d6d4f7); background: var(--indigo-50); }
.pol-item-top { display: flex; align-items: flex-start; gap: 12px; }
.pol-item-top .txt { flex: 1; }
.pol-item-top h4 { font-size: 14px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.risk-pill { font-size: 10.5px; font-weight: 700; padding: 2px 8px; border-radius: 999px; }
.risk-pill.high { background: var(--red-100); color: var(--red-600); }
.risk-pill.mid { background: var(--amber-100); color: var(--amber-600); }
.risk-pill.low { background: var(--emerald-100); color: var(--emerald-600); }
.pol-plain { font-size: 12.5px; color: var(--slate-600); margin-top: 5px; }
.pol-expand { margin-top: 10px; }
.pol-expand summary { font-size: 12px; color: var(--indigo-600); font-weight: 600; cursor: pointer; list-style: none; display: inline-flex; align-items: center; gap: 5px; }
.pol-expand summary::-webkit-details-marker { display: none; }
.pol-expand summary::before { content: "＋"; font-weight: 700; }
.pol-expand[open] summary::before { content: "－"; }
.pol-expand .exp-body { margin-top: 8px; padding: 10px 12px; background: var(--white); border: 1px dashed var(--slate-300); border-radius: 10px; font-size: 12px; color: var(--slate-600); }
.pol-expand .exp-body b { color: var(--slate-800); }
.pol-expand .exp-body .ctrl { display: block; margin-top: 6px; color: var(--indigo-700); }

/* strength segmented control per info-class */
.class-row { display: grid; grid-template-columns: 1.3fr 2fr; gap: 12px; align-items: center; border: 1px solid var(--slate-200); border-radius: 12px; padding: 11px 14px; margin-top: 10px; }
.class-info strong { font-size: 13px; }
.class-info small { display: block; font-size: 11px; color: var(--slate-500); }
.seg { display: inline-flex; background: var(--slate-100); border-radius: 10px; padding: 3px; width: 100%; }
.seg button { flex: 1; padding: 7px 8px; border-radius: 8px; font-size: 11.5px; font-weight: 650; color: var(--slate-600); }
.seg button.active[data-lv="pass"] { background: var(--white); color: var(--slate-700); box-shadow: var(--shadow-sm); }
.seg button.active[data-lv="warn"] { background: var(--amber-500); color: #fff; }
.seg button.active[data-lv="mask"] { background: var(--indigo-600); color: #fff; }
.seg button.active[data-lv="block"] { background: var(--red-500); color: #fff; }

.policy-preview { position: sticky; top: 92px; }
.preview-sample { margin-bottom: 14px; }
.preview-label { display: block; font-size: 11px; color: var(--slate-500); font-weight: 600; margin-bottom: 5px; }
.preview-text { font-size: 13px; background: var(--slate-50); border: 1px solid var(--slate-200); border-radius: 10px; padding: 11px 13px; line-height: 1.7; }
.preview-text mark { background: #fef08a; padding: 1px 3px; border-radius: 3px; }
.preview-result { padding: 13px 14px; border-radius: 12px; margin-bottom: 16px; border: 1px solid; }
.preview-result h4 { font-size: 13px; display: flex; align-items: center; gap: 7px; }
.preview-result p { font-size: 12px; margin-top: 6px; }
.preview-result.pass { background: var(--slate-50); border-color: var(--slate-200); color: var(--slate-700); }
.preview-result.warn { background: var(--amber-100); border-color: #fcd34d; color: var(--amber-600); }
.preview-result.mask { background: var(--indigo-50); border-color: var(--indigo-100); color: var(--indigo-700); }
.preview-result.block { background: var(--red-100); border-color: #fbcaca; color: var(--red-600); }
.preview-result .masked { font-family: ui-monospace, monospace; background: rgba(0,0,0,.05); padding: 6px 9px; border-radius: 7px; margin-top: 7px; font-size: 12px; color: var(--slate-800); }
.preview-file { border: 1px solid var(--slate-200); border-radius: 10px; padding: 12px; font-size: 12px; background: var(--white); }
.preview-file .pf-line { display: flex; justify-content: space-between; padding: 3px 0; border-bottom: 1px dashed var(--slate-100); }
.preview-file .pf-line b.blk { background: var(--sumi); color: transparent; border-radius: 3px; user-select: none; }

/* ===================== CHAT ===================== */
.chat-shell { display: grid; grid-template-columns: 1fr 300px; gap: 16px; align-items: stretch; }
.chat-main { display: flex; flex-direction: column; padding: 0; overflow: hidden; height: calc(100vh - 210px); min-height: 520px; }
.chat-topbar { display: flex; align-items: center; gap: 14px; padding: 14px 18px; border-bottom: 1px solid var(--slate-200); }
.chat-model { display: flex; align-items: center; gap: 10px; flex: 1; }
.chat-model label { font-size: 11.5px; color: var(--slate-500); font-weight: 600; }
.chat-model select { flex: 1; max-width: 420px; padding: 8px 11px; border: 1px solid var(--slate-300); border-radius: 9px; background: var(--white); font-size: 12.5px; }
.guard-pill { display: inline-flex; align-items: center; gap: 7px; font-size: 12px; font-weight: 650; color: var(--emerald-600); background: var(--emerald-100); padding: 6px 12px; border-radius: 999px; }
.live-badge { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 650; color: #1d4ed8; background: #dbeafe; padding: 6px 12px; border-radius: 999px; white-space: nowrap; }
.live-badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: #2563eb; box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.2); }
#send-btn:disabled { opacity: 0.55; cursor: not-allowed; }

.chat-log { flex: 1; overflow-y: auto; padding: 20px; display: flex; flex-direction: column; gap: 16px; background: var(--slate-50); }
.msg { display: flex; gap: 11px; max-width: 82%; }
.msg.user { align-self: flex-end; flex-direction: row-reverse; }
.msg-av { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; font-size: 11px; font-weight: 700; color: #fff; flex: none; }
.msg-av.ai { background: linear-gradient(150deg, var(--indigo-600), var(--violet-500)); }
.msg-av.me { background: var(--slate-600); }
.bubble { background: var(--white); border: 1px solid var(--slate-200); border-radius: 14px; padding: 12px 15px; font-size: 13.5px; line-height: 1.65; box-shadow: var(--shadow-sm); }
.msg.user .bubble { background: var(--indigo-600); color: #fff; border-color: var(--indigo-600); }
.bubble .masked-inline { background: var(--sumi); color: #fff; padding: 0 6px; border-radius: 4px; font-size: 12px; letter-spacing: 1px; }
.msg.user .bubble .masked-inline { background: rgba(0,0,0,.35); }
.bubble .meta { display: block; margin-top: 7px; font-size: 10.5px; opacity: .75; }
.bubble.typing { display: flex; gap: 4px; }
.bubble.typing span { width: 7px; height: 7px; border-radius: 50%; background: var(--slate-400); animation: blink 1.2s infinite; }
.bubble.typing span:nth-child(2){ animation-delay: .2s; } .bubble.typing span:nth-child(3){ animation-delay: .4s; }
@keyframes blink { 0%,60%,100%{ opacity:.3; } 30%{ opacity:1; } }

.chat-inputbar { border-top: 1px solid var(--slate-200); padding: 14px 18px; background: var(--white); }
.preset-row { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; }
.preset-row > span { font-size: 11.5px; color: var(--slate-500); }
.preset { font-size: 12px; padding: 5px 11px; border-radius: 999px; border: 1px solid var(--slate-300); color: var(--slate-700); font-weight: 550; }
.preset:hover { border-color: var(--indigo-500); color: var(--indigo-700); }
.input-wrap { position: relative; }
.highlighter, #chat-input {
  width: 100%; min-height: 66px; padding: 12px 14px; font-size: 13.5px; line-height: 1.6;
  border-radius: 12px; border: 1px solid var(--slate-300); font-family: inherit;
  white-space: pre-wrap; word-break: break-word;
}
.highlighter { position: absolute; inset: 0; pointer-events: none; color: transparent; overflow: hidden; border-color: transparent; }
.highlighter mark { background: #fecaca; color: transparent; border-radius: 3px; box-shadow: 0 0 0 1px #f87171 inset; }
#chat-input { position: relative; background: transparent; resize: vertical; }
#chat-input:focus { border-color: var(--indigo-500); outline: none; box-shadow: 0 0 0 3px var(--indigo-50); }
.input-actions { display: flex; align-items: center; gap: 12px; margin-top: 10px; }
.detect-hint { flex: 1; font-size: 12px; font-weight: 600; }
.detect-hint.warn { color: var(--red-600); }
.detect-hint.scanning { color: var(--slate-500); font-weight: 550; }
.detect-hint.clean { color: var(--emerald-600); }
.mask-fallback-note { font-size: 12px; color: var(--amber-700, #b45309); margin: 0 0 10px; }

.chat-aside { align-self: start; }
.guard-steps { list-style: none; padding: 0; margin: 0 0 14px; display: flex; flex-direction: column; gap: 12px; }
.guard-steps li { display: flex; gap: 11px; }
.guard-steps span { width: 26px; height: 26px; border-radius: 8px; background: var(--indigo-100); color: var(--indigo-700); display: grid; place-items: center; font-weight: 700; font-size: 12px; flex: none; }
.guard-steps strong { display: block; font-size: 12.5px; }
.guard-steps small { font-size: 11.5px; color: var(--slate-500); }
.aside-note { display: flex; gap: 9px; padding: 11px 13px; background: var(--slate-50); border: 1px solid var(--slate-200); border-radius: 11px; }
.aside-note .icon { color: var(--slate-500); flex: none; margin-top: 1px; width: 17px; height: 17px; }
.aside-note p { font-size: 11.5px; color: var(--slate-600); }
.aside-note strong { color: var(--slate-800); }

/* ===================== REDACTION ===================== */
.redact-toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.redact-toolbar > span { font-size: 12px; color: var(--slate-500); }
.file-chip { display: inline-flex; align-items: center; gap: 7px; padding: 8px 13px; border-radius: 10px; border: 1px solid var(--slate-300); background: var(--white); font-size: 12.5px; font-weight: 600; color: var(--slate-700); }
.file-chip .icon { width: 16px; height: 16px; color: var(--slate-500); }
.file-chip.active { border-color: var(--indigo-500); background: var(--indigo-50); color: var(--indigo-700); }
.file-chip.active .icon { color: var(--indigo-600); }

.redact-layout { display: grid; grid-template-columns: 1fr 340px; gap: 16px; align-items: start; }
.redact-doc { padding: 0; overflow: hidden; }
.doc-tabbar { display: flex; border-bottom: 1px solid var(--slate-200); }
.doc-tab { padding: 12px 18px; font-size: 12.5px; font-weight: 650; color: var(--slate-500); border-bottom: 2px solid transparent; }
.doc-tab.active { color: var(--indigo-700); border-bottom-color: var(--indigo-600); }
.doc-stage { padding: 24px; background: var(--slate-100); min-height: 460px; display: grid; place-items: start center; }

/* fake document */
.paper { width: 100%; max-width: 480px; background: #fff; border-radius: 6px; box-shadow: var(--shadow-md); padding: 30px 34px; font-size: 12.5px; color: #333; }
.paper h5 { font-size: 17px; font-weight: 800; text-align: center; letter-spacing: 3px; margin-bottom: 4px; color: #1a1a1a; }
.paper .doc-sub { text-align: center; color: #888; font-size: 11px; margin-bottom: 20px; }
.paper .rows { display: flex; flex-direction: column; gap: 9px; }
.paper .prow { display: flex; justify-content: space-between; border-bottom: 1px solid #eee; padding-bottom: 7px; }
.paper .prow .lbl { color: #888; }
.paper .prow .val { font-weight: 600; }
.paper .total { display: flex; justify-content: space-between; margin-top: 14px; padding-top: 12px; border-top: 2px solid #333; font-size: 15px; font-weight: 800; }
.paper .stamp { margin-top: 20px; text-align: right; color: #b91c1c; font-size: 11px; font-weight: 700; letter-spacing: 1px; }
/* redactable spans */
.rd { border-radius: 3px; transition: background .18s, color .18s; padding: 0 3px; }
.rd.on { background: var(--sumi); color: transparent !important; box-shadow: 0 0 0 1px var(--sumi); user-select: none; }
.rd.off { background: #fef08a; box-shadow: inset 0 0 0 1px #facc15; }

/* namecard image mock */
.namecard { width: 100%; max-width: 440px; aspect-ratio: 1.7/1; background: linear-gradient(135deg,#fff,#f3f4f8); border-radius: 12px; box-shadow: var(--shadow-md); padding: 26px 30px; position: relative; border: 1px solid var(--slate-200); }
.namecard .nc-co { font-size: 12px; color: var(--indigo-600); font-weight: 700; letter-spacing: 1px; }
.namecard .nc-name { font-size: 24px; font-weight: 800; margin: 10px 0 3px; color: #1a1a1a; }
.namecard .nc-title { font-size: 11.5px; color: #888; margin-bottom: 18px; }
.namecard .nc-line { font-size: 12px; color: #444; margin-top: 4px; display: flex; gap: 8px; }
.namecard .nc-line .k { color: #aaa; width: 44px; }
.namecard .nc-face { position: absolute; top: 24px; right: 30px; width: 62px; height: 62px; border-radius: 50%; background: radial-gradient(circle at 40% 35%, #cdd3e0, #9aa2b5); }

.detect-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.detect-item { display: flex; align-items: center; gap: 11px; padding: 10px 12px; border: 1px solid var(--slate-200); border-radius: 11px; }
.detect-item .di-type { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; font-size: 11px; font-weight: 800; color: #fff; flex: none; }
.di-type.person { background: #8b5cf6; } .di-type.money { background: #f59e0b; } .di-type.company { background: #6366f1; }
.di-type.contact { background: #38bdf8; } .di-type.id { background: #ef4444; } .di-type.other { background: var(--slate-400); }
.detect-item .di-txt { flex: 1; min-width: 0; }
.detect-item .di-txt strong { display: block; font-size: 12.5px; }
.detect-item .di-txt small { font-size: 11px; color: var(--slate-500); }
.di-toggle { font-size: 11.5px; font-weight: 650; padding: 5px 11px; border-radius: 8px; border: 1px solid var(--slate-300); color: var(--slate-600); white-space: nowrap; }
.di-toggle.on { background: var(--sumi); color: #fff; border-color: var(--sumi); }
.redact-actions { display: flex; flex-direction: column; gap: 8px; }
.redact-actions .muted { color: var(--slate-500); font-size: 11px; text-align: center; }

/* ===================== GUIDELINE (JDLA) ===================== */
.gl-meta { display: flex; flex-wrap: wrap; gap: 14px 18px; margin-bottom: 18px; align-items: flex-end; }
.gl-meta .fld { flex: 0 0 auto; min-width: 160px; }
.gl-meta .fld.grow { flex: 1; min-width: 260px; }
.gl-meta .fld input { padding: 9px 12px; border: 1px solid var(--slate-300); border-radius: 10px; background: var(--white); width: 100%; }
.gl-meta .fld input:focus { border-color: var(--indigo-500); outline: none; box-shadow: 0 0 0 3px var(--indigo-50); }

.gl-layout { display: grid; grid-template-columns: 1fr 380px; gap: 16px; align-items: start; }
.gl-builder { display: flex; flex-direction: column; gap: 14px; }
.gl-block { background: var(--white); border: 1px solid var(--slate-200); border-radius: var(--r-lg); box-shadow: var(--shadow-sm); padding: 16px 18px; }
.gl-block-head { margin-bottom: 10px; }
.gl-block-head h4 { font-size: 14.5px; font-weight: 750; }
.gl-block-head small { font-size: 11.5px; color: var(--slate-500); }
.gl-item { display: flex; align-items: center; gap: 12px; padding: 11px 12px; border: 1px solid var(--slate-200); border-radius: 12px; margin-top: 9px; cursor: pointer; transition: border-color .15s, background .15s; }
.gl-item:hover { border-color: var(--slate-300); }
.gl-item.on { border-color: var(--indigo-200, #d6d4f7); background: var(--indigo-50); }
.gl-check { position: relative; flex: none; }
.gl-check input { position: absolute; opacity: 0; width: 22px; height: 22px; margin: 0; cursor: pointer; }
.gl-check .box { width: 22px; height: 22px; border-radius: 7px; border: 2px solid var(--slate-300); background: var(--white); display: grid; place-items: center; transition: background .15s, border-color .15s; }
.gl-check .box .icon { width: 15px; height: 15px; color: #fff; opacity: 0; stroke-width: 2.6; }
.gl-check input:checked + .box { background: var(--indigo-600); border-color: var(--indigo-600); }
.gl-check input:checked + .box .icon { opacity: 1; }
.gl-item-txt { flex: 1; min-width: 0; }
.gl-item-txt strong { display: block; font-size: 13px; font-weight: 600; }
.gl-item-txt small { font-size: 11px; color: var(--slate-500); }
.gl-seg { display: inline-flex; background: var(--slate-100); border-radius: 9px; padding: 3px; flex: none; }
.gl-seg button { padding: 6px 10px; border-radius: 7px; font-size: 11.5px; font-weight: 650; color: var(--slate-600); white-space: nowrap; }
.gl-seg button.active[data-lv="allow"] { background: var(--white); color: var(--emerald-600); box-shadow: var(--shadow-sm); }
.gl-seg button.active[data-lv="conditional"] { background: var(--amber-500); color: #fff; }
.gl-seg button.active[data-lv="prohibited"] { background: var(--red-500); color: #fff; }

.gl-preview { position: sticky; top: 92px; display: flex; flex-direction: column; }
.gl-doc { border: 1px solid var(--slate-200); border-radius: 12px; background: var(--slate-50); padding: 20px 22px; max-height: 60vh; overflow-y: auto; font-size: 12px; line-height: 1.7; color: var(--slate-800); }
.gl-doc h2.gd-title { font-size: 15px; font-weight: 800; text-align: center; color: var(--slate-900); margin-bottom: 4px; }
.gl-doc .gd-meta { text-align: center; font-size: 10.5px; color: var(--slate-500); margin-bottom: 14px; padding-bottom: 12px; border-bottom: 1px solid var(--slate-200); }
.gl-doc h3.gd-art { font-size: 12.5px; font-weight: 750; margin: 14px 0 6px; color: var(--indigo-700); }
.gl-doc p.gd-lead { font-size: 11.5px; color: var(--slate-600); margin-bottom: 6px; }
.gl-doc ul.gd-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 5px; }
.gl-doc ul.gd-list li { position: relative; padding-left: 15px; font-size: 11.5px; }
.gl-doc ul.gd-list li::before { content: "・"; position: absolute; left: 0; color: var(--indigo-500); }
.gl-doc .gd-input-row { display: flex; align-items: baseline; gap: 8px; }
.gl-doc .gd-lv { font-size: 10px; font-weight: 700; padding: 1px 7px; border-radius: 999px; flex: none; }
.gl-doc .gd-lv.allow { background: var(--emerald-100); color: var(--emerald-600); }
.gl-doc .gd-lv.conditional { background: var(--amber-100); color: var(--amber-600); }
.gl-doc .gd-lv.prohibited { background: var(--red-100); color: var(--red-600); }
.gl-doc .gd-fussoku { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--slate-200); font-size: 10.5px; color: var(--slate-500); }
.gl-doc .gd-empty { color: var(--slate-400); font-size: 11px; font-style: italic; }
.gl-actions { display: flex; gap: 10px; margin-top: 14px; }
.gl-actions .btn { flex: 1; justify-content: center; }
.gl-attr { display: flex; gap: 8px; margin-top: 12px; font-size: 10.5px; color: var(--slate-500); }
.gl-attr .icon { flex: none; width: 15px; height: 15px; color: var(--slate-400); }
.gl-head-right { display: flex; align-items: center; gap: 8px; }
.gl-expand-btn { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 650; color: var(--indigo-700); background: var(--indigo-50); border: 1px solid var(--indigo-100); padding: 5px 10px; border-radius: 8px; }
.gl-expand-btn:hover { background: var(--indigo-100); }
.gl-expand-btn .icon { width: 14px; height: 14px; }

.gl-expand-overlay { position: fixed; inset: 0; background: rgba(20,18,31,.55); backdrop-filter: blur(3px); display: grid; place-items: center; z-index: 120; padding: 24px; animation: fade .2s; }
.gl-expand-overlay[hidden] { display: none; }
.gl-expand-panel { width: 100%; max-width: 820px; max-height: 88vh; background: var(--white); border-radius: 20px; box-shadow: var(--shadow-lg); display: flex; flex-direction: column; overflow: hidden; }
.gl-expand-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 22px; border-bottom: 1px solid var(--slate-200); flex-wrap: wrap; }
.gl-expand-head h3 { font-size: 16px; font-weight: 750; margin-top: 2px; }
.gl-expand-actions { display: flex; align-items: center; gap: 8px; }
.gl-expand-x { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; color: var(--slate-500); }
.gl-expand-x:hover { background: var(--slate-100); color: var(--slate-800); }
.gl-doc-lg { max-height: none; flex: 1; overflow-y: auto; margin: 0; border: 0; border-radius: 0; background: var(--white); padding: 26px 34px; font-size: 13.5px; }
.gl-doc-lg h2.gd-title { font-size: 19px; }
.gl-doc-lg .gd-meta { font-size: 12px; }
.gl-doc-lg h3.gd-art { font-size: 14.5px; }
.gl-doc-lg p.gd-lead, .gl-doc-lg ul.gd-list li { font-size: 13px; }
.gl-doc-lg .gd-lv { font-size: 11px; }

/* ===================== MODAL ===================== */
.modal-overlay { position: fixed; inset: 0; background: rgba(20,18,31,.5); backdrop-filter: blur(3px); display: grid; place-items: center; z-index: 100; padding: 20px; animation: fade .2s; }
.modal-overlay[hidden] { display: none; }
.modal { width: 100%; max-width: 500px; background: var(--white); border-radius: 20px; box-shadow: var(--shadow-lg); overflow: hidden; }
.modal-head { display: flex; align-items: center; gap: 12px; padding: 20px 24px; background: linear-gradient(100deg,#fff5f5,#fee2e2); border-bottom: 1px solid #fbcaca; }
.modal-head .icon { width: 24px; height: 24px; color: var(--red-600); }
.modal-head h3 { font-size: 16.5px; color: var(--red-600); }
.modal-head.mask-head { background: var(--indigo-50); border-color: var(--indigo-100); }
.modal-head.mask-head .icon, .modal-head.mask-head h3 { color: var(--indigo-700); }
.modal-body { padding: 22px 24px; }
.modal-body p { font-size: 13px; color: var(--slate-700); }
.detected-chips { display: flex; flex-wrap: wrap; gap: 7px; margin: 14px 0; }
.detected-chips .dc { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; padding: 5px 11px; border-radius: 999px; background: var(--red-100); color: var(--red-600); }
.mask-diff { border: 1px solid var(--slate-200); border-radius: 12px; overflow: hidden; margin-top: 8px; }
.mask-diff .md-row { padding: 11px 14px; font-size: 12.5px; }
.mask-diff .md-before { background: #fff5f5; border-bottom: 1px solid var(--slate-200); }
.mask-diff .md-after { background: var(--indigo-50); }
.mask-diff small { display: block; font-size: 10.5px; font-weight: 700; letter-spacing: .5px; margin-bottom: 4px; }
.mask-diff .md-before small { color: var(--red-600); } .mask-diff .md-after small { color: var(--indigo-700); }
.mask-diff .maskv { background: var(--sumi); color: #fff; padding: 0 5px; border-radius: 3px; letter-spacing: 1px; }
.modal-actions { display: flex; gap: 10px; padding: 0 24px 22px; flex-wrap: wrap; }
.modal-actions .btn { flex: 1; justify-content: center; min-width: 130px; }

/* ===================== TOAST ===================== */
.toast { position: fixed; bottom: 26px; left: 50%; transform: translate(-50%, 120%); background: var(--ink-900); color: #fff; padding: 12px 20px; border-radius: 12px; display: flex; align-items: center; gap: 10px; box-shadow: var(--shadow-lg); z-index: 200; transition: transform .3s cubic-bezier(.2,.8,.2,1); font-size: 13px; }
.toast.show { transform: translate(-50%, 0); }
.toast span { width: 24px; height: 24px; border-radius: 7px; background: var(--emerald-500); display: grid; place-items: center; }
.toast .icon { width: 15px; height: 15px; }

.mobile-overlay { display: none; }

/* ===================== RESPONSIVE ===================== */
@media (max-width: 1180px) {
  .kpi-grid { grid-template-columns: repeat(3, 1fr); }
  .dash-grid { grid-template-columns: 1fr; }
  .policy-layout { grid-template-columns: 200px 1fr; }
  .policy-preview { grid-column: 1 / -1; position: static; }
  .ai-grid { grid-template-columns: 1fr; }
  .gl-layout { grid-template-columns: 1fr; }
  .gl-preview { position: static; }
}
@media (max-width: 900px) {
  .sidebar { position: fixed; left: 0; top: 0; z-index: 60; transform: translateX(-100%); transition: transform .25s; }
  .sidebar.open { transform: none; }
  .mobile-menu { display: inline-flex; }
  .mobile-overlay.show { display: block; position: fixed; inset: 0; background: rgba(20,18,31,.4); z-index: 55; }
  .chat-shell { grid-template-columns: 1fr; }
  .chat-aside { display: none; }
  .redact-layout { grid-template-columns: 1fr; }
  .policy-layout { grid-template-columns: 1fr; }
  .policy-cards { flex-direction: row; overflow-x: auto; }
  .pcard { min-width: 180px; }
}
@media (max-width: 720px) {
  .view { padding: 16px 16px 40px; }
  .topbar { padding: 14px 16px; }
  .demo-notice { margin: 14px 16px 0; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .intro { flex-direction: column; align-items: flex-start; }
  .purpose-wrap { flex-direction: column; }
  .legend { grid-template-columns: 1fr 1fr; }
}
