/* =============================================================
   Blomkal Cockpit — Design System premium minimaliste (Apple-like)
   ============================================================= */

:root {
  /* Palette claire */
  --bg:           #f5f5f7;
  --bg-elev:      #ffffff;
  --bg-subtle:    #fafafa;
  --bg-hover:     #f0f0f2;
  --border:       #e6e6ea;
  --border-strong:#d2d2d7;
  --text:         #111113;
  --text-sub:     #535359;
  --text-muted:   #86868b;
  --text-faint:   #a1a1a6;

  /* Accents */
  --accent:       #0a84ff;
  --accent-dark:  #0060df;
  --accent-soft:  rgba(10,132,255,.10);
  --success:      #34c759;
  --success-soft: rgba(52,199,89,.12);
  --warning:      #ff9f0a;
  --warning-soft: rgba(255,159,10,.14);
  --danger:       #ff3b30;
  --danger-soft:  rgba(255,59,48,.12);
  --info:         #5856d6;

  /* Ombres */
  --shadow-sm:    0 1px 2px rgba(0,0,0,.04);
  --shadow:       0 4px 16px rgba(0,0,0,.05), 0 1px 2px rgba(0,0,0,.04);
  --shadow-lg:    0 20px 60px rgba(0,0,0,.10), 0 2px 8px rgba(0,0,0,.05);

  /* Rayons */
  --r-sm: 8px;
  --r:    12px;
  --r-lg: 16px;
  --r-xl: 22px;

  /* Typo */
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text",
          "Helvetica Neue", "Inter", system-ui, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;

  /* Layout */
  --header-h: 62px;
  --sidebar-w: 240px;
}

[data-theme="dark"] {
  --bg:           #0b0b0d;
  --bg-elev:      #18181b;
  --bg-subtle:    #121214;
  --bg-hover:     #1f1f23;
  --border:       #2a2a2e;
  --border-strong:#3a3a3e;
  --text:         #f5f5f7;
  --text-sub:     #c8c8cc;
  --text-muted:   #8e8e93;
  --text-faint:   #6e6e73;
  --accent-soft:  rgba(10,132,255,.18);
  --shadow:       0 4px 16px rgba(0,0,0,.40), 0 1px 2px rgba(0,0,0,.30);
}

/* ---------- Reset ---------- */
* { box-sizing: border-box; }
html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  letter-spacing: -0.005em;
}
button { font-family: inherit; }
a { color: var(--accent); text-decoration: none; }

/* ---------- HEADER ---------- */
.app-header {
  position: sticky; top: 0; z-index: 50;
  height: var(--header-h);
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 0 22px;
  background: rgba(255,255,255,.78);
  backdrop-filter: saturate(180%) blur(18px);
  -webkit-backdrop-filter: saturate(180%) blur(18px);
  border-bottom: 1px solid var(--border);
}
[data-theme="dark"] .app-header { background: rgba(14,14,16,.72); }

.brand { display: flex; align-items: center; }
.logo { display: flex; align-items: center; gap: 10px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-name { font-size: 14px; font-weight: 600; }
.brand-sub { font-size: 11px; color: var(--text-muted); letter-spacing: .01em; }

.header-center { display: flex; justify-content: center; }
.period-switcher {
  display: inline-flex; padding: 3px; background: var(--bg-hover);
  border-radius: 10px; gap: 2px;
}
.period-btn {
  border: 0; background: transparent; padding: 6px 14px; font-size: 13px;
  border-radius: 8px; color: var(--text-sub); cursor: pointer;
  transition: all .18s ease;
}
.period-btn:hover { color: var(--text); }
.period-btn.active {
  background: var(--bg-elev); color: var(--text);
  box-shadow: var(--shadow-sm);
}

.header-right { display: flex; align-items: center; gap: 10px; justify-content: flex-end; }
.mode-switch {
  display: inline-flex; padding: 3px; background: var(--bg-hover);
  border-radius: 10px; gap: 2px;
}
.mode-btn {
  border: 0; background: transparent; padding: 6px 14px; font-size: 13px;
  border-radius: 8px; color: var(--text-sub); cursor: pointer;
  transition: all .18s ease; font-weight: 500;
}
.mode-btn.active {
  background: var(--text); color: var(--bg-elev);
  box-shadow: var(--shadow-sm);
}

.icon-btn {
  position: relative;
  background: transparent; border: 1px solid transparent;
  color: var(--text-sub); cursor: pointer;
  width: 34px; height: 34px; border-radius: 10px;
  display: inline-flex; align-items: center; justify-content: center;
  transition: all .18s ease;
}
.icon-btn:hover { background: var(--bg-hover); color: var(--text); }
.badge-dot {
  position: absolute; top: -2px; right: -2px;
  min-width: 16px; height: 16px; padding: 0 4px;
  border-radius: 10px; background: var(--danger); color: #fff;
  font-size: 10px; font-weight: 600;
  display: inline-flex; align-items: center; justify-content: center;
  border: 2px solid var(--bg-elev);
}

.profile {
  display: flex; align-items: center; gap: 10px;
  padding: 4px 10px 4px 4px; border-radius: 22px;
  background: var(--bg-hover);
}
.avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: linear-gradient(135deg, #111 0%, #444 100%);
  color: #fff; display: inline-flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 600; letter-spacing: .5px;
}
.profile-meta { display: flex; flex-direction: column; line-height: 1.15; }
.profile-name { font-size: 12px; font-weight: 600; }
.profile-role { font-size: 10px; color: var(--text-muted); }

/* ---------- SHELL ---------- */
.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: calc(100vh - var(--header-h));
}

