@charset "UTF-8";

:root {
  --obsidian: #0f172a;
  --obsidian-2: #1e293b;
  --obsidian-line: rgba(255, 255, 255, 0.11);
  --canvas: #eef1f5;
  --surface: #ffffff;
  --surface-subtle: #f7f8fa;
  --paper: #fcfbf8;
  --paper-tint: #f5f3ed;
  --ink: #0f172a;
  --ink-2: #334155;
  --muted: #64748b;
  --muted-2: #94a3b8;
  --line: #dce2ec;
  --line-strong: #c5cfde;
  --brand: #1d4ed8;
  --brand-hover: #1e40af;
  --brand-soft: #eff6ff;
  --brand-border: #bfdbfe;
  --crimson: #be123c;
  --crimson-soft: #fff1f2;
  --crimson-border: #fecdd3;
  --amber: #b45309;
  --amber-soft: #fffbeb;
  --amber-border: #fde68a;
  --emerald: #047857;
  --emerald-soft: #ecfdf5;
  --emerald-border: #a7f3d0;
  --violet: #4338ca;
  --violet-soft: #eef2ff;
  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 14px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
  --shadow-md: 0 8px 24px -6px rgba(15, 23, 42, 0.08), 0 2px 6px rgba(15, 23, 42, 0.04);
  --shadow-paper: 0 12px 32px -10px rgba(15, 23, 42, 0.12), 0 1px 3px rgba(15, 23, 42, 0.08);
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --font-serif-zh: "Songti SC", "STSong", "Noto Serif CJK SC", "Source Han Serif SC", Georgia, serif;
  --font-serif-en: "Georgia", "Times New Roman", "Songti SC", serif;
  --font-mono: "SFMono-Regular", "JetBrains Mono", Menlo, Monaco, Consolas, monospace;
}

*, *::before, *::after {
  box-sizing: border-box;
}

html {
  font-size: 14px;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--canvas);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.55;
  font-synthesis: none;
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  background: none;
  border: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
a:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

svg.ic {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.mono {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

.num {
  font-variant-numeric: tabular-nums;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ==========================================================================
   TOP COMMAND HEADER (IDE STUDIO BAR)
   ========================================================================== */
.studio-shell {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

.command-bar {
  position: sticky;
  top: 0;
  z-index: 40;
  min-height: 58px;
  padding: 0 20px;
  background: var(--obsidian);
  color: #f8fafc;
  border-bottom: 1px solid #1e293b;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand-cluster {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.brand-id {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.brand-glyph {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: linear-gradient(145deg, #2563eb, #1d4ed8);
  border: 1px solid rgba(255, 255, 255, 0.22);
  display: grid;
  place-items: center;
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.35);
}

.brand-title {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}

.brand-title strong {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: #ffffff;
}

.brand-title span {
  font-family: var(--font-mono);
  font-size: 11px;
  color: #94a3b8;
  letter-spacing: 0.06em;
}

.header-divider {
  width: 1px;
  height: 24px;
  background: var(--obsidian-line);
  flex-shrink: 0;
}

.deal-selector-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  padding: 4px 10px;
  min-width: 0;
}

.deal-code-pill {
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 600;
  color: #93c5fd;
  background: rgba(59, 130, 246, 0.18);
  padding: 2px 7px;
  border-radius: 5px;
  white-space: nowrap;
}

.deal-select {
  appearance: none;
  -webkit-appearance: none;
  border: 0;
  background: transparent;
  color: #f1f5f9;
  font-size: 13px;
  font-weight: 500;
  padding: 3px 22px 3px 2px;
  max-width: 280px;
  text-overflow: ellipsis;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 2px center;
}

.deal-select option {
  color: var(--ink);
  background: #ffffff;
}

.primary-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  background: rgba(255, 255, 255, 0.05);
  padding: 4px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.nav-tab {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 13px;
  border-radius: 7px;
  color: #cbd5e1;
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  transition: background 0.16s, color 0.16s;
}

.nav-tab:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.07);
}

.nav-tab.active {
  color: #ffffff;
  background: #2563eb;
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.35);
}

.nav-badge {
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.15);
  color: #ffffff;
}

.nav-tab:not(.active) .nav-badge.alert {
  background: rgba(244, 63, 94, 0.24);
  color: #fda4af;
}

.command-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.sandbox-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 99px;
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.28);
  color: #6ee7b7;
  font-size: 12px;
  white-space: nowrap;
}

.sandbox-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #10b981;
}

.role-switcher {
  display: flex;
  align-items: center;
  gap: 7px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  padding: 4px 10px 4px 6px;
}

.role-chip-avatar {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  background: #3b82f6;
  color: #ffffff;
  font-size: 12px;
  font-weight: 700;
  display: grid;
  place-items: center;
}

.role-chip-avatar.qc {
  background: #0d9488;
}

.role-chip-avatar.pm {
  background: #6366f1;
}

