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

:root {
  color-scheme: dark;
  --bg: #0c0f16;
  --bg-elevated: #12161f;
  --panel: #161b27;
  --panel2: #1a2030;
  --line: #2a3144;
  --line-soft: rgba(255, 255, 255, 0.06);
  --text: #f4f6fb;
  --muted: #8b95ab;
  --accent: #a5f35b;
  --accent2: #d1ff9c;
  --accent-dim: rgba(165, 243, 91, 0.12);
  --danger: #ff838d;
  --blue: #8ea5ff;
  --shadow: 0 24px 64px rgba(0, 0, 0, 0.45);
  --radius: 16px;
  --radius-sm: 10px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font-family: 'DM Sans', system-ui, -apple-system, sans-serif;
  overflow-x: hidden;
  line-height: 1.5;
}
a { color: inherit; text-decoration: none; }
button, input { font: inherit; }
button { cursor: pointer; }
img, svg { display: block; max-width: 100%; }

.wrap {
  width: min(1120px, calc(100% - 40px));
  margin-inline: auto;
}

/* Ambient glow */
.ambient {
  position: fixed;
  z-index: -1;
  pointer-events: none;
  filter: blur(100px);
  border-radius: 50%;
  opacity: 0.18;
  will-change: transform;
}
.ambient-one {
  width: min(420px, 70vw);
  height: min(420px, 70vw);
  background: #5b7cff;
  top: 60px;
  left: -140px;
  animation: floatA 18s var(--ease) infinite alternate;
}
.ambient-two {
  width: min(480px, 75vw);
  height: min(480px, 75vw);
  background: #a5f35b;
  right: -180px;
  top: 320px;
  opacity: 0.1;
  animation: floatB 22s var(--ease) infinite alternate;
}
@keyframes floatA {
  from { transform: translate(0, 0) scale(1); }
  to { transform: translate(40px, 30px) scale(1.08); }
}
@keyframes floatB {
  from { transform: translate(0, 0) scale(1); }
  to { transform: translate(-30px, -40px) scale(1.05); }
}

/* Topbar */
.topbar {
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line-soft);
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(12, 15, 22, 0.82);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 500;
  letter-spacing: -0.3px;
  transition: opacity 0.2s;
}
.brand:hover { opacity: 0.9; }
.brand b { font-weight: 700; }
.brand-mark,
.mini-mark {
  display: grid;
  place-items: center;
  background: var(--accent);
  color: #11170d;
  font-weight: 800;
  letter-spacing: -1px;
  border-radius: 11px;
  box-shadow: 0 0 24px rgba(165, 243, 91, 0.25);
}
.brand-mark { width: 38px; height: 38px; font-size: 14px; }
.top-links {
  display: flex;
  align-items: center;
  gap: 18px;
  color: #a8b2c6;
  font-size: 13px;
}
.top-links a:hover,
.footer a:hover { color: var(--accent); }
.admin-shortcut {
  display: flex;
  align-items: center;
  gap: 8px !important;
  color: #e8ecf6 !important;
  border: 1px solid #323a4f;
  padding: 9px 13px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
  transition: border-color 0.2s, background 0.2s, transform 0.15s;
}
.admin-shortcut:hover {
  border-color: #4a5570;
  background: rgba(255, 255, 255, 0.05);
  transform: translateY(-1px);
}
.dot,
.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  display: inline-block;
  box-shadow: 0 0 12px #a5f35b88;
  flex-shrink: 0;
}
.link-button {
  border: 0;
  background: transparent;
  color: #aeb8cb;
  font-size: 13px;
  padding: 8px 4px;
  transition: color 0.15s;
}
.link-button:hover { color: var(--accent); }

