/* WarmupSuite theme — "Polished Enterprise" (slate neutrals + cyan primary), ported from VisaFlow. */
/* Self-hosted Inter (no CDN dependency — works on air-gapped servers). */
@font-face {
  font-family: 'Inter Variable';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('fonts/inter-latin-wght-normal.woff2') format('woff2');
}

:root {
  --background: #f8fafc; --foreground: #0f172a;
  --card: #ffffff; --card-foreground: #0f172a;
  --muted: #f1f5f9; --muted-foreground: #64748b;
  --border: #e2e8f0; --input: #cbd5e1; --ring: #06b6d4;
  --primary: #0e7490; --primary-foreground: #ffffff; --primary-hover: #155e75;  /* cyan-700: white text = ~5.4:1 (AA) */
  --accent: #ecfeff; --accent-foreground: #0e7490;
  --success-subtle: #ecfdf5; --success-fg: #047857;
  --warning-subtle: #fffbeb; --warning-fg: #b45309;
  --danger-subtle: #fef2f2; --danger-fg: #b91c1c;
  --info-subtle: #eff6ff; --info-fg: #1d4ed8;
  --sidebar: #0b1120; --sidebar-foreground: #cbd5e1; --sidebar-muted: #94a3b8;  /* slate-400: ~7:1 on dark sidebar */
  --sidebar-hover: rgba(148,163,184,.10); --sidebar-active-bg: rgba(6,182,212,.14);
  --sidebar-active-foreground: #67e8f9; --sidebar-border: #1e293b;
  --radius: .625rem;
  --shadow-card: 0 1px 2px 0 rgb(15 23 42 / .04), 0 1px 3px 0 rgb(15 23 42 / .06);
}
html.dark {
  --background: #0b1120; --foreground: #e2e8f0;
  --card: #0f172a; --card-foreground: #e2e8f0;
  --muted: #1e293b; --muted-foreground: #94a3b8;
  --border: #1e293b; --input: #334155; --ring: #22d3ee;
  --primary: #06b6d4; --primary-foreground: #06202a; --primary-hover: #0891b2;
  --accent: #083344; --accent-foreground: #67e8f9;
  --success-subtle: #052e22; --success-fg: #6ee7b7;
  --warning-subtle: #3a2a07; --warning-fg: #fcd34d;
  --danger-subtle: #3f1414; --danger-fg: #fca5a5;
  --info-subtle: #0c1f3f; --info-fg: #93c5fd;
  --sidebar: #070b14; --shadow-card: 0 1px 2px 0 rgb(0 0 0 / .3), 0 1px 3px 0 rgb(0 0 0 / .4);
}

html { color-scheme: light; }
html.dark { color-scheme: dark; }   /* native controls (date picker, etc.) follow the theme */
html, body {
  font-family: 'Inter Variable', 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  background: var(--background); color: var(--foreground);
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}

/* ─── App shell ─── */
.ws-shell { display: flex; min-height: 100vh; }
.ws-sidebar {
  width: 244px; flex-shrink: 0; background: var(--sidebar);
  border-right: 1px solid var(--sidebar-border); height: 100vh;
  position: sticky; top: 0; overflow-y: auto;
}
.ws-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.ws-topbar {
  position: sticky; top: 0; z-index: 10; height: 56px;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px; background: var(--card); border-bottom: 1px solid var(--border);
}
.ws-topbar-title { font-size: .98rem; font-weight: 600; color: var(--foreground); }
.ws-topbar-actions { display: flex; align-items: center; gap: 14px; }
.ws-topbar-link { font-size: .82rem; color: var(--muted-foreground); text-decoration: none; white-space: nowrap; }
.ws-topbar-link:hover { color: var(--foreground); text-decoration: underline; }
.ws-icon-btn { background: none; border: none; cursor: pointer; color: var(--muted-foreground); font-size: 1.05rem; display: flex; padding: 4px; }
.ws-icon-btn:hover { color: var(--foreground); }
.ws-user { display: flex; align-items: center; gap: 8px; font-size: .82rem; color: var(--muted-foreground); }
.ws-avatar { width: 28px; height: 28px; border-radius: 50%; background: var(--accent); color: var(--accent-foreground); display: flex; align-items: center; justify-content: center; font-size: .72rem; font-weight: 600; }
.ws-chip { background: var(--accent); color: var(--accent-foreground); font-size: .66rem; font-weight: 600; padding: 1px 7px; border-radius: 9999px; margin-left: 4px; }
.ws-content { flex: 1; padding: 24px; background: var(--background); }