/* ---------- SIDEBAR ---------- */
.sidebar {
  background: var(--bg-subtle);
  border-right: 1px solid var(--border);
  padding: 20px 14px;
  display: flex; flex-direction: column; gap: 22px;
  position: sticky; top: var(--header-h);
  height: calc(100vh - var(--header-h));
  overflow-y: auto;
}
.nav-group { display: flex; flex-direction: column; gap: 2px; }
.nav-label {
  font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase;
  color: var(--text-faint); padding: 4px 10px; font-weight: 600;
}
.nav-item {
  border: 0; background: transparent;
  display: flex; align-items: center; gap: 10px;
  padding: 7px 10px; border-radius: 8px;
  font-size: 13px; color: var(--text-sub); cursor: pointer;
  text-align: left; transition: all .18s ease; width: 100%;
  font-weight: 500;
}
.nav-item:hover { background: var(--bg-hover); color: var(--text); }
.nav-item.active {
  background: var(--bg-elev); color: var(--text);
  box-shadow: var(--shadow-sm);
}
.nav-icon {
  display: inline-flex; width: 18px; height: 18px; align-items: center; justify-content: center;
  color: var(--text-muted); font-size: 11px;
}
.nav-item.active .nav-icon { color: var(--accent); }

.sidebar-footer { margin-top: auto; }
.data-status {
  display: flex; gap: 10px; align-items: center;
  padding: 10px 12px; border-radius: 10px;
  background: var(--bg-elev); border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}
.dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.dot-ok { background: var(--success); box-shadow: 0 0 0 3px rgba(52,199,89,.18); }
.dot-warn { background: var(--warning); }
.dot-err { background: var(--danger); }
.ds-title { font-size: 12px; font-weight: 600; }
.ds-sub { font-size: 10.5px; color: var(--text-muted); }

