/* =============================================================
   DRUU OXD — Professional UI System
   ============================================================= */
:root {
  --bg-0: #050912;
  --bg-1: #0a1020;
  --surface: #0f1729;
  --surface-2: #131c33;
  --surface-3: #1a2440;
  --border: #1e2a4a;
  --border-strong: #2a3a63;
  --text: #e6edf7;
  --text-muted: #8a94ad;
  --text-dim: #5d6781;
  --primary: #3b82f6;
  --primary-2: #06b6d4;
  --accent: #8b5cf6;
  --gradient: linear-gradient(135deg, #06b6d4 0%, #3b82f6 50%, #8b5cf6 100%);
  --gradient-soft: linear-gradient(135deg, rgba(6,182,212,0.15), rgba(139,92,246,0.15));
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --info: #3b82f6;
  --radius-sm: 10px;
  --radius: 16px;
  --radius-lg: 24px;
  --shadow-sm: 0 2px 8px rgba(0,0,0,0.2);
  --shadow: 0 8px 24px rgba(0,0,0,0.35);
  --shadow-lg: 0 20px 40px rgba(0,0,0,0.45);
  --sidebar-w: 264px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  background: var(--bg-0);
  color: var(--text);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.55;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body {
  background:
    radial-gradient(1200px 600px at 80% -10%, rgba(59,130,246,0.18), transparent 60%),
    radial-gradient(900px 500px at -10% 110%, rgba(139,92,246,0.18), transparent 60%),
    var(--bg-0);
  background-attachment: fixed;
}

a { color: var(--primary-2); text-decoration: none; transition: color 0.15s; }
a:hover { color: var(--primary); }

img { max-width: 100%; display: block; }
code, pre { font-family: 'JetBrains Mono', ui-monospace, 'SF Mono', monospace; font-size: 0.92em; }

/* ---------- Typography ---------- */
h1, h2, h3, h4 { font-weight: 700; letter-spacing: -0.01em; line-height: 1.2; }
h1 { font-size: 2rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.15rem; }
.muted { color: var(--text-muted); }
.dim { color: var(--text-dim); }
.gradient-text {
  background: var(--gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  display: inline-block;
}

/* ---------- Layout primitives ---------- */
.container { max-width: 1280px; margin: 0 auto; padding: 0 24px; }
.stack > * + * { margin-top: 1rem; }
.stack-lg > * + * { margin-top: 1.5rem; }
.row { display: flex; gap: 1rem; flex-wrap: wrap; }
.row-between { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 1.25rem; }
.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1rem; }
.grid-4 { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 1rem; }

/* ---------- Cards ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
}
.card-glow {
  background:
    linear-gradient(180deg, rgba(59,130,246,0.07), transparent 50%),
    var(--surface);
  border-color: var(--border-strong);
}
.card h3 { display: flex; align-items: center; gap: 0.6rem; margin-bottom: 1rem; }
.card h3 i { color: var(--primary-2); }
.card-title { display: flex; align-items: center; gap: 0.6rem; margin-bottom: 1rem; }
.card-title i { color: var(--primary-2); }

/* Stat tiles */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; }
.stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  position: relative;
  overflow: hidden;
}
.stat::before {
  content: '';
  position: absolute;
  inset: 0 0 auto 0;
  height: 3px;
  background: var(--gradient);
}
.stat-label { color: var(--text-muted); font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.08em; font-weight: 600; }
.stat-value { font-size: 2.2rem; font-weight: 800; margin-top: 0.4rem; letter-spacing: -0.02em; }
.stat-icon {
  position: absolute; top: 1.5rem; right: 1.5rem;
  width: 42px; height: 42px;
  background: var(--gradient-soft);
  border: 1px solid var(--border);
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  color: var(--primary-2); font-size: 1.1rem;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.4rem;
  border-radius: 12px;
  border: 1px solid transparent;
  font-family: inherit; font-weight: 600; font-size: 0.95rem;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.15s, box-shadow 0.15s, background 0.15s;
  white-space: nowrap;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn-primary {
  background: var(--gradient);
  color: #fff;
  box-shadow: 0 6px 20px rgba(59,130,246,0.35);
}
.btn-primary:hover { box-shadow: 0 10px 28px rgba(59,130,246,0.45); color: #fff; }
.btn-outline {
  background: transparent;
  color: var(--text);
  border-color: var(--border-strong);
}
.btn-outline:hover { background: var(--surface-2); color: var(--text); }
.btn-ghost { background: transparent; color: var(--text-muted); border: none; }
.btn-ghost:hover { color: var(--text); background: var(--surface-2); }
.btn-success { background: var(--success); color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-sm { padding: 0.5rem 0.9rem; font-size: 0.85rem; }
.btn-block { width: 100%; }

/* ---------- Forms ---------- */
.form-group { margin-bottom: 1.1rem; }
.form-label { display: block; font-size: 0.85rem; font-weight: 600; color: var(--text-muted); margin-bottom: 0.4rem; }
.input, input[type="text"], input[type="email"], input[type="password"],
input[type="number"], input[type="search"], select, textarea {
  width: 100%;
  padding: 0.85rem 1rem;
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--text);
  font-family: inherit;
  font-size: 0.95rem;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.input:focus, input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(59,130,246,0.15);
}
.input-icon { position: relative; }
.input-icon i {
  position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
  color: var(--text-muted); pointer-events: none;
}
.input-icon input { padding-left: 44px; }
.checkbox-row { display: flex; align-items: center; gap: 0.5rem; color: var(--text-muted); }
.checkbox-row input { width: auto; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--border); }
table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
table th, table td { padding: 0.85rem 1rem; text-align: left; }
table thead th {
  background: var(--surface-2);
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  border-bottom: 1px solid var(--border);
}
table tbody tr { border-bottom: 1px solid var(--border); transition: background 0.15s; }
table tbody tr:last-child { border-bottom: none; }
table tbody tr:hover { background: rgba(59,130,246,0.04); }
table td code {
  background: var(--surface-2);
  padding: 0.18rem 0.5rem;
  border-radius: 6px;
  color: var(--primary-2);
}

/* ---------- Badges ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 0.35rem;
  padding: 0.25rem 0.7rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.badge-success { background: rgba(16,185,129,0.15); color: var(--success); border: 1px solid rgba(16,185,129,0.3); }
.badge-failed, .badge-danger { background: rgba(239,68,68,0.15); color: var(--danger); border: 1px solid rgba(239,68,68,0.3); }
.badge-pending, .badge-warning { background: rgba(245,158,11,0.15); color: var(--warning); border: 1px solid rgba(245,158,11,0.3); }
.badge-info { background: rgba(59,130,246,0.15); color: var(--primary); border: 1px solid rgba(59,130,246,0.3); }
.badge-neutral { background: var(--surface-2); color: var(--text-muted); border: 1px solid var(--border); }

/* ---------- Flash ---------- */
.flash-stack { position: fixed; top: 1rem; right: 1rem; z-index: 1100; display: flex; flex-direction: column; gap: 0.5rem; max-width: 360px; }
.flash {
  padding: 0.85rem 1.1rem;
  border-radius: 12px;
  border: 1px solid var(--border-strong);
  background: var(--surface-2);
  display: flex; align-items: center; gap: 0.65rem;
  box-shadow: var(--shadow);
  animation: slideIn 0.3s ease;
}
.flash i { font-size: 1.1rem; }
.flash.success { border-color: rgba(16,185,129,0.4); background: rgba(16,185,129,0.1); color: #6ee7b7; }
.flash.danger  { border-color: rgba(239,68,68,0.4);  background: rgba(239,68,68,0.1);  color: #fca5a5; }
.flash.warning { border-color: rgba(245,158,11,0.4); background: rgba(245,158,11,0.1); color: #fcd34d; }
.flash.info    { border-color: rgba(59,130,246,0.4); background: rgba(59,130,246,0.1); color: #93c5fd; }
@keyframes slideIn { from { opacity: 0; transform: translateY(-12px); } to { opacity: 1; transform: translateY(0); } }

/* ---------- Auth pages ---------- */
.auth-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1.5rem;
}
.auth-card {
  width: 100%; max-width: 440px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2.25rem;
  box-shadow: var(--shadow-lg);
  position: relative;
  overflow: hidden;
}
.auth-card::before {
  content: ''; position: absolute; inset: 0 0 auto 0; height: 4px; background: var(--gradient);
}
.auth-card .brand-mark { text-align: center; margin-bottom: 1.5rem; }
.auth-card .brand-mark .logo {
  display: inline-flex; align-items: center; justify-content: center;
  width: 56px; height: 56px;
  background: var(--gradient);
  border-radius: 16px;
  font-size: 1.4rem; color: #fff; font-weight: 800;
  box-shadow: 0 12px 28px rgba(59,130,246,0.35);
}
.auth-card h1 { font-size: 1.6rem; text-align: center; margin: 0.75rem 0 0.4rem; }
.auth-card p.lead { text-align: center; color: var(--text-muted); margin-bottom: 1.5rem; font-size: 0.95rem; }
.auth-card .alt-link { text-align: center; margin-top: 1.25rem; color: var(--text-muted); font-size: 0.92rem; }
.auth-card .alt-link a { font-weight: 600; }
.divider { display: flex; align-items: center; gap: 1rem; margin: 1.25rem 0; color: var(--text-dim); font-size: 0.8rem; }
.divider::before, .divider::after { content: ''; flex: 1; height: 1px; background: var(--border); }

/* ---------- Sidebar layout (dashboard) ---------- */
.app-shell { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar-w);
  background: rgba(8,12,24,0.85);
  backdrop-filter: blur(14px);
  border-right: 1px solid var(--border);
  padding: 1.5rem 1rem;
  position: fixed; inset: 0 auto 0 0;
  display: flex; flex-direction: column;
  z-index: 1000;
  transition: transform 0.25s ease;
}
.sidebar .brand {
  display: flex; align-items: center; gap: 0.7rem;
  padding: 0.5rem 0.75rem 1.5rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1rem;
}
.sidebar .brand .logo {
  width: 40px; height: 40px;
  background: var(--gradient);
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 800; font-size: 1.1rem;
  box-shadow: 0 8px 18px rgba(59,130,246,0.35);
}
.sidebar .brand .name { font-weight: 800; letter-spacing: 0.02em; }
.sidebar .brand .role { font-size: 0.72rem; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.08em; }

.nav-label { font-size: 0.7rem; color: var(--text-dim); padding: 0.5rem 0.75rem; text-transform: uppercase; letter-spacing: 0.1em; font-weight: 600; }
.nav { list-style: none; display: flex; flex-direction: column; gap: 0.2rem; }
.nav a {
  display: flex; align-items: center; gap: 0.85rem;
  padding: 0.7rem 0.85rem;
  color: var(--text-muted);
  border-radius: 10px;
  font-weight: 500; font-size: 0.93rem;
  transition: background 0.15s, color 0.15s;
}
.nav a:hover { background: var(--surface-2); color: var(--text); }
.nav a.active {
  background: var(--gradient-soft);
  color: var(--text);
  box-shadow: inset 0 0 0 1px var(--border-strong);
}
.nav a i { width: 18px; text-align: center; color: inherit; }
.sidebar-foot { margin-top: auto; padding-top: 1rem; border-top: 1px solid var(--border); }

.main {
  flex: 1;
  margin-left: var(--sidebar-w);
  padding: 1.5rem;
  min-width: 0;
}
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 0.85rem 1.25rem;
  margin-bottom: 1.5rem;
  gap: 1rem;
}
.topbar h2 { font-size: 1.15rem; font-weight: 700; display: flex; align-items: center; gap: 0.5rem; }
.topbar h2 i { color: var(--primary-2); }
.topbar .right { display: flex; align-items: center; gap: 0.75rem; }
.avatar {
  width: 40px; height: 40px; border-radius: 50%;
  background: var(--gradient);
  color: #fff; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 6px 14px rgba(59,130,246,0.3);
}
.menu-toggle {
  display: none;
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text);
  width: 40px; height: 40px; border-radius: 10px; cursor: pointer; align-items: center; justify-content: center;
}
.overlay {
  display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.55);
  z-index: 900; backdrop-filter: blur(2px);
}
.overlay.active { display: block; }