.role-select {
  appearance: none;
  -webkit-appearance: none;
  border: 0;
  background: transparent;
  color: #f8fafc;
  font-size: 12.5px;
  font-weight: 500;
  padding: 2px 18px 2px 2px;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='13' height='13' viewBox='0 0 24 24' fill='none' stroke='%23cbd5e1' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0 center;
}

.role-select option {
  color: var(--ink);
  background: #ffffff;
}

.top-icon-btn {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.05);
  color: #cbd5e1;
  display: inline-grid;
  place-items: center;
  transition: background 0.15s, color 0.15s;
}

.top-icon-btn:hover {
  background: rgba(255, 255, 255, 0.14);
  color: #ffffff;
}

/* ==========================================================================
   PROJECT RIBBON / CONTEXT STRIP
   ========================================================================== */
.project-ribbon {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  padding: 10px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.ribbon-left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  min-width: 0;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 99px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.status-pill::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.status-review {
  background: var(--amber-soft);
  color: var(--amber);
  border: 1px solid var(--amber-border);
}

.status-qc {
  background: var(--brand-soft);
  color: var(--brand);
  border: 1px solid var(--brand-border);
}

.status-sealed {
  background: var(--emerald-soft);
  color: var(--emerald);
  border: 1px solid var(--emerald-border);
}

.status-returned {
  background: var(--crimson-soft);
  color: var(--crimson);
  border: 1px solid var(--crimson-border);
}

.ribbon-deal-picker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px 4px 6px;
  border-radius: 8px;
  background: var(--surface-subtle);
  border: 1px solid var(--line-strong);
  max-width: 100%;
  min-width: 0;
  overflow: hidden;
}

.ribbon-deal-picker .deal-code-pill {
  background: var(--brand-soft);
  color: var(--brand);
  border: 1px solid var(--brand-border);
}

.ribbon-deal-select {
  appearance: none;
  -webkit-appearance: none;
  border: 0;
  background: transparent;
  color: var(--ink);
  font-size: 14px;
  font-weight: 650;
  padding: 2px 22px 2px 2px;
  max-width: 420px;
  min-width: 0;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23475569' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 2px center;
}

.ribbon-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  font-size: 12.5px;
  flex-wrap: wrap;
}

.ribbon-meta span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.ribbon-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.progress-inline {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 5px 12px;
  border-radius: 8px;
  background: var(--surface-subtle);
  border: 1px solid var(--line);
  font-size: 12.5px;
}

.progress-bar-mini {
  width: 88px;
  height: 6px;
  background: #e2e8f0;
  border-radius: 99px;
  overflow: hidden;
}

.progress-bar-mini > span {
  display: block;
  height: 100%;
  background: var(--brand);
  border-radius: inherit;
  transition: width 0.25s ease;
}

.progress-bar-mini.done > span {
  background: var(--emerald);
}

/* ==========================================================================
   BUTTONS & BADGES
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 36px;
  padding: 7px 14px;
  border-radius: 8px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink-2);
  font-size: 13px;
  font-weight: 550;
  white-space: nowrap;
  transition: background 0.15s, border-color 0.15s, color 0.15s, transform 0.1s;
}

.btn:hover:not(:disabled) {
  background: var(--surface-subtle);
  border-color: #94a3b8;
  color: var(--ink);
}

.btn:active:not(:disabled) {
  transform: translateY(1px);
}

.btn-primary {
  background: var(--brand);
  border-color: var(--brand);
  color: #ffffff;
  box-shadow: 0 2px 6px rgba(29, 78, 216, 0.22);
}

.btn-primary:hover:not(:disabled) {
  background: var(--brand-hover);
  border-color: var(--brand-hover);
  color: #ffffff;
}

.btn-emerald {
  background: var(--emerald);
  border-color: var(--emerald);
  color: #ffffff;
  box-shadow: 0 2px 6px rgba(4, 120, 87, 0.22);
}

.btn-emerald:hover:not(:disabled) {
  background: #065f46;
  border-color: #065f46;
  color: #ffffff;
}

.btn-crimson {
  background: #ffffff;
  border-color: #fda4af;
  color: var(--crimson);
}

.btn-crimson:hover:not(:disabled) {
  background: var(--crimson-soft);
  border-color: #fb7185;
}

.btn-soft {
  background: var(--brand-soft);
  border-color: var(--brand-border);
  color: var(--brand);
}

.btn-soft:hover:not(:disabled) {
  background: #dbeafe;
  border-color: #93c5fd;
}

.btn-sm {
  min-height: 31px;
  padding: 5px 11px;
  font-size: 12.5px;
  border-radius: 7px;
}

.sev-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px;
  border-radius: 5px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.sev-critical {
  background: var(--crimson-soft);
  color: var(--crimson);
  border: 1px solid var(--crimson-border);
}

.sev-high {
  background: #fff7ed;
  color: #c2410c;
  border: 1px solid #fed7aa;
}

.sev-medium {
  background: var(--amber-soft);
  color: var(--amber);
  border: 1px solid var(--amber-border);
}

.sev-low {
  background: var(--violet-soft);
  color: var(--violet);
  border: 1px solid #c7d2fe;
}

.cat-tag {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 5px;
  background: #f1f5f9;
  color: var(--ink-2);
  font-size: 12px;
  font-weight: 500;
}

/* ==========================================================================
   VIEW 01: PROOFING STUDIO (3-PANE DOCUMENT IDE)
   ========================================================================== */
