/* Portail Yeastar — runsoft. Teinte d'accent = celle des rapports PDF (#0d6b73). */
:root {
  color-scheme: light;
  --bg: #f4f6f8; --surface: #ffffff; --surface-2: #f1f4f6; --text: #17212b; --muted: #5d6975; --border: #dfe4e9; --border-strong: #c9d1d8;
  --accent: #0d6b73; --accent-hover: #0a5a61; --accent-soft: #e1f0f1; --accent-text: #ffffff;
  --ok: #1f7a47; --ok-soft: #e2f3e8; --warn: #976111; --warn-soft: #fbefd9; --err: #b3261e; --err-soft: #fbe3e1; --neutral-soft: #eceff2;
  --side-bg: #0f262d; --side-text: #c9d6da; --side-muted: #86a0a7; --side-active: #1b3d46; --side-hover: #16333b;
  --radius: 10px; --radius-sm: 7px;
  --shadow: 0 1px 2px rgba(16, 32, 40, .05), 0 1px 1px rgba(16, 32, 40, .03);
  --shadow-lg: 0 12px 32px rgba(16, 32, 40, .16);
  --font: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #0d1316; --surface: #141c20; --surface-2: #192328; --text: #e4eaed; --muted: #95a4ad; --border: #25323a; --border-strong: #33434c;
    --accent: #3fa7ae; --accent-hover: #5cb9bf; --accent-soft: #15353a; --accent-text: #061b1d;
    --ok: #62c28b; --ok-soft: #173123; --warn: #e2b060; --warn-soft: #362a14; --err: #ee8a82; --err-soft: #3b1c1a; --neutral-soft: #222d33;
    --side-bg: #0a1a1f; --side-active: #16333b; --side-hover: #11282f;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3); --shadow-lg: 0 12px 32px rgba(0, 0, 0, .5);
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 14.5px/1.5 var(--font); background: var(--bg); color: var(--text); font-variant-numeric: tabular-nums; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.5rem; font-weight: 650; letter-spacing: -.01em; margin: 0 0 1rem; }
h2 { font-size: 1.02rem; font-weight: 620; margin: 0 0 .9rem; }
h3 { font-size: .95rem; font-weight: 620; margin: 0; }
p { margin: .4rem 0; }
.muted { color: var(--muted); }
.error { color: var(--err); }
.icon { flex: none; }

/* ---------- structure ---------- */
.shell { display: flex; min-height: 100vh; }
.sidebar { width: 236px; flex: none; background: var(--side-bg); color: var(--side-text); display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh; padding: 18px 12px; }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 18px; color: #fff; }
.brand:hover { text-decoration: none; }
.brand-mark { width: 34px; height: 34px; border-radius: 9px; background: var(--accent); color: #fff; display: grid; place-items: center; flex: none; }
.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-text strong { font-size: .98rem; font-weight: 650; }
.brand-text small { color: var(--side-muted); font-size: .78rem; letter-spacing: .04em; text-transform: uppercase; }
.nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.nav-section { color: var(--side-muted); font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; padding: 14px 10px 6px; }
.nav-link { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--radius-sm); color: var(--side-text);
  font: inherit; font-size: .92rem; background: none; border: 0; cursor: pointer; width: 100%; height: auto; text-align: left; }
.nav-link:hover { background: var(--side-hover); color: #fff; text-decoration: none; border: 0; }
.nav-link.active { background: var(--side-active); color: #fff; box-shadow: inset 3px 0 0 var(--accent); }
.sidebar-foot { border-top: 1px solid rgba(255, 255, 255, .08); padding-top: 12px; display: flex; flex-direction: column; gap: 4px; }
.who { padding: 4px 10px; font-size: .85rem; line-height: 1.3; }
.who strong { display: block; color: #fff; font-weight: 600; }
.who span { color: var(--side-muted); font-size: .78rem; }
.content { flex: 1; min-width: 0; }
main { max-width: 1240px; margin: 0 auto; padding: 28px 32px 60px; }

/* écran de connexion */
body.auth .shell { display: block; }
body.auth main { max-width: none; min-height: 100vh; display: grid; place-items: center; padding: 24px 16px;
  background: radial-gradient(1200px 600px at 10% -10%, var(--accent-soft), transparent 60%), var(--bg); }
.login { width: 100%; max-width: 400px; }
.login .panel { padding: 28px; box-shadow: var(--shadow-lg); }
.login-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 22px; }
.login-brand .brand-mark { width: 42px; height: 42px; border-radius: 11px; }
.login-brand strong { display: block; font-size: 1.15rem; }
.login-brand div span { color: var(--muted); font-size: .85rem; }
.login form { display: flex; flex-direction: column; gap: 14px; }
.login button[type=submit] { height: 40px; justify-content: center; }
.login-foot { text-align: center; color: var(--muted); font-size: .8rem; margin-top: 16px; }

/* ---------- en-têtes de page ---------- */
.crumbs { color: var(--muted); font-size: .85rem; margin: 0 0 .6rem; }
.crumbs a { color: var(--muted); }
.crumbs a:hover { color: var(--accent); }
.row { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; }
.spread { justify-content: space-between; }
main > .row.spread { margin-bottom: 1.1rem; }
main > .row.spread h1 { margin: 0; }

/* ---------- blocs ---------- */
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px 22px; margin-bottom: 18px; box-shadow: var(--shadow); }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px 18px; }
.notice { background: var(--warn-soft); border-left: 3px solid var(--warn); color: var(--text); border-radius: var(--radius-sm); padding: 12px 14px; margin: 12px 0; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 8px 22px; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; word-break: break-word; }

