@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@300;400;500;600;700;800&family=JetBrains+Mono:wght@400;500;600&display=swap');

/* ── Design tokens ─────────────────────────────────────────────── */
:root {
  --bg:           #06090f;
  --bg-2:         #0c1120;
  --surface:      #0e1528;
  --surface-alt:  #141e35;
  --surface-hi:   #1a2845;
  --text:         #c4d0e8;
  --text-hi:      #eef2ff;
  --muted:        #4e6585;
  --muted-2:      #7a8fac;
  --line:         rgba(80, 130, 200, 0.11);
  --line-hi:      rgba(0, 229, 192, 0.28);
  --primary:      #00e5c0;
  --primary-2:    #3b82f6;
  --primary-dim:  rgba(0, 229, 192, 0.07);
  --danger:       #ff6b6b;
  --warn:         #f59e0b;
  --ok:           #10b981;
  --radius:       14px;
  --radius-lg:    20px;
  --shadow:       0 4px 32px rgba(0, 0, 0, 0.55), 0 1px 0 rgba(255,255,255,0.025);
  --shadow-glow:  0 0 32px rgba(0,229,192,0.06), 0 4px 20px rgba(0,0,0,0.45);
  --t:            0.22s cubic-bezier(0.4, 0, 0.2, 1);
  --topbar-h:     62px;
  --font-body:    'Space Grotesk', 'Segoe UI', system-ui, sans-serif;
  --font-mono:    'JetBrains Mono', 'Cascadia Code', 'Fira Code', monospace;
}

/* ── Keyframes ─────────────────────────────────────────────────── */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes slideInLeft {
  from { opacity: 0; transform: translateX(-14px); }
  to   { opacity: 1; transform: translateX(0); }
}
@keyframes glowPulse {
  0%,100% { text-shadow: 0 0 12px rgba(0,229,192,.4); }
  50%     { text-shadow: 0 0 28px rgba(0,229,192,.8), 0 0 50px rgba(0,229,192,.3); }
}
@keyframes progressFill {
  from { width: 0 !important; }
}
@keyframes countIn {
  from { opacity: 0; transform: scale(.55) translateY(10px); }
  70%  { transform: scale(1.07) translateY(-2px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}
@keyframes borderGlow {
  0%,100% { box-shadow: 0 0 0 1px rgba(0,229,192,.15); }
  50%     { box-shadow: 0 0 0 1px rgba(0,229,192,.4), 0 0 20px rgba(0,229,192,.12); }
}
@keyframes logoDraw {
  from { stroke-dashoffset: 120; opacity: 0; }
  to   { stroke-dashoffset: 0;   opacity: 1; }
}
@keyframes bellShake {
  0%,100% { transform: rotate(0); }
  20%     { transform: rotate(-14deg); }
  40%     { transform: rotate(14deg); }
  60%     { transform: rotate(-8deg); }
  80%     { transform: rotate(8deg); }
}
@keyframes shimmer {
  from { background-position: -400px 0; }
  to   { background-position:  400px 0; }
}

/* ── Reset & base ──────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Subtle tech grid */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(80,130,200,.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(80,130,200,.04) 1px, transparent 1px);
  background-size: 44px 44px;
  pointer-events: none;
  z-index: 0;
}

/* Ambient glow top-right */
body::after {
  content: '';
  position: fixed;
  top: -180px;
  right: -180px;
  width: 640px;
  height: 640px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(0,229,192,.055) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}

a { color: inherit; }

/* ── Topbar ────────────────────────────────────────────────────── */
.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 0 24px;
  height: var(--topbar-h);
  background: rgba(7, 10, 22, 0.93);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(18px) saturate(1.5);
  -webkit-backdrop-filter: blur(18px);
  box-shadow: 0 1px 0 rgba(0,229,192,.05), 0 4px 20px rgba(0,0,0,.3);
  animation: fadeIn .4s ease both;
}

/* ── Brand / Logo ──────────────────────────────────────────────── */
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 9px;
  background: linear-gradient(135deg, rgba(0,229,192,.14), rgba(59,130,246,.08));
  border: 1px solid rgba(0,229,192,.28);
  flex-shrink: 0;
  color: var(--primary);
  animation: borderGlow 3s ease infinite;
}

.brand-name {
  font-family: var(--font-mono);
  font-size: .95rem;
  font-weight: 700;
  letter-spacing: .18em;
  color: var(--primary);
  text-transform: uppercase;
}

