:root {
  --bg-0: #07080f;
  --bg-1: #0d1117;
  --bg-2: #11162180;
  --bg-3: #171d2a99;
  --card-border: rgba(255, 255, 255, 0.06);
  --card-border-hover: rgba(0, 229, 255, 0.35);
  --text: #ffffff;
  --text-dim: #8b949e;
  --text-faint: #5f6878;
  --cyan: #00e5ff;
  --magenta: #ff006e;
  --lime: #aaff00;
  --red: #ff3860;
  --amber: #ffb547;
  --grad-primary: linear-gradient(135deg, #00e5ff 0%, #ff006e 100%);
  --grad-soft: linear-gradient(135deg, rgba(0,229,255,0.15) 0%, rgba(255,0,110,0.15) 100%);
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --shadow-glow: 0 0 32px rgba(0, 229, 255, 0.12), 0 0 64px rgba(255, 0, 110, 0.06);
  --shadow-card: 0 8px 32px rgba(0, 0, 0, 0.5);
  --font-display: 'Sora', system-ui, sans-serif;
  --font-body: 'Plus Jakarta Sans', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, monospace;
}

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

html, body {
  height: 100%;
  font-family: var(--font-body);
  color: var(--text);
  background: var(--bg-0);
  -webkit-font-smoothing: antialiased;
  font-feature-settings: 'cv11', 'ss01';
}

body {
  background:
    radial-gradient(1200px 800px at 10% -10%, rgba(0, 229, 255, 0.12), transparent 60%),
    radial-gradient(1000px 700px at 110% 10%, rgba(255, 0, 110, 0.10), transparent 60%),
    radial-gradient(800px 600px at 50% 120%, rgba(170, 255, 0, 0.06), transparent 60%),
    var(--bg-0);
  min-height: 100vh;
  overflow-x: hidden;
}

h1, h2, h3, h4 { font-family: var(--font-display); font-weight: 600; letter-spacing: -0.01em; }
h1 { font-size: clamp(1.75rem, 3vw, 2.5rem); }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.125rem; }

a { color: var(--cyan); text-decoration: none; }
a:hover { filter: brightness(1.2); }

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

/* ---------- Layout ---------- */
.app { display: grid; grid-template-columns: 260px 1fr; min-height: 100vh; }
.sidebar {
  background: linear-gradient(180deg, rgba(13,17,23,0.95), rgba(7,8,15,0.95));
  border-right: 1px solid var(--card-border);
  padding: 24px 18px;
  backdrop-filter: blur(14px);
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  display: flex; flex-direction: column; gap: 24px;
}
.sidebar .brand { display: flex; align-items: center; gap: 12px; padding: 4px 6px 16px; border-bottom: 1px solid var(--card-border); }
.sidebar .brand .mark { width: 42px; height: 42px; flex-shrink: 0; }
.sidebar .brand .title { font-family: var(--font-display); font-weight: 700; letter-spacing: -0.02em; line-height: 1; }
.sidebar .brand .title .t { background: var(--grad-primary); -webkit-background-clip: text; background-clip: text; color: transparent; font-size: 1.3rem; }
.sidebar .brand .title .s { color: var(--text); font-size: 0.85rem; display: block; opacity: 0.9; letter-spacing: 0.18em; margin-top: 2px; }

.nav { display: flex; flex-direction: column; gap: 4px; }
.nav a {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 14px; border-radius: var(--radius-sm);
  color: var(--text-dim); font-weight: 500; font-size: 0.92rem;
  border: 1px solid transparent;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  position: relative;
}
.nav a:hover { background: rgba(255,255,255,0.03); color: var(--text); }
.nav a.active { background: var(--grad-soft); color: var(--text); border-color: rgba(0,229,255,0.20); }
.nav a .ico { width: 18px; height: 18px; flex-shrink: 0; opacity: 0.85; }
.nav a .badge-urgent {
  margin-left: auto; background: var(--red); color: #fff;
  font-size: 0.68rem; padding: 2px 7px; border-radius: 999px;
  font-family: var(--font-mono); font-weight: 600;
  animation: pulseBadge 1.8s ease-in-out infinite;
}
@keyframes pulseBadge {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255,56,96,0.6); }
  50% { box-shadow: 0 0 0 6px rgba(255,56,96,0); }
}

