/* ═══════════════════════════════════════════════════════════════════════════
   OptymaPro Compta — Swiss Financial Terminal
   Aesthetic: precision Swiss typography + Bloomberg terminal density +
   atmospheric depth. DM Mono for numbers, Instrument Sans for UI.
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Tokens ─────────────────────────────────────────────────────────────── */
:root {
  /* Surface */
  --bg-root: #080c14;
  --bg-body: #0b1120;
  --bg-sidebar: #060a13;
  --bg-card: #111827;
  --bg-card-hover: #1a2332;
  --bg-input: #0d1525;
  --bg-row-alt: rgba(255,255,255,0.018);
  --bg-overlay: rgba(6,10,19,0.85);

  /* Borders */
  --border: rgba(255,255,255,0.06);
  --border-strong: rgba(255,255,255,0.1);
  --border-accent: rgba(26,86,219,0.4);

  /* Text */
  --text-primary: #e2e8f0;
  --text-secondary: #7a8ba7;
  --text-muted: #475569;
  --text-accent: #60a5fa;
  --text-inverse: #080c14;

  /* Accent */
  --accent: #1a56db;
  --accent-bright: #3b82f6;
  --accent-glow: rgba(26,86,219,0.15);
  --emerald: #059669;
  --emerald-bright: #34d399;
  --emerald-glow: rgba(5,150,105,0.12);

  /* Status */
  --status-valid: #059669;
  --status-valid-bg: rgba(5,150,105,0.1);
  --status-draft: #d97706;
  --status-draft-bg: rgba(217,119,6,0.1);
  --status-error: #dc2626;
  --status-error-bg: rgba(220,38,38,0.1);

  /* Typography */
  --font-ui: 'Instrument Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'DM Mono', 'Menlo', monospace;

  /* Spacing */
  --sidebar-w: 240px;
  --header-h: 56px;
  --radius: 8px;
  --radius-sm: 5px;
  --radius-lg: 12px;
}

/* ── Reset ──────────────────────────────────────────────────────────────── */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

html {
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-ui);
  background: var(--bg-root);
  color: var(--text-primary);
  line-height: 1.5;
  overflow: hidden;
  height: 100vh;
}

/* ── Scrollbar ──────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.08); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.14); }

/* ── Auth Screen ────────────────────────────────────────────────────────── */
.auth-gate {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100vh;
  flex-direction: column;
  gap: 24px;
  background:
    radial-gradient(ellipse 600px 400px at 50% 40%, rgba(26,86,219,0.06), transparent),
    var(--bg-root);
}

.auth-gate .logo-mark {
  width: 64px;
  height: 64px;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--accent), #2563eb);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  font-weight: 700;
  color: white;
  box-shadow: 0 0 60px rgba(26,86,219,0.3);
}

.auth-gate h1 {
  font-size: 1.4rem;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

.auth-gate p {
  color: var(--text-secondary);
  font-size: 0.92rem;
  text-align: center;
  line-height: 1.6;
}

.auth-gate code {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  color: var(--text-accent);
}

/* ── Layout Shell ───────────────────────────────────────────────────────── */
.shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  grid-template-rows: var(--header-h) 1fr;
  height: 100vh;
  background: var(--bg-body);
}

/* ── Sidebar ────────────────────────────────────────────────────────────── */
.sidebar {
  grid-row: 1 / -1;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  position: relative;
}

.sidebar::after {
  content: '';
  position: absolute;
  top: 0; right: 0;
  width: 1px;
  height: 100%;
  background: linear-gradient(to bottom, var(--accent-glow), transparent 30%, transparent 70%, var(--accent-glow));
  pointer-events: none;
}

