/* Nobody Knows Tour — thème aligné sur mobile/lib/app_theme.dart */
:root {
  --ink: #352a22;
  --ink-muted: rgba(53, 42, 34, 0.65);
  --ink-soft: rgba(53, 42, 34, 0.45);
  --paper: #fffaf5;
  --paper-elevated: #fffcf9;
  --parchment: #fff4e8;
  --pearl: #fffefe;
  --spark: #ff9e6b;
  --apricot: #ffb896;
  --ember: #d88852;
  --bronze: #c07842;
  --bronze-deep: #9a522e;
  --wine: #6b3838;
  --wine-muted: #9a5c5c;
  --sage-fresh: #6e9880;
  --mist: #f0e8dc;
  --gold-highlight: #f5d78e;
  --dawn: #fff1e0;
  --outline: #d4c9bc;
  --error: #9b3b3b;

  --bg: var(--paper);
  --surface: var(--pearl);
  --surface2: var(--paper-elevated);
  --border: rgba(212, 201, 188, 0.55);
  --border-strong: rgba(154, 82, 46, 0.22);
  --text: var(--ink);
  --muted: var(--ink-muted);
  --accent: var(--ember);
  --accent2: var(--bronze-deep);
  --danger: var(--wine-muted);
  --ok: var(--sage-fresh);
  --radius: 20px;
  --radius-sm: 14px;
  --shadow-soft: 0 8px 32px rgba(154, 82, 46, 0.08);
  --shadow-card: 0 12px 40px rgba(154, 82, 46, 0.12);
  --font-display: "Fraunces", Georgia, serif;
  --font-body: "Lora", Georgia, serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  font-family: var(--font-body);
  font-weight: 500;
  -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }

h1, h2, h3, .brand, .page-title {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--ink);
}

/* ── Login ── */
#login-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, var(--dawn) 0%, var(--parchment) 55%, var(--pearl) 100%);
}

#login-screen::before,
#login-screen::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
}

#login-screen::before {
  width: 220px;
  height: 220px;
  top: -80px;
  right: -40px;
  background: radial-gradient(circle, rgba(255, 158, 107, 0.35), transparent 70%);
}

#login-screen::after {
  width: 180px;
  height: 180px;
  bottom: 120px;
  left: -60px;
  background: radial-gradient(circle, rgba(245, 215, 142, 0.28), transparent 70%);
}

.login-card {
  width: min(420px, 100%);
  background: rgba(255, 254, 254, 0.88);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(245, 215, 142, 0.45);
  border-radius: 24px;
  padding: 32px 28px;
  box-shadow: var(--shadow-card);
  position: relative;
  z-index: 1;
}

.login-card h1 {
  margin: 0 0 6px;
  font-size: 1.75rem;
  line-height: 1.15;
  text-align: center;
}

.login-card h1 .accent {
  color: var(--bronze-deep);
}

.brand-mark {
  width: 72px;
  height: 72px;
  margin: 0 auto 18px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--apricot), var(--ember));
  color: var(--pearl);
  box-shadow: 0 8px 18px rgba(216, 136, 82, 0.3);
  border: 2px solid rgba(255, 255, 255, 0.85);
}

.login-card .subtitle {
  margin: 0 0 24px;
  color: var(--ink-soft);
  font-size: 0.95rem;
  line-height: 1.5;
  text-align: center;
}

label {
  display: block;
  font-family: var(--font-body);
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--ink-muted);
  margin-bottom: 6px;
}

input, textarea, select {
  width: 100%;
  background: var(--pearl);
  border: 1px solid rgba(245, 215, 142, 0.45);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 500;
  transition: border-color 0.15s, box-shadow 0.15s;
}

input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--ember);
  box-shadow: 0 0 0 3px rgba(216, 136, 82, 0.18);
}

.field { margin-bottom: 16px; }

button, .btn {
  background: linear-gradient(135deg, var(--apricot), var(--ember));
  color: var(--pearl);
  border: none;
  border-radius: 22px;
  padding: 12px 20px;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: 0.02em;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(216, 136, 82, 0.28);
  transition: filter 0.15s, transform 0.1s;
}

button:hover:not(:disabled) { filter: brightness(1.04); }
button:active:not(:disabled) { transform: translateY(1px); }

button.secondary {
  background: var(--pearl);
  color: var(--bronze-deep);
  border: 1px solid var(--border);
  box-shadow: none;
}

button.secondary:hover:not(:disabled) {
  background: var(--mist);
  filter: none;
}

button.danger {
  background: var(--wine-muted);
  color: var(--pearl);
  box-shadow: 0 4px 12px rgba(107, 56, 56, 0.2);
}

