/* Shared EIS tokens and components. Page styles contain domain-specific layouts. */
:root {
  color-scheme: light;
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif;
  --page: #f4f7fb;
  --surface: #fff;
  --surface-2: #f8fafc;
  --ink: #17263c;
  --muted: #627287;
  --line: #dce5ef;
  --accent: #2563eb;
  --accent-dark: #1d4ed8;
  --accent-soft: #eff5ff;
  --success: #087f5b;
  --success-soft: #eaf8f1;
  --danger: #b42318;
  --danger-soft: #fff0ee;
  --amber: #a15c00;
  --amber-soft: #fff7e6;
  --shadow: 0 12px 34px rgb(27 48 82 / 5%);
  --radius: 16px;
  --control-radius: 10px;
  --content-width: 1280px;
  /* Existing business widgets use these aliases for semantic colours. */
  --bg: var(--page);
  --panel: var(--surface);
  --card: var(--surface);
  --text: var(--ink);
  --border: var(--line);
  --blue: var(--accent);
  --blue2: #dbeafe;
  --blue-soft: var(--accent-soft);
  --green: var(--success);
  --green-soft: var(--success-soft);
  --red: var(--danger);
  --red-dark: #941d14;
  --red2: #941d14;
  --red-soft: var(--danger-soft);
  --redsoft: var(--danger-soft);
  --greensoft: var(--success-soft);
  --ambersoft: var(--amber-soft);
  --bluesoft: var(--accent-soft);
  --slate: #334155;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--page); color: var(--ink); font: inherit; }
a { color: var(--accent-dark); }
button, input, select, textarea { font: inherit; }
button, select { cursor: pointer; }
button:disabled, input:disabled, select:disabled { cursor: not-allowed; opacity: .55; }
[hidden] { display: none !important; }
/* Keep keyboard focus visible on links, cards and all native controls. */
:focus-visible { outline: 3px solid #93b4ff; outline-offset: 3px; }
.skip-link { position: fixed; left: 16px; top: -100px; z-index: 100; padding: 12px 18px; border-radius: 10px; background: #fff; }
.skip-link:focus { top: 12px; }
.app-header { background: #14233a; color: #fff; }
.app-header-inner, .app-subnav-inner, main.shell {
  width: 100%; max-width: var(--content-width); margin: 0 auto; padding-left: 24px; padding-right: 24px;
}
.app-header-inner { min-height: 80px; display: flex; align-items: center; gap: 28px; padding-top: 14px; padding-bottom: 14px; }
.app-brand { display: flex; align-items: center; gap: 11px; flex-shrink: 0; color: #fff; text-decoration: none; }
.app-brand-mark { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 11px; background: #3b82f6; font-weight: 750; }
.app-brand strong { display: block; font-size: 16px; letter-spacing: .015em; }
.app-brand small { display: block; margin-top: 1px; color: #b5c6dd; font-size: 11px; }
.app-nav { display: flex; flex-wrap: wrap; gap: 4px; }
.app-nav a { display: flex; align-items: center; min-height: 42px; padding: 8px 14px; border-radius: 10px; color: #cad7e9; text-decoration: none; font-size: 14px; font-weight: 600; }
.app-nav a:hover { background: #203550; color: #fff; }
.app-nav a.is-current { background: #29486f; color: #fff; }
.app-header-status { margin-left: auto; color: #c6d5e9; font-size: 12px; text-align: right; }
.app-subnav { background: var(--surface); border-bottom: 1px solid var(--line); }
.app-subnav-inner { display: flex; gap: 22px; overflow-x: auto; scrollbar-width: thin; }
.app-subnav a { display: flex; align-items: center; flex-shrink: 0; min-height: 52px; border-bottom: 3px solid transparent; padding-top: 3px; color: var(--muted); text-decoration: none; font-size: 13px; font-weight: 650; }
.app-subnav a:hover, .app-subnav a.is-current { color: var(--accent-dark); }
.app-subnav a.is-current { border-bottom-color: var(--accent); }
main.shell { padding-top: 32px; padding-bottom: 64px; }
h1 { margin: 0; font-size: clamp(28px, 3vw, 40px); line-height: 1.15; letter-spacing: -.035em; overflow-wrap: anywhere; }
h2 { margin: 0; font-size: 20px; line-height: 1.35; letter-spacing: -.02em; }
.eyebrow { margin: 0 0 8px; color: var(--accent); font-size: 12px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; }
.hero { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 24px; }
.hero > :first-child { flex: 1 1 580px; min-width: 0; }
.hero p:not(.eyebrow), .intro { margin: 12px 0 0; max-width: 90ch; color: var(--muted); font-size: 15px; line-height: 1.6; }
.hero .controls, .hero .actions { justify-content: flex-start; max-width: 100%; }
.intro { margin-bottom: 24px; }
.muted { color: var(--muted); }
.panel, .card, .sync-card, .sync { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); min-width: 0; }
.card:not(.table-card) { padding: 20px; }
.card-title, .title, .cal-title { color: var(--ink); font-size: 17px; font-weight: 700; line-height: 1.4; }
.card-subtitle, .card-sub, .subtitle, .cal-note { color: var(--muted); font-size: 13px; line-height: 1.5; }
.sub, .source, .hint, .sync-meta, .detail-meta, .selected-meta { color: var(--muted); font-size: 12px; line-height: 1.5; }
.sync-title, .section-title { font-size: 13px; }
.metric-label, .mlabel, .ml { font-size: 11px; line-height: 1.4; }
.kpi-label, .klabel, .kl { color: var(--muted); font-size: 12px; font-weight: 650; text-transform: none; letter-spacing: 0; }
.kpi-value, .kvalue, .kv { font-size: 28px; font-weight: 750; line-height: 1.2; margin-top: 10px; font-variant-numeric: tabular-nums; }
.kpi-meta, .kmeta, .km { color: var(--muted); font-size: 12px; line-height: 1.45; margin-top: 6px; overflow-wrap: anywhere; }
/* Primary actions share a colour; error/loss indicators keep their semantics. */
.btn, .small-btn, .platform-page button {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 10px 16px; border: 1px solid #cbd8e8; border-radius: var(--control-radius);
  background: var(--surface); color: var(--ink); font-size: 14px; font-weight: 650; line-height: 1.4; text-decoration: none; cursor: pointer;
}
.btn:hover, .small-btn:hover, .platform-page button.secondary:hover { border-color: #a7bddb; background: var(--surface-2); }
.btn.primary, .btn-primary, .small-btn.primary, .platform-page button:not(.secondary):not(.danger) { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover, .btn-primary:hover, .small-btn.primary:hover, .platform-page button:not(.secondary):not(.danger):hover { background: var(--accent-dark); border-color: var(--accent-dark); }
.btn.secondary-red, .platform-page button.danger { color: var(--danger); background: var(--danger-soft); border-color: #f0c4be; }
.small-btn, .platform-page button.small { min-height: 36px; padding: 7px 11px; font-size: 12px; }
input:not([type=checkbox]):not([type=radio]):not([type=file]):not([type=hidden]), select, textarea {
  min-height: 44px; max-width: 100%; border: 1px solid #bccbdc; border-radius: var(--control-radius);
  padding: 10px 12px; background: var(--surface); color: var(--ink); font-size: 14px; line-height: 1.4;
}
input::placeholder, textarea::placeholder { color: #728196; opacity: 1; }
input[type=checkbox], input[type=radio] { accent-color: var(--accent); }
input[type=file]::file-selector-button { min-height: 38px; padding: 7px 12px; border: 1px solid #cbd8e8; border-radius: 8px; background: var(--surface); color: var(--ink); font: inherit; cursor: pointer; }
.field input, .field select { height: auto; }
.field label, .field-label { font-size: 13px; font-weight: 650; color: var(--ink); }
.segmented, .segments { display: flex; flex-wrap: wrap; gap: 3px; padding: 3px; border: 1px solid var(--line); border-radius: 12px; background: #eaf0f7; }
.segmented button, .segments button { min-height: 38px; padding: 8px 14px; border: 0; border-radius: 8px; background: transparent; color: var(--muted); font-size: 13px; font-weight: 650; }
.segmented button.active, .segments button.active { color: var(--accent-dark); background: var(--surface); box-shadow: 0 1px 3px rgb(27 48 82 / 8%); }
.filter.active { color: var(--accent-dark); background: var(--accent-soft); border-color: #b5cdf4; }
.switch:checked { background: var(--accent); }
.table-wrap, .tablewrap, .mapping-wrap, .cal-table-wrap { max-width: 100%; border-color: var(--line); border-radius: 12px; scrollbar-width: thin; }
table th, .table th, .mapping-table th, .cal-table th { padding: 12px; background: var(--surface-2); color: var(--muted); font-size: 11px; font-weight: 700; line-height: 1.4; }
table td, .table td, .mapping-table td, .cal-table td { padding: 12px; font-size: 13px; line-height: 1.45; }
tbody tr:hover, .table tbody tr:hover { background: #f8faff; }
tbody tr.selected, .table tbody tr.selected { background: var(--accent-soft); }
.banner, .error-banner, .error, .note { font-size: 13px; line-height: 1.6; border-radius: 12px; }
.empty { font-size: 14px; line-height: 1.6; }
.badge, .conf { font-size: 11px; line-height: 1.4; }
.footer-note { font-size: 12px; }
.sticky, .sticky-panel, .side, .detail { top: 24px; }
dialog { color: var(--ink); border: 1px solid var(--line); border-radius: var(--radius); }
dialog::backdrop { background: rgb(20 35 58 / 55%); }
.platform-page .grid { grid-template-columns: repeat(auto-fit, minmax(min(100%, 390px), 1fr)); }
.platform-page .toolbar { flex-wrap: wrap; }
.platform-page .field input[type=checkbox] { width: auto; }
@media (max-width: 1000px) {
  .app-header-inner { flex-wrap: wrap; gap: 12px 20px; }
  .app-nav { order: 3; width: 100%; }
  .hero > :first-child { flex-basis: 100%; }
}
@media (max-width: 600px) {
  .app-header-inner, .app-subnav-inner, main.shell { padding-left: 16px; padding-right: 16px; }
  .app-header-inner { padding-top: 12px; padding-bottom: 12px; }
  .app-header-status { max-width: 38%; font-size: 11px; }
  .app-nav { display: grid; grid-template-columns: auto 1fr; gap: 4px; }
  .app-nav a { min-height: 40px; padding: 8px 12px; font-size: 13px; }
  .app-subnav-inner { gap: 18px; }
  main.shell { padding-top: 24px; padding-bottom: 40px; }
  .hero { gap: 16px; }
  .hero p:not(.eyebrow), .intro { font-size: 14px; }
  .card:not(.table-card) { padding: 16px; }
  .card-head, .head, .table-toolbar, .mapping-head, .cal-head { flex-wrap: wrap; }
  .table-tools, .tools, .controls, .actions { min-width: 0; max-width: 100%; }
  .kpi-value, .kvalue, .kv { font-size: 25px; }
  .search { width: 100%; }
  .toast { max-width: calc(100% - 32px); right: 16px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
}