/* Hero / login */
.hero {
  display: grid;
  grid-template-columns: 1.05fr 0.78fr;
  gap: clamp(36px, 7vw, 100px);
  align-items: center;
  padding: 56px 0 72px;
  min-height: calc(100dvh - 152px);
}
.eyebrow {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--accent);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.6px;
  text-transform: uppercase;
}
.pulse {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 0 rgba(165, 243, 91, 0.4);
  animation: pulse 2s ease-out infinite;
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(165, 243, 91, 0.45); }
  70% { box-shadow: 0 0 0 10px rgba(165, 243, 91, 0); }
  100% { box-shadow: 0 0 0 0 rgba(165, 243, 91, 0); }
}
h1, h2, p { margin-top: 0; }
h1 {
  font-family: 'Space Grotesk', sans-serif;
  font-size: clamp(40px, 5.4vw, 68px);
  line-height: 1.05;
  letter-spacing: -2.8px;
  margin: 20px 0 18px;
  font-weight: 600;
}
h1 span { color: var(--accent); }
.hero-lead {
  color: var(--muted);
  font-size: 15.5px;
  line-height: 1.75;
  max-width: 470px;
  margin-bottom: 28px;
}
.feature-list {
  display: grid;
  gap: 14px;
  margin-top: 28px;
}
.feature {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid transparent;
  background: rgba(255, 255, 255, 0.02);
  transition: border-color 0.2s, background 0.2s;
}
.feature:hover {
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.035);
}
.feature-icon {
  width: 36px;
  height: 36px;
  border: 1px solid #323a4e;
  border-radius: 10px;
  display: grid;
  place-items: center;
  color: var(--accent);
  font-size: 15px;
  background: #1a2030;
  flex-shrink: 0;
}
.feature b,
.placeholder-row b {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 2px;
}
.feature small,
.placeholder-row small {
  display: block;
  color: var(--muted);
  font-size: 11.5px;
}
.hero-note {
  display: flex;
  align-items: center;
  gap: 9px;
  color: #7f899d;
  font-size: 12px;
  margin-top: 28px;
}
.lock-icon { color: var(--accent); }

