:root {
  color-scheme: light;
  --bg: #f5f7fa;
  --body-bg: linear-gradient(180deg, rgba(245, 247, 250, 0.92), rgba(245, 247, 250, 1)),
    #f5f7fa;
  --surface: #ffffff;
  --surface-soft: #eef3f7;
  --text: #1d2733;
  --muted: #667485;
  --line: #d9e1ea;
  --accent: #166c7d;
  --accent-strong: #0d5666;
  --accent-soft: #e2f3f5;
  --accent-line: #c5e8ec;
  --button-line: #bddfe5;
  --button-surface: #ffffff;
  --brand-mark-bg: #d7f0f3;
  --brand-mark-text: #14343b;
  --sidebar-bg: #17212b;
  --sidebar-text: #f7fbff;
  --sidebar-muted: #a9bac8;
  --sidebar-active: rgba(226, 243, 245, 0.14);
  --sidebar-active-line: rgba(226, 243, 245, 0.2);
  --note-bg: #fbfcfd;
  --note-text: #4c5c69;
  --input-bg: #ffffff;
  --focus: #a8dce4;
  --success: #2f7d52;
  --shadow: 0 18px 45px rgba(31, 45, 61, 0.08);
  --radius: 8px;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg: #111820;
  --body-bg: #111820;
  --surface: #18232d;
  --surface-soft: #22313d;
  --text: #eef5f7;
  --muted: #a5b3bf;
  --line: #2c3c48;
  --accent: #40a6b7;
  --accent-strong: #8fdbe6;
  --accent-soft: #173943;
  --accent-line: #285966;
  --button-line: #32616d;
  --button-surface: #1e2b35;
  --brand-mark-bg: #173943;
  --brand-mark-text: #d7f7fb;
  --sidebar-bg: #0d141b;
  --sidebar-text: #f6fbff;
  --sidebar-muted: #9aabb8;
  --sidebar-active: rgba(64, 166, 183, 0.18);
  --sidebar-active-line: rgba(143, 219, 230, 0.22);
  --note-bg: #152029;
  --note-text: #c8d3dc;
  --input-bg: #111a22;
  --focus: #57bacb;
  --success: #65c18d;
  --shadow: 0 18px 45px rgba(0, 0, 0, 0.24);
}

* {
  box-sizing: border-box;
}

body {
  min-width: 320px;
  margin: 0;
  color: var(--text);
  background: var(--body-bg);
}

button {
  font: inherit;
}

.app-shell {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 28px;
  padding: 28px 18px;
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  border-right: 1px solid rgba(255, 255, 255, 0.08);
}

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

.brand-mark {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: var(--radius);
  background: var(--brand-mark-bg);
  color: var(--brand-mark-text);
  font-weight: 800;
}

.brand-kicker,
.page-kicker,
.eyebrow {
  margin: 0;
  color: var(--muted);
  font-size: 0.77rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

.brand-kicker {
  color: var(--sidebar-muted);
}

.brand h1,
.topbar h2,
.empty-state h3 {
  margin: 0;
  letter-spacing: 0;
}

.brand h1 {
  margin-top: 3px;
  font-size: 1.08rem;
  line-height: 1.2;
}

.tab-list {
  display: grid;
  gap: 6px;
}

.tab-button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  min-height: 46px;
  padding: 11px 12px;
  color: var(--sidebar-text);
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius);
  cursor: pointer;
  text-align: left;
}

.tab-button:hover {
  background: rgba(255, 255, 255, 0.07);
}

.tab-button[aria-selected="true"] {
  color: #ffffff;
  background: var(--sidebar-active);
  border-color: var(--sidebar-active-line);
}

.tab-button[disabled] {
  cursor: not-allowed;
  color: var(--sidebar-muted);
}

.tab-name {
  overflow-wrap: anywhere;
  font-weight: 700;
}

.tab-state {
  flex: 0 0 auto;
  margin-left: 12px;
  color: var(--sidebar-muted);
  font-size: 0.73rem;
}

