/* ============================================================
   KIWIHUB — Shared Design System
   Deep dark mode · Neon green accent · Glassmorphism
   ============================================================ */

:root {
  --bg: #050807;
  --bg-2: #0a0f0d;
  --panel: rgba(16, 24, 21, 0.55);
  --panel-solid: #0d1411;
  --stroke: rgba(57, 255, 136, 0.12);
  --stroke-strong: rgba(57, 255, 136, 0.35);
  --text: #e7f3ec;
  --text-dim: #8aa398;
  --text-faint: #5b6f66;
  --green: #39ff88;
  --green-soft: #2bd673;
  --green-deep: #0fae57;
  --green-glow: rgba(57, 255, 136, 0.45);
  --red: #ff5470;
  --amber: #ffc24b;
  --blue: #4bb5ff;
  --radius: 18px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
}

/* Ambient background glow */
.bg-aura {
  position: fixed;
  inset: 0;
  z-index: -2;
  background:
    radial-gradient(60% 50% at 15% 0%, rgba(57, 255, 136, 0.10), transparent 60%),
    radial-gradient(50% 50% at 100% 30%, rgba(15, 174, 87, 0.08), transparent 55%),
    radial-gradient(40% 40% at 50% 100%, rgba(57, 255, 136, 0.06), transparent 60%);
}
.bg-grid {
  position: fixed;
  inset: 0;
  z-index: -1;
  background-image:
    linear-gradient(rgba(57, 255, 136, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(57, 255, 136, 0.035) 1px, transparent 1px);
  background-size: 46px 46px;
  mask-image: radial-gradient(ellipse 90% 70% at 50% 30%, #000 40%, transparent 100%);
}

/* Typography */
.font-display { font-family: 'Space Grotesk', 'Inter', sans-serif; }

/* Glass surfaces */
.glass {
  background: var(--panel);
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  border: 1px solid var(--stroke);
  border-radius: var(--radius);
}
.glass-hover { transition: border-color .25s, transform .25s, box-shadow .25s; }
.glass-hover:hover {
  border-color: var(--stroke-strong);
  transform: translateY(-3px);
  box-shadow: 0 12px 40px -12px rgba(57, 255, 136, 0.25);
}

/* Neon helpers */
.neon-text { color: var(--green); text-shadow: 0 0 18px var(--green-glow); }
.neon-border { border: 1px solid var(--stroke-strong); box-shadow: 0 0 0 1px rgba(57,255,136,.05), 0 0 24px -6px var(--green-glow) inset; }
.neon-dot { box-shadow: 0 0 10px 1px currentColor; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  font-weight: 600; font-size: .9rem; border-radius: 12px;
  padding: .65rem 1.15rem; cursor: pointer; border: 1px solid transparent;
  transition: transform .15s, box-shadow .25s, background .2s, border-color .2s, color .2s;
  text-decoration: none; white-space: nowrap;
}
.btn:active { transform: scale(.97); }
.btn svg { width: 16px; height: 16px; flex-shrink: 0; }
.badge svg { width: 13px; height: 13px; flex-shrink: 0; }
.btn-primary {
  background: linear-gradient(180deg, var(--green) 0%, var(--green-soft) 100%);
  color: #04140b; box-shadow: 0 8px 28px -8px var(--green-glow);
}
.btn-primary:hover { box-shadow: 0 10px 36px -6px var(--green-glow); filter: brightness(1.08); }
.btn-ghost { background: rgba(255,255,255,0.02); color: var(--text); border-color: var(--stroke); }
.btn-ghost:hover { border-color: var(--stroke-strong); color: var(--green); }
.btn-danger { background: rgba(255,84,112,0.10); color: var(--red); border-color: rgba(255,84,112,0.3); }
.btn-danger:hover { background: rgba(255,84,112,0.18); }

/* Inputs */
.field { display: flex; flex-direction: column; gap: .45rem; }
.field label { font-size: .8rem; color: var(--text-dim); font-weight: 500; }
.input, .select, textarea.input {
  width: 100%; background: rgba(0,0,0,0.35); border: 1px solid var(--stroke);
  border-radius: 12px; padding: .7rem .9rem; color: var(--text); font-size: .92rem;
  font-family: inherit; transition: border-color .2s, box-shadow .2s, background .2s;
}
.input::placeholder { color: var(--text-faint); }
.input:focus, .select:focus, textarea.input:focus {
  outline: none; border-color: var(--stroke-strong);
  box-shadow: 0 0 0 3px rgba(57,255,136,0.10); background: rgba(0,0,0,0.5);
}
.select { appearance: none; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%238aa398' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right .9rem center; padding-right: 2.2rem;
}

/* Badges */
.badge {
  display: inline-flex; align-items: center; gap: .4rem; font-size: .72rem; font-weight: 600;
  padding: .25rem .6rem; border-radius: 999px; border: 1px solid transparent; letter-spacing: .02em;
}
.badge-green { background: rgba(57,255,136,0.12); color: var(--green); border-color: rgba(57,255,136,0.3); }
.badge-amber { background: rgba(255,194,75,0.12); color: var(--amber); border-color: rgba(255,194,75,0.3); }
.badge-red { background: rgba(255,84,112,0.12); color: var(--red); border-color: rgba(255,84,112,0.3); }
.badge-blue { background: rgba(75,181,255,0.12); color: var(--blue); border-color: rgba(75,181,255,0.3); }
.badge-dim { background: rgba(255,255,255,0.04); color: var(--text-dim); border-color: var(--stroke); }

/* Progress bar */
.progress { height: 8px; width: 100%; background: rgba(0,0,0,0.4); border-radius: 999px; overflow: hidden; border: 1px solid var(--stroke); }
.progress > span { display: block; height: 100%; background: linear-gradient(90deg, var(--green-deep), var(--green)); box-shadow: 0 0 12px var(--green-glow); border-radius: 999px; transition: width .6s ease; }

/* Scrollbar */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(57,255,136,0.18); border-radius: 10px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: rgba(57,255,136,0.32); background-clip: padding-box; }

/* ===== Animations ===== */
@keyframes fadeUp { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: translateY(0); } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes scaleIn { from { opacity: 0; transform: scale(.94); } to { opacity: 1; transform: scale(1); } }
@keyframes pulseGlow { 0%,100% { box-shadow: 0 0 8px 0 var(--green-glow); } 50% { box-shadow: 0 0 18px 3px var(--green-glow); } }
@keyframes floaty { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }
@keyframes spin { to { transform: rotate(360deg); } }

.anim-up { opacity: 0; animation: fadeUp .6s cubic-bezier(.2,.7,.2,1) forwards; }
.anim-in { opacity: 0; animation: fadeIn .6s ease forwards; }
.d1 { animation-delay: .06s; } .d2 { animation-delay: .12s; } .d3 { animation-delay: .18s; }
.d4 { animation-delay: .24s; } .d5 { animation-delay: .30s; } .d6 { animation-delay: .36s; }
.pulse-dot { animation: pulseGlow 2s infinite; }
.floaty { animation: floaty 6s ease-in-out infinite; }

/* ===== Layout: sidebar shell ===== */
.shell { display: flex; min-height: 100vh; }
.sidebar {
  width: 264px; flex-shrink: 0; position: fixed; inset: 0 auto 0 0; z-index: 40;
  padding: 1.25rem; display: flex; flex-direction: column; gap: .35rem;
  background: rgba(8, 13, 11, 0.7); backdrop-filter: blur(22px) saturate(140%);
  -webkit-backdrop-filter: blur(22px) saturate(140%);
  border-right: 1px solid var(--stroke); transition: transform .3s ease;
}
.main { flex: 1; margin-left: 264px; min-width: 0; transition: margin .3s ease; }
.content { padding: 1.5rem; max-width: 1280px; margin: 0 auto; }

.nav-link {
  display: flex; align-items: center; gap: .75rem; padding: .68rem .8rem; border-radius: 12px;
  color: var(--text-dim); font-size: .9rem; font-weight: 500; text-decoration: none;
  transition: background .2s, color .2s, box-shadow .2s; cursor: pointer; border: 1px solid transparent;
}
.nav-link svg { width: 18px; height: 18px; flex-shrink: 0; }
.nav-link:hover { background: rgba(57,255,136,0.06); color: var(--text); }
.nav-link.active {
  background: linear-gradient(90deg, rgba(57,255,136,0.16), rgba(57,255,136,0.02));
  color: var(--green); border-color: rgba(57,255,136,0.25);
  box-shadow: inset 3px 0 0 var(--green), 0 6px 20px -10px var(--green-glow);
}
.nav-section { font-size: .68rem; text-transform: uppercase; letter-spacing: .14em; color: var(--text-faint); padding: 1rem .8rem .35rem; }
.submenu { display: none; flex-direction: column; gap: .15rem; margin: .15rem 0 .15rem .9rem; padding-left: .7rem; border-left: 1px solid var(--stroke); }
.submenu.open { display: flex; animation: fadeIn .25s ease; }
.sub-link { font-size: .85rem; padding: .5rem .7rem; }

/* Topbar */
.topbar {
  position: sticky; top: 0; z-index: 30; display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; padding: 1rem 1.5rem; background: rgba(6,10,9,0.55); backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px); border-bottom: 1px solid var(--stroke);
}