/* ---------- Public landing ---------- */
.landing-nav {
  position: sticky; top: 0;
  background: rgba(5,9,18,0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding: 1rem 0;
  z-index: 100;
}
.landing-nav .container { display: flex; justify-content: space-between; align-items: center; }
.landing-nav .brand { display: flex; align-items: center; gap: 0.6rem; font-weight: 800; font-size: 1.1rem; color: var(--text); }
.landing-nav .brand .logo {
  width: 36px; height: 36px; background: var(--gradient); border-radius: 10px;
  display: flex; align-items: center; justify-content: center; color: #fff;
}
.landing-nav .actions { display: flex; gap: 0.5rem; }

.hero { padding: 6rem 0 4rem; text-align: center; }
.hero .eyebrow {
  display: inline-flex; align-items: center; gap: 0.5rem;
  padding: 0.4rem 0.9rem;
  background: var(--gradient-soft);
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  font-size: 0.8rem; color: var(--text-muted);
  margin-bottom: 1.5rem;
}
.hero h1 { font-size: clamp(2.4rem, 5vw, 4rem); font-weight: 800; letter-spacing: -0.025em; margin-bottom: 1rem; }
.hero p { font-size: 1.1rem; color: var(--text-muted); max-width: 640px; margin: 0 auto 2rem; }
.hero-cta { display: flex; gap: 0.75rem; justify-content: center; flex-wrap: wrap; }

.feature-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 1.25rem; padding: 4rem 0; }
.feature {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  transition: transform 0.2s, border-color 0.2s;
}
.feature:hover { transform: translateY(-4px); border-color: var(--border-strong); }
.feature .icon-tile {
  width: 48px; height: 48px;
  background: var(--gradient-soft);
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  color: var(--primary-2); font-size: 1.3rem;
  margin-bottom: 1rem;
}
.feature h3 { margin-bottom: 0.5rem; }
.feature p { color: var(--text-muted); font-size: 0.95rem; }

