:root {
  color-scheme: light;
  --bg: #eef3f8;
  --panel: #ffffff;
  --panel-muted: #f7f9fc;
  --border: #d8e0eb;
  --text: #1e293b;
  --muted: #64748b;
  --brand: #0f4c81;
  --brand-soft: #dbeafe;
  --green: #0f766e;
  --green-soft: #d1fae5;
  --amber: #b45309;
  --amber-soft: #fef3c7;
  --red: #b91c1c;
  --red-soft: #fee2e2;
  --slate-soft: #e2e8f0;
  --shadow: 0 16px 40px rgba(15, 23, 42, 0.08);
  font-family: "Inter", "PingFang SC", "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: linear-gradient(180deg, #f5f8fc 0%, #eaf0f7 100%);
  color: var(--text);
}

body.drawer-open,
body.modal-open {
  overflow: hidden;
}

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

.app-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.sidebar {
  padding: 24px 28px 0;
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(360px, 0.78fr);
  gap: 12px;
  align-items: start;
}

.sidebar > * {
  align-self: start;
}

.sidebar-main {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
  align-items: start;
}

.brand-access-panel {
  display: grid;
  grid-template-columns: minmax(240px, 320px) minmax(280px, 1fr);
  gap: 14px;
  align-items: center;
  padding: 12px 14px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-mark {
  width: 38px;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: linear-gradient(135deg, #0ea5e9, #2563eb);
  color: white;
  font-weight: 700;
  font-size: 18px;
}

.brand h1,
.topbar h2,
.band h3,
.drawer-header h3,
.modal-header h3 {
  margin: 0;
}

.brand p,
.eyebrow,
.muted {
  margin: 0;
}

.brand p {
  color: var(--muted);
  font-size: 12px;
}

.brand h1 {
  font-size: 18px;
  line-height: 1.15;
}

.sidebar-section,
.panel,
.table-wrap,
dialog,
.drawer-panel {
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.sidebar-section {
  padding: 14px;
  background: var(--panel);
  color: var(--text);
  border-color: var(--border);
  box-shadow: var(--shadow);
}

.brand-access-panel .access-panel,
.filter-panel {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 12px;
  align-content: start;
}

.brand-access-panel .access-panel {
  grid-template-columns: 110px repeat(2, minmax(0, 1fr));
  align-items: end;
  gap: 8px 12px;
}

.filter-panel {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.brand-access-panel .access-panel .section-title,
.filter-panel .section-title,
.filter-panel .ghost-btn {
  grid-column: 1 / -1;
}

.brand-access-panel .access-panel .section-title {
  grid-column: 1;
  margin-bottom: 0;
  align-self: center;
}

.brand-access-panel .access-panel label,
.filter-panel label {
  margin-bottom: 0;
}

.brand-access-panel .access-panel label {
  gap: 4px;
}

.action-panel {
  grid-column: 2;
  grid-row: 1;
  align-self: stretch;
  min-height: 0;
  padding: 14px;
  display: flex;
  flex-direction: column;
}

.filter-core {
  min-width: 0;
}

.filter-search {
  grid-column: 1 / 2;
  margin-top: 2px;
}

.filter-reset-btn {
  grid-column: 2 / 3;
  align-self: end;
  min-height: 40px;
}

.section-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--brand);
  margin-bottom: 10px;
}

.sidebar-section label,
.form-grid label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 12px;
}

.form-missing-banner {
  margin: 0 20px 4px;
  padding: 10px 12px;
  border-radius: 8px;
  background: #fff7ed;
  border: 1px solid #fdba74;
  color: #9a3412;
  font-size: 13px;
  font-weight: 600;
}

.sidebar-section span,
.form-grid span {
  font-size: 12px;
  font-weight: 600;
}

.sidebar-section select,
.sidebar-section input,
.form-grid input,
.form-grid select,
.form-grid textarea {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.96);
  color: var(--text);
}

.form-grid label.field-missing span {
  color: #c2410c;
}

.form-grid label.field-required span::after {
  content: " *";
  color: #dc2626;
}