.main-content {
  display: flex;
  min-width: 0;
  flex-direction: column;
  padding: 30px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 24px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.theme-toggle {
  min-height: 36px;
  padding: 8px 12px;
  color: var(--text);
  background: var(--button-surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 800;
  cursor: pointer;
  white-space: nowrap;
}

.theme-toggle:hover {
  border-color: var(--accent);
}

.topbar h2 {
  margin-top: 4px;
  font-size: clamp(1.7rem, 2vw, 2.25rem);
  line-height: 1.1;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  padding: 8px 12px;
  color: var(--accent-strong);
  background: var(--accent-soft);
  border: 1px solid var(--accent-line);
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 700;
  white-space: nowrap;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
}

.content-panel {
  display: flex;
  min-height: min(680px, calc(100vh - 138px));
  flex-direction: column;
  gap: 20px;
}

.workspace-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  padding: 26px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.workspace-header h3 {
  margin: 8px 0 8px;
  font-size: 1.35rem;
  line-height: 1.25;
}

.workspace-header p,
.empty-state p,
.metric-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.header-actions {
  display: flex;
  align-items: start;
  gap: 10px;
}

.action-button {
  min-height: 38px;
  padding: 9px 13px;
  color: var(--accent-strong);
  background: var(--button-surface);
  border: 1px solid var(--button-line);
  border-radius: var(--radius);
  font-weight: 800;
  cursor: default;
}

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

.metric-card,
.empty-state,
.tool-panel,
.action-status,
.data-note {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.metric-card {
  min-height: 118px;
  padding: 18px;
}

.metric-card strong {
  display: block;
  margin-top: 10px;
  font-size: 1.55rem;
}

.empty-state {
  display: grid;
  min-height: 310px;
  place-items: center;
  padding: 34px;
  text-align: center;
}

.empty-state-inner {
  max-width: 560px;
}

.empty-icon {
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  margin: 0 auto 18px;
  color: var(--accent-strong);
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-size: 1.45rem;
  font-weight: 800;
}

.empty-state h3 {
  margin-bottom: 10px;
  font-size: 1.28rem;
}

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

.subtab-list {
  display: flex;
  gap: 8px;
  padding-bottom: 2px;
  border-bottom: 1px solid var(--line);
}

.subtab-button {
  min-height: 38px;
  padding: 8px 13px;
  color: var(--muted);
  background: var(--button-surface);
  border: 1px solid var(--button-line);
  border-radius: var(--radius) var(--radius) 0 0;
  font-weight: 900;
  cursor: pointer;
}

.subtab-button[aria-selected="true"] {
  color: var(--accent-strong);
  background: var(--surface);
  border-color: var(--accent-line);
  border-bottom-color: var(--accent);
}

.tool-panel {
  display: flex;
  min-height: 260px;
  flex-direction: column;
  gap: 14px;
  padding: 18px;
}

.full-panel {
  min-height: auto;
}

.import-panel {
  grid-column: auto;
}

.tool-panel h3 {
  margin: 8px 0;
  font-size: 1.05rem;
  line-height: 1.25;
}

.tool-panel p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.field-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.segmented-control {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
  padding: 4px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.segment-button {
  min-height: 36px;
  color: var(--muted);
  background: transparent;
  border: 1px solid transparent;
  border-radius: calc(var(--radius) - 2px);
  font-weight: 800;
  cursor: pointer;
}

.segment-button[aria-pressed="true"] {
  color: var(--accent-strong);
  background: var(--button-surface);
  border-color: var(--button-line);
}

.is-hidden {
  display: none;
}

.field-label {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.text-input,
.file-input {
  width: 100%;
  min-height: 40px;
  padding: 8px 10px;
  color: var(--text);
  background: var(--input-bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.text-input:focus,
.file-input:focus {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.primary-button,
.secondary-button,
.danger-button {
  min-height: 40px;
  margin-top: auto;
  padding: 9px 13px;
  border-radius: var(--radius);
  font-weight: 800;
  cursor: pointer;
}

.primary-button {
  color: #ffffff;
  background: var(--accent);
  border: 1px solid var(--accent-strong);
}

.secondary-button {
  color: var(--accent-strong);
  background: var(--button-surface);
  border: 1px solid var(--button-line);
}

.danger-button {
  color: #ffffff;
  background: #a43d2e;
  border: 1px solid #8f3124;
}

.inline-button {
  margin-top: 0;
}

.button-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.primary-button:disabled,
.secondary-button:disabled,
.danger-button:disabled {
  cursor: wait;
  opacity: 0.72;
}

.action-status {
  padding: 13px 16px;
  color: var(--accent-strong);
  background: var(--accent-soft);
  font-weight: 700;
}

.import-progress {
  display: grid;
  gap: 8px;
  padding: 12px 14px;
  background: rgba(20, 76, 87, 0.48);
  border: 1px solid var(--button-line);
  border-radius: var(--radius);
}

.import-progress.is-hidden {
  display: none;
}

.import-progress-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--accent-strong);
  font-size: 0.9rem;
  font-weight: 900;
}

.import-progress-track {
  height: 12px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--line);
  border-radius: 999px;
}

.import-progress-bar {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-strong));
  border-radius: inherit;
  transition: width 0.35s ease;
}

.import-progress-detail {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.import-progress[data-tone="error"] {
  background: #fff0ed;
  border-color: #f3c5bd;
}

.import-progress[data-tone="error"] .import-progress-header,
.import-progress[data-tone="error"] .import-progress-detail {
  color: #8a2f23;
}

.import-progress[data-tone="error"] .import-progress-bar {
  background: #b13d2f;
}

.import-progress[data-tone="success"] .import-progress-bar {
  background: #22c55e;
}
.data-note {
  padding: 11px 14px;
  color: var(--note-text);
  background: var(--note-bg);
  font-size: 0.92rem;
  font-weight: 700;
}

.data-note[data-tone="error"] {
  color: #8a2f23;
  background: #fff0ed;
  border-color: #f3c5bd;
}

.action-status[data-tone="error"] {
  color: #8a2f23;
  background: #fff0ed;
  border-color: #f3c5bd;
}

.table-panel {
  display: grid;
  gap: 12px;
  padding: 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.table-toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: end;
}

.table-toolbar h3 {
  margin: 8px 0 0;
  font-size: 1.08rem;
}

.table-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.search-input {
  width: min(300px, 100%);
}

.compact-select {
  width: 150px;
}

.table-button {
  min-height: 40px;
  margin-top: 0;
  white-space: nowrap;
}

.checkbox-control {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  gap: 8px;
  padding: 0 10px;
  color: var(--muted);
  background: var(--button-surface);
  border: 1px solid var(--button-line);
  border-radius: var(--radius);
  font-size: 0.82rem;
  font-weight: 800;
  white-space: nowrap;
}

.checkbox-control input {
  width: 15px;
  height: 15px;
  accent-color: var(--accent);
}

.selection-summary {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 700;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.data-table {
  width: 100%;
  min-width: 1180px;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.data-table th,
.data-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

.data-table th {
  color: var(--muted);
  background: var(--surface-soft);
  font-size: 0.76rem;
  font-weight: 900;
  text-transform: uppercase;
}

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

.data-table td span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.78rem;
}

.budget-view-panel {
  gap: 10px;
}

.budget-table-wrap {
  max-height: 520px;
  overflow: auto;
}

.budget-data-table {
  min-width: 2450px;
  font-size: 0.78rem;
}

.budget-data-table th,
.budget-data-table td {
  padding: 7px 8px;
  white-space: nowrap;
}

.budget-data-table thead th {
  text-align: center;
  vertical-align: middle;
}

.budget-code-row th {
  color: var(--accent-strong);
  font-size: 0.68rem;
}

.trainees-panel {
  gap: 10px;
}

.trainees-table-wrap {
  max-height: 560px;
  overflow: auto;
}

.trainees-data-table {
  min-width: 1360px;
}

.trainees-data-table th,
.trainees-data-table td {
  text-align: center;
  vertical-align: middle;
}

.trainees-data-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
}

.trainees-data-table td strong {
  display: block;
}

.trainees-store-cell {
  max-width: 300px;
}

.trainees-store-cell span {
  display: -webkit-box;
  margin-top: 0;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  line-height: 1.35;
}

.trainees-scroll-status[data-tone="error"] {
  color: #8a2f23;
}

.date-input {
  width: 150px;
}

.timesheet-detail-view-panel {
  gap: 10px;
  margin-top: 12px;
}

.timesheet-detail-table-wrap {
  max-height: 560px;
  overflow: auto;
}

.timesheet-detail-data-table {
  min-width: 1180px;
}

.timesheet-detail-data-table th,
.timesheet-detail-data-table td {
  text-align: center;
  vertical-align: middle;
}

.timesheet-detail-data-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
}

.timesheet-detail-data-table td strong,
.timesheet-detail-data-table td span {
  display: block;
}

.timesheet-detail-data-table td span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.78rem;
}
.anomalies-command-panel {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) auto;
  gap: 16px;
  align-items: end;
  margin-top: 18px;
  padding: 16px 18px;
  background: linear-gradient(180deg, rgba(24, 36, 48, 0.98), rgba(18, 29, 39, 0.98));
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.anomalies-command-panel h3,
.anomalies-command-panel p {
  margin: 0;
}

.anomalies-command-panel h3 {
  margin-top: 6px;
  font-size: 1.16rem;
}

.anomalies-command-panel p:not(.eyebrow) {
  margin-top: 7px;
  color: var(--muted);
  font-weight: 700;
  line-height: 1.4;
}

.anomalies-date-controls {
  display: grid;
  grid-template-columns: 150px 150px auto auto;
  gap: 10px;
  align-items: end;
}
.anomaly-summary-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 12px;
  margin: 18px 0 12px;
}

.anomaly-card {
  display: grid;
  gap: 6px;
  min-height: 92px;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-left-width: 5px;
  border-radius: var(--radius);
}

.anomaly-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

.anomaly-card strong {
  font-size: 2rem;
  line-height: 1;
}

.anomaly-card-teal {
  border-left-color: var(--accent);
}

.anomaly-card-red {
  border-left-color: #e5484d;
}

.anomaly-card-orange {
  border-left-color: #f59e0b;
}

.anomaly-card-yellow {
  border-left-color: #eab308;
}

.anomaly-card-purple {
  border-left-color: #a855f7;
}

.anomaly-card-green {
  border-left-color: #22c55e;
}

.insights-panel {
  display: grid;
  gap: 14px;
  margin-top: 12px;
  padding: 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.insights-header-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: end;
}

.insights-header-row h3,
.insights-panel h3 {
  margin: 7px 0 0;
  font-size: 1.08rem;
}

.severity-pill-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.severity-pill {
  min-height: 34px;
  padding: 0 12px;
  color: var(--muted);
  background: var(--button-surface);
  border: 1px solid var(--button-line);
  border-radius: 999px;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 900;
  cursor: pointer;
}

.severity-pill[aria-pressed="true"] {
  color: #ffffff;
  background: var(--accent);
  border-color: var(--accent-strong);
}

.additional-insights-label {
  margin-top: 4px;
}

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

.insight-card {
  display: grid;
  gap: 10px;
  padding: 16px 18px;
  background: linear-gradient(180deg, rgba(38, 48, 58, 0.94), rgba(30, 41, 51, 0.94));
  border: 1px solid var(--line);
  border-left: 6px solid var(--muted);
  border-radius: var(--radius);
}

.insight-feature-card {
  grid-template-columns: minmax(240px, 0.38fr) minmax(360px, 1fr);
  gap: 18px;
  align-items: stretch;
}

.insight-feature-summary {
  display: grid;
  align-content: start;
  gap: 12px;
  padding-right: 18px;
  border-right: 1px solid var(--line);
}

.insight-feature-metric {
  display: grid;
  gap: 3px;
  margin-top: 10px;
}

.insight-feature-metric strong {
  color: #ff604f;
  font-size: 2.2rem;
  line-height: 1;
}

.insight-high .insight-feature-metric strong {
  color: #ff9f1c;
}

.insight-positive .insight-feature-metric strong {
  color: #22c55e;
}

.insight-feature-metric span {
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 800;
}

.insight-mini-table-wrap {
  min-width: 0;
  overflow-x: auto;
}

.insight-mini-table {
  width: 100%;
  min-width: 520px;
  border-collapse: collapse;
  font-size: 0.82rem;
}

.insight-mini-table th,
.insight-mini-table td {
  padding: 8px 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  text-align: left;
  white-space: nowrap;
}

.insight-mini-table th {
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 900;
}

.insight-mini-table td:nth-child(n+2),
.insight-mini-table th:nth-child(n+2) {
  text-align: center;
}

.insight-mini-row-critical td:nth-child(n+2) {
  color: #ff604f;
  font-weight: 900;
}

.insight-mini-row-high td:nth-child(n+3) {
  color: #ff9f1c;
  font-weight: 900;
}
.insight-card h4,
.insight-card p {
  margin: 0;
}

.insight-card h4 {
  font-size: 1rem;
}

.insight-card p {
  color: var(--muted);
  line-height: 1.45;
  font-weight: 700;
}

.insight-card-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
}

