/* SiteOps Theme System: shared tokens and component surfaces. */
:root {
  --theme-bg: #eef3f9;
  --theme-bg-elevated: #f7f9fc;
  --theme-surface: #ffffff;
  --theme-surface-subtle: #f8fafc;
  --theme-sidebar: #ffffff;
  --theme-topbar: #ffffff;
  --theme-text: #24364b;
  --theme-heading: #304d6d;
  --theme-muted: #71869d;
  --theme-dim: #91a4b7;
  --theme-border: #dce5ef;
  --theme-border-subtle: #e8eef5;
  --theme-primary: #2563eb;
  --theme-primary-hover: #1d4ed8;
  --theme-primary-soft: #eef4ff;
  --theme-success: #16805a;
  --theme-success-soft: #ecfdf5;
  --theme-warning: #b45309;
  --theme-warning-soft: #fffbeb;
  --theme-danger: #be123c;
  --theme-danger-soft: #fff1f2;
  --theme-overlay: rgba(15, 23, 42, .54);
  --theme-shadow: 0 1px 2px rgba(15, 23, 42, .04);
  --theme-shadow-raised: 0 12px 36px rgba(15, 23, 42, .16);
  --theme-chart-grid: #e4ebf3;
  --theme-chart-track: rgba(148, 163, 184, .18);
  --theme-blue: #2563eb;
  --theme-cyan: #0891b2;
  --theme-green: #16a34a;
  --theme-purple: #7c3aed;
  --theme-orange: #d97706;
  --theme-red: #e11d48;
}

html[data-theme="dark"] {
  --theme-bg: #0b1220;
  --theme-bg-elevated: #111c2e;
  --theme-surface: #162235;
  --theme-surface-subtle: #1b2a40;
  --theme-sidebar: #0a1424;
  --theme-topbar: #111c2e;
  --theme-text: #e5edf7;
  --theme-heading: #e5edf7;
  --theme-muted: #94a3b8;
  --theme-dim: #6b7d96;
  --theme-border: #293b52;
  --theme-border-subtle: #24344b;
  --theme-primary: #3b82f6;
  --theme-primary-hover: #2563d8;
  --theme-primary-soft: rgba(59, 130, 246, .16);
  --theme-success: #34d399;
  --theme-success-soft: rgba(52, 211, 153, .14);
  --theme-warning: #fbbf24;
  --theme-warning-soft: rgba(251, 191, 36, .14);
  --theme-danger: #fb7185;
  --theme-danger-soft: rgba(251, 113, 133, .14);
  --theme-overlay: rgba(3, 8, 18, .78);
  --theme-shadow: 0 8px 24px rgba(0, 0, 0, .18);
  --theme-shadow-raised: 0 18px 60px rgba(0, 0, 0, .5);
  --theme-chart-grid: #24344b;
  --theme-chart-track: rgba(148, 163, 184, .16);
  --theme-blue: #3b82f6;
  --theme-cyan: #22d3ee;
  --theme-green: #34d399;
  --theme-purple: #a78bfa;
  --theme-orange: #fbbf24;
  --theme-red: #fb7185;
}

html, body, #app { min-width: 0; max-width: 100%; }
body { background: var(--theme-bg); color: var(--theme-text); }
html[data-landscape="off"] body, html[data-landscape="off"] .enterprise-content { background-image: none; }
html[data-landscape="on"] .enterprise-content { background-image: linear-gradient(rgba(238, 243, 249, .82), rgba(238, 243, 249, .92)), url('/assets/images/siteops-landscape-1.png'); background-size: cover; background-attachment: fixed; }
html[data-theme="dark"][data-landscape="on"] .enterprise-content { background-image: linear-gradient(rgba(11, 18, 32, .88), rgba(11, 18, 32, .94)), url('/assets/images/siteops-landscape-1.png'); }

