/* Orchestrator UI v2 — ruflo-inspired dark/light theme (2026-05-12) */

:root {
  /* Dark by default — ruflo design tokens */
  --bg:          hsl(220, 13%, 10%);
  --bg-elevated: hsl(220, 13%, 14%);
  --bg-hover:    hsl(220, 13%, 18%);
  --border:      hsl(220, 13%, 22%);
  --fg:          hsl(0, 0%, 95%);
  --fg-muted:    hsl(220, 9%, 60%);
  --fg-subtle:   hsl(220, 9%, 50%);
  --accent:      hsl(217, 91%, 60%);
  --accent-fg:   hsl(0, 0%, 98%);
  --accent-glow: hsl(217, 91%, 70%);
  --success:     hsl(142, 76%, 45%);
  --warning:     hsl(38, 92%, 55%);
  --danger:      hsl(0, 84%, 60%);
  --purple:      hsl(263, 70%, 60%);
  --orange:      hsl(25, 95%, 55%);

  --grad-card:   linear-gradient(180deg, hsl(220, 13%, 16%), hsl(220, 13%, 13%));
  --grad-stat:   linear-gradient(135deg, hsl(217, 91%, 50%) 0%, hsl(263, 70%, 50%) 100%);

  --radius:      8px;
  --radius-sm:   4px;
  --shadow:      0 2px 8px hsla(220, 13%, 5%, 0.4);
  --shadow-lg:   0 8px 24px hsla(220, 13%, 5%, 0.5);

  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: "SF Mono", Menlo, Consolas, monospace;

  --sidebar-w:   240px;
  --header-h:   54px;
}

[data-theme="light"] {
  --bg:          hsl(0, 0%, 99%);
  --bg-elevated: hsl(0, 0%, 100%);
  --bg-hover:    hsl(220, 13%, 95%);
  --border:      hsl(220, 13%, 90%);
  --fg:          hsl(220, 13%, 15%);
  --fg-muted:    hsl(220, 9%, 45%);
  --fg-subtle:   hsl(220, 9%, 55%);
  --grad-card:   linear-gradient(180deg, hsl(0, 0%, 100%), hsl(220, 13%, 98%));
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { background: var(--bg); color: var(--fg); font-family: var(--font); font-size: 14px; min-height: 100vh; }

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-glow); text-decoration: underline; }

/* ──── Layout: Sidebar + Main ──── */
.os-shell { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100vh; }
.os-sidebar { background: var(--bg-elevated); border-right: 1px solid var(--border); padding: 16px 12px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.os-main { padding: 24px 32px; min-width: 0; }
.os-brand { display: flex; align-items: center; gap: 8px; padding: 4px 8px 18px; font-weight: 700; font-size: 1.05em; color: var(--fg); border-bottom: 1px solid var(--border); margin-bottom: 14px; }
.os-brand:hover { text-decoration: none; }
.os-brand-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--grad-stat); }
.os-search { margin: 0 4px 14px; }
.os-search-input { width: 100%; min-height: 34px; padding: 7px 10px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg); color: var(--fg); font-size: 0.88em; outline: none; }
.os-search-input::placeholder { color: var(--fg-subtle); }
.os-search-input:focus { border-color: var(--accent); box-shadow: 0 0 0 2px hsla(217, 91%, 60%, 0.22); }

.os-nav { list-style: none; padding: 0; margin: 0; }
.os-nav-section { font-size: 0.72em; text-transform: uppercase; letter-spacing: 0.08em; color: var(--fg-subtle); padding: 14px 8px 6px; font-weight: 600; }
.os-nav-link { display: flex; align-items: center; gap: 8px; padding: 7px 10px; border-radius: var(--radius-sm); color: var(--fg-muted); margin-bottom: 1px; font-size: 0.92em; }
.os-nav-link:hover { background: var(--bg-hover); color: var(--fg); text-decoration: none; }
.os-nav-link.active { background: var(--accent); color: var(--accent-fg); }
.os-nav-link.active:hover { background: var(--accent); }
.os-nav-icon { width: 16px; display: inline-block; opacity: 0.7; }

.os-theme-toggle { position: absolute; bottom: 16px; left: 12px; right: 12px; padding: 8px; background: var(--bg-hover); border: 1px solid var(--border); color: var(--fg-muted); border-radius: var(--radius-sm); cursor: pointer; text-align: center; font-size: 0.85em; }
.os-theme-toggle:hover { color: var(--fg); }

/* ──── Header ──── */
.os-page-title { margin: 0 0 18px; font-size: 1.4em; font-weight: 700; color: var(--fg); }
.os-page-subtitle { color: var(--fg-muted); margin: -10px 0 22px; font-size: 0.92em; }

