/* =====================================================================
   Allvisuall — Transfo/OctoSnail unified UI system
   Duo/trio-tone: neutral slate + ONE teal accent. No purple.
   Colour only when it means something (green = good/done, red = error,
   amber = warning). Light + dark themes via [data-theme].
   Linked by every allvisuall-agent page; page-specific bits stay inline.
   ===================================================================== */

:root, [data-theme="light"] {
  --bg: #f8fafc; --panel: #ffffff; --panel-2: #ffffff; --input: #f1f5f9;
  --border: #e2e8f0; --border-2: #cbd5e1;
  --text: #1e293b; --muted: #617087; --muted-2: #94a3b8;
  --accent: #0f766e; --accent-soft: rgba(15,118,110,.10); --accent-border: rgba(15,118,110,.30);
  --primary: #1e293b; --primary-fg: #ffffff; --primary-hover: #334155;
  --good: #10b981; --good-soft: rgba(16,185,129,.12);
  --bad: #ef4444; --bad-soft: rgba(239,68,68,.12);
  --warn: #d97706; --warn-soft: rgba(217,119,6,.14);
  --shadow: 0 1px 2px rgba(15,23,42,.04), 0 1px 3px rgba(15,23,42,.04);
  --shadow-lg: 0 12px 28px rgba(15,23,42,.10);
  --radius: 12px; --radius-sm: 8px;
  --font: "Poppins", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  --sidebar-w: 244px;
}
[data-theme="dark"] {
  --bg: #0f1216; --panel: #171a21; --panel-2: #1c2029; --input: #1f242d;
  --border: #2a2f3a; --border-2: #3a414e;
  --text: #e7eaf0; --muted: #9aa3b2; --muted-2: #6b7480;
  --accent: #2dd4bf; --accent-soft: rgba(45,212,191,.14); --accent-border: rgba(45,212,191,.30);
  --primary: #2dd4bf; --primary-fg: #06231f; --primary-hover: #5eead4;
  --good: #34d399; --good-soft: rgba(52,211,153,.15);
  --bad: #f87171; --bad-soft: rgba(248,113,113,.15);
  --warn: #fbbf24; --warn-soft: rgba(251,191,36,.15);
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 1px 3px rgba(0,0,0,.3);
  --shadow-lg: 0 12px 30px rgba(0,0,0,.5);
}

* { box-sizing: border-box; }
body { margin: 0; font-family: var(--font); background: var(--bg); color: var(--text); -webkit-font-smoothing: antialiased; font-size: 14px; }
a { text-decoration: none; color: inherit; }

/* ── Layout / sidebar (flush left) / topbar ── */
.app { display: flex; min-height: 100vh; }
.sidebar { width: var(--sidebar-w); flex-shrink: 0; background: var(--panel); border-right: 1px solid var(--border); padding: 20px 14px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 16px; font-weight: 700; font-size: 1.05rem; letter-spacing: -.01em; color: var(--text); }
.brand .mark { width: 30px; height: 30px; border-radius: 8px; color: #fff; flex-shrink: 0; background: var(--accent); display: flex; align-items: center; justify-content: center; font-size: .95rem; }
.brand h1 { font-size: inherit; font-weight: inherit; margin: 0; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav-group { font-size: .62rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--muted-2); padding: 14px 10px 6px; }
.nav-link { display: flex; align-items: center; gap: 11px; padding: 9px 11px; border-radius: var(--radius-sm); color: var(--muted); font-weight: 500; font-size: .86rem; margin-bottom: 2px; transition: background .12s, color .12s; }
.nav-link i { font-size: 1rem; width: 18px; text-align: center; }
.nav-link:hover { background: var(--input); color: var(--text); }
.nav-link.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; gap: 16px; padding: 18px 28px; border-bottom: 1px solid var(--border); background: var(--panel); position: sticky; top: 0; z-index: 5; }
.topbar .crumbs { font-size: .72rem; color: var(--muted-2); }
.topbar h1 { font-size: 1.15rem; font-weight: 600; margin: 2px 0 0; }
.topbar .actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }
/* Wider canvas — plenty of breathing room on big screens */
.content { padding: 26px 32px; max-width: 1500px; width: 100%; margin: 0 auto; }

/* ── Theme toggle ── */
.theme-toggle { width: 38px; height: 38px; border: 1px solid var(--border); background: var(--input); border-radius: var(--radius-sm); color: var(--muted); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; font-size: 1rem; transition: background .15s, color .15s; }
.theme-toggle:hover { background: var(--border); color: var(--text); }
.theme-toggle .bi-sun-fill { display: none; }
[data-theme="dark"] .theme-toggle .bi-sun-fill { display: inline; }
[data-theme="dark"] .theme-toggle .bi-moon-stars-fill { display: none; }