/* chiffres clés */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; margin-bottom: 18px; }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); }
.kpi .v { font-size: 1.6rem; font-weight: 650; line-height: 1.1; }
.kpi .k { color: var(--muted); font-size: .84rem; margin-top: 2px; }
.kpi.ok .v { color: var(--ok); }
.kpi.warn .v { color: var(--warn); }
.kpi.err .v { color: var(--err); }

/* cartes de fonctions */
.features { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 14px; }
.feature-card { border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; display: flex; flex-direction: column; gap: 10px; background: var(--surface); }
.feature-title { display: flex; align-items: center; gap: 10px; }
.feature-icon { width: 34px; height: 34px; border-radius: 9px; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; flex: none; }
.feature-card p { margin: 0; }
.feature-card.soon { background: var(--surface-2); }
.feature-card.soon .feature-icon { background: var(--neutral-soft); color: var(--muted); }

/* ---------- formulaires ---------- */
label { display: flex; flex-direction: column; gap: 5px; font-size: .85rem; color: var(--muted); font-weight: 500; }
label.check { flex-direction: row; align-items: center; gap: 8px; color: var(--text); font-weight: 400; font-size: .9rem; }
label.check input { width: 16px; height: 16px; accent-color: var(--accent); }
input, select, textarea { font: inherit; font-size: .92rem; color: var(--text); background: var(--surface); border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm); padding: 0 11px; height: 36px; min-width: 0; transition: border-color .12s, box-shadow .12s; }
textarea { height: auto; min-height: 5rem; padding: 8px 11px; resize: vertical; }
input[type=checkbox], input[type=radio] { height: auto; }
input[type=file] { height: auto; padding: 10px; border-style: dashed; background: var(--surface-2); cursor: pointer; }
input[type=search] { min-width: 280px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

/* ---------- boutons ---------- */
button { font: inherit; font-size: .9rem; font-weight: 550; height: 36px; padding: 0 14px; border-radius: var(--radius-sm); cursor: pointer;
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); display: inline-flex; align-items: center; gap: 7px;
  transition: background .12s, border-color .12s, color .12s; white-space: nowrap; }
button:hover { background: var(--surface-2); border-color: var(--muted); }
button:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--accent-soft); border-color: var(--accent); }
button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
button.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
button.danger { color: var(--err); border-color: color-mix(in srgb, var(--err) 45%, transparent); background: var(--surface); }
button.danger:hover { background: var(--err-soft); border-color: var(--err); }
button.link { border: 0; background: none; color: var(--accent); padding: 0; height: auto; }
button:disabled, button:disabled:hover { opacity: .5; cursor: default; background: var(--surface); border-color: var(--border-strong); }
button.primary:disabled { background: var(--accent); border-color: var(--accent); }

/* ---------- tableaux ---------- */
.table-wrap { overflow: auto; border: 1px solid var(--border); border-radius: var(--radius-sm); margin: 10px 0; }
.panel .table-wrap { max-height: 560px; }
table { width: 100%; border-collapse: collapse; font-size: .89rem; }
th { position: sticky; top: 0; z-index: 1; background: var(--surface-2); color: var(--muted); font-size: .72rem; font-weight: 650;
  text-transform: uppercase; letter-spacing: .05em; text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; }
td { padding: 9px 12px; border-bottom: 1px solid var(--border); vertical-align: top; }
tbody tr:last-child td { border-bottom: 0; }
tr.clickable { cursor: pointer; }
tbody tr:hover td { background: color-mix(in srgb, var(--accent-soft) 45%, transparent); }
td input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--accent); }