/* ---------- MAIN ---------- */
.main {
  padding: 26px 30px 60px;
  max-width: 1600px;
  min-width: 0;
}
.view { display: none; animation: fadein .25s ease; }
.view.active { display: block; }
@keyframes fadein { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.view-header {
  display: flex; align-items: flex-end; justify-content: space-between;
  margin-bottom: 22px; gap: 16px; flex-wrap: wrap;
}
.view-title {
  font-size: 26px; font-weight: 600; letter-spacing: -.02em; margin: 0 0 4px;
}
.view-sub { color: var(--text-muted); font-size: 13px; margin: 0; }
.view-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* ---------- BUTTONS ---------- */
.btn {
  border: 1px solid var(--border-strong); background: var(--bg-elev);
  padding: 8px 14px; border-radius: 10px;
  font-size: 13px; font-weight: 500; color: var(--text);
  cursor: pointer; transition: all .16s ease;
}
.btn:hover { background: var(--bg-hover); }
.btn-primary {
  background: var(--text); color: var(--bg-elev); border-color: var(--text);
}
.btn-primary:hover { background: #000; color: #fff; }
.btn-ghost {
  background: transparent; border-color: var(--border);
}
.btn-ghost:hover { background: var(--bg-hover); }
.btn-danger {
  color: var(--danger); border-color: var(--border);
}
.btn-danger:hover { background: var(--danger-soft); }
.btn-sm { padding: 6px 10px; font-size: 12px; border-radius: 8px; }

/* ---------- CARDS ---------- */
.card {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 20px;
  margin-bottom: 18px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow .2s ease, transform .2s ease;
}
.card:hover { box-shadow: var(--shadow); }
.card-header {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-bottom: 14px; flex-wrap: wrap;
}
.card-header h3 { font-size: 14px; font-weight: 600; margin: 0; letter-spacing: -.01em; }
.card-sub { color: var(--text-muted); font-size: 11.5px; font-weight: 500; }
.card-actions { display: flex; gap: 8px; align-items: center; margin-left: auto; }

/* ---------- GRIDS ---------- */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-bottom: 18px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 18px; margin-bottom: 18px; }
@media (max-width: 1100px) {
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
}

/* ---------- KPI ---------- */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}
.kpi {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 16px 18px;
  box-shadow: var(--shadow-sm);
  position: relative;
  transition: all .2s ease;
  overflow: hidden;
}
.kpi:hover { transform: translateY(-1px); box-shadow: var(--shadow); }
.kpi-label {
  font-size: 11.5px; color: var(--text-muted);
  font-weight: 500; text-transform: uppercase; letter-spacing: .05em;
  margin-bottom: 6px; display: flex; align-items: center; gap: 6px;
}
.kpi-value {
  font-size: 24px; font-weight: 600; letter-spacing: -.02em;
  font-feature-settings: "tnum";
}
.kpi-sub {
  display: flex; align-items: center; gap: 8px;
  margin-top: 6px; font-size: 12px; color: var(--text-muted);
}
.kpi-delta {
  font-weight: 600; font-size: 12px;
  padding: 2px 6px; border-radius: 6px;
}
.kpi-delta.up { color: var(--success); background: var(--success-soft); }
.kpi-delta.down { color: var(--danger); background: var(--danger-soft); }
.kpi-delta.flat { color: var(--text-muted); background: var(--bg-hover); }
.kpi-target {
  height: 4px; border-radius: 10px; background: var(--bg-hover);
  margin-top: 10px; overflow: hidden;
}
.kpi-target-fill {
  height: 100%; background: linear-gradient(90deg, var(--accent), #5856d6);
  border-radius: 10px;
}
.kpi-source {
  position: absolute; top: 10px; right: 10px; font-size: 10px;
  color: var(--text-faint); cursor: help;
}
.kpi.edited::before {
  content: ""; position: absolute; top: 0; left: 0; right: 0; height: 2px;
  background: linear-gradient(90deg, var(--warning), var(--accent));
}

/* ---------- ALERTS ---------- */
.alert-strip { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.alert {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 10px 14px; border-radius: var(--r);
  background: var(--bg-elev); border: 1px solid var(--border);
  box-shadow: var(--shadow-sm); font-size: 13px;
}
.alert .ico { width: 8px; height: 8px; border-radius: 50%; margin-top: 7px; flex-shrink: 0; }
.alert.alert-danger { background: var(--danger-soft); border-color: rgba(255,59,48,.2); }
.alert.alert-danger .ico { background: var(--danger); }
.alert.alert-warning { background: var(--warning-soft); border-color: rgba(255,159,10,.2); }
.alert.alert-warning .ico { background: var(--warning); }
.alert.alert-info .ico { background: var(--accent); }

/* ---------- TABLES ---------- */
.table-wrap { overflow-x: auto; border-radius: var(--r-sm); }
.table {
  width: 100%; border-collapse: collapse;
  font-size: 13px;
}
.table th {
  text-align: left; font-weight: 600;
  color: var(--text-muted);
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em;
  white-space: nowrap;
}
.table td {
  padding: 11px 12px; border-bottom: 1px solid var(--border);
  color: var(--text); vertical-align: middle;
}
.table tr:last-child td { border-bottom: 0; }
.table tr:hover td { background: var(--bg-subtle); }
.table .num { text-align: right; font-feature-settings: "tnum"; font-variant-numeric: tabular-nums; }
.table .num-cell { font-feature-settings: "tnum"; font-variant-numeric: tabular-nums; }

.tag {
  display: inline-flex; align-items: center; padding: 2px 8px;
  border-radius: 999px; font-size: 11px; font-weight: 600;
  background: var(--bg-hover); color: var(--text-sub);
}
.tag-success { background: var(--success-soft); color: var(--success); }
.tag-warning { background: var(--warning-soft); color: var(--warning); }
.tag-danger  { background: var(--danger-soft);  color: var(--danger); }
.tag-info    { background: var(--accent-soft);  color: var(--accent); }

.edit-btn {
  border: 0; background: transparent; color: var(--text-muted);
  cursor: pointer; padding: 4px 6px; border-radius: 6px; font-size: 12px;
}
.edit-btn:hover { background: var(--bg-hover); color: var(--accent); }
.edited-cell {
  position: relative;
}
.edited-cell::after {
  content: "●"; color: var(--warning); margin-left: 6px; font-size: 9px;
}

/* ---------- FORMS ---------- */
.input, .select, .textarea {
  width: 100%; padding: 8px 10px;
  border: 1px solid var(--border-strong); border-radius: 8px;
  background: var(--bg-elev); color: var(--text);
  font-family: inherit; font-size: 13px;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.input:focus, .select:focus, .textarea:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.input-sm, .select-sm { padding: 6px 8px; font-size: 12px; }
.textarea { min-height: 80px; resize: vertical; }
.form-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 14px;
}
.form-grid label {
  display: flex; flex-direction: column; gap: 4px;
  font-size: 12px; color: var(--text-muted); font-weight: 500;
}
.form-grid label input, .form-grid label select { margin-top: 2px; }

/* ---------- TOP LIST ---------- */
.list-top { display: flex; flex-direction: column; gap: 10px; }
.list-top-item {
  display: grid; grid-template-columns: auto 1fr auto; gap: 10px;
  align-items: center;
  padding: 8px 10px; border-radius: 10px;
  background: var(--bg-subtle);
}
.list-top-rank {
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--text); color: var(--bg-elev);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 600;
}
.list-top-meta { display: flex; flex-direction: column; }
.list-top-name { font-size: 13px; font-weight: 500; }
.list-top-sub { font-size: 11px; color: var(--text-muted); }
.list-top-val { font-size: 13px; font-weight: 600; font-feature-settings: "tnum"; }

/* ---------- TIMELINE ---------- */
.timeline { display: flex; flex-direction: column; gap: 10px; }
.timeline-item {
  display: grid; grid-template-columns: auto 1fr auto; gap: 12px;
  align-items: start; padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.timeline-item:last-child { border-bottom: 0; }
.timeline-dot {
  width: 8px; height: 8px; border-radius: 50%; margin-top: 6px;
  background: var(--accent);
}
.timeline-dot.success { background: var(--success); }
.timeline-dot.warning { background: var(--warning); }
.timeline-dot.danger { background: var(--danger); }
.timeline-title { font-size: 13px; font-weight: 500; }
.timeline-sub { font-size: 11.5px; color: var(--text-muted); }
.timeline-date { font-size: 11px; color: var(--text-faint); font-feature-settings: "tnum"; }

/* ---------- CONNECTOR CARDS ---------- */
.connector-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 14px; margin-bottom: 18px;
}
.connector {
  background: var(--bg-elev); border: 1px solid var(--border);
  border-radius: var(--r-lg); padding: 18px; box-shadow: var(--shadow-sm);
  display: flex; flex-direction: column; gap: 12px;
}
.connector-head { display: flex; align-items: center; gap: 12px; }
.connector-logo {
  width: 38px; height: 38px; border-radius: 10px;
  display: inline-flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700; font-size: 16px;
}
.connector h3 { margin: 0; font-size: 14px; font-weight: 600; }
.connector-state { margin: 0; font-size: 11px; color: var(--text-muted); }
.connector-state[data-connected="true"] { color: var(--success); }
.connector-desc { margin: 0; font-size: 12.5px; color: var(--text-sub); }
.connector-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.connector-help { font-size: 12px; color: var(--text-muted); }
.connector-help summary { cursor: pointer; }
.connector-help p { margin-top: 6px; color: var(--text-sub); }

.dropzone {
  border: 1.5px dashed var(--border-strong);
  border-radius: var(--r); padding: 18px;
  text-align: center; color: var(--text-muted);
  transition: all .2s ease; cursor: pointer;
}
.dropzone:hover, .dropzone.active {
  border-color: var(--accent); color: var(--accent);
  background: var(--accent-soft);
}
.dropzone p { margin: 0; font-size: 12.5px; }
.dropzone p span { font-size: 11px; color: var(--text-faint); }

.mapping-table { display: flex; flex-direction: column; gap: 8px; }
.mapping-row {
  display: grid; grid-template-columns: 1fr auto 1fr auto;
  gap: 10px; align-items: center;
  padding: 8px 10px; border-radius: 8px; background: var(--bg-subtle);
  font-size: 12.5px;
}
.mapping-arrow { color: var(--text-muted); }
.mapping-conf { font-size: 11px; color: var(--text-muted); font-weight: 600; }

/* ---------- SIMULATOR ---------- */
.simu-grid { display: flex; flex-direction: column; gap: 14px; }
.simu-row {
  display: grid; grid-template-columns: 1fr 1.4fr auto;
  gap: 12px; align-items: center;
}
.simu-row label { font-size: 12.5px; color: var(--text-sub); }
.simu-row input[type="range"] {
  -webkit-appearance: none; appearance: none;
  width: 100%; height: 4px; background: var(--bg-hover);
  border-radius: 4px; outline: none;
}
.simu-row input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--bg-elev); border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-sm); cursor: pointer;
  transition: transform .15s ease;
}
.simu-row input[type="range"]::-webkit-slider-thumb:hover { transform: scale(1.1); }
.simu-val {
  font-variant-numeric: tabular-nums; font-weight: 600; font-size: 12.5px;
  color: var(--text); min-width: 60px; text-align: right;
}
.simu-impact {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 10px; margin-bottom: 14px;
}
.simu-impact-item {
  background: var(--bg-subtle); border-radius: 10px; padding: 10px 12px;
}
.simu-impact-label { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .05em; }
.simu-impact-value { font-size: 18px; font-weight: 600; font-feature-settings: "tnum"; }
.simu-impact-delta { font-size: 11.5px; font-weight: 600; }
.simu-impact-delta.up { color: var(--success); }
.simu-impact-delta.down { color: var(--danger); }