.sidebar-brand {
  height: var(--header-h);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 20px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.sidebar-brand .mark {
  width: 30px;
  height: 30px;
  border-radius: 7px;
  background: linear-gradient(135deg, var(--accent), #2563eb);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  color: white;
  flex-shrink: 0;
}

.sidebar-brand span {
  font-weight: 600;
  font-size: 0.95rem;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}

.sidebar-brand .tag {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 400;
  color: var(--text-muted);
  margin-left: auto;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.sidebar-nav {
  padding: 12px 10px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-section-label {
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  padding: 16px 10px 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--text-secondary);
  font-size: 0.88rem;
  font-weight: 500;
  transition: all 0.15s ease;
  border: 1px solid transparent;
  position: relative;
}

.nav-item:hover {
  color: var(--text-primary);
  background: rgba(255,255,255,0.03);
}

.nav-item.active {
  color: var(--text-primary);
  background: var(--accent-glow);
  border-color: var(--border-accent);
}

.nav-item.active::before {
  content: '';
  position: absolute;
  left: -10px;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 20px;
  background: var(--accent-bright);
  border-radius: 0 2px 2px 0;
}

.nav-item svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  opacity: 0.6;
}

.nav-item.active svg {
  opacity: 1;
  color: var(--accent-bright);
}

.nav-item .kbd {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 0.6rem;
  color: var(--text-muted);
  opacity: 0;
  transition: opacity 0.15s;
}

.nav-item:hover .kbd {
  opacity: 1;
}

.sidebar-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

.sidebar-footer .company {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

/* ── Header ─────────────────────────────────────────────────────────────── */
.header {
  display: flex;
  align-items: center;
  padding: 0 28px;
  border-bottom: 1px solid var(--border);
  gap: 16px;
  background: var(--bg-body);
}

.header-title {
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.header-breadcrumb {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.header-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 12px;
}

.header-clock {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-muted);
  letter-spacing: 0.04em;
}

.header-status {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  color: var(--emerald-bright);
}

.header-status .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--emerald);
  animation: pulse-dot 2s ease-in-out infinite;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* ── Main Content ───────────────────────────────────────────────────────── */
.main {
  overflow-y: auto;
  padding: 24px 28px 40px;
  position: relative;
}

/* Subtle grid underlay */
.main::before {
  content: '';
  position: fixed;
  top: var(--header-h);
  left: var(--sidebar-w);
  right: 0;
  bottom: 0;
  background-image:
    linear-gradient(rgba(255,255,255,0.015) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.015) 1px, transparent 1px);
  background-size: 60px 60px;
  pointer-events: none;
  z-index: 0;
  mask-image: radial-gradient(ellipse 80% 60% at 50% 30%, black, transparent);
}

.main > * { position: relative; z-index: 1; }

/* ── View transition ────────────────────────────────────────────────────── */
.view-enter {
  animation: viewFadeIn 0.25s ease-out;
}

@keyframes viewFadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ── KPI Cards ──────────────────────────────────────────────────────────── */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px;
  margin-bottom: 28px;
}

.kpi-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  position: relative;
  overflow: hidden;
  transition: border-color 0.2s, transform 0.15s;
}

.kpi-card:hover {
  border-color: var(--border-strong);
  transform: translateY(-1px);
}

.kpi-card .kpi-label {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.kpi-card .kpi-label svg {
  width: 14px;
  height: 14px;
  opacity: 0.5;
}

.kpi-card .kpi-value {
  font-family: var(--font-mono);
  font-size: 1.6rem;
  font-weight: 500;
  letter-spacing: -0.03em;
  line-height: 1.2;
}

.kpi-card .kpi-sub {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-top: 6px;
}

.kpi-card.accent-blue {
  border-color: var(--border-accent);
}

.kpi-card.accent-blue::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--accent), var(--accent-bright));
}

.kpi-card.accent-green::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--emerald), var(--emerald-bright));
}

.kpi-positive { color: var(--emerald-bright); }
.kpi-negative { color: #f87171; }
.kpi-neutral { color: var(--text-primary); }

/* ── Bank balance hero card ─────────────────────────────────────────────── */
.bank-hero {
  background:
    radial-gradient(ellipse 300px 200px at 85% 30%, rgba(5,150,105,0.08), transparent),
    var(--bg-card);
  border: 1px solid rgba(5,150,105,0.2);
  border-radius: var(--radius-lg);
  padding: 24px 28px;
  margin-bottom: 28px;
  display: flex;
  align-items: center;
  gap: 24px;
}

.bank-hero .bank-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: var(--emerald-glow);
  border: 1px solid rgba(5,150,105,0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--emerald-bright);
  flex-shrink: 0;
}

.bank-hero .bank-icon svg {
  width: 22px;
  height: 22px;
}

.bank-hero .bank-info {
  flex: 1;
}

