:root {
  --bg: #eef1f6;
  --panel: #ffffff;
  --ink: #1b2438;
  --muted: #667085;
  --line: #d9e0ea;
  --nav-bg: #0b1022;
  --nav-hover: #121936;
  --nav-active: #16344c;
  --brand: #1f7db4;
  --brand-2: #155e86;
  --ok: #16a34a;
  --warn: #f59e0b;
  --danger: #ef4444;
  --purple: #5b21b6;
  --teal: #11b5ae;
  --blue-soft: #9ecff4;
  --chat-panel-width: 404px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Inter", "Noto Sans", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  color: var(--ink);
  background: linear-gradient(180deg, #f2f4f8 0%, var(--bg) 100%);
}

.mobile-nav-toggle {
  display: none;
  position: fixed;
  top: 10px;
  left: 10px;
  z-index: 100;
  border: 0;
  border-radius: 10px;
  background: #11182f;
  color: #fff;
  padding: 8px 12px;
}

.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: 250px;
  background: linear-gradient(180deg, #0b1022 0%, #0d1329 100%);
  color: #d8e1ff;
  padding: 14px 10px;
  display: flex;
  flex-direction: column;
}

.logo-card {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  padding: 10px;
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 14px;
}

.logo-dot {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: linear-gradient(145deg, #2fd0ff, #6a63ff);
  display: grid;
  place-items: center;
  color: #001632;
  font-weight: 800;
}

.logo-title { font-size: 21px; font-weight: 800; color: #fff; }
.logo-sub { font-size: 12px; color: #aab5cf; }

.side-nav { display: flex; flex-direction: column; gap: 8px; }

.nav-link {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #d9e4ff;
  text-decoration: none;
  padding: 10px 10px;
  border-radius: 12px;
}

.nav-link:hover { background: var(--nav-hover); }
.nav-link.active {
  background: var(--nav-active);
  border: 1px solid rgba(50, 180, 220, 0.55);
  box-shadow: inset 0 0 0 1px rgba(16, 185, 255, 0.08);
}

.sidebar-foot {
  margin-top: auto;
  border-top: 1px solid rgba(255, 255, 255, 0.15);
  padding-top: 10px;
}

.muted { color: #8ea3c8; font-size: 12px; }

.profile-chip {
  display: inline-block;
  margin-top: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font-weight: 700;
  font-size: 12px;
}

.profile-chip.dark { background: #10274f; color: #eaf2ff; }

.main {
  margin-left: 250px;
  min-height: 100vh;
}

body.page-has-chat .content {
  padding-right: calc(var(--chat-panel-width) + 32px);
}

body.page-has-chat.chat-panel-collapsed .content {
  padding-right: 96px;
}

.topbar {
  padding: 14px 20px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  position: relative;
  z-index: 2;
}

body.page-has-chat .topbar {
  padding-right: calc(var(--chat-panel-width) + 32px);
}

body.page-has-chat.chat-panel-collapsed .topbar {
  padding-right: 96px;
}

.topbar h1 {
  margin: 0;
  font-size: 34px;
  font-weight: 800;
  min-width: 0;
}

.topbar-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
  flex-shrink: 0;
  max-width: 100%;
}

.user-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.82);
  color: #25324b;
  font-weight: 700;
  max-width: min(100%, 420px);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-role {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  background: #eef2ff;
  color: #3b3fc4;
  font-size: 12px;
  text-transform: uppercase;
}

.ghost-button {
  background: #fff;
  color: #334155;
  border-color: #d5dbea;
}

.logout-form {
  margin: 0;
  flex-shrink: 0;
}

.content { padding: 12px 20px 28px; }

.flash {
  margin-bottom: 12px;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid #d9e0ea;
  font-weight: 600;
}

.flash-success {
  background: #eefbf3;
  border-color: #a6e4bb;
  color: #067647;
}

.flash-error {
  background: #fff1f1;
  border-color: #fecaca;
  color: #b42318;
}

.flash-warning {
  background: #fff8eb;
  border-color: #f5d08d;
  color: #9a6700;
}

.flash-info {
  background: #eef2ff;
  border-color: #c7d7fe;
  color: #3538cd;
}

.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at top left, rgba(31, 125, 180, 0.14), transparent 32%),
    radial-gradient(circle at top right, rgba(91, 33, 182, 0.12), transparent 28%),
    linear-gradient(180deg, #0b1022 0%, #11182a 100%);
}

.login-shell {
  width: min(100%, 460px);
}

.login-card {
  background: rgba(18, 25, 46, 0.96);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.34);
  border-radius: 24px;
  padding: 28px;
  color: #edf2ff;
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 22px;
}

.login-brand h1 {
  margin: 0 0 4px;
  font-size: 22px;
  color: #fff;
}

.login-brand p {
  margin: 0;
  color: #aeb9d3;
}

.login-form {
  display: grid;
  gap: 14px;
}

.login-form label {
  display: grid;
  gap: 6px;
  font-weight: 700;
  color: #d8e1ff;
}

.login-form input {
  width: 100%;
  background: #0f1528;
  border-color: rgba(255, 255, 255, 0.09);
  color: #f8fbff;
  padding: 14px 16px;
  border-radius: 14px;
}

.login-form input::placeholder {
  color: #78839f;
}

.primary-button.login-submit {
  width: 100%;
  border: 0;
  border-radius: 16px;
  padding: 14px 16px;
  background: linear-gradient(90deg, #74d4ee 0%, #b8d79d 50%, #ffb649 100%);
  color: #10131b;
  font-size: 16px;
  font-weight: 800;
}

.primary-button.login-submit:hover {
  filter: brightness(0.98);
  background: linear-gradient(90deg, #74d4ee 0%, #b8d79d 50%, #ffb649 100%);
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.04);
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 12px;
}

.panel-head h3 {
  margin: 0;
}

.panel-head.compact {
  margin-bottom: 8px;
}

.collapsible-panel.collapsed {
  padding-bottom: 14px;
}

.grid { display: grid; gap: 12px; margin-bottom: 12px; }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.ai-summary-panel {
  min-height: 128px;
}

.status-shell {
  padding: 14px 16px 16px;
}

.status-shell-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 12px;
}

.status-shell-head h3 {
  margin: 0 0 4px;
}

.status-toolbar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.status-summary-grid {
  margin-bottom: 10px;
}

.status-summary-card {
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  background: linear-gradient(180deg, #ffffff 0%, #fbfdff 100%);
  padding: 14px 16px;
  min-height: 104px;
}

.approvals-shell {
  padding: 14px 16px 16px;
}

.approvals-head {
  margin-bottom: 12px;
}

.approvals-summary-grid {
  margin-bottom: 12px;
}

.approval-summary-card strong {
  font-size: 28px;
}

.approvals-toolbar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 12px;
}

.approval-filter.active {
  background: #10274f;
  color: #fff;
  border-color: #10274f;
}

.approvals-toolbar input {
  min-width: 240px;
}

.approvals-table-wrap {
  overflow-x: auto;
}

.approvals-table {
  min-width: 980px;
}

.approvals-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  box-shadow: inset 0 -1px 0 #e6ebf2;
}

.approval-entity {
  font-weight: 700;
  color: #10274f;
}

.approval-reason {
  color: #475467;
  line-height: 1.5;
  max-width: 460px;
}

.approval-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 250px;
}

