/* ============================================================
   SINHVU INTAKE ADMIN — V11.4 FULL CONNECTION
   Operating Intelligence Center
   ============================================================ */

:root {
  --brand-graphite: #525252;
  --brand-accent: #F8951D;
  --brand-accent-soft: #FEF3E2;
  --brand-accent-deep: #C66F00;

  --c-bg: #F7F6F3;
  --c-surface: #FFFFFF;
  --c-surface-2: #F2F0EB;
  --c-surface-3: #E9E6E0;
  --c-line: #E1DED7;
  --c-line-soft: #ECE9E2;
  --c-divider: #CDC9C0;

  --c-text: #1A1918;
  --c-text-muted: #65625B;
  --c-text-dim: #94908A;
  --c-placeholder: #B5B0A6;

  --c-error: #C8483A;
  --c-error-bg: #FDEFEC;
  --c-warn: #B8762A;
  --c-warn-bg: #FCEFD9;
  --c-success: #2F7A4F;
  --c-success-bg: #E8F4EC;
  --c-info: #2C5BAA;
  --c-info-bg: #EBF1FB;

  --font-sans: "Inter", "Be Vietnam Pro", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, monospace;

  --r-sm: 4px;
  --r-md: 6px;
  --r-lg: 10px;

  --sh-sm: 0 1px 2px rgba(0,0,0,0.04);
  --sh-md: 0 1px 3px rgba(0,0,0,0.05), 0 4px 12px rgba(0,0,0,0.04);
  --sh-focus: 0 0 0 3px rgba(248,149,29,0.18);
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; overflow-x: hidden; }
body {
  background: var(--c-bg);
  color: var(--c-text);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-wrap: break-word;
}
button { cursor: pointer; background: none; border: 0; font: inherit; color: inherit; padding: 0; }
input, select, textarea { font: inherit; color: inherit; max-width: 100%; }
a { color: inherit; text-decoration: none; }
img, svg { display: block; max-width: 100%; }
code { font-family: var(--font-mono); font-size: 12px; }
.hidden { display: none !important; }

/* ---------- LOGIN PAGE ---------- */
.login-page {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr;
  align-content: start;
}
.login-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 28px;
  border-bottom: 1px solid var(--c-line);
  background: var(--c-surface);
}
.login-grid {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 80px;
  align-items: center;
  max-width: 1100px;
  margin: 0 auto;
  padding: 80px 32px;
  width: 100%;
}
.intro-panel .eyebrow,
.login-card .eyebrow,
.panel-eyebrow {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--brand-accent-deep);
  margin-bottom: 16px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.panel-eyebrow::before, .intro-panel .eyebrow::before, .login-card .eyebrow::before {
  content: ""; width: 22px; height: 1px; background: var(--brand-accent);
}
.intro-panel h1 {
  font-size: 36px; line-height: 1.15; letter-spacing: -0.02em;
  font-weight: 600; margin: 0 0 20px 0;
}
.intro-panel p { color: var(--c-text-muted); font-size: 16px; line-height: 1.55; margin: 0 0 32px 0; max-width: 480px; }
.system-rows { display: grid; gap: 12px; max-width: 480px; }
.system-rows > div {
  display: flex; align-items: baseline; justify-content: space-between;
  padding: 12px 0; border-top: 1px solid var(--c-line);
  font-size: 13px;
}
.system-rows span { color: var(--c-text-dim); font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.04em; text-transform: uppercase; }
.system-rows strong { color: var(--c-text); font-weight: 500; font-family: var(--font-mono); }

.login-card {
  background: var(--c-surface);
  border: 1px solid var(--c-line);
  border-radius: 14px;
  padding: 36px;
  box-shadow: var(--sh-md);
}
.login-card h2 { font-size: 24px; margin: 0 0 8px 0; font-weight: 600; letter-spacing: -0.01em; }
.login-card .muted { color: var(--c-text-muted); margin: 0 0 20px 0; font-size: 14px; }
.pass-input {
  width: 100%;
  padding: 14px 16px;
  font-size: 22px;
  font-family: var(--font-mono);
  letter-spacing: 0.5em;
  text-align: center;
  background: var(--c-bg);
  border: 1px solid var(--c-line);
  border-radius: 8px;
  margin-bottom: 16px;
  outline: none;
}
.pass-input:focus { border-color: var(--brand-accent); box-shadow: var(--sh-focus); }
.api-url-input {
  width: 100%;
  padding: 10px 12px;
  font-size: 12px;
  font-family: var(--font-mono);
  background: var(--c-bg);
  border: 1px solid var(--c-line-soft);
  border-radius: 6px;
  margin-bottom: 16px;
  color: var(--c-text-muted);
  outline: none;
  word-break: break-all;
}
.primary-btn {
  width: 100%;
  padding: 14px;
  background: var(--c-text);
  color: var(--c-surface);
  border-radius: 8px;
  font-weight: 500;
  font-size: 15px;
  transition: background 0.15s;
  min-height: 48px;
}
.primary-btn:hover:not(:disabled) { background: var(--brand-accent); }
.primary-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.brand-logo { display: inline-flex; align-items: center; gap: 12px; }
.brand-logo img { height: 28px; width: auto; }
.admin-label {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  color: var(--c-text-dim);
  padding: 3px 8px;
  border: 1px solid var(--c-line);
  border-radius: 4px;
  background: var(--c-surface);
}

/* ---------- TOPBAR ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 28px;
  border-bottom: 1px solid var(--c-line);
  background: var(--c-surface);
  position: sticky; top: 0; z-index: 50;
  flex-wrap: wrap;
  gap: 12px;
}
.topbar-title {
  display: flex; flex-direction: column; gap: 2px;
}
.topbar-title .eyebrow {
  font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.1em;
  color: var(--c-text-dim); text-transform: uppercase;
}
.topbar-title h1 { font-size: 16px; margin: 0; font-weight: 600; letter-spacing: -0.01em; }
.topbar-status {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  font-family: var(--font-mono); font-size: 11px;
}
.api-status {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px; border-radius: 99px;
  background: var(--c-surface-2);
  color: var(--c-text-muted);
}
.api-status .dot {
  width: 8px; height: 8px; border-radius: 99px;
  background: var(--c-text-dim);
}
.api-status.is-ok { background: var(--c-success-bg); color: var(--c-success); }
.api-status.is-ok .dot { background: var(--c-success); }
.api-status.is-err { background: var(--c-error-bg); color: var(--c-error); }
.api-status.is-err .dot { background: var(--c-error); }
.api-status.is-loading .dot { background: var(--brand-accent); animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 0%,100%{opacity:1;} 50%{opacity:0.35;} }
.last-sync { color: var(--c-text-dim); }
.topbar-actions {
  display: flex; gap: 8px; flex-wrap: wrap;
}
.ghost-btn {
  padding: 8px 14px;
  font-size: 13px;
  border: 1px solid var(--c-line);
  border-radius: 6px;
  color: var(--c-text);
  background: var(--c-surface);
  transition: all 0.15s;
  min-height: 36px;
}
.ghost-btn:hover { background: var(--c-surface-2); border-color: var(--c-divider); }
.ghost-btn.is-active { background: var(--c-text); color: var(--c-surface); border-color: var(--c-text); }
.ghost-btn.danger { color: var(--c-error); border-color: rgba(200,72,58,0.3); }
.ghost-btn.danger:hover { background: var(--c-error-bg); }

/* ---------- BANNER ---------- */
.banner {
  padding: 14px 28px;
  font-size: 13px;
  border-bottom: 1px solid var(--c-line);
}
.banner.error { background: var(--c-error-bg); color: var(--c-error); }
.banner.success { background: var(--c-success-bg); color: var(--c-success); }
.banner.warn { background: var(--c-warn-bg); color: var(--c-warn); }
.banner.info { background: var(--c-info-bg); color: var(--c-info); }

/* ---------- CONNECTION HEALTH PANEL ---------- */
.health-panel, .debug-panel {
  margin: 0 28px;
  padding: 18px 22px;
  background: var(--c-surface);
  border: 1px solid var(--c-line);
  border-radius: var(--r-lg);
  margin-top: 14px;
}
.health-panel h3, .debug-panel h3 {
  margin: 0 0 12px 0; font-size: 13px; font-weight: 600;
  color: var(--c-text); letter-spacing: -0.01em;
}
.health-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
}
.health-item {
  padding: 10px 12px;
  border-radius: 6px;
  font-size: 12px;
  background: var(--c-surface-2);
  border-left: 3px solid var(--c-text-dim);
}
.health-item.ok { background: var(--c-success-bg); border-left-color: var(--c-success); }
.health-item.miss { background: var(--c-warn-bg); border-left-color: var(--c-warn); }
.health-item.err { background: var(--c-error-bg); border-left-color: var(--c-error); }
.health-item .name { font-family: var(--font-mono); font-size: 11px; font-weight: 500; }
.health-item .meta { color: var(--c-text-muted); font-size: 11px; margin-top: 4px; }
.health-warnings, .health-errors {
  margin-top: 12px; padding: 10px 12px; border-radius: 6px;
  font-size: 12px; line-height: 1.5;
}
.health-warnings { background: var(--c-warn-bg); color: var(--c-warn); }
.health-errors { background: var(--c-error-bg); color: var(--c-error); }
.health-warnings ul, .health-errors ul { margin: 4px 0 0 0; padding-left: 18px; }

/* ---------- DEBUG PANEL ---------- */
.debug-panel {
  font-family: var(--font-mono); font-size: 11px;
  background: #1B1A18; color: #E8E3DA; border-color: #2A2825;
}
.debug-panel h3 { color: var(--brand-accent); }
.debug-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 8px;
}
.debug-row {
  display: flex; justify-content: space-between; gap: 8px;
  padding: 8px 10px; background: rgba(255,255,255,0.04); border-radius: 4px;
  word-break: break-all;
}
.debug-row .k { color: #8C8378; flex-shrink: 0; }
.debug-row .v { color: #E8E3DA; text-align: right; }

/* ---------- DASHBOARD ---------- */
.dashboard {
  padding: 24px 28px 8px;
}
.dashboard h2 {
  font-size: 12px;
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--c-text-dim);
  margin: 0 0 16px 0;
  font-weight: 500;
}
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 12px;
}
.metric-card {
  background: var(--c-surface);
  border: 1px solid var(--c-line);
  border-radius: var(--r-lg);
  padding: 16px 18px;
  transition: all 0.15s;
  cursor: pointer;
}
.metric-card:hover { border-color: var(--brand-accent); box-shadow: var(--sh-sm); }
.metric-card.active { border-color: var(--brand-accent); background: var(--brand-accent-soft); }
.metric-label {
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--c-text-dim);
  margin-bottom: 6px;
}
.metric-value {
  font-size: 28px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--c-text);
  line-height: 1;
}
.metric-note {
  font-size: 11px;
  color: var(--c-text-muted);
  margin-top: 6px;
}

