:root {
  --bg: #f4f6fb; --text: #1b1f27; --card-bg: rgba(255,255,255,.65); --card-border: rgba(255,255,255,.4);
  --accent: #6366f1; --accent-2: #06b6d4; --muted: #6b7280; --shadow: 0 8px 32px rgba(31,38,135,.12);
}
[data-theme="dark"] {
  --bg: #0f1117; --text: #e5e7eb; --card-bg: rgba(30,32,44,.6); --card-border: rgba(255,255,255,.08);
  --muted: #9ca3af; --shadow: 0 8px 32px rgba(0,0,0,.45);
}
* { transition: background-color .25s ease, color .25s ease, border-color .25s ease; }
body { background: var(--bg); color: var(--text); font-family: 'Inter','Segoe UI',system-ui,sans-serif; min-height: 100vh; }

.bg-gradient-mesh {
  background: radial-gradient(circle at 15% 20%, rgba(99,102,241,.18), transparent 40%),
              radial-gradient(circle at 85% 10%, rgba(6,182,212,.18), transparent 40%),
              radial-gradient(circle at 50% 90%, rgba(236,72,153,.12), transparent 45%);
  position: fixed; inset: 0; z-index: -1;
}

.glass-card { background: var(--card-bg); border: 1px solid var(--card-border); border-radius: 20px; box-shadow: var(--shadow);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); transition: transform .2s ease, box-shadow .2s ease; }
.glass-card:hover { transform: translateY(-2px); }

.navbar-glass { background: var(--card-bg); backdrop-filter: blur(20px); border-bottom: 1px solid var(--card-border); }