/* ── Buttons ── */
.btn { padding: 9px 16px; font-size: .8125rem; font-weight: 500; border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--input); color: var(--text); cursor: pointer; display: inline-flex; align-items: center; gap: 7px; transition: background .15s, border-color .15s, filter .15s; font-family: var(--font); }
.btn:hover { background: var(--border); }
.btn-sm { padding: 6px 12px; font-size: .78rem; }
.btn-lg { padding: 11px 20px; font-size: .9rem; }
.btn-primary, .btn-accent { background: var(--primary); color: var(--primary-fg); border-color: var(--primary); }
.btn-primary:hover, .btn-accent:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn-accent { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn-accent:hover { filter: brightness(1.08); background: var(--accent); }
.btn-outline-primary { background: transparent; border-color: var(--accent); color: var(--accent); }
.btn-outline-primary:hover { background: var(--accent-soft); }
.btn-outline-secondary { background: transparent; }
.btn-outline-secondary:hover { background: var(--input); }
.btn-outline-info { background: transparent; border-color: var(--accent-border); color: var(--accent); }
.btn-outline-info:hover { background: var(--accent-soft); }
.btn-outline-danger { background: transparent; border-color: rgba(239,68,68,.4); color: var(--bad); }
.btn-outline-danger:hover { background: var(--bad-soft); }
.btn-grow { flex: 1; justify-content: center; }

/* ── Forms ── */
.form-label { display: block; font-size: .78rem; font-weight: 600; color: var(--muted); margin-bottom: 5px; }
.form-control, .form-select { width: 100%; padding: 9px 11px; font-size: .85rem; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--input); color: var(--text); font-family: var(--font); }
.form-control:focus, .form-select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.form-control::placeholder { color: var(--muted-2); }
textarea.form-control { resize: vertical; line-height: 1.6; }
.form-check { display: flex; align-items: center; gap: 8px; }
.form-check-input { width: 16px; height: 16px; accent-color: var(--accent); cursor: pointer; }
.form-switch .form-check-input { width: 34px; height: 18px; border-radius: 20px; }
.form-check-label { font-size: .82rem; color: var(--text); cursor: pointer; }

/* ── Labels / pills / panels ── */
.section-eyebrow { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 0 0 4px; }
.section-title { font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 0 0 12px; display: flex; align-items: center; gap: 8px; }
.pill { font-size: 10px; padding: 2px 8px; border-radius: 10px; font-weight: 700; display: inline-block; background: var(--accent-soft); color: var(--accent); }
.pill.muted { background: var(--input); color: var(--muted); }
.pill.good { background: var(--good-soft); color: var(--good); }
.pill.bad { background: var(--bad-soft); color: var(--bad); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.panel, .factory-panel { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.factory-panel { padding: 20px 22px; }
.panel-h5 { font-size: 1rem; font-weight: 600; margin: 0; }
.panel-head { padding: 16px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.panel-head h3 { font-size: .95rem; font-weight: 600; margin: 0; display: flex; align-items: center; gap: 8px; }
.panel-head h3 i { color: var(--accent); }
.panel-body { padding: 18px 20px; }

/* ── Stats (icons use the single accent unless meaningful) ── */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 20px; }
.stat-card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px 18px; display: flex; align-items: center; gap: 14px; }
.stat-ico { width: 42px; height: 42px; border-radius: 11px; display: flex; align-items: center; justify-content: center; font-size: 1.15rem; flex-shrink: 0; background: var(--accent-soft); color: var(--accent); }
.stat-ico.good { background: var(--good-soft); color: var(--good); }
.stat-ico.bad { background: var(--bad-soft); color: var(--bad); }
.stat-ico.warn { background: var(--warn-soft); color: var(--warn); }
.stat-card .s-label { font-size: .72rem; color: var(--muted); margin: 0; }
.stat-card .s-value { font-size: 1.35rem; font-weight: 700; margin: 0; line-height: 1.2; color: var(--text); }

/* ── Status pill / tag chip (engine-emitted) ── */
.status-pill { display: inline-flex; align-items: center; border-radius: 999px; padding: .28rem .7rem; font-size: .68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; background: var(--input); color: var(--muted); }
.status-completed { background: var(--good-soft); color: var(--good); }
.status-running { background: var(--accent-soft); color: var(--accent); }
.status-failed { background: var(--bad-soft); color: var(--bad); }
.status-queued { background: var(--input); color: var(--muted); }
.tag-chip { display: inline-flex; align-items: center; padding: .26rem .66rem; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-size: .74rem; font-weight: 600; }

/* ── Table ── */
.table-responsive { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th { font-size: .64rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted-2); font-weight: 700; padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--border); }
.table td { padding: 11px 12px; border-bottom: 1px solid var(--border); font-size: .82rem; vertical-align: middle; color: var(--text); }
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: var(--input); }