.form-grid label.field-missing input,
.form-grid label.field-missing select,
.form-grid label.field-missing textarea {
  border-color: #fb923c;
  background: #fff7ed;
  box-shadow: 0 0 0 3px rgba(251, 146, 60, 0.12);
}

.sidebar-section input,
.sidebar-section select {
  background: #fff;
  color: var(--text);
  border-color: var(--border);
}

.sidebar-section input::placeholder {
  color: #94a3b8;
}

.mini-list {
  display: grid;
  gap: 8px;
}

.mini-item {
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--panel-muted);
  border: 1px solid var(--border);
}

.mini-item strong {
  display: block;
  font-size: 14px;
  margin-bottom: 4px;
}

.mini-item p {
  margin: 0;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.45;
}

.action-panel .mini-list {
  min-height: 0;
}

.action-panel .muted {
  line-height: 1.5;
}

.action-panel .mini-item {
  padding: 10px 12px;
  display: grid;
  gap: 4px;
}

.action-panel .mini-item strong {
  margin-bottom: 2px;
}

.action-panel .mini-item .todo-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.action-panel .mini-item .todo-date {
  font-size: 12px;
  font-weight: 700;
  color: var(--brand);
}

.action-panel .mini-item .todo-state {
  font-size: 12px;
  color: var(--muted);
}

.workspace {
  padding: 20px 28px 34px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.topbar,
.band-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
}

.table-tools {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.page-size-control {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}

.page-size-control select {
  border: 1px solid var(--border);
  border-radius: 8px;
  min-height: 36px;
  padding: 0 10px;
  background: #fff;
  color: var(--text);
}

.topbar-actions,
.modal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.import-status {
  min-height: 40px;
  display: flex;
  align-items: center;
  padding: 0 14px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--panel);
  font-size: 13px;
}

.import-status.info {
  color: var(--brand);
  background: var(--brand-soft);
}

.import-status.success {
  color: var(--green);
  background: var(--green-soft);
}

.import-status.danger {
  color: var(--red);
  background: var(--red-soft);
}

.context-strip {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 14px;
}

.context-panel {
  min-height: 52px;
  display: flex;
  align-items: center;
  padding: 0 16px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--muted);
  font-size: 13px;
}

.crumb-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.crumb-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  background: var(--panel-muted);
  color: var(--text);
  font-weight: 600;
}

.eyebrow {
  font-size: 12px;
  color: var(--brand);
  font-weight: 700;
}

.topbar h2 {
  font-size: 28px;
  line-height: 1.2;
  max-width: 760px;
}

.primary-btn,
.secondary-btn,
.ghost-btn,
.icon-btn {
  border: 1px solid transparent;
  border-radius: 8px;
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease;
}

.primary-btn {
  background: var(--brand);
  color: #fff;
  padding: 0 16px;
}

.secondary-btn {
  background: #fff;
  color: var(--text);
  border-color: var(--border);
  padding: 0 14px;
}

.ghost-btn {
  background: transparent;
  color: inherit;
  border-color: rgba(148, 163, 184, 0.3);
  padding: 0 14px;
}

.icon-btn {
  width: 40px;
  background: transparent;
  color: var(--muted);
  border-color: var(--border);
}

.primary-btn:hover,
.secondary-btn:hover,
.ghost-btn:hover,
.icon-btn:hover {
  transform: translateY(-1px);
}

.kpi-strip,
.assessment-grid,
.summary-grid,
.dashboard-grid,
.assessment-center-grid {
  display: grid;
  gap: 14px;
}