/* ---------- FILTERS ---------- */
.filters {
  display: grid;
  grid-template-columns: minmax(200px, 1.4fr) repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
  padding: 16px 28px;
  background: var(--c-surface);
  border-top: 1px solid var(--c-line);
  border-bottom: 1px solid var(--c-line);
  margin-top: 16px;
}
.filter-field, .search-field {
  display: flex; flex-direction: column; gap: 4px; min-width: 0;
}
.filter-field span, .search-field span {
  font-family: var(--font-mono); font-size: 10px;
  text-transform: uppercase; letter-spacing: 0.06em; color: var(--c-text-dim);
}
.filter-field select, .search-field input, .filter-field input {
  padding: 8px 10px;
  font-size: 13px;
  border: 1px solid var(--c-line);
  border-radius: 6px;
  background: var(--c-surface);
  outline: none;
}
.filter-field select:focus, .search-field input:focus, .filter-field input:focus {
  border-color: var(--brand-accent); box-shadow: var(--sh-focus);
}
.filter-chips {
  display: flex; gap: 8px; flex-wrap: wrap; padding: 0 28px 16px;
}
.filter-chip {
  padding: 6px 12px;
  font-size: 12px;
  border: 1px solid var(--c-line);
  border-radius: 99px;
  background: var(--c-surface);
  color: var(--c-text-muted);
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 30px;
}
.filter-chip.active {
  background: var(--brand-accent-soft);
  border-color: var(--brand-accent);
  color: var(--brand-accent-deep);
  font-weight: 500;
}

/* ---------- MAIN GRID ---------- */
.main-grid {
  display: grid;
  grid-template-columns: minmax(0, 380px) minmax(0, 1fr);
  gap: 0;
  min-height: calc(100vh - 220px);
  border-top: 1px solid var(--c-line);
}

/* ---------- REQUEST LIST ---------- */
.request-list {
  border-right: 1px solid var(--c-line);
  background: var(--c-surface);
  display: flex; flex-direction: column;
  min-width: 0;
  max-height: calc(100vh - 220px);
  overflow-y: auto;
}
.list-head {
  position: sticky; top: 0;
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 20px;
  border-bottom: 1px solid var(--c-line);
  background: var(--c-surface);
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--c-text-dim);
  z-index: 5;
}
.list-head .count { color: var(--c-text); font-weight: 500; }
.list-scroll {
  display: flex; flex-direction: column;
}
.request-card {
  text-align: left;
  padding: 14px 20px;
  border-bottom: 1px solid var(--c-line-soft);
  background: var(--c-surface);
  transition: all 0.15s;
  display: flex; flex-direction: column; gap: 6px;
  min-width: 0;
}
.request-card:hover { background: var(--c-surface-2); }
.request-card.selected {
  background: var(--brand-accent-soft);
  border-left: 3px solid var(--brand-accent);
  padding-left: 17px;
}
.req-title {
  display: flex; justify-content: space-between; align-items: baseline; gap: 8px;
}
.req-title strong { font-size: 14px; font-weight: 600; color: var(--c-text); }
.req-company { font-size: 12px; color: var(--c-text-muted); }
.req-services { font-size: 11px; color: var(--c-text-muted); font-family: var(--font-mono); }
.req-foot {
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
  margin-top: 4px; font-size: 11px;
}
.req-foot .right { color: var(--c-text-dim); font-family: var(--font-mono); }

/* ---------- TAGS ---------- */
.tag {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  font-size: 11px;
  border-radius: 4px;
  font-weight: 500;
  background: var(--c-surface-2);
  color: var(--c-text-muted);
  white-space: nowrap;
}
.tag.success { background: var(--c-success-bg); color: var(--c-success); }
.tag.warn { background: var(--c-warn-bg); color: var(--c-warn); }
.tag.danger { background: var(--c-error-bg); color: var(--c-error); }
.tag.info { background: var(--c-info-bg); color: var(--c-info); }
.tag.brand { background: var(--brand-accent-soft); color: var(--brand-accent-deep); }

/* ---------- DETAIL PANEL ---------- */
.detail-panel {
  background: var(--c-bg);
  display: flex; flex-direction: column; min-width: 0;
  max-height: calc(100vh - 220px);
  overflow-y: auto;
}
.detail-empty {
  padding: 80px 40px; text-align: center; color: var(--c-text-dim);
  display: flex; align-items: center; justify-content: center; min-height: 400px;
}
.detail-head {
  position: sticky; top: 0; z-index: 5;
  background: var(--c-surface);
  padding: 18px 24px;
  border-bottom: 1px solid var(--c-line);
  display: flex; flex-direction: column; gap: 8px;
}
.detail-head .head-top {
  display: flex; justify-content: space-between; align-items: flex-start; gap: 12px;
  flex-wrap: wrap;
}
.detail-head .req-id {
  font-family: var(--font-mono); font-size: 11px; color: var(--c-text-dim);
  text-transform: uppercase; letter-spacing: 0.06em;
}
.detail-head h2 {
  font-size: 22px; font-weight: 600; letter-spacing: -0.01em;
  margin: 4px 0; color: var(--c-text);
}
.detail-head .sub-title { color: var(--c-text-muted); font-size: 13px; }
.detail-head .head-tags { display: flex; gap: 6px; flex-wrap: wrap; }

.detail-section {
  background: var(--c-surface);
  margin: 14px 24px 0;
  border: 1px solid var(--c-line);
  border-radius: var(--r-lg);
  padding: 18px 22px;
}
.detail-section.snapshot { border-left: 3px solid var(--brand-accent); }
.detail-section h3 {
  font-size: 11px;
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--brand-accent-deep);
  margin: 0 0 14px 0;
  font-weight: 500;
}
.detail-section h3 .sub {
  color: var(--c-text-dim);
  margin-left: 6px;
  text-transform: none;
  letter-spacing: 0;
  font-size: 11px;
}

/* Snapshot */
.snapshot-summary { font-size: 15px; line-height: 1.55; color: var(--c-text); margin: 0 0 14px 0; }
.snapshot-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 10px;
}
.kpi {
  padding: 10px 12px;
  background: var(--c-surface-2);
  border-radius: 6px;
  display: flex; flex-direction: column; gap: 2px;
}
.kpi .k {
  font-family: var(--font-mono); font-size: 10px;
  text-transform: uppercase; letter-spacing: 0.06em; color: var(--c-text-dim);
}
.kpi .v { font-size: 14px; color: var(--c-text); font-weight: 500; }
.kpi.high .v { color: var(--c-error); }
.kpi.warn .v { color: var(--c-warn); }
.kpi.good .v { color: var(--c-success); }

.snapshot-twocol {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 14px; margin-top: 14px;
}
.snapshot-card {
  padding: 14px 16px;
  background: var(--c-surface-2);
  border-radius: 8px;
  border-left: 3px solid var(--c-divider);
}
.snapshot-card.bright { border-left-color: var(--c-success); background: var(--c-success-bg); }
.snapshot-card.block { border-left-color: var(--c-error); background: var(--c-error-bg); }
.snapshot-card.next { border-left-color: var(--brand-accent); background: var(--brand-accent-soft); }
.snapshot-card .label {
  font-family: var(--font-mono); font-size: 10px;
  text-transform: uppercase; letter-spacing: 0.06em; color: var(--c-text-dim);
  margin-bottom: 6px;
}
.snapshot-card ul { margin: 0; padding-left: 18px; }
.snapshot-card li { font-size: 13px; line-height: 1.5; margin-bottom: 4px; }

/* Completeness scorecard */
.completeness {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 8px; margin-top: 12px;
}
.score-cell {
  padding: 10px 12px;
  background: var(--c-surface-2);
  border-radius: 6px;
  border-left: 3px solid var(--c-divider);
}
.score-cell.good { border-left-color: var(--c-success); background: var(--c-success-bg); }
.score-cell.warn { border-left-color: var(--c-warn); background: var(--c-warn-bg); }
.score-cell.block { border-left-color: var(--c-error); background: var(--c-error-bg); }
.score-cell .lbl {
  font-family: var(--font-mono); font-size: 10px;
  text-transform: uppercase; letter-spacing: 0.06em; color: var(--c-text-dim);
  margin-bottom: 4px;
}
.score-cell .val { font-size: 13px; font-weight: 500; color: var(--c-text); }
.score-cell .pct { font-family: var(--font-mono); font-size: 11px; color: var(--c-text-muted); }

/* Info grid */
.info-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 10px;
}
.info-item {
  padding: 8px 10px;
  background: var(--c-surface-2);
  border-radius: 6px;
}
.info-item .ilbl {
  font-family: var(--font-mono); font-size: 10px;
  text-transform: uppercase; letter-spacing: 0.06em; color: var(--c-text-dim);
  margin-bottom: 3px;
}
.info-item .ival { font-size: 13px; color: var(--c-text); word-break: break-word; }
.info-item .ival a { color: var(--c-info); }
.info-item.wide { grid-column: 1 / -1; }

/* Module Briefs */
.module-card {
  margin-top: 12px;
  padding: 14px 16px;
  border: 1px solid var(--c-line);
  border-radius: 8px;
  background: var(--c-surface);
}
.module-card:first-child { margin-top: 0; }
.module-card .mhead {
  display: flex; justify-content: space-between; align-items: baseline;
  gap: 8px; margin-bottom: 10px;
}
.module-card .mhead h4 {
  font-size: 14px; margin: 0; font-weight: 600; color: var(--c-text);
}
.module-card .mtype {
  font-family: var(--font-mono); font-size: 10px;
  text-transform: uppercase; color: var(--c-text-dim); letter-spacing: 0.06em;
}
.module-fields { display: grid; gap: 8px; }
.mfield {
  display: grid; grid-template-columns: 200px 1fr; gap: 10px;
  padding: 6px 0; border-top: 1px solid var(--c-line-soft);
  font-size: 13px;
}
.mfield:first-child { border-top: 0; }
.mfield .mk { color: var(--c-text-muted); }
.mfield .mv { color: var(--c-text); word-break: break-word; }

/* Risks heatmap */
.heat-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}
.heat-block {
  padding: 12px 14px;
  border-radius: 8px;
  background: var(--c-surface-2);
}
.heat-block.high { background: var(--c-error-bg); }
.heat-block.medium { background: var(--c-warn-bg); }
.heat-block.low { background: var(--c-success-bg); }
.heat-block h4 {
  font-size: 11px; font-family: var(--font-mono);
  text-transform: uppercase; letter-spacing: 0.06em;
  margin: 0 0 8px 0;
}
.heat-block.high h4 { color: var(--c-error); }
.heat-block.medium h4 { color: var(--c-warn); }
.heat-block.low h4 { color: var(--c-success); }
.heat-block ul { margin: 0; padding-left: 18px; font-size: 13px; }
.heat-block li { margin-bottom: 4px; line-height: 1.5; }
.heat-impact {
  margin-top: 12px; padding: 10px 14px;
  background: var(--c-surface-2);
  border-radius: 6px;
  font-size: 13px; color: var(--c-text-muted);
  border-left: 3px solid var(--c-divider);
}

/* Operating plan */
.plan-list { display: grid; gap: 10px; }
.plan-row {
  display: grid; grid-template-columns: 80px 1fr;
  gap: 14px; padding: 10px 12px;
  background: var(--c-surface-2);
  border-radius: 6px;
  font-size: 13px;
}
.plan-row .ptag {
  font-family: var(--font-mono); font-size: 10px;
  text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--brand-accent-deep);
  font-weight: 500;
}
.plan-row .ptext { color: var(--c-text); line-height: 1.5; }
.plan-list-block { margin-top: 12px; }
.plan-list-block h4 {
  font-size: 11px; font-family: var(--font-mono);
  text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--c-text-dim);
  margin: 0 0 8px 0;
}
.plan-list-block ol { margin: 0; padding-left: 20px; font-size: 13px; }
.plan-list-block li { margin-bottom: 4px; line-height: 1.5; }