/* ---------- EXEC CARD (bank) ---------- */
.card-exec {
  background: linear-gradient(135deg, #111 0%, #2b2b2b 100%);
  color: #fff; border: 0;
}
.card-exec .exec-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 16px; }
.card-exec .exec-eyebrow { font-size: 11px; text-transform: uppercase; letter-spacing: .1em; opacity: .7; margin-bottom: 4px; }
.card-exec .exec-title { font-size: 22px; font-weight: 600; letter-spacing: -.02em; margin: 0; }
.card-exec .exec-period { font-size: 12px; opacity: .7; margin-top: 4px; }
.card-exec .exec-logo {
  width: 48px; height: 48px; border-radius: 12px;
  background: rgba(255,255,255,.1); backdrop-filter: blur(10px);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 18px; font-weight: 700; letter-spacing: -.02em;
}
.card-exec .exec-body { font-size: 13.5px; line-height: 1.7; color: rgba(255,255,255,.85); max-width: 80ch; margin: 0; }

.kpi-bank .kpi { background: var(--bg-elev); }

/* ---------- REPORTS ---------- */
.report-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px; }
.report-card {
  background: var(--bg-elev); border: 1px solid var(--border); border-radius: var(--r-lg);
  padding: 18px; box-shadow: var(--shadow-sm);
  display: flex; flex-direction: column; gap: 10px;
  transition: all .2s ease;
}
.report-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.report-card h4 { margin: 0; font-size: 14px; font-weight: 600; }
.report-card p { margin: 0; font-size: 12px; color: var(--text-muted); }
.report-card-actions { margin-top: auto; display: flex; gap: 8px; }