.brand-sep {
  color: var(--muted);
  font-size: .7rem;
  font-family: var(--font-mono);
}

.brand-title {
  color: var(--muted-2);
  font-size: .78rem;
  font-weight: 500;
  letter-spacing: .04em;
  font-family: var(--font-mono);
}

/* ── Top actions ───────────────────────────────────────────────── */
.top-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.badge-btn {
  position: relative;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 10px;
  padding: 8px 11px;
  cursor: pointer;
  color: var(--text);
  transition: border-color var(--t), background var(--t), transform var(--t);
  font-size: 15px;
  line-height: 1;
}

.badge-btn:hover {
  border-color: var(--line-hi);
  background: var(--surface-alt);
  transform: translateY(-1px);
}

.badge-btn:hover .bell-icon {
  animation: bellShake .5s ease;
}

.badge-count {
  position: absolute;
  right: -6px;
  top: -6px;
  min-width: 18px;
  height: 18px;
  border-radius: 999px;
  background: var(--danger);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  font-family: var(--font-mono);
  display: grid;
  place-items: center;
  padding: 0 4px;
  animation: countIn .3s ease;
}

/* ── Layout ────────────────────────────────────────────────────── */
.layout {
  display: grid;
  grid-template-columns: 234px 1fr;
  min-height: calc(100vh - var(--topbar-h));
  position: relative;
  z-index: 1;
}

/* ── Sidebar ───────────────────────────────────────────────────── */
.sidebar {
  border-right: 1px solid var(--line);
  background: rgba(8, 12, 26, 0.88);
  padding: 16px 10px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: var(--topbar-h);
  height: calc(100vh - var(--topbar-h));
  overflow-y: auto;
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 3px;
  flex: 1;
}

.nav a {
  text-decoration: none;
  padding: 9px 11px;
  border-radius: 10px;
  color: var(--muted-2);
  font-weight: 500;
  font-size: .875rem;
  display: flex;
  align-items: center;
  gap: 9px;
  transition: all var(--t);
  border: 1px solid transparent;
  animation: slideInLeft .35s ease both;
  position: relative;
  overflow: hidden;
}

.nav a::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%) scaleY(0);
  width: 2px;
  height: 60%;
  border-radius: 999px;
  background: var(--primary);
  transition: transform var(--t);
}

.nav a:nth-child(1) { animation-delay: .04s; }
.nav a:nth-child(2) { animation-delay: .07s; }
.nav a:nth-child(3) { animation-delay: .10s; }
.nav a:nth-child(4) { animation-delay: .13s; }
.nav a:nth-child(5) { animation-delay: .16s; }
.nav a:nth-child(6) { animation-delay: .19s; }
.nav a:nth-child(7) { animation-delay: .22s; }

.nav-icon {
  font-size: 13px;
  width: 18px;
  text-align: center;
  flex-shrink: 0;
  transition: color var(--t);
}

.nav-label {
  flex: 1;
}

.nav a:hover {
  color: var(--text-hi);
  background: var(--surface-alt);
  border-color: var(--line);
}

.nav a:hover::before {
  transform: translateY(-50%) scaleY(1);
}

.nav a.active {
  color: var(--primary);
  background: var(--primary-dim);
  border-color: rgba(0,229,192,.18);
}

.nav a.active::before {
  transform: translateY(-50%) scaleY(1);
}

.nav a.active .nav-icon {
  text-shadow: 0 0 10px currentColor;
}

.user-box {
  margin-top: 16px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 11.5px;
  color: var(--muted);
  background: var(--surface);
  line-height: 1.8;
}

.user-box strong {
  color: var(--muted-2);
  font-family: var(--font-mono);
  font-size: 10.5px;
}

/* ── Content area ──────────────────────────────────────────────── */
.content {
  padding: 24px;
  position: relative;
  z-index: 1;
}

/* ── Typography ────────────────────────────────────────────────── */
h1 {
  margin: 0 0 18px;
  font-size: 1.55rem;
  font-weight: 700;
  color: var(--text-hi);
  letter-spacing: -.025em;
  animation: fadeInUp .38s ease both;
  line-height: 1.25;
}

h2 {
  margin: 0 0 12px;
  font-size: .78rem;
  font-weight: 600;
  color: var(--muted-2);
  text-transform: uppercase;
  letter-spacing: .1em;
  font-family: var(--font-mono);
}