button:disabled { opacity: 0.45; cursor: not-allowed; }

.error {
  color: var(--error);
  font-size: 0.9rem;
  margin-top: 12px;
}

/* ── Shell ── */
#app-shell {
  display: grid;
  grid-template-columns: 248px 1fr;
  min-height: 100vh;
  background: linear-gradient(180deg, var(--dawn) 0%, var(--paper) 18%, var(--paper) 100%);
}

.sidebar {
  background: rgba(255, 254, 254, 0.92);
  border-right: 1px solid var(--border);
  padding: 20px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  box-shadow: 4px 0 24px rgba(154, 82, 46, 0.04);
}

.brand {
  padding: 10px 14px 22px;
  font-size: 1.15rem;
  color: var(--bronze-deep);
  line-height: 1.2;
}

.brand small {
  display: block;
  font-family: var(--font-body);
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--ink-soft);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-top: 4px;
}

.nav-btn {
  text-align: left;
  background: transparent;
  color: var(--ink-muted);
  border: none;
  border-radius: var(--radius-sm);
  padding: 11px 14px;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.92rem;
  box-shadow: none;
  transition: background 0.15s, color 0.15s;
}

.nav-btn:hover:not(.active) {
  background: rgba(240, 232, 220, 0.65);
  color: var(--ink);
  filter: none;
  transform: none;
}

.nav-btn.active {
  background: linear-gradient(135deg, rgba(255, 184, 150, 0.35), rgba(216, 136, 82, 0.18));
  color: var(--bronze-deep);
  border: 1px solid rgba(245, 215, 142, 0.5);
  box-shadow: none;
}

.sidebar-footer {
  margin-top: auto;
  padding: 12px 10px;
  font-size: 0.82rem;
  color: var(--ink-soft);
}

.sidebar-footer #admin-email {
  word-break: break-all;
  color: var(--ink-muted);
}

main {
  padding: 28px 32px 48px;
  overflow: auto;
}

.page-title {
  margin: 0 0 22px;
  font-size: 1.75rem;
  line-height: 1.2;
}

/* ── Cards & panels ── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 16px;
  box-shadow: var(--shadow-soft);
}

.stat-card .label {
  color: var(--ink-soft);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.stat-card .value {
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: 600;
  margin-top: 6px;
  color: var(--bronze-deep);
}

.charts-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-soft);
}

.panel h3 {
  margin: 0 0 14px;
  font-size: 1.05rem;
}

.toolbar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 14px;
  align-items: center;
}

.toolbar input { max-width: 280px; }

/* ── Tables ── */
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

th, td {
  text-align: left;
  padding: 11px 10px;
  border-bottom: 1px solid rgba(53, 42, 34, 0.06);
  vertical-align: top;
}

th {
  color: var(--ink-soft);
  font-weight: 700;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

tr:hover td { background: rgba(255, 241, 224, 0.45); }

.tag {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  background: var(--mist);
  color: var(--ink-muted);
  border: 1px solid rgba(212, 201, 188, 0.4);
}

.tag.ok {
  background: rgba(110, 152, 128, 0.14);
  color: #4a7560;
  border-color: rgba(110, 152, 128, 0.25);
}

.tag.warn {
  background: rgba(216, 136, 82, 0.12);
  color: var(--bronze-deep);
  border-color: rgba(216, 136, 82, 0.25);
}

.pagination {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-top: 14px;
  color: var(--ink-soft);
  font-size: 0.85rem;
}

/* ── Modal ── */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(53, 42, 34, 0.35);
  backdrop-filter: blur(4px);
  display: grid;
  place-items: center;
  z-index: 50;
  padding: 20px;
}

.modal {
  background: var(--pearl);
  border: 1px solid rgba(245, 215, 142, 0.45);
  border-radius: 22px;
  width: min(720px, 100%);
  max-height: 85vh;
  overflow: auto;
  padding: 24px;
  box-shadow: var(--shadow-card);
}

.modal h3 {
  margin: 0 0 12px;
  font-size: 1.25rem;
}

.modal pre {
  white-space: pre-wrap;
  word-break: break-word;
  background: var(--parchment);
  border: 1px solid var(--border);
  padding: 14px;
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 0.88rem;
  line-height: 1.55;
  color: var(--ink);
}

canvas { max-height: 260px; }

.loading {
  color: var(--ink-soft);
  font-style: italic;
}

@media (max-width: 900px) {
  #app-shell { grid-template-columns: 1fr; }
  .sidebar {
    flex-direction: row;
    flex-wrap: wrap;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
  .sidebar-footer { width: 100%; }
  .charts-row { grid-template-columns: 1fr; }
  main { padding: 20px 16px 32px; }
}
