/*
 * IAG Ops ERP — Enterprise - Clean
 * Source of truth: working/M3/20_design/theme.md
 *
 * app.css owns layout and responsive behaviour. This file owns the visual
 * tokens and restrained enterprise skin so the theme can evolve without
 * coupling presentation choices to Django page structure.
 */
:root {
  --accent: #3949ab;
  --accent-hover: #2f3d94;
  --accent-soft: #eef0fb;
  --accent2: #0e7490;
  --accent-2: var(--accent2);

  --good: #15803d;
  --good-soft: #ecfdf3;
  --warn: #b45309;
  --warn-soft: #fff7ed;
  --bad: #b91c1c;
  --bad-soft: #fef2f2;

  --bg: #f4f5f7;
  --surface: #eceef2;
  --panel: #ffffff;
  --panel-2: #f7f8fa;
  --topbar-bg: #ffffff;
  --sidebar-bg: #fbfcfd;

  --border: #e3e6eb;
  --border-strong: #cdd2da;
  --text: #1a2233;
  --text-2: #5a6475;
  --text-3: #98a1b2;

  --font-disp: "IBM Plex Sans", "Noto Sans TC", "Microsoft JhengHei", system-ui, sans-serif;
  --font-body: "IBM Plex Sans", "Noto Sans TC", "Microsoft JhengHei", system-ui, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, Menlo, Consolas, monospace;
  --font: var(--font-body);
  --mono: var(--font-mono);

  --radius-sm: 3px;
  --radius: 6px;
  --radius-lg: 8px;
  --radius-pill: 6px;
  --chip-radius: 4px;
  --r-sm: var(--radius-sm);
  --r: var(--radius);
  --r-lg: var(--radius-lg);

  --shadow: 0 1px 2px rgba(20, 30, 55, 0.05);
  --shadow-lg: 0 18px 44px rgba(20, 30, 55, 0.14);
  --nav-active-bg: #eef0fb;
  --nav-active-fg: #3949ab;
}

html {
  text-rendering: optimizeLegibility;
}

body {
  font-family: var(--font-body);
  line-height: 1.5;
}

::placeholder {
  color: var(--text-3);
  opacity: 1;
}

::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-thumb {
  border: 2px solid var(--bg);
  border-radius: 99px;
  background: var(--border-strong);
}

a:hover {
  color: var(--accent-hover);
}

.mono {
  letter-spacing: -0.01em;
}

.topbar {
  background: var(--topbar-bg);
  box-shadow: var(--shadow);
}

.brand,
.brand-tile,
.page-head h1,
.panel-head,
.btn,
.metric > span,
.metric > strong,
.chip,
th {
  font-family: var(--font-disp);
}

.brand-tile {
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  letter-spacing: 0.02em;
}

.env {
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
}

.global-search input {
  border-radius: var(--radius);
  background: var(--surface);
}

.global-search input:focus,
.field input:focus,
.field select:focus,
.form-field input:focus,
.column-search input:focus {
  outline: 0;
  border-color: var(--accent);
  background: var(--panel);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.top-button,
.icon-button,
.btn,
.field input,
.field select,
.form-field input {
  border-radius: var(--radius);
}

.user-card {
  border-radius: var(--radius-pill);
  background: var(--panel);
}

.avatar {
  border-radius: var(--radius-pill);
  font-family: var(--font-disp);
}

.sidebar {
  background: var(--sidebar-bg);
}

.nav-item,
.nav-tree > summary {
  border-radius: var(--radius);
  font-weight: 600;
}

.nav-item.active,
.data-nav-tree > summary.active {
  border-radius: 0 var(--radius) var(--radius) 0;
  background: var(--nav-active-bg);
  color: var(--nav-active-fg);
  box-shadow: inset 3px 0 0 var(--accent);
}

.nav-child,
.nav-child-overview {
  border-radius: var(--radius-sm);
}

.page-head h1 {
  font-weight: 600;
}

.btn {
  font-weight: 700;
}

.panel,
.table-wrap,
.toolbar,
.subfunction-card,
.dataset-identity,
.login-card {
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

.metric {
  border-left: 3px solid var(--border-strong);
  border-radius: var(--radius-lg);
}

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

.metric.good {
  border-left-color: var(--good);
}

.metric.warn {
  border-left-color: var(--warn);
}

.metric.bad,
.metric.alert {
  border-left-color: var(--bad);
}

.metric > strong,
.module-summary strong,
.card-stat-row dd,
.sync-overview-card strong,
.reason-row strong,
.health-legend strong {
  font-variant-numeric: tabular-nums;
}

.chip {
  border-radius: var(--chip-radius);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

th {
  color: var(--text-2);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
}

td {
  padding: 13px 14px;
}

.modal {
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
}

.column-picker-panel {
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
}

.login-page {
  background: var(--bg);
}

.login-card {
  border-left: 3px solid var(--accent);
}

.login-card h1 {
  font-family: var(--font-disp);
  font-weight: 600;
}

@media (max-width: 680px) {
  .page-head h1 {
    font-size: 22px;
  }

  .modal {
    border-radius: var(--radius-lg);
  }

  .modal-backdrop.dataset-drawer .modal {
    border-radius: 0;
  }
}