/* Raw answers */
details.raw-answers {
  border: 1px solid var(--c-line);
  border-radius: 8px;
  background: var(--c-surface);
}
details.raw-answers > summary {
  cursor: pointer;
  padding: 12px 16px;
  font-size: 13px;
  font-weight: 500;
  color: var(--c-text-muted);
  list-style: none;
}
details.raw-answers > summary::-webkit-details-marker { display: none; }
details.raw-answers > summary::after { content: " ▾"; color: var(--c-text-dim); }
details.raw-answers[open] > summary::after { content: " ▴"; }
.raw-table {
  border-top: 1px solid var(--c-line-soft);
  font-size: 12px; line-height: 1.5;
  max-height: 500px; overflow-y: auto;
}
.raw-row {
  display: grid; grid-template-columns: 200px 200px 1fr 100px 100px;
  gap: 10px;
  padding: 8px 16px;
  border-bottom: 1px solid var(--c-line-soft);
  align-items: start;
}
.raw-row.head {
  font-family: var(--font-mono); font-size: 10px;
  text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--c-text-dim);
  background: var(--c-surface-2);
  font-weight: 500;
  position: sticky; top: 0;
}
.raw-row .qid { font-family: var(--font-mono); color: var(--c-text-dim); word-break: break-word; }
.raw-row .qtext { color: var(--c-text-muted); word-break: break-word; }
.raw-row .ans { color: var(--c-text); word-break: break-word; }
.raw-row .mod { font-family: var(--font-mono); font-size: 11px; color: var(--c-text-dim); }

/* Admin actions panel */
.actions-panel {
  background: #1B1A18;
  color: #E8E3DA;
  margin: 14px 24px 24px;
  border-radius: var(--r-lg);
  padding: 18px 22px;
}
.actions-panel h3 { color: var(--brand-accent); }
.actions-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
}
.actions-grid .field-edit { display: flex; flex-direction: column; gap: 4px; }
.actions-grid .field-edit span {
  font-family: var(--font-mono); font-size: 10px;
  text-transform: uppercase; letter-spacing: 0.06em; color: #8C8378;
}
.actions-grid .field-edit input,
.actions-grid .field-edit select,
.actions-grid .field-edit textarea {
  padding: 8px 10px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 6px;
  color: #E8E3DA;
  font-size: 13px;
  outline: none;
}
.actions-grid .field-edit input:focus,
.actions-grid .field-edit select:focus,
.actions-grid .field-edit textarea:focus {
  border-color: var(--brand-accent);
}
.actions-grid .field-edit textarea { min-height: 70px; resize: vertical; font-family: inherit; }
.actions-grid .wide { grid-column: 1 / -1; }
.actions-foot {
  display: flex; justify-content: space-between; align-items: center;
  margin-top: 14px; gap: 10px; flex-wrap: wrap;
}
.copy-row { display: flex; gap: 6px; flex-wrap: wrap; }
.mini-copy {
  padding: 6px 10px;
  font-size: 11px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 4px;
  color: #E8E3DA;
  font-family: var(--font-mono);
  min-height: 28px;
}
.mini-copy:hover { background: rgba(255,255,255,0.1); border-color: var(--brand-accent); }
.save-btn {
  padding: 10px 18px;
  background: var(--brand-accent);
  color: #fff;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  min-height: 36px;
}
.save-btn:hover:not(:disabled) { background: var(--brand-accent-deep); }
.save-btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ---------- INLINE MESSAGES ---------- */
.inline-message {
  margin: 10px 24px 0;
  padding: 10px 14px;
  font-size: 13px;
  border-radius: 6px;
}
.inline-message.error { background: var(--c-error-bg); color: var(--c-error); }
.inline-message.success { background: var(--c-success-bg); color: var(--c-success); }
.inline-message.warn { background: var(--c-warn-bg); color: var(--c-warn); }

/* ---------- FOOTER ---------- */
.footer {
  padding: 20px 28px;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--c-text-dim);
  border-top: 1px solid var(--c-line);
  margin-top: 24px;
}

/* ============================================================
   RESPONSIVE — Admin V11.4
   Breakpoints: 1280, 1024, 768, 540
   ============================================================ */

@media (max-width: 1280px) {
  .main-grid { grid-template-columns: minmax(0, 320px) minmax(0, 1fr); }
}

@media (max-width: 1024px) {
  .login-grid { grid-template-columns: 1fr; gap: 40px; padding: 40px 24px; }
  .intro-panel h1 { font-size: 28px; }
  .filters { grid-template-columns: minmax(180px, 1.4fr) repeat(auto-fit, minmax(120px, 1fr)); }
  .main-grid {
    grid-template-columns: minmax(0, 1fr);
    min-height: auto;
  }
  .request-list {
    border-right: 0;
    border-bottom: 1px solid var(--c-line);
    max-height: 400px;
  }
  .detail-panel { max-height: none; }
  .raw-row { grid-template-columns: 1fr; gap: 4px; padding: 10px 16px; }
  .raw-row.head { display: none; }
  .raw-row .qid::before { content: "ID: "; color: var(--c-text-dim); }
  .raw-row .qtext::before { content: "Q: "; color: var(--c-text-dim); }
  .raw-row .ans::before { content: "A: "; color: var(--c-text-dim); }
}

@media (max-width: 768px) {
  .topbar { padding: 12px 16px; }
  .login-card { padding: 24px; }
  .pass-input { font-size: 18px; letter-spacing: 0.4em; }
  .dashboard, .filters, .filter-chips { padding-left: 16px; padding-right: 16px; }
  .health-panel, .debug-panel { margin: 14px 16px 0; }
  .detail-section, .actions-panel { margin: 14px 16px 0; padding: 16px 18px; }
  .detail-head { padding: 16px 18px; }
  .actions-panel { margin-bottom: 24px; }
  .mfield { grid-template-columns: 1fr; gap: 4px; }
  .mfield .mk { font-family: var(--font-mono); font-size: 10px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--c-text-dim); }
}

@media (max-width: 540px) {
  .topbar { padding: 10px 14px; }
  .topbar-status { font-size: 10px; gap: 8px; }
  .api-status { padding: 3px 8px; }
  .last-sync { display: none; }
  .ghost-btn { padding: 8px 12px; font-size: 12px; }
  .dashboard, .filters, .filter-chips { padding-left: 14px; padding-right: 14px; }
  .filters { grid-template-columns: 1fr 1fr; gap: 8px; padding: 12px 14px; }
  .search-field { grid-column: 1 / -1; }
  .detail-section, .actions-panel, .health-panel, .debug-panel {
    margin-left: 14px; margin-right: 14px; padding: 14px 16px;
    border-radius: 8px;
  }
  .detail-head h2 { font-size: 18px; }
  .metrics-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .metric-card { padding: 12px 14px; }
  .metric-value { font-size: 22px; }
  .actions-foot { flex-direction: column; align-items: stretch; }
  .copy-row { justify-content: flex-start; }
  .save-btn { width: 100%; }
  .request-card { padding: 12px 16px; }
  .raw-row { padding: 10px 14px; }
}

/* ============================================================
   V11.5 — BRIEF COMPLETION WORKFLOW
   ============================================================ */

.bcw-section { border-left: 3px solid var(--c-info); }
.bcw-section h3 .tag { margin-left: 8px; }

.bcw-actions {
  display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px;
}
.bcw-btn {
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 500;
  border-radius: 6px;
  border: 1px solid var(--c-line);
  background: var(--c-surface);
  color: var(--c-text);
  min-height: 38px;
  transition: all 0.15s;
}
.bcw-btn:hover:not(:disabled) {
  border-color: var(--brand-accent);
  background: var(--brand-accent-soft);
}
.bcw-btn.primary {
  background: var(--c-text); color: var(--c-surface); border-color: var(--c-text);
}
.bcw-btn.primary:hover:not(:disabled) {
  background: var(--brand-accent); border-color: var(--brand-accent); color: #fff;
}
.bcw-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.bcw-updates-count {
  display: inline-flex; align-items: center;
  padding: 6px 12px; font-size: 11px;
  background: var(--c-success-bg); color: var(--c-success);
  border-radius: 4px; font-family: var(--font-mono);
}

.gap-matrix {
  border: 1px solid var(--c-line); border-radius: 8px;
  overflow: hidden; background: var(--c-surface);
}
.gap-matrix-head, .gap-row {
  display: grid;
  grid-template-columns: 100px minmax(180px, 1fr) minmax(200px, 2fr);
  gap: 12px;
  padding: 10px 14px;
  font-size: 13px;
  align-items: start;
  border-bottom: 1px solid var(--c-line-soft);
}
.gap-matrix-head {
  font-family: var(--font-mono); font-size: 10px;
  text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--c-text-dim);
  background: var(--c-surface-2); font-weight: 500;
}
.gap-row:last-child { border-bottom: 0; }
.gap-severity {
  font-family: var(--font-mono); font-size: 10px;
  padding: 4px 8px; border-radius: 4px;
  display: inline-block; font-weight: 600; text-align: center;
  width: fit-content;
}
.gap-row.severity-blocking .gap-severity {
  background: var(--c-error-bg); color: var(--c-error);
}
.gap-row.severity-blocking { background: rgba(200, 72, 58, 0.04); }
.gap-row.severity-important .gap-severity {
  background: var(--c-warn-bg); color: var(--c-warn);
}
.gap-row.severity-nice .gap-severity {
  background: var(--c-surface-2); color: var(--c-text-muted);
}
.gap-label { color: var(--c-text); font-weight: 500; }
.gap-reason { color: var(--c-text-muted); line-height: 1.5; }

.gap-empty {
  padding: 24px; text-align: center;
  background: var(--c-surface-2); border-radius: 8px;
  color: var(--c-text-muted); font-size: 14px;
}
.gap-empty.success {
  background: var(--c-success-bg); color: var(--c-success); font-weight: 500;
}

.bcw-history { margin-top: 18px; }
.bcw-history h4 {
  font-size: 11px; font-family: var(--font-mono);
  text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--c-text-dim); margin: 0 0 10px 0;
}
.bcw-history-list { display: grid; gap: 8px; }
.bcw-history-row {
  display: grid; grid-template-columns: 80px 1fr;
  gap: 12px; padding: 10px 12px;
  background: var(--c-surface-2); border-radius: 6px;
  font-size: 12px;
}
.src-badge {
  display: inline-flex; align-items: flex-start; justify-content: center;
  padding: 4px 8px; font-family: var(--font-mono); font-size: 9px;
  font-weight: 600; border-radius: 4px;
  height: fit-content;
}
.src-call { background: var(--c-info-bg); color: var(--c-info); }
.src-workshop { background: var(--brand-accent-soft); color: var(--brand-accent-deep); }
.src-email { background: var(--c-success-bg); color: var(--c-success); }
.src-note { background: var(--c-surface); color: var(--c-text-muted); }
.bcw-h-label { color: var(--c-text); font-weight: 500; margin-bottom: 4px; }
.bcw-h-val { color: var(--c-text); line-height: 1.5; word-break: break-word; }
.bcw-h-meta {
  font-family: var(--font-mono); font-size: 10px;
  color: var(--c-text-dim); margin-top: 4px;
}

