/* ============================================================
   SIMPLIAXIS SA EXECUTIVE DASHBOARD — STYLES
   Design tokens
   Ink Navy #0F1230 / Deep Indigo #1B1F3B / Teal #00C2A8 (accent)
   Warm Coral #FF7A59 (secondary) / Off-white #F7F8FC
   Display font: Sora — Body/data font: Inter
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Sora:wght@400;600;700;800&family=Inter:wght@400;500;600;700&display=swap');

:root {
  --accent: #00C2A8;
  --accent-2: #FF7A59;
  --radius: 16px;
  --radius-sm: 10px;
  --font-display: 'Sora', sans-serif;
  --font-body: 'Inter', sans-serif;
}

[data-theme="dark"] {
  --bg: #0B0D22;
  --bg-elev: #121538;
  --card: #161A40;
  --card-2: #1B1F3B;
  --border: rgba(255,255,255,0.08);
  --grid: rgba(148,163,184,0.12);
  --text: #F1F3FB;
  --text-muted: #96A0C2;
  --sidebar-bg: #0D0F26;
  --glass: rgba(22,26,64,0.6);
}

[data-theme="light"] {
  --bg: #F5F6FB;
  --bg-elev: #FFFFFF;
  --card: #FFFFFF;
  --card-2: #FBFBFF;
  --border: rgba(15,18,48,0.08);
  --grid: rgba(15,18,48,0.08);
  --text: #171A34;
  --text-muted: #6B7290;
  --sidebar-bg: #12153A;
  --glass: rgba(255,255,255,0.65);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { font-family: var(--font-display); margin: 0; }
button { font-family: var(--font-body); cursor: pointer; }
input, select { font-family: var(--font-body); }
::selection { background: var(--accent); color: #fff; }

/* ---------------- LAYOUT ---------------- */
.app-shell { display: flex; min-height: 100vh; }