/* ── Timeline ── */
.timeline-item { display: grid; grid-template-columns: 14px 1fr; gap: .8rem; align-items: start; margin-bottom: 1rem; }
.timeline-dot { width: 12px; height: 12px; border-radius: 50%; margin-top: .35rem; background: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }

/* ── JSON / code inspector ── */
.json-inspector { background: #0b0f14; color: #cbe7e2; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 1rem; min-height: 320px; max-height: 620px; overflow: auto; font-family: var(--mono); font-size: .8rem; line-height: 1.5; margin: 0; white-space: pre-wrap; word-break: break-word; }

/* ── Loading spinner ── */
.loading-state { display: flex; justify-content: center; align-items: center; min-height: 260px; }
.loading-spinner { width: 42px; height: 42px; border: 4px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: tspin 1s linear infinite; }
@keyframes tspin { to { transform: rotate(360deg); } }

/* ── Alert ── */
.alert { border-radius: var(--radius-sm); padding: 12px 16px; font-size: .85rem; margin-bottom: 20px; border: 1px solid var(--border); background: var(--panel); }
.alert-info { background: var(--accent-soft); border-color: var(--accent-border); color: var(--accent); }

/* ── Utility classes (covers what page engines emit) ── */
.d-flex { display: flex; } .d-grid { display: grid; } .d-none { display: none; } .d-block { display: block; }
.flex-column { flex-direction: column; } .flex-wrap { flex-wrap: wrap; } .flex-grow-1 { flex: 1 1 auto; }
.align-items-center { align-items: center; } .align-items-start { align-items: flex-start; }
.justify-content-between { justify-content: space-between; } .justify-content-end { justify-content: flex-end; } .justify-content-center { justify-content: center; }
.gap-1 { gap: 4px; } .gap-2 { gap: 8px; } .gap-3 { gap: 12px; } .gap-4 { gap: 16px; }
.mb-0 { margin-bottom: 0; } .mb-1 { margin-bottom: 4px; } .mb-2 { margin-bottom: 8px; } .mb-3 { margin-bottom: 14px; } .mb-4 { margin-bottom: 20px; }
.mt-1 { margin-top: 4px; } .mt-2 { margin-top: 8px; } .mt-3 { margin-top: 14px; } .me-1 { margin-right: 4px; } .ms-1 { margin-left: 4px; } .ms-auto { margin-left: auto; }
.ps-3 { padding-left: 14px; } .pt-3 { padding-top: 14px; } .py-4 { padding: 18px 0; } .py-5 { padding: 28px 0; } .p-3 { padding: 14px; }
.text-muted { color: var(--muted); } .text-sm { font-size: .85rem; } .text-xs { font-size: .72rem; } .small { font-size: .8rem; }
.text-center { text-align: center; } .text-end { text-align: right; } .text-uppercase { text-transform: uppercase; } .text-decoration-none { text-decoration: none; } .fw-bold { font-weight: 700; } .fw-semibold { font-weight: 600; }
.text-success { color: var(--good); } .text-danger { color: var(--bad); } .text-warning { color: var(--warn); } .text-accent { color: var(--accent); }
.h-100 { height: 100%; } .w-100 { width: 100%; }
.row { display: flex; flex-wrap: wrap; gap: 16px; }
.row > [class*="col-"] { margin: 0; }
.col-12 { flex: 0 0 100%; max-width: 100%; }
.col-xl-6, .col-lg-6, .col-md-6 { flex: 1 1 calc(50% - 8px); min-width: 240px; }
.col-xl-4, .col-lg-4, .col-md-4 { flex: 1 1 calc(33.333% - 11px); min-width: 200px; }
.col-xl-3, .col-lg-3 { flex: 1 1 calc(25% - 12px); min-width: 180px; }

@media (max-width: 1080px) { .stats { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 760px) {
  .sidebar { display: none; }
  .content { padding: 18px; } .topbar { padding: 14px 18px; }
}

#brandClientName { display: none !important; }