.studio-workbench {
  flex: 1;
  display: grid;
  grid-template-columns: 244px minmax(0, 1fr) 416px;
  height: calc(100dvh - 114px);
  min-height: 620px;
  overflow: hidden;
}

/* Left Pane: Chapter & Tie-Out Navigator */
.outline-pane {
  background: var(--surface);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

.pane-header {
  padding: 13px 16px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.pane-header h2 {
  margin: 0;
  font-size: 13px;
  font-weight: 650;
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: 7px;
}

.pane-sub {
  font-size: 12px;
  color: var(--muted);
}

.section-nav-list {
  padding: 10px;
  display: grid;
  gap: 6px;
  overflow-y: auto;
}

.section-card-btn {
  width: 100%;
  text-align: left;
  padding: 11px 12px;
  border-radius: 9px;
  border: 1px solid transparent;
  background: transparent;
  transition: background 0.15s, border-color 0.15s;
}

.section-card-btn:hover {
  background: var(--surface-subtle);
  border-color: var(--line);
}

.section-card-btn.active {
  background: var(--brand-soft);
  border-color: var(--brand-border);
}

.sec-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin-bottom: 5px;
}

.sec-page {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  color: var(--brand);
}

.sec-counts {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-family: var(--font-mono);
  font-size: 11.5px;
}

.sec-pill-open {
  padding: 1px 6px;
  border-radius: 99px;
  background: var(--crimson-soft);
  color: var(--crimson);
  border: 1px solid var(--crimson-border);
  font-weight: 600;
}

.sec-pill-done {
  padding: 1px 6px;
  border-radius: 99px;
  background: var(--emerald-soft);
  color: var(--emerald);
  font-weight: 600;
}

.sec-title-zh {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.4;
}

.sec-title-en {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tieout-radar-box {
  margin: auto 10px 12px;
  padding: 13px;
  border-radius: 10px;
  background: #f8fafc;
  border: 1px solid var(--line);
}

.radar-title {
  font-size: 12.5px;
  font-weight: 650;
  color: var(--ink);
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.radar-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12.5px;
  padding: 5px 0;
  border-top: 1px dashed #e2e8f0;
  color: var(--ink-2);
}

.radar-row:first-of-type {
  border-top: 0;
}

.radar-val {
  font-family: var(--font-mono);
  font-weight: 600;
}

.radar-val.ok { color: var(--emerald); }
.radar-val.warn { color: var(--crimson); }

/* Center Pane: Bilingual Proof Galley Canvas */
.canvas-pane {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  background: #e6ebf2;
}

.canvas-toolbar {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  padding: 9px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.segmented {
  display: inline-flex;
  background: #eef2f6;
  padding: 3px;
  border-radius: 8px;
  border: 1px solid var(--line);
}

.seg-btn {
  padding: 5px 11px;
  border-radius: 6px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.seg-btn.active {
  background: var(--surface);
  color: var(--ink);
  font-weight: 600;
  box-shadow: var(--shadow-sm);
}

.canvas-tools-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.galley-scroll {
  flex: 1;
  padding: 24px 26px 36px;
  overflow-y: auto;
}

.proof-sheet {
  max-width: 1040px;
  margin: 0 auto;
  background: var(--paper);
  border: 1px solid #d6d3c9;
  border-radius: 4px;
  box-shadow: var(--shadow-paper);
  position: relative;
  padding: 32px 38px 36px;
}

/* Printer Proof Running Header */
.proof-running-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 12px;
  margin-bottom: 22px;
  border-bottom: 2px solid #1e293b;
  font-size: 12px;
  color: var(--muted);
}

.proof-stamp {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 600;
  color: #334155;
  background: var(--paper-tint);
  border: 1px solid #d6d3c9;
  padding: 3px 8px;
  border-radius: 4px;
}

.proof-sec-heading {
  margin-bottom: 20px;
  padding-bottom: 14px;
  border-bottom: 1px solid #e5e2d9;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.proof-sec-heading h3 {
  margin: 0;
  font-family: var(--font-serif-zh);
  font-size: 20px;
  font-weight: 700;
  color: #111827;
}

.proof-sec-heading span {
  font-family: var(--font-serif-en);
  font-size: 15px;
  font-style: italic;
  color: #475569;
}

.bilingual-col-headers {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) minmax(0, 1fr);
  gap: 20px;
  padding: 7px 12px;
  margin-bottom: 12px;
  background: var(--paper-tint);
  border: 1px solid #e4e1d7;
  border-radius: 5px;
  font-size: 12px;
  font-weight: 600;
  color: #475569;
}

.proof-sheet.mode-single .bilingual-col-headers {
  display: none;
}

/* Clause Block */
.clause-row {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) minmax(0, 1fr);
  gap: 20px;
  padding: 14px 12px;
  border-bottom: 1px solid #ece9df;
  border-radius: 6px;
  transition: background 0.16s;
}

.clause-row:last-of-type {
  border-bottom: 0;
}

.clause-row:hover {
  background: rgba(241, 245, 249, 0.65);
}

.clause-row.has-selected {
  background: #eff6ff;
  box-shadow: inset 3px 0 0 var(--brand);
}

.proof-sheet.mode-single .clause-row {
  grid-template-columns: 38px minmax(0, 1fr);
  gap: 12px;
}

.proof-sheet.mode-single .clause-en {
  grid-column: 2;
  padding-top: 8px;
  border-top: 1px dashed #e5e2d9;
}

.line-num {
  font-family: var(--font-mono);
  font-size: 12px;
  color: #94a3b8;
  padding-top: 3px;
  user-select: none;
}

.clause-zh {
  font-family: var(--font-serif-zh);
  font-size: 14.5px;
  line-height: 1.85;
  color: #1e293b;
  min-width: 0;
}

.clause-en {
  font-family: var(--font-serif-en);
  font-size: 14px;
  line-height: 1.78;
  color: #334155;
  min-width: 0;
}

/* Financial Statement Table inside Galley Proof */
.clause-table-row {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  gap: 16px;
  padding: 16px 12px;
  border-bottom: 1px solid #ece9df;
}

.clause-table-row.has-selected {
  background: #eff6ff;
  box-shadow: inset 3px 0 0 var(--brand);
  border-radius: 6px;
}

.fin-table-wrap {
  overflow-x: auto;
  border: 1px solid #d6d3c9;
  border-radius: 6px;
  background: #ffffff;
}

.fin-table-caption {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 9px 14px;
  background: #f8f7f3;
  border-bottom: 1px solid #e2dfd5;
  font-family: var(--font-sans);
  font-size: 12.5px;
  color: #475569;
}

.fin-table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--font-sans);
  font-size: 13px;
}