.bank-hero .bank-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.bank-hero .bank-amount {
  font-family: var(--font-mono);
  font-size: 2rem;
  font-weight: 400;
  letter-spacing: -0.03em;
  color: var(--emerald-bright);
}

.bank-hero .bank-sub {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 2px;
}

/* ── Section header ─────────────────────────────────────────────────────── */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.section-title {
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-secondary);
}

/* ── Data Table ─────────────────────────────────────────────────────────── */
.data-table-wrap {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.data-table thead {
  position: sticky;
  top: 0;
  z-index: 2;
}

.data-table th {
  text-align: left;
  padding: 10px 14px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
  transition: color 0.15s;
}

.data-table th:hover {
  color: var(--text-secondary);
}

.data-table th.sorted {
  color: var(--text-accent);
}

.data-table th .sort-arrow {
  display: inline-block;
  margin-left: 4px;
  font-size: 0.6rem;
  opacity: 0.5;
}

.data-table td {
  padding: 9px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.data-table tr:nth-child(even) td {
  background: var(--bg-row-alt);
}

.data-table tr:hover td {
  background: rgba(26,86,219,0.04);
}

.data-table tr.clickable {
  cursor: pointer;
}

.data-table .col-num {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  letter-spacing: -0.01em;
  text-align: right;
}

.data-table .col-account {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--text-accent);
}

.data-table .col-id {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-muted);
}

.data-table .col-date {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  white-space: nowrap;
}

/* ── Badges ─────────────────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 99px;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.badge-valid {
  background: var(--status-valid-bg);
  color: var(--emerald-bright);
  border: 1px solid rgba(5,150,105,0.2);
}

.badge-draft {
  background: var(--status-draft-bg);
  color: #fbbf24;
  border: 1px solid rgba(217,119,6,0.2);
}

.badge-error {
  background: var(--status-error-bg);
  color: #f87171;
  border: 1px solid rgba(220,38,38,0.2);
}

.badge-neutral {
  background: rgba(255,255,255,0.04);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

.badge-reconciled {
  background: var(--status-valid-bg);
  color: var(--emerald-bright);
  border: 1px solid rgba(5,150,105,0.2);
}

.badge-pending {
  background: var(--status-draft-bg);
  color: #fbbf24;
  border: 1px solid rgba(217,119,6,0.2);
}

/* ── Filters bar ────────────────────────────────────────────────────────── */
.filters-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.filter-input,
.filter-select {
  font-family: var(--font-ui);
  font-size: 0.82rem;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 7px 12px;
  color: var(--text-primary);
  outline: none;
  transition: border-color 0.15s;
}

.filter-input:focus,
.filter-select:focus {
  border-color: var(--border-accent);
}

.filter-input::placeholder {
  color: var(--text-muted);
}

.filter-input.search {
  min-width: 220px;
  padding-left: 34px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%23475569' stroke-width='1.5' stroke-linecap='round'%3E%3Ccircle cx='7' cy='7' r='5'/%3E%3Cline x1='11' y1='11' x2='14' y2='14'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: 10px center;
}

.filter-select {
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  padding-right: 28px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='none' stroke='%23475569' stroke-width='1.5'%3E%3Cpath d='M3 4.5L6 7.5L9 4.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
}

.filter-date {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  width: 130px;
}

/* ── Pagination ─────────────────────────────────────────────────────────── */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 0 4px;
}

.pagination button {
  font-family: var(--font-ui);
  font-size: 0.8rem;
  font-weight: 500;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  padding: 5px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s;
}

.pagination button:hover:not(:disabled) {
  border-color: var(--border-strong);
  color: var(--text-primary);
}

.pagination button:disabled {
  opacity: 0.3;
  cursor: default;
}

.pagination .page-info {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-muted);
  padding: 0 8px;
}

/* ── Two-column layout (Bilan) ──────────────────────────────────────────── */
.dual-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.dual-col-header {
  padding: 12px 16px;
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-bottom: 1px solid var(--border);
}

.dual-col .col-actif .dual-col-header {
  color: var(--accent-bright);
  background: var(--accent-glow);
}

.dual-col .col-passif .dual-col-header {
  color: var(--emerald-bright);
  background: var(--emerald-glow);
}

