/* ================================================================
   ELINT DESIGN SYSTEM
   Font: Syne (headings/brand) + DM Sans (body)
   Theme: Sunset (default) | Dark | White | Outlook | Aurora
================================================================ */

/* ── CSS Variables ──────────────────────────────────────────── */
:root {
  --font-heading: 'Syne', sans-serif;
  --font-body: 'DM Sans', sans-serif;

  /* Sunset (default) */
  --bg: #fff6ef;
  --bg-card: #ffffff;
  --bg-panel: rgba(255,255,255,0.94);
  --fg: #111827;
  --fg-muted: rgba(17,24,39,0.65);
  --primary: #e07000;
  --primary-soft: rgba(224,112,0,0.12);
  --accent: #7c3aed;
  --border: rgba(31,41,55,0.12);
  --border-strong: rgba(31,41,55,0.22);
  --shadow: 0 4px 24px rgba(0,0,0,0.08);
  --shadow-lg: 0 12px 48px rgba(0,0,0,0.12);
  --radius: 16px;
  --radius-sm: 10px;
  --header-bg: linear-gradient(105deg, #04091a 0%, #0d1e50 42%, #1a4db5 78%, #1F6FEB 100%);
  --tbl-head: rgba(224,112,0,0.10);
  --tbl-even: rgba(255,243,230,0.6);
  --input-bg: rgba(255,255,255,0.96);
  --input-border: rgba(31,41,55,0.16);
  --btn-bg: #e07000;
  --btn-fg: #ffffff;
}

[data-theme="dark"] {
  --bg: #060816;
  --bg-card: rgba(15,23,42,0.62);
  --bg-panel: rgba(15,23,42,0.80);
  --fg: #e5e7eb;
  --fg-muted: rgba(229,231,235,0.65);
  --primary: #1F6FEB;
  --primary-soft: rgba(31,111,235,0.16);
  --border: rgba(148,163,184,0.15);
  --border-strong: rgba(148,163,184,0.28);
  --tbl-head: rgba(31,111,235,0.22);
  --tbl-even: rgba(15,23,42,0.80);
  --input-bg: rgba(9,17,36,0.85);
  --input-border: rgba(148,163,184,0.22);
  --btn-bg: #1F6FEB;
}

[data-theme="white"] {
  --bg: #f6f8fc;
  --primary: #1F6FEB;
  --primary-soft: rgba(31,111,235,0.10);
  --tbl-head: rgba(31,111,235,0.10);
  --btn-bg: #1F6FEB;
}

[data-theme="aurora"] {
  --bg: #030413;
  --bg-card: rgba(7,12,28,0.72);
  --fg: #e6f0ff;
  --fg-muted: rgba(230,240,255,0.65);
  --primary: #3B82F6;
  --primary-soft: rgba(59,130,246,0.18);
  --border: rgba(59,130,246,0.22);
  --tbl-head: rgba(34,211,238,0.16);
  --input-bg: rgba(6,10,24,0.90);
  --btn-bg: #3B82F6;
}

/* ── Reset ──────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html {
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
}

html[data-ui-scale="s"] { font-size: 14px; }
html[data-ui-scale="m"] { font-size: 15px; }
html[data-ui-scale="l"] { font-size: 16.5px; }
body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--fg);
  min-height: 100vh;
  line-height: 1.55;
}

/* ── Header ─────────────────────────────────────────────────── */
.elint-header {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  padding: 0.75rem 2rem;
  background: var(--header-bg);
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 4px 24px rgba(31,111,235,0.30);
}
.header-logo { display: flex; align-items: center; gap: 0.75rem; }
.header-logo-svg { width: 42px; height: 42px; filter: drop-shadow(0 0 8px rgba(56,189,248,0.5)); }
.header-brand { display: flex; align-items: baseline; gap: 0.35rem; }
.header-title {
  font-family: var(--font-heading);
  font-size: 1.35rem;
  font-weight: 800;
  color: #fff;
  letter-spacing: 0.02em;
}
.header-dash { color: rgba(255,255,255,0.5); font-size: 1.1rem; }
.header-subtitle { font-size: 0.95rem; color: rgba(255,255,255,0.85); font-weight: 400; }
.header-tagline {
  flex: 1;
  font-size: 0.88rem;
  color: rgba(255,255,255,0.70);
  font-style: italic;
}
.header-meta { display: flex; align-items: center; gap: 1rem; }
.header-license { font-size: 0.82rem; color: rgba(255,255,255,0.80); }
.user-badge {
  font-size: 0.82rem;
  padding: 0.25rem 0.65rem;
  background: rgba(255,255,255,0.15);
  border-radius: 999px;
  color: #fff;
}
.user-badge--demo { background: rgba(255,140,0,0.30); }
.btn-logout {
  font-size: 0.82rem;
  color: rgba(255,255,255,0.80);
  text-decoration: none;
  padding: 0.25rem 0.65rem;
  border: 1px solid rgba(255,255,255,0.25);
  border-radius: 8px;
  transition: background 0.15s;
}
.btn-logout:hover { background: rgba(255,255,255,0.15); color: #fff; }

/* ── Main ────────────────────────────────────────────────────── */
.main-content {
  max-width: 1400px;
  margin: 0 auto;
  padding: 1.5rem 1.5rem 3rem;
}

/* ── Card ────────────────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.25rem 1.5rem;
  margin-bottom: 1rem;
}

/* ── Controls Bar ────────────────────────────────────────────── */
.controls-bar { padding: 1rem 1.5rem 0; }
.controls-inner {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  align-items: flex-end;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}
.ctrl-group { display: flex; flex-direction: column; gap: 0.3rem; min-width: 200px; flex: 1; }
.ctrl-group--sm { min-width: 110px; flex: 0 0 auto; }
.ctrl-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--fg-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.ctrl-icon { margin-right: 0.2rem; }
.ctrl-select {
  width: 100%;
  padding: 0.5rem 0.75rem;
  background: var(--input-bg);
  color: var(--fg);
  border: 1px solid var(--input-border);
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 0.90rem;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23888' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.7rem center;
  padding-right: 2rem;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.ctrl-select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}
.ctrl-locked {
  padding: 0.5rem 0.75rem;
  background: rgba(255,140,0,0.10);
  border: 1px solid rgba(255,140,0,0.30);
  border-radius: var(--radius-sm);
  font-size: 0.90rem;
  font-weight: 600;
}
.lock-badge { margin-right: 0.3rem; }

/* ── KPI Strip ───────────────────────────────────────────────── */
.kpi-strip {
  display: flex;
  gap: 1rem;
  padding: 0.85rem 0 0.25rem;
  flex-wrap: wrap;
}
.kpi-card {
  flex: 1;
  min-width: 140px;
  padding: 0.65rem 1rem;
  background: var(--primary-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.kpi-label {
  font-size: 0.75rem;
  color: var(--fg-muted);
  font-weight: 600;
  margin-bottom: 0.2rem;
  font-family: var(--font-body);
  letter-spacing: 0;
}

.kpi-value {
  font-family: var(--font-body);
  font-size: 1.9rem;
  font-weight: 800;
  color: var(--fg);
  line-height: 1.05;
  letter-spacing: -0.01em;
  font-stretch: normal;
  font-style: normal;
  font-synthesis: none;
  text-transform: none;
  word-break: break-word;
  overflow-wrap: anywhere;
}

.kpi-value--name {
  font-family: var(--font-body);
  font-size: 0.90rem;
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: 0;
  font-stretch: normal;
  font-style: normal;
  font-synthesis: none;
}

html[data-ui-scale="s"] .kpi-value { font-size: 1.6rem; }
html[data-ui-scale="m"] .kpi-value { font-size: 1.9rem; }
html[data-ui-scale="l"] .kpi-value { font-size: 2.15rem; }

html[data-ui-scale="s"] .kpi-value--name { font-size: 0.82rem; }
html[data-ui-scale="m"] .kpi-value--name { font-size: 0.90rem; }
html[data-ui-scale="l"] .kpi-value--name { font-size: 1.02rem; }

html[data-ui-scale="s"] .ctrl-select,
html[data-ui-scale="s"] .tab-btn,
html[data-ui-scale="s"] .data-table,
html[data-ui-scale="s"] .multi-check-item {
  font-size: 0.82rem;
}

html[data-ui-scale="l"] .ctrl-select,
html[data-ui-scale="l"] .tab-btn,
html[data-ui-scale="l"] .data-table,
html[data-ui-scale="l"] .multi-check-item {
  font-size: 0.96rem;
}

/* ── Tabs ────────────────────────────────────────────────────── */
.tabs-container { padding: 0; overflow: hidden; }
.tabs-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0;
  background: var(--bg-panel);
  border-bottom: 1px solid var(--border);
  padding: 0.5rem 0.75rem 0;
}
.tab-btn {
  padding: 0.5rem 1rem;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--fg-muted);
  font-family: var(--font-body);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  margin-bottom: -1px;
  border-radius: 8px 8px 0 0;
  transition: all 0.15s;
  white-space: nowrap;
}
.tab-btn:hover { color: var(--fg); background: var(--primary-soft); }
.tab-btn.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  background: var(--bg-card);
}
.tab-panel { padding: 1.5rem; }
.tab-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
}
.tab-header h2 {
  font-family: var(--font-heading);
  font-size: 1.20rem;
  font-weight: 700;
}
.tab-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding: 3rem;
  color: var(--fg-muted);
}
.spinner {
  width: 24px; height: 24px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Charts ──────────────────────────────────────────────────── */
.chart-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(400px, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.chart-card {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1rem;
}
.chart-card h3 { font-size: 0.9rem; font-weight: 700; margin-bottom: 0.75rem; color: var(--fg-muted); }
.chart-card--wide { grid-column: 1 / -1; }
.plotly-chart { width: 100%; min-height: 340px; }
.plotly-chart--tall { min-height: 460px; }

/* ── Tables ──────────────────────────────────────────────────── */
.table-section { margin-top: 0.5rem; }
.table-section h3 { font-size: 0.95rem; font-weight: 700; margin-bottom: 0.65rem; }
.data-table-wrapper {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}
.data-table thead th {
  background: var(--tbl-head);
  color: var(--fg);
  font-weight: 700;
  padding: 0.6rem 0.85rem;
  text-align: left;
  border-bottom: 1px solid var(--border-strong);
  font-family: var(--font-heading);
  font-size: 0.80rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.data-table thead th.num { text-align: right; }
.data-table tbody td {
  padding: 0.5rem 0.85rem;
  border-bottom: 1px solid var(--border);
  color: var(--fg);
}
.data-table tbody td.num { text-align: right; font-variant-numeric: tabular-nums; }
.data-table tbody tr:nth-child(even) { background: var(--tbl-even); }
.data-table tbody tr:hover { background: var(--primary-soft); }

/* ── Zone Badges ─────────────────────────────────────────────── */
.zones-legend { display: flex; gap: 0.75rem; flex-wrap: wrap; margin-bottom: 1rem; }
.zone-badge {
  font-size: 0.78rem;
  padding: 0.3rem 0.7rem;
  border-radius: 999px;
  font-weight: 600;
}
.zone-badge--fortress { background: rgba(34,197,94,0.15); color: #15803d; }
.zone-badge--base { background: rgba(59,130,246,0.15); color: #1d4ed8; }
.zone-badge--hard { background: rgba(249,115,22,0.15); color: #c2410c; }
.zone-badge--growth { background: rgba(239,68,68,0.15); color: #b91c1c; }

/* ── Profile KPIs ────────────────────────────────────────────── */
.profile-kpis { display: flex; gap: 0.75rem; flex-wrap: wrap; margin-bottom: 1.5rem; }
.profile-kpi {
  flex: 1; min-width: 140px;
  text-align: center;
  padding: 1rem;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.profile-kpi-icon { font-size: 1.5rem; margin-bottom: 0.3rem; }
.profile-kpi-label { font-size: 0.75rem; color: var(--fg-muted); font-weight: 600; margin-bottom: 0.25rem; }
.profile-kpi-value {
  font-family: var(--font-body);
  font-size: 1.35rem;
  font-weight: 800;
  line-height: 1.1;
}

/* ── Auth (Login) ────────────────────────────────────────────── */
.auth-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  background: var(--bg);
}
.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2.5rem;
  box-shadow: var(--shadow-lg);
}
.auth-title {
  font-family: var(--font-heading);
  font-size: 1.5rem;
  font-weight: 800;
  margin-bottom: 0.35rem;
}
.auth-subtitle { color: var(--fg-muted); font-size: 0.9rem; margin-bottom: 1.75rem; }
.form-group { margin-bottom: 1.1rem; }
.form-label { display: block; font-size: 0.82rem; font-weight: 600; margin-bottom: 0.35rem; color: var(--fg-muted); }
.form-input {
  width: 100%;
  padding: 0.6rem 0.85rem;
  background: var(--input-bg);
  color: var(--fg);
  border: 1px solid var(--input-border);
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 0.95rem;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.form-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}
.btn-primary {
  width: 100%;
  padding: 0.7rem 1.5rem;
  background: var(--btn-bg);
  color: var(--btn-fg, #fff);
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--font-heading);
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  letter-spacing: 0.02em;
  transition: filter 0.15s, transform 0.1s;
  margin-top: 0.5rem;
}
.btn-primary:hover { filter: brightness(1.1); }
.btn-primary:active { transform: scale(0.98); }
.form-error { color: #dc2626; font-size: 0.82rem; margin-top: 0.35rem; }
.auth-footer { margin-top: 1.25rem; font-size: 0.80rem; color: var(--fg-muted); text-align: center; }

/* ── Input sm ────────────────────────────────────────────────── */
.input-sm {
  width: 70px;
  padding: 0.3rem 0.5rem;
  background: var(--input-bg);
  color: var(--fg);
  border: 1px solid var(--input-border);
  border-radius: 6px;
  font-size: 0.875rem;
  text-align: center;
}

/* ── Messages ────────────────────────────────────────────────── */
.messages-container { max-width: 1400px; margin: 0.75rem auto; padding: 0 1.5rem; }
.message {
  padding: 0.65rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  margin-bottom: 0.5rem;
}
.message--error { background: rgba(220,38,38,0.12); border: 1px solid rgba(220,38,38,0.30); color: #dc2626; }
.message--success { background: rgba(22,163,74,0.12); border: 1px solid rgba(22,163,74,0.30); color: #16a34a; }
.message--warning { background: rgba(234,179,8,0.12); border: 1px solid rgba(234,179,8,0.30); color: #a16207; }

/* ── Footer ──────────────────────────────────────────────────── */
.elint-footer {
  text-align: center;
  padding: 1.5rem;
  font-size: 0.78rem;
  color: var(--fg-muted);
  border-top: 1px solid var(--border);
}
.footer-sep { margin: 0 0.5rem; }

/* ── Responsive ──────────────────────────────────────────────── */
@media (max-width: 768px) {
  .elint-header { padding: 0.65rem 1rem; flex-wrap: wrap; }
  .header-tagline { display: none; }
  .main-content { padding: 1rem; }
  .controls-inner { gap: 0.65rem; }
  .ctrl-group { min-width: 150px; }
  .kpi-value { font-size: 1.45rem; }
  .kpi-value--name { font-size: 0.95rem; }
  .chart-grid { grid-template-columns: 1fr; }
  .tabs-nav { overflow-x: auto; flex-wrap: nowrap; }
}

[x-cloak] { display: none !important; }

/* ── User Management ─────────────────────────────────────────── */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
  gap: .6rem;
}
.page-header h1 {
  font-family: var(--font-heading);
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1.3;
  word-break: break-word;
  overflow-wrap: break-word;
  max-width: 65%;
}
@media (max-width: 768px) {
  .page-header h1 { font-size: 1.1rem; max-width: 100%; }
  .page-header { flex-direction: column; align-items: flex-start; }
}
.btn-back {
  font-size: .85rem;
  padding: .4rem .9rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  text-decoration: none;
  color: var(--fg-muted);
  transition: background .15s;
}
.btn-back:hover { background: var(--primary-soft); color: var(--fg); }

.badge {
  display: inline-block;
  font-size: .72rem;
  font-weight: 700;
  padding: .15rem .55rem;
  border-radius: 999px;
  letter-spacing: .03em;
}
.badge--admin   { background: rgba(124,58,237,.15); color: #7c3aed; }
.badge--user    { background: rgba(31,111,235,.12); color: #1d4ed8; }
.badge--demo    { background: rgba(255,140,0,.15);  color: #b45309; }
.badge--active  { background: rgba(34,197,94,.15);  color: #15803d; }
.badge--inactive{ background: rgba(148,163,184,.18);color: #64748b; }
.badge--you     { background: rgba(168,85,247,.12); color: #7c3aed; }

.btn-action {
  display: inline-block;
  font-size: .78rem;
  font-weight: 600;
  padding: .2rem .55rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  cursor: pointer;
  background: transparent;
  text-decoration: none;
  color: var(--fg);
  transition: background .12s;
  margin-right: .2rem;
}
.btn-action:hover { background: var(--primary-soft); }
.btn-action--edit:hover  { background: rgba(31,111,235,.12); }
.btn-action--delete { border-color: rgba(220,38,38,.3); color: #dc2626; }
.btn-action--delete:hover { background: rgba(220,38,38,.1); }
.btn-action--toggle { font-size: .75rem; }

/* ── Multi-check list ────────────────────────────────────────── */
.multi-check-list { border: 1px solid var(--border); border-radius: 8px; padding: .35rem; background: var(--input-bg); }
.multi-check-item {
  display: flex;
  align-items: center;
  gap: .45rem;
  padding: .3rem .5rem;
  font-size: .85rem;
  cursor: pointer;
  border-radius: 6px;
  transition: background .1s;
}
.multi-check-item:hover { background: var(--primary-soft); }
.multi-check-item input[type="checkbox"] { accent-color: var(--primary); width: 14px; height: 14px; }


.compare-table .data-table thead th {
  font-family: var(--font-body);
  font-weight: 700;
  letter-spacing: 0.01em;
}

.matrix-tab .data-table thead th.num,
.matrix-tab .data-table tbody td.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.matrix-tab .data-table thead th:first-child,
.matrix-tab .data-table tbody td:first-child {
  text-align: left;
}

.matrix-tab .data-table {
  table-layout: fixed;
  width: 100%;
}

.matrix-tab .data-table th,
.matrix-tab .data-table td {
  vertical-align: middle;
}


.input-error {
  border: 2px solid #d00;
  background-color: #fff0f0;
}


/* ================================================================
   ELINT DESIGN SYSTEM - COMBINED CSS
================================================================ */

/* ── Base Fonts & Reset ───────────────────────────────────────── */
:root {
  --font-heading: 'Syne', sans-serif;
  --font-body: 'DM Sans', sans-serif;
  --radius: 12px;
  --btn-fg: #fff;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; -webkit-font-smoothing: antialiased; }
body {
  font-family: var(--font-body);
  background: var(--bg, #fff);
  color: var(--fg, #111827);
  min-height: 100vh;
  line-height: 1.55;
}

/* ── Themes ──────────────────────────────────────────────────── */
:root {
  /* Sunset (default) */
  --bg: #fff6ef; --bg-card: #fff; --bg-panel: rgba(255,255,255,0.94);
  --fg: #111827; --fg-muted: rgba(17,24,39,0.65);
  --primary: #e07000; --primary-soft: rgba(224,112,0,0.12);
  --accent: #7c3aed;
  --border: rgba(31,41,55,0.12); --border-strong: rgba(31,41,55,0.22);
  --shadow: 0 4px 24px rgba(0,0,0,0.08); --shadow-lg: 0 12px 48px rgba(0,0,0,0.12);
  --header-bg: linear-gradient(105deg,#04091a 0%,#0d1e50 42%,#1a4db5 78%,#1F6FEB 100%);
  --btn-bg: #e07000;
}

[data-theme="dark"] {
  --bg: #060816; --bg-card: rgba(15,23,42,0.62); --bg-panel: rgba(15,23,42,0.80);
  --fg: #e5e7eb; --fg-muted: rgba(229,231,235,0.65);
  --primary: #1F6FEB; --primary-soft: rgba(31,111,235,0.16);
  --border: rgba(148,163,184,0.15); --border-strong: rgba(148,163,184,0.28);
  --btn-bg: #1F6FEB;
}

[data-theme="white"] {
  --bg: #f6f8fc; --primary: #1F6FEB; --primary-soft: rgba(31,111,235,0.10);
  --btn-bg: #1F6FEB;
}

[data-theme="aurora"] {
  --bg: #030413; --bg-card: rgba(7,12,28,0.72);
  --fg: #e6f0ff; --fg-muted: rgba(230,240,255,0.65);
  --primary: #3B82F6; --primary-soft: rgba(59,130,246,0.18);
  --border: rgba(59,130,246,0.22); --btn-bg: #3B82F6;
  --bg-panel: rgba(6,10,24,0.90);
}

/* ── Editions ────────────────────────────────────────────────── */
html[data-edition="friendly"] {
  --bg: #fff6ef; --bg-card: #fff; --fg: #111827; --fg-muted: rgba(17,24,39,0.65);
  --primary: #e07000; --primary-soft: rgba(224,112,0,0.12);
  --border: rgba(31,41,55,0.12); --border-strong: rgba(31,41,55,0.22);
  --btn-bg: #e07000; --radius: 12px;
}

html[data-edition="professional"] {
  --bg: #f6f8fc; --bg-card: #fff; --fg: #111827; --fg-muted: rgba(17,24,39,0.65);
  --primary: #1F6FEB; --primary-soft: rgba(31,111,235,0.12);
  --border: rgba(31,41,55,0.12); --border-strong: rgba(31,41,55,0.22);
  --btn-bg: #1F6FEB; --radius: 16px;
}

html[data-edition="enterprise"] {
  --bg: #060816; --bg-card: rgba(15,23,42,0.62); --bg-panel: rgba(15,23,42,0.80);
  --fg: #e5e7eb; --fg-muted: rgba(229,231,235,0.65);
  --primary: #1F6FEB; --primary-soft: rgba(31,111,235,0.16);
  --border: rgba(148,163,184,0.15); --border-strong: rgba(148,163,184,0.28);
  --radius: 16px; --btn-bg: #1F6FEB;
  --header-bg: linear-gradient(105deg,#04091a 0%,#0d1e50 42%,#1a4db5 78%,#1F6FEB 100%);
}

/* ── UI Scaling ──────────────────────────────────────────────── */
html[data-ui-scale="s"] { font-size: 14px; }
html[data-ui-scale="m"] { font-size: 15px; }
html[data-ui-scale="l"] { font-size: 16.5px; }

/* ── Common Components ───────────────────────────────────────── */
.elint-header { display:flex; align-items:center; gap:1.5rem; padding:.75rem 2rem;
  background: var(--header-bg); color:#fff; position:sticky; top:0; z-index:100;
  box-shadow: var(--shadow);
}
.card { background: var(--bg-card); border:1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding:1.25rem 1.5rem; margin-bottom:1rem;
}
.btn-primary { padding:.7rem 1.5rem; background: var(--btn-bg); color: var(--btn-fg);
  border-radius: var(--radius); font-family: var(--font-heading); font-weight:700;
  cursor:pointer; transition: filter .15s, transform .1s;
}
.btn-primary:hover { filter: brightness(1.1); }
.btn-primary:active { transform: scale(0.98); }

/* ── Responsive Media Queries ───────────────────────────────── */
@media (max-width: 1024px) { html { font-size: 14px; } }
@media (max-width: 768px) {
  .elint-header { padding: .65rem 1rem; flex-wrap: wrap; }
  .main-content { padding: 1rem; }
  .chart-grid { grid-template-columns: 1fr; }
  .tabs-nav { overflow-x:auto; flex-wrap:nowrap; }
}

/* ── Helpers & Cloak ────────────────────────────────────────── */
[x-cloak] { display: none !important; }
/* ══════════════════════════════════════════════════════════════
   UI/UX POLISH v3 — Smooth transitions, mobile improvements
   ══════════════════════════════════════════════════════════════ */

/* ── Global smooth transitions ─────────────────────────────── */
*, *::before, *::after {
  transition-property: background-color, border-color, color, opacity, box-shadow, transform;
  transition-duration: 0.15s;
  transition-timing-function: ease;
}
/* Exclude elements that shouldn't animate */
input, textarea, select, [x-cloak],
.chart-container *, canvas, svg * {
  transition: none !important;
}

/* ── Page fade-in ───────────────────────────────────────────── */
@keyframes pageFadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}
.main-content {
  animation: pageFadeIn 0.25s ease-out both;
}

/* ── Card hover lift ────────────────────────────────────────── */
.card:hover {
  box-shadow: 0 4px 20px rgba(0,0,0,.12);
  transform: translateY(-1px);
}

/* ── Button active feedback ─────────────────────────────────── */
button:active, .btn:active, .btn-primary:active {
  transform: scale(0.97) !important;
}

/* ── Focus ring (accessibility) ─────────────────────────────── */
:focus-visible {
  outline: 2px solid #e86833;
  outline-offset: 2px;
  border-radius: 4px;
}

/* ── Table row hover ────────────────────────────────────────── */
tr:hover td { background: rgba(232,104,51,.04) !important; }

/* ── Scrollbar styling ──────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(148,163,184,.35); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(148,163,184,.6); }

/* ── Loading skeleton animation ─────────────────────────────── */
@keyframes shimmer {
  0%   { background-position: -400px 0; }
  100% { background-position: 400px 0; }
}
.skeleton {
  background: linear-gradient(90deg, #f1f5f9 25%, #e2e8f0 50%, #f1f5f9 75%);
  background-size: 400px 100%;
  animation: shimmer 1.4s ease infinite;
  border-radius: 6px;
  color: transparent;
  pointer-events: none;
  user-select: none;
}

/* ── Badge pulse (notifications) ───────────────────────────── */
@keyframes badgePulse {
  0%, 100% { transform: scale(1); }
  50%       { transform: scale(1.2); }
}
.badge-pulse { animation: badgePulse 2s ease infinite; }

/* ── Modal/drawer entrance ──────────────────────────────────── */
@keyframes modalSlideUp {
  from { opacity: 0; transform: translateY(24px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.modal-box, [role="dialog"] {
  animation: modalSlideUp 0.22s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

/* ── Tab active indicator ───────────────────────────────────── */
.nav-tab.active, .sub-tab.active {
  position: relative;
}
.sub-tab.active::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  right: 0;
  height: 2px;
  background: #e86833;
  border-radius: 2px 2px 0 0;
}

/* ── Mobile: larger tap targets ─────────────────────────────── */
@media (max-width: 768px) {
  .btn, button.btn, .pay-btn, .pc-btn {
    min-height: 44px;
    padding-top: .6rem;
    padding-bottom: .6rem;
  }
  .sub-tab { min-height: 40px; }
  .mod-card { padding: 1rem; }
  table { font-size: .82rem; }
  th, td { padding: .5rem .6rem; }
}

/* ── Print improvements ─────────────────────────────────────── */
@media print {
  .main-nav, #pwa-install, #pwa-ios-hint,
  .pay-row, .cart-section { display: none !important; }
  body { background: white !important; color: black !important; }
  .card { box-shadow: none; border: 1px solid #ccc; }
}

/* ── Toast notification (utility class) ─────────────────────── */
.toast {
  position: fixed; bottom: 1.5rem; right: 1.5rem; z-index: 10000;
  background: #1e293b; color: #fff; border-radius: 12px;
  padding: .75rem 1.2rem; font-size: .88rem; font-weight: 600;
  box-shadow: 0 4px 20px rgba(0,0,0,.3);
  border-left: 4px solid #e86833;
  animation: pageFadeIn .25s ease-out;
  max-width: 320px;
}
.toast.success { border-left-color: #16a34a; }
.toast.error   { border-left-color: #dc2626; }