.sidebar .user-card {
  margin-top: auto; padding: 14px; border-radius: var(--radius-md);
  background: var(--bg-2); border: 1px solid var(--card-border);
  display: flex; gap: 12px; align-items: center;
}
.user-avatar {
  width: 38px; height: 38px; border-radius: 50%;
  background: var(--grad-primary); color: #0d1117;
  display: grid; place-items: center; font-weight: 700;
  font-family: var(--font-display);
}
.user-card .name { font-size: 0.88rem; font-weight: 600; }
.user-card .role { font-size: 0.72rem; color: var(--text-dim); letter-spacing: 0.08em; text-transform: uppercase; }
.sidebar .logout {
  margin-top: 8px; width: 100%; background: transparent; color: var(--text-dim);
  border: 1px solid var(--card-border); padding: 9px; border-radius: var(--radius-sm);
  cursor: pointer; font-size: 0.85rem; transition: all 0.15s;
}
.sidebar .logout:hover { color: var(--red); border-color: rgba(255,56,96,0.4); }

.main { padding: 32px 40px 64px; max-width: 1600px; width: 100%; }
.page-header { display: flex; justify-content: space-between; align-items: flex-end; margin-bottom: 28px; gap: 16px; flex-wrap: wrap; }
.page-header .eyebrow { color: var(--text-dim); font-size: 0.78rem; letter-spacing: 0.18em; text-transform: uppercase; margin-bottom: 8px; }
.page-header h1 { background: linear-gradient(135deg, #fff 0%, #8b949e 100%); -webkit-background-clip: text; background-clip: text; color: transparent; }

/* ---------- Cards ---------- */
.card {
  background: var(--bg-2);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  padding: 22px;
  backdrop-filter: blur(20px);
  box-shadow: var(--shadow-card);
  transition: border-color 0.2s, transform 0.2s, box-shadow 0.2s;
}
.card.hoverable { cursor: pointer; }
.card.hoverable:hover { border-color: var(--card-border-hover); box-shadow: var(--shadow-glow), var(--shadow-card); transform: translateY(-2px); }
.card h3 { margin-bottom: 8px; }

.grid { display: grid; gap: 18px; }
.grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 1100px) {
  .grid.cols-4 { grid-template-columns: repeat(2, 1fr); }
  .grid.cols-3 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 720px) {
  .grid.cols-4, .grid.cols-3, .grid.cols-2 { grid-template-columns: 1fr; }
}

/* ---------- KPIs ---------- */
.kpi { display: flex; flex-direction: column; gap: 6px; position: relative; overflow: hidden; }
.kpi .label { color: var(--text-dim); font-size: 0.78rem; letter-spacing: 0.12em; text-transform: uppercase; }
.kpi .value { font-family: var(--font-display); font-size: 2.2rem; font-weight: 700; line-height: 1.1; }
.kpi .value.accent { background: var(--grad-primary); -webkit-background-clip: text; background-clip: text; color: transparent; }
.kpi .sub { color: var(--text-dim); font-size: 0.82rem; }
.kpi::after {
  content: ''; position: absolute; top: -1px; right: -1px; width: 56px; height: 56px;
  background: radial-gradient(circle, rgba(0,229,255,0.25), transparent 70%);
  pointer-events: none;
}

/* ---------- Progress ---------- */
.progress { height: 10px; background: rgba(255,255,255,0.05); border-radius: 999px; overflow: hidden; position: relative; }
.progress .bar {
  height: 100%; border-radius: 999px;
  background: var(--grad-primary);
  box-shadow: 0 0 12px rgba(0,229,255,0.35);
  transition: width 0.6s cubic-bezier(0.2, 0.8, 0.2, 1);
  position: relative;
}
.progress .bar::after {
  content: ''; position: absolute; top: 0; right: 0; bottom: 0; width: 20px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.35));
}
.progress-label { font-family: var(--font-mono); font-size: 0.82rem; color: var(--text-dim); }