.approval-action-form {
  flex-wrap: wrap;
}

.approval-approve {
  color: #067647;
  border-color: #a6e4bb;
  background: #eefbf3;
}

.approval-reject {
  color: #b42318;
  border-color: #fecaca;
  background: #fff1f1;
}

.approval-delay {
  color: #3538cd;
  border-color: #c7d7fe;
  background: #eef2ff;
}

.approval-ask-ai {
  align-self: flex-start;
}

.status-summary-label {
  display: inline-block;
  margin-bottom: 8px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: #475467;
}

.summary-text {
  margin: 0;
  color: #334155;
  line-height: 1.6;
  font-size: 14px;
}

.mode-card {
  text-decoration: none;
  color: inherit;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 18px;
}

.mode-card h2 { margin: 0 0 8px; }
.mode-card p { margin: 0; color: var(--muted); }

.status-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 10px 12px;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.03);
}

.status-card span { display: block; font-size: 12px; color: var(--muted); }
.status-card strong { font-size: 30px; line-height: 1.1; }

.hint {
  background: #eef4ff;
  border: 1px solid #c9d7ff;
  color: #25406e;
  border-radius: 10px;
  padding: 8px 10px;
  margin: 8px 0;
  font-size: 13px;
}

.label { font-weight: 700; }

