:root {
  --bg: #0f1c1a;
  --bg-2: #152624;
  --panel: #1a2f2c;
  --panel-2: #213a36;
  --ink: #eef6f3;
  --muted: #9bb4ae;
  --accent: #2dd4a8;
  --accent-2: #f0b429;
  --danger: #f07167;
  --line: rgba(238, 246, 243, 0.08);
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
  --radius: 18px;
  --font: "DM Sans", system-ui, sans-serif;
  --display: "Fraunces", Georgia, serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: var(--font);
  color: var(--ink);
  background:
    radial-gradient(1200px 600px at 10% -10%, rgba(45, 212, 168, 0.18), transparent 55%),
    radial-gradient(900px 500px at 100% 0%, rgba(240, 180, 41, 0.12), transparent 50%),
    linear-gradient(160deg, #0c1614 0%, #12201d 45%, #0f1c1a 100%);
}

a { color: var(--accent); text-decoration: none; }
button, .btn {
  font: inherit;
  cursor: pointer;
  border: 0;
  border-radius: 12px;
  padding: 0.7rem 1.1rem;
  background: var(--accent);
  color: #06221a;
  font-weight: 600;
}
.btn.ghost {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
}
.btn.danger { background: var(--danger); color: #1a0a08; }
.btn.sm { padding: 0.4rem 0.75rem; font-size: 0.875rem; }

.shell {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: 100vh;
}

.sidebar {
  padding: 1.5rem 1.1rem;
  border-right: 1px solid var(--line);
  background: rgba(15, 28, 26, 0.72);
  backdrop-filter: blur(16px);
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  color: inherit;
}
.brand-logo {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  object-fit: cover;
  background: #fff;
  box-shadow: 0 10px 30px rgba(45, 212, 168, 0.2);
}
.brand-mark {
  width: 44px; height: 44px;
  border-radius: 14px;
  display: grid; place-items: center;
  font-family: var(--display);
  font-weight: 700;
  background: linear-gradient(145deg, var(--accent), #1aa37f);
  color: #042018;
  box-shadow: 0 10px 30px rgba(45, 212, 168, 0.25);
}
.brand-text strong { display: block; font-family: var(--display); font-size: 1.35rem; letter-spacing: -0.02em; }
.brand-text small { color: var(--muted); }

.sidebar nav { display: flex; flex-direction: column; gap: 0.35rem; flex: 1; }
.sidebar nav a {
  color: var(--muted);
  padding: 0.75rem 0.9rem;
  border-radius: 12px;
  transition: 0.2s ease;
}
.sidebar nav a:hover, .sidebar nav a.active {
  background: rgba(45, 212, 168, 0.12);
  color: var(--ink);
}
.sidebar-foot button {
  width: 100%;
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--line);
}

.main { padding: 1.75rem 2rem 3rem; }
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.topbar h1 {
  margin: 0;
  font-family: var(--display);
  font-size: clamp(1.6rem, 2.4vw, 2.2rem);
  letter-spacing: -0.03em;
}
.sub { margin: 0.35rem 0 0; color: var(--muted); }
.user-chip {
  display: flex; align-items: center; gap: 0.75rem;
  background: rgba(26, 47, 44, 0.8);
  border: 1px solid var(--line);
  padding: 0.55rem 0.85rem;
  border-radius: 999px;
}
.user-chip img, .avatar-fallback {
  width: 36px; height: 36px; border-radius: 50%; object-fit: cover;
}
.avatar-fallback {
  display: grid; place-items: center;
  background: var(--panel-2); font-weight: 700;
}
.user-chip strong { display: block; font-size: 0.9rem; }
.user-chip small { color: var(--muted); }

.flash {
  padding: 0.85rem 1rem;
  border-radius: 12px;
  margin-bottom: 1rem;
}
.flash.ok { background: rgba(45, 212, 168, 0.15); color: #b8f5e0; }
.flash.err { background: rgba(240, 113, 103, 0.15); color: #ffd0cb; }

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.stat {
  background: linear-gradient(160deg, rgba(33, 58, 54, 0.95), rgba(26, 47, 44, 0.9));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.1rem 1.2rem;
  box-shadow: var(--shadow);
  animation: rise 0.5s ease both;
}
.stat:nth-child(2) { animation-delay: 0.05s; }
.stat:nth-child(3) { animation-delay: 0.1s; }
.stat:nth-child(4) { animation-delay: 0.15s; }
.stat span { color: var(--muted); font-size: 0.85rem; }
.stat strong {
  display: block;
  margin-top: 0.35rem;
  font-family: var(--display);
  font-size: 2rem;
  letter-spacing: -0.03em;
}

.panel {
  background: rgba(26, 47, 44, 0.72);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow);
  margin-bottom: 1.25rem;
}
.panel h2 {
  margin: 0 0 1rem;
  font-family: var(--display);
  font-size: 1.25rem;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 1.25rem;
}

table { width: 100%; border-collapse: collapse; }
th, td {
  text-align: left;
  padding: 0.75rem 0.5rem;
  border-bottom: 1px solid var(--line);
  font-size: 0.92rem;
}
th { color: var(--muted); font-weight: 500; }
tr:hover td { background: rgba(45, 212, 168, 0.04); }

.toolbar {
  display: flex; flex-wrap: wrap; gap: 0.75rem;
  align-items: center; margin-bottom: 1rem;
}
input, select, textarea {
  font: inherit;
  color: var(--ink);
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.65rem 0.85rem;
}
input:focus, select:focus, textarea:focus {
  outline: 2px solid rgba(45, 212, 168, 0.35);
  border-color: transparent;
}
label { display: block; color: var(--muted); font-size: 0.85rem; margin-bottom: 0.35rem; }
.form-row { margin-bottom: 0.9rem; }
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.85rem;
}

.badge {
  display: inline-flex;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-size: 0.75rem;
  background: rgba(45, 212, 168, 0.15);
  color: var(--accent);
}
.badge.warn { background: rgba(240, 180, 41, 0.15); color: var(--accent-2); }
.badge.muted { background: rgba(155, 180, 174, 0.15); color: var(--muted); }

.pagination { margin-top: 1rem; display: flex; gap: 0.4rem; flex-wrap: wrap; }
.pagination a, .pagination span {
  padding: 0.4rem 0.7rem;
  border-radius: 8px;
  border: 1px solid var(--line);
  color: var(--muted);
}
.pagination .active span { background: var(--accent); color: #06221a; border-color: transparent; }

/* Auth */
.auth-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 2rem;
  position: relative;
  overflow: hidden;
}
.auth-page::before {
  content: "";
  position: absolute;
  inset: -20% auto auto -10%;
  width: 55vw; height: 55vw;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(45, 212, 168, 0.22), transparent 65%);
  animation: drift 12s ease-in-out infinite alternate;
}
.auth-page::after {
  content: "";
  position: absolute;
  right: -10%; bottom: -20%;
  width: 45vw; height: 45vw;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(240, 180, 41, 0.14), transparent 65%);
  animation: drift 14s ease-in-out infinite alternate-reverse;
}
.auth-card {
  position: relative;
  z-index: 1;
  width: min(420px, 100%);
  background: rgba(26, 47, 44, 0.88);
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 2rem;
  box-shadow: var(--shadow);
  animation: rise 0.6s ease both;
}
.auth-card .auth-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.65rem;
  margin-bottom: 0.35rem;
}
.auth-card .auth-brand img {
  width: 72px;
  height: 72px;
  border-radius: 18px;
  object-fit: cover;
  background: #fff;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.25);
}
.auth-card .logo {
  font-family: var(--display);
  font-size: 2.4rem;
  margin: 0;
  letter-spacing: -0.04em;
  text-align: center;
}
.auth-card .tagline { color: var(--muted); margin: 0 0 1.5rem; text-align: center; }
.auth-card .divider {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 0.75rem;
  align-items: center;
  color: var(--muted);
  margin: 1.25rem 0;
  font-size: 0.85rem;
}
.auth-card .divider::before, .auth-card .divider::after {
  content: ""; height: 1px; background: var(--line);
}
.google-btn {
  display: flex; align-items: center; justify-content: center; gap: 0.65rem;
  width: 100%;
  background: #fff;
  color: #1f1f1f;
  border-radius: 12px;
  padding: 0.8rem 1rem;
  font-weight: 600;
}
.errors { color: #ffb4ae; font-size: 0.9rem; margin-bottom: 0.75rem; }

@keyframes rise {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: none; }
}
@keyframes drift {
  from { transform: translate(0, 0); }
  to { transform: translate(40px, 30px); }
}

@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: relative; height: auto; }
  .grid-2 { grid-template-columns: 1fr; }
  .main { padding: 1.25rem; }
}