.insight-critical {
  border-left-color: #e5484d;
}

.insight-high {
  border-left-color: #f59e0b;
}

.insight-medium {
  border-left-color: #8b7cf6;
}

.insight-positive {
  border-left-color: var(--accent);
}

.severity-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 76px;
  padding: 4px 9px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 900;
}

.severity-critical {
  color: #8a1f1f;
  background: #ffe1e1;
}

.severity-high {
  color: #7a3d00;
  background: #ffe8bf;
}

.severity-medium {
  color: #3f3478;
  background: #e8e4ff;
}

.severity-positive {
  color: #00574f;
  background: #c9fff8;
}

.insight-impact {
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 900;
}

.insight-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.insight-tags span {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 10px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 800;
}

.market-variance-chart {
  display: grid;
  gap: 8px;
}

.market-variance-row {
  display: grid;
  grid-template-columns: 190px minmax(180px, 1fr) 72px;
  gap: 10px;
  align-items: center;
}

.market-variance-name,
.market-variance-value {
  font-size: 0.82rem;
  font-weight: 900;
}

.market-variance-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.market-variance-track {
  position: relative;
  height: 14px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  overflow: hidden;
}

.market-variance-zero {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 1px;
  background: var(--line);
}

.market-variance-bar {
  position: absolute;
  top: 0;
  bottom: 0;
  max-width: 50%;
  border-radius: 999px;
}