.kpi-strip {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.kpi-card {
  padding: 18px;
  border-radius: 8px;
  background: var(--panel);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  min-height: 136px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.clickable {
  cursor: pointer;
  transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease;
}

.clickable:hover {
  transform: translateY(-1px);
  box-shadow: 0 18px 36px rgba(15, 23, 42, 0.1);
}

.kpi-card .kpi-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.kpi-card h4,
.kpi-card p,
.panel h4,
.panel p {
  margin: 0;
}

.kpi-card h4 {
  font-size: 14px;
}

.kpi-number {
  font-size: 34px;
  font-weight: 700;
  letter-spacing: 0;
}

.kpi-note {
  color: var(--muted);
  line-height: 1.5;
  font-size: 13px;
}

.band {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.assessment-grid {
  grid-template-columns: 1.15fr 0.9fr 1fr;
  align-items: start;
}

.summary-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.ai-model-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.ai-model-card {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel-muted);
  padding: 14px;
  display: grid;
  gap: 10px;
}

.ai-model-card.current {
  border-color: #60a5fa;
  box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.12);
}

.ai-model-head,
.ai-model-meta,
.ai-model-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.ai-model-head strong {
  font-size: 15px;
}

.ai-progress {
  width: 100%;
  height: 8px;
  border-radius: 999px;
  background: #e2e8f0;
  overflow: hidden;
}

.ai-progress > span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #2563eb, #0ea5e9);
}

.ai-model-badges {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.ai-model-actions {
  display: flex;
  justify-content: flex-end;
}

.tiny-btn {
  min-height: 30px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  padding: 0 12px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.tiny-btn:hover {
  transform: translateY(-1px);
}

.tiny-tag {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}

.tiny-tag.info { background: #dbeafe; color: #1d4ed8; }
.tiny-tag.success { background: #d1fae5; color: #047857; }
.tiny-tag.warn { background: #fef3c7; color: #b45309; }
.tiny-tag.danger { background: #fee2e2; color: #b91c1c; }
.tiny-tag.slate { background: #e2e8f0; color: #475569; }

.task-board-grid {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 14px;
}

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

.summary-header h4 {
  margin-bottom: 0;
}

.summary-control {
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: flex-end;
  min-width: 160px;
}

.summary-control span {
  font-size: 12px;
  color: var(--muted);
  font-weight: 600;
}

.summary-control input {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0 10px;
  background: #fff;
  color: var(--text);
}

.task-tools {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.task-filter,
.task-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
}

.task-filter span,
.task-toggle span {
  font-size: 12px;
  color: var(--muted);
  font-weight: 600;
}

.task-filter select {
  min-height: 36px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0 10px;
  background: #fff;
  color: var(--text);
}

.task-toggle input {
  width: 16px;
  height: 16px;
}

.ai-analysis {
  display: grid;
  gap: 10px;
}

.ai-block {
  padding: 12px;
  border-radius: 8px;
  background: #fff;
  border: 1px solid var(--border);
}

.ai-block p,
.ai-block ul {
  margin: 8px 0 0;
}

.ai-block ul {
  padding-left: 18px;
}

.dashboard-grid {
  grid-template-columns: 1.05fr 1fr 1fr;
}

.assessment-center-grid {
  grid-template-columns: 1.15fr 0.85fr;
}

.panel {
  padding: 16px;
}

.panel h4 {
  font-size: 17px;
  margin-bottom: 10px;
}

.pipeline-list,
.leaderboard-list,
.risk-list,
.rank-list,
.task-list,
.assessment-card-list,
.assessment-action-list,
.detail-grid,
.timeline {
  display: grid;
  gap: 10px;
}

.pipeline-row,
.leaderboard-row,
.risk-item,
.rank-item,
.task-item,
.assessment-card,
.assessment-action,
.detail-item,
.timeline-item {
  display: grid;
  gap: 4px;
}

.pipeline-meta,
.leaderboard-row,
.detail-item {
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 12px;
}

.progress {
  width: 100%;
  height: 8px;
  background: #edf2f7;
  border-radius: 999px;
  overflow: hidden;
}

.progress > span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #3b82f6, #0f766e);
}

.leaderboard-score,
.badge,
.tag {
  justify-self: start;
  display: inline-flex;
  align-items: center;
  padding: 4px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}

.pipeline-row {
  padding: 6px 0;
}

.pipeline-meta strong,
.leaderboard-row strong {
  font-size: 13px;
}

.risk-item {
  padding: 4px 0 6px;
}

.risk-item p {
  margin: 0;
  line-height: 1.45;
}

#leaderboard-panel .leaderboard-list,
#pipeline-panel .pipeline-list {
  align-content: start;
}

#leaderboard-panel .leaderboard-row {
  grid-template-columns: auto 1fr auto;
  padding: 6px 0;
}

#risk-panel .risk-list {
  max-height: 520px;
  overflow: auto;
  padding-right: 4px;
}

.drill-link {
  cursor: pointer;
}

.bar-list {
  display: grid;
  gap: 12px;
}

.bar-row {
  display: grid;
  gap: 6px;
  padding: 8px 8px 10px;
  border-radius: 8px;
  transition: background 0.16s ease, box-shadow 0.16s ease;
}

.bar-row.active {
  background: #f8fbff;
  box-shadow: inset 0 0 0 1px #dbe7f5;
}

.bar-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 13px;
  align-items: center;
}

.bar-track {
  width: 100%;
  height: 10px;
  background: #edf2f7;
  border-radius: 999px;
  overflow: hidden;
}

.bar-track span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #0f4c81, #3b82f6);
}

.quote-card {
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel-muted);
}