/* ---------- badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 99px; font-size: .76rem; font-weight: 600;
  line-height: 1.5; white-space: nowrap; background: var(--neutral-soft); color: var(--muted); }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .8; }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.err { background: var(--err-soft); color: var(--err); }
td > div + div, td .badge + div { margin-top: 3px; }

/* ---------- divers ---------- */
details > summary { cursor: pointer; color: var(--accent); font-weight: 550; margin: .6rem 0; }
details > summary:hover { text-decoration: underline; }
progress { width: 100%; height: 10px; appearance: none; border: 0; border-radius: 99px; overflow: hidden; background: var(--neutral-soft); margin: 10px 0; }
progress::-webkit-progress-bar { background: var(--neutral-soft); }
progress::-webkit-progress-value { background: var(--accent); border-radius: 99px; }
progress::-moz-progress-bar { background: var(--accent); }
pre.details { margin: 0; white-space: pre-wrap; font-size: .78rem; color: var(--muted); max-width: 420px; font-family: ui-monospace, Consolas, monospace; }
ul { margin: .4rem 0; padding-left: 1.2rem; }
.toast { position: fixed; bottom: 22px; right: 22px; z-index: 50; background: #17212b; color: #fff; padding: 11px 16px; border-radius: var(--radius-sm);
  max-width: min(460px, 92vw); box-shadow: var(--shadow-lg); font-size: .9rem; border-left: 4px solid #3fa7ae; }
.toast.err { border-left-color: #ef5350; }
dialog { border: 0; border-radius: var(--radius); background: var(--surface); color: var(--text); max-width: 480px; width: 92vw; padding: 24px; box-shadow: var(--shadow-lg); }
dialog h2 { margin-top: 0; }
dialog form { display: flex; flex-direction: column; gap: 12px; }
dialog::backdrop { background: rgba(10, 20, 25, .5); }

/* ---------- petits écrans : la barre latérale passe en haut ---------- */
@media (max-width: 900px) {
  .shell { flex-direction: column; }
  .sidebar { width: auto; height: auto; position: static; padding: 10px 12px; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 6px; }
  .brand { padding: 0 8px 0 0; }
  .brand-text small { display: none; }
  .nav { flex-direction: row; flex-wrap: wrap; flex: 1; }
  .nav-section { display: none; }
  .nav-link { width: auto; padding: 6px 9px; }
  .nav-link span.label { display: none; }
  .sidebar-foot { border: 0; padding: 0; flex-direction: row; align-items: center; }
  .who { display: none; }
  main { padding: 18px 16px 48px; }
  input[type=search] { min-width: 0; width: 100%; }
}

/* ---------- création d'un standard ---------- */
.panel h3 { margin: 18px 0 10px; color: var(--muted); font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; }
.steps { display: flex; flex-direction: column; gap: 14px; }
.step { display: flex; gap: 12px; align-items: flex-start; }
.step-dot { width: 22px; height: 22px; border-radius: 50%; flex: none; margin-top: 1px; border: 2px solid var(--border-strong); background: var(--surface); position: relative; }
.step.done .step-dot { background: var(--ok); border-color: var(--ok); }
.step.done .step-dot::after { content: ""; position: absolute; left: 6px; top: 2px; width: 5px; height: 10px; border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg); }
.step.active .step-dot { border-color: var(--accent); border-top-color: transparent; animation: spin .9s linear infinite; }
.step.err .step-dot { background: var(--err); border-color: var(--err); }
.step.todo { opacity: .55; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .step.active .step-dot { animation: none; border-top-color: var(--accent); } }
.panel.ready { border-color: color-mix(in srgb, var(--ok) 45%, var(--border)); background: color-mix(in srgb, var(--ok-soft) 60%, var(--surface)); }
.panel.secret { border-color: color-mix(in srgb, var(--warn) 45%, var(--border)); }
.mono { font-family: ui-monospace, Consolas, monospace; font-size: 1rem; letter-spacing: .03em; user-select: all; }


/* ---------- schéma des routes entrantes ---------- */
.rt-legend { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 14px; }
.rt-key { font-size: .78rem; padding: 3px 10px; border-radius: 99px; border: 1px solid var(--border); background: var(--surface); }
.rt-flow { display: flex; align-items: flex-start; gap: 0; overflow-x: auto; padding-bottom: 4px; }
.rt-col { display: flex; flex-direction: column; gap: 6px; min-width: 150px; flex: none; }
.rt-grow { flex: 1; min-width: 320px; }
.rt-caption { font-size: .7rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 650; }
.rt-did { font-family: ui-monospace, Consolas, monospace; font-size: .9rem; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 6px 10px; }
.rt-routebox { border: 1.5px solid var(--accent); border-radius: var(--radius-sm); padding: 8px 12px; background: var(--accent-soft); }
.rt-arrow { flex: none; width: 34px; align-self: flex-start; margin-top: 30px; height: 2px; background: var(--border-strong); position: relative; }
.rt-arrow::after { content: ""; position: absolute; right: -1px; top: -4px; border: 5px solid transparent; border-left: 7px solid var(--border-strong); border-right: 0; }
.rt-branch { display: flex; align-items: flex-start; gap: 0; margin: 4px 0; }
.rt-branch > .rt-arrow { margin-top: 13px; width: 26px; }
.rt-pill { flex: none; font-size: .78rem; font-weight: 600; padding: 5px 10px; border-radius: 99px; background: var(--neutral-soft); color: var(--text); white-space: nowrap; min-width: 128px; text-align: center; }
.rt-node { border-radius: var(--radius-sm); padding: 6px 10px; border: 1px solid var(--border); border-left-width: 4px; background: var(--surface); min-width: 220px; flex: 1; }
.rt-label { font-weight: 600; font-size: .9rem; }
.rt-detail { color: var(--muted); font-size: .8rem; }
.rt-note { color: var(--muted); font-size: .8rem; font-style: italic; margin: 4px 0; }
.rt-menu { margin-top: 8px; padding: 8px 0 2px 10px; border-left: 2px dashed var(--border-strong); }
.rt-menu-head { font-size: .8rem; font-weight: 650; margin-bottom: 4px; }
.rt-node.rt-ivr, .rt-key.rt-ivr { border-left-color: var(--accent); }
.rt-node.rt-group, .rt-key.rt-group { border-left-color: var(--ok); }
.rt-node.rt-ext, .rt-key.rt-ext { border-left-color: #5b7cc4; }
.rt-node.rt-vm, .rt-key.rt-vm { border-left-color: var(--warn); }
.rt-node.rt-msg, .rt-key.rt-msg { border-left-color: #8a6cc0; }
.rt-node.rt-stop, .rt-key.rt-stop { border-left-color: var(--err); }
.rt-node.rt-same { border-style: dashed; }
.rt-key { border-left-width: 4px; }
@media print {
  .sidebar, .no-print, .toast { display: none !important; }
  body, main { background: #fff; padding: 0; }
  .panel { box-shadow: none; break-inside: avoid; }
  .rt-flow { overflow: visible; }
}


.rt-members { display: flex; flex-wrap: wrap; gap: 5px; margin: 2px 0 4px; }
.rt-member { font-size: .78rem; padding: 2px 8px; border-radius: 99px; background: var(--ok-soft); color: var(--text); }

.rt-all { padding: 10px 16px; }
.rt-all > summary { color: var(--text); font-weight: 500; margin: 0; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.rt-all > summary:hover { text-decoration: none; }
.rt-all > summary .muted { font-size: .85rem; }
.rt-all-link { margin-left: auto; font-size: .85rem; }
.rt-all-body { margin-top: 10px; }
.rt-all-body > .panel { box-shadow: none; border: 1px solid var(--border); }
.nowrap { white-space: nowrap; }
.kpi.clickable { cursor: pointer; }
.kpi.clickable:hover { border-color: var(--warn); }
.badge.info { background: var(--accent-soft); color: var(--accent); }

/* installation / double authentification */
.login.wide { max-width: 460px; }
.qr-wrap { display: flex; justify-content: center; margin: 4px 0 8px; }
.qr { background: #fff; padding: 8px; border-radius: var(--radius-sm); border: 1px solid var(--border); }
input.otp { font-family: ui-monospace, Consolas, monospace; font-size: 1.15rem; letter-spacing: .12em; }
input.otp.short { max-width: 190px; font-size: 1rem; }
code.secret { font-size: .95rem; word-break: break-all; }
.codes { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px 14px; margin: 10px 0 14px; padding: 12px 14px;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); }
.codes code { font-size: .95rem; }
.steps-mini { display: flex; gap: 6px; list-style: none; padding: 0; margin: -8px 0 16px; font-size: .75rem; counter-reset: s; }
.steps-mini li { flex: 1; padding: 4px 6px; border-radius: 99px; background: var(--neutral-soft); color: var(--muted); text-align: center; }
.steps-mini li.on { background: var(--accent); color: #fff; }
.steps-mini li.done { background: var(--ok-soft); color: var(--text); }
.small { font-size: .85rem; }