.inline-form { display: flex; gap: 8px; align-items: center; }
.wrap { flex-wrap: wrap; }

input,
select,
button,
.btn {
  border: 1px solid #c9cfda;
  border-radius: 10px;
  padding: 8px 10px;
  font: inherit;
  background: #fff;
}

button,
.btn {
  text-decoration: none;
  background: #ffffff;
  color: var(--purple);
  border-color: #ddd9f7;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.02);
  font-weight: 700;
}

button.primary,
.btn.primary {
  background: var(--brand);
  color: #fff;
  border-color: var(--brand);
  cursor: pointer;
}

button:hover,
.btn:hover {
  background: #f7f7fb;
}

button.primary:hover,
.btn.primary:hover {
  background: var(--brand-2);
}

button.danger { background: #9f1239; border-color: #9f1239; }
button.danger,
.btn.danger {
  background: #b42318;
  border-color: #b42318;
  color: #fff;
}
button.danger:hover,
.btn.danger:hover {
  background: #912018;
  border-color: #912018;
  color: #fff;
}

.table-wrap {
  overflow-x: auto;
  background: #fff;
  border: 1px solid #d9dee8;
  border-radius: 14px;
}

table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid #e6ebf2;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
}
th {
  color: #475467;
  font-weight: 800;
  background: #fbfcfe;
}

.cell-note {
  margin-bottom: 6px;
  line-height: 1.45;
  font-size: 12px;
  color: #334155;
}

.muted-note {
  color: #667085;
}

pre {
  margin: 0;
  border-radius: 10px;
  padding: 10px;
  background: #09122f;
  color: #dce6ff;
  font-size: 12px;
  white-space: pre-wrap;
}