.task-item {
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel-muted);
  text-align: left;
}

.task-item p {
  margin: 0;
}

.quote-card strong,
.rank-item strong,
.assessment-card strong,
.assessment-action strong {
  font-size: 15px;
}

.quote-card p,
.rank-item p,
.assessment-card p,
.assessment-action p {
  margin: 0;
}

.rank-item {
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel-muted);
}

.assessment-card,
.assessment-action {
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel-muted);
}

.assessment-card {
  gap: 8px;
}

.metric-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 13px;
  color: var(--muted);
  flex-wrap: wrap;
}

.metric-row strong {
  font-size: 13px;
}

.metric-summary-row {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  font-size: 12px;
  color: var(--muted);
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  margin-top: 2px;
}

.metric-tile {
  padding: 8px 10px;
  border-radius: 8px;
  background: #fff;
  border: 1px solid var(--border);
  display: grid;
  gap: 2px;
}

.metric-tile span {
  font-size: 11px;
  color: var(--muted);
}

.metric-tile strong {
  font-size: 14px;
  color: var(--text);
}

.metric-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 2px;
}

.advice-block {
  display: grid;
  gap: 8px;
}

.badge.success,
.tag.success {
  background: var(--green-soft);
  color: var(--green);
}

.badge.warn,
.tag.warn {
  background: var(--amber-soft);
  color: var(--amber);
}

.badge.danger,
.tag.danger {
  background: var(--red-soft);
  color: var(--red);
}

.badge.info,
.tag.info {
  background: var(--brand-soft);
  color: var(--brand);
}

.tag.slate {
  background: #e2e8f0;
  color: #475569;
}

.tag.indigo {
  background: #e0e7ff;
  color: #4338ca;
}

.tag.purple {
  background: #f3e8ff;
  color: #7e22ce;
}

.tag.amber-strong {
  background: #ffedd5;
  color: #c2410c;
}

.tag.danger-soft {
  background: #ffe4e6;
  color: #be123c;
}

.tag-action {
  border: none;
  cursor: pointer;
  transition: transform 0.14s ease, box-shadow 0.14s ease, filter 0.14s ease;
}

.tag-action:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 16px rgba(15, 23, 42, 0.08);
  filter: saturate(1.02);
}

.tag-action:focus-visible {
  outline: 2px solid rgba(37, 99, 235, 0.28);
  outline-offset: 2px;
}

.table-wrap {
  overflow: auto;
}

.pagination {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 16px 4px 0;
  flex-wrap: wrap;
}

.pagination-info {
  color: var(--muted);
  font-size: 13px;
}

.pagination-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.page-btn {
  min-width: 38px;
  height: 38px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  cursor: pointer;
}

.page-btn.active {
  background: var(--brand);
  color: #fff;
  border-color: var(--brand);
}

.page-btn:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.summary-table-wrap {
  overflow: auto;
}