/* ──── Cards ──── */
.os-card { background: var(--grad-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; margin-bottom: 14px; box-shadow: var(--shadow); }
.os-card-title { font-weight: 600; margin: 0 0 8px; color: var(--fg); display: flex; justify-content: space-between; align-items: center; }
.os-card-meta { color: var(--fg-muted); font-size: 0.82em; }

/* ──── Stat Grid ──── */
.os-stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 14px; margin-bottom: 24px; }
.os-stat { background: var(--grad-stat); color: var(--accent-fg); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow-lg); position: relative; overflow: hidden; }
.os-stat-num { font-size: 2em; font-weight: 700; display: block; line-height: 1; }
.os-stat-label { font-size: 0.82em; opacity: 0.92; margin-top: 4px; display: block; }
.os-stat-link { color: var(--accent-fg); opacity: 0.8; font-size: 0.78em; margin-top: 6px; display: inline-block; }
.os-stat-link:hover { opacity: 1; color: var(--accent-fg); }

/* Variants for stat color */
.os-stat.success { background: linear-gradient(135deg, hsl(142, 76%, 35%), hsl(142, 76%, 50%)); }
.os-stat.warning { background: linear-gradient(135deg, hsl(38, 92%, 45%), hsl(38, 92%, 60%)); }
.os-stat.danger  { background: linear-gradient(135deg, hsl(0, 84%, 50%), hsl(0, 84%, 65%)); }
.os-stat.purple  { background: linear-gradient(135deg, hsl(263, 70%, 50%), hsl(290, 70%, 60%)); }

/* ──── Pills / Badges ──── */
.os-pill { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 0.78em; background: var(--bg-hover); color: var(--fg-muted); border: 1px solid var(--border); }
.os-pill.accent { background: var(--accent); color: var(--accent-fg); border-color: transparent; }
.os-pill.success { background: var(--success); color: white; border-color: transparent; }
.os-pill.warning { background: var(--warning); color: white; border-color: transparent; }
.os-pill.danger { background: var(--danger); color: white; border-color: transparent; }
.os-pill.purple { background: var(--purple); color: white; border-color: transparent; }

/* ──── Tables ──── */
.os-table { width: 100%; border-collapse: collapse; }
.os-table th, .os-table td { padding: 8px 12px; text-align: left; border-bottom: 1px solid var(--border); font-size: 0.9em; }
.os-table th { color: var(--fg-muted); font-weight: 500; text-transform: uppercase; font-size: 0.72em; letter-spacing: 0.05em; }
.os-table tr:hover td { background: var(--bg-hover); }

/* ──── Buttons ──── */
.os-btn { display: inline-block; padding: 7px 14px; border-radius: var(--radius-sm); background: var(--bg-hover); color: var(--fg); border: 1px solid var(--border); cursor: pointer; font-size: 0.88em; }
.os-btn:hover { background: var(--accent); color: var(--accent-fg); border-color: var(--accent); text-decoration: none; }
.os-btn.primary { background: var(--accent); color: var(--accent-fg); border-color: var(--accent); }
.os-btn.primary:hover { background: var(--accent-glow); }

/* ──── Footer ──── */
.os-footer { color: var(--fg-subtle); font-size: 0.8em; margin-top: 40px; padding-top: 16px; border-top: 1px solid var(--border); }

/* ──── Backwards-compat shims for existing ss-* classes ──── */
.ss-main { padding: 0; }
.ss-page-title { font-size: 1.4em; font-weight: 700; color: var(--fg); margin: 0 0 18px; }
.ss-stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 14px; margin-bottom: 24px; }
.ss-stat-card { background: var(--grad-stat); color: var(--accent-fg); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow-lg); }
.ss-stat-num { font-size: 2em; font-weight: 700; display: block; }
.ss-stat-label { font-size: 0.82em; opacity: 0.92; display: block; margin-top: 4px; }
.ss-stat-link { color: var(--accent-fg); opacity: 0.8; font-size: 0.78em; }
.ss-card { background: var(--grad-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; margin-bottom: 14px; }
.ss-footer { color: var(--fg-subtle); font-size: 0.8em; margin-top: 40px; padding-top: 16px; border-top: 1px solid var(--border); }
.ss-badge { background: var(--bg-hover); color: var(--fg-muted); padding: 3px 8px; border-radius: 999px; font-size: 0.72em; border: 1px solid var(--border); }
.ss-btn { display: inline-block; padding: 7px 14px; border-radius: var(--radius-sm); background: var(--bg-hover); color: var(--fg); border: 1px solid var(--border); }
.ss-btn:hover { background: var(--accent); color: var(--accent-fg); }
table { border-collapse: collapse; }
th, td { padding: 8px 12px; border-bottom: 1px solid var(--border); }

/* ──── Responsive ──── */
@media (max-width: 920px) {
  .os-shell { grid-template-columns: 1fr; }
  .os-sidebar { position: relative; height: auto; border-right: 0; border-bottom: 1px solid var(--border); }
  .os-main { padding: 16px; }
}