.market-variance-bar.is-over {
  left: 50%;
  background: #e5484d;
}

.market-variance-bar.is-under {
  right: 50%;
  background: #2dd4bf;
}

.market-variance-value.is-over {
  color: #ff8b8b;
}

.market-variance-value.is-under {
  color: #6ee7d8;
}
.anomaly-insight-detail-panel {
  gap: 10px;
  margin-top: 12px;
}

.anomaly-insight-detail-panel.is-hidden {
  display: none;
}

.anomaly-insight-detail-table-wrap {
  max-height: 520px;
  overflow: auto;
}

.anomaly-insight-detail-data-table {
  min-width: 1400px;
}

.anomaly-insight-detail-data-table th,
.anomaly-insight-detail-data-table td {
  text-align: center;
  vertical-align: middle;
}

.anomaly-insight-detail-data-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
}

.anomaly-insight-detail-data-table td strong,
.anomaly-insight-detail-data-table td span {
  display: block;
}

.anomaly-insight-detail-data-table td span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.78rem;
}

.insight-detail-button {
  justify-self: start;
  min-width: 112px;
}
.anomaly-card-detail {
  display: grid;
  grid-column: 1 / -1;
  gap: 10px;
  margin-top: 8px;
  padding: 14px;
  background: rgba(8, 18, 28, 0.42);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.anomaly-card-detail.is-hidden {
  display: none;
}

.anomaly-card-detail-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
}