.dual-col .total-row {
  padding: 10px 16px;
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: 0.95rem;
  border-top: 2px solid var(--border-strong);
  display: flex;
  justify-content: space-between;
}

/* ── TVA Summary ────────────────────────────────────────────────────────── */
.tva-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-bottom: 24px;
}

.tva-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  text-align: center;
}

.tva-card .tva-label {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.tva-card .tva-amount {
  font-family: var(--font-mono);
  font-size: 1.4rem;
  font-weight: 400;
}

/* ── Entry detail modal ─────────────────────────────────────────────────── */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: var(--bg-overlay);
  backdrop-filter: blur(4px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.15s ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  width: 90%;
  max-width: 640px;
  max-height: 80vh;
  overflow-y: auto;
  animation: modalSlide 0.2s ease-out;
}

@keyframes modalSlide {
  from { opacity: 0; transform: translateY(10px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-header {
  padding: 18px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-header h3 {
  font-size: 1rem;
  font-weight: 600;
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  transition: color 0.15s;
}

.modal-close:hover {
  color: var(--text-primary);
}

.modal-body {
  padding: 20px 24px;
}

.modal-meta {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}

.modal-meta .meta-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.modal-meta .meta-label {
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

.modal-meta .meta-value {
  font-size: 0.88rem;
  color: var(--text-primary);
}

.modal-meta .meta-value.mono {
  font-family: var(--font-mono);
}

/* ── Account selector (Grand Livre) ─────────────────────────────────────── */
.account-selector {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}

.account-selector select {
  flex: 1;
  max-width: 400px;
}

/* ── Export view ─────────────────────────────────────────────────────────── */
.export-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.export-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.export-card h3 {
  font-size: 0.95rem;
  font-weight: 600;
}

.export-card p {
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.btn {
  font-family: var(--font-ui);
  font-size: 0.82rem;
  font-weight: 600;
  border: none;
  border-radius: var(--radius-sm);
  padding: 8px 16px;
  cursor: pointer;
  transition: all 0.15s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn-primary {
  background: var(--accent);
  color: white;
}

.btn-primary:hover {
  background: var(--accent-bright);
}

.btn-outline {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

.btn-outline:hover {
  border-color: var(--border-strong);
  color: var(--text-primary);
}

.btn svg {
  width: 15px;
  height: 15px;
}

/* ── Tiers table tags ───────────────────────────────────────────────────── */
.tiers-type {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.tiers-client { color: var(--accent-bright); }
.tiers-fournisseur { color: var(--emerald-bright); }
.tiers-autre { color: var(--text-secondary); }

/* ── Loading skeleton ───────────────────────────────────────────────────── */
.skeleton {
  background: linear-gradient(90deg,
    var(--bg-card) 25%,
    rgba(255,255,255,0.04) 50%,
    var(--bg-card) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.skeleton-row {
  height: 36px;
  margin-bottom: 4px;
}

.skeleton-card {
  height: 100px;
}

.skeleton-hero {
  height: 88px;
  border-radius: var(--radius-lg);
  margin-bottom: 28px;
}

/* ── Empty state ────────────────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-muted);
}

.empty-state svg {
  width: 40px;
  height: 40px;
  margin-bottom: 12px;
  opacity: 0.3;
}

.empty-state p {
  font-size: 0.88rem;
}

/* ── Responsive ─────────────────────────────────────────────────────────── */
@media (max-width: 900px) {
  :root {
    --sidebar-w: 56px;
  }

  .sidebar-brand span,
  .sidebar-brand .tag,
  .nav-item span,
  .nav-item .kbd,
  .nav-section-label,
  .sidebar-footer {
    display: none;
  }

  .sidebar-brand {
    justify-content: center;
    padding: 0;
  }

  .nav-item {
    justify-content: center;
    padding: 10px;
  }

  .nav-item.active::before {
    left: 0;
  }

  .dual-col {
    grid-template-columns: 1fr;
  }

  .tva-grid {
    grid-template-columns: 1fr;
  }

  .main {
    padding: 16px;
  }
}

@media (max-width: 600px) {
  .kpi-grid {
    grid-template-columns: 1fr 1fr;
  }

  .filters-bar {
    flex-direction: column;
    align-items: stretch;
  }

  .filter-input.search {
    min-width: unset;
  }
}