/* Stat card */
.stat-card { padding: 1.25rem; position: relative; overflow: hidden; }
.stat-card .icon-pill {
  width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center;
  background: rgba(57,255,136,0.10); color: var(--green); border: 1px solid rgba(57,255,136,0.2);
}

/* Modal */
.modal-overlay {
  position: fixed; inset: 0; z-index: 60; display: none; align-items: center; justify-content: center;
  padding: 1rem; background: rgba(2,5,4,0.65); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
}
.modal-overlay.open { display: flex; animation: fadeIn .2s ease; }
.modal {
  width: 100%; max-width: 480px; padding: 1.6rem; animation: scaleIn .25s cubic-bezier(.2,.8,.2,1);
  max-height: 90vh; overflow-y: auto;
}

/* Toast */
.toast-wrap { position: fixed; right: 1.25rem; bottom: 1.25rem; z-index: 90; display: flex; flex-direction: column; gap: .65rem; max-width: 340px; }
.toast {
  display: flex; align-items: flex-start; gap: .7rem; padding: .85rem 1rem; border-radius: 14px;
  background: rgba(13,20,17,0.9); backdrop-filter: blur(14px); border: 1px solid var(--stroke);
  box-shadow: 0 16px 40px -12px rgba(0,0,0,0.6); animation: scaleIn .3s ease; min-width: 260px;
}
.toast.success { border-color: rgba(57,255,136,0.35); }
.toast.error { border-color: rgba(255,84,112,0.4); }
.toast .t-icon { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; flex-shrink: 0; }
.toast.success .t-icon { background: rgba(57,255,136,0.14); color: var(--green); }
.toast.error .t-icon { background: rgba(255,84,112,0.14); color: var(--red); }
.toast.exit { animation: fadeOutToast .3s ease forwards; }
@keyframes fadeOutToast { to { opacity: 0; transform: translateX(40px); } }