.enterprise-shell, .enterprise-main, .enterprise-content { background: var(--theme-bg); color: var(--theme-text); }
.enterprise-sidebar, .enterprise-brand, .enterprise-sidebar-foot { background: var(--theme-sidebar); color: var(--theme-text); border-color: var(--theme-border); }
.enterprise-topbar { background: var(--theme-topbar); border-color: var(--theme-border); }
.enterprise-content h1, .enterprise-content h2, .enterprise-content h3, .enterprise-content h4, .ent-page-head h1, .ent-panel-head h2, .section-head h2 { color: var(--theme-heading); }
.enterprise-content p, .enterprise-content .muted, .muted, .ent-page-head p { color: var(--theme-muted); }
.enterprise-brand .brand, .ent-top-title b { color: var(--theme-heading); }
.enterprise-brand small, .ent-top-title span, .ent-user, .eyebrow { color: var(--theme-muted); }
.ent-nav-heading { color: var(--theme-muted); }
.ent-nav-heading span:last-child { color: var(--theme-dim); }
.ent-nav-item { color: var(--theme-text); }
.ent-nav-item:hover { color: var(--theme-primary); background: var(--theme-primary-soft); }
.ent-nav-item.active, .ent-nav-item.active:hover { color: var(--theme-primary); background: var(--theme-primary-soft); box-shadow: inset 3px 0 var(--theme-primary); }
.ent-nav-item .ent-icon { color: var(--theme-dim); }
.ent-nav-item.active .ent-icon { color: var(--theme-primary); }
.enterprise-sidebar-foot { border-top-color: var(--theme-border); }
.ent-global-search { background: var(--theme-surface-subtle); border-color: var(--theme-border); }
.ent-global-search input { background: transparent; color: var(--theme-text); }
.ent-global-search input::placeholder, input::placeholder, textarea::placeholder { color: var(--theme-dim); opacity: 1; }
.ent-search-icon { color: var(--theme-muted); }
.ent-top-actions .icon-btn { color: var(--theme-muted); background: var(--theme-surface); border-color: var(--theme-border); }
.ent-top-actions .icon-btn:hover { color: var(--theme-primary); background: var(--theme-primary-soft); }

.card, .ent-kpi-row, .ent-list-card, .ent-panel, .dashboard-panel, .dashboard-gauge, .login-card { background: var(--theme-surface); color: var(--theme-text); border-color: var(--theme-border); box-shadow: var(--theme-shadow); }
.ent-kpi-card, .quick-create-item, .asset-detail-grid, .ticket-fault-panel, .inspection-item, .vendor-row, .infra-row, .sop-toolbar, .sop-categories, .sop-list, .sop-reader-head, .sop-guide-head, .sop-flow-section, .handoff-result-card { background: var(--theme-surface); color: var(--theme-text); border-color: var(--theme-border); }
.ent-kpi-card:hover, .quick-create-item:hover { background: var(--theme-primary-soft); border-color: var(--theme-primary); }
.ent-kpi-card small, .ent-kpi-card span, .infra-row small, .infra-status, .vendor-row span, .vendor-row small { color: var(--theme-muted); }
.ent-kpi-card strong, .dashboard-kpi-card strong { color: var(--theme-heading); }
.ent-table, .table { color: var(--theme-text); }
.ent-table th, .table th { background: var(--theme-surface-subtle); color: var(--theme-muted); border-color: var(--theme-border); }
.ent-table td, .table td { color: var(--theme-text); border-color: var(--theme-border-subtle); }
.ent-table tbody tr:hover td, .table tbody tr:hover td { background: var(--theme-primary-soft); }
.ent-table td small, .table td small { color: var(--theme-muted); }
.ent-tabbar button { color: var(--theme-text); border-color: var(--theme-border); background: var(--theme-surface); }
.ent-tabbar button:hover, .ent-tabbar button.active { color: var(--theme-primary); background: var(--theme-primary-soft); border-color: var(--theme-primary); }