.cta-band {
  margin: 4rem 0;
  padding: 3rem;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  background-image: var(--gradient-soft);
  text-align: center;
}
.cta-band h2 { font-size: 1.8rem; margin-bottom: 0.75rem; }
.cta-band p { color: var(--text-muted); margin-bottom: 1.5rem; }

.footer {
  border-top: 1px solid var(--border);
  padding: 2rem 0;
  text-align: center;
  color: var(--text-dim);
  font-size: 0.9rem;
}

/* ---------- Specific patterns ---------- */
.kv-list { display: flex; flex-direction: column; gap: 0.75rem; }
.kv {
  display: flex; justify-content: space-between; align-items: center;
  gap: 1rem;
  padding: 0.85rem 1rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 12px;
}
.kv .label { color: var(--text-muted); font-size: 0.85rem; }
.kv .value { font-weight: 600; word-break: break-all; text-align: right; }

.token-box {
  display: flex; align-items: center; gap: 0.5rem;
  background: var(--bg-1);
  border: 1px dashed var(--border-strong);
  padding: 0.75rem 1rem;
  border-radius: 12px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.9rem;
  word-break: break-all;
}

.range-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 0.75rem; }
.range-tile {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.85rem 1rem;
  cursor: pointer;
  transition: transform 0.1s, border-color 0.15s, background 0.15s;
}
.range-tile:hover { background: var(--surface-3); border-color: var(--primary); transform: translateY(-2px); }
.range-tile .range-code { font-family: 'JetBrains Mono', monospace; font-weight: 600; }
.range-tile .range-meta { font-size: 0.75rem; color: var(--text-muted); margin-top: 0.25rem; display: flex; justify-content: space-between; }