.fin-table th {
  padding: 9px 12px;
  background: #f4f3ee;
  border-bottom: 1.5px solid #334155;
  color: #1e293b;
  font-weight: 650;
  text-align: right;
  white-space: nowrap;
}

.fin-table th:first-child {
  text-align: left;
}

.fin-table td {
  padding: 9px 12px;
  border-bottom: 1px solid #ebe8df;
  color: #1e293b;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.fin-table td:first-child {
  text-align: left;
}

.fin-table td .en-sub {
  display: block;
  font-size: 12px;
  color: #64748b;
  margin-top: 1px;
}

.fin-table tr.total-row td {
  font-weight: 700;
  background: #faf9f5;
  border-top: 1.5px solid #475569;
  border-bottom: 3px double #334155;
}

/* Interactive Issue Anchor Spans inside Document */
.proof-anchor {
  display: inline;
  padding: 2px 5px;
  margin: 0 1px;
  border-radius: 4px;
  font: inherit;
  line-height: 1.4;
  cursor: pointer;
  border-bottom: 2px solid var(--crimson);
  background: #ffe4e6;
  color: #881337;
  transition: box-shadow 0.15s, background 0.15s;
}

.proof-anchor.sev-medium,
.proof-anchor.sev-low {
  border-bottom-color: #d97706;
  background: #fef3c7;
  color: #78350f;
}

.proof-anchor:hover {
  box-shadow: 0 0 0 3px rgba(190, 18, 60, 0.18);
}

.proof-anchor.selected {
  box-shadow: 0 0 0 3px rgba(29, 78, 216, 0.35);
  outline: 1.5px solid var(--brand);
}

.proof-anchor.state-applied {
  border-bottom: 2px solid var(--emerald);
  background: #d1fae5;
  color: #065f46;
}

.proof-anchor.state-waived {
  border-bottom: 2px dashed #64748b;
  background: #f1f5f9;
  color: #334155;
}

.proof-anchor.state-rfi {
  border-bottom: 2px dotted #6366f1;
  background: #e0e7ff;
  color: #312e81;
}

.anchor-tag {
  display: inline-block;
  margin-left: 4px;
  padding: 0 5px;
  border-radius: 3px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  vertical-align: baseline;
  background: rgba(15, 23, 42, 0.12);
}

.proof-running-foot {
  margin-top: 24px;
  padding-top: 12px;
  border-top: 1px solid #dcd9cf;
  display: flex;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 12px;
  color: #64748b;
}