/* ---------- MODAL ---------- */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(0,0,0,.35); backdrop-filter: blur(8px);
  display: none; align-items: center; justify-content: center;
  animation: fadein .2s ease;
}
.modal-backdrop.open { display: flex; }
.modal {
  background: var(--bg-elev);
  width: min(520px, 92vw);
  border-radius: var(--r-xl); box-shadow: var(--shadow-lg);
  overflow: hidden; animation: popin .22s ease;
}
@keyframes popin {
  from { opacity: 0; transform: translateY(8px) scale(.98); }
  to { opacity: 1; transform: none; }
}
.modal-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 16px 20px; border-bottom: 1px solid var(--border);
}
.modal-header h3 { margin: 0; font-size: 15px; font-weight: 600; }
.modal-body { padding: 20px; display: flex; flex-direction: column; gap: 16px; }
.modal-footer {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 20px; border-top: 1px solid var(--border);
  background: var(--bg-subtle);
  gap: 8px;
}
.modal-footer > div { display: flex; gap: 8px; }
.edit-row { display: flex; flex-direction: column; gap: 6px; }
.edit-row label { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .05em; font-weight: 600; }
.edit-field { font-weight: 600; font-size: 14px; }
.edit-source {
  font-size: 13px; color: var(--text-muted);
  padding: 8px 10px; border-radius: 8px; background: var(--bg-subtle);
  font-variant-numeric: tabular-nums;
}