/* ─── Sidebar brand + nav ─── */
.ws-brand { display: flex; align-items: center; gap: 10px; padding: 16px 16px 12px; }
.ws-brand-badge { width: 34px; height: 34px; border-radius: 8px; background: linear-gradient(135deg, #22d3ee, #0891b2); color: #06202a; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 15px; flex-shrink: 0; }
.ws-brand-name { font-size: .9rem; font-weight: 700; color: #fff; line-height: 1.1; }
.ws-brand-tag { font-size: .7rem; color: var(--sidebar-muted); }
.ws-nav { padding: 4px 10px 16px; }
.ws-nav-group { padding: 14px 10px 5px; font-size: .62rem; font-weight: 600; letter-spacing: .07em; text-transform: uppercase; color: var(--sidebar-muted); }
.ws-sidebar .nav-link {
  display: flex !important; flex-direction: row; align-items: center; gap: 10px;
  padding: 8px 10px; margin-bottom: 2px; white-space: nowrap;
  border-radius: 7px; font-size: .85rem; color: var(--sidebar-foreground); text-decoration: none; transition: background-color .12s, color .12s;
}
.ws-sidebar .nav-link:hover { background: var(--sidebar-hover); color: #fff; }
.ws-sidebar .nav-link.active { background: var(--sidebar-active-bg); color: var(--sidebar-active-foreground); font-weight: 500; }
.ws-sidebar .nav-link > i, .ws-sidebar .nav-link .bi {
  font-size: 1.05rem; line-height: 1; flex-shrink: 0; width: 1.05rem;
  display: inline-flex; align-items: center; justify-content: center;
}

/* ─── Bootstrap surface mapping to tokens ─── */
a, .btn-link { color: var(--primary); }
a:hover { color: var(--primary-hover); }
.btn-primary { background-color: var(--primary); border-color: var(--primary); color: var(--primary-foreground); }
.btn-primary:hover, .btn-primary:focus { background-color: var(--primary-hover); border-color: var(--primary-hover); }
.btn:focus, .form-control:focus, .form-select:focus { box-shadow: 0 0 0 .2rem rgb(8 145 178 / .25); border-color: var(--ring); }
.card { background: var(--card); color: var(--card-foreground); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-card); }
.card-header, .card-footer { background: transparent; border-color: var(--border); font-weight: 500; }
.text-muted { color: var(--muted-foreground) !important; }
.border, .border-top, .border-bottom, .border-start, .border-end { border-color: var(--border) !important; }
h1, h2, h3, h4, h5 { color: var(--foreground); }

/* Dark-mode Bootstrap adjustments (light mode inherits Bootstrap defaults + tokens above) */
html.dark .table { --bs-table-color: var(--foreground); --bs-table-bg: transparent; --bs-table-border-color: var(--border); color: var(--foreground); }
html.dark .table > :not(caption) > * > * { background: transparent; color: var(--foreground); border-color: var(--border); }
html.dark .table-active, html.dark .table-active > * { background: var(--muted) !important; color: var(--foreground); }
html.dark .form-control, html.dark .form-select, html.dark .input-group-text { background: var(--card); color: var(--foreground); border-color: var(--input); }
html.dark .form-control::placeholder { color: var(--muted-foreground); }
html.dark .list-group-item { background: var(--card); color: var(--foreground); border-color: var(--border); }
html.dark .btn-outline-secondary { color: var(--foreground); border-color: var(--input); }
html.dark .btn-outline-secondary:hover { background: var(--muted); color: #fff; }
html.dark .alert-secondary { background: var(--muted); color: var(--foreground); border-color: var(--border); }
html.dark .dropdown-menu, html.dark .modal-content { background: var(--card); color: var(--foreground); border-color: var(--border); }

/* ─── Phase 2: component styling ─── */
.ws-content h1 { font-size: 1.5rem; font-weight: 600; }
.ws-content h2 { font-size: 1.25rem; font-weight: 600; }

/* Hero banner (dashboards) */
.ws-hero {
  border-radius: var(--radius); padding: 20px 22px; margin-bottom: 1.25rem; color: #fff;
  background: radial-gradient(700px 240px at 90% -40%, rgba(6,182,212,.20), transparent 60%),
              linear-gradient(120deg, #0b1220, #0e1b2e 60%, #0a1622);
}
.ws-hero h1 { color: #fff; font-size: 1.35rem; margin: 0 0 4px; }
.ws-hero p { margin: 0; color: #94a3b8; font-size: .85rem; }

/* Metric cards */
.ws-metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 1.25rem; }
.ws-metric { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow-card); }
.ws-metric-label { font-size: .78rem; color: var(--muted-foreground); }
.ws-metric-value { font-size: 1.6rem; font-weight: 600; color: var(--foreground); margin-top: 3px; }
.ws-metric-value.accent { color: var(--primary); }

/* Buttons + cards */
.btn { border-radius: 7px; font-weight: 500; }
.btn-sm { border-radius: 6px; }
.card-header { font-size: .9rem; }

/* Status badges → subtle token variants */
.badge.bg-success   { background: var(--success-subtle) !important; color: var(--success-fg) !important; font-weight: 500; }
.badge.bg-warning   { background: var(--warning-subtle) !important; color: var(--warning-fg) !important; font-weight: 500; }
.badge.bg-danger    { background: var(--danger-subtle)  !important; color: var(--danger-fg)  !important; font-weight: 500; }
.badge.bg-info      { background: var(--info-subtle)    !important; color: var(--info-fg)    !important; font-weight: 500; }
.badge.bg-primary   { background: var(--accent)         !important; color: var(--accent-foreground) !important; font-weight: 500; }
.badge.bg-secondary { background: var(--muted)          !important; color: var(--muted-foreground)  !important; font-weight: 500; }

/* Tables */
.table > thead th { font-weight: 500; font-size: .76rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted-foreground); border-color: var(--border); }
.table > tbody td, .table > tbody th { border-color: var(--border); vertical-align: middle; }
.table-hover > tbody > tr:hover > * { background: var(--muted); }

/* Alerts → token-tinted */
.alert { border-radius: var(--radius); border: 1px solid transparent; }
.alert-success   { background: var(--success-subtle); color: var(--success-fg); }
.alert-warning   { background: var(--warning-subtle); color: var(--warning-fg); }
.alert-danger    { background: var(--danger-subtle);  color: var(--danger-fg); }
.alert-info      { background: var(--info-subtle);    color: var(--info-fg); }
.alert-secondary { background: var(--muted);          color: var(--foreground); }

/* ─── Phase 3: polish (motion, scrollbars, empty states) ─── */
@keyframes ws-fade-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.ws-content { animation: ws-fade-in .16s ease-out both; }
@media (prefers-reduced-motion: reduce) { .ws-content { animation: none; } }

* { scrollbar-color: var(--input) transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb { background: var(--input); border-radius: 9999px; border: 2px solid transparent; background-clip: content-box; }
*::-webkit-scrollbar-thumb:hover { background: var(--muted-foreground); background-clip: content-box; }

.ws-empty { text-align: center; padding: 2.25rem 1rem; color: var(--muted-foreground); }
.ws-empty .bi { font-size: 1.9rem; display: block; margin-bottom: .5rem; opacity: .55; }

/* ─── Responsive: stack the sidebar above content on narrow screens ─── */
@media (max-width: 640.98px) {
  .ws-shell { flex-direction: column; }
  .ws-sidebar { width: 100%; height: auto; position: static; }
  .ws-nav { display: flex; flex-wrap: wrap; gap: 4px; }
  .ws-nav-group { width: 100%; }
}