.anomaly-card-detail-header h4 {
  margin: 4px 0 0;
}

.anomaly-card-detail-table-wrap {
  max-height: 420px;
  overflow: auto;
}

.anomaly-card-detail-close {
  min-width: 82px;
}
.anomalies-panel,
.dm-anomaly-panel {
  gap: 10px;
  margin-top: 12px;
}

.anomaly-filter-bar .compact-select {
  width: 170px;
}

.anomalies-table-wrap {
  max-height: 560px;
  overflow: auto;
}

.anomalies-data-table {
  min-width: 1400px;
}

.anomalies-data-table th,
.anomalies-data-table td,
.dm-anomaly-data-table th,
.dm-anomaly-data-table td {
  text-align: center;
  vertical-align: middle;
}

.anomalies-data-table thead th,
.dm-anomaly-data-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
}

.sortable-header {
  width: 100%;
  padding: 0;
  color: inherit;
  background: transparent;
  border: 0;
  font: inherit;
  font-weight: 900;
  text-transform: uppercase;
  cursor: pointer;
}

.sortable-header span {
  display: inline;
  margin-left: 4px;
  color: var(--accent-strong);
  font-size: 0.68rem;
}

.data-table td .anomaly-badge {
  display: inline-flex;
  margin-top: 0;
}

.anomaly-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 136px;
  margin: 0;
  padding: 6px 8px;
  border-radius: 999px;
  color: #ffffff;
  font-size: 0.76rem;
  font-weight: 900;
}