.endpoint {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  margin-bottom: 1rem;
}
.endpoint .method {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  border-radius: 6px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.78rem;
  font-weight: 700;
  margin-right: 0.5rem;
}
.method-get { background: rgba(16,185,129,0.18); color: var(--success); }
.method-post { background: rgba(59,130,246,0.18); color: var(--primary); }
.endpoint .url { font-family: 'JetBrains Mono', monospace; color: var(--text); }
.endpoint pre {
  background: var(--bg-0);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.85rem 1rem;
  overflow-x: auto;
  margin: 0.6rem 0;
  color: #cbd5e1;
}

.toast {
  position: fixed; bottom: 1.5rem; left: 50%; transform: translateX(-50%);
  background: var(--surface-3); border: 1px solid var(--border-strong);
  padding: 0.8rem 1.2rem; border-radius: 12px;
  display: flex; align-items: center; gap: 0.5rem;
  box-shadow: var(--shadow);
  z-index: 1200; animation: slideIn 0.25s ease;
}
.toast i { color: var(--success); }

.notification-banner {
  position: fixed; top: 1rem; left: 50%; transform: translateX(-50%);
  background: rgba(16,185,129,0.18); border: 1px solid rgba(16,185,129,0.4);
  color: #6ee7b7;
  padding: 0.85rem 1.25rem; border-radius: 12px;
  display: flex; align-items: center; gap: 0.6rem;
  box-shadow: var(--shadow); z-index: 1200; cursor: pointer;
  font-weight: 500; animation: slideIn 0.3s ease;
}

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main { margin-left: 0; padding: 1rem; }
  .menu-toggle { display: inline-flex; }
}

@media (max-width: 540px) {
  .auth-card { padding: 1.75rem; }
  .topbar { flex-direction: column; align-items: flex-start; }
  .stat-value { font-size: 1.8rem; }
  .hero { padding: 4rem 0 2rem; }
}