.btn-gradient { background: linear-gradient(135deg, var(--accent), var(--accent-2)); border: none; color: #fff; font-weight: 600; border-radius: 12px; padding: .6rem 1.4rem; }
.btn-gradient:hover { opacity: .92; color: #fff; }

.badge-status-active { background: #16a34a22; color: #16a34a; }
.badge-status-pending_review { background: #f59e0b22; color: #f59e0b; }
.badge-status-stopped { background: #6b728022; color: #6b7280; }
.badge-status-suspended, .badge-status-rejected { background: #dc262622; color: #dc2626; }
.badge-status-approved { background: #16a34a22; color: #16a34a; }
.badge-status-pending { background: #f59e0b22; color: #f59e0b; }

.stat-number { font-size: 2rem; font-weight: 700; }
.theme-toggle { cursor: pointer; border: none; background: transparent; font-size: 1.2rem; color: var(--text); }

.plan-card.featured { border: 2px solid var(--accent); transform: scale(1.03); }
.progress-storage { height: 8px; border-radius: 8px; }
.fade-in { animation: fadeIn .4s ease both; }
@keyframes fadeIn { from { opacity:0; transform: translateY(8px);} to { opacity:1; transform: translateY(0);} }

code, .code-box { background: rgba(0,0,0,.06); padding: .5rem .75rem; border-radius: 8px; word-break: break-all; display: inline-block; }
[data-theme="dark"] code, [data-theme="dark"] .code-box { background: rgba(255,255,255,.08); }
.copy-btn { cursor: pointer; }

/* ============================ Hero / Landing ============================ */
.hero { padding: 6rem 0 4rem; text-align: center; }
.hero h1 { font-size: 3rem; font-weight: 800; line-height: 1.15; }
.hero p.lead { font-size: 1.2rem; color: var(--muted); }
.feature-icon { width: 52px; height: 52px; border-radius: 15px; display: flex; align-items: center; justify-content: center; font-size: 1.4rem; color: #fff; background: linear-gradient(135deg, var(--accent), var(--accent-2)); }
.step-num { width: 34px; height: 34px; border-radius: 50%; background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; flex-shrink: 0; }
footer.site-footer { border-top: 1px solid var(--card-border); padding: 2.5rem 0; color: var(--muted); font-size: .9rem; }

/* ============================ App Sidebar Layout ============================ */
.app-shell { display: flex; min-height: 100vh; }
.app-sidebar { width: 250px; flex-shrink: 0; background: var(--card-bg); border-right: 1px solid var(--card-border);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); position: sticky; top: 0; height: 100vh;
  padding: 1.5rem 1.1rem; display: flex; flex-direction: column; z-index: 1001; }
.app-sidebar .brand { font-weight: 800; font-size: 1.05rem; margin-bottom: 1.75rem; display: flex; align-items: center; gap: .6rem; padding: 0 .25rem; }
.app-sidebar .brand i { color: var(--accent); font-size: 1.3rem; }
.app-nav-link { display: flex; align-items: center; gap: .8rem; padding: .6rem .9rem; border-radius: 12px; color: var(--text); text-decoration: none; margin-bottom: .25rem; font-weight: 500; font-size: .9rem; opacity: .72; }
.app-nav-link i { font-size: 1.05rem; width: 1.1rem; text-align: center; }
.app-nav-link:hover { background: rgba(99,102,241,.1); opacity: 1; color: var(--text); }
.app-nav-link.active { background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; opacity: 1; box-shadow: 0 4px 14px rgba(99,102,241,.35); }
.nav-badge { margin-left: auto; background: #ef4444; color: #fff; font-size: .68rem; font-weight: 700; border-radius: 999px; padding: .1rem .45rem; line-height: 1.4; }
.app-sidebar-footer { border-top: 1px solid var(--card-border); }
.app-main { flex: 1; min-width: 0; }
.app-topbar { position: sticky; top: 0; z-index: 10; background: var(--card-bg); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--card-border); padding: .9rem 1.5rem; display: flex; align-items: center; justify-content: space-between; }
.app-content { padding: 1.5rem; }
.sidebar-toggle-btn { display: none; }
.app-sidebar-overlay { display: none; }
@media (max-width: 900px) {
  .app-sidebar { position: fixed; left: -270px; top: 0; box-shadow: 0 0 40px rgba(0,0,0,.25); transition: left .25s ease; }
  .app-shell.sidebar-open .app-sidebar { left: 0; }
  .sidebar-toggle-btn { display: inline-flex; }
  .app-sidebar-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 1000; }
  .app-shell.sidebar-open .app-sidebar-overlay { display: block; }
}

.avatar-circle { width: 38px; height: 38px; border-radius: 50%; background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff;
  display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: .9rem; flex-shrink: 0; }

.stat-card { display: flex; align-items: flex-start; gap: 1rem; }
.stat-icon { width: 46px; height: 46px; border-radius: 13px; display: flex; align-items: center; justify-content: center; font-size: 1.25rem; color: #fff; background: linear-gradient(135deg, var(--accent), var(--accent-2)); flex-shrink: 0; }
.stat-icon.warn { background: linear-gradient(135deg, #f59e0b, #f97316); }
.stat-icon.danger { background: linear-gradient(135deg, #ef4444, #dc2626); }
.stat-icon.success { background: linear-gradient(135deg, #16a34a, #22c55e); }

.table-modern { margin-bottom: 0; }
.table-modern thead th { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); border-bottom: 1px solid var(--card-border); font-weight: 700; padding-bottom: .75rem; }
.table-modern td { padding: .8rem .6rem; vertical-align: middle; border-bottom: 1px solid var(--card-border); }
.table-modern tbody tr:last-child td { border-bottom: none; }
.table-modern tbody tr:hover { background: rgba(99,102,241,.05); }

.empty-state { text-align: center; padding: 3rem 1rem; color: var(--muted); }
.empty-state i { font-size: 2.6rem; opacity: .35; display: block; margin-bottom: .75rem; }

.segmented { display: inline-flex; background: rgba(99,102,241,.08); border-radius: 12px; padding: .25rem; gap: .15rem; }
.segmented a { padding: .35rem .85rem; border-radius: 9px; font-size: .82rem; font-weight: 600; color: var(--text); text-decoration: none; opacity: .65; }
.segmented a.active { background: var(--card-bg); opacity: 1; box-shadow: 0 2px 8px rgba(0,0,0,.08); }

.section-card { padding: 1.5rem; }
.page-subtitle { color: var(--muted); font-size: .88rem; }

/* File manager */
.fm-tree-item { padding: .35rem .6rem; border-radius: 8px; cursor: pointer; display: flex; align-items: center; gap: .5rem; font-size: .88rem; }
.fm-tree-item:hover { background: rgba(99,102,241,.08); }
.fm-tree-item.active { background: rgba(99,102,241,.15); font-weight: 600; }
.fm-editor-wrap { border-radius: 14px; overflow: hidden; border: 1px solid var(--card-border); }
.CodeMirror { height: 460px; font-size: .88rem; }

/* Live log console */
.log-console { background: #0b0e14; color: #d1d5db; border-radius: 14px; padding: 1rem; font-family: 'Fira Code', monospace; font-size: .82rem; height: 360px; overflow-y: auto; }
.log-line { padding: .15rem 0; border-bottom: 1px solid rgba(255,255,255,.04); }
.log-level-info { color: #60a5fa; }
.log-level-warning { color: #fbbf24; }
.log-level-error { color: #f87171; }