/* Right Pane: Evidence & Resolution Inspector */
.inspector-pane {
  background: var(--surface);
  border-left: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

.inspector-filter-bar {
  padding: 8px 14px;
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  background: var(--surface-subtle);
  flex-shrink: 0;
}

.chip-btn {
  padding: 4px 9px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  border: 1px solid transparent;
}

.chip-btn:hover {
  color: var(--ink);
  background: #e2e8f0;
}

.chip-btn.active {
  background: var(--surface);
  color: var(--brand);
  border-color: var(--brand-border);
  font-weight: 600;
  box-shadow: var(--shadow-sm);
}

.issue-queue-list {
  max-height: 196px;
  flex-shrink: 0;
  overflow-y: auto;
  border-bottom: 1px solid var(--line);
}

.issue-queue-item {
  width: 100%;
  text-align: left;
  padding: 11px 15px;
  border-bottom: 1px solid #eef2f6;
  background: var(--surface);
  transition: background 0.14s;
}

.issue-queue-item:hover {
  background: #f8fafc;
}

.issue-queue-item.selected {
  background: var(--brand-soft);
  box-shadow: inset 3px 0 0 var(--brand);
}

.iq-head {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 5px;
}

.iq-loc {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--muted);
}

.iq-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.42;
}

.iq-state-pill {
  font-size: 11.5px;
  font-weight: 600;
}

.iq-state-open { color: var(--crimson); }
.iq-state-applied { color: var(--emerald); }
.iq-state-waived { color: var(--muted); }
.iq-state-rfi { color: var(--violet); }

/* Detailed Evidence Card */
.inspector-detail {
  flex: 1;
  padding: 16px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 13px;
}

.detail-top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.rule-code-badge {
  font-family: var(--font-mono);
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 5px;
  background: #f1f5f9;
  color: #475569;
  border: 1px solid var(--line);
}

.detail-heading {
  margin: 0;
  font-size: 15px;
  font-weight: 650;
  color: var(--ink);
  line-height: 1.45;
}

.detail-rationale {
  margin: 0;
  font-size: 13px;
  color: var(--ink-2);
  line-height: 1.6;
}

/* Tie-Out Evidence Matrix */
.evidence-matrix {
  border: 1px solid var(--line);
  border-radius: 9px;
  overflow: hidden;
  background: var(--surface-subtle);
}

.matrix-head {
  padding: 8px 12px;
  background: #eef2f6;
  border-bottom: 1px solid var(--line);
  font-size: 12px;
  font-weight: 650;
  color: var(--ink-2);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.matrix-row {
  padding: 9px 12px;
  border-bottom: 1px solid #e5eaf1;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
  font-size: 12.5px;
  background: var(--surface);
}

.matrix-row:last-child {
  border-bottom: 0;
}

.matrix-row.conflict {
  background: #fff1f2;
}

.matrix-row.authority {
  background: #ecfdf5;
}

.matrix-src {
  color: var(--ink-2);
  font-weight: 500;
}

.matrix-val {
  font-family: var(--font-mono);
  font-weight: 650;
  text-align: right;
}

.matrix-row.conflict .matrix-val { color: var(--crimson); }
.matrix-row.authority .matrix-val { color: var(--emerald); }

/* Proposed Edit Box */
.proposal-card {
  border: 1px solid var(--brand-border);
  background: #f8fbff;
  border-radius: 9px;
  padding: 12px;
}

.proposal-label {
  font-size: 12px;
  font-weight: 650;
  color: var(--brand);
  margin-bottom: 6px;
  display: flex;
  justify-content: space-between;
}

.proposal-input {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: #ffffff;
  font-size: 13px;
  line-height: 1.5;
  resize: vertical;
  min-height: 54px;
}

.memo-input {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
  font-size: 12.5px;
  resize: vertical;
  min-height: 48px;
}

.action-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.resolution-banner {
  padding: 11px 12px;
  border-radius: 8px;
  background: var(--emerald-soft);
  border: 1px solid var(--emerald-border);
  color: #065f46;
  font-size: 12.5px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.resolution-banner.waived {
  background: #f1f5f9;
  border-color: var(--line-strong);
  color: var(--ink-2);
}

.resolution-banner.rfi {
  background: var(--violet-soft);
  border-color: #c7d2fe;
  color: var(--violet);
}

.role-gate-hint {
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--amber-soft);
  border: 1px solid var(--amber-border);
  color: #92400e;
  font-size: 12.5px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

/* ==========================================================================
   VIEW 02–05: WIDE WORKSPACE CONTAINER
   ========================================================================== */
.page-container {
  max-width: 1480px;
  width: 100%;
  margin: 0 auto;
  padding: 22px 24px 42px;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}

.kpi-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
  box-shadow: var(--shadow-sm);
}

.kpi-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12.5px;
  color: var(--muted);
}