/* ---------- Badges / chips ---------- */
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; font-size: 0.74rem; font-weight: 600; letter-spacing: 0.04em; border: 1px solid transparent; }
.chip.cyan { background: rgba(0,229,255,0.12); color: var(--cyan); border-color: rgba(0,229,255,0.25); }
.chip.magenta { background: rgba(255,0,110,0.12); color: var(--magenta); border-color: rgba(255,0,110,0.25); }
.chip.lime { background: rgba(170,255,0,0.10); color: var(--lime); border-color: rgba(170,255,0,0.30); }
.chip.amber { background: rgba(255,181,71,0.10); color: var(--amber); border-color: rgba(255,181,71,0.25); }
.chip.red { background: rgba(255,56,96,0.12); color: var(--red); border-color: rgba(255,56,96,0.30); }
.chip.muted { background: rgba(255,255,255,0.05); color: var(--text-dim); border-color: rgba(255,255,255,0.08); }
.chip .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 18px; border-radius: var(--radius-sm);
  font-weight: 600; font-size: 0.9rem;
  border: 1px solid transparent; cursor: pointer;
  transition: all 0.15s; font-family: var(--font-body);
  white-space: nowrap;
}
.btn.primary { background: var(--grad-primary); color: #0d1117; box-shadow: 0 4px 20px rgba(0,229,255,0.25); }
.btn.primary:hover { transform: translateY(-1px); box-shadow: 0 6px 28px rgba(0,229,255,0.4); }
.btn.ghost { background: transparent; color: var(--text); border-color: var(--card-border); }
.btn.ghost:hover { border-color: var(--cyan); color: var(--cyan); }
.btn.danger { background: rgba(255,56,96,0.12); color: var(--red); border-color: rgba(255,56,96,0.30); }
.btn.danger:hover { background: rgba(255,56,96,0.22); }
.btn.sm { padding: 6px 12px; font-size: 0.82rem; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ---------- Forms ---------- */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.field label { font-size: 0.82rem; color: var(--text-dim); font-weight: 500; letter-spacing: 0.04em; }
.field input, .field select, .field textarea {
  width: 100%; padding: 12px 14px; background: rgba(255,255,255,0.03);
  border: 1px solid var(--card-border); border-radius: var(--radius-sm);
  color: var(--text); font-size: 0.92rem; transition: border-color 0.15s, background 0.15s;
  font-family: var(--font-body);
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none; border-color: var(--cyan); background: rgba(0,229,255,0.04);
  box-shadow: 0 0 0 3px rgba(0,229,255,0.12);
}
.field textarea { min-height: 96px; resize: vertical; }
.field.row { flex-direction: row; gap: 12px; align-items: center; }
.field-error { color: var(--red); font-size: 0.82rem; margin-top: 4px; }

.form-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 8px; }

/* ---------- Tables ---------- */
.table { width: 100%; border-collapse: separate; border-spacing: 0; }
.table th, .table td { text-align: left; padding: 12px 14px; font-size: 0.9rem; }
.table th { color: var(--text-dim); font-weight: 500; font-size: 0.76rem; letter-spacing: 0.12em; text-transform: uppercase; border-bottom: 1px solid var(--card-border); }
.table td { border-bottom: 1px solid var(--card-border); }
.table tr:last-child td { border-bottom: none; }
.table tr:hover td { background: rgba(255,255,255,0.015); }

/* ---------- Project cards ---------- */
.proj-card {
  background: var(--bg-2);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  padding: 20px;
  display: flex; flex-direction: column; gap: 14px;
  transition: all 0.2s; cursor: pointer; min-height: 190px;
}
.proj-card:hover { border-color: var(--card-border-hover); transform: translateY(-2px); box-shadow: var(--shadow-glow); }
.proj-card .top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.proj-card .name { font-family: var(--font-display); font-size: 1.05rem; font-weight: 600; line-height: 1.3; }
.proj-card .meta { display: flex; gap: 10px; font-size: 0.8rem; color: var(--text-dim); flex-wrap: wrap; }
.proj-card .meta .k { color: var(--text-faint); }
.proj-card.urgent { border-color: rgba(255,56,96,0.4); box-shadow: 0 0 24px rgba(255,56,96,0.15); }
.proj-card.pending { border-color: rgba(255,181,71,0.4); }

/* ---------- Comments ---------- */
.comment {
  background: var(--bg-3);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  padding: 16px 18px; margin-bottom: 12px;
  display: flex; flex-direction: column; gap: 8px;
  transition: all 0.2s;
}
.comment.urgent {
  border-color: var(--red);
  box-shadow: 0 0 0 1px var(--red) inset, 0 0 24px rgba(255,56,96,0.25);
  background: linear-gradient(135deg, rgba(255,56,96,0.08), rgba(255,0,110,0.04));
  animation: urgentPulse 2.8s ease-in-out infinite;
}
@keyframes urgentPulse {
  0%, 100% { box-shadow: 0 0 0 1px var(--red) inset, 0 0 24px rgba(255,56,96,0.20); }
  50% { box-shadow: 0 0 0 1px var(--red) inset, 0 0 36px rgba(255,56,96,0.45); }
}
.comment .head { display: flex; justify-content: space-between; align-items: center; gap: 10px; font-size: 0.84rem; }
.comment .author { font-weight: 600; }
.comment .when { color: var(--text-faint); font-family: var(--font-mono); font-size: 0.78rem; }
.comment .body { font-size: 0.94rem; line-height: 1.5; color: var(--text); }
.comment .project-ref { font-size: 0.78rem; color: var(--cyan); }

/* ---------- Toast ---------- */
.toast-container { position: fixed; top: 20px; right: 20px; z-index: 9999; display: flex; flex-direction: column; gap: 10px; }
.toast {
  min-width: 260px; padding: 14px 18px; border-radius: var(--radius-sm);
  background: rgba(13,17,23,0.96); border: 1px solid var(--card-border);
  color: var(--text); font-size: 0.9rem; box-shadow: var(--shadow-card);
  backdrop-filter: blur(14px);
  animation: toastIn 0.22s ease-out;
}
.toast.success { border-color: rgba(170,255,0,0.4); }
.toast.error { border-color: rgba(255,56,96,0.4); color: #ffd2db; }
.toast.info { border-color: rgba(0,229,255,0.4); }
@keyframes toastIn { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: none; } }

/* ---------- Modal ---------- */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(4,6,12,0.75);
  display: grid; place-items: center; z-index: 9000;
  backdrop-filter: blur(6px); animation: fadeIn 0.15s ease;
}
.modal {
  background: var(--bg-1); border: 1px solid var(--card-border);
  border-radius: var(--radius-lg); padding: 28px; width: min(520px, 92vw);
  box-shadow: var(--shadow-card), var(--shadow-glow);
  animation: slideUp 0.22s cubic-bezier(0.2,0.8,0.2,1);
}
.modal h2 { margin-bottom: 14px; }