/* ── Cards ─────────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow);
  animation: fadeInUp .38s ease both;
  position: relative;
  overflow: hidden;
  transition: border-color var(--t), box-shadow var(--t);
}

.card::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(135deg, rgba(0,229,192,.022) 0%, transparent 55%);
  pointer-events: none;
}

.card:hover {
  border-color: rgba(0,229,192,.14);
  box-shadow: var(--shadow-glow);
}

.card:nth-child(1) { animation-delay: .04s; }
.card:nth-child(2) { animation-delay: .09s; }
.card:nth-child(3) { animation-delay: .14s; }
.card:nth-child(4) { animation-delay: .19s; }
.card:nth-child(5) { animation-delay: .24s; }

/* ── Grid helpers ──────────────────────────────────────────────── */
.grid   { display: grid; gap: 14px; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(290px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }

/* ── Form elements ─────────────────────────────────────────────── */
label {
  display: block;
  margin: 12px 0 5px;
  color: var(--muted-2);
  font-size: .73rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .08em;
  font-family: var(--font-mono);
}

input, select, textarea, button { font: inherit; }

input, select, textarea {
  width: 100%;
  border-radius: 10px;
  border: 1px solid var(--line);
  padding: 10px 13px;
  background: var(--surface-alt);
  color: var(--text);
  transition: border-color var(--t), box-shadow var(--t), background var(--t);
  outline: none;
}

input:focus, select:focus, textarea:focus {
  border-color: rgba(0,229,192,.45);
  background: var(--surface-hi);
  box-shadow: 0 0 0 3px rgba(0,229,192,.07);
}

input::placeholder, textarea::placeholder {
  color: var(--muted);
}

textarea {
  min-height: 90px;
  resize: vertical;
}

select {
  cursor: pointer;
}

select option {
  background: var(--surface-alt);
  color: var(--text);
}

/* ── Buttons ───────────────────────────────────────────────────── */
button {
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 9px 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--t);
  letter-spacing: .02em;
  white-space: nowrap;
  position: relative;
  overflow: hidden;
}

button.primary {
  background: linear-gradient(135deg, #00e5c0, #00c8a8);
  color: #041510;
  border-color: transparent;
  box-shadow: 0 2px 14px rgba(0,229,192,.22);
}

button.primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 24px rgba(0,229,192,.38);
}

button.primary:active {
  transform: translateY(0);
  box-shadow: 0 1px 8px rgba(0,229,192,.2);
}

button.ghost {
  border-color: var(--line);
  background: var(--surface-alt);
  color: var(--text);
}

button.ghost:hover {
  border-color: var(--line-hi);
  background: var(--surface-hi);
  color: var(--text-hi);
}

button.danger {
  background: rgba(255,107,107,.08);
  border-color: rgba(255,107,107,.22);
  color: var(--danger);
}

button.danger:hover {
  background: rgba(255,107,107,.14);
  border-color: rgba(255,107,107,.38);
}

/* ── Flex helper ───────────────────────────────────────────────── */
.inline { display: flex; gap: 8px; flex-wrap: wrap; }

/* ── KPI numbers ───────────────────────────────────────────────── */
.kpi {
  font-size: 2.4rem;
  font-weight: 800;
  color: var(--primary);
  font-family: var(--font-mono);
  letter-spacing: -.04em;
  line-height: 1;
  margin-top: 8px;
  animation: countIn .55s cubic-bezier(.4,0,.2,1) both, glowPulse 3s ease 1s infinite;
  display: inline-block;
}

/* ── Table ─────────────────────────────────────────────────────── */
.table-wrap { overflow: auto; }

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 680px;
}

th, td {
  text-align: left;
  padding: 11px 14px;
  border-bottom: 1px solid var(--line);
  font-size: .875rem;
}