.kpi-num {
  margin-top: 8px;
  font-size: 26px;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

.kpi-num small {
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  margin-left: 4px;
}

.kpi-sub {
  margin-top: 6px;
  font-size: 12px;
  color: var(--muted);
}

.card-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.card-head {
  padding: 15px 20px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.card-head h2, .card-head h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 650;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Blackline Diff View */
.diff-workbench {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 18px;
  align-items: start;
}

.diff-clause-card {
  padding: 20px 24px;
  border-bottom: 1px solid var(--line);
  transition: background 0.15s;
}

.diff-clause-card:last-child {
  border-bottom: 0;
}

.diff-clause-card.selected {
  background: #f8fbff;
  box-shadow: inset 3px 0 0 var(--brand);
}

.diff-clause-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.redline-box {
  padding: 15px 18px;
  border-radius: 8px;
  background: var(--paper);
  border: 1px solid #dedad0;
  font-family: var(--font-serif-zh);
  font-size: 14.5px;
  line-height: 1.9;
  color: #1e293b;
}

.redline-box del, .side-old mark {
  background: #ffe4e6;
  color: #9f1239;
  text-decoration: line-through;
  text-decoration-thickness: 1.5px;
  padding: 1px 4px;
  border-radius: 3px;
}

.redline-box ins, .side-new mark {
  background: #d1fae5;
  color: #065f46;
  text-decoration: none;
  border-bottom: 2px solid #059669;
  font-weight: 600;
  padding: 1px 4px;
  border-radius: 3px;
}

.side-by-side-diff {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.side-col {
  padding: 13px 15px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--paper);
  font-family: var(--font-serif-zh);
  font-size: 14px;
  line-height: 1.82;
}

.side-col-label {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--muted);
  margin-bottom: 6px;
  display: block;
}

.diff-impact-bar {
  margin-top: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  font-size: 12.5px;
  color: var(--muted);
}

/* Intake & Pipeline View */
.pipeline-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(320px, 0.95fr);
  gap: 18px;
  align-items: start;
}

.std-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.std-table th {
  padding: 11px 16px;
  background: var(--surface-subtle);
  border-bottom: 1px solid var(--line);
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  white-space: nowrap;
}

.std-table td {
  padding: 14px 16px;
  border-bottom: 1px solid #eef2f6;
  font-size: 13px;
  vertical-align: middle;
}

.std-table tbody tr:last-child td {
  border-bottom: 0;
}

.std-table tbody tr:hover {
  background: #f8fafc;
}

.inbox-item {
  padding: 14px 18px;
  border-bottom: 1px solid #eef2f6;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.inbox-item:last-child {
  border-bottom: 0;
}

.inbox-source-tag {
  font-family: var(--font-mono);
  font-size: 11.5px;
  padding: 2px 7px;
  border-radius: 4px;
  background: #eef2ff;
  color: var(--violet);
  font-weight: 600;
}

/* Glossary & Rules View */
.glossary-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(320px, 0.85fr);
  gap: 18px;
  align-items: start;
}

.toolbar-strip {
  padding: 12px 18px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  background: var(--surface-subtle);
}

.input-search {
  flex: 1;
  min-width: 200px;
  height: 36px;
  padding: 6px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #ffffff;
  font-size: 13px;
}

.toggle-switch {
  width: 38px;
  height: 22px;
  border-radius: 99px;
  background: #cbd5e1;
  position: relative;
  transition: background 0.16s;
}

.toggle-switch::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
  transition: transform 0.16s;
}

.toggle-switch.on {
  background: var(--emerald);
}

.toggle-switch.on::after {
  transform: translateX(16px);
}

/* Sign-off & Audit View */
.audit-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(340px, 1fr);
  gap: 18px;
  align-items: start;
}

.gate-list {
  padding: 16px 20px;
  display: grid;
  gap: 10px;
}

.gate-row {
  padding: 12px 14px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: var(--surface-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.gate-row.pass {
  background: #f0fdf4;
  border-color: #bbf7d0;
}

.gate-row.block {
  background: #fff1f2;
  border-color: #fecdd3;
}

.audit-timeline {
  padding: 18px 20px;
  max-height: 540px;
  overflow-y: auto;
}

.audit-node {
  position: relative;
  padding: 0 0 18px 20px;
  border-left: 2px solid #e2e8f0;
}

.audit-node:last-child {
  border-left-color: transparent;
  padding-bottom: 0;
}

.audit-node::before {
  content: "";
  position: absolute;
  left: -6px;
  top: 3px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--brand);
  border: 2px solid #ffffff;
  box-shadow: 0 0 0 1px var(--brand-border);
}

/* ==========================================================================
   DIALOGS & TOAST
   ========================================================================== */
dialog#modal-dialog {
  width: min(600px, calc(100vw - 28px));
  max-height: calc(100dvh - 36px);
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 24px 64px rgba(15, 23, 42, 0.28);
  overflow: auto;
}

dialog#modal-dialog::backdrop {
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(3px);
}