/* ---------- Animations ---------- */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }
.fade-in { animation: fadeIn 0.3s ease-out; }
.slide-up { animation: slideUp 0.4s cubic-bezier(0.2,0.8,0.2,1); }
.stagger > * { animation: slideUp 0.4s cubic-bezier(0.2,0.8,0.2,1) both; }
.stagger > *:nth-child(1) { animation-delay: 0.03s; }
.stagger > *:nth-child(2) { animation-delay: 0.06s; }
.stagger > *:nth-child(3) { animation-delay: 0.09s; }
.stagger > *:nth-child(4) { animation-delay: 0.12s; }
.stagger > *:nth-child(5) { animation-delay: 0.15s; }
.stagger > *:nth-child(6) { animation-delay: 0.18s; }
.stagger > *:nth-child(7) { animation-delay: 0.21s; }
.stagger > *:nth-child(8) { animation-delay: 0.24s; }

/* ---------- Login page ---------- */
.login-page {
  min-height: 100vh; display: grid; place-items: center; padding: 24px;
  background:
    radial-gradient(1200px 800px at 20% 20%, rgba(0,229,255,0.12), transparent 60%),
    radial-gradient(1000px 700px at 80% 90%, rgba(255,0,110,0.12), transparent 60%),
    radial-gradient(500px 400px at 50% 50%, rgba(170,255,0,0.05), transparent 60%),
    var(--bg-0);
  position: relative; overflow: hidden;
}
.login-page::before {
  content: ''; position: absolute; inset: 0;
  background-image: linear-gradient(rgba(0,229,255,0.03) 1px, transparent 1px),
                    linear-gradient(90deg, rgba(0,229,255,0.03) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse at center, black, transparent 75%);
  pointer-events: none;
}
.login-card {
  width: min(440px, 92vw); padding: 40px 34px;
  background: var(--bg-2); border: 1px solid var(--card-border);
  border-radius: var(--radius-lg); backdrop-filter: blur(20px);
  box-shadow: var(--shadow-card), var(--shadow-glow);
  position: relative; z-index: 1;
}
.login-card .brand-big { text-align: center; margin-bottom: 28px; }
.login-card .brand-big svg { width: 92px; height: 92px; margin: 0 auto 14px; display: block; }
.login-card .brand-big .title { font-family: var(--font-display); font-weight: 700; letter-spacing: -0.02em; font-size: 1.8rem; }
.login-card .brand-big .title .t { background: var(--grad-primary); -webkit-background-clip: text; background-clip: text; color: transparent; }
.login-card .brand-big .subtitle { color: var(--text-dim); font-size: 0.85rem; letter-spacing: 0.18em; text-transform: uppercase; margin-top: 4px; }
.login-card .tag {
  display: inline-block; padding: 4px 12px; border-radius: 999px; margin-top: 10px;
  background: rgba(170,255,0,0.12); color: var(--lime);
  font-size: 0.7rem; letter-spacing: 0.12em; border: 1px solid rgba(170,255,0,0.3);
}

