/* ---------- Base ---------- */
html { color-scheme: dark; }
body { -webkit-font-smoothing: antialiased; }

::selection { background: rgba(99,102,241,.4); color: #fff; }

/* Scrollbars */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,.08); border-radius: 8px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,.16); }

/* ---------- Nav ---------- */
.nav-link {
  display: flex; align-items: center; gap: .75rem;
  padding: .625rem .75rem; border-radius: .75rem;
  font-size: 14px; font-weight: 500; color: #cbd5e1;
  cursor: pointer; transition: all .2s ease;
  position: relative;
}
.nav-link:hover { background: rgba(255,255,255,.04); color: #fff; }
.nav-link svg { width: 18px; height: 18px; opacity: .9; }
.nav-link.active {
  background: linear-gradient(135deg, rgba(99,102,241,.18), rgba(34,211,238,.10));
  color: #fff;
  box-shadow: inset 0 0 0 1px rgba(99,102,241,.25);
}
.nav-link.active::before {
  content: ""; position: absolute; left: -12px; top: 50%; transform: translateY(-50%);
  width: 3px; height: 18px; border-radius: 2px;
  background: linear-gradient(180deg, #6366f1, #22d3ee);
}

/* ---------- Buttons ---------- */
.btn-primary {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  padding: .625rem 1rem; border-radius: .75rem;
  font-size: 13px; font-weight: 600; color: white;
  background: linear-gradient(135deg, #6366f1, #4f46e5);
  box-shadow: 0 10px 24px -10px rgba(99,102,241,.6), inset 0 0 0 1px rgba(255,255,255,.08);
  transition: all .2s ease;
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 14px 28px -10px rgba(99,102,241,.7); }
.btn-primary:active { transform: translateY(0); }

.btn-secondary {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  padding: .55rem .9rem; border-radius: .75rem;
  font-size: 13px; font-weight: 500; color: #e2e8f0;
  background: rgba(255,255,255,.04); border: 1px solid rgba(255,255,255,.08);
  transition: all .2s ease;
}
.btn-secondary:hover { background: rgba(255,255,255,.08); color: white; }

.btn-danger {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  padding: .55rem .9rem; border-radius: .75rem;
  font-size: 13px; font-weight: 600; color: #fecaca;
  background: rgba(244,63,94,.10); border: 1px solid rgba(244,63,94,.25);
  transition: all .2s ease;
}
.btn-danger:hover { background: rgba(244,63,94,.18); color: #fff; }

.btn-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 38px; height: 38px; border-radius: .75rem;
  background: rgba(255,255,255,.04); border: 1px solid rgba(255,255,255,.06);
  color: #cbd5e1; transition: all .2s ease;
}
.btn-icon:hover { background: rgba(255,255,255,.08); color: white; }
.btn-icon svg { width: 18px; height: 18px; }

/* ---------- Cards ---------- */
.card {
  background: linear-gradient(180deg, rgba(255,255,255,.025), rgba(255,255,255,.01));
  border: 1px solid rgba(255,255,255,.06);
  border-radius: 1rem;
  box-shadow: 0 1px 0 rgba(255,255,255,.04) inset, 0 10px 30px -20px rgba(0,0,0,.6);
}

.glass {
  background: linear-gradient(180deg, rgba(255,255,255,.04), rgba(255,255,255,.015));
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255,255,255,.06);
}

/* ---------- Badges ---------- */
.badge { display:inline-flex; align-items:center; gap:.35rem; padding:.25rem .55rem; font-size:11px; font-weight:600; border-radius:999px; letter-spacing:.02em; }
.badge-emerald { background: rgba(16,185,129,.12); color: #6ee7b7; box-shadow: inset 0 0 0 1px rgba(16,185,129,.22); }
.badge-amber   { background: rgba(245,158,11,.12); color: #fcd34d; box-shadow: inset 0 0 0 1px rgba(245,158,11,.22); }
.badge-rose    { background: rgba(244,63,94,.12);  color: #fda4af; box-shadow: inset 0 0 0 1px rgba(244,63,94,.22); }
.badge-brand   { background: rgba(99,102,241,.14); color: #c7d2fe; box-shadow: inset 0 0 0 1px rgba(99,102,241,.28); }
.badge-cyan    { background: rgba(34,211,238,.12); color: #a5f3fc; box-shadow: inset 0 0 0 1px rgba(34,211,238,.25); }
.badge-slate   { background: rgba(148,163,184,.10); color: #cbd5e1; box-shadow: inset 0 0 0 1px rgba(148,163,184,.22); }

.dot { width: 6px; height: 6px; border-radius: 999px; }

/* ---------- Forms ---------- */
.input, .select, textarea.input {
  width: 100%; padding: .625rem .8rem; border-radius: .75rem;
  background: rgba(11,13,20,.7); border: 1px solid rgba(255,255,255,.07);
  color: #f1f5f9; font-size: 13.5px;
  transition: all .15s ease;
}
.input:focus, .select:focus, textarea.input:focus {
  outline: none; border-color: rgba(99,102,241,.5); box-shadow: 0 0 0 4px rgba(99,102,241,.12);
}
.label { display: block; font-size: 12px; font-weight: 600; color: #cbd5e1; margin-bottom: .375rem; }

.select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='%2394a3b8'%3E%3Cpath d='M5.23 7.21a.75.75 0 0 1 1.06.02L10 11.06l3.71-3.83a.75.75 0 1 1 1.08 1.04l-4.25 4.39a.75.75 0 0 1-1.08 0L5.21 8.27a.75.75 0 0 1 .02-1.06z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right .65rem center; background-size: 1.1rem; padding-right: 2.25rem; }

/* ---------- Table ---------- */
.tbl { width: 100%; border-collapse: separate; border-spacing: 0; }
.tbl thead th {
  text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .08em;
  color: #94a3b8; padding: .65rem .85rem; border-bottom: 1px solid rgba(255,255,255,.06);
  background: rgba(255,255,255,.015);
}
.tbl tbody td {
  padding: .85rem; border-bottom: 1px solid rgba(255,255,255,.04); font-size: 13.5px; vertical-align: middle;
}
.tbl tbody tr:hover { background: rgba(255,255,255,.025); }
.tbl tbody tr:last-child td { border-bottom: none; }

/* ---------- KPI ---------- */
.kpi-card {
  position: relative; overflow: hidden;
  background: linear-gradient(180deg, rgba(255,255,255,.035), rgba(255,255,255,.01));
  border: 1px solid rgba(255,255,255,.06);
  border-radius: 1rem; padding: 1.1rem 1.2rem;
}
.kpi-card::after {
  content: ""; position: absolute; inset: -1px;
  background: radial-gradient(120% 80% at 100% 0%, rgba(99,102,241,.18), transparent 60%);
  pointer-events: none; opacity: .8;
}
.kpi-icon { width: 38px; height: 38px; border-radius: .75rem; display: grid; place-items: center; }

/* ---------- Avatar ---------- */
.avatar {
  width: 36px; height: 36px; border-radius: 999px; display: grid; place-items: center;
  font-weight: 700; font-size: 12px; letter-spacing: .02em; color: white; flex-shrink: 0;
}

/* ---------- Modal ---------- */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(2,3,7,.7); backdrop-filter: blur(6px);
  z-index: 80; display: grid; place-items: center; padding: 1rem;
  animation: fadeIn .2s ease;
}
.modal-card {
  width: 100%; max-width: 560px; max-height: 90vh; overflow: auto;
  background: linear-gradient(180deg, #11141d, #0c0f17);
  border: 1px solid rgba(255,255,255,.08); border-radius: 1.25rem;
  box-shadow: 0 30px 80px -20px rgba(0,0,0,.7);
  animation: slideUp .25s ease;
}
@keyframes fadeIn { from {opacity:0} to {opacity:1} }
@keyframes slideUp { from { transform: translateY(8px); opacity: 0 } to { transform: translateY(0); opacity: 1 } }

/* ---------- Toast ---------- */
.toast {
  pointer-events: auto;
  display:flex; gap:.65rem; align-items:flex-start;
  padding: .8rem .9rem; border-radius: .9rem;
  background: linear-gradient(180deg, rgba(20,24,34,.95), rgba(14,17,25,.95));
  border: 1px solid rgba(255,255,255,.08);
  box-shadow: 0 14px 30px -10px rgba(0,0,0,.6);
  animation: slideDown .25s ease;
  min-width: 280px;
}
.toast .icon { width: 32px; height: 32px; border-radius: .6rem; display: grid; place-items: center; flex-shrink: 0; }
@keyframes slideDown { from { transform: translateY(-8px); opacity: 0 } to { transform: translateY(0); opacity: 1 } }

/* ---------- Misc ---------- */
.divider { height: 1px; background: linear-gradient(90deg, transparent, rgba(255,255,255,.08), transparent); }

.shimmer {
  background: linear-gradient(90deg, rgba(255,255,255,.04), rgba(255,255,255,.10), rgba(255,255,255,.04));
  background-size: 200% 100%;
  animation: shim 1.4s infinite;
}
@keyframes shim { 0% { background-position: 200% 0 } 100% { background-position: -200% 0 } }

.spark { stroke: #6366f1; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.progress { height: 6px; background: rgba(255,255,255,.05); border-radius: 999px; overflow: hidden; }
.progress > span { display: block; height: 100%; background: linear-gradient(90deg, #6366f1, #22d3ee); border-radius: 999px; }

.tag-input { display:flex; flex-wrap:wrap; gap:.35rem; padding:.45rem; border-radius:.75rem; background:rgba(11,13,20,.7); border:1px solid rgba(255,255,255,.07); }
.tag-input input { background: transparent; border: none; outline: none; flex: 1; min-width: 100px; color: white; font-size: 13px; padding: .25rem; }

/* Empty state */
.empty {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 3rem 1.5rem; text-align: center;
}
.empty .ico { width: 56px; height: 56px; border-radius: 1rem; background: rgba(99,102,241,.10); border: 1px solid rgba(99,102,241,.2); display: grid; place-items: center; margin-bottom: .9rem; }

/* Animated check */
.check-circle { animation: pop .35s cubic-bezier(.2,1.4,.4,1) both; }
@keyframes pop { 0% { transform: scale(.6); opacity: 0 } 100% { transform: scale(1); opacity: 1 } }