.btn { background: var(--theme-surface); color: var(--theme-text); border-color: var(--theme-border); }
.btn:hover { background: var(--theme-surface-subtle); border-color: var(--theme-primary); color: var(--theme-primary); }
.btn.primary { background: var(--theme-primary); border-color: var(--theme-primary); color: #fff; }
.btn.primary:hover { background: var(--theme-primary-hover); border-color: var(--theme-primary-hover); color: #fff; }
.btn.ghost { background: transparent; color: var(--theme-muted); }
input, select, textarea { background: var(--theme-surface); color: var(--theme-text); border-color: var(--theme-border); }
input:-webkit-autofill, input:-webkit-autofill:hover, input:-webkit-autofill:focus, textarea:-webkit-autofill, select:-webkit-autofill { -webkit-text-fill-color: var(--theme-text); -webkit-box-shadow: 0 0 0 1000px var(--theme-surface) inset; box-shadow: 0 0 0 1000px var(--theme-surface) inset; transition: background-color 9999s ease-in-out 0s; }
input:focus, select:focus, textarea:focus { border-color: var(--theme-primary); outline: 2px solid var(--theme-primary-soft); }
.form-grid label, label { color: var(--theme-muted); }
.status-pill, .risk-pill, .badge { background: var(--theme-primary-soft); color: var(--theme-primary); border-color: var(--theme-border); }
.status-pill.open, .risk-pill.danger { background: var(--theme-danger-soft); color: var(--theme-danger); }
.status-pill.resolved, .badge.ok { background: var(--theme-success-soft); color: var(--theme-success); }
.risk-pill.warning, .badge.warn { background: var(--theme-warning-soft); color: var(--theme-warning); }
.status-pill.closed, .status-pill.manual { background: var(--theme-surface-subtle); color: var(--theme-muted); }
.empty { color: var(--theme-muted); }
.modal { background: var(--theme-overlay); }
.modal-card { background: var(--theme-surface); color: var(--theme-text); border-color: var(--theme-border); box-shadow: var(--theme-shadow-raised); }
.modal-card h2 { color: var(--theme-heading); }
.modal-actions { background: var(--theme-surface); border-top-color: var(--theme-border); }
.toast { background: var(--theme-heading); color: var(--theme-surface); }
.link-button, .enterprise-content a { color: var(--theme-primary); }
.link-button:hover, .enterprise-content a:hover { color: var(--theme-primary-hover); }
.calendar-event, .report-bar b { background: var(--theme-primary-soft); color: var(--theme-primary); }
.calendar-event.done { background: var(--theme-success-soft); color: var(--theme-success); }
.selected-task { background: var(--theme-primary-soft); }
.report-preview { background: var(--theme-surface-subtle); border-color: var(--theme-border); color: var(--theme-text); }
.sop-prose, .sop-copy { color: var(--theme-text); }
.sop-prose h1, .sop-prose h2, .sop-prose h3, .sop-guide-title h1, .sop-section-heading h2 { color: var(--theme-heading); }
.sop-prose code, .sop-scene-card code { background: var(--theme-primary-soft); color: var(--theme-primary); }
.sop-prose blockquote, .handoff-note { background: var(--theme-surface-subtle); border-left-color: var(--theme-primary); color: var(--theme-muted); }
.sop-scene-card { background: var(--theme-primary-soft); border-color: var(--theme-border); color: var(--theme-text); }
.sop-step-card { background: var(--theme-surface); border-color: var(--theme-border); box-shadow: var(--theme-shadow); }

html[data-density="compact"] .enterprise-content { padding: 18px 22px 28px; }
html[data-density="compact"] .card, html[data-density="compact"] .ent-list-card { padding: 14px; }
html[data-density="compact"] .ent-table th, html[data-density="compact"] .ent-table td { padding-top: 8px; padding-bottom: 8px; }

.settings-appearance-card .settings-appearance-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; align-items: end; }
.settings-appearance-card .settings-appearance-grid label { margin: 0; }
.settings-appearance-card .settings-toggle { display: flex; align-items: center; gap: 8px; min-height: 42px; padding: 0 10px; border: 1px solid var(--theme-border); border-radius: 9px; background: var(--theme-surface-subtle); }
.settings-appearance-card .settings-toggle input { width: auto; accent-color: var(--theme-primary); }
@media (max-width: 780px) { .settings-appearance-card .settings-appearance-grid { grid-template-columns: 1fr; } }