/* ---------- Empty state ---------- */
.empty {
  padding: 64px 24px; text-align: center; color: var(--text-dim);
  border: 1px dashed var(--card-border); border-radius: var(--radius-md);
}
.empty h3 { color: var(--text); margin-bottom: 8px; }

/* ---------- Filter bar ---------- */
.filters {
  display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 20px;
  padding: 14px; background: var(--bg-2); border: 1px solid var(--card-border);
  border-radius: var(--radius-md); backdrop-filter: blur(14px);
}
.filters .field { margin: 0; min-width: 160px; flex: 1; }
.filters .field.grow { flex: 2; }
.filters input, .filters select { padding: 9px 12px; font-size: 0.88rem; }

/* ---------- Misc ---------- */
.divider { height: 1px; background: var(--card-border); margin: 20px 0; }
.mono { font-family: var(--font-mono); }
.muted { color: var(--text-dim); }
.text-center { text-align: center; }
.row { display: flex; gap: 12px; align-items: center; }
.row.between { justify-content: space-between; }
.row.wrap { flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.stack.lg { gap: 20px; }
.hide { display: none !important; }

/* Mobile */
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; top: 0; left: -100%; width: 280px; z-index: 100;
    transition: left 0.25s;
  }
  .sidebar.open { left: 0; }
  .main { padding: 20px; }
  .mobile-topbar { display: flex !important; }
}
.mobile-topbar {
  display: none; padding: 14px 20px; justify-content: space-between; align-items: center;
  border-bottom: 1px solid var(--card-border); background: var(--bg-1);
  position: sticky; top: 0; z-index: 50;
}
.mobile-topbar .menu-btn { background: transparent; border: 1px solid var(--card-border); color: var(--text); padding: 8px 10px; border-radius: 8px; cursor: pointer; }