.anomaly-badge-orange {
  background: #c05621;
}

.anomaly-badge-yellow {
  color: #1f2933;
  background: #facc15;
}

.anomaly-badge-purple {
  background: #7c3aed;
}

.anomaly-badge-red {
  background: #dc2626;
}

.anomaly-badge-grey {
  background: #64748b;
}

.dm-anomaly-table-wrap {
  max-height: 360px;
  overflow: auto;
}

.dm-anomaly-data-table {
  min-width: 900px;
}

.dm-leaderboard-top td {
  background: rgba(220, 38, 38, 0.16);
}
.leadership-header {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(520px, 0.95fr);
  gap: 18px;
  align-items: end;
}

.leadership-title-block h3 {
  margin: 8px 0 0;
  font-size: 1.12rem;
}

.leadership-controls {
  display: grid;
  grid-template-columns: 150px 150px auto;
  gap: 10px;
  align-items: end;
  justify-self: end;
  width: min(100%, 520px);
}

.leadership-date-group,
.leadership-search-group {
  display: grid;
  gap: 5px;
}

.leadership-search-group .search-input {
  width: 100%;
}

.leadership-button-group {
  display: flex;
  gap: 8px;
  align-items: end;
}

.leadership-button-group .table-button {
  min-width: 88px;
}
.leadership-filter-bar {
  display: grid;
  grid-template-columns: auto minmax(150px, 1fr) minmax(190px, 1.35fr) minmax(170px, 1.05fr) minmax(220px, 1.35fr) auto;
  gap: 8px;
  align-items: center;
  padding: 10px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.leadership-role-pills {
  display: inline-flex;
  gap: 7px;
  align-items: center;
  white-space: nowrap;
}

.leadership-role-pill {
  min-height: 32px;
  min-width: 42px;
  padding: 0 12px;
  color: var(--muted);
  background: var(--button-surface);
  border: 1px solid var(--button-line);
  border-radius: 999px;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 900;
  cursor: pointer;
}

.leadership-role-pill[aria-pressed="true"] {
  color: #ffffff;
  background: var(--accent);
  border-color: var(--accent-strong);
}

.leadership-role-dm[aria-pressed="true"] {
  background: #1f9d63;
  border-color: #31c27c;
}

.leadership-role-om[aria-pressed="true"] {
  background: #a45b1f;
  border-color: #d07a2d;
}

.leadership-role-tm[aria-pressed="true"] {
  background: #6d4bb5;
  border-color: #8b6bd8;
}

.leadership-filter-select,
.leadership-filter-search {
  width: 100%;
  min-width: 0;
}

.leadership-reset-button {
  min-height: 40px;
  margin-top: 0;
  white-space: nowrap;
}
.leadership-panel {
  gap: 10px;
}

.leadership-table-wrap {
  max-height: 560px;
  overflow: auto;
}

.leadership-data-table {
  min-width: 1180px;
}

.leadership-data-table th,
.leadership-data-table td {
  text-align: center;
  vertical-align: middle;
}

.leadership-data-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
}

.leadership-data-table td strong {
  display: block;
}