/* ---------- TOASTS ---------- */
.toast-zone {
  position: fixed; bottom: 24px; right: 24px;
  display: flex; flex-direction: column; gap: 8px;
  z-index: 200; pointer-events: none;
}
.toast {
  background: var(--bg-elev); border: 1px solid var(--border);
  border-radius: var(--r); padding: 10px 14px;
  box-shadow: var(--shadow-lg);
  font-size: 13px; display: flex; align-items: center; gap: 10px;
  pointer-events: auto; min-width: 240px;
  animation: slidein .22s ease;
}
@keyframes slidein {
  from { opacity: 0; transform: translateX(12px); }
  to { opacity: 1; transform: none; }
}
.toast.success { border-left: 3px solid var(--success); }
.toast.error { border-left: 3px solid var(--danger); }
.toast.info { border-left: 3px solid var(--accent); }

/* ---------- MISC ---------- */
.muted { color: var(--text-muted); }
.small { font-size: 11.5px; }
.actions-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }

/* ---------- CHART WRAPPER (fix expansion infinie) ---------- */
.chart-wrap {
  position: relative;
  height: 260px;
  width: 100%;
  min-height: 220px;
  max-height: 320px;
}
.chart-wrap canvas {
  position: absolute !important;
  top: 0; left: 0;
  width: 100% !important;
  height: 100% !important;
  display: block;
}
.card { overflow: hidden; }
.card canvas { max-height: 320px; }

/* ---------- HEATMAP ---------- */
.heatmap {
  display: grid;
  grid-template-columns: 120px repeat(26, 1fr);
  gap: 3px; align-items: center;
  font-size: 11px;
}
.heatmap-row-label { color: var(--text-muted); font-size: 11px; padding-right: 6px; }
.heatmap-cell {
  height: 22px; border-radius: 4px;
  background: var(--bg-hover);
  transition: all .15s ease;
  cursor: pointer;
  position: relative;
}
.heatmap-cell:hover { transform: scale(1.15); z-index: 2; box-shadow: var(--shadow); }
.heatmap-cell[data-load="low"] { background: #d7f5e1; }
.heatmap-cell[data-load="mid"] { background: #a8e6b9; }
.heatmap-cell[data-load="high"] { background: #5dd87f; }
.heatmap-cell[data-load="over"] { background: #ff9f0a; }
.heatmap-cell[data-load="critical"] { background: #ff3b30; }
.heatmap-header {
  grid-column: 2 / -1; display: grid; grid-template-columns: repeat(26, 1fr); gap: 3px;
  font-size: 10px; color: var(--text-faint); text-align: center;
  margin-bottom: 4px;
}

/* ---------- PRINT / PDF ---------- */
@media print {
  @page { size: A4; margin: 18mm 14mm; }
  body { background: #fff; color: #000; font-size: 11px; }
  .app-header, .sidebar, .view-actions, .card-actions, .alert-strip, .toast-zone { display: none !important; }
  .app-shell { display: block; }
  .main { padding: 0; max-width: none; }
  .view { display: none !important; }
  .view.print-active { display: block !important; }
  .card { box-shadow: none; border: 1px solid #ddd; break-inside: avoid; page-break-inside: avoid; }
  .grid-2, .grid-3 { gap: 10px; }
  .kpi { box-shadow: none; border: 1px solid #ddd; }
  .card-exec { background: #111 !important; color: #fff !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* ---------- RESPONSIVE ---------- */
@media (max-width: 1024px) {
  :root { --sidebar-w: 72px; }
  .nav-item span:not(.nav-icon) { display: none; }
  .nav-label { display: none; }
  .sidebar-footer { display: none; }
}
@media (max-width: 760px) {
  .header-center { display: none; }
  .profile-meta { display: none; }
  .main { padding: 16px; }
}