/* ============================================================
   BCW MODAL OVERLAY
   ============================================================ */
.bcw-modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, 0.55);
  z-index: 100;
  display: flex; align-items: flex-start; justify-content: center;
  overflow-y: auto;
  padding: 40px 20px;
  animation: fadeIn 0.15s;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.bcw-modal {
  background: var(--c-surface);
  border-radius: 12px;
  max-width: 880px; width: 100%;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
  animation: slideUp 0.2s ease-out;
}
@keyframes slideUp { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.modal-head {
  display: flex; justify-content: space-between; align-items: flex-start;
  padding: 20px 28px;
  border-bottom: 1px solid var(--c-line);
  gap: 16px; flex-wrap: wrap;
}
.modal-head .eyebrow-mini {
  font-family: var(--font-mono); font-size: 10px;
  text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--brand-accent-deep); margin-bottom: 6px;
}
.modal-head h2 { font-size: 22px; font-weight: 600; margin: 0 0 4px 0; letter-spacing: -0.01em; }
.modal-head p { font-size: 13px; color: var(--c-text-muted); margin: 0; }
.modal-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.modal-actions .ghost-btn { padding: 6px 12px; font-size: 12px; min-height: 32px; }
.modal-actions .close-btn {
  background: var(--c-surface-2); border-color: transparent;
  font-size: 14px; padding: 6px 10px;
}

/* PRECALL */
.precall-card { max-width: 760px; }
.precall-body { padding: 24px 28px; }
.precall-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px; margin-bottom: 24px;
  padding: 14px 16px;
  background: var(--c-surface-2); border-radius: 8px;
}
.precall-grid .ck {
  font-family: var(--font-mono); font-size: 10px;
  text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--c-text-dim); margin-bottom: 4px;
}
.precall-grid .cv { font-size: 13px; color: var(--c-text); font-weight: 500; }
.precall-block { margin-bottom: 22px; }
.precall-block h3 {
  font-size: 12px; font-family: var(--font-mono);
  text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--brand-accent-deep);
  margin: 0 0 10px 0; font-weight: 500;
}
.precall-block ul, .precall-block ol { margin: 0; padding-left: 18px; font-size: 14px; line-height: 1.6; }
.precall-block li { margin-bottom: 6px; }
.precall-block.warn-block {
  padding: 14px 16px; background: var(--c-warn-bg);
  border-radius: 8px; border-left: 3px solid var(--c-warn);
}
.precall-block.warn-block h3 { color: var(--c-warn); }
.precall-questions li { padding: 10px 0; border-bottom: 1px solid var(--c-line-soft); list-style: none; counter-increment: q; position: relative; padding-left: 30px; }
.precall-questions { counter-reset: q; }
.precall-questions li::before {
  content: counter(q) ".";
  position: absolute; left: 0; top: 10px;
  font-family: var(--font-mono); font-weight: 600; color: var(--c-text-dim);
}
.precall-questions .qsev {
  display: inline-block; padding: 2px 6px;
  font-family: var(--font-mono); font-size: 9px;
  font-weight: 600; border-radius: 3px;
  margin-right: 8px;
}
.precall-questions .severity-blocking .qsev { background: var(--c-error-bg); color: var(--c-error); }
.precall-questions .severity-important .qsev { background: var(--c-warn-bg); color: var(--c-warn); }
.precall-questions .severity-nice .qsev { background: var(--c-surface-2); color: var(--c-text-muted); }
.precall-questions .qtxt { color: var(--c-text); font-weight: 500; }
.precall-questions .qrsn {
  margin-top: 4px; font-size: 12px; color: var(--c-text-muted);
  padding-left: 0; font-style: italic;
}

/* CAPTURE */
.capture-modal { max-width: 820px; }
.capture-body { padding: 20px 28px; }
.capture-fields {
  display: flex; flex-direction: column; gap: 14px;
  max-height: 60vh; overflow-y: auto;
  padding-right: 8px;
}
.capture-field {
  padding: 14px 16px;
  border: 1px solid var(--c-line);
  border-radius: 8px;
  background: var(--c-surface);
}
.capture-field.severity-blocking { border-left: 3px solid var(--c-error); }
.capture-field.severity-important { border-left: 3px solid var(--c-warn); }
.capture-field.severity-nice { border-left: 3px solid var(--c-divider); }
.cf-head { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; flex-wrap: wrap; }
.cf-sev {
  font-family: var(--font-mono); font-size: 9px;
  font-weight: 600; padding: 3px 7px; border-radius: 3px;
}
.severity-blocking .cf-sev { background: var(--c-error-bg); color: var(--c-error); }
.severity-important .cf-sev { background: var(--c-warn-bg); color: var(--c-warn); }
.severity-nice .cf-sev { background: var(--c-surface-2); color: var(--c-text-muted); }
.cf-label { font-size: 14px; font-weight: 500; color: var(--c-text); }
.cf-question { font-size: 13px; color: var(--c-text-muted); margin-bottom: 10px; line-height: 1.5; }
.cf-input {
  width: 100%; padding: 10px 12px; font-size: 14px;
  border: 1px solid var(--c-line); border-radius: 6px;
  background: var(--c-bg);
  font-family: inherit; color: var(--c-text); outline: none;
  resize: vertical; min-height: 60px;
  line-height: 1.5;
}
.cf-input:focus { border-color: var(--brand-accent); box-shadow: var(--sh-focus); }
.capture-foot {
  display: flex; justify-content: space-between; align-items: center;
  margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--c-line);
  flex-wrap: wrap; gap: 12px;
}
.filled-count {
  font-family: var(--font-mono); font-size: 12px; color: var(--c-text-muted);
}
.capture-buttons { display: flex; gap: 8px; }

/* WORKSHOP DOC */
.workshop-doc { max-width: 800px; }
.workshop-body { padding: 24px 28px; }
.ws-block { margin-bottom: 22px; }
.ws-block h3 {
  font-size: 12px; font-family: var(--font-mono);
  text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--brand-accent-deep);
  margin: 0 0 10px 0; font-weight: 500;
}
.ws-block ul, .ws-block ol { margin: 0; padding-left: 18px; font-size: 14px; line-height: 1.6; }
.ws-block.warn {
  padding: 14px 16px; background: var(--c-warn-bg);
  border-radius: 8px; border-left: 3px solid var(--c-warn);
}
.ws-block.warn h3 { color: var(--c-warn); }

/* ============================================================
   PRINT STYLES — for Pre-call Card + Workshop Pre-Read
   ============================================================ */
@media print {
  body * { visibility: hidden; }
  .bcw-modal-overlay, .bcw-modal-overlay * { visibility: visible; }
  .bcw-modal-overlay {
    position: absolute; inset: 0;
    background: white; padding: 0;
    overflow: visible;
  }
  .bcw-modal {
    box-shadow: none; max-width: none; width: 100%;
    border-radius: 0;
  }
  .modal-actions { display: none !important; }
  .modal-head { border-bottom: 2px solid #000; }
  .precall-block, .ws-block { page-break-inside: avoid; }
}

/* ============================================================
   RESPONSIVE — BCW
   ============================================================ */
@media (max-width: 768px) {
  .gap-matrix-head, .gap-row {
    grid-template-columns: 1fr; gap: 6px;
  }
  .gap-matrix-head { display: none; }
  .gap-row .gap-label::before { content: "Cần xác minh: "; color: var(--c-text-dim); font-size: 11px; }
  .gap-row .gap-reason::before { content: "Tại sao: "; color: var(--c-text-dim); font-size: 11px; }

  .bcw-modal-overlay { padding: 12px; }
  .modal-head { padding: 16px 18px; }
  .precall-body, .capture-body, .workshop-body { padding: 16px 18px; }
  .modal-head h2 { font-size: 18px; }
}

@media (max-width: 540px) {
  .bcw-actions { flex-direction: column; }
  .bcw-actions .bcw-btn { width: 100%; }
  .modal-actions .ghost-btn { padding: 6px 10px; font-size: 11px; }
  .precall-grid { grid-template-columns: 1fr 1fr; }
  .capture-fields { max-height: 55vh; }
  .capture-foot { flex-direction: column; align-items: stretch; }
  .capture-buttons { width: 100%; }
  .capture-buttons button { flex: 1; }
}

/* ============================================================
   V11.5.1 — UX RESTRUCTURE: Hero, Brief gauge, Collapsibles, Drawer, A4 doc
   ============================================================ */

/* HERO */
.project-view { padding: 0; }
.project-hero {
  background: var(--c-surface);
  padding: 28px 28px 24px;
  border-bottom: 1px solid var(--c-line);
}
.hero-meta {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 14px; gap: 12px; flex-wrap: wrap;
}
.hero-meta .req-id {
  font-family: var(--font-mono); font-size: 11px;
  text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--c-text-dim);
}
.hero-grid {
  display: grid; grid-template-columns: minmax(0, 1fr) auto;
  gap: 28px; align-items: center;
}
.hero-main { min-width: 0; }
.hero-company {
  font-size: 32px; font-weight: 600; letter-spacing: -0.02em;
  margin: 0 0 6px 0; line-height: 1.15;
  color: var(--c-text);
}
.hero-sub {
  font-size: 14px; color: var(--c-text-muted); margin-bottom: 14px;
  line-height: 1.5;
}
.hero-tags { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 18px; }
.hero-next {
  padding: 14px 18px;
  background: var(--brand-accent-soft);
  border-left: 3px solid var(--brand-accent);
  border-radius: 6px;
}
.hero-next .hn-label {
  font-family: var(--font-mono); font-size: 10px;
  text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--brand-accent-deep); margin-bottom: 6px;
}
.hero-next .hn-text {
  font-size: 15px; color: var(--c-text); line-height: 1.55; font-weight: 500;
}

/* BRIEF GAUGE */
.brief-gauge {
  display: flex; flex-direction: column; align-items: center;
  gap: 8px; flex-shrink: 0;
}
.brief-gauge svg { display: block; }
.gauge-status {
  font-family: var(--font-mono); font-size: 11px;
  text-transform: uppercase; letter-spacing: 0.06em;
  font-weight: 600; text-align: center;
}

/* OLD detail-head — fade out, no longer used but keep for legacy compat */
.project-view .detail-head { display: none; }

/* BCW SPOTLIGHT — moved to top, give it visual weight */
.project-view .bcw-section {
  margin-top: 20px; margin-bottom: 24px;
  border-left-width: 4px;
  background: var(--c-surface);
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
.project-view .bcw-actions { gap: 10px; }
.project-view .bcw-btn { padding: 12px 20px; font-size: 14px; min-height: 44px; font-weight: 500; }

/* SECONDARY GROUP LABEL */
.secondary-group-label {
  margin: 28px 24px 8px;
  font-family: var(--font-mono); font-size: 10px;
  text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--c-text-dim);
  padding-bottom: 8px;
  border-bottom: 1px solid var(--c-line);
}