.table-wrap {
  overflow: auto;
  position: relative;
  isolation: isolate;
}

.summary-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
}

.summary-table th,
.summary-table td {
  padding: 10px 8px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  white-space: nowrap;
  word-break: keep-all;
  vertical-align: middle;
}

.summary-table th {
  position: static;
  background: transparent;
  color: var(--muted);
  line-height: 1.4;
}

.summary-table td .tag {
  white-space: nowrap;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 1220px;
}

th,
td {
  padding: 14px 12px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}

th {
  position: sticky;
  top: 0;
  background: #f8fafc;
  z-index: 1;
  font-size: 13px;
  color: var(--muted);
}

thead th:first-child {
  left: 0;
  z-index: 3;
  box-shadow: 1px 0 0 var(--border);
}

body.drawer-open th {
  position: relative;
  top: auto;
  z-index: 0;
}

.sort-btn {
  border: none;
  background: transparent;
  color: inherit;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  padding: 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.sort-btn.active {
  color: var(--brand);
}

tbody tr:hover {
  background: #f8fbff;
}

tbody tr:hover .col-customer {
  background: #f8fbff;
}

.customer-cell {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.customer-cell strong {
  font-size: 14px;
}

.customer-sub {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.55;
}

.customer-sub strong {
  color: #475569;
  font-weight: 700;
}

.row-actions {
  display: flex;
  gap: 8px;
  flex-wrap: nowrap;
  align-items: center;
}

.action-link {
  background: #f8fbff;
  border: 1px solid #dbe7f5;
  border-radius: 999px;
  color: var(--brand);
  cursor: pointer;
  padding: 6px 12px;
  min-height: 34px;
  white-space: nowrap;
  font-weight: 600;
}

.action-link:hover {
  background: #edf5ff;
}

.col-owner,
.col-level,
.col-status,
.col-budget,
.col-next,
.col-risk,
.col-amount,
.col-actions {
  white-space: nowrap;
  vertical-align: middle;
}

.col-owner {
  min-width: 96px;
}

.col-level,
.col-status,
.col-budget,
.col-next,
.col-risk,
.col-amount {
  min-width: 88px;
}

.col-actions {
  min-width: 182px;
}

.col-customer {
  position: sticky;
  left: 0;
  z-index: 2;
  background: #fff;
  min-width: 340px;
  box-shadow: 1px 0 0 var(--border);
}

.drawer {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.34);
  display: none;
  justify-content: center;
  padding: 16px;
  z-index: 1200;
  isolation: isolate;
}

.drawer[aria-hidden="false"] {
  display: flex;
}

.drawer-panel {
  width: min(520px, 100%);
  max-height: calc(100vh - 16px);
  display: flex;
  flex-direction: column;
  position: relative;
  z-index: 1201;
  overflow: hidden;
  box-shadow: 0 20px 48px rgba(15, 23, 42, 0.18);
}

.drawer-panel-wide {
  width: min(1560px, calc(100vw - 16px));
}

.drawer-header,
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 12px 16px 0;
  position: sticky;
  top: 0;
  background: var(--panel);
  z-index: 2;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

.drawer-body {
  overflow: auto;
  padding: 12px 16px 16px;
}

.inline-panel {
  padding: 14px;
  margin-bottom: 12px;
}

.drawer-actions {
  display: flex;
  justify-content: flex-start;
  gap: 8px;
  flex-wrap: wrap;
}

.detail-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-bottom: 12px;
}

.detail-grid-wide {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.detail-item {
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--panel-muted);
  grid-template-columns: 1fr;
}

.detail-item span {
  font-size: 12px;
  color: var(--muted);
}

.timeline-item {
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
}

.timeline-content {
  display: grid;
  gap: 8px;
  margin-top: 8px;
}

.timeline-segment {
  margin: 0;
  padding-left: 14px;
  border-left: 3px solid #dbe7f5;
  color: var(--muted);
  line-height: 1.7;
}

dialog {
  width: min(1680px, calc(100vw - 16px));
  max-height: calc(100vh - 10px);
  padding: 0;
}

