:root {
  --bg: #faf9f5;
  --bg-side: #f3f1ea;
  --bg-card: #ffffff;
  --bg-hover: #ece9e0;
  --bg-active: #e6e2d6;
  --text: #1f1e1d;
  --muted: #706d66;
  --border: #e4e0d4;
  --border-strong: #d3cebf;
  --accent: #d97757;
  --accent-ink: #ffffff;
  --accent-soft: #f6e4dc;
  --ok: #3a8a4f;
  --warn: #c58a1d;
  --down: #c24135;
  --shadow: 0 8px 28px rgba(31, 30, 29, 0.16), 0 1px 3px rgba(31, 30, 29, 0.1);
  --radius: 12px;
  --radius-sm: 8px;
  --left: 260px;
  --right: 340px;
  --font: "Pretendard", "Pretendard Variable", system-ui, -apple-system, "Segoe UI", "Noto Sans KR", "Malgun Gothic", "Apple SD Gothic Neo", sans-serif;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, "D2Coding", monospace;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #262624;
  --bg-side: #1f1e1d;
  --bg-card: #30302e;
  --bg-hover: #3a3936;
  --bg-active: #45433f;
  --text: #f1efe8;
  --muted: #a6a29a;
  --border: #3d3c39;
  --border-strong: #55534e;
  --accent-soft: #4a3329;
  --shadow: 0 8px 28px rgba(0, 0, 0, 0.5), 0 1px 3px rgba(0, 0, 0, 0.4);
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]):not([data-theme="dark"]) {
    --bg: #262624;
    --bg-side: #1f1e1d;
    --bg-card: #30302e;
    --bg-hover: #3a3936;
    --bg-active: #45433f;
    --text: #f1efe8;
    --muted: #a6a29a;
    --border: #3d3c39;
    --border-strong: #55534e;
    --accent-soft: #4a3329;
    --shadow: 0 8px 28px rgba(0, 0, 0, 0.5), 0 1px 3px rgba(0, 0, 0, 0.4);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { background: var(--bg); color: var(--text); font: 14px/1.5 var(--font); -webkit-font-smoothing: antialiased; overflow: hidden; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
h2 { font-size: 20px; margin: 0; letter-spacing: -0.01em; }
h4 { margin: 0 0 8px; font-size: 12px; font-weight: 600; color: var(--muted); text-transform: none; letter-spacing: 0.02em; }
code, pre, .mono { font-family: var(--mono); font-size: 12px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.hidden { display: none !important; }
.invisible { visibility: hidden; }
.spacer { flex: 1; }
.grow { flex: 1; min-width: 0; }
.pad { padding: 8px 10px; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.row { display: flex; align-items: center; gap: 8px; min-width: 0; }
.row.gap { gap: 8px; }
.ico { flex: none; vertical-align: middle; }
.boot { height: 100vh; display: grid; place-items: center; }

/* ---------- layout ---------- */
.app { display: grid; grid-template-columns: var(--left) minmax(0, 1fr) var(--right); height: 100vh; transition: grid-template-columns 0.18s ease; }
.app.left-closed { grid-template-columns: 0 minmax(0, 1fr) var(--right); }
.app.right-closed { grid-template-columns: var(--left) minmax(0, 1fr) 0; }
.app.left-closed.right-closed { grid-template-columns: 0 minmax(0, 1fr) 0; }
.app.no-select { user-select: none; }
.left, .right { overflow: hidden; display: flex; flex-direction: column; background: var(--bg-side); min-width: 0; }
.left { border-right: 1px solid var(--border); }
.right { border-left: 1px solid var(--border); }
.app.left-closed .left, .app.right-closed .right { visibility: hidden; border: 0; }
.center { display: flex; flex-direction: column; min-width: 0; min-height: 0; position: relative; background: var(--bg); }

/* ---------- buttons & inputs ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 7px 12px; border-radius: var(--radius-sm); border: 1px solid var(--border-strong); background: var(--bg-card); font-weight: 500; white-space: nowrap; }
.btn:hover:not(:disabled) { background: var(--bg-hover); }
.btn.small { padding: 4px 9px; font-size: 12px; }
.btn.big { padding: 12px 22px; font-size: 15px; border-radius: 10px; }
.btn.wide { width: 100%; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover:not(:disabled) { background: #c8643f; }
.btn.ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn.danger { background: var(--down); border-color: var(--down); color: #fff; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.icon-btn { display: inline-grid; place-items: center; width: 28px; height: 28px; border: 0; background: transparent; border-radius: 7px; color: var(--muted); padding: 0; }
.icon-btn:hover { background: var(--bg-hover); color: var(--text); }
.icon-btn.tiny { width: 22px; height: 22px; }
.linkish { display: flex; align-items: center; gap: 8px; border: 0; background: transparent; padding: 3px 4px; border-radius: 6px; text-align: left; min-width: 0; max-width: 100%; }
.linkish:hover { background: var(--bg-hover); }
input:not([type="checkbox"]):not([type="color"]), select, textarea {
  width: 100%; padding: 7px 10px; border-radius: var(--radius-sm); border: 1px solid var(--border-strong); background: var(--bg-card); outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
input:disabled { opacity: 0.6; }
input[type="color"] { width: 44px; height: 34px; padding: 2px; border-radius: var(--radius-sm); border: 1px solid var(--border-strong); background: var(--bg-card); }
textarea { resize: vertical; }
textarea.code { font-family: var(--mono); font-size: 12px; line-height: 1.5; min-height: 280px; white-space: pre; tab-size: 2; }
.field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 10px; }
.field .label, .label { font-size: 12px; color: var(--muted); font-weight: 500; }
.label.sect { margin: 8px 0 6px; font-weight: 600; }
.field input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--accent); }
.pill { display: inline-flex; align-items: center; gap: 5px; padding: 1px 9px; border-radius: 999px; font-size: 12px; font-weight: 500; background: var(--bg-hover); color: var(--text); white-space: nowrap; border: 0; }
.pill.ok { background: color-mix(in srgb, var(--ok) 16%, transparent); color: var(--ok); }
.pill.warn { background: color-mix(in srgb, var(--warn) 18%, transparent); color: var(--warn); }
.pill.down { background: color-mix(in srgb, var(--down) 16%, transparent); color: var(--down); }
.pill.unknown, .pill.neutral { background: var(--bg-hover); color: var(--muted); }
.pill.clickable { cursor: pointer; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--muted); flex: none; }
.dot.ok { background: var(--ok); }
.dot.warn { background: var(--warn); }
.dot.down { background: var(--down); }
.tag { display: inline-block; padding: 0 6px; border-radius: 5px; background: var(--bg-hover); color: var(--muted); font-size: 11px; margin-right: 6px; }
.badge { margin-left: auto; background: var(--accent); color: #fff; border-radius: 999px; font-size: 11px; padding: 0 7px; line-height: 18px; }
.alert { padding: 8px 12px; border-radius: var(--radius-sm); font-size: 13px; margin: 8px 0; display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.alert.down { background: color-mix(in srgb, var(--down) 12%, var(--bg-card)); border: 1px solid color-mix(in srgb, var(--down) 40%, transparent); }
.alert.warn { background: color-mix(in srgb, var(--warn) 14%, var(--bg-card)); border: 1px solid color-mix(in srgb, var(--warn) 40%, transparent); }
.alert .strong { font-weight: 600; }
.alert[hidden] { display: none; }
.card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; }

/* ---------- left ---------- */
.left-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 10px 6px 14px; }
.brand { display: flex; align-items: center; gap: 9px; font-weight: 650; font-size: 15px; letter-spacing: -0.01em; }
.brand.big { font-size: 22px; justify-content: center; margin-bottom: 4px; }
.logo { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 8px; background: var(--accent); color: #fff; font-weight: 700; }
.search { position: relative; margin: 4px 10px 8px; color: var(--muted); }
.search .ico { position: absolute; left: 10px; top: 9px; }
.search input[type="search"] { padding-left: 30px; background: var(--bg); }
.nav-item { display: flex; align-items: center; gap: 9px; margin: 0 8px; padding: 7px 10px; border: 0; background: transparent; border-radius: var(--radius-sm); text-align: left; }
.nav-item:hover { background: var(--bg-hover); }
.nav-item.active { background: var(--bg-active); font-weight: 600; }
.section-label { font-size: 11px; color: var(--muted); padding: 12px 18px 4px; font-weight: 600; }
.modules { flex: 1; overflow-y: auto; padding: 0 8px; display: flex; flex-direction: column; min-height: 60px; }
.drop-end { flex: 1; min-height: 24px; }
.mod { position: relative; display: flex; align-items: center; gap: 2px; border-radius: var(--radius-sm); padding: 1px 4px 1px 0; user-select: none; }
.mod:hover { background: var(--bg-hover); }
.mod.active { background: var(--bg-active); }
.mod[draggable="true"] { cursor: grab; }
.mod.dragging-self { opacity: 0.4; }
.mod.hint-before::before, .mod.hint-after::after { content: ""; position: absolute; left: 4px; right: 4px; height: 2px; background: var(--accent); border-radius: 2px; }
.mod.hint-before::before { top: -1px; }
.mod.hint-after::after { bottom: -1px; }
.chev { width: 20px; height: 28px; border: 0; background: transparent; color: var(--muted); padding: 0; display: grid; place-items: center; }
.mod-main { flex: 1; display: flex; align-items: center; gap: 8px; padding: 5px 4px; min-width: 0; cursor: pointer; }
.mod-name { flex: 1; }
.mod-ready { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; color: var(--muted); white-space: nowrap; }
.mod-edit { opacity: 0; }
.mod:hover .mod-edit { opacity: 1; }
@media (hover: none) { .mod-edit { opacity: 1; } }
.mod-views { margin: 0 0 4px 30px; display: flex; flex-direction: column; }
.view-item { display: flex; align-items: center; gap: 8px; padding: 4px 8px; border: 0; border-radius: 6px; background: transparent; color: var(--muted); text-align: left; font-size: 13px; }
.view-item:hover { background: var(--bg-hover); color: var(--text); }
.view-item.active { background: var(--bg-active); color: var(--text); }
.modicon { display: inline-grid; place-items: center; flex: none; border-radius: 8px; color: var(--mc); background: color-mix(in srgb, var(--mc) 16%, transparent); }
.trash { display: flex; align-items: center; justify-content: center; gap: 8px; margin: 6px 10px; padding: 8px; border: 1px dashed var(--border-strong); border-radius: var(--radius-sm); color: var(--muted); font-size: 12px; transition: all 0.12s; }
.trash.armed { border-color: var(--down); color: var(--down); }
.trash.over { background: color-mix(in srgb, var(--down) 14%, transparent); border-style: solid; }
.left-foot { padding: 8px 10px 12px; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 8px; position: relative; }
.user { position: relative; }
.user-btn { width: 100%; display: flex; align-items: center; gap: 8px; border: 0; background: transparent; padding: 6px 8px; border-radius: var(--radius-sm); text-align: left; }
.user-btn:hover { background: var(--bg-hover); }
.user-btn .ellipsis { flex: 1; }
.menu { position: absolute; bottom: 44px; left: 0; right: 0; background: var(--bg-card); border: 1px solid var(--border-strong); border-radius: var(--radius); box-shadow: var(--shadow); padding: 8px; z-index: 50; }
.menu-label { font-size: 11px; color: var(--muted); padding: 2px 4px 6px; }
.seg { display: flex; gap: 4px; margin-bottom: 6px; }
.seg button { flex: 1; display: flex; align-items: center; justify-content: center; gap: 4px; padding: 5px 4px; border: 1px solid var(--border); background: transparent; border-radius: 7px; font-size: 12px; }
.seg button.on { background: var(--accent-soft); border-color: var(--accent); }
.menu-item { width: 100%; display: flex; align-items: center; gap: 8px; border: 0; background: transparent; padding: 7px 8px; border-radius: 7px; text-align: left; }
.menu-item:hover { background: var(--bg-hover); }

/* ---------- center ---------- */
.topbar { display: flex; align-items: center; gap: 6px; padding: 8px 10px 0; border-bottom: 1px solid var(--border); background: var(--bg); }
.topbar .icon-btn { margin-bottom: 6px; }
.tabs { flex: 1; display: flex; gap: 2px; overflow-x: auto; min-width: 0; scrollbar-width: none; }
.tab { display: flex; align-items: center; gap: 7px; padding: 7px 8px 8px 12px; border-radius: 9px 9px 0 0; color: var(--muted); cursor: pointer; white-space: nowrap; max-width: 230px; border: 1px solid transparent; border-bottom: 0; position: relative; top: 1px; }
.tab:hover { background: var(--bg-hover); color: var(--text); }
.tab.active { background: var(--bg-card); color: var(--text); border-color: var(--border); }
.tab-title { overflow: hidden; text-overflow: ellipsis; }
.tab-x { width: 18px; height: 18px; display: grid; place-items: center; border: 0; background: transparent; border-radius: 5px; color: var(--muted); padding: 0; opacity: 0.6; }
.tab-x:hover { background: var(--bg-active); opacity: 1; }
.panes { position: relative; flex: 1; min-height: 0; }
.pane { position: absolute; inset: 0; display: flex; flex-direction: column; min-height: 0; }
.pane.hidden { display: none; }
.pane-scroll { flex: 1; overflow-y: auto; padding: 22px 28px 40px; }
.pane-scroll.narrow { max-width: 860px; margin: 0 auto; width: 100%; }
.pane-head { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.summary { display: flex; gap: 6px; flex-wrap: wrap; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 14px; margin-top: 14px; }
.card-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.card-title { flex: 1; min-width: 0; cursor: pointer; }
.name { font-weight: 600; }
.card-foot { display: flex; align-items: center; gap: 8px; margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--border); flex-wrap: wrap; }
.card-foot .linkish { flex: 1; min-width: 0; }
.linkish > .muted, .run-main .muted, .pill { flex: none; white-space: nowrap; }
.linkish > .ellipsis { flex: 1; }
.widgets { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.widgets.compact { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 8px; }
.widget { background: var(--bg); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; min-width: 0; }
.widget:not(.compact) { background: var(--bg-card); padding: 14px 16px; }
.w-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.w-title { font-size: 12px; color: var(--muted); font-weight: 500; }
.widget .icon-btn { opacity: 0; }
.widget:hover .icon-btn { opacity: 1; }
.w-status { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.w-stat { display: flex; align-items: baseline; gap: 5px; }
.w-num { font-size: 26px; font-weight: 650; letter-spacing: -0.02em; }
.widget.compact .w-num { font-size: 20px; }
.w-unit { color: var(--muted); }
.chips { display: flex; flex-wrap: wrap; gap: 5px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 1px 8px; border: 1px solid var(--border); border-radius: 999px; font-size: 12px; background: var(--bg-card); }
table.units { width: 100%; border-collapse: collapse; font-size: 13px; }
table.units td { padding: 5px 6px 5px 0; border-top: 1px solid var(--border); vertical-align: middle; }
table.units tr:first-child td { border-top: 0; }
.u-name { font-weight: 500; }
dl.kv { display: grid; grid-template-columns: auto 1fr; gap: 2px 12px; margin: 0; font-size: 13px; }
dl.kv dt { color: var(--muted); }
dl.kv dd { margin: 0; overflow-wrap: anywhere; min-width: 0; }
.widget.compact dl.kv { grid-template-columns: auto minmax(0, 1fr); }
.widget.compact dl.kv dd { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.w-json summary { cursor: pointer; font-weight: 500; }
.w-json pre, pre.code-view { background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px; overflow: auto; max-height: 320px; margin: 8px 0 0; white-space: pre-wrap; word-break: break-word; }
.empty { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; text-align: center; padding: 48px 20px; color: var(--text); flex: 1; }
.empty p { margin: 2px 0; }
.empty .ico { color: var(--accent); margin-bottom: 8px; }
.open-card { display: flex; align-items: center; gap: 20px; justify-content: space-between; margin-bottom: 14px; }
.url { max-width: 520px; }
.embed { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.embed-bar { display: flex; align-items: center; gap: 10px; padding: 8px 14px; border-bottom: 1px solid var(--border); }
.embed-frame { flex: 1; width: 100%; border: 0; background: #fff; min-height: 0; }
.embed-hint { padding: 4px 14px; border-top: 1px solid var(--border); }
/* a module's readiness warning shown inside its own screens (SPEC-P4 §6), not only the sidebar chip */
.ready-note { display: flex; align-items: flex-start; gap: 8px; margin: 0 0 12px; padding: 10px 12px; border-radius: var(--radius-sm); border: 1px solid color-mix(in srgb, var(--warn) 40%, transparent); background: color-mix(in srgb, var(--warn) 12%, var(--bg-card)); font-size: 12px; color: var(--muted); }
.ready-note .dot.warn { margin-top: 4px; }
.ready-note-title { font-weight: 600; color: var(--warn); }
.ready-note-body { display: flex; flex-direction: column; gap: 2px; align-items: flex-start; }
.ready-note .btn { margin-top: 6px; }
.embed .ready-note { margin: 10px 14px 12px; }
.pane-chat > .ready-note { margin: 10px 14px 0; }
.drop-veil { display: none; position: absolute; inset: 8px; border: 2px dashed var(--accent); border-radius: var(--radius); background: color-mix(in srgb, var(--accent) 8%, transparent); align-items: center; justify-content: center; gap: 10px; color: var(--accent); font-weight: 600; pointer-events: none; z-index: 5; }
.center.drop-over .drop-veil { display: flex; }
.center.dragging iframe { pointer-events: none; }

/* ---------- right ---------- */
.right-head { display: flex; align-items: center; gap: 6px; padding: 12px 10px 8px 16px; }
.right-body { flex: 1; overflow-y: auto; padding: 0 14px 24px; }
.ctx-head { display: flex; align-items: center; gap: 10px; padding: 8px 0 12px; border-bottom: 1px solid var(--border); margin-bottom: 4px; }
.ctx-section { padding: 12px 0 6px; border-bottom: 1px solid var(--border); }
.ctx-section:last-child { border-bottom: 0; }
.agent { border: 1px solid var(--border); background: var(--bg-card); border-radius: 10px; padding: 10px; margin-bottom: 8px; display: flex; flex-direction: column; gap: 6px; }
.runs { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.run-row { display: flex; align-items: center; gap: 2px; }
.run-main { flex: 1; border: 0; background: transparent; text-align: left; padding: 5px 6px; border-radius: 7px; min-width: 0; display: block; }
.run-main:hover { background: var(--bg-hover); }
.approvals { display: flex; flex-direction: column; gap: 6px; }
.appr-row { display: flex; align-items: center; gap: 6px; border: 1px solid var(--border); background: var(--bg-card); border-radius: 10px; padding: 6px 8px; }
.appr-main { flex: 1; min-width: 0; display: flex; flex-direction: column; text-align: left; border: 0; background: transparent; padding: 0; }
.appr-kind { font-weight: 600; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.cat-card { display: flex; align-items: center; gap: 10px; padding: 10px; border: 1px solid var(--border); background: var(--bg-card); border-radius: 10px; margin-bottom: 8px; }
.cat-card[draggable="true"] { cursor: grab; }
.cat-card[draggable="true"]:hover { border-color: var(--accent); }
.cat-card.installed { opacity: 0.7; }

/* ---------- run detail ---------- */
.run-head { border: 1px solid var(--border); background: var(--bg-card); border-radius: var(--radius); padding: 12px 14px; display: flex; flex-direction: column; gap: 6px; }
.run-goal { font-weight: 600; font-size: 15px; }
.progress { height: 6px; background: var(--bg-hover); border-radius: 99px; overflow: hidden; }
.progress .bar { height: 100%; background: var(--accent); transition: width 0.25s; }
.run h4 { margin-top: 16px; }
.restate, .report { white-space: pre-wrap; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 12px; }
.steps { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 4px; }
.step { display: flex; gap: 10px; padding: 8px 10px; border-radius: var(--radius-sm); background: var(--bg-card); border: 1px solid var(--border); }
.step.active { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.step.pending { opacity: 0.7; }
.step-ico { flex: none; margin-top: 2px; display: grid; }
.step-ico.done { color: var(--ok); }
.step-ico.active { color: var(--accent); }
.step-ico.pending, .step-ico.skipped { color: var(--muted); }
.step-body { min-width: 0; flex: 1; }
.evidence { list-style: none; padding: 0; margin: 6px 0 0; display: flex; flex-direction: column; gap: 3px; font-size: 12.5px; color: var(--muted); }
.evidence code { margin-right: 6px; color: var(--text); background: var(--bg); padding: 0 4px; border-radius: 4px; }
.decisions { margin-top: 14px; }
.decisions summary { cursor: pointer; color: var(--muted); font-size: 12px; }
.decisions ul { list-style: none; padding: 0; margin: 8px 0 0; display: flex; flex-direction: column; gap: 3px; font-size: 12.5px; }
.spin .ico { animation: spin 1.1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- popups ---------- */
.popup-layer { position: fixed; inset: 0; pointer-events: none; z-index: 1000; }
.popup { position: fixed; pointer-events: auto; width: 440px; max-width: calc(100vw - 20px); max-height: min(78vh, 760px); background: var(--bg-card); border: 1px solid var(--border-strong); border-radius: var(--radius); box-shadow: var(--shadow); display: flex; flex-direction: column; overflow: hidden; }
.popup.wide { width: 560px; }
.popup.min { display: none; }
.popup:not(.top) .popup-title { opacity: 0.8; }
.popup-title { display: flex; align-items: center; gap: 4px; padding: 6px 8px 6px 14px; background: var(--bg-side); border-bottom: 1px solid var(--border); cursor: grab; user-select: none; font-weight: 600; font-size: 13px; }
.popup-title:active { cursor: grabbing; }
.popup-title-text { flex: 1; }
.popup-scroll { overflow-y: auto; flex: 1; min-height: 0; }
.popup-body { padding: 14px 16px 16px; }
.popup-actions { display: flex; align-items: center; justify-content: flex-end; gap: 8px; margin-top: 14px; }
.popup-actions .push-left { margin-right: auto; }
.tabs-mini { display: flex; gap: 4px; margin-bottom: 12px; align-items: center; }
.tabs-mini button { padding: 4px 14px; border-radius: 999px; border: 1px solid var(--border); background: transparent; }
.tabs-mini button.on { background: var(--accent-soft); border-color: var(--accent); font-weight: 600; }
.spacer-l { margin-left: auto; }
.dock { position: fixed; left: 50%; transform: translateX(-50%); bottom: 12px; display: flex; gap: 6px; z-index: 1100; background: var(--bg-side); border: 1px solid var(--border-strong); border-radius: 12px; padding: 5px; box-shadow: var(--shadow); max-width: 80vw; overflow-x: auto; }
.dock-chip { display: flex; align-items: center; background: var(--bg-card); border: 1px solid var(--border); border-radius: 8px; padding-right: 2px; max-width: 220px; }
.dock-open { border: 0; background: transparent; padding: 4px 8px; max-width: 180px; }
.file-veil { position: fixed; inset: 0; z-index: 2000; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; background: color-mix(in srgb, var(--bg) 82%, transparent); border: 3px dashed var(--accent); color: var(--accent); font-size: 16px; font-weight: 600; pointer-events: none; }

/* ---------- toasts / login ---------- */
.toasts { position: fixed; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 3000; max-width: 380px; }
.toast { padding: 9px 14px; border-radius: 10px; background: var(--text); color: var(--bg); box-shadow: var(--shadow); cursor: pointer; font-size: 13px; }
.toast.error { background: var(--down); color: #fff; }
.toast.ok { background: var(--ok); color: #fff; }
.login-wrap { height: 100vh; display: grid; place-items: center; background: var(--bg); }
.login { width: 340px; display: flex; flex-direction: column; gap: 4px; padding: 26px; box-shadow: var(--shadow); }
.login p { text-align: center; margin: 0 0 12px; }

@media (max-width: 1100px) { :root { --left: 220px; --right: 300px; } }
table.units td:last-child { max-width: 110px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- AI accounts / models (SPEC-AI §4) ---------- */
.row.wrap, .wrap { flex-wrap: wrap; }
.ai-intro { max-width: 760px; margin: -6px 0 12px; }
.grid.providers { grid-template-columns: repeat(auto-fill, minmax(420px, 1fr)); align-items: start; margin-top: 8px; }
.provider-card .card-head { align-items: flex-start; }
.card-title.static { cursor: default; }
.small-pills { margin-top: 4px; gap: 5px; }
.small-pills .pill { padding: 0 8px; font-size: 11.5px; }
.login-hint-line { margin: -2px 0 8px; padding: 6px 8px; background: var(--bg); border-radius: var(--radius-sm); border: 1px dashed var(--border-strong); }
.accts { display: flex; flex-direction: column; gap: 8px; }
.acct { border: 1px solid var(--border); background: var(--bg); border-radius: 10px; padding: 9px 10px; display: flex; flex-direction: column; gap: 5px; }
.acct.off { opacity: 0.65; }
.acct .row { flex-wrap: wrap; row-gap: 4px; }
.acct-meta { overflow-wrap: anywhere; }
.acct-err { color: var(--down); font-size: 12px; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.acct-empty { padding: 6px 2px; }
.key-hint { background: var(--bg-hover); border-radius: 5px; padding: 0 6px; color: var(--muted); }
.btn.danger-ghost { color: var(--down); border-color: color-mix(in srgb, var(--down) 45%, transparent); }
.btn.danger-ghost:hover:not(:disabled) { background: color-mix(in srgb, var(--down) 12%, transparent); }
.down-text { color: var(--down); }
.test-res { margin-top: 6px; display: flex; flex-direction: column; gap: 6px; }
.test-excerpt { max-height: 120px; margin: 0; overflow: auto; background: var(--bg-hover); border-radius: var(--radius-sm); padding: 6px 8px; font-size: 13px; }
.login-box { border: 1px solid var(--border); background: var(--bg); border-radius: var(--radius-sm); padding: 10px 12px; margin-bottom: 10px; display: flex; flex-direction: column; gap: 6px; }
.login-hint { font-family: var(--mono); font-size: 12px; background: var(--bg-card); border: 1px solid var(--border); border-radius: 6px; padding: 6px 8px; overflow-wrap: anywhere; }
.acct-form .seg { margin-bottom: 0; }
.acct-form .seg button { flex: none; padding: 5px 12px; }
.model-pick { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.model-pick .row select { flex: 1; min-width: 0; }
.model-pick .mt { margin-top: 0; }
.ai-section { display: flex; flex-direction: column; gap: 8px; }
.ai-agent { border: 1px solid var(--border); background: var(--bg-card); border-radius: 10px; padding: 9px 10px; display: flex; flex-direction: column; gap: 6px; }
.ai-agent select { min-width: 0; }
.seg.compact { margin: 0; flex: none; }
.seg.compact button { padding: 2px 8px; font-size: 11.5px; flex: none; }
.seg button:disabled { opacity: 0.55; cursor: not-allowed; }
.ai-missing { display: flex; align-items: center; gap: 5px; color: var(--warn); font-size: 12px; font-weight: 500; }
.tag.ai-tag { margin-right: 0; background: var(--accent-soft); color: var(--accent); font-family: var(--mono); white-space: nowrap; flex: none; }

/* ---- native CVE screen (SPEC-P3) ---- */
.pane-scroll.wide { max-width: 1040px; margin: 0 auto; width: 100%; }
.cve { display: flex; flex-direction: column; gap: 10px; }
.cve-form { display: flex; gap: 8px; align-items: center; }
.cve-search { flex: 1; margin: 0; }
.cve-examples { gap: 6px; }
.cve-help summary { cursor: pointer; }
.cve-help-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 8px 24px; margin-top: 8px; }
.cve-empty { text-align: center; padding: 32px 16px; display: flex; flex-direction: column; align-items: center; gap: 6px; color: var(--muted); }
.cve-record { display: flex; flex-direction: column; gap: 10px; }
.cve-id { font-weight: 700; }
.cve-id.big { font-size: 16px; }
.cve-chip { display: inline-flex; align-items: center; padding: 1px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 600; white-space: nowrap; }
.sev-critical { background: color-mix(in srgb, #e11d48 16%, transparent); color: #be123c; }
.sev-high { background: color-mix(in srgb, #ea580c 16%, transparent); color: #c2410c; }
.sev-medium { background: color-mix(in srgb, #d97706 18%, transparent); color: #b45309; }
.sev-low, .sev-ok { background: color-mix(in srgb, #059669 16%, transparent); color: #047857; }
.sev-na { background: var(--bg-hover); color: var(--muted); }
.cve-verdict { display: flex; align-items: center; gap: 8px; padding: 10px 14px; border-radius: var(--radius-sm); border: 1px solid; flex-wrap: wrap; }
.verdict-critical { background: color-mix(in srgb, #e11d48 10%, var(--bg-card)); border-color: color-mix(in srgb, #e11d48 40%, transparent); color: #be123c; }
.verdict-high { background: color-mix(in srgb, #ea580c 10%, var(--bg-card)); border-color: color-mix(in srgb, #ea580c 40%, transparent); color: #c2410c; }
.verdict-medium { background: color-mix(in srgb, #d97706 10%, var(--bg-card)); border-color: color-mix(in srgb, #d97706 40%, transparent); color: #b45309; }
.verdict-low { background: color-mix(in srgb, #059669 10%, var(--bg-card)); border-color: color-mix(in srgb, #059669 40%, transparent); color: #047857; }
.cve-kev-extra { opacity: 0.8; }
.cve-summary { display: flex; gap: 10px; align-items: flex-start; background: var(--accent-soft); }
.cve-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.cve-tile { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 12px; background: var(--bg-card); }
.cve-tile .lbl { font-size: 11px; color: var(--muted); }
.cve-tile .val { font-size: 16px; font-weight: 700; margin-top: 2px; }
.cve-tile .word { font-size: 11px; font-weight: 600; margin-left: 6px; }
.cve-tile .sub { font-size: 10.5px; color: var(--muted); }
.tile-critical { border-color: color-mix(in srgb, #e11d48 45%, transparent); } .tile-critical .val { color: #be123c; }
.tile-high { border-color: color-mix(in srgb, #ea580c 45%, transparent); } .tile-high .val { color: #c2410c; }
.tile-medium { border-color: color-mix(in srgb, #d97706 45%, transparent); } .tile-medium .val { color: #b45309; }
.tile-low .val, .tile-ok .val { color: #047857; }
.tile-f5 { border-color: color-mix(in srgb, #2563eb 45%, transparent); } .tile-f5 .val { color: #2563eb; }
.cve-head { display: flex; flex-direction: column; gap: 8px; }
.cve-meta { gap: 12px; align-items: center; }
.cve-link { color: var(--accent); text-decoration: none; }
.cve-link:hover { text-decoration: underline; }
.cve-vec { gap: 16px; align-items: center; }
.cve-epss { min-width: 140px; }
.epss-bar { height: 5px; border-radius: 999px; background: var(--bg-hover); overflow: hidden; margin-top: 3px; }
.epss-fill { height: 100%; border-radius: 999px; background: linear-gradient(90deg, #a5b4fc, #6366f1); }
.cve-vector { flex: 1; min-width: 180px; word-break: break-all; }
.tiny { font-size: 10.5px; }
.cve-text { margin: 0; line-height: 1.7; white-space: pre-wrap; overflow-wrap: anywhere; }
.cve-trans-box { border: 1px solid color-mix(in srgb, #0ea5e9 35%, transparent); background: color-mix(in srgb, #0ea5e9 8%, var(--bg-card)); border-radius: var(--radius-sm); padding: 10px 12px; display: flex; flex-direction: column; gap: 6px; }
.cve-weak { gap: 6px; }
.cve-fresh { gap: 12px; border-top: 1px solid var(--border); padding-top: 8px; margin-top: 4px; }
.cve-fresh.stale > span:first-child { color: var(--warn); font-weight: 600; }
.cve-two { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 10px; }
.cve-aff { margin-bottom: 6px; display: flex; flex-wrap: wrap; gap: 4px 6px; align-items: center; }
.cve-aff > div { flex-basis: 100%; }
.cve-cpe { padding: 1px 0; }
.cve-h { margin: 0; }
.cve-ref { word-break: break-all; font-size: 12px; padding: 2px 0; }
.cve-doc { display: flex; align-items: center; gap: 6px; padding: 2px 0; }
.cve-sig { border-left: 4px solid var(--border-strong); }
.sig-mapped { border-left-color: #34d399; } .sig-pattern { border-left-color: #fbbf24; }
.sig-patch { border-left-color: #60a5fa; } .sig-unknown { border-left-color: var(--border-strong); }
.cve-sigs { margin: 8px 0 0; padding-left: 18px; }
.cve-sigs code { background: var(--accent-soft); padding: 0 6px; border-radius: 5px; margin-right: 6px; }
.cve-ai { background: color-mix(in srgb, #8b5cf6 6%, var(--bg-card)); }
.cve-running { gap: 8px; margin: 8px 0; }
.cve-report { margin-top: 8px; }
.cve-stale { color: var(--warn); font-weight: 600; }
.cve-list-head { margin: 2px 0; }
.cve-row { display: block; width: 100%; text-align: left; margin-bottom: 8px; cursor: pointer; }
.cve-row:hover { background: var(--bg-hover); }
.cve-desc { margin: 4px 0 0; line-height: 1.6; }

/* wafscan (SPEC-P3-2 §3) */
.wafscan { display: flex; flex-direction: column; gap: 12px; }
.wafscan-form { display: flex; flex-direction: column; gap: 10px; }
.wafscan-form input[type=text], .wafscan-form textarea { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 6px 10px; color: var(--text); font: inherit; }
.wafscan-form textarea { width: 100%; resize: vertical; }
.wafscan-cats { gap: 6px; }
.wafscan-advanced { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 8px 10px; }
.wafscan-advanced summary { cursor: pointer; color: var(--muted); font-size: 13px; }
.wafscan-advanced > div, .wafscan-advanced > textarea, .wafscan-advanced > input { margin-top: 8px; }
.wafscan-consent { gap: 6px; font-weight: 600; }
.wafscan-cal { display: flex; flex-direction: column; gap: 4px; margin: 6px 0; }
.wafscan-summary { gap: 6px; align-items: center; margin: 6px 0; }
.wafscan-summary .pill.on { outline: 2px solid var(--accent); }
.sum-block { background: color-mix(in srgb, #059669 16%, transparent); color: #047857; }
.sum-pass { background: color-mix(in srgb, #e11d48 16%, transparent); color: #be123c; }
.sum-anomaly { background: color-mix(in srgb, #d97706 18%, transparent); color: #b45309; }
.sum-inconclusive { background: color-mix(in srgb, #2563eb 16%, transparent); color: #1d4ed8; }
.sum-error { background: var(--bg-hover); color: var(--muted); }
.wafscan-results { width: 100%; border-collapse: collapse; font-size: 12.5px; margin-top: 8px; }
.wafscan-results th { text-align: left; color: var(--muted); font-size: 11px; padding: 4px 6px; border-bottom: 1px solid var(--border); }
.wafscan-results td { padding: 4px 6px; border-bottom: 1px solid var(--border); vertical-align: top; }
.wafscan-results tr.v-block td:first-child { border-left: 3px solid #059669; }
.wafscan-results tr.v-pass td:first-child { border-left: 3px solid #e11d48; }
.wafscan-results tr.v-anomaly td:first-child { border-left: 3px solid #d97706; }
.wafscan-results tr.v-inconclusive td:first-child { border-left: 3px solid #2563eb; }
.wafscan-results tr.v-error td:first-child { border-left: 3px solid var(--border-strong); }
.wafscan-results pre { max-height: 220px; overflow: auto; background: var(--bg-hover); border-radius: var(--radius-sm); padding: 6px 8px; white-space: pre-wrap; overflow-wrap: anywhere; }
.pill.state-queued, .pill.state-running { background: color-mix(in srgb, #2563eb 16%, transparent); color: #1d4ed8; }
.pill.state-done { background: color-mix(in srgb, #059669 16%, transparent); color: #047857; }
.pill.state-stopped, .pill.state-interrupted { background: color-mix(in srgb, #d97706 18%, transparent); color: #b45309; }
.pill.state-failed { background: color-mix(in srgb, #e11d48 16%, transparent); color: #be123c; }
.wafscan-hist-row { display: flex; width: 100%; text-align: left; cursor: pointer; align-items: center; gap: 8px; padding: 6px 4px; border-radius: var(--radius-sm); }
.wafscan-hist-row:hover { background: var(--bg-hover); }
.wafscan-asserts { margin: 6px 0 0; padding-left: 0; list-style: none; display: flex; flex-direction: column; gap: 4px; }
.wafscan-asserts li { display: flex; align-items: center; gap: 6px; font-size: 13px; }
.wafscan-asserts li.ok { color: var(--ok); }
.wafscan-asserts li.bad { color: var(--down); }
.wafscan-ai { background: color-mix(in srgb, #8b5cf6 6%, var(--bg-card)); }
.wafscan-delta-list { margin: 6px 0 0; padding-left: 18px; font-size: 12.5px; }
.wafscan-warnings { margin: 0; padding-left: 0; list-style: none; display: flex; flex-direction: column; gap: 4px; }
.wafscan-fp-evidence { margin: 6px 0 0; padding-left: 16px; display: flex; flex-direction: column; gap: 2px; }

/* users and permissions (admin settings) */
.users-intro { margin: -6px 0 12px; max-width: 760px; }
.users-card { padding: 0; overflow: hidden; }
.users-card .table-wrap { overflow-x: auto; }
table.users-table { width: 100%; border-collapse: collapse; font-size: 13px; }
table.users-table th { text-align: left; font-size: 12px; font-weight: 600; color: var(--muted); padding: 9px 12px; background: var(--bg-side); border-bottom: 1px solid var(--border); white-space: nowrap; }
table.users-table td { padding: 8px 12px; border-top: 1px solid var(--border); vertical-align: middle; }
table.users-table tbody tr:first-child td { border-top: 0; }
table.users-table tr.off td { color: var(--muted); }
table.users-table tr.off .u-name { text-decoration: line-through; text-decoration-color: color-mix(in srgb, var(--muted) 60%, transparent); }
.u-name { display: flex; align-items: center; gap: 6px; font-weight: 600; max-width: 220px; }
.u-name .tag { margin-right: 0; }
.nowrap { white-space: nowrap; }
.perm-head, .perm-cell { text-align: center !important; }
.perm-cell input[type="checkbox"] { width: 17px; height: 17px; accent-color: var(--accent); cursor: pointer; }
.perm-cell input[type="checkbox"]:disabled { cursor: not-allowed; opacity: 0.55; }
.u-actions { white-space: nowrap; text-align: right; }
.u-actions .btn + .btn { margin-left: 6px; }
.u-actions-head { text-align: right !important; }
.gen-pw { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border: 1px dashed var(--border-strong); border-radius: var(--radius-sm); background: var(--bg); margin-top: 6px; }
.gen-pw-text { flex: 1; font-size: 15px; letter-spacing: 0.04em; user-select: all; word-break: break-all; }
.alert.ok-box { background: color-mix(in srgb, var(--ok) 12%, var(--bg-card)); border: 1px solid color-mix(in srgb, var(--ok) 40%, transparent); }
.perm-pick { display: flex; align-items: center; gap: 8px; padding: 4px 0; flex-wrap: wrap; }
.perm-pick input { width: 16px; height: 16px; accent-color: var(--accent); }
.down-text { color: var(--down); }

/* edu (SPEC-P3-3 §5) */
.edu { display: flex; flex-direction: column; gap: 14px; }
.edu-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 12px; }
.edu-card { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.edu-lbl { font-size: 11px; color: var(--muted); font-weight: 600; letter-spacing: 0.02em; }
.edu-big { font-size: 26px; font-weight: 700; line-height: 1; }
.edu-h { margin: 0 0 8px; font-size: 15px; }
.edu-h2 { margin: 10px 0 2px; font-size: 13px; color: var(--muted); }
.edu-notice.ok { background: color-mix(in srgb, var(--ok) 12%, var(--bg-card)); border: 1px solid color-mix(in srgb, var(--ok) 40%, transparent); }
.edu-strip { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; }
.edu-lesson { flex: 0 0 168px; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 8px 10px; background: var(--bg-card); }
.edu-lesson.first { border-color: var(--accent); background: var(--accent-soft); }
.edu-lesson-title { font-size: 12.5px; line-height: 1.35; margin-top: 2px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.edu .table-wrap { overflow-x: auto; }
.edu-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.edu-table th { text-align: left; color: var(--muted); font-size: 11px; padding: 4px 8px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.edu-table td.muted { white-space: nowrap; }
.edu-table td { padding: 5px 8px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.edu-t-title { max-width: 360px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.edu-table tr.edu-row-down td:first-child { border-left: 3px solid var(--down); }
.edu-table tr.edu-row-warn td:first-child { border-left: 3px solid var(--warn); }
.edu-table tr.edu-row-ok td:first-child { border-left: 3px solid var(--ok); }
.edu-table tr.edu-off td { opacity: 0.55; }
.edu-bad { color: var(--down); font-weight: 600; }
.edu-warn { color: var(--warn); font-weight: 600; }
.edu-bar { width: 70px; height: 6px; border-radius: 999px; background: var(--bg-hover); overflow: hidden; }
.edu-bar-fill { height: 100%; background: var(--ok); }
.edu-pending { border-color: color-mix(in srgb, var(--warn) 45%, transparent); }
.edu-select, .edu select, .edu input[type=text], .edu input[type=password], .edu textarea { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 6px 10px; color: var(--text); font: inherit; max-width: 100%; }
.edu textarea { width: 100%; resize: vertical; }
.edu-frame { width: 100%; height: 640px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: #fff; margin-top: 8px; }
.edu-subject { margin-top: 6px; overflow-wrap: anywhere; }
.edu-form { display: flex; flex-direction: column; gap: 4px; max-width: 640px; }
.edu-smtp { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 0 14px; }
.edu-add { margin-top: 10px; }
.edu-confirm p { margin: 0 0 8px; }

/* ---- wiki screen (SPEC-P3-4) ---- */
.pane-scroll.wiki-wrap { max-width: none; padding: 16px 20px 28px; }
.wiki { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 18px; align-items: start; }
.wiki-side { position: sticky; top: 0; max-height: calc(100vh - 150px); overflow-y: auto; padding-right: 4px; }
.wiki-side h4 { margin: 14px 0 6px; font-size: 12px; color: var(--muted); font-weight: 600; letter-spacing: 0.02em; }
.wiki-side h4:first-child { margin-top: 0; }
.wiki-cat { display: flex; align-items: center; gap: 8px; width: 100%; border: 0; background: transparent; padding: 5px 8px; border-radius: 7px; text-align: left; cursor: pointer; }
.wiki-cat > span:nth-last-child(2):not(.wiki-dot) { flex: 1; }
.wiki-cat:first-of-type > span:first-child { flex: 1; }
.wiki-cat:hover { background: var(--bg-hover); }
.wiki-cat.active { background: var(--accent-soft); font-weight: 600; }
.wiki-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; flex: none; margin-right: 6px; vertical-align: baseline; background: var(--muted); }
.wiki-dot.broken { background: transparent; border: 1px dashed var(--down); }
.wiki-tags { display: flex; flex-wrap: wrap; gap: 4px; }
.wiki-recent { list-style: none; margin: 0; padding: 0; }
.wiki-recent-item { flex-direction: column; align-items: flex-start; gap: 0; width: 100%; }
.wiki-recent-item .ellipsis { max-width: 100%; font-size: 13px; }
.wiki-main { min-width: 0; }
.wiki-search { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; }
.wiki-search .search { flex: 1; margin: 0; }
.wiki-status { margin: 4px 0 8px; gap: 10px; }
.wiki-stale, .wiki-warn { color: var(--warn); font-weight: 600; }
.wiki-chip { display: inline-flex; align-items: center; padding: 0 8px; border: 1px solid var(--border); border-radius: 999px; font-size: 12px; background: var(--bg-card); line-height: 20px; white-space: nowrap; }
.wiki-chip.cat { border-color: var(--cc, var(--border)); color: var(--cc, inherit); }
.wiki-chip.tag { cursor: pointer; color: var(--muted); }
.wiki-chip.tag:hover, .wiki-chip.tag.active { background: var(--accent-soft); color: var(--text); border-color: var(--accent); }
.wiki-chip.via { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 50%, transparent); }
.wiki-chip.broken { color: var(--down); border-color: var(--down); margin-left: 6px; }
.wiki-chip.conf, .wiki-chip.status, .wiki-chip.type, .wiki-chip.date { color: var(--muted); }
.wiki-list-head { margin: 6px 0; gap: 10px; align-items: baseline; }
.wiki-list-head h3 { margin: 0; font-size: 16px; }
.wiki-rows, .wiki-hits { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.wiki-row, .wiki-hit { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-sm); }
.wiki-row:hover, .wiki-hit:hover { border-color: var(--border-strong); background: var(--bg-hover); }
.wiki-row-main, .wiki-hit-main { display: flex; align-items: center; gap: 8px; width: 100%; border: 0; background: transparent; padding: 8px 12px; text-align: left; cursor: pointer; flex-wrap: wrap; }
.wiki-hit-main { display: block; }
.wiki-title { font-weight: 600; }
.wiki-row-tags { padding: 0 12px 8px; }
.wiki-snippet { margin-top: 4px; color: var(--muted); font-size: 13px; overflow-wrap: anywhere; }
.wiki-pager { justify-content: center; gap: 12px; margin: 12px 0; }
.wiki-page-head h2 { margin: 0; font-size: 22px; flex: 1; min-width: 0; }
.wiki-meta { gap: 6px; margin: 8px 0 4px; }
.wiki-aliases { margin: 2px 0 6px; }
.wiki-toc { display: flex; flex-direction: column; gap: 0; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 8px 12px; margin: 10px 0; max-height: 220px; overflow-y: auto; }
.wiki-toc-item { font-size: 13px; padding: 1px 4px; }
.wiki-toc-item.lv2 { padding-left: 14px; } .wiki-toc-item.lv3 { padding-left: 28px; }
.wiki-toc-item.lv4, .wiki-toc-item.lv5, .wiki-toc-item.lv6 { padding-left: 42px; }
.wiki-body { margin: 12px 0; }
.wiki-note { margin: 4px 0 8px; }
.wiki-section h4 { margin: 18px 0 6px; font-size: 13px; color: var(--muted); }
.wiki-sources, .wiki-linklist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 1px; }
.wiki-sources li { overflow-wrap: anywhere; }
.wiki-linklist .linkish { font-size: 13px; }
.wiki-broken-item { color: var(--down); font-size: 13px; padding: 3px 4px; }
.wiki-ctx-title { font-weight: 600; margin-bottom: 4px; }
.wiki-open { margin: 4px 0 6px; }
.wiki-ctx-lists { max-height: 240px; overflow-y: auto; margin: 6px 0; }
.wiki-graph .row { margin-bottom: 4px; gap: 4px; }
.wiki-canvas { width: 100%; height: auto; aspect-ratio: 300 / 240; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-sm); cursor: pointer; display: block; }
.wiki-hover { min-height: 18px; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wiki-legend { display: flex; flex-wrap: wrap; gap: 4px 10px; margin-top: 2px; }
.btn.small.active { background: var(--accent-soft); border-color: var(--accent); }
@media (max-width: 900px) { .wiki { grid-template-columns: 1fr; } .wiki-side { position: static; max-height: none; } }

/* ---- rendered markdown (server-sanitized HTML: wiki pages, CVE analysis, run reports) ---- */
.md, .report.md { white-space: normal; overflow-wrap: anywhere; line-height: 1.65; }
.md > :first-child { margin-top: 0; } .md > :last-child { margin-bottom: 0; }
.md h1, .md h2, .md h3, .md h4, .md h5, .md h6 { line-height: 1.3; margin: 1.3em 0 0.5em; scroll-margin-top: 8px; }
.md h1 { font-size: 1.5em; } .md h2 { font-size: 1.3em; border-bottom: 1px solid var(--border); padding-bottom: 4px; } .md h3 { font-size: 1.12em; } .md h4, .md h5, .md h6 { font-size: 1em; }
.md p { margin: 0.6em 0; }
.md ul, .md ol { padding-left: 1.6em; margin: 0.5em 0; }
.md li { margin: 0.15em 0; }
.md blockquote { margin: 0.8em 0; padding: 4px 14px; border-left: 3px solid var(--border-strong); color: var(--muted); background: color-mix(in srgb, var(--bg-hover) 40%, transparent); }
.md code { background: var(--bg-hover); padding: 1px 5px; border-radius: 5px; }
.md pre { background: var(--bg-side); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 12px; overflow-x: auto; white-space: pre; }
.md pre code { background: transparent; padding: 0; }
.md table { display: block; max-width: 100%; overflow-x: auto; border-collapse: collapse; margin: 0.8em 0; }
.md th, .md td { border: 1px solid var(--border-strong); padding: 5px 10px; text-align: left; vertical-align: top; overflow-wrap: normal; word-break: keep-all; min-width: 4.5em; }
.md th { background: var(--bg-hover); font-weight: 600; }
.md tr:nth-child(even) td { background: color-mix(in srgb, var(--bg-hover) 30%, transparent); }
.md hr { border: 0; border-top: 1px solid var(--border); margin: 1.2em 0; }
.md a { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
.md a.wiki-link { text-decoration-style: dotted; }
.md a.ext-link::after { content: " ↗"; font-size: 0.8em; color: var(--muted); }
.md .wiki-broken { color: var(--down); border-bottom: 1px dashed var(--down); cursor: help; }
.md .md-img { display: inline-block; color: var(--muted); border: 1px dashed var(--border-strong); border-radius: 6px; padding: 0 6px; font-size: 0.9em; }
.md del { color: var(--muted); }
.md sup.footnote-reference a { text-decoration: none; }
.md .footnote-definition { font-size: 0.9em; color: var(--muted); }

/* ---- AI chat screen (SPEC-P3-5) ---- */
.pane-chat { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.chat { flex: 1; min-height: 0; display: grid; grid-template-columns: 250px minmax(0, 1fr); }
.chat-side { border-right: 1px solid var(--border); padding: 14px 12px; display: flex; flex-direction: column; gap: 8px; min-height: 0; overflow-y: auto; background: var(--bg-side); }
.chat-list-head { margin-top: 6px; font-weight: 600; }
.chat-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.chat-none { padding: 6px 4px; }
.chat-item { display: flex; align-items: center; gap: 2px; border-radius: 8px; position: relative; }
.chat-item:hover { background: var(--bg-hover); }
.chat-item.active { background: var(--accent-soft); }
.chat-item-main { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: flex-start; border: 0; background: transparent; padding: 6px 8px; text-align: left; cursor: pointer; }
.chat-item-title { max-width: 100%; font-size: 13px; font-weight: 500; }
.chat-item-actions { display: none; flex: none; padding-right: 4px; }
.chat-item:hover .chat-item-actions, .chat-item.active .chat-item-actions { display: inline-flex; }
.chat-rename { margin: 4px; flex: 1; min-width: 0; }
.chat-confirm { display: flex; align-items: center; gap: 4px; padding-right: 6px; flex: none; }
.chat-privacy { margin-top: auto; padding-top: 10px; line-height: 1.5; }
.chat-main { min-width: 0; min-height: 0; display: flex; flex-direction: column; }
.chat-scroll { flex: 1; min-height: 0; overflow-y: auto; padding: 18px 24px 8px; }
.chat-thread { max-width: 820px; margin: 0 auto; display: flex; flex-direction: column; gap: 14px; }
.chat-row { display: flex; }
.chat-row.user { justify-content: flex-end; }
.chat-bubble { max-width: 100%; border-radius: 14px; padding: 10px 14px; line-height: 1.6; overflow-wrap: anywhere; }
.chat-bubble.user { background: var(--accent); color: var(--accent-ink); max-width: 78%; white-space: pre-wrap; border-bottom-right-radius: 4px; }
.chat-bubble.answer { background: var(--bg-card); border: 1px solid var(--border); width: 100%; border-bottom-left-radius: 4px; }
.chat-bubble.answer.focus { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.chat-bubble.answer.noev { border-color: color-mix(in srgb, var(--warn) 55%, transparent); background: color-mix(in srgb, var(--warn) 7%, var(--bg-card)); }
.chat-bubble.pending { display: inline-flex; align-items: center; gap: 10px; background: var(--bg-hover); }
.chat-bubble.muted-bubble { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); background: var(--bg-hover); }
.chat-bubble.failed { background: color-mix(in srgb, var(--down) 10%, var(--bg-card)); border: 1px solid color-mix(in srgb, var(--down) 40%, transparent); display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.chat-err { color: var(--muted); overflow-wrap: anywhere; }
.chat-md { font-size: 14px; }
.chat-plain { white-space: pre-wrap; }
.chat-gaps { margin-top: 8px; color: var(--muted); }
.chat-cites { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 10px; padding-top: 8px; border-top: 1px dashed var(--border); }
.chat-cite { display: inline-flex; align-items: center; padding: 1px 10px; border-radius: 999px; background: var(--accent-soft); border: 1px solid color-mix(in srgb, var(--accent) 45%, transparent); color: var(--text); font-size: 12.5px; text-decoration: none; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-cite:hover { background: var(--accent); color: var(--accent-ink); }
.chat-cite.plain { background: var(--bg-hover); border-color: var(--border); }
.chat-answer-foot { margin-top: 8px; gap: 10px; color: var(--muted); }
.chat-empty { max-width: 640px; margin: 8vh auto 0; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 8px; color: var(--accent); }
.chat-empty h3 { margin: 4px 0 0; color: var(--text); font-size: 20px; }
.chat-empty p { margin: 0; line-height: 1.6; max-width: 520px; }
.chat-examples { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; width: 100%; margin-top: 10px; }
.chat-example { text-align: left; padding: 10px 12px; border: 1px solid var(--border-strong); background: var(--bg-card); border-radius: 10px; color: var(--text); cursor: pointer; line-height: 1.45; }
.chat-example:hover { border-color: var(--accent); background: var(--accent-soft); }
.chat-input { padding: 8px 24px 14px; max-width: 868px; width: 100%; margin: 0 auto; }
.chat-box { display: flex; gap: 8px; align-items: flex-end; }
.chat-box textarea { flex: 1; resize: none; min-height: 48px; max-height: 180px; border-radius: 12px; }
.chat-send { height: 44px; }
.chat-foot { margin-top: 6px; gap: 10px; flex-wrap: wrap; }
.chat-notice { margin: 0 0 8px; }
.pill.quota { background: var(--bg-hover); }
.pill.quota.warn { background: color-mix(in srgb, var(--warn) 18%, transparent); color: var(--warn); }
.pill.quota.down { background: color-mix(in srgb, var(--down) 16%, transparent); color: var(--down); }
.down-text { color: var(--down); }
.chat-ctx .chat-evidence { list-style: none; margin: 8px 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.chat-ev { border: 1px solid var(--border); border-radius: 9px; background: var(--bg-card); }
.chat-ev.cited { border-color: color-mix(in srgb, var(--ok) 55%, transparent); }
.chat-ev-main { display: flex; flex-direction: column; gap: 4px; align-items: flex-start; width: 100%; border: 0; background: transparent; padding: 8px 10px; text-align: left; cursor: pointer; border-radius: 9px; }
.chat-ev-main:hover { background: var(--bg-hover); }
.chat-ev-title { font-weight: 600; font-size: 13px; }
.chat-ev-snippet { font-size: 12px; color: var(--muted); line-height: 1.5; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.chat-stat-table { width: 100%; border-collapse: collapse; margin: 6px 0; }
.chat-stat-table th, .chat-stat-table td { text-align: left; padding: 2px 6px; border-bottom: 1px solid var(--border); }
@media (max-width: 900px) { .chat { grid-template-columns: 1fr; } .chat-side { display: none; } .chat-examples { grid-template-columns: 1fr; } }

/* ---- document studio (SPEC-P3-6) ---- */
.pane-docs { flex: 1; min-height: 0; display: flex; flex-direction: column; padding: 14px 20px 16px; gap: 8px; overflow: hidden; }
.docs-wrap { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 8px; }
.docs-bar { gap: 8px; flex-wrap: wrap; }
.docs-search { margin: 0; flex: 1; min-width: 160px; max-width: 320px; }
.docs-form { max-width: 220px; }
.docs-all { display: inline-flex; align-items: center; gap: 5px; font-size: 13px; white-space: nowrap; }
.docs-body { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(220px, 300px) minmax(0, 1fr); gap: 12px; }
.docs-list-col { min-height: 0; display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-card); overflow: hidden; }
.docs-count { padding: 8px 12px 4px; }
.docs-list { list-style: none; margin: 0; padding: 4px 6px 8px; overflow-y: auto; flex: 1; display: flex; flex-direction: column; gap: 2px; }
.docs-item { display: flex; flex-direction: column; gap: 1px; width: 100%; text-align: left; border: 0; background: transparent; padding: 7px 9px; border-radius: 7px; cursor: pointer; }
.docs-item:hover { background: var(--bg-hover); }
.docs-item.active { background: var(--accent-soft); }
.docs-title { font-weight: 600; flex: 1; }
.docs-view { min-height: 0; min-width: 0; display: flex; flex-direction: column; gap: 6px; overflow-y: auto; }
.docs-frame { flex: 1; min-height: 360px; width: 100%; border: 1px solid var(--border); border-radius: var(--radius); background: #fff; }
.docs-banner { padding: 6px 10px; border: 1px solid var(--warn); border-radius: var(--radius-sm); background: color-mix(in srgb, var(--warn) 12%, var(--bg-card)); font-size: 13px; }
.docs-nonhtml { width: 100%; box-sizing: border-box; }
.docs-note { padding: 0 4px; }
.docs-info-title { font-weight: 600; word-break: break-word; }
.docs-downloads { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0; }
.docs-versions { list-style: none; margin: 4px 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.docs-version { display: flex; align-items: center; gap: 6px; padding: 4px 6px; border: 1px solid var(--border); border-radius: 7px; }
.docs-popup-frame { width: 100%; height: 360px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: #fff; margin-top: 6px; }
/* the hub's own edits (SPEC-P3-6B 3-6b-1) */
.docs-tools { gap: 8px; align-items: center; flex-wrap: wrap; }
.docs-editor { flex: 1; min-height: 360px; width: 100%; resize: none; }
.docs-confirm { display: flex; flex-direction: column; gap: 6px; margin: 4px 0; }
.docs-confirm p { margin: 0; }
.docs-question { white-space: pre-line; }
.docs-versions .docs-confirm { list-style: none; }
/* the AI studio (SPEC-P3-6B 3-6b-5) */
.docs-studio { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; padding: 2px 2px 12px; }
.docs-prompt { min-height: 120px; line-height: 1.5; }
.docs-choices { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.docs-choices .field { margin-bottom: 0; flex: 1; min-width: 180px; max-width: 320px; }
.docs-choices .docs-pages { flex: 0 0 120px; min-width: 100px; }
.docs-count.over { color: var(--down); font-weight: 600; }
.docs-ai-error { margin: 2px 0; }
.docs-jobs-h { margin: 10px 0 2px; }
.docs-jobs { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.docs-job { display: flex; flex-direction: column; gap: 4px; padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg-card); }
.docs-job-kind { font-weight: 600; }
.docs-job-req { color: var(--muted); font-size: 12.5px; }
.docs-job-fail { color: var(--down); }
.docs-job-note { padding-left: 2px; }
.docs-jobstrip { display: flex; flex-direction: column; gap: 6px; }
.docs-livepill { cursor: pointer; }
.docs-aiedit { display: flex; flex-direction: column; gap: 6px; padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg-card); }
.docs-aiedit-text { min-height: 64px; line-height: 1.5; }

/* The edit frame has its own sandbox and network-denying CSP. */
.docs-visual-tools { gap: 6px; border-bottom: 1px solid var(--border); }
.docs-visual-frame { flex: 1; min-height: 65vh; background: #f1f5f9; }
.docs-visual-tools .btn { white-space: nowrap; }

.docs-fit { position: relative; overflow: hidden; flex: 1; min-height: 360px; background: #e8edf2; }
.docs-fit-edit { min-height: 65vh; }
.docs-fit > .docs-frame { position: absolute; inset: 0; width: 100%; height: 100%; min-height: 0; box-sizing: border-box; }

.docs-pageview { background: #e8edf2; margin-top: 1rem; padding: 1rem; }
.docs-page { margin: 0 0 1.25rem; }
.docs-page img { display: block; width: 100%; height: auto; background: white; box-shadow: 0 2px 8px #0002; }
/* the room a page keeps while its image is fetched (api_image.rs) */
.docs-page > div { width: 100%; background: white; box-shadow: 0 2px 8px #0002; }
.docs-page figcaption { text-align: center; padding-top: .5rem; font-size: .8rem; color: #596777; }

/* human-readable views */
.human-json { display:grid; grid-template-columns:minmax(7rem,auto) minmax(0,1fr); gap:.5rem 1rem; font:inherit; }
.human-json dt { color:var(--muted); white-space:pre-wrap; }
.human-json dd { margin:0; overflow-wrap:anywhere; white-space:pre-wrap; }
.tech-details { margin-top:.75rem; font-size:.85rem; }
.tech-details summary { cursor:pointer; color:var(--muted); }
.tech-details pre { max-height:20rem; overflow:auto; white-space:pre-wrap; }

/* ---------- company profile (설정 › 회사 정보) ---------- */
.company-card .card-head { align-items: baseline; }
.company-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 18px; }
.company-field.company-wide { grid-column: 1 / -1; }
.company-err { color: var(--down); font-size: 12px; }
.company-actions { margin-top: 4px; }
.company-readonly { display: flex; flex-direction: column; }
.company-row { display: flex; align-items: center; gap: 8px; padding: 5px 0; border-bottom: 1px dashed var(--border); font-size: 13px; min-width: 0; }
.company-row:last-child { border-bottom: none; }
.company-row-label { color: var(--muted); flex: 0 0 110px; }
.company-row-dash { color: var(--border); }
.company-row-value { flex: 1; min-width: 0; }
.brand-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.brand-company { font-size: 11px; font-weight: 500; color: var(--muted); max-width: 150px; }
.company-nudge { flex-direction: row; align-items: center; flex-wrap: wrap; }
.company-nudge-text { flex: 1; min-width: 220px; }
.company-nudge-line { display: flex; align-items: center; gap: 6px; margin: 2px 0 10px; }

.wiki-inbox { display: grid; gap: 12px; overflow-x: auto; }
.wiki-inbox-drop { border: 2px dashed var(--border, #aaa); border-radius: 8px; padding: 24px; }
.wiki-inbox-drop input { display: block; margin-top: 12px; max-width: 100%; }
.wiki-inbox table { width: 100%; border-collapse: collapse; }
.wiki-inbox th, .wiki-inbox td { padding: 8px; text-align: left; border-bottom: 1px solid var(--border, #ddd); overflow-wrap: anywhere; }

.audit-filters { display:flex; flex-wrap:wrap; gap:12px; align-items:end; margin-bottom:16px; }
.audit-filters label { display:flex; flex-direction:column; gap:4px; }
.audit-pane { padding:16px 0; }
.audit-table td { overflow-wrap:anywhere; max-width:360px; vertical-align:top; }

.wiki-meta-pages { margin-bottom: 16px; gap: 8px; }
.wiki-meta-pages .btn { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }
.wiki-meta-log { margin-bottom: 12px; }

.content-card { border: 1px solid var(--border, #ddd); border-radius: 8px; padding: 16px; margin: 12px 0; }
.content-card { background: var(--bg-card); }
.content-card > p, .content-card > div > p { margin: 6px 0; }
.content-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 8px 0; }

.wiki-log { max-height: 480px; overflow: auto; white-space: pre-wrap; }

.fetchq fieldset { display: flex; flex-wrap: wrap; align-items: end; gap: 12px; border: 0; padding: 12px 0; min-width: 0; }
.fetchq fieldset label { display: flex; flex-direction: column; gap: 4px; max-width: 100%; }
.fetchq input { max-width: 100%; }
.fetchq article { overflow-wrap: anywhere; }

/* 새 자료 찾기 */
.disc-pane { display: grid; gap: 16px; }
.disc-pane > p:empty, .disc-pane > ul:empty, .disc-pane > [hidden] { display: none; }
.disc-pane > p, .disc-pane > ul { margin: 0; }
.disc-banner { padding: 12px 16px; border: 1px solid #b88635; border-radius: 8px; background: #b8863518; }
.disc-counts { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 10px; }
.disc-count { display: grid; gap: 8px; padding: 16px; border: 1px solid var(--border,#7775); border-radius: 10px; background: transparent; color: inherit; cursor: pointer; }
.disc-count strong { font-size: 1.6rem; }
.disc-count[aria-pressed="true"] { border-color: #5997e5; background: #5997e518; }
.disc-toolbar,.disc-row-head,.disc-row-actions,.disc-bulk,.disc-source { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; }
.disc-rows { display: grid; gap: 12px; }
.disc-row,.disc-panel { border: 1px solid var(--border,#7775); border-radius: 10px; padding: 16px; min-width: 0; }
.disc-row h3 { margin: 12px 0 6px; overflow-wrap: anywhere; }
.disc-pill,.disc-score { border-radius: 20px; padding: 3px 9px; font-size: .85rem; background: #8882; }
.disc-red { color: #ed6a6a; background: #ed6a6a20; }
.disc-amber { color: #c18a28; background: #c18a2820; }
.disc-grey { color: var(--muted,#888); }
.disc-row-actions { border: 0; padding: 12px 0 0; margin: 0; }
.disc-bulk { position: sticky; bottom: 0; z-index: 2; padding: 16px; border: 1px solid #5997e5; border-radius: 10px; background: var(--bg,#20242c); color: var(--text,#eee); box-shadow: 0 -4px 16px #0002; }
.disc-bulk[hidden] { display: none; }
.disc-source { justify-content: space-between; padding: 8px 0; }
.disc-summary { white-space: pre-wrap; overflow-wrap: anywhere; }
.disc-row dd { margin-bottom: 8px; overflow-wrap: anywhere; }
.disc-table-scroll { overflow-x: auto; }
.disc-table { width: 100%; border-collapse: collapse; text-align: left; }
.disc-table th,.disc-table td { padding: 10px; border-bottom: 1px solid #8883; vertical-align: top; }
.disc-select-all { display: flex; align-items: center; gap: 8px; }
@media(max-width:600px) { .disc-counts { grid-template-columns:repeat(2,minmax(0,1fr)); } .disc-bulk { gap: 8px; } }

/* Wiki curation */
.cur-pane { display: grid; gap: 16px; min-width: 0; max-width: 100%; overflow-wrap: anywhere; }
.cur-pane > p:empty,.cur-pane > ul:empty,.cur-pane p.cur-banner:empty,.cur-detail > p:empty { display: none; }
.cur-pane [hidden] { display: none !important; }
.cur-toolbar,.cur-bulk { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; min-width: 0; }
.cur-counts { display: grid; grid-template-columns: repeat(auto-fit,minmax(120px,1fr)); gap: 8px; }
.cur-counts button { padding: 12px; border: 1px solid var(--border,#7775); border-radius: 8px; background: transparent; color: inherit; }
.cur-counts button[aria-pressed="true"],.cur-toolbar button[aria-pressed="true"] { border-color: #5997e5; background: #5997e518; }
.cur-rows { display: grid; gap: 12px; min-width: 0; }
.cur-row,.cur-panel { min-width: 0; border: 1px solid var(--border,#7775); border-radius: 10px; padding: 16px; }
.cur-row h3 { margin: 12px 0 6px; }
.cur-row p { white-space: pre-wrap; }
.cur-banner { padding: 12px; background: #c18a2818; border-radius: 8px; }
.cur-pill { border-radius: 20px; padding: 3px 9px; font-size: .85rem; background: #8882; }
.cur-green { color: #338952; background: #33895220; }
.cur-amber { color: #c18a28; background: #c18a2820; }
.cur-grey { color: var(--muted,#888); }
.cur-detail { margin-top: 16px; min-width: 0; }
.cur-detail fieldset { min-width: 0; margin: 0; padding: 0; border: 0; }
.cur-detail label { display: grid; gap: 6px; margin: 12px 0; min-width: 0; }
.cur-detail input,.cur-detail select,.cur-detail textarea { width: 100%; max-width: 100%; min-width: 0; box-sizing: border-box; }
.cur-draft { min-height: 420px; font-family: monospace; resize: vertical; }
.cur-preview { white-space: pre-wrap; overflow-wrap: anywhere; min-width: 0; max-width: 100%; }
.cur-bulk { position: sticky; bottom: 0; padding: 16px; border: 1px solid #5997e5; border-radius: 10px; background: var(--bg,#20242c); z-index: 2; }
.cur-table-scroll { max-width: 100%; min-width: 0; overflow-x: auto; }
.cur-panel table { width: 100%; border-collapse: collapse; text-align: left; }
.cur-panel th,.cur-panel td { padding: 10px; border-bottom: 1px solid #8883; vertical-align: top; }
@media(max-width:600px) { .cur-counts { grid-template-columns: repeat(2,minmax(0,1fr)); } .cur-row,.cur-panel { padding: 12px; } .cur-toolbar > *,.cur-bulk > * { max-width: 100%; min-width: 0; } .cur-toolbar button,.cur-bulk button { white-space: normal; overflow-wrap: anywhere; } }

.module-group { min-width: 0; }
.module-group-header { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; width: 100%; min-width: 0; padding: 8px; border: 0; background: transparent; color: inherit; text-align: left; cursor: pointer; }
.module-group-header > span { overflow-wrap: anywhere; }


/* Phone navigation is independent of the desktop pane preferences. */
.mobile-app-bar, .mobile-bottom-nav, .mobile-backdrop, .mobile-overlay-close, .mobile-grab { display: none; }
@media (max-width: 768px) {
  html, body { max-width: 100%; overflow-x: hidden; }
  .app, .app.left-closed, .app.right-closed, .app.left-closed.right-closed {
    display: flex; flex-direction: column; width: 100%; height: 100dvh; min-width: 0;
    padding-bottom: calc(56px + env(safe-area-inset-bottom, 0px)); overflow: hidden;
  }
  .mobile-app-bar { display: flex; align-items: center; gap: 8px; flex: none; position: sticky; top: 0; min-height: 52px; padding: 4px 8px; background: var(--bg-side); border-bottom: 1px solid var(--border); z-index: 30; }
  .mobile-app-bar > span { flex: 1; font-weight: 600; }
  .mobile-app-bar button, .mobile-bottom-nav button, .mobile-overlay-close { min-height: 44px; min-width: 44px; border: 0; border-radius: 8px; background: var(--bg-side); color: var(--text); }
  .mobile-bottom-nav { display: flex; position: fixed; inset: auto 0 0; z-index: 30; background: var(--bg-side); border-top: 1px solid var(--border); padding: 6px 4px calc(6px + env(safe-area-inset-bottom, 0px)); }
  .mobile-bottom-nav button { flex: 1; }
  .mobile-backdrop { display: block; position: fixed; inset: 0; z-index: 80; border: 0; background: rgb(0 0 0 / 48%); }
  .app .left, .app .right { position: fixed; z-index: 90; visibility: hidden; pointer-events: none; overflow: hidden; transition: transform .2s ease; border: 1px solid var(--border); }
  .app .left { inset: 0 auto 0 0; width: min(86vw, 340px); height: 100dvh; transform: translateX(-100%); }
  .app .right { inset: auto 0 0; width: 100%; max-height: 85dvh; border-radius: 18px 18px 0 0; transform: translateY(100%); padding-bottom: env(safe-area-inset-bottom, 0px); }
  .app.mobile-drawer .left, .app.mobile-sheet .right { visibility: visible; pointer-events: auto; transform: translate(0); }
  .mobile-overlay-close { display: block; flex: none; align-self: flex-end; margin: 4px 8px; }
  .mobile-grab { display: block; flex: none; width: 40px; height: 4px; border-radius: 4px; background: var(--border-strong); margin: 10px auto 0; }
  .right-body { min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
  .left .trash { display: none; }
  .center { flex: 1; width: 100%; min-height: 0; overflow: hidden; }
  .topbar > .icon-btn { display: none; }
  .topbar { min-width: 0; padding: 4px; }
  .tabs { flex-wrap: nowrap; overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: thin; }
  .tab { flex: 0 0 auto; min-height: 44px; }
  .panes, .pane, .pane-scroll { min-width: 0; max-width: 100%; }
  .pane-scroll, .pane-scroll.wide, .pane-scroll.narrow { padding: 12px 10px 24px; overflow-x: hidden; }
  .grid, .grid.providers, .widgets, .widgets.compact { grid-template-columns: minmax(0, 1fr); }
  .card, .widget, form, fieldset { min-width: 0; max-width: 100%; }
  input:not([type=checkbox]):not([type=color]), select, textarea { max-width: 100%; min-width: 0; min-height: 40px; font-size: 16px; }
  button, .icon-btn, .icon-btn.tiny, .tab-x, .chev, .view-item, .mod-main { min-width: 40px; min-height: 40px; }
  .pane-head, .row.gap { flex-wrap: wrap; }
  .table-wrap { max-width: 100%; overflow-x: auto; }
  table { display: block; max-width: 100%; overflow-x: auto; }
  pre { max-width: 100%; overflow-x: auto; }
  img, iframe { max-width: 100%; }
}
@media (max-width: 768px) and (prefers-reduced-motion: reduce) {
  .app, .app .left, .app .right { transition: none; }
}

/* Dashboard cards keep their controls visible while the preview clips. */


.mod-wrap { --module-motion: 1; transition: transform 150ms ease; }
.mod-wrap.drag-gap { transform: translateY(40px); }
@media (prefers-reduced-motion: reduce) {
  .mod-wrap { --module-motion: 0; transition: none !important; transform: none !important; }
}

/* Compact dashboard (SPEC-P19): the center panel is the responsive container. */
.dash-summary { container-type: inline-size; color: var(--text); }
.dash-kpis { display: grid; grid-template-columns: 1.1fr 1.6fr .85fr .85fr; gap: 8px; margin: 12px 0 0; }
.dash-kpi, .dash-glance, .dash-tile { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--text); text-align: left; font: inherit; min-width: 0; box-shadow: none; box-sizing: border-box; }
.dash-kpi { padding: 10px 12px; display: flex; flex-direction: column; gap: 3px; font-size: 12px; min-height: 96px; line-height: 1.2; }
.dash-kpi.has-pending { border-top: 3px solid var(--warn); }
.dash-summary strong { font-size: 24px; font-weight: 650; line-height: 1.15; font-variant-numeric: tabular-nums; }
.dash-summary small { font-size: 11px; color: var(--muted); font-weight: 400; }
.dash-kpi > small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: none; }
.dash-segments { display: flex; height: 6px; flex: none; gap: 2px; border-radius: 3px; overflow: hidden; margin-top: auto; }
.dash-legend { display: flex; flex-wrap: wrap; gap: 2px 8px; font-size: 10.5px; color: var(--muted); }
.dash-legend span { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.dash-legend i { width: 6px; height: 6px; border-radius: 50%; flex: none; }
.dash-kpi.dash-activity { flex-direction: row; align-items: stretch; gap: 10px; }
.dash-activity-value { display: flex; flex-direction: column; gap: 3px; flex: none; min-width: 0; }
.dash-activity-value small { white-space: nowrap; }
.dash-activity-chart { flex: 1; min-width: 0; display: flex; flex-direction: column; justify-content: flex-end; gap: 4px; }
.dash-activity-chart .dash-legend { justify-content: flex-end; }
.dash-bars { height: 44px; width: 100%; display: block; }
.dash-h { font-size: 12px; font-weight: 600; color: var(--muted); margin: 14px 0 6px; }
.dash-h span { font-weight: 400; }
.dash-section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.dash-section-head button { font: inherit; font-size: 11px; color: var(--muted); background: transparent; border: 0; cursor: pointer; }
.dash-glances { display: grid; grid-template-columns: repeat(auto-fill, minmax(124px, 1fr)); gap: 8px; }
.dash-glances:empty { display: none; }
.dash-glance { padding: 9px 10px; display: flex; flex-direction: column; gap: 3px; font-size: 12px; cursor: pointer; }
.dash-glance strong { font-size: 20px; }
.dash-glance small { display: flex; align-items: center; gap: 5px; font-size: 11px; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dash-glance small .dot { margin-right: 4px; }
.dash-glance-label { font-size: 11.5px; color: var(--muted); }
.dash-spark { height: 22px; width: 100%; margin-top: auto; }
.dash-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 8px; }
.dash-tile { height: 52px; display: flex; align-items: center; gap: 9px; padding: 8px 10px; cursor: pointer; }
.dash-tile > div { min-width: 0; flex: 1; }
.dash-tile b, .dash-tile small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dash-tile b { font-size: 13px; font-weight: 600; }
.dash-tile small { margin-top: 2px; font-size: 11.5px; }
.dash-tile .dot { margin-right: 5px; }
.dash-badge { font-size: 11px; border: 1px solid var(--border); padding: 2px 5px; border-radius: 5px; font-variant-numeric: tabular-nums; }
.dash-summary button:hover { background: color-mix(in srgb, var(--text) 4%, var(--bg-card)); }
.dash-summary button[aria-pressed="true"] { box-shadow: inset 0 0 0 1px var(--border-strong); }
.dash-summary button:focus-visible, .dash-view button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.dash-view:has(button:focus-visible) { overflow: visible; }
.dash-view { margin-left: auto; display: flex; border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; }
.dash-view button { border: 0; background: transparent; color: var(--muted); padding: 5px 10px; font-size: 12px; cursor: pointer; }
.dash-view button[aria-pressed="true"] { background: var(--bg-active); color: var(--text); }
/* narrow center panel: the two charts take a full row each, the two counts share one */
@container (max-width: 640px) {
  .dash-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dash-health, .dash-activity { grid-column: 1 / -1; min-height: 0; }
  .dash-health .dash-segments { margin-top: 4px; }
}

.dashboard-grid { align-items: stretch; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(min(320px, 100%), 1fr)); }
.dashboard-grid .modcard { box-sizing: border-box; min-width: 0; display: flex; flex-direction: column; }
.dashboard-grid .modcard.expanded { grid-column: 1 / -1; }
.modcard > .card-head, .modcard > .card-foot { flex: none; min-width: 0; }
.modcard .card-head { flex-wrap: nowrap; gap: 8px; margin-bottom: 12px; }
.modcard .card-title { min-width: 80px; }
.modcard .name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.modcard-body { min-height: 0; min-width: 0; overflow: hidden; max-height: 168px; margin-bottom: 10px; }
.modcard.expanded .modcard-body { overflow: visible; max-height: none; }
.modcard-toggle svg { transition: transform 200ms ease; }
.modcard.expanded .modcard-toggle svg { transform: rotate(180deg); }
.modcard-content { min-width: 0; overflow-wrap: anywhere; }
.modcard .widgets { grid-template-columns: repeat(auto-fill, minmax(min(260px, 100%), 1fr)); }
.modcard-content pre { max-width: 100%; overflow: auto; }
@media (max-width: 768px) { .dashboard-grid { grid-template-columns: minmax(0, 1fr); } }
@media (prefers-reduced-motion: reduce) { .modcard-toggle svg { transition: none; } }
/* Detail dashboard: quiet surfaces, compact rows, accessible controls. */
.modcard { container-type: inline-size; border-left: 3px solid var(--border); }
.modcard.detail-warn { border-left-color: var(--warn); }
.modcard.detail-down { border-left-color: var(--down); }
.modcard-open { background: none; border: 0; padding: 0; text-align: left; color: inherit; flex: 1; overflow: hidden; cursor: pointer; }
.modcard-status { display: inline-flex; gap: 4px; align-items: center; color: var(--muted); font-size: 11px; white-space: nowrap; margin-left: auto; }
.modcard .card-head > .icon-btn { opacity: .65; }
.modcard:hover .card-head > .icon-btn, .modcard:focus-within .card-head > .icon-btn { opacity: 1; }
.modcard-last { display: flex; gap: 6px; align-items: center; min-width: 0; flex: 1 1 auto; font-size: 12px; overflow: hidden; border: 0; padding: 0; background: none; color: var(--text); cursor: pointer; text-align: left; }
.modcard-last .ellipsis { flex: 1; }
.modcard-last:hover .ellipsis { text-decoration: underline; }
.modcard-last .ai-tag { color: var(--muted); background: none; font-size: 10px; text-decoration: none; }
.modcard .card-foot { margin-top: auto; padding-top: 9px; flex-wrap: nowrap; gap: 6px; }
.modcard .card-foot > .btn { background: none; padding: 3px 7px; font-size: 11px; flex: none; color: var(--muted); border-color: transparent; }
.detail-widgets.compact { display: flex; flex-wrap: wrap; gap: 8px; }
.detail-widgets.compact > .widget { flex: 1 1 140px; }
.detail-status-chip { display: inline-flex; gap: 5px; align-items: center; font-size: 11px; }
.modcard .dash-glances { margin-bottom: 8px; grid-template-columns: repeat(auto-fill, minmax(min(260px, 100%), 1fr)); }
.dash-module-list { display: grid; grid-template-columns: repeat(auto-fill,minmax(min(320px,100%),1fr)); gap: 0 16px; }
.dash-module-row { display: flex; align-items: center; gap: 5px; min-width: 0; min-height: 40px; border-bottom: 1px solid var(--border); }
.dash-row-main { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; border: 0; padding: 8px 0; background: none; color: var(--text); cursor: pointer; text-align: left; }
.dash-row-main > .ellipsis { flex: 1; min-width: 0; }
.dash-module-row .pill { font-size: 10px; padding: 2px 4px; }
.dash-detail button:focus-visible, .detail-filters button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.detail-filters { display: flex; gap: 4px; flex-wrap: wrap; }
.detail-filters button { background: none; border: 1px solid transparent; border-radius: 5px; color: var(--muted); padding: 4px 8px; font-size: 12px; cursor: pointer; }
.detail-filters button[aria-pressed="true"] { border-color: var(--border); color: var(--text); }
@media (hover:none) { .modcard .card-head > .icon-btn { opacity: 1; } }
@container (max-width: 300px) { .modcard-status { max-width: 72px; overflow: hidden; } }

.modcard-body.overflowing { mask-image: linear-gradient(to bottom, var(--text) calc(100% - 20px), transparent); }
.modcard-status .dot.ok, .detail-status-chip .dot.ok, .dash-row-main .dot.ok { background: var(--muted); }
.modcard-status:has(.dot.warn), .detail-status-chip:has(.dot.warn) { color: var(--warn); }
.modcard-status:has(.dot.down), .detail-status-chip:has(.dot.down) { color: var(--down); }

.dash-detail .modcard { padding: 14px 16px 12px; }
.modcard-last .muted.small { white-space: nowrap; }
.modcard .card-foot > .pill { white-space: nowrap; flex: none; }
.modcard .card-foot > .btn:hover { color: var(--text); border-color: var(--border); }
.modcard .card-foot > .muted.small { flex: 1; }
/* status chips sit on their own first line above the compact widget cards */
.detail-widgets.compact > .detail-status-chip { order: -1; padding: 3px 8px 3px 6px; border: 1px solid var(--border); border-radius: 999px; background: var(--bg); }
.detail-widgets.compact > .widget { order: 1; }
.detail-widgets.compact:has(> .detail-status-chip):has(> .widget)::before { content: ""; flex-basis: 100%; height: 0; order: 0; margin-top: -4px; }
.detail-widgets:empty { display: none; }
/* glance inside a card: value | label + hint | sparkline, module name hidden (the card already says it) */
.modcard .dash-glance { min-width: 0; display: grid; grid-template-columns: auto minmax(0, 1fr) minmax(72px, 38%); grid-template-rows: auto auto; column-gap: 12px; row-gap: 1px; align-items: center; padding: 10px 12px; background: var(--bg); }
.modcard .dash-glance > small:first-child { display: none; }
.modcard .dash-glance > strong { grid-row: 1 / 3; grid-column: 1; font-size: 22px; line-height: 1; }
.modcard .dash-glance > .dash-glance-label { grid-column: 2; grid-row: 1; }
.modcard .dash-glance > small:not(:first-child) { grid-column: 2; grid-row: 2; color: var(--muted); }
.modcard .dash-glance > .dash-spark { grid-column: 3; grid-row: 1 / 3; height: 30px; margin: 0; }
.modcard .dash-glance:not(:has(.dash-glance-label)) > small:not(:first-child) { grid-row: 1 / 3; }

.modcard-open > span { display: block; }
.modcard-body button:focus-visible { outline-offset: -2px; }
/* row tools stay in the tab order and layout; they brighten on hover / keyboard focus */
.dash-module-row > .icon-btn { opacity: .55; }
.dash-module-row:hover > .icon-btn, .dash-module-row:focus-within > .icon-btn { opacity: 1; }
@media (hover:none) { .dash-module-row > .icon-btn { opacity: 1; } }
.dash-row-time { border: 0; background: none; color: var(--muted); font-size: 10px; white-space: nowrap; cursor: pointer; }
.dash-glance-hint { min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
@container (max-width: 300px) { .modcard .card-foot { flex-wrap: wrap; } }

/* Account module grants: keep the matrix inside its own scroll area. */
.access-pane { min-width: 0; }
.access-pane .table-wrap { max-width: 100%; overflow-x: auto; margin-top: 16px; }
.access-pane .users-table { min-width: 640px; }
.access-pane .row { flex-wrap: wrap; }
.access-pane .card { margin-top: 20px; padding: 16px; }
.access-pane .field { margin-top: 12px; }
.access-pane .perm-pick { flex-wrap: wrap; }
@media (max-width: 600px) {
  .access-pane .btn { white-space: normal; }
  .access-pane select { max-width: 100%; }
  .access-pane .card { padding: 12px; }
}