.detail-toggle {
  min-height: 30px;
  padding: 5px 8px;
  color: var(--accent-strong);
  background: var(--button-surface);
  border: 1px solid var(--button-line);
  border-radius: var(--radius);
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

.detail-toggle[aria-expanded="true"] {
  color: #ffffff;
  background: var(--accent);
  border-color: var(--accent-strong);
}

.compact-detail-toggle {
  max-width: 170px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.details-button {
  min-width: 88px;
  color: #ffffff;
  background: var(--accent);
  border-color: var(--accent-strong);
}

.details-button[aria-expanded="true"] {
  background: var(--accent-strong);
}

.leadership-detail-row td {
  padding: 0;
  text-align: left;
}

.leadership-detail-panel {
  display: grid;
  gap: 10px;
  padding: 12px;
  background: var(--surface-soft);
  border-top: 1px solid var(--line);
}

.leadership-detail-panel span,
.detail-table span {
  display: block;
  color: var(--muted);
  font-size: 0.82rem;
}

.detail-table {
  width: 100%;
  border-collapse: collapse;
}

.detail-table th,
.detail-table td {
  padding: 8px;
  border-top: 1px solid var(--line);
  text-align: center;
  vertical-align: middle;
}

.leadership-detail-empty {
  padding: 12px;
  color: var(--muted);
  background: var(--surface-soft);
  font-weight: 700;
}

.empty-table-cell {
  color: var(--muted);
  text-align: center;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(6, 12, 18, 0.58);
}

.modal-backdrop.is-hidden {
  display: none;
}

.modal-panel {
  width: min(460px, 100%);
  padding: 20px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.modal-panel h3 {
  margin: 0 0 8px;
}

.modal-panel p {
  margin: 0 0 16px;
  color: var(--muted);
  line-height: 1.5;
}

.modal-error {
  min-height: 22px;
  margin-top: 8px;
  color: #a43d2e;
  font-weight: 800;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 16px;
}

@media (max-width: 880px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 2;
    gap: 18px;
    padding: 18px;
  }

  .tab-list {
    grid-auto-flow: column;
    grid-auto-columns: minmax(158px, 1fr);
    overflow-x: auto;
    padding-bottom: 2px;
  }

  .tab-button {
    min-height: 44px;
  }

  .main-content {
    padding: 22px;
  }

  .workspace-header,
  .topbar {
    grid-template-columns: 1fr;
    flex-direction: column;
    align-items: stretch;
  }

  .topbar-actions {
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .header-actions {
    align-items: stretch;
  }

  .report-grid {
    grid-template-columns: 1fr;
  }

  .tool-grid {
    grid-template-columns: 1fr;
  }

  .import-panel {
    grid-column: auto;
  }

  .table-toolbar {
    grid-template-columns: 1fr;
  }

  .table-actions {
    justify-content: flex-start;
  }

  .search-input {
    width: 100%;
  }

  .compact-select {
    width: 100%;
  }

  .anomalies-command-panel,
  .insights-header-row {
    grid-template-columns: 1fr;
  }

  .anomalies-date-controls {
    grid-template-columns: 1fr 1fr;
    width: 100%;
  }

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

  .insight-feature-card {
    grid-template-columns: 1fr;
  }

  .insight-feature-summary {
    padding-right: 0;
    padding-bottom: 14px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

}

@media (max-width: 540px) {
  .brand {
    align-items: flex-start;
  }

  .topbar h2 {
    font-size: 1.55rem;
  }

  .workspace-header,
  .empty-state {
    padding: 22px;
  }

  .field-row {
    grid-template-columns: 1fr;
  }

  .button-row {
    grid-template-columns: 1fr;
  }

  .anomalies-date-controls,
  .anomaly-summary-grid {
    grid-template-columns: 1fr;
  }
}



















.workbook-report-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: end;
}

.workbook-report-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  flex-wrap: wrap;
}

.workbook-summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(160px, 1fr));
  gap: 12px;
  margin: 12px 0;
}

.workbook-summary-grid article {
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius);
}

.workbook-summary-grid p {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

.workbook-summary-grid strong {
  font-size: 1.3rem;
}

.workbook-view-panel {
  gap: 10px;
}

.workbook-sheet-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.workbook-sheet-tabs button {
  min-height: 36px;
  padding: 0 12px;
  color: var(--muted);
  background: var(--button-surface);
  border: 1px solid var(--button-line);
  border-radius: var(--radius);
  font-weight: 900;
  cursor: pointer;
}

.workbook-sheet-tabs button[aria-pressed="true"] {
  color: #fff;
  background: var(--accent);
  border-color: var(--accent-strong);
}

.workbook-report-table-wrap {
  max-height: 620px;
  overflow: auto;
}

.workbook-report-data-table {
  min-width: 2400px;
  font-size: 0.78rem;
}

.workbook-report-data-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  text-align: center;
  vertical-align: middle;
}

.workbook-report-data-table thead tr:nth-child(2) th {
  top: 38px;
  background: var(--surface-soft);
}

.workbook-report-data-table td {
  text-align: center;
  vertical-align: middle;
  white-space: nowrap;
}

.workbook-report-data-table td strong {
  display: block;
}

.variance-negative {
  color: #ff8b8b;
  font-weight: 900;
}

.variance-positive {
  color: #6ee7d8;
  font-weight: 900;
}

@media (max-width: 900px) {
  .workbook-report-panel,
  .workbook-summary-grid {
    grid-template-columns: 1fr;
  }
}
