/* Codesia Admin - console d'ops mobile, thème sombre */
:root {
  --bg: #0b0e14;
  --panel: #121826;
  --panel-2: #0f141f;
  --line: #1e2635;
  --txt: #e6eaf2;
  --dim: #8b95a7;
  --acc: #22d3ee;   /* cyan terminal */
  --ok: #34d399;
  --warn: #fbbf24;
  --err: #f87171;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html { background: var(--bg); }
body {
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--txt);
  background: var(--bg);
  min-height: 100dvh;
  padding-bottom: calc(64px + env(safe-area-inset-bottom));
}

/* ---- header ---- */
header {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand-mark { font-family: var(--mono); color: var(--acc); font-weight: 700; }
.brand-name { font-weight: 650; letter-spacing: .02em; }
.brand-dim { color: var(--dim); font-weight: 400; }
.head-right { display: flex; align-items: center; gap: 12px; }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.dot-on  { background: var(--ok); box-shadow: 0 0 8px var(--ok); }
.dot-off { background: var(--err); }
.icon-btn {
  background: var(--panel); color: var(--txt); border: 1px solid var(--line);
  border-radius: 10px; width: 40px; height: 40px; font-size: 18px;
}

/* ---- contenu ---- */
main { padding: 14px 14px 20px; display: grid; gap: 10px; }
.section-label {
  color: var(--dim); font-size: 12px; text-transform: uppercase;
  letter-spacing: .12em; margin: 8px 2px 0;
}
.card {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 14px; padding: 12px 14px;
  display: grid; gap: 8px;
}
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.card-title { font-weight: 600; overflow-wrap: anywhere; }
.meta { color: var(--dim); font-size: 13px; font-family: var(--mono); display: flex; flex-wrap: wrap; gap: 4px 12px; }
.dim { color: var(--dim); }
.mono { font-family: var(--mono); }

/* pastilles de statut */
.pill {
  font-family: var(--mono); font-size: 12px; padding: 3px 9px;
  border-radius: 999px; border: 1px solid var(--line); white-space: nowrap;
}
.pill-running { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 45%, transparent); animation: pulse 1.4s infinite; }
.pill-waiting { color: var(--dim); }
.pill-on  { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 45%, transparent); }
.pill-off { color: var(--dim); }
.pill-err { color: var(--err); border-color: color-mix(in srgb, var(--err) 45%, transparent); }
@keyframes pulse { 50% { opacity: .45; } }

/* boutons */
.btn {
  min-height: 44px; padding: 0 16px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--panel-2);
  color: var(--txt); font-size: 15px; font-weight: 550;
}
.btn:active { transform: scale(.98); }
.btn-primary { background: color-mix(in srgb, var(--acc) 18%, var(--panel-2)); border-color: var(--acc); color: var(--acc); }
.btn-danger  { background: color-mix(in srgb, var(--err) 14%, var(--panel-2)); border-color: var(--err); color: var(--err); }
.btn-ok      { background: color-mix(in srgb, var(--ok) 14%, var(--panel-2)); border-color: var(--ok); color: var(--ok); }
.btn[disabled] { opacity: .4; }
.row { display: flex; gap: 10px; }
.row .btn { flex: 1; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.actions .btn { flex: 1; min-width: 120px; }

/* recherche */
.search {
  width: 100%; min-height: 44px; padding: 0 14px;
  background: var(--panel-2); border: 1px solid var(--line);
  border-radius: 12px; color: var(--txt); font-size: 15px;
}
.search::placeholder { color: var(--dim); }

/* état vide */
.empty {
  text-align: center; color: var(--dim); padding: 48px 16px;
  font-family: var(--mono); font-size: 14px;
}

/* switch inclure waiting */
.toggle-line { display: flex; align-items: center; justify-content: space-between; padding: 2px 4px; color: var(--dim); font-size: 14px; }

/* ---- navigation basse ---- */
nav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 10;
  display: grid; grid-template-columns: repeat(3, 1fr);
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(10px);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.tab {
  background: none; border: none; color: var(--dim);
  padding: 10px 4px 12px; font-size: 12px; display: grid; gap: 3px; justify-items: center;
  position: relative;
}
.tab-ico { font-size: 18px; }
.tab.active { color: var(--acc); }
.badge {
  position: absolute; top: 6px; right: 22%;
  background: var(--warn); color: #111; font-size: 11px; font-weight: 700;
  min-width: 18px; height: 18px; border-radius: 9px; line-height: 18px; padding: 0 4px;
}

/* ---- overlays ---- */
.overlay {
  position: fixed; inset: 0; z-index: 20;
  background: rgba(4, 6, 10, .72); backdrop-filter: blur(4px);
  display: flex; align-items: flex-end; justify-content: center;
}
.sheet {
  width: 100%; max-width: 520px;
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 18px 18px 0 0; padding: 22px 18px calc(22px + env(safe-area-inset-bottom));
  display: grid; gap: 14px;
}
.sheet h2 { font-size: 18px; }
.sheet input {
  min-height: 46px; padding: 0 14px; border-radius: 12px;
  background: var(--panel-2); border: 1px solid var(--line); color: var(--txt); font-size: 16px;
}

/* toast */
.toast {
  position: fixed; top: calc(64px + env(safe-area-inset-top)); left: 50%; transform: translateX(-50%);
  z-index: 30; background: var(--panel); border: 1px solid var(--line); border-left: 3px solid var(--acc);
  border-radius: 12px; padding: 10px 16px; font-size: 14px; max-width: 92vw;
  box-shadow: 0 8px 30px rgba(0,0,0,.5);
}
.toast.err { border-left-color: var(--err); }
.hidden { display: none !important; }
