/* OrdoPIM : style « Classique » (par défaut). Les thèmes Apple et Moderne viendront hors MVP. */
:root {
  --bg: #f4f6f9; --surface: #fff; --line: #d5dbe3; --text: #1d2733; --muted: #5d6b7c;
  --accent: #1f3a5f; --accent-soft: #e8eef6; --hover: #f0f4f9;
  --surface: #ffffff; --head-bg: #eef2f7; --head2-bg: #fafbfc; --track: #e3e8ee; --radius: 6px; --radius-s: 4px;
  --ok: #2e7d4f; --ok-soft: #e3f2e9; --warn: #a86a0a; --warn-soft: #fbf0d9; --bad: #b3382c; --bad-soft: #f8e1de;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--text); font: 14px/1.5 "Segoe UI", system-ui, -apple-system, sans-serif; }
h1, h2, h3 { margin: 0; }
button, input, select { font: inherit; color: inherit; }
input, select { border: 1px solid var(--line); border-radius: 4px; padding: 6px 8px; background: var(--surface); max-width: 100%; }
input:focus, select:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
.btn { border: 1px solid var(--line); background: var(--surface); padding: 7px 14px; border-radius: 4px; cursor: pointer; }
.btn:hover { background: var(--hover); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.btn[disabled] { opacity: .6; cursor: default; }
.msg { min-height: 20px; font-size: 13px; }
.msg.err { color: var(--bad); }
.msg.info { color: var(--muted); }
.spin { display: inline-block; width: 12px; height: 12px; margin-right: 6px; border: 2px solid #fff6; border-top-color: #fff; border-radius: 50%; animation: sp .7s linear infinite; vertical-align: -2px; }
@keyframes sp { to { transform: rotate(360deg); } }

/* Connexion */
body.login { display: grid; place-items: center; min-height: 100vh; padding: 16px; }
.wrap { width: 100%; max-width: 380px; }
.brand { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.brand .mark { width: 44px; height: 44px; border-radius: 8px; background: var(--accent); display: grid; place-items: center; }
.brand h1 { font-size: 22px; }
.brand p { margin: 0; color: var(--muted); }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 20px; }
label.f { display: block; margin-bottom: 12px; color: var(--muted); font-size: 12px; }
label.f input, label.f select { display: block; width: 100%; margin-top: 4px; color: var(--text); font-size: 14px; }
.card .btn.primary { width: 100%; margin-top: 4px; }
.foot { color: var(--muted); font-size: 12px; margin-top: 14px; }

/* Application */
.top { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; background: var(--accent); color: #fff; padding: 10px 20px; }
.top .name { font-weight: 700; font-size: 16px; }
.top .tenant { opacity: .85; }
.top .spacer { flex: 1; }
.top .who { opacity: .9; font-size: 13px; }
.top .btn { background: transparent; border-color: #ffffff66; color: #fff; padding: 4px 10px; }
.demo { background: var(--warn-soft); color: var(--warn); padding: 6px 20px; font-size: 13px; border-bottom: 1px solid var(--line); }
main { padding: 16px 20px 40px; max-width: 1200px; margin: 0 auto; }
.quotas { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; margin-bottom: 16px; }
.quota { background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 12px 14px; }
.quota .label { color: var(--muted); font-size: 12px; }
.quota .val { font-size: 18px; font-weight: 600; }
.bar { height: 6px; background: var(--track); border-radius: 3px; overflow: hidden; margin-top: 6px; }
.bar i { display: block; height: 100%; background: var(--accent); }
.bar i.warn { background: var(--warn); } .bar i.full { background: var(--bad); }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 14px; }
.tabs button { border: 0; background: none; padding: 9px 14px; cursor: pointer; color: var(--muted); border-bottom: 3px solid transparent; margin-bottom: -1px; }
.tabs button.on { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 14px; margin-bottom: 14px; }
.panel h3 { font-size: 14px; margin-bottom: 10px; }
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-end; }
.row .grow { flex: 1; min-width: 160px; }
.tablewrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); }
table.g { border-collapse: collapse; width: 100%; min-width: 640px; }
table.g th, table.g td { text-align: left; padding: 7px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.g thead tr.lab th { background: var(--head-bg); cursor: pointer; user-select: none; }
table.g thead tr.lab th.sorted { background: var(--accent-soft); }
table.g thead tr.lab th .ar { color: var(--muted); font-size: 11px; margin-left: 4px; }
table.g thead tr.flt th { background: var(--head2-bg); padding: 4px 6px; }
table.g thead tr.flt input, table.g thead tr.flt select { width: 100%; font-size: 12px; padding: 3px 5px; }
table.g tbody tr:hover { background: var(--hover); }
.chip { display: inline-block; font-size: 11px; padding: 1px 8px; border-radius: 10px; font-weight: 600; background: #e8ecf1; }
.chip.ok { background: var(--ok-soft); color: var(--ok); }
.chip.warn { background: var(--warn-soft); color: var(--warn); }
.chip.bad { background: var(--bad-soft); color: var(--bad); }
.pager { display: flex; justify-content: space-between; align-items: center; margin-top: 8px; color: var(--muted); font-size: 12px; }
.link { background: none; border: 0; color: var(--accent); cursor: pointer; padding: 0; text-decoration: underline; }
.empty { text-align: center; color: var(--muted); padding: 18px; }

/* Modèle de données */
.subtabs { display: flex; gap: 6px; margin-bottom: 12px; }
.subtabs button { border: 1px solid var(--line); background: var(--surface); padding: 6px 14px; border-radius: 16px; cursor: pointer; }
.subtabs button.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.chip.pick { border: 1px solid var(--line); background: var(--surface); font-weight: 500; padding: 4px 12px; cursor: pointer; }
.chip.pick.on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); font-weight: 600; }
.chip .x { border: 0; background: none; cursor: pointer; margin-left: 6px; color: var(--muted); padding: 0; }
.muted { color: var(--muted); }
.chk { display: flex; align-items: center; gap: 6px; padding-bottom: 7px; }
textarea { border: 1px solid var(--line); border-radius: 4px; padding: 6px 8px; font: inherit; width: 100%; margin-top: 4px; resize: vertical; }
label.f textarea { display: block; }