/* Auth card */
.auth-card {
  background: linear-gradient(160deg, #1a1f2d 0%, #131722 100%);
  border: 1px solid #2e3548;
  border-radius: 20px;
  padding: 28px;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
  animation: rise 0.55s var(--ease) both;
}
.auth-card::before {
  content: "";
  position: absolute;
  height: 2px;
  top: 0;
  left: 16%;
  right: 16%;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  opacity: 0.85;
}
@keyframes rise {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}
.card-heading {
  display: flex;
  align-items: center;
  gap: 13px;
  margin-bottom: 24px;
}
.mini-mark {
  width: 44px;
  height: 44px;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 14px;
  border-radius: 12px;
}
.card-heading h2 {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 20px;
  letter-spacing: -0.5px;
  margin: 0 0 4px;
}
.card-heading p {
  font-size: 12px;
  color: var(--muted);
  margin: 0;
}
.tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: #0e121b;
  border: 1px solid #262d3f;
  border-radius: 11px;
  padding: 4px;
  margin-bottom: 22px;
}
.tab {
  border: 0;
  background: transparent;
  color: #8b95a9;
  padding: 11px;
  border-radius: 8px;
  font-size: 12.5px;
  font-weight: 600;
  transition: background 0.2s, color 0.2s, box-shadow 0.2s;
}
.tab.active {
  background: #252c3e;
  color: var(--text);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.25);
}
.tab:not(.active):hover { color: #c5cddc; }
label {
  display: block;
  font-size: 11.5px;
  font-weight: 600;
  color: #d0d6e4;
  margin-bottom: 8px;
}
input {
  width: 100%;
  border: 1px solid #323a50;
  border-radius: 10px;
  background: #0e121b;
  color: var(--text);
  padding: 13px 14px;
  outline: none;
  font-size: 13.5px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
input::placeholder { color: #5c667a; }
input:focus {
  border-color: rgba(165, 243, 91, 0.55);
  box-shadow: 0 0 0 3px var(--accent-dim);
}
#email { margin-bottom: 16px; }
.password-wrap { position: relative; }
.password-wrap input { padding-right: 68px; }
.show-password {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: 0;
  color: #93a0b6;
  font-size: 11px;
  font-weight: 600;
  padding: 6px 8px;
  border-radius: 6px;
  transition: color 0.15s, background 0.15s;
}
.show-password:hover {
  color: var(--accent);
  background: var(--accent-dim);
}
.field-hint {
  color: #f0c56a;
  font-size: 11px;
  margin: 8px 0 0;
}
.btn {
  border: 0;
  border-radius: 10px;
  font-weight: 700;
  font-size: 13px;
  padding: 13px 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: transform 0.15s var(--ease), filter 0.15s, box-shadow 0.15s;
}
.btn:hover {
  filter: brightness(1.06);
  transform: translateY(-1px);
}
.btn:active { transform: translateY(0); }
.btn-primary {
  background: var(--accent);
  color: #11170d;
  box-shadow: 0 8px 28px rgba(165, 243, 91, 0.22);
}
.btn-primary:disabled {
  opacity: 0.6;
  cursor: wait;
  transform: none;
  box-shadow: none;
}
.btn-full { width: 100%; margin-top: 18px; }
.btn-secondary {
  background: #222838;
  color: #e9edf6;
  border: 1px solid #343c52;
}
.btn-secondary:hover {
  border-color: #46506a;
  background: #272e40;
}
.legal-note {
  font-size: 11px;
  line-height: 1.65;
  color: #6d778c;
  margin: 16px 0 20px;
}
.card-footer {
  border-top: 1px solid #262d3f;
  padding-top: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: #7f8a9e;
  font-size: 11px;
}
.message {
  padding: 11px 13px;
  border: 1px solid #3a4a34;
  background: #1a2a1a;
  color: #c8ffad;
  border-radius: 10px;
  font-size: 12.5px;
  line-height: 1.5;
  margin: 12px 0;
}
.message.error {
  border-color: #5c333c;
  background: #2a1a22;
  color: #ffb6bc;
}
.message[hidden] { display: none; }

/* Footer */
.footer {
  min-height: 68px;
  border-top: 1px solid var(--line-soft);
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: #6d778c;
  font-size: 11px;
  padding: 8px 0;
  gap: 12px;
  flex-wrap: wrap;
}
.footer span:last-child {
  display: flex;
  gap: 10px;
  align-items: center;
}
.footer i {
  font-style: normal;
  color: #3f4759;
}

/* Dashboard */
.dashboard {
  padding: 44px 0 60px;
  min-height: calc(100dvh - 148px);
}
.page-title-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  margin-bottom: 28px;
}
.page-title-row h1 {
  font-size: clamp(36px, 4.5vw, 48px);
  letter-spacing: -2px;
  margin: 12px 0 8px;
}
.muted {
  color: var(--muted);
  font-size: 13.5px;
  line-height: 1.7;
}
.page-title-row .muted { margin-bottom: 0; }
.user-chip {
  display: flex;
  align-items: center;
  gap: 12px;
  border: 1px solid #2e3548;
  background: var(--panel);
  padding: 10px 14px;
  border-radius: 14px;
  max-width: 320px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}
.avatar {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 11px;
  background: var(--accent);
  color: #141a0f;
  font-weight: 800;
  font-size: 11px;
  flex-shrink: 0;
}
.admin-avatar { background: #9badff; color: #10131c; }
.user-chip small {
  display: block;
  color: #8590a4;
  font-size: 9px;
  letter-spacing: 1px;
  margin-bottom: 3px;
}
.user-chip b {
  display: block;
  font-size: 12.5px;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}
.stat-card,
.panel-card {
  background: linear-gradient(155deg, #181e2b 0%, #131822 100%);
  border: 1px solid #2a3144;
  border-radius: var(--radius);
  padding: 22px;
  transition: border-color 0.2s, transform 0.2s var(--ease), box-shadow 0.2s;
}
.stat-card:hover {
  border-color: #3a435a;
  transform: translateY(-2px);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.25);
}
.stat-label {
  font-size: 11.5px;
  color: #8e98ac;
  font-weight: 500;
}
.stat-value {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 28px;
  letter-spacing: -1px;
  font-weight: 600;
  margin: 12px 0 6px;
}
.stat-date { font-size: 20px; }
.stat-foot {
  font-size: 11px;
  color: #6d778c;
}
.content-grid {
  display: grid;
  grid-template-columns: 1.35fr 0.65fr;
  gap: 14px;
}
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
}
.section-head .eyebrow {
  font-size: 9px;
  margin-bottom: 6px;
}
.section-head h2 {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 19px;
  letter-spacing: -0.4px;
  margin: 0;
}
.badge {
  border-radius: 999px;
  padding: 6px 11px;
  font-size: 10px;
  font-weight: 700;
  white-space: nowrap;
}
.badge-pending {
  color: #f4d58a;
  background: #3d3118;
  border: 1px solid #5c4a28;
}
.placeholder-row {
  display: flex;
  align-items: center;
  gap: 12px;
  border: 1px solid #2e3548;
  border-radius: 12px;
  background: #10151f;
  padding: 14px;
  margin-top: 18px;
}
.placeholder-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: #24321c;
  color: var(--accent);
  display: grid;
  place-items: center;
  font-size: 18px;
  flex-shrink: 0;
}
.quick-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 13px 0;
  border-bottom: 1px solid #262d3f;
  font-size: 13px;
  color: #c5cddc;
  transition: color 0.15s, padding-left 0.15s;
}
.quick-link:last-child { border-bottom: 0; }
.quick-link span { color: var(--accent); }
.quick-link:hover {
  color: var(--accent);
  padding-left: 4px;
}
.small-text {
  font-size: 11px;
  margin-top: 16px;
}
.users-card { margin-top: 0; }
.table-wrap {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: 10px;
}
table {
  border-collapse: collapse;
  width: 100%;
  min-width: 480px;
  text-align: left;
}
th {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.9px;
  color: #7a8499;
  font-weight: 600;
  padding: 12px 12px;
  border-bottom: 1px solid #2e3548;
}
td {
  padding: 13px 12px;
  border-bottom: 1px solid #222836;
  font-size: 12.5px;
  color: #d2d9e6;
}
tbody tr {
  transition: background 0.15s;
}
tbody tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}
tbody tr:last-child td { border-bottom: 0; }
.table-empty {
  text-align: center;
  color: #8590a4;
  padding: 28px;
}
.role-tag,
.state-tag {
  display: inline-block;
  padding: 5px 9px;
  border-radius: 6px;
  font-size: 10px;
  font-weight: 700;
}
.role-admin { background: #273152; color: #b9c7ff; }
.role-user { background: #2a3040; color: #c4cada; }
.state-active { background: #22351e; color: #c5f8a8; }
.state-inactive { background: #3f232a; color: #ffadb5; }
.admin-note { margin-top: 14px; }
code {
  background: #0c1018;
  border: 1px solid #2a3144;
  border-radius: 5px;
  padding: 2px 6px;
  color: #d4ffb8;
  font-size: 11.5px;
}

/* Focus visible for a11y */
:focus-visible {
  outline: 2px solid rgba(165, 243, 91, 0.55);
  outline-offset: 2px;
}
button:focus:not(:focus-visible),
a:focus:not(:focus-visible) {
  outline: none;
}

/* ---------- Responsive ---------- */
@media (max-width: 960px) {
  .hero {
    gap: 32px;
    grid-template-columns: 1fr 0.95fr;
  }
  .auth-card { padding: 24px; }
  .content-grid { grid-template-columns: 1fr; }
}

@media (max-width: 720px) {
  .wrap { width: min(100% - 28px, 560px); }
  .topbar { height: 68px; }
  .top-links { gap: 12px; font-size: 12px; }
  .brand { font-size: 14px; }
  .brand-mark { width: 34px; height: 34px; font-size: 13px; }
  .hero {
    grid-template-columns: 1fr;
    padding: 32px 0 48px;
    gap: 28px;
    min-height: 0;
  }
  .hero-copy { order: 0; }
  .auth-card { order: 1; }
  h1 {
    font-size: clamp(34px, 9vw, 44px);
    letter-spacing: -1.8px;
  }
  .hero-lead { font-size: 14.5px; max-width: none; }
  .feature-list { gap: 10px; }
  .feature { padding: 11px 12px; }
  .auth-card { padding: 22px; }
  .footer {
    padding: 16px 0 24px;
    gap: 10px;
  }
  .dashboard { padding: 28px 0 48px; }
  .page-title-row {
    align-items: flex-start;
    flex-direction: column;
    gap: 16px;
  }
  .page-title-row h1 {
    font-size: clamp(32px, 8vw, 40px);
  }
  .user-chip {
    max-width: none;
    width: 100%;
  }
  .stat-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  .stat-card,
  .panel-card { padding: 18px; }
  .stat-value { margin: 8px 0 4px; font-size: 26px; }
  .stat-date { font-size: 20px; }
  .section-head h2 { font-size: 17px; }
  .admin-shortcut { padding: 8px 11px; font-size: 12px; }
  table { min-width: 420px; }
}

@media (max-width: 420px) {
  .wrap { width: calc(100% - 22px); }
  .top-links .admin-shortcut span:not(.dot) {
    /* keep short label readable */
  }
  h1 { letter-spacing: -1.4px; }
  .btn { font-size: 12.5px; }
  .card-heading h2 { font-size: 18px; }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .ambient-one,
  .ambient-two { animation: none; }
}
