:root {
    --sb-bg: #0f172a;
    --sb-bg2: #1e293b;
    --sb-accent: #f59e0b;
    --sb-accent2: #fbbf24;
    --content-bg: #f5f7fa;
}

html, body { height: 100%; }

body {
    background: var(--content-bg);
    font-family: 'Segoe UI', system-ui, -apple-system, Arial, sans-serif;
    color: #1f2933;
}

/* ---------- App shell ---------- */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
    width: 240px;
    flex-shrink: 0;
    background: linear-gradient(180deg, var(--sb-bg) 0%, var(--sb-bg2) 100%);
    color: #cbd5e1;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
}

.brand { display: flex; align-items: center; gap: .65rem; padding: 1.25rem 1.25rem 1rem; border-bottom: 1px solid rgba(255,255,255,.08); }
.brand-logo { width: 38px; height: 38px; flex-shrink: 0; }
.brand-mark { font-size: 1.8rem; color: var(--sb-accent2); line-height: 1; }
.brand-text { font-weight: 700; color: #fff; line-height: 1.1; }
.brand-text small { font-weight: 400; color: #94a3b8; font-size: .72rem; letter-spacing: .12em; text-transform: uppercase; }

.side-nav { padding: .75rem .6rem; flex-grow: 1; }
.side-nav a {
    display: flex; align-items: center; gap: .65rem;
    padding: .6rem .75rem; margin-bottom: .15rem; border-radius: 8px;
    color: #cbd5e1; text-decoration: none; font-size: .94rem;
    transition: background .15s, color .15s;
}
.side-nav a span { width: 1.2rem; text-align: center; }
.side-nav a:hover { background: rgba(255,255,255,.06); color: #fff; }
.side-nav a.active { background: var(--sb-accent); color: #1f2933; font-weight: 600; }

.side-foot { padding: 1rem; border-top: 1px solid rgba(255,255,255,.08); }
.side-user { font-size: .82rem; color: #94a3b8; margin-bottom: .5rem; overflow: hidden; text-overflow: ellipsis; }

.content { flex-grow: 1; padding: 1.75rem 2rem; max-width: 1400px; }

/* ---------- Page heading ---------- */
.page-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.25rem; flex-wrap: wrap; gap: .75rem; }
.page-head h1 { font-size: 1.5rem; font-weight: 700; margin: 0; }
.page-head .subtitle { color: #64748b; font-size: .9rem; }

/* ---------- Cards / tiles ---------- */
.tile { background: #fff; border-radius: 12px; box-shadow: 0 1px 3px rgba(15,23,42,.08); padding: 1.25rem; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.stat { background:#fff; border-radius:12px; padding:1.1rem 1.25rem; box-shadow:0 1px 3px rgba(15,23,42,.08); }
.stat .num { font-size: 1.9rem; font-weight: 700; }
.stat .label { color:#64748b; font-size:.82rem; text-transform:uppercase; letter-spacing:.06em; }

.plant-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px,1fr)); gap: 1rem; }
.plant-card { background:#fff; border-radius:12px; padding:1.1rem; box-shadow:0 1px 3px rgba(15,23,42,.08); text-decoration:none; color:inherit; display:block; transition: transform .12s, box-shadow .12s; }
.plant-card:hover { transform: translateY(-2px); box-shadow:0 6px 18px rgba(15,23,42,.12); }
.plant-card h3 { font-size:1.05rem; margin:0 0 .35rem; }

/* ---------- Status badges ---------- */
.status { display:inline-block; padding:.2rem .55rem; border-radius:999px; font-size:.76rem; font-weight:600; }
.status-online { background:#d1fae5; color:#065f46; }
.status-offline { background:#e2e8f0; color:#475569; }
.status-alarm { background:#fee2e2; color:#991b1b; }
.status-standby { background:#fef3c7; color:#92400e; }
.status-disconnected { background:#e2e8f0; color:#475569; }
.status-unknown { background:#ede9fe; color:#5b21b6; }
.status-mixed { background:#fef3c7; color:#92400e; }

.state-pending { background:#e0e7ff; color:#3730a3; }
.state-shuttingdown, .state-restarting { background:#fef3c7; color:#92400e; }
.state-down { background:#dbeafe; color:#1e40af; }
.state-completed { background:#d1fae5; color:#065f46; }
.state-failed { background:#fee2e2; color:#991b1b; }
.state-cancelled { background:#e2e8f0; color:#475569; }

/* ---------- Tables ---------- */
.table-wrap { background:#fff; border-radius:12px; box-shadow:0 1px 3px rgba(15,23,42,.08); overflow:hidden; }
.table-wrap table { margin:0; }
.table-wrap thead th { background:#f8fafc; font-size:.78rem; text-transform:uppercase; letter-spacing:.04em; color:#64748b; border-bottom:1px solid #e2e8f0; }
.table-wrap td, .table-wrap th { vertical-align: middle; }

/* ---------- Command bar ---------- */
.command-bar { position: sticky; bottom: 0; background:#fff; border-top:1px solid #e2e8f0; padding:.85rem 1rem; display:flex; align-items:center; gap:.75rem; border-radius:0 0 12px 12px; }
.command-bar .sel-count { font-weight:600; color:#475569; margin-right:auto; }

/* ---------- Login ---------- */
.login-wrap { min-height:100vh; display:flex; align-items:center; justify-content:center; background: linear-gradient(135deg, #0f172a, #1e293b); }
.login-card { background:#fff; border-radius:16px; padding:2.25rem; width:100%; max-width:380px; box-shadow:0 20px 50px rgba(0,0,0,.35); }
.login-logo { display:block; width:180px; max-width:70%; margin:0 auto .5rem; }
.login-card h1 { font-size:1.15rem; text-align:center; color:#64748b; font-weight:500; margin:.25rem 0 1.5rem; }

.toast-host { position: fixed; top: 1rem; right: 1rem; z-index: 1080; display:flex; flex-direction:column; gap:.5rem; }