dialog::backdrop {
  background: rgba(15, 23, 42, 0.36);
}

.modal-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: calc(100vh - 10px);
}

.form-grid {
  padding: 0 18px;
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: 8px 10px;
  overflow: auto;
}

.form-grid .wide {
  grid-column: 1 / -1;
}

.form-grid .span-3 {
  grid-column: span 4;
}

.lead-modal-form .compact-note textarea {
  min-height: 74px;
}

.followup-grid {
  grid-template-columns: repeat(8, minmax(0, 1fr));
}

.followup-form textarea {
  min-height: 84px;
}

.modal-actions {
  padding: 0 18px 16px;
  justify-content: flex-end;
  position: sticky;
  bottom: 0;
  background: var(--panel);
  border-top: 1px solid var(--border);
}

.section-divider {
  grid-column: 1 / -1;
  margin-top: 2px;
  padding: 4px 2px 2px;
  font-size: 12px;
  font-weight: 700;
  color: var(--brand);
}

.lead-modal-form label,
.followup-form label {
  margin-bottom: 0;
}

.lead-modal-form input,
.lead-modal-form select,
.lead-modal-form textarea,
.followup-form input,
.followup-form select,
.followup-form textarea {
  min-height: 40px;
}

.compact-panel {
  display: grid;
  gap: 10px;
}

.compact-panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.compact-panel-head h4 {
  margin: 0;
}

.compact-info-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px 14px;
}

.compact-info-grid p,
.compact-note-text {
  margin: 0;
  line-height: 1.45;
}

.drawer-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(360px, 0.9fr);
  gap: 14px;
  align-items: start;
}

.drawer-main,
.drawer-side {
  min-width: 0;
}

.timeline-panel {
  display: grid;
  gap: 10px;
}

.timeline-scroll {
  max-height: calc(100vh - 150px);
  overflow: auto;
  padding-right: 4px;
}

.muted {
  color: var(--muted);
}

.table-meta {
  color: var(--muted);
  font-size: 13px;
}

@media (max-width: 1200px) {
  .sidebar {
    grid-template-columns: 1fr;
    padding: 18px 18px 0;
  }

  .sidebar-main {
    grid-template-columns: 1fr;
  }

  .brand-access-panel {
    grid-template-columns: 1fr;
    align-items: start;
  }

  .brand-access-panel .access-panel,
  .filter-panel,
  .action-panel {
    grid-template-columns: 1fr;
  }

  .brand-access-panel .access-panel .section-title {
    grid-column: 1 / -1;
    margin-bottom: 10px;
  }

  .kpi-strip,
  .assessment-grid,
  .task-board-grid,
  .summary-grid,
  .ai-model-grid,
  .dashboard-grid,
  .assessment-center-grid,
  .context-strip,
  .detail-grid,
  .drawer-layout,
  .compact-info-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .form-grid,
  .followup-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .detail-grid-wide {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 780px) {
  .workspace,
  .sidebar {
    padding: 18px;
  }

  .sidebar,
  .sidebar-main {
    grid-template-columns: 1fr;
  }

  .brand-access-panel {
    grid-template-columns: 1fr;
  }

  .col-customer,
  thead th:first-child {
    position: static;
    left: auto;
    box-shadow: none;
  }

  .topbar,
  .band-header,
  .topbar-actions,
  .table-tools,
  .pagination {
    flex-direction: column;
    align-items: stretch;
  }

  .kpi-strip,
  .assessment-grid,
  .task-board-grid,
  .summary-grid,
  .ai-model-grid,
  .dashboard-grid,
  .assessment-center-grid,
  .context-strip,
  .detail-grid,
  .drawer-layout,
  .compact-info-grid {
    grid-template-columns: 1fr;
  }

  .form-grid,
  .followup-grid {
    grid-template-columns: 1fr;
  }

  .topbar h2 {
    font-size: 24px;
  }

  .detail-grid-wide {
    grid-template-columns: 1fr;
  }

  .form-grid .span-3 {
    grid-column: 1 / -1;
  }
}