.modal-head {
  padding: 18px 22px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.modal-head h2 {
  margin: 0;
  font-size: 17px;
  font-weight: 650;
}

.modal-head p {
  margin: 4px 0 0;
  font-size: 12.5px;
  color: var(--muted);
}

.modal-body {
  padding: 20px 22px;
  display: grid;
  gap: 14px;
}

.form-2col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.field-label {
  display: grid;
  gap: 6px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-2);
}

.field-control {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #ffffff;
  font-size: 13.5px;
  font-weight: 400;
}

.modal-foot {
  padding: 14px 22px;
  border-top: 1px solid var(--line);
  background: var(--surface-subtle);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.scan-step-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 8px;
  background: var(--surface-subtle);
  font-size: 13px;
  color: var(--muted);
}

.scan-step-row.active {
  background: var(--brand-soft);
  color: var(--brand);
  font-weight: 600;
}

.scan-step-row.done {
  background: var(--emerald-soft);
  color: var(--emerald);
}

#toast {
  position: fixed;
  z-index: 90;
  bottom: 24px;
  left: 50%;
  transform: translate(-50%, 14px);
  max-width: min(520px, calc(100vw - 28px));
  padding: 11px 18px;
  border-radius: 10px;
  background: var(--obsidian);
  color: #ffffff;
  font-size: 13px;
  font-weight: 500;
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.26);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s, transform 0.18s;
}

#toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

#toast.warn {
  background: #9f1239;
}

.mobile-bottom-bar {
  display: none;
}

.noscript-box {
  margin: 32px;
  padding: 20px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 10px;
  text-align: center;
}

/* ==========================================================================
   PORTFOLIO OVERVIEW (MERGED CONTROL TOWER)
   ========================================================================== */
.overview-page {
  max-width: 1560px;
}

.overview-heading {
  margin-bottom: 22px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
}

.overview-kicker {
  margin-bottom: 6px;
  color: var(--brand);
  font: 10px/1.4 var(--font-mono);
  letter-spacing: 0.14em;
}

.overview-heading h1 {
  margin: 0;
  color: var(--ink);
  font-size: 25px;
  line-height: 1.3;
  letter-spacing: -0.035em;
}

.overview-heading p {
  max-width: 680px;
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.overview-actions {
  display: flex;
  gap: 9px;
  flex-wrap: wrap;
}

.overview-kpis .kpi-card {
  min-height: 120px;
  padding: 20px 22px;
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.035);
}

.overview-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 350px;
  gap: 18px;
  align-items: start;
}

.overview-projects {
  min-width: 0;
}

.overview-toolbar {
  padding: 13px 16px;
  display: flex;
  gap: 10px;
  border-bottom: 1px solid var(--line);
  background: #fbfcfe;
}

.overview-toolbar .input-search {
  flex: 1;
  min-width: 0;
}

.overview-status-filter {
  min-width: 140px;
  padding: 8px 30px 8px 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink-2);
  background: var(--surface);
  font-size: 12.5px;
}

.overview-project-name {
  min-width: 260px;
  max-width: 480px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 650;
}

.overview-project-meta {
  margin-top: 4px;
  color: var(--muted);
  font: 11px/1.5 var(--font-mono);
}

.overview-active-row {
  background: #f7f9ff;
}

.overview-side-stack {
  display: grid;
  gap: 18px;
}

.risk-overview-body {
  padding: 20px;
  display: grid;
  grid-template-columns: 118px minmax(0, 1fr);
  gap: 20px;
  align-items: center;
}

.risk-donut {
  position: relative;
  width: 112px;
  height: 112px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: conic-gradient(var(--crimson) 0 var(--critical-stop), #d97706 var(--critical-stop) var(--medium-stop), #818cf8 var(--medium-stop) 100%);
}

.risk-donut::after {
  content: "";
  position: absolute;
  inset: 15px;
  border-radius: 50%;
  background: var(--surface);
}

.risk-donut > div {
  position: relative;
  z-index: 1;
  text-align: center;
}

.risk-donut strong {
  display: block;
  font-size: 27px;
  line-height: 1.1;
}

.risk-donut span {
  color: var(--muted);
  font-size: 10px;
}

.risk-overview-legend {
  display: grid;
  gap: 11px;
}

.risk-overview-legend > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--ink-2);
  font-size: 12px;
}

.risk-overview-legend span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.risk-overview-legend i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
}

.risk-overview-note {
  margin: 0 20px 18px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 11px;
  line-height: 1.7;
}

.overview-activity-list {
  padding: 18px 20px;
}

.overview-activity {
  position: relative;
  padding: 0 0 18px 18px;
  border-left: 1px solid var(--line);
}

.overview-activity:last-child {
  padding-bottom: 0;
  border-left-color: transparent;
}

.overview-activity::before {
  content: "";
  position: absolute;
  top: 4px;
  left: -4px;
  width: 7px;
  height: 7px;
  border: 2px solid #fff;
  border-radius: 50%;
  background: #818cf8;
  box-shadow: 0 0 0 1px #c7d2fe;
}

