/* Palette identique au thème "dark" du Qist desktop (voir _THEMES dans
   qist.py) — même app, même identité visuelle sur PC et sur le web. */
:root {
  --bg: #07111f;
  --surface: #0c1a2e;
  --surface-2: #101f35;
  --sidebar: #060e1c;
  --border: #182840;
  --entry-bg: #081220;
  --tag-bg: #152240;
  --hover-bg: #1c3050;
  --text: #e8eeff;
  --muted: #7a8db0;
  --accent: #4fd1c5;
  --accent-2: #5b8af5;
  --success: #2ed573;
  --danger: #ff4d6d;
  --warning: #ffa940;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
}

a { color: var(--accent); }

.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 28px;
  width: 100%;
  max-width: 360px;
}

.login-card h1 { color: var(--accent); margin: 0 0 20px; font-size: 20px; }

.field-row { display: flex; gap: 8px; margin-bottom: 14px; }

input, select, textarea, button {
  font-size: 14px;
  font-family: inherit;
  background: var(--entry-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  padding: 9px 12px;
}

input, select, textarea { width: 100%; }
textarea { resize: vertical; min-height: 60px; }

button { cursor: pointer; white-space: nowrap; background: var(--tag-bg); }
button:hover { border-color: var(--accent); background: var(--hover-bg); }

.btn-primary {
  background: var(--accent);
  color: #07111f;
  border: none;
  font-weight: 700;
}
.btn-primary:hover { opacity: 0.9; background: var(--accent); }

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

.sidebar {
  width: 220px;
  flex-shrink: 0;
  background: var(--sidebar);
  border-right: 1px solid var(--border);
  padding: 20px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sidebar h1 { color: var(--accent); font-size: 18px; margin: 0 12px 16px; }

.nav-item {
  display: block;
  padding: 10px 12px;
  border-radius: 8px;
  color: var(--text);
  text-decoration: none;
  background: transparent;
  border: 1px solid transparent;
  text-align: left;
  font-size: 13.5px;
}
.nav-item:hover { background: var(--hover-bg); }
.nav-item.active { background: var(--hover-bg); border-color: var(--accent); color: var(--accent); }

.sidebar-footer { margin-top: auto; padding: 0 12px; }
.sidebar-footer button { width: 100%; }

.main {
  flex: 1;
  padding: 24px 28px;
  overflow-x: auto;
}

.main h2 { margin: 0 0 4px; font-size: 22px; }
.main .muted { color: var(--muted); font-size: 13px; margin-bottom: 18px; }

.card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px 20px;
  margin-bottom: 18px;
}

.stat-row { display: flex; gap: 14px; flex-wrap: wrap; margin-bottom: 18px; }
.stat-tile {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px 20px;
  min-width: 140px;
}
.stat-tile .label { color: var(--muted); font-size: 12px; text-transform: uppercase; }
.stat-tile .value { font-size: 22px; font-weight: 700; margin-top: 4px; color: var(--accent); }

.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { border-collapse: collapse; width: 100%; min-width: 480px; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); font-size: 13.5px; }
th { color: var(--muted); font-weight: 600; text-transform: uppercase; font-size: 11px; }
tr.pending-row { opacity: 0.75; }

.badge { display: inline-block; padding: 2px 8px; border-radius: 6px; font-size: 12px; font-weight: 600; }
.badge-pending { background: #251a00; color: var(--warning); }
.badge-status { background: var(--tag-bg); }

.toolbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; gap: 10px; }

.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.6);
  display: flex; align-items: center; justify-content: center; z-index: 50; padding: 20px;
}
.modal-overlay[hidden] { display: none; }
.modal {
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
  padding: 22px; width: 100%; max-width: 440px; max-height: 85vh; overflow-y: auto;
}
.modal h3 { margin: 0 0 16px; }
.modal .form-field { margin-bottom: 12px; }
.modal .form-field label { display: block; font-size: 12.5px; color: var(--muted); margin-bottom: 5px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 16px; }

.toast {
  position: fixed; top: 16px; right: 16px; z-index: 100;
  background: var(--tag-bg); border: 1px solid var(--accent); color: var(--text);
  padding: 12px 18px; border-radius: 10px; font-size: 13.5px; max-width: 320px;
}
.toast[hidden] { display: none; }

.empty { color: var(--muted); font-size: 13.5px; padding: 20px 0; }

@media (max-width: 720px) {
  .app-shell { flex-direction: column; }
  .sidebar { width: 100%; flex-direction: row; flex-wrap: wrap; border-right: none; border-bottom: 1px solid var(--border); }
  .sidebar h1 { width: 100%; }
  .sidebar-footer { margin-top: 0; display: flex; gap: 8px; width: 100%; }
  .main { padding: 16px; }
}

/* Couleurs de statut identiques à STATUS_COLORS dans qist.py */
.status-badge { display: inline-block; padding: 2px 9px; border-radius: 6px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.status-payee, .status-accepte { background: #062214; color: var(--success); }
.status-en_retard, .status-refuse { background: #280816; color: var(--danger); }
.status-partiellement_payee { background: #251a00; color: var(--warning); }
.status-emise { background: #081630; color: var(--accent-2); }
.status-converti { background: #081630; color: var(--accent); }
.status-brouillon, .status-expire { background: #141830; color: var(--muted); }