/* COLLAPSIBLE SECTIONS */
.detail-section.collapsible {
  margin-top: 8px;
}
.collapsible-head {
  display: flex; align-items: center; gap: 10px;
  width: 100%; padding: 14px 22px;
  background: transparent; border: 0;
  text-align: left; cursor: pointer;
  border-radius: 8px 8px 0 0;
  transition: background 0.15s;
}
.collapsible-head:hover { background: var(--c-surface-2); }
.collapsible-head .chev {
  font-family: var(--font-mono); font-size: 12px;
  color: var(--c-text-dim); width: 14px; flex-shrink: 0;
}
.collapsible-head h3 { margin: 0; flex: 1; }
.detail-section.collapsible.is-collapsed {
  padding-bottom: 0;
}
.detail-section.collapsible:not(.is-collapsed) .collapsible-head {
  border-bottom: 1px solid var(--c-line-soft);
  background: var(--c-surface-2);
}
.collapsible-body {
  padding: 18px 22px;
}

/* DRAWER (slide from right, replaces capture modal) */
.bcw-drawer-backdrop {
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 100;
  display: flex; justify-content: flex-end;
  animation: fadeIn 0.15s;
}
.bcw-drawer {
  background: var(--c-surface);
  width: 540px; max-width: 100vw;
  height: 100vh;
  display: flex; flex-direction: column;
  box-shadow: -10px 0 40px rgba(0,0,0,0.2);
  animation: slideInRight 0.22s ease-out;
  overflow: hidden;
}
@keyframes slideInRight { from { transform: translateX(100%); } to { transform: translateX(0); } }
.drawer-head {
  display: flex; justify-content: space-between; align-items: flex-start;
  padding: 22px 24px;
  border-bottom: 1px solid var(--c-line);
  gap: 12px;
}
.drawer-head .eyebrow-mini {
  font-family: var(--font-mono); font-size: 10px;
  text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--brand-accent-deep); margin-bottom: 6px;
}
.drawer-head h2 { font-size: 22px; font-weight: 600; margin: 0 0 6px 0; letter-spacing: -0.01em; }
.drawer-head p { font-size: 12px; color: var(--c-text-muted); margin: 0; line-height: 1.5; }

.bcw-drawer .capture-body {
  flex: 1; overflow-y: auto; padding: 18px 24px;
}

/* V11.5.4 — Inline owner selector inside capture drawer */
.capture-owner-bar {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 24px;
  background: var(--c-surface-2);
  border-bottom: 1px solid var(--c-line);
  flex-wrap: wrap;
}
.capture-owner-bar .co-label {
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--c-text-muted);
  font-weight: 500;
  flex-shrink: 0;
}
.capture-owner-bar .co-select {
  flex: 1; min-width: 180px;
  padding: 8px 32px 8px 12px;
  background: var(--c-surface);
  border: 1px solid var(--c-line);
  border-radius: 6px;
  color: var(--c-text);
  font-size: 13px;
  font-family: inherit;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6' fill='none'%3E%3Cpath d='M1 1L5 5L9 1' stroke='%23525252' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  cursor: pointer;
  outline: none;
}
.capture-owner-bar .co-select:focus {
  border-color: var(--brand-accent);
  box-shadow: var(--sh-focus);
}
.capture-owner-bar .co-status {
  font-family: var(--font-mono); font-size: 11px;
  font-weight: 500;
  white-space: nowrap;
}
.capture-owner-bar .co-status.ok { color: var(--c-success); }
.capture-owner-bar .co-status.warn { color: var(--c-warn); }

@media (max-width: 540px) {
  .capture-owner-bar {
    flex-direction: column; align-items: stretch;
    padding: 10px 18px;
  }
  .capture-owner-bar .co-select { width: 100%; }
  .capture-owner-bar .co-status { text-align: center; }
}
.bcw-drawer .capture-fields { max-height: none; padding-right: 0; }
.bcw-drawer .capture-foot {
  border-top: 1px solid var(--c-line);
  padding: 14px 24px;
  background: var(--c-surface);
  margin: 0;
}

.ghost-btn.danger {
  color: var(--c-error);
  border-color: rgba(200, 72, 58, 0.3);
}
.ghost-btn.danger:hover { background: var(--c-error-bg); }

/* ============================================================
   PRE-CALL DOC — A4 print-ready layout
   ============================================================ */
.precall-doc {
  max-width: 820px;
  background: var(--c-bg);
  padding: 16px;
}
.doc-toolbar {
  display: flex; justify-content: space-between; align-items: center;
  padding: 4px 8px 16px; gap: 12px; flex-wrap: wrap;
}
.doc-toolbar .doc-meta {
  font-family: var(--font-mono); font-size: 11px;
  color: var(--c-text-dim);
  text-transform: uppercase; letter-spacing: 0.06em;
}
.doc-page {
  background: white;
  padding: 50px 56px 40px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.08);
  font-family: "Inter", "Be Vietnam Pro", sans-serif;
  color: #1A1918;
  /* A4 portrait approximate */
  min-height: 1100px;
}
.doc-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 24px;
  padding-bottom: 24px;
  border-bottom: 2px solid #1A1918;
  margin-bottom: 28px;
}
.doc-logo { height: 32px; width: auto; flex-shrink: 0; }
.doc-title { text-align: right; }
.doc-title .dt-label {
  font-family: var(--font-mono); font-size: 10px;
  text-transform: uppercase; letter-spacing: 0.1em;
  font-weight: 600;
}
.doc-title .dt-meta {
  font-family: var(--font-mono); font-size: 10px;
  color: #65625B; margin-top: 4px;
}
.doc-client-block { margin-bottom: 32px; }
.doc-h1 {
  font-size: 28px; font-weight: 600; letter-spacing: -0.02em;
  margin: 0 0 6px 0; line-height: 1.15;
}
.doc-h1-sub { font-size: 13px; color: #65625B; }
.doc-page .precall-grid {
  grid-template-columns: repeat(4, 1fr);
}
.doc-page .precall-block { page-break-inside: avoid; }
.doc-page .precall-block h3 {
  font-size: 11px; color: #1A1918;
  border-bottom: 1px solid #DCDAD3; padding-bottom: 6px; margin-bottom: 10px;
}
.doc-footer {
  margin-top: 36px; padding-top: 18px;
  border-top: 1px solid #DCDAD3;
  display: flex; justify-content: space-between;
  font-family: var(--font-mono); font-size: 10px;
  color: #94908A;
}

/* PRINT — make sure pre-call doc prints clean */
@media print {
  .doc-toolbar { display: none !important; }
  .precall-doc { padding: 0; max-width: none; background: white; box-shadow: none; }
  .doc-page { box-shadow: none; min-height: auto; padding: 20mm; }
  .bcw-modal-overlay { background: white; padding: 0; align-items: flex-start; }
  .bcw-modal { box-shadow: none; max-width: none; width: 100%; }
}

/* ============================================================
   RESPONSIVE — Hero + Drawer + Doc
   ============================================================ */
@media (max-width: 1024px) {
  .hero-grid { grid-template-columns: minmax(0, 1fr); gap: 18px; }
  .brief-gauge { flex-direction: row; align-self: flex-start; }
  .brief-gauge svg { width: 100px; height: 100px; }
  .bcw-drawer { width: 100vw; }
}

@media (max-width: 768px) {
  .project-hero { padding: 20px 16px 18px; }
  .hero-company { font-size: 24px; }
  .hero-sub { font-size: 13px; }
  .hero-next { padding: 12px 14px; }
  .secondary-group-label { margin-left: 16px; margin-right: 16px; }
  .collapsible-head { padding: 12px 16px; }
  .collapsible-body { padding: 14px 16px; }
  .doc-page { padding: 24px 20px; min-height: auto; }
  .doc-h1 { font-size: 22px; }
  .doc-page .precall-grid { grid-template-columns: 1fr 1fr; }
  .drawer-head { padding: 18px 18px; }
  .bcw-drawer .capture-body { padding: 14px 18px; }
  .bcw-drawer .capture-foot { padding: 12px 18px; }
}

/* ============================================================
   V11.5.2 — UI REBUILD: Top-tab nav + Project Workspace
   ============================================================ */

/* App shell — full-height layout */
.app-shell.v2 {
  min-height: 100vh;
  display: flex; flex-direction: column;
}

/* Top-tab navbar */
.topbar.v2 {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 24px;
  padding: 0 20px;
  height: 60px;
  border-bottom: 1px solid var(--c-line);
  background: var(--c-surface);
  position: sticky; top: 0; z-index: 50;
}
.topbar-brand .brand-logo img { height: 26px; }
.top-tabs {
  display: flex; gap: 4px;
  justify-self: center;
}
.top-tab {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 18px;
  font-size: 14px; font-weight: 500;
  color: var(--c-text-muted);
  border-radius: 6px;
  border: 1px solid transparent;
  transition: all 0.15s;
  background: transparent;
  min-height: 40px;
}
.top-tab:hover { background: var(--c-surface-2); color: var(--c-text); }
.top-tab.is-active {
  background: var(--c-text);
  color: var(--c-surface);
  border-color: var(--c-text);
}
.top-tab .tt-icon { font-size: 16px; }
.topbar-right {
  display: flex; align-items: center; gap: 10px;
  font-family: var(--font-mono); font-size: 11px;
}
.topbar-right .last-sync { color: var(--c-text-dim); }
.topbar-right .ghost-btn { padding: 6px 12px; font-size: 12px; min-height: 32px; }

/* Tab content container */
.tab-content {
  flex: 1;
  display: block;
  background: var(--c-bg);
}

/* ============================================================
   DASHBOARD TAB
   ============================================================ */
.dashboard-tab {
  padding: 28px 32px;
  max-width: 1400px; margin: 0 auto;
  display: flex; flex-direction: column; gap: 32px;
}
.dashboard-tab h2 {
  font-size: 11px;
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--c-text-dim);
  margin: 0 0 14px 0;
  font-weight: 500;
}

.dash-kpi-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
}
.kpi-big {
  padding: 22px 24px;
  background: var(--c-surface);
  border: 1px solid var(--c-line);
  border-radius: 12px;
  box-shadow: var(--sh-sm);
  transition: transform 0.15s;
}
.kpi-big:hover { transform: translateY(-2px); box-shadow: var(--sh-md); }
.kpi-big.kpi-warn { border-left: 3px solid var(--c-warn); }
.kpi-big.kpi-info { border-left: 3px solid var(--c-info); }
.kpi-big.kpi-success { border-left: 3px solid var(--c-success); }
.kbig-label {
  font-family: var(--font-mono); font-size: 10px;
  text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--c-text-dim); margin-bottom: 8px;
}
.kbig-value {
  font-size: 36px; font-weight: 600; letter-spacing: -0.02em;
  color: var(--c-text); line-height: 1; margin-bottom: 8px;
}
.kbig-note {
  font-size: 12px; color: var(--c-text-muted); line-height: 1.4;
}

