:root {
  --ink: #15213a;
  --muted: #72809a;
  --line: #e6eaf0;
  --surface: #ffffff;
  --canvas: #f5f7fb;
  --navy: #0c1730;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --teal: #0d9488;
  --danger: #dc2626;
  --warning: #b45309;
  --radius: 18px;
  --shadow: 0 16px 45px rgba(16, 31, 61, .08);
}
* { box-sizing: border-box; }
html { min-height: 100%; background: var(--canvas); }
body { margin: 0; color: var(--ink); font-family: Tahoma, Arial, sans-serif; background: var(--canvas); line-height: 1.55; }
button, input, select, textarea { font: inherit; }
a { color: var(--primary); text-decoration: none; }
.app-shell { min-height: 100vh; display: grid; grid-template-columns: 260px 1fr; }
.sidebar { position: sticky; top: 0; height: 100vh; padding: 28px 20px; color: #fff; background: radial-gradient(circle at 0 0, #173467, transparent 35%), var(--navy); display: flex; flex-direction: column; }
.brand { display: flex; align-items: center; gap: 12px; color: inherit; }
.brand-mark { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 14px; background: linear-gradient(135deg, #3b82f6, #22c55e); color: #fff; font-weight: 900; box-shadow: 0 10px 26px rgba(37, 99, 235, .35); }
.brand b, .brand small { display: block; }
.brand small { margin-top: 2px; color: #96a6c6; font-size: 11px; }
.sidebar nav { display: grid; gap: 7px; margin-top: 44px; }
.sidebar nav a { color: #b9c5dc; padding: 12px 14px; border-radius: 12px; transition: .2s ease; }
.sidebar nav a:hover { color: #fff; background: rgba(255,255,255,.08); transform: translateX(-2px); }
.sidebar-user { margin-top: auto; padding-top: 20px; border-top: 1px solid rgba(255,255,255,.1); display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 10px; }
.sidebar-user b, .sidebar-user small { display: block; }
.sidebar-user small { color: #8fa0c2; font-size: 11px; }
.avatar { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 12px; background: rgba(255,255,255,.12); }
.link-button { border: 0; color: #fca5a5; background: transparent; cursor: pointer; }
main { min-width: 0; }
.topbar { height: 78px; padding: 0 34px; border-bottom: 1px solid var(--line); background: rgba(255,255,255,.86); backdrop-filter: blur(16px); display: flex; align-items: center; justify-content: space-between; }
.topbar small, .topbar strong { display: block; }
.topbar small { color: var(--muted); }
.secure-pill { color: #047857; background: #ecfdf5; border: 1px solid #a7f3d0; border-radius: 999px; padding: 7px 12px; font-size: 12px; }
.secure-pill::before { content: "●"; margin-left: 7px; }
.content { max-width: 1450px; margin: 0 auto; padding: 34px; }
.page-head { margin-bottom: 24px; display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; }
.page-head h1 { margin: 2px 0 4px; font-size: 30px; letter-spacing: -.5px; }
.page-head p { margin: 0; color: var(--muted); }
.eyebrow { color: var(--primary) !important; font-weight: 700; font-size: 12px; letter-spacing: .5px; }
.actions, .row-actions, .form-actions { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.button { display: inline-flex; align-items: center; justify-content: center; min-height: 40px; padding: 8px 15px; border: 1px solid var(--line); border-radius: 11px; background: #fff; color: var(--ink); font-weight: 700; cursor: pointer; transition: .18s ease; }
.button:hover { border-color: #cbd5e1; transform: translateY(-1px); box-shadow: 0 7px 18px rgba(15, 23, 42, .07); }
.button-primary { border-color: var(--primary); background: var(--primary); color: #fff; }
.button-primary:hover { border-color: var(--primary-dark); background: var(--primary-dark); }
.button-danger { border-color: #fecaca; color: var(--danger); background: #fff7f7; }
.button-success { border-color: #a7f3d0; color: #047857; background: #ecfdf5; }
.button-small { min-height: 32px; padding: 5px 10px; font-size: 12px; border-radius: 9px; }
.button-wide { width: 100%; }
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 20px; }
.stat-card { position: relative; overflow: hidden; padding: 20px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.stat-card::after { content: ""; position: absolute; inset: auto -20px -28px auto; width: 90px; height: 90px; border-radius: 50%; background: #eff6ff; }
.stat-card span, .stat-card small, .stat-card strong { position: relative; z-index: 1; display: block; }
.stat-card span, .stat-card small { color: var(--muted); }
.stat-card strong { margin: 6px 0 2px; font-size: 34px; }
.stat-card.accent strong { color: var(--teal); }
.stat-card.danger strong { color: var(--danger); }
.two-col { display: grid; grid-template-columns: 1.6fr 1fr; gap: 20px; margin-bottom: 20px; }
.panel { margin-bottom: 20px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); overflow: hidden; }
.panel-head { padding: 20px 22px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; gap: 14px; }
.panel-head h2 { margin: 0; font-size: 18px; }
.panel-head p { margin: 3px 0 0; color: var(--muted); font-size: 12px; }
.live-dot { color: #047857; background: #ecfdf5; padding: 5px 10px; border-radius: 999px; font-size: 11px; }
.live-dot::before { content: "●"; margin-left: 6px; }
.status-dot { width: 12px; height: 12px; border-radius: 50%; background: #cbd5e1; box-shadow: 0 0 0 5px #f1f5f9; }
.status-dot.online { background: #22c55e; box-shadow: 0 0 0 5px #dcfce7; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { padding: 12px 18px; background: #f8fafc; color: #64748b; text-align: right; font-size: 11px; font-weight: 700; white-space: nowrap; }
td { padding: 14px 18px; border-top: 1px solid var(--line); vertical-align: middle; white-space: nowrap; }
td b, td small { display: block; }
td small { color: var(--muted); margin-top: 2px; font-size: 11px; }
.details { margin: 0; padding: 8px 22px 20px; }
.details > div { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 13px 0; border-bottom: 1px dashed var(--line); }
.details > div:last-child { border-bottom: 0; }
.details dt { color: var(--muted); }
.details dd { margin: 0; font-weight: 700; text-align: left; }
.badge { display: inline-flex; align-items: center; width: max-content; padding: 4px 9px; border-radius: 999px; font-size: 11px; font-weight: 700; }
.badge-success { color: #047857; background: #d1fae5; }
.badge-danger { color: #b91c1c; background: #fee2e2; }
.badge-warning { color: var(--warning); background: #fef3c7; }
.badge-muted { color: #64748b; background: #f1f5f9; }
.alert { margin-bottom: 18px; padding: 13px 16px; border-radius: 12px; border: 1px solid; }
.alert-success { color: #065f46; border-color: #a7f3d0; background: #ecfdf5; }
.alert-error { color: #991b1b; border-color: #fecaca; background: #fff1f2; }
.alert-info { color: #1e40af; border-color: #bfdbfe; background: #eff6ff; }
.empty { padding: 35px !important; color: var(--muted); text-align: center; }
.empty-state { padding: 70px 20px; text-align: center; border: 1px dashed #cbd5e1; border-radius: var(--radius); background: #fff; }
.form-panel { padding: 24px; }
.form-panel.narrow { max-width: 680px; }
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 18px; }
.stack-form { display: grid; gap: 18px; }
.field, .stack-form label { display: grid; gap: 7px; color: #334155; font-weight: 700; font-size: 13px; }
.field:has(textarea), .form-actions { grid-column: 1 / -1; }
.field em { color: var(--danger); font-style: normal; }
.field small { color: var(--muted); font-weight: 400; font-size: 11px; }
.field-error { color: var(--danger); font-size: 11px; }
input, select, textarea { width: 100%; border: 1px solid #d9e0e9; border-radius: 11px; padding: 11px 12px; background: #fff; color: var(--ink); outline: none; transition: .18s ease; }
input:focus, select:focus, textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 4px rgba(37, 99, 235, .1); }
input[type=checkbox] { width: 20px; height: 20px; accent-color: var(--primary); }
.client-hero { margin-bottom: 20px; padding: 26px; color: #fff; border-radius: var(--radius); background: linear-gradient(135deg, #334155, #0f172a); display: flex; align-items: center; justify-content: space-between; box-shadow: var(--shadow); }
.client-hero.connected { background: linear-gradient(135deg, #0f766e, #065f46); }
.client-hero > div { display: flex; align-items: center; gap: 15px; }
.client-hero small, .client-hero h2 { display: block; margin: 0; }
.connection-icon { display: grid; place-items: center; width: 52px; height: 52px; border-radius: 16px; background: rgba(255,255,255,.15); font-size: 25px; }
.auth-main { grid-column: 1 / -1; min-height: 100vh; display: grid; place-items: center; background: #eef3fb; }
.auth-main .content { width: min(100%, 1060px); }
.login-wrap { display: grid; grid-template-columns: 1fr .9fr; min-height: 620px; overflow: hidden; border-radius: 28px; background: #fff; box-shadow: 0 30px 90px rgba(21, 33, 58, .16); }
.login-card { padding: 64px 56px; align-self: center; }
.brand-login { color: var(--ink); margin-bottom: 50px; }
.login-card h1 { margin: 0 0 6px; font-size: 32px; }
.muted { color: var(--muted); }
.security-note { margin: 22px 0 0; color: var(--muted); font-size: 11px; text-align: center; }
.login-art { position: relative; overflow: hidden; padding: 60px; color: #fff; background: linear-gradient(145deg, #0f2857, #172554 48%, #0f766e); display: grid; place-content: center; text-align: center; }
.login-art h2 { margin: 22px 0 6px; font-size: 30px; }
.login-art p { color: #cbd5e1; }
.shield { position: relative; z-index: 2; display: grid; place-items: center; width: 100px; height: 116px; margin: auto; border: 2px solid rgba(255,255,255,.55); border-radius: 50px 50px 60px 60px; background: rgba(255,255,255,.11); backdrop-filter: blur(12px); font-size: 46px; }
.orb { position: absolute; border-radius: 50%; filter: blur(1px); background: rgba(59,130,246,.28); }
.orb-one { width: 280px; height: 280px; top: -80px; right: -90px; }
.orb-two { width: 220px; height: 220px; bottom: -60px; left: -50px; background: rgba(34,197,94,.22); }
code { color: #334155; padding: 3px 6px; border-radius: 6px; background: #f1f5f9; direction: ltr; }
@media (max-width: 1050px) {
  .app-shell { grid-template-columns: 220px 1fr; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .two-col { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .app-shell { display: block; }
  .sidebar { position: static; width: 100%; height: auto; padding: 18px; }
  .sidebar nav { display: flex; overflow-x: auto; margin-top: 18px; }
  .sidebar nav a { white-space: nowrap; }
  .sidebar-user { margin-top: 18px; }
  .topbar { padding: 0 18px; }
  .content { padding: 20px 15px; }
  .page-head { align-items: flex-start; flex-direction: column; }
  .stats-grid, .form-grid { grid-template-columns: 1fr; }
  .login-wrap { grid-template-columns: 1fr; min-height: 0; }
  .login-card { padding: 40px 26px; }
  .login-art { display: none; }
}