/* ---------------- SIDEBAR ---------------- */
.sidebar {
  width: 264px;
  background: var(--sidebar-bg);
  color: #E7EAFB;
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
  transition: width .25s ease;
  z-index: 40;
  border-right: 1px solid rgba(255,255,255,0.06);
}
.sidebar.collapsed { width: 82px; }
.sidebar.collapsed .brand-text, .sidebar.collapsed .nav-item span { display: none; }
.sidebar-brand {
  display: flex; align-items: center; gap: 12px;
  padding: 22px 20px; border-bottom: 1px solid rgba(255,255,255,0.06);
}
.brand-mark {
  width: 38px; height: 38px; border-radius: 10px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-weight: 800; color: #0B0D22; flex-shrink: 0;
}
.brand-text { line-height: 1.15; }
.brand-text b { display: block; font-family: var(--font-display); font-size: 15px; }
.brand-text small { color: #8791BE; font-size: 11px; }

.sidebar-nav { flex: 1; overflow-y: auto; padding: 14px 12px; display: flex; flex-direction: column; gap: 3px; }
.nav-item {
  display: flex; align-items: center; gap: 12px;
  background: transparent; border: none; color: #A9B0D8;
  padding: 11px 12px; border-radius: var(--radius-sm); font-size: 13.5px; font-weight: 500;
  text-align: left; transition: background .15s, color .15s;
}
.nav-item i { width: 18px; text-align: center; color: #7B84B5; transition: color .15s; }
.nav-item:hover { background: rgba(255,255,255,0.06); color: #fff; }
.nav-item.active { background: linear-gradient(90deg, rgba(0,194,168,0.18), transparent); color: #fff; }
.nav-item.active i { color: var(--accent); }

.sidebar-toggle-wrap { padding: 12px; border-top: 1px solid rgba(255,255,255,0.06); }
#sidebarToggle { width: 100%; background: rgba(255,255,255,0.05); border: none; color: #A9B0D8; padding: 10px; border-radius: var(--radius-sm); }
#sidebarMobileToggle { display: none; }

/* ---------------- MAIN ---------------- */
.main-wrap { flex: 1; display: flex; flex-direction: column; min-width: 0; }

/* HEADER */
.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; padding: 12px 22px;
  background: var(--glass); backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}
.topbar-left { display: flex; align-items: center; gap: 14px; min-width: 0; }
.topbar-left h2#pageTitle { font-size: 18px; white-space: nowrap; }
.status-pill { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-muted); background: var(--card); padding: 5px 10px; border-radius: 20px; border: 1px solid var(--border); }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: #94A3B8; }
.status-dot.live { background: #3FD98E; box-shadow: 0 0 8px #3FD98E; }
.status-dot.demo { background: #FFC24B; }
.status-dot.partial { background: var(--accent-2); }

.topbar-mid { display: flex; align-items: center; gap: 18px; flex: 1; justify-content: center; }
.clock-block { text-align: center; font-size: 12px; color: var(--text-muted); }
.clock-block b { display: block; font-family: var(--font-display); font-size: 15px; color: var(--text); }
.search-box { display: flex; align-items: center; gap: 8px; background: var(--card); border: 1px solid var(--border); border-radius: 20px; padding: 7px 14px; width: 260px; max-width: 32vw; }
.search-box input { border: none; background: transparent; outline: none; color: var(--text); font-size: 13px; width: 100%; }
.search-box i { color: var(--text-muted); }

.topbar-right { display: flex; align-items: center; gap: 8px; position: relative; }
.icon-btn {
  width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--card); color: var(--text); display: flex; align-items: center; justify-content: center;
  font-size: 14px; position: relative; transition: background .15s, transform .1s;
}
.icon-btn:hover { background: var(--card-2); }
.icon-btn:active { transform: scale(.94); }
.icon-btn .dot-badge { position: absolute; top: 6px; right: 6px; width: 7px; height: 7px; border-radius: 50%; background: var(--accent-2); }
.avatar { width: 38px; height: 38px; border-radius: 10px; background: linear-gradient(135deg, var(--accent), #6C7BFF); display: flex; align-items: center; justify-content: center; color: #08101f; font-weight: 700; font-family: var(--font-display); }

.dropdown-panel {
  position: absolute; top: 48px; right: 0; width: 300px; background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius-sm); box-shadow: 0 20px 40px rgba(0,0,0,0.25); display: none; flex-direction: column;
  padding: 10px; z-index: 50;
}
.dropdown-panel.open { display: flex; }
.dropdown-panel h4 { font-size: 13px; padding: 6px 8px 10px; color: var(--text-muted); }
.dropdown-panel button { display: flex; align-items: center; gap: 10px; background: transparent; border: none; color: var(--text); padding: 9px 8px; border-radius: 8px; font-size: 13px; text-align: left; }
.dropdown-panel button:hover { background: var(--card-2); }
.notif-item { display: flex; gap: 10px; padding: 9px 8px; border-radius: 8px; font-size: 12.5px; color: var(--text-muted); }
.notif-item i { color: var(--accent); margin-top: 2px; }
.notif-item b { color: var(--text); display: block; font-size: 12.5px; }

/* CONTENT */
.content-scroll { padding: 20px 24px 60px; flex: 1; }

/* ---------------- FILTER / TAB BARS ---------------- */
.filter-bar { display: flex; flex-wrap: wrap; align-items: end; gap: 14px; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 18px; margin-bottom: 18px; }
.filter-group { display: flex; flex-direction: column; gap: 5px; }
.filter-group label { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .04em; }
.filter-group select { background: var(--card-2); border: 1px solid var(--border); color: var(--text); padding: 8px 12px; border-radius: 8px; font-size: 13px; min-width: 150px; }
.btn-reset { background: transparent; border: 1px solid var(--border); color: var(--text-muted); padding: 8px 14px; border-radius: 8px; font-size: 13px; display: flex; gap: 6px; align-items: center; }
.btn-reset:hover { color: var(--text); border-color: var(--accent); }
.filter-checkbox { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--text); cursor: pointer; user-select: none; }
.filter-checkbox input { width: 16px; height: 16px; accent-color: var(--accent); cursor: pointer; }
.btn-primary { background: var(--accent); border: none; color: #06231d; font-weight: 700; padding: 10px 18px; border-radius: 8px; font-size: 13px; display: inline-flex; gap: 8px; align-items: center; margin-top: 10px; }

.tab-bar { display: flex; gap: 6px; margin-bottom: 18px; background: var(--card); border: 1px solid var(--border); padding: 6px; border-radius: 12px; width: fit-content; flex-wrap: wrap; }
.tab { background: transparent; border: none; color: var(--text-muted); padding: 8px 16px; border-radius: 8px; font-size: 13px; font-weight: 600; }
.tab.active { background: var(--accent); color: #06231d; }

/* ---------------- KPI CARDS ---------------- */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; margin-bottom: 20px; }
.kpi-grid.compact { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
.kpi-card {
  background: linear-gradient(160deg, var(--card), var(--card-2));
  border: 1px solid var(--border); border-radius: var(--radius); padding: 16px;
  position: relative; overflow: hidden; transition: transform .15s;
}
.kpi-card:hover { transform: translateY(-2px); }
.kpi-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.kpi-icon { width: 34px; height: 34px; border-radius: 10px; background: rgba(0,194,168,0.14); color: var(--accent); display: flex; align-items: center; justify-content: center; font-size: 14px; }
.kpi-trend { font-size: 11px; font-weight: 700; display: flex; align-items: center; gap: 4px; padding: 3px 7px; border-radius: 20px; }
.kpi-trend.up { color: #3FD98E; background: rgba(63,217,142,0.12); }
.kpi-trend.down { color: #FF5C7A; background: rgba(255,92,122,0.12); }
.kpi-trend.flat { color: var(--text-muted); background: rgba(148,163,184,0.12); }
.kpi-value { font-family: var(--font-display); font-size: 22px; font-weight: 700; margin-bottom: 2px; word-break: break-word; }
.kpi-label { font-size: 12px; color: var(--text-muted); }
.kpi-sub { font-size: 10px; color: var(--text-muted); margin-top: 3px; opacity: .7; }
.kpi-spark { height: 30px; margin-top: 8px; opacity: .8; }

/* ---------------- CHART GRID ---------------- */
.chart-grid { display: grid; grid-template-columns: repeat(12, 1fr); gap: 14px; margin-bottom: 20px; }
.chart-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; grid-column: span 12; }
.chart-card h3 { font-size: 13.5px; margin-bottom: 10px; color: var(--text); font-weight: 700; }
.chart-box { height: 240px; position: relative; }
.span-4 { grid-column: span 4; } .span-6 { grid-column: span 6; } .span-8 { grid-column: span 8; } .span-12 { grid-column: span 12; }
@media (max-width: 1200px) { .span-4, .span-6, .span-8 { grid-column: span 12; } }

/* ---------------- PANELS / TABLES ---------------- */
.panel { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; margin-bottom: 20px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.panel h3 { font-size: 14px; display: flex; align-items: center; gap: 8px; margin-bottom: 14px; }
.panel-head h3 { margin-bottom: 0; }

.table-wrap { overflow-x: auto; }
table.data-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
table.data-table th { text-align: left; color: var(--text-muted); font-weight: 600; padding: 10px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; text-transform: uppercase; font-size: 10.5px; letter-spacing: .03em; }
table.data-table td { padding: 10px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; }
table.data-table tbody tr:hover { background: var(--card-2); }
.table-footnote { text-align: center; color: var(--text-muted); font-size: 11.5px; padding: 10px; }

.badge { padding: 4px 10px; border-radius: 20px; font-size: 11px; font-weight: 700; }
.badge-success { background: rgba(63,217,142,0.14); color: #3FD98E; }
.badge-warn { background: rgba(255,194,75,0.14); color: #FFC24B; }
.badge-error { background: rgba(255,92,122,0.14); color: #FF5C7A; }
.badge-info { background: rgba(108,123,255,0.14); color: #7ADFFF; }
.badge-neutral { background: rgba(148,163,184,0.14); color: var(--text-muted); }

.empty-state { text-align: center; padding: 40px 0; color: var(--text-muted); }
.empty-state i { font-size: 28px; margin-bottom: 10px; }
.empty-panel { text-align: center; padding: 60px 20px; color: var(--text-muted); }
.empty-panel i { font-size: 34px; color: var(--accent); margin-bottom: 14px; }
.empty-panel h3 { font-size: 18px; color: var(--text); margin-bottom: 8px; }

/* ---------------- HEATMAP ---------------- */
.heatmap { display: flex; flex-direction: column; gap: 4px; font-size: 10.5px; }
.heatmap-row { display: grid; grid-template-columns: 90px repeat(8, 1fr); gap: 4px; align-items: center; }
.heatmap-head .heatmap-label { color: var(--text-muted); text-align: center; font-weight: 600; }
.heatmap-label { color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.heatmap-cell { text-align: center; padding: 7px 2px; border-radius: 6px; color: #fff; font-weight: 700; }

/* ---------------- CALENDAR ---------------- */
.calendar-nav { display: flex; align-items: center; gap: 12px; }
.calendar-nav button { background: var(--card-2); border: 1px solid var(--border); color: var(--text); width: 30px; height: 30px; border-radius: 8px; }
.calendar-nav span { font-weight: 700; font-family: var(--font-display); font-size: 13.5px; min-width: 130px; text-align: center; display: inline-block; }
.calendar-layout { display: grid; grid-template-columns: 1fr 280px; gap: 18px; }
@media (max-width: 900px) { .calendar-layout { grid-template-columns: 1fr; } }
.calendar-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.cal-dow { text-align: center; font-size: 11px; color: var(--text-muted); font-weight: 700; padding-bottom: 4px; }
.cal-cell { aspect-ratio: 1; border-radius: 8px; background: var(--card-2); display: flex; flex-direction: column; align-items: center; justify-content: center; font-size: 12px; position: relative; border: 1px solid transparent; }
.cal-cell.empty { background: transparent; }
.cal-cell.has-data { cursor: pointer; border-color: var(--border); }
.cal-cell.has-data:hover { border-color: var(--accent); }
.cal-dot { font-size: 9px; background: var(--accent); color: #06231d; border-radius: 20px; padding: 1px 6px; font-weight: 700; margin-top: 3px; }
.calendar-detail { background: var(--card-2); border-radius: var(--radius-sm); padding: 14px; font-size: 12.5px; }
.calendar-detail h4 { font-size: 13px; margin-bottom: 12px; }
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.detail-grid div { display: flex; flex-direction: column; gap: 3px; }
.detail-grid span { color: var(--text-muted); font-size: 10.5px; text-transform: uppercase; }
.detail-grid b { font-family: var(--font-display); font-size: 14px; }
.detail-compare div { display: flex; justify-content: space-between; padding: 6px 0; border-top: 1px solid var(--border); font-size: 11.5px; color: var(--text-muted); }
.detail-compare b.up { color: #3FD98E; } .detail-compare b.down { color: #FF5C7A; }
.muted { color: var(--text-muted); font-size: 12.5px; }

/* ---------------- SETTINGS ---------------- */
.settings-panel h3 { display: flex; align-items: center; gap: 8px; }
.settings-row { display: flex; align-items: center; justify-content: space-between; padding: 14px 0; border-bottom: 1px solid var(--border); flex-wrap: wrap; gap: 10px; }
.settings-row:last-child { border-bottom: none; }
.settings-row label { font-size: 13px; color: var(--text); font-weight: 600; }
.segmented { display: flex; background: var(--card-2); border-radius: 8px; padding: 3px; }
.segmented button { border: none; background: transparent; color: var(--text-muted); padding: 7px 16px; border-radius: 6px; font-size: 12.5px; }
.segmented button.active { background: var(--accent); color: #06231d; font-weight: 700; }
.accent-swatches { display: flex; gap: 8px; }
.swatch { width: 26px; height: 26px; border-radius: 50%; border: 2px solid transparent; }
.swatch.active { border-color: var(--text); }
.switch { position: relative; display: inline-block; width: 42px; height: 24px; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; background: var(--card-2); border: 1px solid var(--border); border-radius: 20px; transition: .2s; }
.switch span::before { content: ""; position: absolute; width: 18px; height: 18px; left: 2px; top: 2px; background: var(--text-muted); border-radius: 50%; transition: .2s; }
.switch input:checked + span { background: var(--accent); }
.switch input:checked + span::before { transform: translateX(18px); background: #06231d; }
.sheet-url-list { display: flex; flex-direction: column; gap: 8px; width: 100%; margin-top: 10px; }
.sheet-url-item { display: grid; grid-template-columns: 150px 1fr auto; align-items: center; gap: 10px; }
.sheet-url-item span:first-child { font-size: 12px; color: var(--text-muted); }
.sheet-url-item input { background: var(--card-2); border: 1px solid var(--border); color: var(--text); padding: 8px 10px; border-radius: 8px; font-size: 12px; }
.src-badge { font-size: 10px; font-weight: 700; padding: 3px 8px; border-radius: 20px; text-align: center; }
.src-badge.live { background: rgba(63,217,142,0.14); color: #3FD98E; }
.src-badge.mock { background: rgba(255,194,75,0.14); color: #FFC24B; }

/* ---------------- MARKETING: INSIGHT BANNER / RANKED BARS ---------------- */
.insight-banner {
  background: linear-gradient(120deg, rgba(0,194,168,0.14), rgba(108,123,255,0.10));
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px 18px; margin-bottom: 18px; font-size: 13px; line-height: 1.7; color: var(--text);
}
.insight-banner b { color: var(--text); }

.chart-card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; gap: 10px; flex-wrap: wrap; }
.chart-card-head h3 { margin-bottom: 0; }
.chart-sub { font-size: 11.5px; color: var(--text-muted); margin: -6px 0 10px; }

.segmented-mini { display: flex; background: var(--card-2); border-radius: 8px; padding: 3px; }
.segmented-mini button { border: none; background: transparent; color: var(--text-muted); padding: 5px 11px; border-radius: 6px; font-size: 11.5px; font-weight: 600; }
.segmented-mini button.active { background: var(--accent); color: #06231d; }

.ranked-bar-list { display: flex; flex-direction: column; gap: 10px; }
.ranked-bar-row { display: grid; grid-template-columns: 90px 1fr 70px 50px; align-items: center; gap: 10px; font-size: 12px; }
.ranked-bar-label { color: var(--text); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ranked-bar-track { background: var(--card-2); border-radius: 20px; height: 10px; overflow: hidden; }
.ranked-bar-fill { height: 100%; border-radius: 20px; }
.ranked-bar-value { color: var(--text-muted); text-align: right; white-space: nowrap; }

.target-progress { display: flex; align-items: center; gap: 8px; min-width: 130px; }
.target-progress-track { flex: 1; background: var(--card-2); border-radius: 20px; height: 8px; overflow: hidden; }
.target-progress-fill { height: 100%; border-radius: 20px; }
.target-progress-label { font-size: 11px; color: var(--text-muted); min-width: 34px; text-align: right; }
.target-total-row td { font-weight: 700; color: var(--text); border-top: 2px solid var(--border); }
.rank-cell { font-size: 15px; text-align: center; width: 36px; }

/* ---------------- MODULE LOADING ---------------- */
.module-loading { text-align: center; padding: 80px 0; color: var(--text-muted); font-size: 14px; }
.module-loading i { margin-right: 8px; color: var(--accent); }

/* ---------------- TOASTS ---------------- */
.toast-wrap { position: fixed; bottom: 20px; right: 20px; z-index: 100; display: flex; flex-direction: column; gap: 8px; }
.toast { background: var(--card); border: 1px solid var(--border); color: var(--text); padding: 12px 16px; border-radius: 10px; box-shadow: 0 12px 30px rgba(0,0,0,0.25); display: flex; align-items: center; gap: 10px; font-size: 13px; opacity: 0; transform: translateY(10px); transition: .25s; }
.toast.show { opacity: 1; transform: translateY(0); }
.toast-success i { color: #3FD98E; } .toast-error i { color: #FF5C7A; } .toast-info i { color: var(--accent); }

/* ---------------- RESPONSIVE ---------------- */
@media (max-width: 992px) {
  .sidebar { position: fixed; left: -280px; transition: left .25s ease; }
  .sidebar.open { left: 0; }
  #sidebarMobileToggle { display: flex; }
  .topbar-mid { display: none; }
}
body.compact .kpi-card { padding: 10px; }
body.compact .chart-box { height: 190px; }
body.compact .panel { padding: 12px; }

@media print {
  .sidebar, .topbar, .filter-bar, .tab-bar { display: none !important; }
  .content-scroll { padding: 0; }
}