/* Pipeline */
.dash-pipeline {
  background: var(--c-surface);
  padding: 24px 28px;
  border-radius: 12px;
  border: 1px solid var(--c-line);
}
.pipeline-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
}
.stage-col {
  background: var(--c-surface-2);
  border-radius: 8px;
  padding: 14px;
  min-height: 280px;
  display: flex; flex-direction: column;
}
.stage-head {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--c-line);
}
.stage-label {
  font-size: 12px; font-weight: 500; color: var(--c-text);
}
.stage-count {
  font-family: var(--font-mono); font-size: 12px;
  background: var(--c-surface);
  padding: 3px 8px; border-radius: 99px;
  color: var(--c-text-muted); font-weight: 500;
}
.stage-body {
  display: flex; flex-direction: column; gap: 6px;
  flex: 1;
}
.stage-card {
  text-align: left;
  background: var(--c-surface);
  padding: 10px 12px;
  border-radius: 6px;
  border: 1px solid transparent;
  transition: all 0.15s;
  position: relative;
}
.stage-card:hover {
  border-color: var(--brand-accent);
  box-shadow: var(--sh-sm);
}
.sc-name { font-size: 13px; font-weight: 500; color: var(--c-text); margin-bottom: 2px; word-break: break-word; }
.sc-company { font-size: 11px; color: var(--c-text-muted); }
.sc-risk-dot {
  position: absolute; top: 8px; right: 10px;
  color: var(--c-error); font-size: 10px;
}
.stage-empty {
  font-size: 12px; color: var(--c-text-dim); font-style: italic;
  padding: 20px 0; text-align: center;
}
.stage-more {
  margin-top: 8px; padding-top: 8px;
  border-top: 1px dashed var(--c-divider);
  font-size: 11px; color: var(--c-text-dim);
  text-align: center; font-family: var(--font-mono);
}

/* Workload table */
.dash-workload {
  background: var(--c-surface);
  padding: 24px 28px;
  border-radius: 12px;
  border: 1px solid var(--c-line);
}
.workload-table { display: flex; flex-direction: column; gap: 8px; }
.wl-row {
  display: grid; grid-template-columns: 200px 100px 1fr;
  gap: 16px; align-items: center;
  padding: 10px 14px;
  background: var(--c-surface-2); border-radius: 6px;
}
.wl-row.unassigned { background: var(--c-warn-bg); }
.wl-row.unassigned .wl-name { color: var(--c-warn); font-weight: 600; }
.wl-name { font-size: 13px; font-weight: 500; color: var(--c-text); }
.wl-count { font-family: var(--font-mono); font-size: 12px; color: var(--c-text-muted); }
.wl-bar {
  height: 6px; background: var(--c-line); border-radius: 99px; overflow: hidden;
}
.wl-fill {
  height: 100%; background: var(--brand-accent);
  transition: width 0.4s ease;
}
.wl-empty { padding: 24px; text-align: center; color: var(--c-text-dim); }

/* ============================================================
   PROJECTS TAB — Sidebar + Workspace
   ============================================================ */
.projects-tab {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  height: calc(100vh - 60px - 36px); /* topbar - footer */
  overflow: hidden;
  position: relative;
}

.project-sidebar {
  background: var(--c-surface);
  border-right: 1px solid var(--c-line);
  display: flex; flex-direction: column;
  overflow: hidden;
  transition: width 0.2s ease;
}
.project-sidebar.is-collapsed { width: 0; }
.sidebar-head {
  display: flex; gap: 8px; align-items: center;
  padding: 14px 16px;
  border-bottom: 1px solid var(--c-line-soft);
}
.sidebar-search {
  flex: 1;
  padding: 8px 12px;
  font-size: 13px;
  border: 1px solid var(--c-line);
  border-radius: 6px;
  background: var(--c-bg);
  outline: none;
  min-width: 0;
}
.sidebar-search:focus { border-color: var(--brand-accent); box-shadow: var(--sh-focus); }
.sidebar-toggle {
  flex-shrink: 0;
  width: 28px; height: 28px;
  border-radius: 4px;
  background: var(--c-surface-2);
  color: var(--c-text-muted);
  font-size: 16px;
  font-weight: 600;
}
.sidebar-toggle:hover { background: var(--c-divider); color: var(--c-text); }
.sidebar-meta {
  padding: 8px 16px;
  font-family: var(--font-mono); font-size: 10px;
  text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--c-text-dim);
  border-bottom: 1px solid var(--c-line-soft);
}
.sidebar-list {
  flex: 1; overflow-y: auto;
}
.sb-item {
  display: grid; grid-template-columns: 16px 1fr;
  gap: 10px; align-items: flex-start;
  width: 100%;
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid var(--c-line-soft);
  background: transparent;
  transition: background 0.1s;
}
.sb-item:hover { background: var(--c-surface-2); }
.sb-item.is-selected {
  background: var(--brand-accent-soft);
  border-left: 3px solid var(--brand-accent);
  padding-left: 13px;
}
.sb-dot { font-size: 10px; margin-top: 5px; }
.sb-dot.dot-success { color: var(--c-success); }
.sb-dot.dot-warn { color: var(--c-warn); }
.sb-dot.dot-brand { color: var(--brand-accent); }
.sb-dot.dot-neutral { color: var(--c-text-dim); }
.sb-body { min-width: 0; }
.sb-name {
  font-size: 13px; font-weight: 500; color: var(--c-text);
  margin-bottom: 2px; word-break: break-word;
}
.sb-sub { font-size: 11px; color: var(--c-text-muted); margin-bottom: 4px; }
.sb-tags { display: flex; gap: 4px; flex-wrap: wrap; }
.mini-tag {
  font-family: var(--font-mono); font-size: 9px;
  padding: 2px 5px; border-radius: 3px;
  background: var(--c-surface-2); color: var(--c-text-muted);
  text-transform: uppercase; letter-spacing: 0.04em;
}
.mini-tag.warn { background: var(--c-warn-bg); color: var(--c-warn); }
.mini-tag.danger { background: var(--c-error-bg); color: var(--c-error); }
.mini-tag.info { background: var(--c-info-bg); color: var(--c-info); }
.sb-empty {
  padding: 32px 20px; text-align: center;
  color: var(--c-text-dim); font-size: 13px; font-style: italic;
}

/* Project Workspace */
.project-workspace {
  background: var(--c-bg);
  overflow-y: auto;
  position: relative;
  min-width: 0;
}
.ws-empty {
  padding: 80px 40px;
  text-align: center;
  color: var(--c-text-dim);
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; min-height: 60vh;
}
.ws-empty-icon { font-size: 48px; margin-bottom: 16px; opacity: 0.4; }
.ws-empty h2 { font-size: 18px; font-weight: 500; color: var(--c-text-muted); margin: 0 0 8px 0; }
.ws-empty p { font-size: 13px; color: var(--c-text-dim); max-width: 400px; line-height: 1.5; }

/* PROJECT HERO V2 — sticky */
.project-hero.v2 {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 24px;
  align-items: center;
  padding: 20px 28px;
  background: var(--c-surface);
  border-bottom: 1px solid var(--c-line);
  position: sticky; top: 0; z-index: 20;
}
.project-hero.v2.sticky { /* sticky already applied above */ }
.ph-left .brief-gauge svg { width: 100px; height: 100px; }
.ph-left .gauge-status { font-size: 9px; }
.ph-main { min-width: 0; }
.ph-meta {
  display: flex; gap: 8px; align-items: center;
  margin-bottom: 4px;
}
.ph-id {
  font-family: var(--font-mono); font-size: 10px;
  text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--c-text-dim);
}
.ph-company {
  font-size: 24px; font-weight: 600; letter-spacing: -0.02em;
  margin: 0 0 4px 0; line-height: 1.2;
  color: var(--c-text);
}
.ph-sub {
  font-size: 13px; color: var(--c-text-muted); margin-bottom: 8px;
}
.ph-tags { display: flex; gap: 6px; flex-wrap: wrap; }
.ph-actions {
  display: flex; flex-direction: column; gap: 6px;
  flex-shrink: 0;
}
.ph-action-btn {
  padding: 8px 14px;
  font-size: 12px; font-weight: 500;
  border: 1px solid var(--c-line);
  border-radius: 6px;
  background: var(--c-surface);
  color: var(--c-text);
  white-space: nowrap;
  min-height: 32px;
  transition: all 0.15s;
}
.ph-action-btn:hover {
  border-color: var(--brand-accent);
  background: var(--brand-accent-soft);
  color: var(--brand-accent-deep);
}
.ph-action-btn.primary {
  background: var(--c-text); color: var(--c-surface); border-color: var(--c-text);
}
.ph-action-btn.primary:hover {
  background: var(--brand-accent); border-color: var(--brand-accent); color: #fff;
}

/* Project sub-tabs */
.project-tabs {
  display: flex; gap: 0;
  padding: 0 28px;
  background: var(--c-surface);
  border-bottom: 1px solid var(--c-line);
  position: sticky; top: 142px; z-index: 15;
}
.ptab {
  padding: 14px 20px;
  background: transparent;
  border: 0;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  display: flex; flex-direction: column; align-items: flex-start;
  gap: 2px;
  transition: all 0.15s;
  text-align: left;
}
.ptab-label { font-size: 13px; font-weight: 500; color: var(--c-text-muted); }
.ptab-sub { font-size: 10px; color: var(--c-text-dim); font-family: var(--font-mono); text-transform: uppercase; letter-spacing: 0.06em; }
.ptab:hover .ptab-label { color: var(--c-text); }
.ptab.is-active { border-bottom-color: var(--brand-accent); }
.ptab.is-active .ptab-label { color: var(--c-text); font-weight: 600; }
.ptab.is-active .ptab-sub { color: var(--brand-accent-deep); }

/* Tab content area */
.project-tab-content {
  padding: 24px 28px 80px;
}
.ws-content { display: flex; flex-direction: column; gap: 18px; }

/* Override detail-section margins inside ws-content */
.ws-content .detail-section { margin: 0; }

/* QUICK ACTION FAB */
.quick-fab {
  position: fixed;
  bottom: 28px; right: 28px;
  width: 56px; height: 56px;
  border-radius: 50%;
  background: var(--c-text);
  color: var(--c-surface);
  font-size: 22px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
  z-index: 50;
  transition: all 0.2s;
  border: 0; cursor: pointer;
}
.quick-fab:hover {
  background: var(--brand-accent);
  transform: scale(1.05);
}
.quick-drawer { width: 480px; }

/* V11.5.3 — Quick drawer light theme overrides (fix poor contrast) */
.quick-drawer .actions-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.quick-drawer .actions-grid .wide { grid-column: 1 / -1; }
.quick-drawer .actions-grid .field-edit {
  display: flex; flex-direction: column; gap: 6px;
}
.quick-drawer .actions-grid .field-edit span {
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--c-text-dim);
  font-weight: 500;
}
.quick-drawer .actions-grid .field-edit input,
.quick-drawer .actions-grid .field-edit select,
.quick-drawer .actions-grid .field-edit textarea {
  padding: 10px 12px;
  background: var(--c-bg);                   /* light background, not transparent */
  border: 1px solid var(--c-line);            /* solid visible border */
  border-radius: 6px;
  color: var(--c-text);                       /* dark text for contrast */
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  min-height: 40px;
}
.quick-drawer .actions-grid .field-edit input::placeholder,
.quick-drawer .actions-grid .field-edit textarea::placeholder {
  color: var(--c-text-dim);
  opacity: 0.7;
}
.quick-drawer .actions-grid .field-edit input:focus,
.quick-drawer .actions-grid .field-edit select:focus,
.quick-drawer .actions-grid .field-edit textarea:focus {
  border-color: var(--brand-accent);
  box-shadow: var(--sh-focus);
  background: var(--c-surface);
}
.quick-drawer .actions-grid .field-edit textarea {
  min-height: 90px;
  resize: vertical;
  line-height: 1.5;
}
.quick-drawer .actions-grid .field-edit select {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8' fill='none'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%23525252' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
  cursor: pointer;
}
.quick-drawer .capture-foot {
  background: var(--c-surface-2);
  border-top: 1px solid var(--c-line);
}
.quick-drawer .filled-count {
  font-size: 12px;
  color: var(--c-text-muted);
  font-family: var(--font-sans);
}

