/* Comptabilité La Niche à Luna : styles de base (clair / sombre, mobile) */
/* Palette reprise du tableau de bord actuel (dashboard_actuel.html) */
:root {
  --bg: #f4f6f6;
  --surface: #ffffff;
  --surface-2: #e8eded;
  --text: #17262b;
  --muted: #5d6f75;
  --border: #dbe3e4;
  --primary: #1d6b66;
  --primary-soft: #dcefed;
  --primary-text: #ffffff;
  --danger: #a3262a;
  --ok-bg: #dff3e6; --ok-fg: #1b7a43;
  --err-bg: #fbe0e0; --err-fg: #a3262a;
  --info-bg: #e0ebfa; --info-fg: #2b5c9e;
  --amber-bg: #fdebc4; --amber-fg: #8a5a00;
  --font-display: 'Space Grotesk', system-ui, sans-serif;
  --font-body: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --radius: 8px;
  --shadow: none;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1a1d; --surface: #17262b; --surface-2: #223237; --text: #e6eeee; --muted: #93a6ab;
    --border: #2a3d43; --primary: #5cc4bb; --primary-soft: #1d3a3b; --primary-text: #0f1a1d; --danger: #f08a8d;
    --ok-bg: #16382a; --ok-fg: #6fd49a; --err-bg: #44191b; --err-fg: #f08a8d;
    --info-bg: #18304d; --info-fg: #8db7f0; --amber-bg: #40320f; --amber-fg: #f0c15e;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0f1a1d; --surface: #17262b; --surface-2: #223237; --text: #e6eeee; --muted: #93a6ab;
  --border: #2a3d43; --primary: #5cc4bb; --primary-soft: #1d3a3b; --primary-text: #0f1a1d; --danger: #f08a8d;
  --ok-bg: #16382a; --ok-fg: #6fd49a; --err-bg: #44191b; --err-fg: #f08a8d;
  --info-bg: #18304d; --info-fg: #8db7f0; --amber-bg: #40320f; --amber-fg: #f0c15e;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: var(--font-body); font-size: 14px; line-height: 1.45;
}
a { color: var(--primary); }
h1 { font-family: var(--font-display); font-size: 24px; letter-spacing: -.01em; margin: 0 0 1rem; }
h2 { font-size: 1.15rem; margin: 0 0 .75rem; }
code { font-family: ui-monospace, Consolas, monospace; }

.topbar {
  display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1.25rem;
  padding: .6rem 1rem; background: var(--surface); border-bottom: 1px solid var(--border);
}
.brand { font-weight: 700; color: var(--text); text-decoration: none; }
.brand span { color: var(--primary); }
.nav { display: flex; flex-wrap: wrap; gap: .25rem; }
.nav a { padding: .35rem .65rem; border-radius: 8px; text-decoration: none; color: var(--muted); }
.nav a:hover { background: var(--surface-2); color: var(--text); }
.nav a.active { background: var(--surface-2); color: var(--text); font-weight: 600; }
.nav-count { display: inline-block; min-width: 1.4em; padding: 0 .35em; margin-left: .2em; border-radius: 999px; background: var(--primary); color: var(--primary-text); font-size: .75rem; font-weight: 600; text-align: center; line-height: 1.4; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: .5rem; }
.who { color: var(--muted); text-decoration: none; font-size: .9rem; }

.container { max-width: 1240px; margin: 0 auto; padding: 1.25rem 1rem 3rem; }
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1.25rem; box-shadow: var(--shadow); margin-bottom: 1.25rem;
}
.narrow { max-width: 460px; margin-left: auto; margin-right: auto; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.inline { display: inline; }

.form { display: grid; gap: .9rem; }
.form label { display: grid; gap: .3rem; font-weight: 500; }
input, select, textarea {
  font: inherit; color: var(--text); background: var(--surface);
  border: 1px solid var(--border); border-radius: 8px; padding: .55rem .7rem; width: 100%;
}
select { width: auto; }
.form select { width: 100%; }
input:focus, select:focus, textarea:focus, .btn:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }

.btn {
  font: inherit; cursor: pointer; border-radius: 8px; padding: .5rem .9rem;
  border: 1px solid var(--border); background: var(--surface-2); color: var(--text);
}
.btn-primary { background: var(--primary); color: var(--primary-text); border-color: var(--primary); font-weight: 600; }
.btn-ghost { background: transparent; }
.btn-danger { background: transparent; color: var(--danger); border-color: var(--danger); }
.btn-icon { background: none; border: 1px solid var(--border); border-radius: 8px; color: var(--text); cursor: pointer; padding: .3rem .55rem; }

.alert { padding: .75rem 1rem; border-radius: 8px; margin-bottom: 1rem; }
.alert-ok { background: var(--ok-bg); color: var(--ok-fg); }
.alert-err { background: var(--err-bg); color: var(--err-fg); }
.alert-info { background: var(--info-bg); color: var(--info-fg); }
.temp-pw { display: inline-block; margin: .35rem 0; padding: .2rem .5rem; background: var(--surface); color: var(--text); border-radius: 6px; font-size: 1.05rem; user-select: all; }

.table-wrap { overflow-x: auto; padding: 0; }
.table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.table th, .table td { padding: .6rem .75rem; border-bottom: 1px solid var(--border); text-align: left; vertical-align: middle; }
.table th { background: var(--surface-2); font-weight: 600; white-space: nowrap; }
.table tr.inactive td { color: var(--muted); }
.actions { white-space: nowrap; }
.actions .btn { padding: .3rem .6rem; font-size: .85rem; }

.badge { display: inline-block; padding: .1rem .5rem; border-radius: 999px; font-size: .8rem; font-weight: 600; white-space: nowrap; }
.badge-green { background: var(--ok-bg); color: var(--ok-fg); }
.badge-amber { background: var(--amber-bg); color: var(--amber-fg); }
.badge-gray { background: var(--surface-2); color: var(--muted); }

.table th.r, .table td.r { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.table th { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.sup { font-weight: 500; }
.nowrap { white-space: nowrap; }
.pad { padding: 1rem 1rem 0; }
.table-wrap h2.pad { margin-bottom: .5rem; }
.empty { padding: 28px; text-align: center; color: var(--muted); }
.form-row { display: flex; flex-wrap: wrap; gap: .75rem; align-items: center; }
.form-row input[type=file] { width: auto; flex: 1 1 260px; }
.button-row { display: flex; flex-wrap: wrap; gap: .75rem; align-items: center; margin-bottom: 1.25rem; }
.btn-sm { padding: .2rem .55rem; font-size: .8rem; }
.version-line { display: flex; flex-wrap: wrap; gap: .25rem .6rem; align-items: center; padding: .15rem 0; }
.warnings { margin: 0; padding-left: 1.2rem; display: grid; gap: .5rem; }
.warnings ul { margin: .2rem 0 0; padding-left: 1.1rem; }
.table tfoot .total-row td { font-weight: 600; background: var(--surface-2); border-bottom: 0; }
.filters-row { margin-bottom: 1rem; }
.inline-label { display: flex; align-items: center; gap: .4rem; font-size: .9rem; color: var(--muted); }
.table tr.warn-row td { background: var(--amber-bg); }
.pager { display: flex; gap: .75rem; align-items: center; justify-content: center; margin-bottom: 1.25rem; }
a.btn { text-decoration: none; display: inline-block; }
.rename-form { display: flex; gap: .35rem; align-items: center; }
.rename-form input { width: 11rem; padding: .3rem .5rem; }
.btn.confirm-armed, button.confirm-armed { background: var(--danger); color: #fff; border-color: var(--danger); }
.confirm-msg { display: block; margin-top: .3rem; font-size: .8rem; color: var(--err-fg); white-space: normal; max-width: 22rem; }
ul.tight { margin: .4rem 0 0; padding-left: 1.2rem; }

@media (max-width: 640px) {
  .topbar-right { margin-left: 0; width: 100%; justify-content: flex-end; }
  .card { padding: 1rem; }
  .actions { white-space: normal; }
  .actions form { display: block; margin: .25rem 0; }
}
