:root {
  --teal: #2a8c82;
  --teal-dark: #1f6b63;
  --bg: #f3f6f6;
  --card: #ffffff;
  --text: #1a2423;
  --muted: #5f6f6d;
  --danger: #b42318;
  --warn: #b54708;
  --border: #d7e2e0;
  --radius: 10px;
  --sidebar-w: 240px;
  font-family: "Segoe UI", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: linear-gradient(160deg, #e8f3f1 0%, var(--bg) 40%, #eef2f1 100%); color: var(--text); min-height: 100vh; }
a { color: var(--teal-dark); text-decoration: none; }
a:hover { text-decoration: underline; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.9em; background: #eef5f4; padding: 0.1rem 0.35rem; border-radius: 4px; word-break: break-word; }

body.shell { display: flex; min-height: 100vh; background: #eef3f2; }
.sidebar {
  width: var(--sidebar-w); flex-shrink: 0; background: #123532; color: #fff;
  display: flex; flex-direction: column; padding: 1.1rem 0.85rem; position: sticky; top: 0; height: 100vh;
  z-index: 40;
}
.sidebar-brand {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 0.75rem;
  padding: 0.35rem 0.65rem 1rem; border-bottom: 1px solid #2a524e; margin-bottom: 0.75rem;
}
.sidebar-brand strong { display: block; font-size: 1.05rem; }
.sidebar-brand span { color: #7fd4cb; font-size: 0.8rem; }
.sidebar-close {
  display: none; width: 36px; height: 36px; border: 1px solid #3d6a65; border-radius: 8px;
  background: transparent; color: #fff; font-size: 1.4rem; line-height: 1; cursor: pointer;
}
.sidebar-nav { display: flex; flex-direction: column; gap: 0.15rem; flex: 1; overflow: auto; }
.nav-section {
  margin: 0.85rem 0.65rem 0.25rem; font-size: 0.7rem; letter-spacing: 0.06em;
  text-transform: uppercase; color: #7a9e9a; font-weight: 700;
}
.sidebar-nav a {
  color: #c9e8e4; padding: 0.55rem 0.75rem; border-radius: 8px; text-decoration: none; font-size: 0.92rem;
}
.sidebar-nav a:hover, .sidebar-nav a.active { background: #1c4a46; color: #fff; text-decoration: none; }
.sidebar-term {
  display: flex; align-items: center; gap: 0.45rem;
  width: 100%; text-align: left; cursor: pointer;
  color: #7fd4cb; padding: 0.55rem 0.75rem; border-radius: 8px;
  background: transparent; border: 1px dashed #3d6a65; font: inherit; font-size: 0.92rem;
  margin-top: 0.25rem;
}
.sidebar-term span { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-weight: 700; }
.sidebar-term:hover { background: #1c4a46; color: #fff; }
.sidebar-logout { border-top: 1px solid #2a524e; padding-top: 0.85rem; margin-top: 0.5rem; }
.sidebar-logout button {
  width: 100%; background: transparent; border: 1px solid #3d6a65; color: #fff;
  border-radius: 8px; padding: 0.45rem 0.75rem; cursor: pointer; font: inherit;
}
.sidebar-logout small { display: block; margin-top: 0.45rem; color: #8fb5b0; font-size: 0.75rem; word-break: break-all; }
.sidebar-backdrop {
  display: none; position: fixed; inset: 0; background: rgba(18, 53, 50, 0.45); z-index: 30;
}
.shell-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.mobile-topbar { display: none; }
.banner-maint {
  background: #fff4e5; color: #8a4b08; border-bottom: 1px solid #f6d5a8;
  padding: 0.65rem 1.25rem; font-size: 0.9rem; font-weight: 600;
}

.container { max-width: 1100px; width: 100%; margin: 1.5rem auto; padding: 0 1rem 3rem; }
body.guest .container { max-width: none; margin: 0; padding: 0; }
h1 { margin: 0 0 1rem; font-size: clamp(1.25rem, 4vw, 1.6rem); }
h2 { margin: 0; font-size: 1.1rem; }
.muted { color: var(--muted); }
.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; margin-bottom: 1rem; flex-wrap: wrap; }
.actions { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--border); background: #fff; color: var(--text);
  border-radius: 8px; padding: 0.5rem 0.9rem; cursor: pointer; font: inherit;
  min-height: 40px;
}
.btn:hover { text-decoration: none; border-color: var(--teal); }
.btn.primary { background: var(--teal); border-color: var(--teal); color: #fff; }
.btn.primary:hover { background: var(--teal-dark); }
.btn.danger { background: #fff5f5; border-color: #f3c1bc; color: var(--danger); }
.btn.sm { padding: 0.25rem 0.55rem; font-size: 0.85rem; min-height: 32px; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 0.75rem; margin-bottom: 1.25rem; }
.stat { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem; }
.stat span { display: block; font-size: 1.6rem; font-weight: 700; color: var(--teal-dark); }
.stat.warn span { color: var(--warn); }
.stat label { color: var(--muted); font-size: 0.85rem; }

.panel, .form-card, .login-card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.1rem; margin-bottom: 1rem;
}
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 0.75rem; margin-bottom: 0.75rem; flex-wrap: wrap; }

.table-wrap { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; border-radius: var(--radius); border: 1px solid var(--border); background: var(--card); margin-bottom: 1rem; }
.table-wrap table { border: none; margin: 0; border-radius: 0; }
table { width: 100%; border-collapse: collapse; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
th, td { text-align: left; padding: 0.65rem 0.75rem; border-bottom: 1px solid var(--border); vertical-align: top; font-size: 0.92rem; }
th { background: #f0f7f6; color: var(--muted); font-weight: 600; white-space: nowrap; }
.truncate { max-width: 280px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.badge { display: inline-block; padding: 0.15rem 0.45rem; border-radius: 999px; font-size: 0.75rem; background: #eef2f1; }
.badge.active, .badge.ok { background: #d9f2ee; color: #0f5c54; }
.badge.revoked, .badge.denied, .badge.ssrf_blocked, .badge.platform_blocked, .badge.key_disabled { background: #fde8e6; color: var(--danger); }
.badge.disabled, .badge.upstream_error, .badge.upstream_timeout, .badge.maintenance { background: #fff4e5; color: var(--warn); }
.badge.rate_limited { background: #eee8ff; color: #4c1d95; }

.alert { padding: 0.85rem 1rem; border-radius: 8px; margin-bottom: 1rem; }
.alert.ok { background: #e7f6f3; border: 1px solid #b7e2da; }
.alert.err { background: #fdecea; border: 1px solid #f3c1bc; }
.alert.warn { background: #fff7ed; border: 1px solid #f6d5a8; }
.alert ul { margin: 0; padding-left: 1.1rem; }
.key-once { display: block; margin-top: 0.5rem; word-break: break-all; background: #123532; color: #7fd4cb; padding: 0.75rem; border-radius: 8px; flex: 1; }
.copy-row { display: flex; align-items: center; gap: 0.65rem; flex-wrap: wrap; margin: 0.5rem 0; }
.copy-row.tight { margin: 0; }
.copy-row .grow { flex: 1; margin: 0; min-width: 0; }
.btn.copied { border-color: var(--teal); color: var(--teal-dark); }

label { display: block; margin-bottom: 0.85rem; font-weight: 600; font-size: 0.9rem; }
input[type=text], input[type=email], input[type=password], input[type=url], input[type=search], input[type=color], select, textarea {
  display: block; width: 100%; margin-top: 0.35rem; padding: 0.55rem 0.65rem;
  border: 1px solid var(--border); border-radius: 8px; font: inherit; background: #fff;
  max-width: 100%;
}
.check { font-weight: 500; display: flex; align-items: center; gap: 0.4rem; margin-bottom: 0.4rem; }
.check input { width: auto; margin: 0; }
.checks { display: flex; flex-wrap: wrap; gap: 0.75rem; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }
.inline-form { display: flex; gap: 0.5rem; margin-bottom: 0.85rem; flex-wrap: wrap; }
.inline-form input, .inline-form select { width: auto; min-width: min(220px, 100%); margin: 0; flex: 1 1 180px; }

.login-wrap {
  min-height: 100vh; display: grid; place-items: center; padding: 1.25rem;
  background:
    radial-gradient(900px 420px at 15% 10%, color-mix(in srgb, var(--login-accent, var(--teal)) 28%, transparent), transparent 60%),
    radial-gradient(700px 380px at 90% 85%, color-mix(in srgb, var(--login-accent, var(--teal)) 18%, transparent), transparent 55%),
    linear-gradient(160deg, #123532 0%, #1a4743 45%, #0f2c29 100%);
}
.login-card { width: min(420px, 100%); }
.login-card-dynamic {
  border: none; box-shadow: 0 24px 60px rgba(0,0,0,0.28);
  animation: loginIn 0.45s ease both;
}
.login-hero { text-align: center; margin-bottom: 1.1rem; }
.login-mark {
  width: 56px; height: 56px; margin: 0 auto 0.75rem; border-radius: 16px;
  display: grid; place-items: center; font-weight: 800; font-size: 1.35rem; color: #fff;
  background: linear-gradient(145deg, var(--login-accent, var(--teal)), #1f6b63);
  box-shadow: 0 10px 24px color-mix(in srgb, var(--login-accent, var(--teal)) 45%, transparent);
}
.login-card h1 { margin-bottom: 0.25rem; }
.login-submit { width: 100%; margin-top: 0.35rem; }
.login-footer { text-align: center; margin: 1rem 0 0; font-size: 0.85rem; }
@keyframes loginIn {
  from { opacity: 0; transform: translateY(12px) scale(0.98); }
  to { opacity: 1; transform: none; }
}

.platform-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0.85rem; margin-bottom: 1rem;
}
.platform-card.is-off { border-color: #f3c1bc; background: #fffafa; }
.platform-card .btn { width: 100%; }

/* —— Ops Center (flux plateforme) —— */
.terminal-launch {
  gap: 0.45rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  background: #123532;
  color: #9fe0d8;
  border-color: #1f4f4a;
}
.terminal-launch:hover { border-color: #2A8C82; color: #fff; text-decoration: none; }
.terminal-launch.dark { background: #0c2422; }
.term-icon { font-weight: 700; letter-spacing: -0.04em; color: #7fd4cb; }

.ops-board {
  margin-bottom: 1rem;
  border: 1px solid #1a3f3b;
  border-radius: 14px;
  overflow: hidden;
  background:
    linear-gradient(180deg, #163f3b 0%, #102e2b 42%, #0d2623 100%);
  color: #d7ece9;
  box-shadow: 0 18px 40px rgba(18, 53, 50, 0.18);
}
.ops-board-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 0.85rem; flex-wrap: wrap;
  padding: 0.85rem 1rem;
  border-bottom: 1px solid rgba(127, 212, 203, 0.14);
  background: rgba(0, 0, 0, 0.18);
}
.ops-board-title { display: flex; align-items: center; gap: 0.7rem; min-width: 0; }
.ops-board-title strong { display: block; font-size: 0.95rem; letter-spacing: 0.01em; }
.ops-board-title small {
  display: block; color: #7a9e9a; font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.08em;
}
.ops-dot {
  width: 10px; height: 10px; border-radius: 50%; background: #7fd4cb;
  box-shadow: 0 0 0 3px rgba(127, 212, 203, 0.18);
}
.ops-dot.is-warn { background: #f0b429; box-shadow: 0 0 0 3px rgba(240, 180, 41, 0.2); }
.ops-kpis { display: flex; gap: 0.55rem; flex-wrap: wrap; }
.ops-kpi {
  min-width: 64px; padding: 0.35rem 0.55rem; border-radius: 8px;
  background: rgba(255,255,255,0.04); border: 1px solid rgba(127,212,203,0.12);
  text-align: center;
}
.ops-kpi em {
  display: block; font-style: normal; font-weight: 700; font-size: 1.05rem;
  font-variant-numeric: tabular-nums; color: #fff;
}
.ops-kpi span {
  font-size: 0.68rem; color: #7a9e9a; text-transform: uppercase; letter-spacing: 0.06em;
}
.ops-kpi.ok em { color: #7fd4cb; }
.ops-kpi.bad em { color: #f3a39a; }
.ops-kpi.muted em { color: #c9b6ff; }

.ops-topology {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(220px, 0.7fr);
  gap: 0;
  min-height: 320px;
}
.ops-clients {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0;
  border-right: 1px solid rgba(127, 212, 203, 0.12);
}
.ops-client {
  position: relative;
  padding: 1.1rem 1rem 1.35rem;
  border-right: 1px solid rgba(127, 212, 203, 0.1);
  display: flex; flex-direction: column; gap: 0.45rem;
  background: linear-gradient(180deg, rgba(255,255,255,0.02), transparent 55%);
}
.ops-client:last-child { border-right: none; }
.ops-client-top { display: flex; justify-content: space-between; align-items: center; gap: 0.5rem; }
.ops-tag {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.68rem; font-weight: 700; letter-spacing: 0.1em;
  padding: 0.18rem 0.4rem; border-radius: 4px;
  background: rgba(42,140,130,0.25); color: #9fe0d8;
}
.ops-client.platform-ios .ops-tag { background: rgba(59,130,246,0.2); color: #93c5fd; }
.ops-client.platform-android .ops-tag { background: rgba(22,163,74,0.2); color: #86efac; }
.ops-state {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.68rem; letter-spacing: 0.08em; color: #7fd4cb;
}
.ops-client.is-down .ops-state { color: #f3a39a; }
.ops-client.is-live .ops-state::before {
  content: ""; display: inline-block; width: 6px; height: 6px; border-radius: 50%;
  background: #34d399; margin-right: 0.35rem; vertical-align: middle;
  animation: opsBlink 1.4s ease-in-out infinite;
}
.ops-client h3 { margin: 0; font-size: 1.15rem; color: #fff; font-weight: 700; }
.ops-client p { margin: 0; font-size: 0.78rem; color: #7a9e9a; }
.ops-client-metrics {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.35rem; margin-top: 0.35rem;
}
.ops-client-metrics div {
  padding: 0.4rem 0.35rem; border-radius: 7px; background: rgba(0,0,0,0.22);
  border: 1px solid rgba(127,212,203,0.08);
}
.ops-client-metrics strong {
  display: block; font-size: 0.95rem; color: #fff; font-variant-numeric: tabular-nums;
}
.ops-client-metrics span {
  font-size: 0.65rem; color: #7a9e9a; text-transform: uppercase; letter-spacing: 0.05em;
}
.ops-spark {
  width: 100%; height: 34px; margin-top: 0.35rem;
}
.ops-spark polyline {
  fill: none; stroke: #2A8C82; stroke-width: 1.6; stroke-linejoin: round; stroke-linecap: round;
  opacity: 0.9;
}
.ops-client.platform-ios .ops-spark polyline { stroke: #60a5fa; }
.ops-client.platform-android .ops-spark polyline { stroke: #4ade80; }
.ops-client.is-down { opacity: 0.55; }
.ops-client.is-down .ops-spark polyline { stroke: #94a3a0; }

.ops-pipe {
  position: absolute; right: -1px; top: 28%; bottom: 28%; width: 2px;
  background: rgba(127,212,203,0.12); overflow: hidden;
}
.ops-pipe span {
  position: absolute; left: 0; width: 2px; height: 18%;
  background: linear-gradient(180deg, transparent, #7fd4cb, transparent);
  opacity: 0;
}
.ops-pipe.is-flowing span { animation: opsPacket 2.2s linear infinite; opacity: 1; }
.ops-pipe.is-flowing span:nth-child(2) { animation-delay: 0.7s; }
.ops-pipe.is-flowing span:nth-child(3) { animation-delay: 1.4s; }

.ops-hub {
  position: relative;
  display: flex; align-items: stretch; justify-content: stretch;
  background:
    repeating-linear-gradient(
      90deg,
      rgba(127,212,203,0.03) 0 1px,
      transparent 1px 12px
    ),
    linear-gradient(160deg, #0f2c29, #123532 60%, #0c2421);
  padding: 1rem;
}
.ops-hub-plate {
  flex: 1;
  border: 1px solid rgba(127,212,203,0.22);
  border-radius: 12px;
  padding: 1rem;
  background: rgba(8, 24, 22, 0.55);
  display: flex; flex-direction: column; gap: 0.75rem;
}
.ops-hub-leds { display: flex; gap: 0.4rem; }
.ops-hub-leds i {
  width: 8px; height: 8px; border-radius: 50%; background: #3d5552; display: block;
}
.ops-hub-leds i.on { background: #34d399; box-shadow: 0 0 8px rgba(52,211,153,0.55); }
.ops-hub-name span {
  display: block; font-size: 0.68rem; letter-spacing: 0.16em; color: #7a9e9a;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
.ops-hub-name strong {
  display: block; font-size: 1.35rem; color: #fff; letter-spacing: 0.04em; margin-top: 0.15rem;
}
.ops-hub-meta {
  display: grid; grid-template-columns: 1fr 1fr; gap: 0.45rem; margin: 0;
}
.ops-hub-meta > div {
  margin: 0; padding: 0.4rem 0.5rem; border-radius: 7px; background: rgba(255,255,255,0.03);
  border: 1px solid rgba(127,212,203,0.08);
}
.ops-hub-meta dt {
  margin: 0; font-size: 0.62rem; text-transform: uppercase; letter-spacing: 0.08em; color: #7a9e9a;
}
.ops-hub-meta dd {
  margin: 0.1rem 0 0; font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.85rem; color: #c9e8e4;
}
.ops-hub-actions {
  display: flex; gap: 0.4rem; margin-top: auto;
}
.ops-hub-actions a, .ops-hub-actions button {
  flex: 1; text-align: center; border: 1px solid rgba(127,212,203,0.22);
  background: transparent; color: #9fe0d8; border-radius: 7px; padding: 0.4rem 0.35rem;
  font: inherit; font-size: 0.78rem; font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  cursor: pointer; text-decoration: none;
}
.ops-hub-actions a:hover, .ops-hub-actions button:hover {
  background: rgba(42,140,130,0.25); color: #fff; text-decoration: none;
}
.ops-hub.is-maint .ops-hub-plate { border-color: rgba(240,180,41,0.45); }
.ops-hub-rail {
  position: absolute; left: 0; top: 12%; bottom: 12%; width: 3px;
  background: linear-gradient(180deg, transparent, #2A8C82, transparent);
  opacity: 0.55;
}
.ops-banner {
  padding: 0.55rem 1rem; font-size: 0.82rem; color: #9fb8b4;
  border-top: 1px solid rgba(127,212,203,0.12); background: rgba(0,0,0,0.2);
}
.ops-banner.is-warn { color: #f6d5a8; background: rgba(181,71,8,0.18); }
.ops-banner code { background: rgba(255,255,255,0.08); color: #9fe0d8; }

@keyframes opsBlink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}
@keyframes opsPacket {
  from { top: -20%; }
  to { top: 110%; }
}

/* —— Terminal overlay —— */
.bx-term[hidden] { display: none !important; }
.bx-term {
  position: fixed; inset: 0; z-index: 80;
  display: grid; place-items: center; padding: 1rem;
}
.bx-term-backdrop {
  position: absolute; inset: 0; background: rgba(6, 18, 17, 0.72);
  backdrop-filter: blur(4px);
}
.bx-term-window {
  position: relative; z-index: 1;
  width: min(860px, 100%);
  height: min(560px, calc(100vh - 2rem));
  display: flex; flex-direction: column;
  border-radius: 12px; overflow: hidden;
  border: 1px solid #2a4a46;
  background: #0b1413;
  box-shadow: 0 30px 80px rgba(0,0,0,0.45);
  animation: termIn 0.22s ease both;
}
.bx-term-chrome {
  display: flex; align-items: center; gap: 0.75rem;
  padding: 0.55rem 0.75rem;
  background: linear-gradient(180deg, #1a2e2c, #142422);
  border-bottom: 1px solid #243b38;
}
.bx-term-dots { display: flex; gap: 0.4rem; }
.bx-term-dot {
  width: 11px; height: 11px; border-radius: 50%; border: none; padding: 0;
  background: #3d5552; display: inline-block;
}
.bx-term-dot.close { background: #ff5f57; cursor: pointer; }
.bx-term-title {
  flex: 1; text-align: center;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.78rem; color: #8fb5b0;
}
.bx-term-x {
  border: none; background: transparent; color: #7a9e9a; cursor: pointer;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.72rem;
}
.bx-term-body {
  flex: 1; min-height: 0; display: flex; flex-direction: column;
  padding: 0.85rem 1rem 1rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.86rem; line-height: 1.45; color: #d7ece9;
}
.bx-term-out {
  flex: 1; overflow: auto; white-space: pre-wrap; word-break: break-word;
  margin-bottom: 0.65rem;
}
.bx-term-out .line-cmd { color: #9fe0d8; }
.bx-term-out .line-err { color: #f3a39a; }
.bx-term-out .line-ok { color: #86efac; }
.bx-term-line {
  display: flex; align-items: center; gap: 0.55rem;
  border-top: 1px solid #1f3431; padding-top: 0.65rem;
}
.bx-term-prompt { color: #7fd4cb; white-space: nowrap; font-weight: 700; margin: 0; }
.bx-term-line input {
  flex: 1; border: none; outline: none; background: transparent;
  color: #fff; font: inherit; padding: 0; margin: 0; width: 100%;
  caret-color: #7fd4cb;
}
@keyframes termIn {
  from { opacity: 0; transform: translateY(10px) scale(0.985); }
  to { opacity: 1; transform: none; }
}

.platform-card-head {
  display: flex; justify-content: space-between; align-items: center; gap: 0.5rem; margin-bottom: 0.85rem;
}
.platform-id { font-weight: 800; font-size: 1.05rem; }
.platform-id.platform-web { color: #1f6b63; }
.platform-id.platform-ios { color: #1d4ed8; }
.platform-id.platform-android { color: #166534; }
.platform-card.is-live {
  box-shadow: 0 0 0 1px rgba(42,140,130,0.25), 0 10px 28px rgba(18,53,50,0.06);
}
.platform-metrics {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.55rem; margin-bottom: 0.75rem;
}
.platform-metrics > div {
  background: #f6faf9; border: 1px solid var(--border); border-radius: 8px; padding: 0.55rem 0.65rem;
}
.platform-metrics strong {
  display: block; font-size: 1.15rem; color: var(--teal-dark); font-variant-numeric: tabular-nums;
}
.platform-metrics span { font-size: 0.75rem; color: var(--muted); }
.platform-meta {
  display: flex; justify-content: space-between; gap: 0.5rem; flex-wrap: wrap;
  font-size: 0.8rem; color: var(--muted); margin-bottom: 0.65rem;
}
.platform-paths { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.35rem; }
.platform-paths li {
  display: flex; justify-content: space-between; gap: 0.5rem; align-items: center;
  font-size: 0.82rem; padding: 0.3rem 0; border-top: 1px dashed var(--border);
}
.platform-paths span { color: var(--muted); font-variant-numeric: tabular-nums; }
.platform-empty { margin: 0; font-size: 0.85rem; }

.badge.platform-web { background: #d9f2ee; color: #0f5c54; }
.badge.platform-ios { background: #dbeafe; color: #1d4ed8; }
.badge.platform-android { background: #dcfce7; color: #166534; }

.chart-panel { overflow: hidden; }
.chart-legend { display: flex; gap: 0.75rem; flex-wrap: wrap; font-size: 0.8rem; }
.chart-legend .lg { display: inline-flex; align-items: center; gap: 0.35rem; color: var(--muted); }
.chart-legend .lg::before {
  content: ""; width: 10px; height: 10px; border-radius: 3px; background: #2A8C82;
}
.chart-legend .lg.ios::before { background: #3b82f6; }
.chart-legend .lg.android::before { background: #16a34a; }

.hour-chart {
  display: grid;
  grid-template-columns: repeat(24, minmax(0, 1fr));
  gap: 0.25rem;
  align-items: end;
  min-height: 160px;
  padding-top: 0.5rem;
}
.hour-col {
  display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 0.35rem; min-width: 0;
}
.hour-stack {
  width: 100%; max-width: 18px; display: flex; flex-direction: column-reverse; gap: 1px;
  height: 130px; justify-content: flex-start;
}
.hour-stack .seg {
  width: 100%; border-radius: 3px 3px 1px 1px;
  height: calc((var(--h) / var(--max)) * 100%);
  min-height: 0;
  transform-origin: bottom;
  animation: barRise 0.7s ease both;
  animation-delay: var(--d, 0s);
}
.hour-stack .seg.web { background: #2A8C82; }
.hour-stack .seg.ios { background: #3b82f6; }
.hour-stack .seg.android { background: #16a34a; }
.hour-label { font-size: 0.62rem; color: var(--muted); white-space: nowrap; }

@keyframes barRise {
  from { transform: scaleY(0); opacity: 0.2; }
  to { transform: scaleY(1); opacity: 1; }
}

.audit-filters .actions { margin-top: 0.25rem; }
.audit-list { display: none; flex-direction: column; gap: 0.75rem; }
.audit-card { margin-bottom: 0; }
.audit-card-top {
  display: flex; justify-content: space-between; align-items: flex-start; gap: 0.75rem; flex-wrap: wrap;
}
.audit-req { display: flex; align-items: center; gap: 0.5rem; min-width: 0; flex: 1; }
.audit-path { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.audit-badges { display: flex; gap: 0.35rem; flex-wrap: wrap; }
.audit-message {
  margin: 0.75rem 0 0; padding: 0.65rem 0.75rem; border-radius: 8px;
  background: #f7faf9; border: 1px solid var(--border); color: var(--text); font-size: 0.92rem;
  word-break: break-word;
}
.audit-meta {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 0.65rem 0.85rem;
  margin: 0.85rem 0 0; padding: 0;
}
.audit-meta > div { margin: 0; }
.audit-meta dt {
  margin: 0; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); font-weight: 700;
}
.audit-meta dd { margin: 0.15rem 0 0; font-size: 0.9rem; }
.audit-id { font-size: 0.85em; }
.method-pill {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 3.2rem; padding: 0.15rem 0.4rem; border-radius: 6px;
  background: #123532; color: #7fd4cb; font-size: 0.72rem; font-weight: 700; letter-spacing: 0.02em;
}
.audit-detail { max-width: 360px; word-break: break-word; }
.nowrap { white-space: nowrap; }
.desktop-only { display: block; }
.mobile-only { display: none; }

.fw-layout {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 0.85rem;
  margin-bottom: 1rem;
}
.fw-settings .checks { margin-bottom: 0.85rem; }
.fw-rule-form { margin-bottom: 0.5rem; }
.fw-help ol.fw-flow {
  margin: 0.5rem 0 0; padding-left: 1.2rem; color: var(--muted); line-height: 1.55;
}
.fw-help ol.fw-flow strong { color: var(--text); }
.fw-help h2 { margin-bottom: 0.35rem; }

@media (max-width: 980px) {
  .fw-layout { grid-template-columns: 1fr; }
}

.pager { display: flex; gap: 0.75rem; align-items: center; margin-top: 1rem; flex-wrap: wrap; }
.pager a, .pager span { padding: 0.35rem 0.65rem; border: 1px solid var(--border); border-radius: 6px; background: #fff; }
.pager .disabled { opacity: 0.45; }
.pager-info { color: var(--muted); border: none !important; background: transparent !important; }

.row-actions { display: flex; gap: 0.65rem; align-items: center; flex-wrap: wrap; }
.field-error { color: var(--danger); margin: 0.35rem 0 0; font-size: 0.9rem; }

.modal {
  border: none; border-radius: 12px; padding: 0; max-width: 440px; width: calc(100% - 2rem);
  box-shadow: 0 18px 50px rgba(18, 53, 50, 0.28);
}
.modal::backdrop { background: rgba(18, 53, 50, 0.45); }
.modal-card { padding: 1.25rem; margin: 0; }
.modal-card h2 { margin: 0 0 0.5rem; }
.modal-card p { color: var(--muted); margin: 0 0 1rem; }
.modal-card .actions { margin-top: 1rem; justify-content: flex-end; flex-wrap: wrap; }
.secret-edit { margin-top: 0.35rem; }
.secret-edit summary { cursor: pointer; color: var(--teal-dark); font-size: 0.85rem; }
.secret-edit .inline-form { margin-top: 0.4rem; margin-bottom: 0; }

/* —— Responsive —— */
@media (max-width: 980px) {
  body.shell { display: block; }
  .mobile-topbar {
    display: flex; align-items: center; gap: 0.75rem;
    position: sticky; top: 0; z-index: 25;
    background: #123532; color: #fff;
    padding: 0.7rem 0.9rem;
    padding-top: max(0.7rem, env(safe-area-inset-top));
  }
  .mobile-brand { min-width: 0; }
  .mobile-brand strong { display: block; font-size: 0.95rem; line-height: 1.2; }
  .mobile-brand span { display: block; font-size: 0.75rem; color: #7fd4cb; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .nav-toggle {
    width: 42px; height: 42px; border: 1px solid #3d6a65; border-radius: 10px;
    background: transparent; display: inline-flex; flex-direction: column;
    align-items: center; justify-content: center; gap: 5px; cursor: pointer; flex-shrink: 0;
  }
  .nav-toggle span { display: block; width: 18px; height: 2px; background: #fff; border-radius: 2px; }
  .sidebar {
    position: fixed; left: 0; top: 0; bottom: 0; height: 100dvh; width: min(86vw, 300px);
    transform: translateX(-105%); transition: transform 0.22s ease;
    padding-top: max(1.1rem, env(safe-area-inset-top));
    box-shadow: 12px 0 40px rgba(0,0,0,0.25);
  }
  body.sidebar-open .sidebar { transform: translateX(0); }
  body.sidebar-open .sidebar-backdrop { display: block; }
  .sidebar-close { display: inline-grid; place-items: center; }
  .sidebar-nav { flex-direction: column; flex-wrap: nowrap; }
  .nav-section { width: auto; }
  .container { margin: 1rem auto; padding: 0 0.85rem 2.5rem; }
  .banner-maint { padding: 0.65rem 0.85rem; font-size: 0.85rem; }
  .audit-list { display: flex; }
  .desktop-only { display: none; }
  .ops-topology { grid-template-columns: 1fr; }
  .ops-clients { border-right: none; border-bottom: 1px solid rgba(127,212,203,0.12); }
  .ops-hub-rail { display: none; }
  .ops-pipe { display: none; }
}

@media (max-width: 720px) {
  .grid-2 { grid-template-columns: 1fr; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .platform-grid { grid-template-columns: 1fr; }
  .hour-chart { gap: 0.15rem; }
  .hour-stack { max-width: 12px; height: 110px; }
  .ops-clients { grid-template-columns: 1fr; }
  .ops-client { border-right: none; border-bottom: 1px solid rgba(127,212,203,0.1); }
  .ops-kpis { width: 100%; }
  .ops-kpi { flex: 1 1 calc(25% - 0.55rem); }
  .bx-term-window { height: min(78vh, 560px); }
  .page-head .actions, .panel-head .actions { width: 100%; }
  .page-head .actions .btn, .panel-head .actions .btn { flex: 1 1 auto; }
  .truncate { max-width: 140px; }
  .inline-form input, .inline-form select { min-width: 0; width: 100%; }
  .modal { width: calc(100% - 1rem); max-width: none; margin: auto; }
  .modal-card .actions { justify-content: stretch; }
  .modal-card .actions .btn { flex: 1; }
  th, td { font-size: 0.85rem; padding: 0.55rem 0.6rem; }
  .login-wrap { padding: 1rem; align-items: start; padding-top: 12vh; }
  .login-card { padding: 1rem; }
}

@media (max-width: 420px) {
  .stats { grid-template-columns: 1fr; }
  .btn { width: 100%; }
  .actions { width: 100%; }
  .copy-row .btn { width: auto; }
}
