:root {
  --bg: #07101f;
  --bg2: #0d1c35;
  --card: rgba(13, 27, 52, 0.72);
  --card-2: rgba(255,255,255,0.04);
  --line: rgba(255,255,255,0.10);
  --text: #edf3ff;
  --muted: #aab6cf;
  --primary: #66a8ff;
  --primary2: #8b7dff;
  --green: #34d399;
  --orange: #f59e0b;
  --red: #fb7185;
  --blue: #60a5fa;
  --shadow: 0 20px 60px rgba(0,0,0,0.28);
  --radius: 24px;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; font-family: Inter, system-ui, -apple-system, sans-serif; color: var(--text); background:
radial-gradient(circle at top left, rgba(102,168,255,0.15), transparent 28%),
radial-gradient(circle at top right, rgba(139,125,255,0.14), transparent 26%),
linear-gradient(160deg, var(--bg), var(--bg2)); min-height: 100%; }
body { min-height: 100vh; }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; }
code { background: rgba(255,255,255,0.07); padding: 2px 6px; border-radius: 8px; }

.public-bg { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.public-wrap, .login-wrap { width: 100%; max-width: 640px; }
.glass { background: var(--card); backdrop-filter: blur(18px); border: 1px solid var(--line); box-shadow: var(--shadow); }
.card-lg, .auth-card, .panel, .sidebar { border-radius: var(--radius); }
.card-lg, .auth-card, .panel { padding: 28px; }
.text-center { text-align: center; }
h1, h2 { margin: 0 0 12px; line-height: 1.05; }
h1 { font-size: clamp(2rem, 4vw, 2.8rem); }
h2 { font-size: 1.1rem; }
.muted { color: var(--muted); }
.small { font-size: .9rem; }
.eyebrow { color: var(--muted); letter-spacing: .12em; text-transform: uppercase; font-size: .78rem; margin-bottom: 8px; }
.badge { display: inline-flex; margin-bottom: 18px; padding: 9px 12px; border-radius: 999px; background: rgba(255,255,255,0.08); border: 1px solid var(--line); color: #d6e3ff; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 42px; padding: 0 16px; border-radius: 14px; border: 1px solid var(--line); background: rgba(255,255,255,0.04); color: var(--text); cursor: pointer; transition: transform .18s ease, background .18s ease, border-color .18s ease; }
.btn:hover { transform: translateY(-1px); background: rgba(255,255,255,0.08); }
.btn-primary { background: linear-gradient(135deg, var(--primary), var(--primary2)); border: 0; color: white; }
.btn-danger { background: rgba(251,113,133,0.12); color: #ffdce2; }
.btn-sm { min-height: 34px; padding: 0 12px; border-radius: 12px; font-size: .92rem; }
.btn-block { width: 100%; }
.cta-row, .actions, .inline-form, .field-grid { display: flex; gap: 12px; flex-wrap: wrap; }

.field { display: flex; flex-direction: column; gap: 8px; }
.field label { font-weight: 600; }
.field input, .field select, .field textarea {
  width: 100%; border: 1px solid var(--line); background: rgba(255,255,255,0.04); color: var(--text);
  border-radius: 14px; padding: 14px; outline: none; transition: border-color .2s ease, box-shadow .2s ease;
}
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: rgba(102,168,255,0.6); box-shadow: 0 0 0 4px rgba(102,168,255,0.14);
}
.field small { color: var(--muted); }
.checkbox-row { display: flex; gap: 10px; align-items: center; min-height: 40px; }

.shell { display: grid; grid-template-columns: 280px 1fr; min-height: 100vh; gap: 20px; padding: 20px; }
.sidebar { padding: 22px; display: flex; flex-direction: column; justify-content: space-between; position: sticky; top: 20px; height: calc(100vh - 40px); }
.brand { font-size: 1.4rem; font-weight: 800; letter-spacing: -.03em; }
.brand span { color: var(--primary); }
.nav-link { display: flex; align-items: center; min-height: 44px; padding: 0 14px; border-radius: 14px; color: var(--muted); transition: background .18s ease, color .18s ease, transform .18s ease; }
.nav-link:hover, .nav-link.is-active { background: rgba(255,255,255,0.07); color: white; transform: translateX(2px); }
.sidebar-foot { display: flex; flex-direction: column; gap: 12px; }

.main { display: flex; flex-direction: column; gap: 20px; padding: 8px 0 20px; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.stats-grid { display: grid; grid-template-columns: repeat(5, minmax(0,1fr)); gap: 16px; }
.grid-2 { display: grid; grid-template-columns: 1.4fr .9fr; gap: 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 16px; }
.stack-xs > * + * { margin-top: 4px; }
.stack-sm > * + * { margin-top: 10px; }
.stack-md > * + * { margin-top: 16px; }

.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.stat-card { padding: 18px; border-radius: 20px; display: flex; flex-direction: column; gap: 8px; }
.stat-card span { color: var(--muted); font-size: .92rem; }
.stat-card strong { font-size: 1.7rem; letter-spacing: -.04em; }
.subtle { background: rgba(255,255,255,0.03); }
.preview-box, .mini-row { padding: 16px; border-radius: 18px; background: var(--card-2); border: 1px solid var(--line); }
.mini-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; }

.table-wrap { overflow: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 14px 10px; border-bottom: 1px solid rgba(255,255,255,0.08); text-align: left; vertical-align: top; font-size: .95rem; }
th { color: var(--muted); font-weight: 600; position: sticky; top: 0; background: rgba(7,16,31,0.5); backdrop-filter: blur(10px); }
.truncate { max-width: 300px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.pill { display: inline-flex; align-items: center; justify-content: center; border-radius: 999px; padding: 6px 10px; font-size: .82rem; border: 1px solid transparent; }
.pill-green { background: rgba(52,211,153,0.14); color: #c8ffe9; }
.pill-orange { background: rgba(245,158,11,0.16); color: #ffe4b2; }
.pill-gray { background: rgba(255,255,255,0.08); color: #d9e2f5; }
.pill-blue { background: rgba(96,165,250,0.14); color: #dbeafe; }
.pill-red { background: rgba(251,113,133,0.14); color: #ffe2e8; }

.alert { padding: 14px 16px; border-radius: 16px; border: 1px solid var(--line); }
.alert-success { background: rgba(52,211,153,0.12); }
.alert-error { background: rgba(251,113,133,0.12); }
.alert-info { background: rgba(96,165,250,0.12); }

.feature-list { margin: 0; padding-left: 18px; color: var(--muted); }
.feature-list li + li { margin-top: 10px; }
.code-block { overflow: auto; padding: 16px; border-radius: 18px; background: rgba(255,255,255,0.04); border: 1px solid var(--line); color: #dce8ff; }

.chart-bars { display: flex; align-items: end; gap: 12px; min-height: 180px; padding-top: 16px; overflow-x: auto; }
.bar-col { min-width: 52px; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.bar { width: 100%; border-radius: 16px 16px 8px 8px; background: linear-gradient(180deg, var(--primary), var(--primary2)); box-shadow: 0 12px 24px rgba(102,168,255,0.25); }

.fade-in-up { opacity: 0; transform: translateY(10px); animation: fadeUp .55s ease forwards; }
@keyframes fadeUp { to { opacity: 1; transform: translateY(0); } }

@media (max-width: 1200px) {
  .stats-grid { grid-template-columns: repeat(3, minmax(0,1fr)); }
  .grid-2 { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; }
}
@media (max-width: 720px) {
  .stats-grid, .grid-3, .field-grid { grid-template-columns: 1fr !important; display: grid; }
  .topbar, .panel-head, .mini-row { align-items: flex-start; flex-direction: column; }
  .cta-row, .actions, .inline-form { flex-direction: column; align-items: stretch; }
  .truncate { max-width: 180px; }
}