/* ============================================================
   V11.5.3 — PROJECT REPORT DOC (printable A4 portrait)
   ============================================================ */
.report-overlay { background: rgba(20, 18, 15, 0.6); align-items: flex-start; padding: 24px 16px; }
.report-doc {
  background: var(--c-bg);
  max-width: 920px;
  width: 100%;
  border-radius: 12px;
  overflow: hidden;
  padding-bottom: 16px;
}
.report-toolbar {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 22px;
  background: var(--c-surface);
  border-bottom: 1px solid var(--c-line);
  position: sticky; top: 0; z-index: 5;
}
.report-toolbar .doc-meta {
  font-family: var(--font-mono); font-size: 11px;
  color: var(--c-text-dim);
  text-transform: uppercase; letter-spacing: 0.06em;
}

.report-document {
  display: flex; flex-direction: column;
  gap: 24px;
  padding: 24px;
  /* Document base font for A4 readability */
  font-family: "Inter", "Be Vietnam Pro", sans-serif;
  color: #1A1918;
  font-size: 13px;
  line-height: 1.55;
}

/* Each .rp-page is rendered as a sheet that prints to a single A4 page */
.rp-page {
  background: white;
  padding: 56px 64px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  border-radius: 4px;
  /* A4: 210mm × 297mm. Approximate min-height for visual on screen */
  min-height: 1100px;
  page-break-after: always;
}
.rp-page:last-child { page-break-after: auto; }

/* ----- COVER PAGE ----- */
.rp-cover {
  display: flex; flex-direction: column;
  justify-content: space-between;
  background: linear-gradient(180deg, #FAFAF9 0%, white 50%);
}
.rp-cover-head {
  display: flex; justify-content: space-between; align-items: flex-start;
  padding-bottom: 24px;
  border-bottom: 2px solid #1A1918;
}
.rp-logo { height: 32px; }
.rp-cover-org { text-align: right; }
.rp-cover-org-line {
  font-family: var(--font-mono); font-size: 11px;
  font-weight: 600; letter-spacing: 0.08em;
  text-transform: uppercase;
}
.rp-cover-org-sub {
  font-family: var(--font-mono); font-size: 10px;
  color: #65625B; letter-spacing: 0.04em;
  margin-top: 2px;
}

.rp-cover-body { flex: 1; padding-top: 40px; }
.rp-cover-eyebrow {
  font-family: var(--font-mono); font-size: 11px;
  letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--brand-accent-deep);
  margin-bottom: 18px;
}
.rp-cover-company {
  font-size: 44px; line-height: 1.1;
  font-weight: 600; letter-spacing: -0.02em;
  margin: 0 0 8px 0;
  color: #1A1918;
}
.rp-cover-client {
  font-size: 16px; color: #65625B; margin-bottom: 38px;
}

.rp-cover-gauge-wrap {
  display: flex; align-items: center; gap: 32px;
  padding: 24px 28px;
  background: #FAFAF9;
  border-left: 4px solid var(--brand-accent);
  border-radius: 4px;
  margin-bottom: 36px;
}
.rp-cover-gauge-wrap .brief-gauge svg { width: 130px; height: 130px; }
.rp-cover-gauge-side { flex: 1; }
.rp-cover-status {
  font-size: 18px; font-weight: 600; letter-spacing: -0.01em;
  color: #1A1918; margin-bottom: 6px;
}
.rp-cover-action {
  font-size: 14px; color: #65625B; line-height: 1.55;
}