.pill {
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 11px;
  border: 1px solid #d0d5dd;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  white-space: nowrap;
  line-height: 1;
}
.pill.pending { background: #fff4dd; color: #9a6700; border-color: #f5d08d; }
.pill.approved { background: #e7f8ed; color: #067647; border-color: #a6e4bb; }
.pill.rejected { background: #ffecec; color: #b42318; border-color: #fecaca; }
.pill.delay_7d { background: #eef2ff; color: #3538cd; border-color: #c7d7fe; }
.pill.confidence-high { background: #e7f8ed; color: #067647; border-color: #a6e4bb; }
.pill.confidence-medium { background: #fff4dd; color: #9a6700; border-color: #f5d08d; }
.pill.confidence-low { background: #ffecec; color: #b42318; border-color: #fecaca; }
.pill.sufficiency-strong { background: #e8f1ff; color: #1d4ed8; border-color: #bfdbfe; }
.pill.sufficiency-ok { background: #f3f4f6; color: #475467; border-color: #d0d5dd; }
.pill.sufficiency-thin { background: #fff7ed; color: #c2410c; border-color: #fed7aa; }

.tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.tab { background: #f4f8ff; color: #1d3557; }
.tab.active { background: #1f4f82; color: #fff; }
.tab-pane { display: none; }
.tab-pane.active { display: block; }

.tooltip {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #f0f3ff;
  color: #44517b;
  font-size: 12px;
  cursor: default;
}

.tooltip-text {
  visibility: hidden;
  opacity: 0;
  transition: opacity 0.15s;
  position: absolute;
  left: 24px;
  top: -2px;
  width: 280px;
  background: #171d31;
  color: #f3f7ff;
  border-radius: 8px;
  padding: 8px;
  font-size: 12px;
  z-index: 30;
}

.tooltip:hover .tooltip-text {
  visibility: visible;
  opacity: 1;
}

.chat-history {
  border: 1px solid #d5dbe6;
  border-radius: 14px;
  background: #fff;
  padding: 12px;
  min-height: 220px;
  max-height: 360px;
  overflow-y: auto;
  margin-bottom: 12px;
}

.chat-panel-head {
  margin-bottom: 10px;
}

.chat-panel-head h3 {
  margin: 0 0 6px;
}

.chat-msg {
  border-radius: 12px;
  padding: 10px 12px;
  margin-bottom: 10px;
  font-size: 16px;
  line-height: 1.5;
}

.chat-msg.user {
  background: #f4f6fb;
  border: 1px solid #e0e7f1;
}

.chat-msg.assistant {
  background: #fbfcfe;
  border: 1px solid #e3e8ef;
}

.chat-body {
  white-space: pre-wrap;
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans", sans-serif;
  letter-spacing: -0.01em;
}

.chat-chart {
  max-width: 100%;
  border-radius: 8px;
  border: 1px solid #d3dce9;
  margin-top: 8px;
}

.side-chat-panel {
  position: fixed;
  top: 18px;
  right: 18px;
  bottom: 18px;
  width: 404px;
  min-width: 340px;
  max-width: 620px;
  background: #ffffff;
  border: 1px solid #d9e0ea;
  border-radius: 22px;
  box-shadow: 0 18px 38px rgba(15, 23, 42, 0.12);
  z-index: 40;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: width 0.18s ease, transform 0.18s ease;
}

.chat-panel-resizer {
  position: absolute;
  top: 0;
  left: 0;
  width: 14px;
  height: 100%;
  cursor: ew-resize;
  background: linear-gradient(90deg, rgba(219, 226, 239, 0.45), rgba(219, 226, 239, 0));
  z-index: 2;
  transition: background 0.18s ease;
}

.chat-panel-resizer::after {
  content: "";
  position: absolute;
  left: 5px;
  top: 50%;
  transform: translateY(-50%);
  width: 4px;
  height: 64px;
  border-radius: 999px;
  background: linear-gradient(180deg, #cbd5e1 0%, #94a3b8 100%);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.6);
}

.chat-panel-resizer:hover {
  background: linear-gradient(90deg, rgba(191, 219, 254, 0.7), rgba(219, 226, 239, 0));
}

.chat-panel-resizer:hover::after {
  background: linear-gradient(180deg, #60a5fa 0%, #2563eb 100%);
}

.side-chat-panel.collapsed {
  width: 64px;
  min-width: 64px;
  border-radius: 20px;
  background: linear-gradient(180deg, #ffffff 0%, #f7faff 100%);
}

.side-chat-panel.collapsed .chat-panel-head,
.side-chat-panel.collapsed .side-chat-body {
  display: none;
}

.side-chat-panel.collapsed .chat-panel-resizer {
  display: none;
}

.side-chat-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  padding: 16px 16px 10px;
  border-bottom: 1px solid #eef2f7;
}

.side-chat-body {
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex: 1;
  padding: 14px;
}

.side-chat-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 12px;
  align-items: stretch;
}

.side-chat-tab {
  flex: 1 1 0;
  padding: 8px 10px;
  font-size: 12px;
  border-radius: 10px;
  background: #f4f7fb;
  color: #334155;
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  text-align: center;
  white-space: nowrap;
}

.side-chat-tab.active {
  background: #10274f;
  color: #ffffff;
  border-color: #10274f;
}

.side-chat-tab.memory-tab {
  flex: 1.15 1 0;
}

.tab-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 18px;
  padding: 0 6px;
  margin-left: 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.2);
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.side-chat-tabpane {
  display: none;
  min-height: 0;
  flex: 1;
}

.side-chat-tabpane.active {
  display: flex;
  flex-direction: column;
}

.side-help h4,
.side-memory-group h4 {
  margin: 0 0 8px;
  font-size: 14px;
}

.context-summary-box {
  margin-bottom: 12px;
  padding: 10px 12px;
  border-radius: 12px;
  background: #f8fbff;
  border: 1px solid #dbe7f6;
  color: #334155;
  line-height: 1.55;
  font-size: 13px;
}

.context-meta-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 14px;
}

.context-meta-item {
  border: 1px solid #e6ebf3;
  border-radius: 12px;
  background: #fafcff;
  padding: 8px 10px;
}

.context-meta-item span {
  display: block;
  font-size: 11px;
  color: #667085;
  margin-bottom: 4px;
}

.context-meta-item strong {
  display: block;
  font-size: 13px;
  color: #16344c;
}

.side-help p {
  margin: 0 0 12px;
  color: #475467;
  line-height: 1.55;
  font-size: 14px;
}

.side-help-list {
  margin: 0;
  padding-left: 18px;
  color: #334155;
  line-height: 1.55;
}

.quick-prompt-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.quick-prompt {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  padding: 8px 10px;
  background: #eef4ff;
  color: #16344c;
  border-color: #c7d7fe;
  text-align: left;
}

.quick-prompt.favorite {
  background: #fff7ed;
  border-color: #fed7aa;
  color: #9a3412;
}

.quick-prompt span {
  flex: 1;
}

.quick-prompt-star {
  font-style: normal;
  font-size: 14px;
  line-height: 1;
}

.side-memory-group + .side-memory-group {
  margin-top: 14px;
}

.side-memory-search {
  width: 100%;
  margin-bottom: 12px;
}

.side-memory-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.side-memory-item {
  border: 1px solid #e6ebf3;
  border-radius: 12px;
  padding: 10px 12px;
  background: #fafcff;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.side-memory-item strong {
  font-size: 12px;
  color: #10274f;
}

.side-memory-item span,
.side-memory-empty {
  font-size: 12px;
  color: #667085;
}

.side-memory-item.outcome-success {
  border-color: #a6e4bb;
  background: #f0fbf4;
}

.side-memory-item.outcome-no_impact,
.side-memory-item.memory-approval_status {
  border-color: #d0d5dd;
  background: #f8fafc;
}

.side-memory-item.outcome-negative_impact,
.side-memory-item.memory-negative_impact {
  border-color: #fecaca;
  background: #fff1f1;
}

.side-chat-collapsed-ui {
  display: none;
}

.chat-panel-toggle {
  min-width: 36px;
  width: 36px;
  height: 36px;
  padding: 0;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
}

.side-chat-panel.collapsed .side-chat-head {
  padding: 8px;
  border-bottom: 0;
}

.side-chat-panel.collapsed .side-chat-collapsed-ui {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  height: 100%;
  padding: 16px 8px;
  writing-mode: vertical-rl;
  text-orientation: mixed;
}

.side-chat-collapsed-icon {
  width: 30px;
  height: 30px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: linear-gradient(145deg, #dbeafe 0%, #c7d2fe 100%);
  color: #1e3a8a;
  font-size: 16px;
  font-weight: 900;
  box-shadow: inset 0 0 0 1px rgba(96, 165, 250, 0.18);
}

.side-chat-collapsed-label {
  font-size: 12px;
  font-weight: 700;
  color: #10274f;
  letter-spacing: 0.04em;
  opacity: 0.9;
}

.chat-panel-toggle-secondary {
  width: 36px;
  min-width: 36px;
  height: 36px;
  padding: 0;
  display: grid;
  place-items: center;
  border-radius: 12px;
  color: #3538cd;
  border-color: #d7def0;
  background: #ffffff;
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.08);
}

.verif-toolbar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.verif-block {
  border: 1px solid #dde4ee;
  border-radius: 18px;
  padding: 14px;
  margin-bottom: 14px;
  background: #fff;
}

.vf-group.collapsed {
  padding-bottom: 16px;
}

.vf-group.collapsed .panel-head.compact {
  margin-bottom: 0;
}

.vf-group-body {
  margin-top: 8px;
}

.verif-block-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 12px;
}

.verif-block h4 {
  margin: 0 0 4px;
  font-size: 20px;
}

.verif-sub {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.verif-toolbar .btn,
.verif-toolbar button,
.verif-toolbar input,
.verif-toolbar select {
  font-size: 13px;
}

.chart-shell {
  border: 1px solid #d8dfe9;
  background: linear-gradient(180deg, #ffffff 0%, #fafcff 100%);
  border-radius: 16px;
  padding: 14px 16px 16px;
  margin-bottom: 10px;
}

.chart-shell-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 10px;
}

.vf-chart {
  width: 100%;
  height: 300px;
  display: block;
}

.chart-kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.chart-kpi {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 92px;
  padding: 12px 14px;
  border-radius: 12px;
  background: #fff;
  border: 1px solid #e6ebf3;
}

.chart-kpi-head {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
}

.chart-kpi-head .dot {
  width: 12px;
  height: 12px;
  border-radius: 4px;
  margin-right: 0;
  flex: 0 0 auto;
}

.dot.clicks { background: #8b8b8b; }

.chart-kpi-label {
  color: #475467;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.1;
  margin: 0;
}

.chart-kpi strong {
  display: block;
  font-size: 26px;
  line-height: 1.1;
  color: #1f2937;
  margin: 0;
}

.chart-legend {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  margin-top: 10px;
  font-size: 13px;
  color: #475467;
  justify-content: flex-start;
}

.dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-right: 6px;
}

.dot.cost { background: #2563eb; }
.dot.sales { background: var(--teal); }
.dot.acos { background: #d61f9c; }

.vf-count {
  margin-left: auto;
  font-weight: 700;
  color: #334155;
}

.chart-sub {
  margin-top: 4px;
  font-size: 13px;
  color: #667085;
}

.verif-table {
  table-layout: fixed;
  min-width: 1200px;
}

.head-filter-row th {
  background: #f8fafc;
  padding: 6px;
}

.head-filter-row input {
  width: 100%;
  min-width: 90px;
  padding: 6px 7px;
  font-size: 12px;
}

.col-resizer {
  position: absolute;
  top: 0;
  right: 0;
  width: 7px;
  height: 100%;
  cursor: col-resize;
  user-select: none;
}

.chat-composer {
  display: flex;
  gap: 12px;
  align-items: flex-end;
  background: #fff;
  border: 1px solid #d9e0ea;
  border-radius: 22px;
  padding: 10px;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.06);
}

.chat-input {
  flex: 1;
  min-height: 64px;
  max-height: 220px;
  resize: none;
  border: 0;
  border-radius: 12px;
  background: transparent;
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans", sans-serif;
  font-size: 15px;
  line-height: 1.5;
  font-weight: 400;
  letter-spacing: -0.01em;
  color: #111827;
  padding: 10px 12px;
  overflow-y: hidden;
  box-shadow: none;
}

.chat-input:focus {
  outline: none;
}

.chat-input::placeholder {
  color: #8a94a6;
  font-size: 15px;
  line-height: 1.45;
}

.send-dot {
  width: 56px;
  height: 56px;
  min-width: 56px;
  border-radius: 50%;
  background: #0b0b0b;
  border-color: #0b0b0b;
  color: #fff;
  font-size: 28px;
  line-height: 1;
  padding: 0;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  box-shadow: 0 10px 20px rgba(15, 23, 42, 0.18);
}

.send-dot:hover {
  background: #000;
  border-color: #000;
}

.plans-table-wrap {
  overflow-x: auto;
}

.plans-table {
  table-layout: fixed;
  min-width: 1480px;
}

.plans-table thead th {
  position: sticky;
  top: 0;
  z-index: 3;
  box-shadow: inset 0 -1px 0 #e6ebf2;
}

.plans-table th,
.plans-table td {
  vertical-align: top;
}

.plans-table th {
  white-space: normal;
  overflow-wrap: break-word;
  word-break: normal;
  line-height: 1.25;
}

.plans-table .col-entity { width: 176px; }
.plans-table .col-type { width: 108px; }
.plans-table .col-label { width: 112px; }
.plans-table .col-value { width: 96px; }
.plans-table .col-delta { width: 98px; }
.plans-table .col-acos { width: 104px; }
.plans-table .col-money { width: 92px; }
.plans-table .col-pill { width: 128px; }
.plans-table .col-guidance { width: 420px; }
.plans-table .col-risk { width: 84px; }

.plan-pill {
  min-width: 96px;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 700;
}

.guidance-cell .cell-note {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  text-wrap: pretty;
}

.guidance-cell .muted-note {
  -webkit-line-clamp: 1;
}

.guidance-preview {
  margin-bottom: 8px;
  max-height: 104px;
  overflow: hidden;
  transition: max-height 0.2s ease, opacity 0.18s ease;
  opacity: 0.96;
}

.guidance-cell.expanded .cell-note,
.guidance-cell.expanded .muted-note {
  display: block;
  -webkit-line-clamp: unset;
  overflow: visible;
}

.guidance-cell.expanded .guidance-preview {
  max-height: 360px;
  opacity: 1;
}

.guidance-toggle {
  padding: 6px 10px;
  font-size: 12px;
  color: #16344c;
  border-color: #d7e2ef;
  background: #fbfdff;
}

.guidance-toggle:hover {
  background: #f8fbff;
}

.chat-panel-resizer[title] {
  position: absolute;
}

@media (max-width: 1120px) {
  .topbar {
    flex-direction: column;
    align-items: flex-start;
  }
  body.page-has-chat .topbar,
  body.page-has-chat.chat-panel-collapsed .topbar {
    padding-right: 20px;
  }
  .topbar-actions {
    width: 100%;
    justify-content: flex-start;
  }
  .user-badge {
    max-width: 100%;
  }
  .grid.three,
  .grid.four { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .verif-block-head,
  .chart-shell-head { flex-direction: column; }
  .chart-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 880px) {
  .mobile-nav-toggle { display: block; }
  .sidebar { transform: translateX(-100%); transition: transform 0.2s ease; z-index: 90; }
  body.nav-open .sidebar { transform: translateX(0); }
  .main { margin-left: 0; padding-top: 30px; }
  .grid.two, .grid.three, .grid.four { grid-template-columns: 1fr; }
  body.page-has-chat .content,
  body.page-has-chat.chat-panel-collapsed .content { padding-right: 20px; }
  .side-chat-panel {
    position: static;
    width: 100%;
    min-width: 0;
    max-width: none;
    height: auto;
    margin-bottom: 12px;
  }
  .side-chat-tab {
    white-space: normal;
    line-height: 1.2;
  }
  .status-shell-head {
    flex-direction: column;
  }
  .status-summary-card {
    min-height: 0;
  }
  .chat-panel-resizer {
    display: none;
  }
  .side-chat-panel.collapsed {
    width: 100%;
  }
  .side-chat-panel.collapsed .chat-panel-head,
  .side-chat-panel.collapsed .side-chat-body {
    display: none;
  }
  .chart-kpis { grid-template-columns: 1fr; }
  .chart-kpi strong { font-size: 24px; }
  .plans-table {
    min-width: 1320px;
  }
}