/* Tables */
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: .74rem; text-transform: uppercase; letter-spacing: .08em; color: var(--text-faint); padding: .8rem 1rem; font-weight: 600; }
.table td { padding: .9rem 1rem; border-top: 1px solid var(--stroke); font-size: .9rem; }
.table tbody tr { transition: background .15s; }
.table tbody tr:hover { background: rgba(57,255,136,0.04); }

/* Matrix table */
.matrix { width: 100%; border-collapse: separate; border-spacing: 6px; }
.matrix th, .matrix td { padding: .7rem .9rem; text-align: center; font-size: .85rem; border-radius: 10px; }
.matrix thead th { background: rgba(57,255,136,0.06); color: var(--green); font-weight: 600; }
.matrix tbody th { background: rgba(255,255,255,0.03); color: var(--text); text-align: left; font-weight: 600; }
.matrix tbody td { background: rgba(0,0,0,0.25); border: 1px solid var(--stroke); color: var(--text-dim); transition: all .2s; }
.matrix tbody td:hover { border-color: var(--stroke-strong); color: var(--green); background: rgba(57,255,136,0.06); }
.matrix td.hi { color: var(--green); font-weight: 700; }

/* Mobile menu button */
.menu-btn { display: none; }
.backdrop { display: none; }

@media (max-width: 980px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); box-shadow: 0 0 60px rgba(0,0,0,0.6); }
  .main { margin-left: 0; }
  .menu-btn { display: inline-flex; }
  .backdrop.show { display: block; position: fixed; inset: 0; z-index: 35; background: rgba(0,0,0,0.5); }
}

.show-sm { display: none !important; }
@media (max-width: 640px) { .hide-sm { display: none !important; } .show-sm { display: block !important; } }

.divider { height: 1px; background: var(--stroke); border: none; margin: 1rem 0; }
.avatar { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; font-weight: 700; background: linear-gradient(135deg, var(--green), var(--green-deep)); color: #04140b; }
