/* Automation Control Center — a dark operations console. Colour carries meaning only: green healthy, amber warning,
   red failing, orange silent, purple not ready, grey waiting / not watched. Numbers in a monospace face. */
:root {
    --bg: #0B0F17; --bg-2: #0E1320; --panel: #121827; --panel-2: #172033; --panel-3: #1C263B;
    --line: #232D42; --line-2: #1A2234; --ink: #E7ECF5; --ink-2: #B9C2D3; --muted: #8592A8; --faint: #5E6A80;
    --accent: #7C9CFF; --accent-2: #5B7CF0; --focus: #93B4FF;
    --ok: #22C55E; --warn: #F5A524; --bad: #F04444; --orange: #FB7A2E; --purple: #A78BFA; --wait: #94A3B8; --off: #5B6578;
    --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Consolas, monospace;
    --radius: 14px;
    color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: radial-gradient(1200px 600px at 10% -10%, #16203A 0%, transparent 60%), var(--bg); color: var(--ink); }
body { font: 14px/1.5 Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; -webkit-font-smoothing: antialiased; min-height: 100vh; }
body.cc-no-scroll { overflow: hidden; }
button, input, select { font: inherit; color: inherit; }
a { color: inherit; }
svg.lucide { width: 16px; height: 16px; stroke-width: 2; flex: none; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 8px; }
[hidden] { display: none !important; }
.cc-sr { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.cc-muted { color: var(--muted); }
.bad { color: #FF8A8A; }
.num, .cc-kpi-n, time { font-variant-numeric: tabular-nums; }

/* ---- buttons, inputs ------------------------------------------------------------------------------------------- */
.cc-btn { display: inline-flex; align-items: center; gap: 7px; height: 36px; padding: 0 14px; border-radius: 10px; border: 1px solid var(--line);
    background: var(--panel-2); color: var(--ink); font-weight: 600; font-size: 13px; cursor: pointer; text-decoration: none; white-space: nowrap; transition: background .15s, border-color .15s; }
.cc-btn:hover { background: var(--panel-3); border-color: #2E3A55; }
.cc-btn:disabled { opacity: .55; cursor: not-allowed; }
.cc-btn.primary { background: linear-gradient(180deg, var(--accent), var(--accent-2)); border-color: transparent; color: #0B1020; }
.cc-btn.primary:hover { filter: brightness(1.08); }
.cc-btn.ghost { background: transparent; }
.cc-btn.ghost:hover { background: var(--panel-2); }
.cc-btn.sm { height: 32px; padding: 0 11px; font-size: 12.5px; }
.cc-btn.xs { height: 26px; padding: 0 9px; font-size: 12px; border-radius: 8px; }
.cc-btn.spin svg, .spin > svg { animation: cc-spin .8s linear infinite; }
.cc-icon-btn { width: 36px; height: 36px; display: inline-flex; align-items: center; justify-content: center; border-radius: 10px; border: 1px solid transparent; background: transparent; cursor: pointer; color: var(--ink-2); }
.cc-icon-btn:hover { background: var(--panel-2); color: var(--ink); }
.cc-link { background: none; border: 0; padding: 0; color: var(--ink); font-weight: 600; cursor: pointer; text-decoration: underline; text-decoration-color: #3A4763; text-underline-offset: 3px; display: inline-flex; align-items: center; gap: 4px; }
.cc-link:hover { text-decoration-color: var(--accent); color: #fff; }
.cc-link svg { width: 13px; height: 13px; }
.cc-select, .cc-field input, .cc-field select, .cc-search input {
    height: 36px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg-2); color: var(--ink); padding: 0 12px; outline: none; }
.cc-select:focus, .cc-field input:focus, .cc-field select:focus, .cc-search input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(124,156,255,.18); }

/* ---- header ---------------------------------------------------------------------------------------------------- */
.cc-app { max-width: 1640px; margin: 0 auto; padding: 0 24px 64px; }
.cc-top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
    margin: 0 -24px; padding: 14px 24px; background: rgba(11,15,23,.82); backdrop-filter: blur(14px); border-bottom: 1px solid var(--line-2); }
.cc-brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.cc-brand h1 { margin: 0; font-size: 17px; font-weight: 800; letter-spacing: -.01em; }
.cc-brand p { margin: 1px 0 0; font-size: 12.5px; color: var(--muted); }
.cc-logo { width: 38px; height: 38px; border-radius: 11px; display: inline-flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, #7C9CFF, #A78BFA); color: #0B1020; box-shadow: 0 6px 24px rgba(124,156,255,.35); }
.cc-logo svg { width: 20px; height: 20px; }
.cc-logo.big { width: 52px; height: 52px; border-radius: 15px; }
.cc-logo.big svg { width: 26px; height: 26px; }
.cc-top-right { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.cc-alerts-pill { display: inline-flex; align-items: center; gap: 8px; height: 32px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line);
    background: var(--panel); color: var(--ink-2); font-size: 12.5px; font-weight: 600; cursor: pointer; }
.cc-alerts-pill.on { border-color: rgba(34,197,94,.45); background: rgba(34,197,94,.10); color: #A7F3C5; }
.cc-alerts-pill:hover { border-color: #3A4763; }
.cc-live { display: inline-flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.cc-live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 0 rgba(34,197,94,.6); animation: cc-pulse 2s infinite; }
.cc-live.down .cc-live-dot { background: var(--bad); animation: none; }
.cc-live.down { color: #FF9C9C; }

/* ---- layout blocks -------------------------------------------------------------------------------------------- */
.cc-main { display: flex; flex-direction: column; gap: 16px; padding-top: 18px; }
.cc-card { background: linear-gradient(180deg, var(--panel), #101624); border: 1px solid var(--line-2); border-radius: var(--radius); min-width: 0; }
.cc-card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 16px 6px; }
.cc-card-head h2 { margin: 0; display: flex; align-items: center; gap: 8px; font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 700; }
.cc-banner { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: var(--radius); border: 1px solid; }
.cc-banner > svg { width: 22px; height: 22px; margin-top: 1px; }
.cc-banner div { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.cc-banner b { font-size: 15px; }
.cc-banner span { color: var(--ink-2); font-size: 13px; }
.cc-banner.ok { background: linear-gradient(90deg, rgba(34,197,94,.12), transparent 70%); border-color: rgba(34,197,94,.3); }
.cc-banner.ok > svg { color: var(--ok); }
.cc-banner.bad { background: linear-gradient(90deg, rgba(240,68,68,.16), transparent 70%); border-color: rgba(240,68,68,.4); }
.cc-banner.bad > svg { color: var(--bad); }

.cc-kpis { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; }
.cc-kpi { text-align: left; display: flex; flex-direction: column; gap: 4px; padding: 14px 16px; border-radius: var(--radius); border: 1px solid var(--line-2);
    background: linear-gradient(180deg, var(--panel), #101624); cursor: pointer; min-width: 0; transition: border-color .15s, transform .15s; }
.cc-kpi:hover { border-color: #33405C; transform: translateY(-1px); }
.cc-kpi-top { display: flex; align-items: center; gap: 7px; font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cc-kpi-top svg { width: 14px; height: 14px; }
.cc-kpi-n { font: 700 30px/1.1 var(--mono); letter-spacing: -.02em; }
.cc-kpi-n small { font-size: 16px; color: var(--muted); font-weight: 600; }
.cc-kpi-s { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cc-kpi.bad { border-color: rgba(240,68,68,.45); background: linear-gradient(180deg, rgba(240,68,68,.14), #101624 75%); }
.cc-kpi.bad .cc-kpi-n { color: #FF8A8A; }
.cc-kpi.warn { border-color: rgba(245,165,36,.4); }
.cc-kpi.warn .cc-kpi-n { color: #FFC56B; }
.cc-kpi.good .cc-kpi-n { color: #7EE2A6; }

.cc-mid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 16px; }
.cc-chart { margin: 0; padding: 4px 16px 14px; }
.cc-chart svg { display: block; width: 100%; }
.cc-hit { fill: transparent; }
g:hover > .cc-hit { fill: rgba(255,255,255,.04); }
.cc-bad-bar { fill: rgba(240,68,68,.85); }
.cc-ticks { position: relative; height: 16px; font: 500 10.5px var(--mono); color: var(--faint); }
.cc-ticks span { position: absolute; transform: translateX(-50%); }
.cc-chart figcaption { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 16px; font-size: 12.5px; color: var(--muted); margin-top: 6px; }
.cc-chart figcaption b { color: var(--ink); font-family: var(--mono); }
.cc-legend { display: inline-flex; gap: 12px; flex-wrap: wrap; margin-left: auto; }
.cc-legend span { display: inline-flex; align-items: center; gap: 6px; }
.cc-legend i, .cc-client i, .cc-chips i { width: 9px; height: 9px; border-radius: 3px; display: inline-block; flex: none; }
.cc-bad-key { background: var(--bad); }

.cc-hosts { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 12px; }
.cc-host { border: 1px solid var(--line-2); border-radius: var(--radius); background: linear-gradient(180deg, var(--panel), #101624); padding: 12px; display: flex; flex-direction: column; gap: 10px;
    border-top: 3px solid var(--host); }
.cc-host.on { border-color: var(--host); box-shadow: 0 0 0 1px var(--host) inset; }
.cc-host.is-bad { box-shadow: 0 0 0 1px rgba(240,68,68,.5) inset; }
.cc-host-main { display: flex; flex-direction: column; gap: 8px; text-align: left; background: none; border: 0; padding: 4px; cursor: pointer; border-radius: 10px; }
.cc-host-main:hover { background: rgba(255,255,255,.02); }
.cc-host-name { display: flex; align-items: center; gap: 8px; font-size: 15px; font-weight: 700; }
.cc-swatch { width: 10px; height: 10px; border-radius: 3px; background: var(--host); }
.cc-host-meta { display: flex; align-items: center; gap: 10px; font-size: 12.5px; color: var(--muted); flex-wrap: wrap; }
.cc-host-bar { display: flex; height: 6px; border-radius: 999px; overflow: hidden; gap: 2px; background: var(--line-2); }
.cc-host-bar span { display: block; }
.cc-host-nums { display: flex; gap: 14px; font-size: 12.5px; color: var(--muted); flex-wrap: wrap; }
.cc-host-nums b { color: var(--ink); font-family: var(--mono); }
.cc-host-nums .bad b { color: #FF8A8A; }
.cc-host-acts { display: flex; gap: 6px; flex-wrap: wrap; border-top: 1px dashed var(--line); padding-top: 10px; }
.cc-host-err { margin: 0; font-size: 12.5px; color: #FFB4B4; background: rgba(240,68,68,.08); border: 1px solid rgba(240,68,68,.25); padding: 8px 10px; border-radius: 10px; }
/* Z3 Connect's own automations (cc-z3.js): the same card, marked as ours. */
.cc-host-z3 { background: linear-gradient(180deg, #161D2C, #101624); }
.cc-host-name small { font-size: 11px; font-weight: 600; color: var(--muted); border: 1px solid var(--line-2); border-radius: 999px; padding: 1px 8px; }

/* ---- status pills and tones --------------------------------------------------------------------------------------- */
.cc-pill { display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 9px; border-radius: 999px; font-size: 11.5px; font-weight: 700; white-space: nowrap;
    background: color-mix(in srgb, var(--c) 16%, transparent); color: color-mix(in srgb, var(--c) 70%, white); border: 1px solid color-mix(in srgb, var(--c) 40%, transparent); }
.cc-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--c); }
.t-ok { --c: var(--ok); } .t-warn { --c: var(--warn); } .t-bad { --c: var(--bad); } .t-orange { --c: var(--orange); }
.t-purple { --c: var(--purple); } .t-muted { --c: var(--wait); } .t-off { --c: var(--off); }
.cc-host-bar .t-ok, .cc-host-bar .t-warn, .cc-host-bar .t-bad, .cc-host-bar .t-orange, .cc-host-bar .t-purple, .cc-host-bar .t-muted, .cc-host-bar .t-off { background: var(--c); }
.t-bad .cc-dot { animation: cc-pulse-bad 1.6s infinite; }
.cc-tag { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 600; padding: 2px 8px; border-radius: 7px; background: var(--panel-3); color: var(--ink-2); }
.cc-tag svg { width: 12px; height: 12px; }
.cc-tag.bad { background: rgba(240,68,68,.14); color: #FF9C9C; }
.cc-tag.warn { background: rgba(245,165,36,.12); color: #FFC56B; }

/* ---- tabs, toolbar --------------------------------------------------------------------------------------------- */
.cc-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line-2); margin-top: 6px; overflow-x: auto; }
.cc-tabs button { display: inline-flex; align-items: center; gap: 8px; padding: 10px 14px; border: 0; border-bottom: 2px solid transparent; background: none; color: var(--muted); font-weight: 600; cursor: pointer; white-space: nowrap; }
.cc-tabs button:hover { color: var(--ink); }
.cc-tabs button.on { color: var(--ink); border-bottom-color: var(--accent); }
.cc-tabs b { font: 600 11.5px var(--mono); padding: 1px 7px; border-radius: 999px; background: var(--panel-3); color: var(--ink-2); }
.cc-tabs b:empty { display: none; }
.cc-tab-card { border-top-left-radius: 0; }
.cc-toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 14px 16px; border-bottom: 1px solid var(--line-2); }
.cc-search { position: relative; flex: 1 1 280px; display: flex; align-items: center; }
.cc-search svg { position: absolute; left: 11px; color: var(--muted); pointer-events: none; }
.cc-search input { width: 100%; padding-left: 34px; }
.cc-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.cc-chips button, .cc-seg button { display: inline-flex; align-items: center; gap: 7px; height: 32px; padding: 0 11px; border-radius: 9px; border: 1px solid var(--line); background: transparent;
    color: var(--ink-2); font-size: 12.5px; font-weight: 600; cursor: pointer; }
.cc-chips button[aria-pressed="true"] { background: var(--panel-3); color: var(--ink); border-color: #3A4763; }
.cc-seg { display: inline-flex; padding: 3px; gap: 2px; border-radius: 11px; background: var(--bg-2); border: 1px solid var(--line); flex-wrap: wrap; }
.cc-seg button { border: 0; height: 28px; }
.cc-seg button[aria-pressed="true"] { background: var(--panel-3); color: var(--ink); box-shadow: 0 1px 0 rgba(255,255,255,.04) inset; }
.cc-seg b { font: 600 11px var(--mono); color: var(--muted); }
.cc-toggle { display: inline-flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--ink-2); cursor: pointer; }
.cc-toggle input, .cc-check input { accent-color: var(--accent); width: 16px; height: 16px; }
.cc-note { margin: 0; flex: 1 1 320px; font-size: 12.5px; color: var(--muted); }

/* ---- tables ---------------------------------------------------------------------------------------------------- */
.cc-table-wrap { overflow-x: auto; }
.cc-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; }
.cc-table th { position: sticky; top: 0; text-align: left; padding: 10px 12px; background: var(--panel-2); color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .07em;
    font-weight: 700; border-bottom: 1px solid var(--line); white-space: nowrap; }
.cc-table th button { display: inline-flex; align-items: center; gap: 5px; background: none; border: 0; padding: 0; color: inherit; font: inherit; letter-spacing: inherit; text-transform: inherit; cursor: pointer; }
.cc-table th button svg { width: 12px; height: 12px; opacity: .55; }
.cc-table th[aria-sort="ascending"], .cc-table th[aria-sort="descending"] { color: var(--ink); }
.cc-table th[aria-sort="ascending"] svg, .cc-table th[aria-sort="descending"] svg { opacity: 1; color: var(--accent); }
.cc-table th.num, .cc-table td.num { text-align: right; }
.cc-table th.num button { flex-direction: row-reverse; }
.cc-table td { padding: 11px 12px; border-bottom: 1px solid var(--line-2); vertical-align: top; }
.cc-table td.num { font-family: var(--mono); font-size: 13px; }
.cc-table td.num small { color: var(--muted); font-size: 11px; }
.cc-table tbody tr:last-child td { border-bottom: 0; }
.cc-row { cursor: pointer; transition: background .12s; }
.cc-row:hover td, .cc-row:focus td { background: rgba(124,156,255,.05); }
.cc-row.s-failing td:first-child { box-shadow: inset 3px 0 0 var(--bad); }
.cc-row.s-stalled td:first-child { box-shadow: inset 3px 0 0 var(--orange); }
.cc-row.s-degraded td:first-child { box-shadow: inset 3px 0 0 var(--warn); }
.cc-row.s-not_ready td:first-child { box-shadow: inset 3px 0 0 var(--purple); }
.cc-row.is-off td { opacity: .55; }
.cc-c-name b { display: block; font-size: 13.5px; }
.cc-sub { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; max-width: 520px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cc-tags { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 6px; }
.cc-client { display: inline-flex; align-items: center; gap: 7px; font-weight: 600; white-space: nowrap; }
.cc-what { max-width: 420px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink-2); }
.cc-ok-ico { color: var(--ok); }
.cc-foot { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 12px 16px; color: var(--muted); font-size: 12.5px; border-top: 1px solid var(--line-2); }
.cc-foot b { color: var(--ink); font-family: var(--mono); }

/* ---- incidents -------------------------------------------------------------------------------------------------- */
.cc-inc-list, .cc-inc-cards { list-style: none; margin: 0; padding: 4px 16px 14px; display: flex; flex-direction: column; gap: 10px; }
.cc-inc, .cc-inc-card { border: 1px solid var(--line-2); border-radius: 12px; padding: 10px 12px; background: var(--bg-2); }
.cc-inc-card.open { border-color: rgba(240,68,68,.35); }
.cc-inc-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.cc-inc p, .cc-inc-card p { margin: 6px 0 0; font-size: 12.5px; color: var(--ink-2); overflow-wrap: anywhere; }
.cc-inc-meta { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 8px; font-size: 12px; color: var(--muted); }
.cc-inc-when { margin-left: auto; font-size: 12.5px; color: var(--muted); }
.cc-inc-when b { color: #FF9C9C; }
.cc-more { margin: 0 16px 14px; }

/* ---- side panel --------------------------------------------------------------------------------------------------- */
.cc-panel-wrap { position: fixed; inset: 0; z-index: 50; pointer-events: none; }
.cc-backdrop { position: absolute; inset: 0; background: rgba(3,6,12,.6); opacity: 0; transition: opacity .2s; }
.cc-panel { position: absolute; top: 0; right: 0; bottom: 0; width: min(680px, 100vw); background: var(--bg-2); border-left: 1px solid var(--line); display: flex; flex-direction: column;
    transform: translateX(100%); transition: transform .22s ease; box-shadow: -20px 0 60px rgba(0,0,0,.45); }
.cc-panel-wrap.open { pointer-events: auto; }
.cc-panel-wrap.open .cc-backdrop { opacity: 1; }
.cc-panel-wrap.open .cc-panel { transform: none; }
.cc-panel-head { display: flex; justify-content: space-between; gap: 12px; padding: 16px 18px 12px; border-bottom: 1px solid var(--line-2); }
.cc-panel-head h2 { margin: 2px 0 4px; font-size: 18px; }
.cc-panel-head code { font: 500 11.5px var(--mono); color: var(--faint); }
.cc-eyebrow { font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.cc-panel-body { overflow-y: auto; padding: 16px 18px 48px; display: flex; flex-direction: column; gap: 18px; }
.cc-status-card { border-radius: 12px; padding: 14px; border: 1px solid var(--line); background: var(--panel); }
.cc-status-card.s-failing { border-color: rgba(240,68,68,.5); background: linear-gradient(180deg, rgba(240,68,68,.10), var(--panel)); }
.cc-status-card.s-stalled { border-color: rgba(251,122,46,.5); }
.cc-status-card.s-degraded { border-color: rgba(245,165,36,.45); }
.cc-status-card.s-healthy { border-color: rgba(34,197,94,.35); }
.cc-status-top { display: flex; gap: 8px; flex-wrap: wrap; }
.cc-status-card p { margin: 10px 0 0; color: var(--ink-2); overflow-wrap: anywhere; }
.cc-acts { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 12px; }
.cc-sec h3 { display: flex; align-items: center; gap: 8px; margin: 0 0 10px; font-size: 11.5px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.cc-sec .cc-inc-list { padding: 0; }
.cc-facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin: 0; }
.cc-fact { background: var(--panel); border: 1px solid var(--line-2); border-radius: 10px; padding: 9px 11px; min-width: 0; }
.cc-fact dt { font-size: 11.5px; color: var(--muted); }
.cc-fact dd { margin: 3px 0 0; font: 600 14px var(--mono); overflow-wrap: anywhere; }
.cc-fact dd small { font-size: 11.5px; color: var(--muted); }
.cc-fact.bad dd { color: #FF8A8A; }
.cc-mini-chart { margin: 0; }
.cc-mini-chart svg { display: block; width: 100%; }
.cc-mini-chart rect.on { fill: #6F8BEF; }
.cc-mini-chart rect.zero { fill: var(--line); }
.cc-mini-chart figcaption { display: flex; justify-content: space-between; font-size: 11.5px; color: var(--muted); margin-top: 6px; }
.cc-mini-chart figcaption b { color: var(--ink); }
.cc-broken { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; font-size: 12.5px; }
.cc-broken pre, .cc-error { margin: 6px 0 0; padding: 9px 11px; border-radius: 10px; background: rgba(240,68,68,.08); border: 1px solid rgba(240,68,68,.28); color: #FFB4B4;
    font: 12px/1.5 var(--mono); white-space: pre-wrap; overflow-wrap: anywhere; }
.cc-error { display: flex; gap: 8px; align-items: center; margin: 16px; font-family: inherit; font-size: 13px; }
.cc-runs-mini td, .cc-runs-mini th { padding: 8px; }

/* ---- forms, dialogs -------------------------------------------------------------------------------------------- */
.cc-form { display: flex; flex-direction: column; gap: 12px; }
.cc-field { display: flex; flex-direction: column; gap: 6px; font-size: 12.5px; color: var(--ink-2); font-weight: 600; min-width: 0; }
.cc-field input, .cc-field select { width: 100%; font-weight: 500; }
.cc-grid2, .cc-grid3 { display: grid; gap: 10px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.cc-grid3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.cc-check { display: flex; align-items: flex-start; gap: 10px; font-size: 13px; color: var(--ink); cursor: pointer; }
.cc-check span { display: flex; flex-direction: column; gap: 2px; }
.cc-check small { color: var(--muted); font-size: 12px; }
.cc-check.big { padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); }
.cc-hint { margin: 0; font-size: 12.5px; color: var(--muted); }
.cc-form-error { margin: 0; padding: 9px 11px; border-radius: 10px; background: rgba(240,68,68,.1); border: 1px solid rgba(240,68,68,.35); color: #FFB4B4; font-size: 12.5px; }
.cc-form-foot { display: flex; gap: 8px; padding-top: 4px; }
.cc-dialog-wrap { position: fixed; inset: 0; z-index: 60; display: flex; align-items: center; justify-content: center; padding: 16px; background: rgba(3,6,12,.66); }
.cc-dialog { width: min(560px, 100%); max-height: 92vh; overflow-y: auto; background: var(--bg-2); border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 30px 80px rgba(0,0,0,.5); }
.cc-dialog header { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--line-2); }
.cc-dialog h2 { margin: 0; font-size: 16px; }
.cc-dialog form { display: flex; flex-direction: column; gap: 14px; padding: 16px; }
.cc-dialog footer { display: flex; justify-content: flex-end; gap: 8px; padding-top: 4px; }

/* ---- sign-in, empty, skeleton, toasts ------------------------------------------------------------------------- */
.cc-login { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px; }
.cc-login-card { width: min(400px, 100%); display: flex; flex-direction: column; gap: 14px; padding: 28px; border-radius: 18px; background: var(--panel); border: 1px solid var(--line); text-align: left; }
.cc-login-card h1 { margin: 6px 0 0; font-size: 20px; }
.cc-login-card p { margin: 0; color: var(--muted); }
.cc-empty { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 40px 16px; text-align: center; color: var(--muted); }
.cc-empty svg { width: 30px; height: 30px; color: var(--faint); }
.cc-empty b { color: var(--ink); font-size: 14.5px; }
.cc-skel { display: flex; flex-direction: column; gap: 10px; padding: 16px; }
.cc-skel div { height: 18px; border-radius: 8px; background: linear-gradient(90deg, var(--panel-2), var(--panel-3), var(--panel-2)); background-size: 200% 100%; animation: cc-shimmer 1.2s infinite; }
.cc-toasts { position: fixed; right: 16px; bottom: 16px; z-index: 80; display: flex; flex-direction: column; gap: 8px; }
.cc-toast { padding: 10px 14px; border-radius: 12px; background: var(--panel-3); border: 1px solid var(--line); box-shadow: 0 10px 30px rgba(0,0,0,.4); font-size: 13px; max-width: 380px;
    transition: opacity .3s, transform .3s; }
.cc-toast.t-ok { border-color: rgba(34,197,94,.45); }
.cc-toast.t-bad { border-color: rgba(240,68,68,.55); color: #FFC4C4; }
.cc-toast.out { opacity: 0; transform: translateY(6px); }

@keyframes cc-spin { to { transform: rotate(360deg); } }
@keyframes cc-pulse { 0% { box-shadow: 0 0 0 0 rgba(34,197,94,.5); } 70% { box-shadow: 0 0 0 7px rgba(34,197,94,0); } 100% { box-shadow: 0 0 0 0 rgba(34,197,94,0); } }
@keyframes cc-pulse-bad { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }
@keyframes cc-shimmer { to { background-position: -200% 0; } }

/* ---- smaller screens --------------------------------------------------------------------------------------------- */
@media (max-width: 1280px) { .cc-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 980px) { .cc-mid { grid-template-columns: 1fr; } }
@media (max-width: 720px) {
    .cc-app { padding: 0 12px 48px; }
    .cc-top { margin: 0 -12px; padding: 10px 12px; position: static; }
    .cc-alerts-pill span { display: none; }
    .cc-alerts-pill { width: 32px; padding: 0; justify-content: center; }
    .cc-brand p, .cc-hide-sm { display: none; }
    .cc-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
    .cc-kpi { padding: 12px; }
    .cc-kpi-n { font-size: 24px; }
    .cc-hosts { grid-template-columns: 1fr; }
    .cc-toolbar { padding: 12px; }
    .cc-search { flex-basis: 100%; }
    .cc-legend { margin-left: 0; }
    .cc-bots, .cc-bots tbody, .cc-runs, .cc-runs tbody { display: block; }
    .cc-bots thead, .cc-runs thead { display: none; }
    .cc-bots tr, .cc-runs tr { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 6px 12px; padding: 12px; border-bottom: 1px solid var(--line-2); }
    .cc-bots td, .cc-runs td { display: block; padding: 0; border: 0; text-align: left !important; }
    .cc-bots td[data-label]::before, .cc-runs td[data-label]::before { content: attr(data-label); display: block; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--faint); margin-bottom: 2px; }
    .cc-bots td.cc-c-name, .cc-runs td.cc-what { grid-column: 1 / -1; }
    .cc-bots td:first-child::before, .cc-bots td.cc-c-name::before { display: none; }
    .cc-row.s-failing, .cc-row.s-stalled, .cc-row.s-degraded, .cc-row.s-not_ready { box-shadow: inset 3px 0 0 var(--bad); }
    .cc-row td:first-child { box-shadow: none !important; }
    .cc-sub { white-space: normal; }
    .cc-what { white-space: normal; max-width: none; }
    .cc-facts { grid-template-columns: 1fr 1fr; }
    .cc-grid3 { grid-template-columns: 1fr 1fr; }
    .cc-panel-body { padding: 14px 12px 40px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
.cc-banner.wait { background: linear-gradient(90deg, rgba(148,163,184,.12), transparent 70%); border-color: rgba(148,163,184,.3); }
.cc-banner.wait > svg { color: var(--wait); animation: cc-spin 1.4s linear infinite; }

/* A client's CRM and AI credit lines on its card (migration 055, 11 Nov 2026) */
.cc-host-extra { display: flex; flex-direction: column; gap: 6px; padding: 8px 4px 0; border-top: 1px solid var(--line-2); }
.cc-xline { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); min-width: 0; }
.cc-xlabel { display: inline-flex; align-items: center; gap: 5px; min-width: 78px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); }
.cc-xlabel svg { width: 14px; height: 14px; }
.cc-xfacts { display: inline-flex; gap: 4px 10px; flex-wrap: wrap; min-width: 0; }
.cc-xfacts b { color: var(--ink); font-family: var(--mono); }
.cc-spark { width: 96px; height: 24px; margin-left: auto; flex: none; }
.cc-spark-all { fill: var(--line); }
.cc-spark-bot { fill: var(--host, var(--accent)); }
.cc-xline .cc-btn.xs { margin-left: auto; }
.cc-xadd { align-self: flex-start; font-size: 12.5px; color: var(--ink-2); }
.cc-xadd svg { width: 14px; height: 14px; }
.cc-host-err.muted { color: var(--muted); background: var(--panel-2); border-color: var(--line-2); }
@media (max-width: 520px) { .cc-spark { width: 100%; margin-left: 0; } .cc-xlabel { min-width: 0; } }
.cc-xlabel small { font-size: 10.5px; font-weight: 600; letter-spacing: .02em; text-transform: none; color: var(--faint); }

/* ---- Billing & services (migration 055, 11 Nov 2026): each client's paid services ------------------------------------ */
.cc-minis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; padding: 16px 16px 0; }
.cc-mini { display: flex; flex-direction: column; gap: 2px; text-align: left; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line-2);
    background: var(--bg-2); color: var(--ink); cursor: pointer; transition: border-color .15s, background .15s; }
.cc-mini:hover { border-color: #2E3A55; background: var(--panel-2); }
.cc-mini span { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); }
.cc-mini b { font: 700 22px/1.2 var(--mono); letter-spacing: -.01em; }
.cc-mini small { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cc-mini.warn b { color: var(--warn); } .cc-mini.bad b { color: #FF8A8A; } .cc-mini.bad { border-color: rgba(240,68,68,.35); }

.cc-svcs td { vertical-align: middle; }
.cc-svc { display: flex; align-items: center; gap: 10px; min-width: 0; }
.cc-svc > span:last-child { min-width: 0; }
.cc-svc-ic { flex: none; width: 32px; height: 32px; border-radius: 9px; display: inline-flex; align-items: center; justify-content: center;
    background: color-mix(in srgb, var(--ic) 16%, transparent); color: var(--ic); }
.cc-svc-ic svg { width: 16px; height: 16px; }
.c-whatsapp { --ic: #25D366; } .c-instagram { --ic: #E1306C; } .c-ai { --ic: var(--purple); } .c-hosting { --ic: #38BDF8; } .c-crm { --ic: var(--warn); } .c-other { --ic: var(--wait); }
.cc-due { display: inline-flex; align-items: center; height: 20px; padding: 0 7px; margin-left: 6px; border-radius: 999px; font-size: 11px; font-weight: 700;
    background: var(--panel-3); color: var(--ink-2); white-space: nowrap; }
.cc-due.soon { background: rgba(124,156,255,.14); color: #AFC2FF; }
.cc-due.warn { background: rgba(245,165,36,.14); color: #FFC56B; }
.cc-due.bad { background: rgba(240,68,68,.16); color: #FF9C9C; }
.cc-payer { display: inline-flex; align-items: center; height: 22px; padding: 0 9px; border-radius: 7px; font-size: 12px; font-weight: 700; background: var(--panel-3); color: var(--ink-2); }
.cc-payer.z3 { background: rgba(124,156,255,.16); color: #C3D1FF; }
.cc-money { font-family: var(--mono); } .cc-money.warn { color: var(--warn); }
.cc-ok-text { color: var(--ok); font-weight: 600; font-size: 12.5px; }
.cc-bad-text { color: #FF9C9C; }
.cc-row-acts { display: flex; gap: 6px; margin-top: 6px; flex-wrap: wrap; }
.cc-c-acts { white-space: nowrap; text-align: right; }
.cc-c-acts .cc-btn { margin-right: 4px; }
.cc-group td { padding: 14px 12px 8px; background: transparent; border-bottom: 1px solid var(--line); }
.cc-group-row { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.cc-client.big { font-size: 14px; font-weight: 700; color: var(--ink); }
.cc-client.big small { margin-left: 8px; font-size: 12px; font-weight: 500; color: var(--muted); }
.cc-group-contact { display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--ink-2); flex: 1 1 auto; min-width: 0; }
.cc-group-contact svg { width: 14px; height: 14px; color: var(--muted); }
.cc-group-contact .cc-link { margin-left: 4px; font-size: 12.5px; }
.cc-group-empty { color: var(--muted); font-size: 13px; padding: 14px 12px 18px !important; }

/* The card's "Services" line opens Billing & services. */
.cc-xbtn { width: 100%; background: none; border: 0; padding: 4px 6px; margin: 0 -6px; border-radius: 9px; cursor: pointer; color: inherit; font: inherit; text-align: left; }
.cc-xbtn:hover { background: rgba(255,255,255,.03); }
.cc-xgo { width: 15px; height: 15px; margin-left: auto; color: var(--faint); flex: none; }

/* The service dialog: four short sections. */
.cc-fs { border: 1px solid var(--line-2); border-radius: 12px; padding: 12px 14px 4px; margin: 0 0 12px; min-width: 0; }
.cc-fs legend { padding: 0 6px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); }
.cc-fs[hidden] { display: none; }
.cc-radios { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 10px; }
.cc-radios label { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); cursor: pointer; }
.cc-radios label:has(input:checked) { border-color: var(--accent); background: rgba(124,156,255,.08); }
.cc-radios input { margin-top: 3px; accent-color: var(--accent); }
.cc-radios span { display: flex; flex-direction: column; gap: 2px; font-size: 13px; }
.cc-radios small { color: var(--muted); font-size: 12px; }
.cc-hint-gap { margin-top: 14px; }
.cc-dialog { max-height: calc(100vh - 32px); overflow-y: auto; }

@media (max-width: 1100px) { .cc-minis { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 720px) {
    .cc-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .cc-minis { padding: 12px 12px 0; gap: 8px; }
    .cc-svcs, .cc-svcs tbody { display: block; }
    .cc-svcs thead { display: none; }
    .cc-svcs tr { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px 12px; padding: 12px; border-bottom: 1px solid var(--line-2); }
    .cc-svcs td { display: block; padding: 0; border: 0; text-align: left !important; }
    .cc-svcs td[data-label]:not([data-label=""])::before { content: attr(data-label); display: block; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--faint); margin-bottom: 2px; }
    .cc-svcs td.cc-c-name, .cc-svcs td.cc-c-acts, .cc-svcs .cc-group td, .cc-svcs .cc-group-empty { grid-column: 1 / -1; }
    .cc-svcs td.cc-c-name::before { display: none; }
    .cc-svcs .cc-group { display: block; padding: 0; }
    .cc-svcs .cc-group td { padding: 14px 12px 8px; border-bottom: 1px solid var(--line); }
    .cc-c-acts { text-align: left; }
    .cc-radios { grid-template-columns: 1fr; }
}
/* Billing table: sub-lines wrap inside their column, so the actions never fall off the right edge. */
.cc-svcs .cc-sub { white-space: normal; max-width: 260px; }
.cc-svcs td:nth-child(1) { min-width: 220px; }
.cc-svcs td:nth-child(2) { min-width: 120px; white-space: nowrap; }
.cc-svcs td:nth-child(2) .cc-sub { white-space: normal; }
.cc-svcs td:nth-child(3) { min-width: 170px; }
.cc-svcs td:nth-child(4), .cc-svcs td:nth-child(5) { min-width: 150px; }
.cc-c-acts { width: 1%; }
.cc-c-acts .cc-btn { margin: 2px 4px 2px 0; }
@media (max-width: 720px) { .cc-svcs td.cc-c-name[data-label]::before { display: none; } }
