/* Inspiration OS: light by default, dark on toggle. Amber accent. Bootstrap 5.3 colour modes underneath. */
:root, [data-bs-theme="light"] {
  --ios-bg: #f4f5f9; --ios-panel: #ffffff; --ios-panel-2: #eef0f6; --ios-border: #dfe3ee;
  --ios-text: #1b2033; --ios-muted: #6b7390; --ios-accent: #e0a100; --ios-accent-2: #ff7a1a;
  --ios-ok: #159a6a; --ios-warn: #c98a00; --ios-bad: #d54848;
  --ios-side-bg: linear-gradient(180deg, #ffffff 0%, #f7f8fc 100%); --ios-side-text: #3b4360;
  --bs-body-bg: var(--ios-bg); --bs-body-color: var(--ios-text); --bs-border-color: var(--ios-border);
  --bs-link-color: #b07f00; --bs-link-hover-color: #8a6300; --bs-secondary-color: var(--ios-muted);
}
[data-bs-theme="dark"] {
  --ios-bg: #0b1020; --ios-panel: #131a2e; --ios-panel-2: #1a2340; --ios-border: #263052;
  --ios-text: #e6e9f2; --ios-muted: #8b94b3; --ios-accent: #f5b301; --ios-accent-2: #ff7a1a;
  --ios-ok: #34d399; --ios-warn: #fbbf24; --ios-bad: #f87171;
  --ios-side-bg: linear-gradient(180deg, #0e1530 0%, #0b1020 100%); --ios-side-text: #c7cde3;
  --bs-body-bg: var(--ios-bg); --bs-body-color: var(--ios-text); --bs-border-color: var(--ios-border);
  --bs-link-color: var(--ios-accent); --bs-link-hover-color: #ffd257; --bs-secondary-color: var(--ios-muted);
}
html, body { height: 100%; }
body { font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; background: var(--ios-bg); color: var(--ios-text); }
a { text-decoration: none; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .9em; }

/* shell */
.shell { display: flex; min-height: 100vh; }
.sidebar { width: 232px; flex: 0 0 232px; background: var(--ios-side-bg); border-right: 1px solid var(--ios-border); padding: 20px 14px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 18px; color: var(--ios-text) !important; font-weight: 700; letter-spacing: .2px; }
.brand .glow { width: 14px; height: 14px; border-radius: 50%; background: var(--ios-accent); box-shadow: 0 0 12px 3px rgba(245,179,1,.55); }
.brand small { display: block; font-weight: 500; color: var(--ios-muted); font-size: .72rem; letter-spacing: .12em; text-transform: uppercase; }
.nav-section { color: var(--ios-muted); font-size: .7rem; letter-spacing: .12em; text-transform: uppercase; padding: 14px 10px 6px; }
.sidebar .nav-link { color: var(--ios-side-text); border-radius: 8px; padding: 8px 10px; display: flex; align-items: center; gap: 10px; font-size: .95rem; }
.sidebar .nav-link:hover { background: var(--ios-panel-2); color: var(--ios-text); }
.sidebar .nav-link.active { background: rgba(245,179,1,.12); color: var(--ios-accent); }
.sidebar .nav-link i { width: 18px; text-align: center; opacity: .9; }
.main { flex: 1; min-width: 0; padding: 28px 32px 48px; }
.topbar { display: flex; align-items: center; gap: 16px; margin-bottom: 22px; }
.topbar h1 { font-size: 1.45rem; font-weight: 700; margin: 0; }
.org-switch select { background: var(--ios-panel); color: var(--ios-text); border-color: var(--ios-border); }

/* panels */
.panel { background: var(--ios-panel); border: 1px solid var(--ios-border); border-radius: 12px; }
.panel-h { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--ios-border); font-weight: 600; }
.panel-b { padding: 16px; }
.table { --bs-table-bg: transparent; --bs-table-color: var(--ios-text); --bs-table-border-color: var(--ios-border); --bs-table-hover-bg: rgba(255,255,255,.03); margin-bottom: 0; }
/* let row menus escape the table wrapper on wide screens; keep horizontal scroll on phones */
@media (min-width: 992px) { .table-responsive { overflow: visible; } }
.table thead th { color: var(--ios-muted); font-weight: 600; font-size: .75rem; letter-spacing: .06em; text-transform: uppercase; border-bottom-width: 1px; }
.table td, .table th { vertical-align: middle; }
.form-control, .form-select { background: var(--ios-bg); color: var(--ios-text); border-color: var(--ios-border); }
.form-control:focus, .form-select:focus { background: var(--ios-bg); color: var(--ios-text); border-color: var(--ios-accent); box-shadow: 0 0 0 .2rem rgba(245,179,1,.15); }
.form-label { color: var(--ios-muted); font-size: .8rem; }
.btn-accent { background: var(--ios-accent); border-color: var(--ios-accent); color: #1a1200; font-weight: 600; }
.btn-accent:hover { background: #ffd257; border-color: #ffd257; color: #1a1200; }
.btn-outline-light { --bs-btn-color: var(--ios-side-text); --bs-btn-border-color: var(--ios-border); --bs-btn-hover-bg: var(--ios-panel-2); --bs-btn-hover-border-color: var(--ios-border); --bs-btn-hover-color: var(--ios-text); --bs-btn-active-bg: var(--ios-panel-2); --bs-btn-active-color: var(--ios-text); --bs-btn-active-border-color: var(--ios-border); }

/* stats */
.stat { background: var(--ios-panel); border: 1px solid var(--ios-border); border-radius: 12px; padding: 14px 16px; }
.stat .k { color: var(--ios-muted); font-size: .75rem; letter-spacing: .08em; text-transform: uppercase; }
.stat .v { font-size: 1.7rem; font-weight: 700; line-height: 1.2; }
.stat .v small { font-size: .9rem; color: var(--ios-muted); font-weight: 500; }

/* status dots and badges */
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--ios-muted); vertical-align: middle; }
.dot.on { background: var(--ios-ok); box-shadow: 0 0 8px rgba(52,211,153,.6); }
.dot.warn { background: var(--ios-warn); }
.dot.off { background: #b8bfd3; }
[data-bs-theme="dark"] .dot.off { background: #4b536e; }
.badge-mode { font-weight: 600; font-size: .7rem; letter-spacing: .06em; text-transform: uppercase; padding: .3em .55em; border-radius: 6px; }
.mode-realtime { background: rgba(52,211,153,.15); color: var(--ios-ok); }
.mode-fallback, .mode-idle, .mode-manual { background: rgba(139,148,179,.15); color: var(--ios-muted); }
.mode-test, .mode-identify { background: rgba(245,179,1,.15); color: var(--ios-accent); }
.badge-new { background: rgba(255,122,26,.18); color: var(--ios-accent-2); }
.pill { border-radius: 999px; padding: .15em .6em; font-size: .78rem; background: var(--ios-panel-2); color: var(--ios-side-text); }
.pill.ok { background: rgba(52,211,153,.15); color: var(--ios-ok); }
.pill.bad { background: rgba(248,113,113,.15); color: var(--ios-bad); }
.pill.warn { background: rgba(251,191,36,.15); color: var(--ios-warn); }

/* box cards */
.box-card { background: var(--ios-panel); border: 1px solid var(--ios-border); border-radius: 14px; padding: 16px 18px; color: var(--ios-text); display: block; transition: border-color .15s, transform .15s; }
.box-card:hover { border-color: var(--ios-accent); color: var(--ios-text); transform: translateY(-1px); }
.box-card .n { font-size: 1.6rem; font-weight: 800; color: var(--ios-accent); line-height: 1; }
.box-card .name { font-weight: 600; margin-top: 6px; }
.outputs { display: grid; grid-template-columns: repeat(10, 1fr); gap: 4px; margin-top: 12px; }
.outputs span { height: 8px; border-radius: 3px; background: var(--ios-panel-2); }
.outputs span.on { background: var(--ios-ok); }
.outputs span.lim { background: var(--ios-warn); }
.outputs span.off { background: var(--ios-bad); }

/* show controls */
.range-accent { accent-color: var(--ios-accent); }
.preset-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
.preset-btn { background: var(--ios-panel-2); border: 1px solid var(--ios-border); color: var(--ios-text); border-radius: 10px; padding: 10px 12px; text-align: left; }
.preset-btn:hover { border-color: var(--ios-accent); }
.preset-btn.active { border-color: var(--ios-accent); background: rgba(245,179,1,.12); }
.preset-btn.active { color: var(--ios-text); }
.preset-btn .sw { display: block; height: 6px; border-radius: 3px; margin-bottom: 8px; }
.log { font-family: ui-monospace, Menlo, monospace; font-size: .78rem; color: var(--ios-muted); white-space: pre-wrap; max-height: 260px; overflow: auto; }
.toast-ios { position: fixed; right: 20px; bottom: 20px; z-index: 50; background: var(--ios-panel-2); border: 1px solid var(--ios-border); border-left: 3px solid var(--ios-accent); color: var(--ios-text); padding: 10px 14px; border-radius: 10px; box-shadow: 0 10px 30px rgba(0,0,0,.4); max-width: 380px; }
.toast-ios.bad { border-left-color: var(--ios-bad); }

/* public */
.public-wrap { min-height: 100vh; display: grid; place-items: center; background: radial-gradient(1200px 600px at 50% -10%, rgba(245,179,1,.18), transparent 60%), var(--ios-bg); padding: 24px; }
.public-card { width: 100%; max-width: 420px; background: var(--ios-panel); border: 1px solid var(--ios-border); border-radius: 16px; padding: 32px; }

@media (max-width: 900px) {
  .shell { flex-direction: column; }
  .sidebar { width: auto; flex: none; height: auto; position: static; display: flex; flex-wrap: wrap; gap: 4px; padding: 12px; }
  .sidebar .brand { width: 100%; padding-bottom: 8px; }
  .nav-section { display: none; }
  .main { padding: 18px 16px 40px; }
  .outputs { grid-template-columns: repeat(10, 1fr); }
}
@media print {
  body { background: #fff; color: #000; }
}

/* avatar + theme toggle */
.avatar { width: 30px; height: 30px; border-radius: 50%; object-fit: cover; background: var(--ios-panel-2); flex: none; }
.avatar-fallback { width: 30px; height: 30px; border-radius: 50%; background: var(--ios-accent); color: #1a1200; font-weight: 700; font-size: .8rem; display: grid; place-items: center; flex: none; }
.theme-toggle { cursor: pointer; }

/* marketing site */
.site { --site-max: 1080px; }
.site nav.top { display: flex; align-items: center; gap: 16px; max-width: var(--site-max); margin: 0 auto; padding: 18px 24px; }
.site .hero { max-width: var(--site-max); margin: 0 auto; padding: 56px 24px 40px; display: grid; grid-template-columns: 1.1fr .9fr; gap: 40px; align-items: center; }
.site .hero h1 { font-size: clamp(2rem, 4.5vw, 3.4rem); font-weight: 800; line-height: 1.08; letter-spacing: -.02em; margin-bottom: 16px; }
.site .hero p.lead { color: var(--ios-muted); font-size: 1.15rem; }
.site .eyebrow { color: var(--ios-accent); font-weight: 700; letter-spacing: .14em; text-transform: uppercase; font-size: .75rem; }
.site section { max-width: var(--site-max); margin: 0 auto; padding: 40px 24px; }
.site h2 { font-weight: 800; letter-spacing: -.01em; font-size: 1.7rem; margin-bottom: 8px; }
.site .sub { color: var(--ios-muted); max-width: 640px; margin-bottom: 28px; }
.site .feature { background: var(--ios-panel); border: 1px solid var(--ios-border); border-radius: 16px; padding: 22px; height: 100%; }
.site .feature i { font-size: 1.5rem; color: var(--ios-accent); }
.site .feature h5 { font-weight: 700; margin: 12px 0 6px; }
.site .feature p { color: var(--ios-muted); margin: 0; font-size: .95rem; }
.site .step { display: flex; gap: 14px; }
.site .step .n { width: 32px; height: 32px; border-radius: 50%; background: var(--ios-accent); color: #1a1200; font-weight: 800; display: grid; place-items: center; flex: none; }
.site .spec { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }
.site .spec div { background: var(--ios-panel); border: 1px solid var(--ios-border); border-radius: 12px; padding: 14px; }
.site .spec .k { color: var(--ios-muted); font-size: .75rem; text-transform: uppercase; letter-spacing: .08em; }
.site .spec .v { font-weight: 700; font-size: 1.05rem; }
.site .cta { background: linear-gradient(135deg, #1b2033, #2a3457); color: #fff; border-radius: 20px; padding: 40px; display: flex; flex-wrap: wrap; gap: 20px; align-items: center; justify-content: space-between; }
.site .cta h3 { font-weight: 800; margin: 0 0 6px; }
.site footer { max-width: var(--site-max); margin: 0 auto; padding: 24px; color: var(--ios-muted); font-size: .85rem; display: flex; flex-wrap: wrap; gap: 12px; justify-content: space-between; }
.trail { position: relative; height: 320px; border-radius: 20px; background: radial-gradient(600px 300px at 30% 20%, rgba(245,179,1,.25), transparent 60%), #0b1020; overflow: hidden; border: 1px solid var(--ios-border); }
.trail .l { position: absolute; width: 6px; height: 46px; border-radius: 3px; background: linear-gradient(180deg, #ffd257, #ff7a1a); box-shadow: 0 0 14px 3px rgba(245,179,1,.45); animation: glow 2.4s ease-in-out infinite; }
.trail .l:nth-child(3n) { background: linear-gradient(180deg, #7dd3fc, #38bdf8); box-shadow: 0 0 14px 3px rgba(56,189,248,.45); animation-delay: .6s; }
.trail .l:nth-child(4n) { background: linear-gradient(180deg, #c084fc, #a855f7); box-shadow: 0 0 14px 3px rgba(168,85,247,.45); animation-delay: 1.2s; }
@keyframes glow { 0%, 100% { opacity: .55; } 50% { opacity: 1; } }
@media (max-width: 820px) { .site .hero { grid-template-columns: 1fr; } .trail { height: 200px; } }