.rp-cover-meta {
  width: 100%; border-collapse: collapse;
  margin-bottom: 36px;
}
.rp-cover-meta tr { border-bottom: 1px solid #ECE9E2; }
.rp-cover-meta tr:last-child { border-bottom: 0; }
.rp-meta-k {
  width: 35%; padding: 10px 14px 10px 0;
  font-family: var(--font-mono); font-size: 10px;
  text-transform: uppercase; letter-spacing: 0.06em;
  color: #94908A; font-weight: 500;
  vertical-align: top;
}
.rp-meta-v {
  padding: 10px 0;
  font-size: 13px; color: #1A1918; font-weight: 500;
}

.rp-cover-toc {
  margin-top: auto;
  padding-top: 24px;
  border-top: 1px solid #DCDAD3;
}
.rp-toc-title {
  font-family: var(--font-mono); font-size: 10px;
  text-transform: uppercase; letter-spacing: 0.08em;
  color: #94908A; font-weight: 600;
  margin-bottom: 12px;
}
.rp-toc-list {
  margin: 0; padding-left: 22px;
  font-size: 13px; line-height: 1.8;
  color: #1A1918;
}
.rp-toc-list li::marker { color: var(--brand-accent); font-weight: 600; }

.rp-cover-footer {
  display: flex; justify-content: space-between;
  margin-top: 36px; padding-top: 18px;
  border-top: 1px solid #DCDAD3;
  font-family: var(--font-mono); font-size: 10px;
  color: #94908A;
}

/* ----- SECTION PAGES ----- */
.rp-section-head {
  display: grid;
  grid-template-columns: 64px 1fr;
  gap: 16px;
  align-items: flex-start;
  padding-bottom: 24px;
  border-bottom: 2px solid #1A1918;
  margin-bottom: 28px;
}
.rp-section-num {
  font-family: var(--font-mono); font-size: 38px;
  font-weight: 600;
  color: var(--brand-accent);
  line-height: 1;
}
.rp-section-title {
  font-size: 22px; font-weight: 600;
  letter-spacing: -0.01em;
  margin: 0 0 4px 0;
  color: #1A1918;
}
.rp-section-sub {
  font-size: 13px; color: #65625B; line-height: 1.5;
}

.rp-summary {
  font-size: 16px; line-height: 1.6;
  color: #1A1918;
  margin: 0 0 28px 0;
  padding: 18px 22px;
  background: #FAFAF9;
  border-left: 3px solid var(--brand-accent);
  border-radius: 4px;
}

.rp-block { margin-bottom: 24px; }
.rp-block:last-child { margin-bottom: 0; }
.rp-block h3 {
  font-size: 11px; font-family: var(--font-mono);
  text-transform: uppercase; letter-spacing: 0.08em;
  color: #1A1918; font-weight: 600;
  margin: 0 0 10px 0;
  padding-bottom: 6px;
  border-bottom: 1px solid #ECE9E2;
}
.rp-block.highlight {
  padding: 18px 22px;
  background: #FEF3E2;
  border-left: 3px solid var(--brand-accent);
  border-radius: 4px;
  border-bottom: 0;
}
.rp-block.highlight h3 { border-bottom: 0; padding-bottom: 0; color: var(--brand-accent-deep); }
.rp-block.highlight p { margin: 0; font-size: 14px; line-height: 1.6; }
.rp-block.bright { background: #E8F4EC; border-left-color: #2F7A4F; }
.rp-block.bright h3 { color: #2F7A4F; }
.rp-block.block-issues { background: #FCEFEC; border-left-color: #C8483A; }
.rp-block.block-issues h3 { color: #C8483A; }

.rp-twocol {
  display: grid; grid-template-columns: 1fr 1fr; gap: 16px;
  margin-bottom: 24px;
}
.rp-twocol .rp-block {
  margin-bottom: 0;
  padding: 14px 18px;
  border-radius: 4px;
  border-left: 3px solid;
}
.rp-twocol .rp-block ul {
  margin: 0; padding-left: 18px; font-size: 13px; line-height: 1.6;
}

.rp-kpi-row {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px;
  margin-bottom: 24px;
}
.rp-kpi {
  padding: 12px 14px;
  background: #FAFAF9;
  border: 1px solid #ECE9E2;
  border-radius: 4px;
}
.rp-kpi-label {
  font-family: var(--font-mono); font-size: 10px;
  text-transform: uppercase; letter-spacing: 0.06em;
  color: #94908A; margin-bottom: 6px;
}
.rp-kpi-value {
  font-size: 15px; font-weight: 500; color: #1A1918;
}

/* ----- TABLES ----- */
.rp-table {
  width: 100%; border-collapse: collapse;
  font-size: 12.5px; line-height: 1.5;
}
.rp-table thead {
  border-bottom: 2px solid #1A1918;
}
.rp-table thead th {
  text-align: left; padding: 8px 12px;
  font-family: var(--font-mono); font-size: 10px;
  text-transform: uppercase; letter-spacing: 0.06em;
  color: #1A1918; font-weight: 600;
}
.rp-table tbody tr {
  border-bottom: 1px solid #ECE9E2;
}
.rp-table tbody tr:last-child { border-bottom: 0; }
.rp-table td {
  padding: 8px 12px;
  vertical-align: top;
  word-break: break-word;
}
.rp-table .rp-q-cell {
  width: 36%;
  font-weight: 500;
  color: #65625B;
}
.rp-table-total td {
  font-weight: 600; color: #1A1918;
  border-top: 2px solid #1A1918 !important;
  padding-top: 12px !important;
}
.rp-score-good td { color: #2F7A4F; }
.rp-score-warn td { color: #B8762A; }
.rp-score-block td { color: #C8483A; font-weight: 500; }

.rp-gaps .rp-q { font-size: 13px; color: #1A1918; font-weight: 500; }
.rp-gaps .rp-r { margin-top: 4px; font-size: 12px; color: #65625B; font-style: italic; }
.rp-row-blocking { background: #FCEFEC; }
.rp-row-important { background: #FCEFD9; }

.rp-sev {
  display: inline-block;
  font-family: var(--font-mono); font-size: 9px;
  font-weight: 700;
  padding: 3px 8px; border-radius: 3px;
  letter-spacing: 0.04em;
  white-space: nowrap;
}
.rp-sev-blocking { background: #C8483A; color: white; }
.rp-sev-important { background: #B8762A; color: white; }
.rp-sev-nice { background: #DCDAD3; color: #1A1918; }

.rp-src {
  display: inline-block;
  font-family: var(--font-mono); font-size: 9px;
  font-weight: 700;
  padding: 3px 7px; border-radius: 3px;
}
.rp-src-call { background: #EBF1FB; color: #2C5BAA; }
.rp-src-workshop { background: #FEF3E2; color: var(--brand-accent-deep); }
.rp-src-email { background: #E8F4EC; color: #2F7A4F; }
.rp-src-note { background: #ECE9E2; color: #65625B; }

.rp-time {
  font-family: var(--font-mono); font-size: 11px;
  color: #65625B; line-height: 1.4;
}

/* ----- MODULE BLOCK ----- */
.rp-module-block {
  margin-bottom: 28px;
  padding: 18px 22px;
  background: #FAFAF9;
  border-left: 3px solid var(--brand-accent);
  border-radius: 4px;
  page-break-inside: avoid;
}
.rp-module-block:last-child { margin-bottom: 0; }
.rp-module-title {
  font-size: 16px; font-weight: 600;
  margin: 0 0 12px 0;
  color: #1A1918;
}
.rp-module-meta {
  font-family: var(--font-mono); font-size: 11px;
  color: #65625B; font-weight: 400;
}
.rp-module-table { background: white; border-radius: 4px; }

/* ----- HEAT MAP ----- */
.rp-heat {
  display: grid; grid-template-columns: 1fr 1fr 1fr;
  gap: 12px; margin-bottom: 20px;
}
.rp-heat-col {
  padding: 14px 16px;
  border-radius: 4px;
}
.rp-heat-col.high { background: #FCEFEC; border-left: 3px solid #C8483A; }
.rp-heat-col.medium { background: #FCEFD9; border-left: 3px solid #B8762A; }
.rp-heat-col.low { background: #E8F4EC; border-left: 3px solid #2F7A4F; }
.rp-heat-col h3 {
  font-size: 11px; font-family: var(--font-mono);
  text-transform: uppercase; letter-spacing: 0.06em;
  margin: 0 0 8px 0; padding: 0; border: 0;
  font-weight: 600;
}
.rp-heat-col.high h3 { color: #C8483A; }
.rp-heat-col.medium h3 { color: #B8762A; }
.rp-heat-col.low h3 { color: #2F7A4F; }
.rp-heat-col ul { margin: 0; padding-left: 18px; font-size: 12.5px; line-height: 1.55; }
.rp-heat-col li { margin-bottom: 4px; }
.rp-heat-col p { margin: 0; font-size: 12.5px; color: #65625B; font-style: italic; }

/* ----- BRIEF FIELD ----- */
.rp-brief-field {
  margin-bottom: 12px;
  padding: 12px 16px;
  background: #FAFAF9;
  border-left: 3px solid var(--brand-accent);
  border-radius: 4px;
}
.rp-brief-field:last-child { margin-bottom: 0; }
.rp-brief-label {
  font-family: var(--font-mono); font-size: 10px;
  text-transform: uppercase; letter-spacing: 0.06em;
  color: #94908A; margin-bottom: 6px; font-weight: 500;
}
.rp-brief-value {
  font-size: 13px; line-height: 1.6; color: #1A1918;
  white-space: pre-wrap;
}

/* ----- LISTS ----- */
.rp-ol, .rp-ul { margin: 0; padding-left: 22px; font-size: 13px; line-height: 1.7; }
.rp-ol li, .rp-ul li { margin-bottom: 6px; }
.rp-ol li::marker { color: var(--brand-accent-deep); font-weight: 600; }

/* ----- NOTES & ACTIVITY ----- */
.rp-note {
  padding: 12px 16px;
  background: #FAFAF9;
  border-left: 3px solid #DCDAD3;
  border-radius: 4px;
  margin-bottom: 10px;
}
.rp-note-meta {
  font-family: var(--font-mono); font-size: 11px;
  color: #65625B; margin-bottom: 6px;
}
.rp-note-body {
  font-size: 13px; line-height: 1.55; color: #1A1918;
}

/* ----- APPENDIX ----- */
.rp-appendix .rp-table { font-size: 11.5px; }
.rp-answers .rp-qid { font-family: var(--font-mono); color: #94908A; font-size: 11px; }
.rp-answers .rp-mod { font-family: var(--font-mono); color: #65625B; font-size: 11px; }

/* ----- DOCUMENT FOOTER ----- */
.rp-document-footer {
  display: flex; justify-content: space-between;
  padding: 14px 24px; margin-top: 4px;
  font-family: var(--font-mono); font-size: 10px;
  color: #94908A;
  border-top: 1px solid #DCDAD3;
}

.rp-empty { color: #94908A; font-style: italic; font-size: 13px; }

/* ============================================================
   PRINT — A4 portrait
   ============================================================ */
@media print {
  @page {
    size: A4 portrait;
    margin: 14mm;
  }
  body * { visibility: hidden; }
  .report-overlay, .report-overlay * { visibility: visible; }
  .report-overlay {
    position: absolute; inset: 0;
    background: white;
    padding: 0;
    overflow: visible;
    display: block;
  }
  .report-doc {
    box-shadow: none; max-width: none; width: 100%;
    border-radius: 0; padding-bottom: 0;
    background: white;
  }
  .report-toolbar { display: none !important; }
  .report-document { padding: 0; gap: 0; }
  .rp-page {
    box-shadow: none; padding: 0; margin: 0;
    min-height: auto;
    page-break-after: always;
    background: white;
  }
  .rp-page:last-child { page-break-after: auto; }
  .rp-cover { background: white !important; }
  .rp-section-head, .rp-block, .rp-module-block, .rp-heat-col,
  .rp-twocol, .rp-kpi-row { page-break-inside: avoid; }
  .rp-table thead { display: table-header-group; } /* repeat header on each printed page */
  .rp-table tr { page-break-inside: avoid; }
  .rp-document-footer {
    display: none; /* per-page footer comes from @page rule, not this */
  }
}

/* Responsive: smaller screens — keep readable */
@media (max-width: 768px) {
  .report-document { padding: 12px; }
  .rp-page { padding: 28px 24px; min-height: auto; }
  .rp-cover-company { font-size: 32px; }
  .rp-section-num { font-size: 28px; }
  .rp-section-title { font-size: 18px; }
  .rp-cover-gauge-wrap { flex-direction: column; align-items: flex-start; gap: 16px; }
  .rp-cover-gauge-wrap .brief-gauge svg { width: 100px; height: 100px; }
  .rp-kpi-row { grid-template-columns: 1fr 1fr; }
  .rp-twocol { grid-template-columns: 1fr; }
  .rp-heat { grid-template-columns: 1fr; }
}

/* SYSTEM TAB */
.system-tab {
  padding: 28px 32px;
  max-width: 1200px; margin: 0 auto;
  display: flex; flex-direction: column; gap: 24px;
}
.system-block {
  background: var(--c-surface);
  border: 1px solid var(--c-line);
  border-radius: 12px;
  padding: 22px 26px;
}
.system-block.dark {
  background: #1B1A18; color: #E8E3DA; border-color: #2A2825;
}
.system-block.dark h2 { color: var(--brand-accent); }
.system-block h2 {
  font-family: var(--font-mono); font-size: 11px;
  text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--c-text-dim); margin: 0 0 14px 0; font-weight: 500;
}
.sys-spreadsheet {
  font-family: var(--font-mono); font-size: 12px;
  color: var(--c-text-muted); margin: 0 0 14px 0;
}

/* Activity / Notes / Logs lists in Data tab */
.activity-list, .notes-list, .logs-list { display: flex; flex-direction: column; gap: 8px; }
.act-row, .note-row, .log-row {
  padding: 10px 14px;
  background: var(--c-surface-2);
  border-radius: 6px;
  font-size: 13px;
  line-height: 1.5;
}
.act-meta, .note-meta { font-size: 12px; margin-bottom: 4px; }
.act-meta .muted, .note-meta .muted, .log-time { color: var(--c-text-dim); font-family: var(--font-mono); font-size: 11px; }
.act-note, .note-body { color: var(--c-text); margin-top: 4px; }
.act-changes summary { font-size: 11px; color: var(--c-text-muted); cursor: pointer; margin-top: 6px; }
.act-changes pre {
  font-size: 10px; background: var(--c-bg); padding: 8px 10px; border-radius: 4px;
  overflow-x: auto; margin: 6px 0 0 0;
}
.log-row {
  display: grid; grid-template-columns: 70px 140px 1fr 140px;
  gap: 12px; align-items: center;
  font-size: 12px;
}
.log-row.level-error { border-left: 3px solid var(--c-error); background: var(--c-error-bg); }
.log-row.level-warn { border-left: 3px solid var(--c-warn); background: var(--c-warn-bg); }
.log-level {
  font-family: var(--font-mono); font-size: 10px;
  font-weight: 600;
  padding: 2px 6px; border-radius: 3px;
  background: var(--c-surface); text-align: center;
}
.log-action { font-family: var(--font-mono); font-size: 11px; color: var(--c-text); }
.log-msg { color: var(--c-text-muted); }

.footer.v2 {
  padding: 8px 20px;
  font-size: 10px;
  color: var(--c-text-dim);
  text-align: right;
  background: var(--c-surface);
  border-top: 1px solid var(--c-line);
  font-family: var(--font-mono);
  height: 36px;
  display: flex; align-items: center; justify-content: flex-end;
}

/* ============================================================
   RESPONSIVE — V2
   ============================================================ */
@media (max-width: 1280px) {
  .pipeline-grid { grid-template-columns: repeat(3, 1fr); }
  .pipeline-grid .stage-col:nth-child(n+4) { display: none; }
}
@media (max-width: 1024px) {
  .topbar.v2 { grid-template-columns: 1fr auto; gap: 8px; padding: 0 12px; }
  .top-tabs { grid-column: 1 / -1; order: 2; padding: 0 12px 8px; justify-self: stretch; }
  .top-tab { padding: 8px 12px; font-size: 12px; flex: 1; justify-content: center; }
  .top-tab .tt-icon { display: none; }
  .topbar-right { order: 1; gap: 8px; }
  .projects-tab { grid-template-columns: 1fr; height: auto; }
  .project-sidebar { max-height: 320px; border-right: 0; border-bottom: 1px solid var(--c-line); }
  .project-hero.v2 { grid-template-columns: 1fr; gap: 14px; }
  .ph-left { display: flex; align-self: flex-start; }
  .ph-actions { flex-direction: row; flex-wrap: wrap; }
  .pipeline-grid { grid-template-columns: 1fr 1fr; }
  .pipeline-grid .stage-col:nth-child(n+3) { display: none; }
  .project-tabs { top: 0; position: relative; }
}
@media (max-width: 768px) {
  .dashboard-tab { padding: 16px; }
  .system-tab { padding: 16px; }
  .kbig-value { font-size: 28px; }
  .pipeline-grid { grid-template-columns: 1fr; }
  .pipeline-grid .stage-col:nth-child(n+2) { display: block; }
  .wl-row { grid-template-columns: 1fr; gap: 8px; }
  .project-tab-content { padding: 16px 12px 60px; }
  .project-hero.v2 { padding: 14px 16px; }
  .ph-company { font-size: 20px; }
  .quick-drawer { width: 100vw; }
  .quick-fab { bottom: 16px; right: 16px; width: 48px; height: 48px; font-size: 18px; }
  .ptab { padding: 10px 12px; }
  .ptab-label { font-size: 12px; }
  .ptab-sub { display: none; }
}
@media (max-width: 540px) {
  .top-tab { padding: 6px 8px; font-size: 11px; }
  .top-tab .tt-label { font-size: 11px; }
  .topbar-right .last-sync { display: none; }
  .ph-actions .ph-action-btn { font-size: 11px; padding: 6px 10px; min-height: 28px; }
}
