/* DOMOSSE Portail. Vert sapin + gris perle, bandeau sapin (option E). */
:root {
  --sapin: #1f4a3a;
  --sapin-2: #2c634e;
  --sapin-soft: #e3ece6;
  --lin: #dde0e5;
  --lin-2: #eceef2;
  --bg: #f3f4f6;
  --surface: #ffffff;
  --ink: #1b1f1d;
  --ink-2: #4a5059;
  --ink-3: #676d76;
  --line: #e3e6eb;
  --grid: #eef0f3;
  --ok: #2e7d4f;  --ok-bg: #e4f1e8;
  --warn: #a8670f; --warn-bg: #fbf0dc;
  --crit: #b42318; --crit-bg: #fbe5e2;
  --none: #d5d9df;
  /* Bandeau du haut */
  --top-bg: #1f4a3a;
  --top-ink: #ffffff;
  --top-ink-2: #cfe3d8;
  --top-hover: rgba(255, 255, 255, .14);
  --top-sep: rgba(255, 255, 255, .25);
  --radius: 10px;
  --shadow: 0 1px 2px rgba(20, 30, 25, .05);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --sapin: #8fc3a8; --sapin-2: #a9d4bd; --sapin-soft: #1f2e27;
    --lin: #363b42; --lin-2: #262a30; --bg: #121417; --surface: #1a1d21;
    --ink: #eceef0; --ink-2: #b9bec5; --ink-3: #8b9199; --line: #2c3036; --grid: #24282d;
    --top-bg: #163a2d; --top-ink: #ffffff; --top-ink-2: #b9d6c6; --top-hover: rgba(255, 255, 255, .10); --top-sep: rgba(255, 255, 255, .18);
    --ok: #6cc28e; --ok-bg: #1d3226; --warn: #e3a84b; --warn-bg: #3a2c15; --crit: #f0857a; --crit-bg: #3d1e1b;
    --none: #353a41; color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 15px/1.5 "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-variant-numeric: tabular-nums;
}
a { color: var(--sapin); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -.01em; }
h1 { font-size: 24px; }
h2 { font-size: 16px; }
h3 { font-size: 14px; color: var(--ink-2); }
.muted { color: var(--ink-3); }
.small { font-size: 13px; }

/* Logo : « domosse », le 1er o est un anneau, le 2e un disque plein */
.logo { display: inline-flex; align-items: baseline; font-weight: 600; font-size: 21px; letter-spacing: -.02em; color: var(--sapin); }
.logo .o { display: inline-block; width: .56em; height: .56em; border-radius: 50%; margin: 0 .04em; transform: translateY(.02em); }
.logo .ring { border: .11em solid currentColor; }
.logo .disc { background: currentColor; }

/* Barre du haut */
.top { background: var(--top-bg); }
.top .logo { color: var(--top-ink); }
.top .in { max-width: 1240px; margin: 0 auto; padding: 0 16px; height: 60px; display: flex; align-items: center; gap: 28px; }
.top .tag { font-size: 12px; color: var(--top-ink-2); border-left: 1px solid var(--top-sep); padding-left: 12px; margin-left: -14px; }
.top nav { display: flex; gap: 4px; flex: 1; overflow-x: auto; }
.top nav a { color: var(--top-ink-2); padding: 7px 12px; border-radius: 8px; white-space: nowrap; }
.top nav a.on, .top nav a:hover { background: var(--top-hover); color: var(--top-ink); text-decoration: none; }
.top .linkbtn { color: var(--top-ink); }
.top :focus-visible { outline: 2px solid var(--top-ink); outline-offset: 2px; }
.top .who { font-size: 13px; color: var(--top-ink-2); display: flex; gap: 12px; align-items: center; white-space: nowrap; }
.linkbtn { background: none; border: 0; color: var(--sapin); cursor: pointer; font: inherit; padding: 0; }