.overview-activity > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.overview-activity strong {
  color: var(--brand);
  font-size: 11px;
}

.overview-activity span,
.overview-activity small {
  color: var(--muted);
  font: 10px/1.5 var(--font-mono);
}

.overview-activity p {
  margin: 5px 0;
  color: var(--ink-2);
  font-size: 12px;
  line-height: 1.65;
}

@media (max-width: 1180px) {
  .overview-layout {
    grid-template-columns: 1fr;
  }
  .overview-side-stack {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 680px) {
  .overview-heading {
    flex-direction: column;
    gap: 14px;
  }
  .overview-heading h1 {
    font-size: 22px;
  }
  .overview-actions,
  .overview-actions .btn {
    width: 100%;
  }
  .overview-toolbar {
    flex-direction: column;
  }
  .overview-status-filter {
    width: 100%;
  }
  .overview-side-stack {
    grid-template-columns: 1fr;
  }
  .risk-overview-body {
    grid-template-columns: 110px minmax(0, 1fr);
    padding: 16px;
  }
}

/* ==========================================================================
   RESPONSIVE ADAPTATION (TABLET & MOBILE)
   ========================================================================== */
@media (max-width: 1280px) {
  .studio-workbench {
    grid-template-columns: 210px minmax(0, 1fr) 360px;
  }
  .deal-select {
    max-width: 190px;
  }
  .sandbox-pill {
    display: none;
  }
}

@media (max-width: 1180px) {
  .primary-nav {
    display: none;
  }
  .mobile-bottom-bar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 45;
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    background: rgba(15, 23, 42, 0.96);
    backdrop-filter: blur(12px);
    border-top: 1px solid #334155;
    padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
  }
  .mobile-nav-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    padding: 6px 2px;
    border-radius: 7px;
    color: #94a3b8;
    font-size: 11.5px;
  }
  .mobile-nav-btn.active {
    color: #ffffff;
    background: rgba(37, 99, 235, 0.35);
    font-weight: 600;
  }
  .studio-shell {
    padding-bottom: 66px;
  }
  .studio-workbench {
    grid-template-columns: 1fr;
    height: auto;
    min-height: auto;
    overflow: visible;
  }
  .outline-pane {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
  .section-nav-list {
    display: flex;
    overflow-x: auto;
    gap: 8px;
  }
  .section-card-btn {
    min-width: 210px;
    flex-shrink: 0;
  }
  .tieout-radar-box {
    display: none;
  }
  .inspector-pane {
    border-left: 0;
    border-top: 1px solid var(--line);
  }
  .diff-workbench,
  .pipeline-layout,
  .glossary-grid,
  .audit-grid {
    grid-template-columns: 1fr;
  }
  .kpi-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 680px) {
  .command-bar {
    padding: 8px 12px;
    flex-wrap: wrap;
    gap: 8px;
  }
  .header-divider {
    display: none;
  }
  .brand-title span {
    display: none;
  }
  .deal-selector-wrap {
    order: 3;
    width: 100%;
  }
  .deal-select {
    max-width: none;
    flex: 1;
  }
  .project-ribbon {
    padding: 10px 14px;
  }
  .galley-scroll {
    padding: 12px;
  }
  .proof-sheet {
    padding: 20px 16px;
  }
  .bilingual-col-headers {
    display: none;
  }
  .clause-row {
    grid-template-columns: 1fr;
    gap: 10px;
    padding: 12px 8px;
  }
  .line-num {
    padding-top: 0;
  }
  .clause-en {
    padding-top: 8px;
    border-top: 1px dashed #e2dfd5;
  }
  .clause-table-row {
    grid-template-columns: 1fr;
    padding: 12px 4px;
  }
  .side-by-side-diff,
  .form-2col,
  .action-grid-2 {
    grid-template-columns: 1fr;
  }
  .page-container {
    padding: 14px 12px 30px;
  }
  #toast {
    bottom: 78px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition: none !important;
    animation: none !important;
  }
}

.role-switcher .role-tabs{display:flex;align-items:center;gap:3px;max-width:100%;padding:3px;border:1px solid var(--line);border-radius:12px;background:#f7f8fa;overflow-x:auto}.role-tabs button{min-height:44px;padding:7px 11px;border:0;border-radius:9px;background:transparent;color:var(--muted);font-size:10px;white-space:nowrap}.role-tabs button.active{background:var(--brand);color:#fff}

.primary-nav{min-width:0;overflow-x:auto;scrollbar-width:none}.command-actions{min-width:0}.role-switcher{min-width:0}.role-switcher .role-tabs{min-width:0}@media(max-width:1400px){.brand-cluster{display:none}}@media(max-width:680px){.command-actions{width:100%;min-width:0}.role-switcher{flex:1;min-width:0;padding:3px}.role-chip-avatar{display:none}.role-switcher .role-tabs{width:100%}.role-tabs button{flex:1 0 auto}}