th {
  color: var(--muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .08em;
  font-size: .7rem;
  font-family: var(--font-mono);
}

tr { transition: background var(--t); }

tbody tr:hover { background: rgba(0,229,192,.025); }

tbody tr:last-child td { border-bottom: none; }

/* ── Pill badges ───────────────────────────────────────────────── */
.pill {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: .72rem;
  font-weight: 600;
  font-family: var(--font-mono);
  letter-spacing: .04em;
  background: var(--surface-alt);
  color: var(--muted-2);
  border: 1px solid var(--line);
}

/* ── Messages ──────────────────────────────────────────────────── */
.msg {
  margin-top: 10px;
  padding: 10px 14px;
  border-radius: 10px;
  font-size: .85rem;
  font-weight: 500;
  border: 1px solid transparent;
  animation: fadeIn .22s ease;
}

.msg.ok {
  background: rgba(16,185,129,.08);
  color: var(--ok);
  border-color: rgba(16,185,129,.2);
}

.msg.err {
  background: rgba(255,107,107,.08);
  color: var(--danger);
  border-color: rgba(255,107,107,.2);
}

/* ── Timeline ──────────────────────────────────────────────────── */
.timeline {
  border-left: 2px solid rgba(0,229,192,.2);
  margin-left: 10px;
  padding-left: 18px;
}

.timeline-item {
  margin-bottom: 18px;
  position: relative;
  animation: fadeInUp .3s ease both;
}

.timeline-item:nth-child(1) { animation-delay: .05s; }
.timeline-item:nth-child(2) { animation-delay: .10s; }
.timeline-item:nth-child(3) { animation-delay: .15s; }

.timeline-item::before {
  content: '';
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--primary);
  position: absolute;
  left: -25px;
  top: 7px;
  box-shadow: 0 0 10px rgba(0,229,192,.55);
}

/* ── Muted text ────────────────────────────────────────────────── */
.muted { color: var(--muted-2); }

/* ── Progress bar ──────────────────────────────────────────────── */
.progress {
  height: 8px;
  border-radius: 999px;
  background: var(--surface-hi);
  overflow: hidden;
  margin: 6px 0;
}

.progress > span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--primary-2));
  border-radius: 999px;
  animation: progressFill .9s cubic-bezier(.4,0,.2,1) both;
  box-shadow: 0 0 10px rgba(0,229,192,.35);
}

/* ── Hidden ────────────────────────────────────────────────────── */
.hidden { display: none !important; }

/* ── Login page ────────────────────────────────────────────────── */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  position: relative;
  z-index: 1;
}

/* Extra ambient glow bottom-left for login */
.login-wrap::before {
  content: '';
  position: fixed;
  bottom: -200px;
  left: -200px;
  width: 600px;
  height: 600px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(59,130,246,.05) 0%, transparent 70%);
  pointer-events: none;
}

.login-card {
  width: min(440px, 100%);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 40px 36px;
  box-shadow: var(--shadow);
  animation: fadeInUp .55s cubic-bezier(.4,0,.2,1) both;
  position: relative;
  overflow: hidden;
}

.login-card::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(135deg, rgba(0,229,192,.04) 0%, transparent 55%);
  pointer-events: none;
}

.login-card::after {
  content: '';
  position: absolute;
  top: -1px;
  left: 20%;
  right: 20%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(0,229,192,.4), transparent);
}

.login-logo {
  display: flex;
  align-items: center;
  gap: 13px;
  margin-bottom: 32px;
}

.login-logo-icon {
  width: 50px;
  height: 50px;
  border-radius: 13px;
  background: linear-gradient(135deg, rgba(0,229,192,.13), rgba(59,130,246,.08));
  border: 1px solid rgba(0,229,192,.28);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
  animation: borderGlow 3s ease infinite;
}

.login-logo-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.login-brand-name {
  font-family: var(--font-mono);
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: .18em;
  color: var(--primary);
  line-height: 1;
}

.login-brand-sub {
  font-size: .7rem;
  color: var(--muted);
  letter-spacing: .06em;
  font-family: var(--font-mono);
  text-transform: uppercase;
}

.login-card h1 {
  font-size: 1.45rem;
  margin: 0 0 6px;
  color: var(--text-hi);
  animation: none;
}

.login-card p {
  color: var(--muted-2);
  margin: 0 0 24px;
  font-size: .88rem;
}

/* ── Responsive ────────────────────────────────────────────────── */
@media (max-width: 900px) {
  .layout {
    grid-template-columns: 1fr;
  }
  .sidebar {
    position: static;
    height: auto;
    border-right: none;
    border-bottom: 1px solid var(--line);
    padding: 12px;
  }
  .nav {
    flex-direction: row;
    flex-wrap: wrap;
  }
  .nav a {
    flex: 1;
    min-width: 110px;
    justify-content: center;
  }
  .nav a::before { display: none; }
  .user-box { display: none; }
}