main { max-width: 1240px; margin: 0 auto; padding: 28px 16px 64px; }
.head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.head p { margin: 4px 0 0; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px 20px; }
main > .card, main > .grid, .noprint > .grid { margin-top: 16px; }
main > .head + *, main > .banner + *, main > .noprint > .flash + .grid { margin-top: 0; }
.noprint { margin-top: 16px; }
.card > h2 { margin-bottom: 14px; display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
@media (max-width: 960px) { .g4, .g5 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g3 { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 760px) {
  .top .in { flex-wrap: wrap; height: auto; padding: 10px 16px; gap: 6px 16px; }
  .top nav { order: 3; flex-basis: 100%; margin: 0 -12px; }
  .top .who { margin-left: auto; }
  .top .tag { display: none; }
}
@media (max-width: 640px) {
  .g2, .g4 { grid-template-columns: minmax(0, 1fr); }
  .g5 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g5 > :first-child { grid-column: 1 / -1; }
  .stat .v { font-size: 24px; }
  .card { padding: 16px; }
  .scroll { margin: 0 -16px; padding: 0 16px; }
  .alerts li { grid-template-columns: auto 1fr; }
  .alerts li > :nth-child(3) { grid-column: 2; }
  .strip { gap: 2px; }
  .strip span { height: 28px; }
  main { padding-top: 20px; }
}

/* Tuiles chiffres */
.stat .k { font-size: 13px; color: var(--ink-3); }
.stat .v { font-size: 28px; font-weight: 600; letter-spacing: -.02em; margin-top: 2px; line-height: 1.2; }
.stat .v small { font-size: 15px; font-weight: 500; color: var(--ink-2); margin-left: 3px; }
.stat .s { font-size: 13px; color: var(--ink-3); margin-top: 2px; }

/* Statuts : toujours icône + libellé, jamais la couleur seule */
.pill { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 500; padding: 2px 10px 2px 8px; border-radius: 999px; white-space: nowrap; }
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill.ok { color: var(--ok); background: var(--ok-bg); }
.pill.warning { color: var(--warn); background: var(--warn-bg); }
.pill.critical { color: var(--crit); background: var(--crit-bg); }
.pill.idle { color: var(--ink-3); background: var(--lin-2); }
.pill.warning::before { border-radius: 1px; transform: rotate(45deg); }
.pill.critical::before { border-radius: 1px; }

.banner { display: flex; gap: 14px; align-items: center; border-radius: var(--radius); padding: 14px 18px; margin-bottom: 16px; border: 1px solid transparent; }
.banner.ok { background: var(--ok-bg); color: var(--ok); }
.banner.warning { background: var(--warn-bg); color: var(--warn); }
.banner.critical { background: var(--crit-bg); color: var(--crit); }
.banner b { color: var(--ink); }
.banner .t { color: var(--ink-2); font-size: 14px; }
.banner .ico { width: 28px; height: 28px; flex: none; }

/* Tableaux */
.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th { text-align: left; font-weight: 500; font-size: 12.5px; color: var(--ink-3); padding: 0 10px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl td { padding: 10px; border-bottom: 1px solid var(--grid); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl .num { text-align: right; white-space: nowrap; }
.tbl tbody tr:hover td { background: var(--lin-2); }
.tbl tfoot td { font-weight: 600; border-top: 1px solid var(--line); border-bottom: 0; }
.scroll { overflow-x: auto; margin: 0 -20px; padding: 0 20px; }

/* Graphiques */
.chart { position: relative; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart .area { fill: var(--sapin); fill-opacity: .12; }
.chart .line { fill: none; stroke: var(--sapin); stroke-width: 2; stroke-linejoin: round; }
.chart .gridl { stroke: var(--grid); stroke-width: 1; }
.chart .base { stroke: var(--line); stroke-width: 1; }
.chart text { fill: var(--ink-3); font-size: 11px; }
.chart .xh { stroke: var(--ink-3); stroke-width: 1; stroke-dasharray: 3 3; opacity: 0; }
.chart .dot { fill: var(--sapin); stroke: var(--surface); stroke-width: 2; opacity: 0; }
.chart .hit { fill: transparent; cursor: crosshair; }
.tip { position: absolute; pointer-events: none; background: var(--ink); color: var(--surface); font-size: 12px; padding: 6px 9px; border-radius: 6px; white-space: nowrap; opacity: 0; transform: translate(-50%, -110%); transition: opacity .08s; z-index: 5; }
.tip b { font-weight: 600; }
.chart-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 6px; }
.chart-head .now { font-weight: 600; }

/* Frise de disponibilité */
.strip { display: grid; grid-template-columns: repeat(31, 1fr); gap: 3px; position: relative; }
.strip span { height: 34px; border-radius: 3px; background: var(--none); cursor: default; }
.strip span.ok { background: var(--ok); }
.strip span.warning { background: var(--warn); }
.strip span.critical { background: var(--crit); }
.strip span.future { background: transparent; border: 1px dashed var(--line); }
.strip-legend { display: flex; gap: 16px; font-size: 12.5px; color: var(--ink-3); margin-top: 10px; flex-wrap: wrap; }
.strip-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 6px; vertical-align: -1px; }

/* Listes d'alertes */
.alerts { list-style: none; margin: 0; padding: 0; }
.alerts li { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: start; padding: 11px 0; border-bottom: 1px solid var(--grid); }
.alerts li:last-child { border-bottom: 0; }
.alerts .d { color: var(--ink-3); font-size: 13px; }
.empty { color: var(--ink-3); font-size: 14px; padding: 6px 0; }

/* Formulaires */
label { display: block; font-size: 13px; color: var(--ink-2); margin-bottom: 4px; }
input, textarea, select { width: 100%; font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; }
textarea { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 12.5px; min-height: 260px; }
input:focus, textarea:focus, select:focus { outline: 2px solid var(--sapin); outline-offset: -1px; }
.btn { display: inline-flex; align-items: center; gap: 6px; background: var(--sapin); color: var(--surface); border: 0; border-radius: 8px; padding: 8px 14px; font: inherit; font-weight: 500; cursor: pointer; text-decoration: none; }
.btn:hover { background: var(--sapin-2); text-decoration: none; }
.btn.ghost { background: transparent; color: var(--sapin); border: 1px solid var(--line); }
.btn.ghost:hover { background: var(--lin-2); }
.btn.sm { padding: 4px 10px; font-size: 13px; }
.row { display: flex; gap: 12px; align-items: end; flex-wrap: wrap; }
.row > div { flex: 1; min-width: 160px; }
.secret { font-family: ui-monospace, Menlo, monospace; background: var(--lin-2); padding: 10px 12px; border-radius: 8px; word-break: break-all; font-size: 13px; }
.flash { background: var(--sapin-soft); border: 1px solid var(--line); padding: 12px 16px; border-radius: var(--radius); margin-bottom: 16px; }
details summary { cursor: pointer; color: var(--sapin); font-weight: 500; }

.monthnav { display: inline-flex; align-items: center; gap: 4px; }
.monthnav span { min-width: 130px; text-align: center; font-weight: 500; }

/* Connexion */
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login .card { width: 100%; max-width: 380px; padding: 32px; }
.login .logo { font-size: 30px; }
.login-brand { display: flex; align-items: center; gap: 14px; margin-bottom: 10px; }
.login-space { font-size: 24px; font-weight: 500; letter-spacing: -.01em; color: var(--ink-2); padding-left: 14px; border-left: 1px solid var(--line); line-height: 1.2; }
.login form > div { margin-top: 14px; }
.err { color: var(--crit); font-size: 14px; margin-top: 10px; }

/* Relevé mensuel imprimable */
.report { max-width: 860px; margin: 0 auto; }
.report .sheet { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 40px 44px; }
.report .rh { display: flex; justify-content: space-between; align-items: flex-start; gap: 24px; padding-bottom: 22px; border-bottom: 2px solid var(--sapin); margin-bottom: 24px; }
.report .rh .logo { font-size: 26px; }
.report section { margin-top: 26px; }
.report section h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--sapin); margin-bottom: 10px; }
.report .total { display: flex; justify-content: flex-end; margin-top: 10px; }
.report .total table td { padding: 4px 0 4px 32px; text-align: right; }
.report .total tr:last-child td { font-size: 18px; font-weight: 600; border-top: 1px solid var(--line); padding-top: 8px; }
.toolbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; gap: 12px; flex-wrap: wrap; }
@media print {
  .top, .toolbar, .noprint { display: none !important; }
  body { background: #fff; color: #000; font-size: 12px; }
  main { padding: 0; max-width: none; }
  .report .sheet { border: 0; padding: 0; }
  .strip span { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .pill { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* Onglets d'un client */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin: -6px 0 18px; overflow-x: auto; }
.tabs a { padding: 9px 14px; color: var(--ink-2); border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs a:hover { color: var(--ink); text-decoration: none; }
.tabs a.on { color: var(--sapin); border-bottom-color: var(--sapin); font-weight: 500; }
.head .muted .pill { vertical-align: 1px; }

/* Liste des clients */
.filter { margin-bottom: 12px; max-width: 420px; }
.rowlink { cursor: pointer; }
.opts { display: flex; flex-wrap: wrap; gap: 4px; max-width: 260px; }
.tag-opt { font-size: 12px; background: var(--surface); border: 1px solid var(--line); color: var(--ink-2); padding: 1px 8px; border-radius: 999px; white-space: nowrap; }
details.card > summary { font-weight: 600; font-size: 16px; color: var(--ink); list-style: none; display: flex; justify-content: space-between; align-items: center; }
details.card > summary::-webkit-details-marker { display: none; }
details.card > summary::after { content: "+"; font-weight: 400; font-size: 20px; color: var(--sapin); }
details.card[open] > summary::after { content: "–"; }

/* Fiche client */
.dl { display: grid; grid-template-columns: 150px 1fr; gap: 9px 16px; margin: 0; font-size: 14px; }
.dl dt { color: var(--ink-3); }
.dl dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.note { margin-top: 14px; padding: 10px 12px; background: var(--lin-2); border-radius: 8px; font-size: 13.5px; color: var(--ink-2); white-space: pre-wrap; }
.checks { list-style: none; margin: 8px 0 0; padding: 0; font-size: 14px; }
.checks li { display: flex; justify-content: space-between; gap: 12px; padding: 7px 0 7px 24px; border-bottom: 1px solid var(--grid); position: relative; }
.checks li:last-child { border-bottom: 0; }
.checks li.inc::before { content: ""; position: absolute; left: 3px; top: 12px; width: 9px; height: 5px; border-left: 2px solid var(--ok); border-bottom: 2px solid var(--ok); transform: rotate(-45deg); }
.checks li.off { color: var(--ink-3); }
.checks li.off::before { content: ""; position: absolute; left: 3px; top: 15px; width: 10px; border-top: 2px solid var(--none); }
.checks.plain li { padding-left: 0; }
.checks b { font-weight: 500; white-space: nowrap; }
.grid.tight { gap: 24px; }
.small-v { font-size: 20px !important; padding-top: 6px; }
.meter-row .meter-head { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; color: var(--ink-2); margin-bottom: 6px; }
.meter-row .meter-head b { color: var(--ink); font-weight: 600; white-space: nowrap; }
.meter { height: 8px; background: var(--lin-2); border-radius: 4px; overflow: hidden; margin-bottom: 5px; }
.meter i { display: block; height: 100%; background: var(--sapin); border-radius: 4px; }
.meter.hi i { background: var(--warn); }
.banner.slim { padding: 10px 14px; margin-bottom: 18px; }
.banner.slim .ico { width: 22px; height: 22px; }
.kv { list-style: none; padding: 0; margin: 16px 0 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 10px; }
.kv li { background: var(--lin-2); border-radius: 8px; padding: 10px 12px; font-size: 13.5px; display: flex; flex-direction: column; }
.kv li span { color: var(--ink-3); }
.fh { margin: 20px 0 8px; color: var(--sapin); font-size: 13px; text-transform: uppercase; letter-spacing: .05em; }
.form-tbl td { padding: 6px 8px; border: 0; }
.form-tbl tbody tr:hover td { background: none; }
.form-tbl td:first-child { width: 50%; }
.check { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--ink); margin: 0; }
.check input { width: auto; }
textarea.notes { font-family: inherit; font-size: 14px; min-height: 90px; }
@media (max-width: 640px) { .dl { grid-template-columns: 1fr; gap: 2px 0; } .dl dd { margin-bottom: 8px; } }

/* Comptes */
.acts { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
main.narrow { max-width: 720px; }
.top .who a { color: var(--top-ink-2); }
.top .who a.on, .top .who a:hover { color: var(--top-ink); }

/* Ticketing */
.pill.info { color: var(--sapin); background: var(--sapin-soft); }
.nb { display: inline-block; min-width: 18px; padding: 0 5px; margin-left: 2px; border-radius: 9px; background: #fff; color: var(--top-bg); font-size: 11.5px; font-weight: 600; line-height: 18px; text-align: center; vertical-align: 1px; }
.nowrap { white-space: nowrap; }
.dot-todo { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--sapin); margin-right: 6px; vertical-align: 1px; }
.filters { display: flex; gap: 10px; align-items: end; flex-wrap: wrap; margin-bottom: 14px; }
.filters > div { min-width: 150px; }
.filters .grow { flex: 1; min-width: 200px; }
.stack { display: flex; flex-direction: column; gap: 14px; }
textarea.msg { font-family: inherit; font-size: 14.5px; min-height: 150px; resize: vertical; }
input[type=file] { padding: 6px; background: var(--bg); }
.impacts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.impact { display: flex; flex-direction: column; gap: 2px; border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px 10px 36px; position: relative; cursor: pointer; margin: 0; color: var(--ink); }
.impact input { position: absolute; left: 12px; top: 13px; width: auto; accent-color: var(--sapin); }
.impact span { font-size: 12.5px; color: var(--ink-3); }
.impact:has(input:checked) { border-color: var(--sapin); background: var(--sapin-soft); }
.tgrid { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 16px; align-items: start; }
.tgrid > div > .card + .card, .tgrid aside .card + .card { margin-top: 16px; }
@media (max-width: 960px) { .tgrid { grid-template-columns: minmax(0, 1fr); } .tgrid aside { order: -1; } }
@media (max-width: 640px) { .impacts { grid-template-columns: minmax(0, 1fr); } }
.thread { display: flex; flex-direction: column; gap: 12px; }
.msg { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; background: var(--surface); }
.msg-staff { border-left: 3px solid var(--sapin); }
.msg-client { border-left: 3px solid var(--lin); }
.msg-note { background: var(--warn-bg); border-color: transparent; border-left: 3px solid var(--warn); }
.note-label { font-size: 12px; font-weight: 600; color: var(--warn); margin-bottom: 6px; }
.mh { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; flex-wrap: wrap; }
.mh .muted { margin-left: auto; }
.av { width: 26px; height: 26px; border-radius: 50%; background: var(--lin-2); color: var(--ink-2); display: inline-grid; place-items: center; font-size: 11px; font-weight: 600; }
.msg-staff .av { background: var(--sapin); color: #fff; }
.badge { font-size: 11px; font-weight: 600; color: var(--sapin); background: var(--sapin-soft); padding: 1px 7px; border-radius: 999px; }
.mb { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 14.5px; line-height: 1.55; }
.files { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.file { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); border-radius: 8px; padding: 4px 10px; font-size: 13px; background: var(--surface); }
.file:hover { text-decoration: none; border-color: var(--sapin); }
.fi { color: var(--ink-3); }
.ev { text-align: center; font-size: 12.5px; color: var(--ink-3); padding: 2px 0; }
.dl.one { grid-template-columns: 110px minmax(0, 1fr); }
.dl dd .pill { white-space: normal; }
