/* ===== THEME TOKENS (light + dark + system) ===== */
:root {
  --navy-50: oklch(97.2% 0.008 250);
  --navy-100: oklch(93.3% 0.014 250);
  --navy-200: oklch(87.5% 0.024 250);
  --navy-400: oklch(60% 0.075 250);
  --navy-600: oklch(44% 0.075 252);
  --navy-900: oklch(19% 0.032 264);
  --ember: oklch(63% 0.219 25);
  --ember-soft: oklch(95% 0.03 25);
  --orange: oklch(68% 0.19 32);

  --background: oklch(100% 0 0);
  --foreground: var(--navy-900);
  --card: oklch(100% 0 0);
  --muted: var(--navy-50);
  --muted-foreground: var(--navy-600);
  --accent: var(--ember-soft);
  --accent-foreground: var(--ember);
  --primary: var(--ember);
  --primary-foreground: oklch(100% 0 0);
  --border: var(--navy-100);
  --side: var(--navy-900);
  --side-fg: #fff;

  --shadow-lift: 0 24px 60px -28px
    color-mix(in oklab, var(--navy-900) 45%, transparent);
  --shadow-glow: 0 20px 60px -20px
    color-mix(in oklab, var(--ember) 45%, transparent);

  --font-sans: "Space Grotesk", ui-sans-serif, system-ui, sans-serif;
  --font-display: "Fraunces", ui-serif, Georgia, serif;
  box-sizing: border-box;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

/* explicit light (same as default) */
:root[data-theme="light"] {
  --navy-50: oklch(97.2% 0.008 250);
  --navy-100: oklch(93.3% 0.014 250);
  --navy-200: oklch(87.5% 0.024 250);
  --navy-400: oklch(60% 0.075 250);
  --navy-600: oklch(44% 0.075 252);
  --navy-900: oklch(19% 0.032 264);
  --ember: oklch(63% 0.219 25);
  --ember-soft: oklch(95% 0.03 25);
  --background: oklch(100% 0 0);
  --foreground: var(--navy-900);
  --card: oklch(100% 0 0);
  --muted: var(--navy-50);
  --muted-foreground: var(--navy-600);
  --accent: var(--ember-soft);
  --primary: var(--ember);
  --primary-foreground: oklch(100% 0 0);
  --border: var(--navy-100);
  --side: var(--navy-900);
  --side-fg: #fff;
}

/* explicit dark */
:root[data-theme="dark"] {
  --navy-50: oklch(24% 0.022 264);
  --navy-100: oklch(28% 0.022 264);
  --navy-200: oklch(72% 0.018 250);
  --navy-400: oklch(60% 0.075 250);
  --navy-600: oklch(72% 0.018 250);
  --navy-900: oklch(96% 0.008 250);
  --ember: oklch(66% 0.21 27);
  --ember-soft: oklch(30% 0.06 25);
  --orange: oklch(68% 0.19 32);

  --background: oklch(15% 0.022 264);
  --foreground: oklch(96% 0.008 250);
  --card: oklch(19.5% 0.024 264);
  --muted: oklch(24% 0.022 264);
  --muted-foreground: oklch(72% 0.018 250);
  --accent: oklch(30% 0.06 25);
  --accent-foreground: oklch(80% 0.16 30);
  --primary: oklch(66% 0.21 27);
  --primary-foreground: oklch(100% 0 0);
  --border: oklch(28% 0.022 264);
  --side: oklch(12% 0.022 264);
  --side-fg: #fff;
  --shadow-lift: 0 24px 60px -28px rgba(0, 0, 0, 0.75);
  --shadow-glow: 0 20px 60px -20px
    color-mix(in oklab, var(--ember) 55%, transparent);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]):not([data-theme="dark"]) {
    --navy-50: oklch(24% 0.022 264);
    --navy-100: oklch(28% 0.022 264);
    --navy-200: oklch(72% 0.018 250);
    --navy-400: oklch(60% 0.075 250);
    --navy-600: oklch(72% 0.018 250);
    --navy-900: oklch(96% 0.008 250);
    --ember: oklch(66% 0.21 27);
    --ember-soft: oklch(30% 0.06 25);
    --background: oklch(15% 0.022 264);
    --foreground: oklch(96% 0.008 250);
    --card: oklch(19.5% 0.024 264);
    --muted: oklch(24% 0.022 264);
    --muted-foreground: oklch(72% 0.018 250);
    --accent: oklch(30% 0.06 25);
    --accent-foreground: oklch(80% 0.16 30);
    --primary: oklch(66% 0.21 27);
    --primary-foreground: oklch(100% 0 0);
    --border: oklch(28% 0.022 264);
    --side: oklch(12% 0.022 264);
    --side-fg: #fff;
  }
}

/* ===== GLOBAL RESET + BASE ===== */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}
html {
  scroll-padding-top: env(safe-area-inset-top, 0px);
  -webkit-text-size-adjust: 100%;
}
body {
  min-height: 100vh;
  font-family: var(--font-sans);
  color: var(--foreground);
  background: var(--background);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  transition:
    background 0.3s,
    color 0.3s;
}
button {
  font: inherit;
  color: inherit;
}
[hidden] {
  display: none !important;
}

/* ===== THEME TOGGLE ===== */
.theme-btn {
  border: 1px solid var(--border);
  background: transparent;
  border-radius: 9999px;
  padding: 0.45rem 0.9rem;
  font-size: 0.75rem;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  cursor: pointer;
  transition:
    background 0.3s,
    transform 0.2s;
  line-height: 1;
  color: var(--foreground);
  white-space: nowrap;
}
.theme-btn:hover {
  background: var(--muted);
  transform: translateY(-1px);
}
.theme-btn svg {
  width: 1rem;
  height: 1rem;
  flex-shrink: 0;
  stroke: currentColor;
  fill: none;
}
.theme-btn .icon-sun {
  display: none;
}
.theme-btn .icon-moon {
  display: block;
}
:root[data-theme="dark"] .theme-btn .icon-sun {
  display: block;
}
:root[data-theme="dark"] .theme-btn .icon-moon {
  display: none;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]):not([data-theme="dark"])
    .theme-btn
    .icon-sun {
    display: block;
  }
  :root:not([data-theme="light"]):not([data-theme="dark"])
    .theme-btn
    .icon-moon {
    display: none;
  }
}

/* ===== BACKDROP / AURORA / CONSTELLATION ===== */
.backdrop {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  overflow: hidden;
}
.aurora {
  position: absolute;
  border-radius: 9999px;
  filter: blur(110px);
}
.a1 {
  left: -12%;
  top: -10%;
  height: 55vh;
  width: 55vh;
  opacity: 0.55;
  background: radial-gradient(
    circle,
    color-mix(in oklab, var(--ember) 38%, transparent),
    transparent 70%
  );
  animation: aurora-1 22s ease-in-out infinite;
}
.a2 {
  right: -12%;
  top: 25%;
  height: 50vh;
  width: 50vh;
  opacity: 0.45;
  background: radial-gradient(
    circle,
    color-mix(in oklab, var(--navy-400) 45%, transparent),
    transparent 70%
  );
  animation: aurora-2 26s ease-in-out infinite;
}
@keyframes aurora-1 {
  0%,
  100% {
    transform: translate(0, 0) scale(1);
  }
  50% {
    transform: translate(40px, 30px) scale(1.12);
  }
}
@keyframes aurora-2 {
  0%,
  100% {
    transform: translate(0, 0) scale(1.05);
  }
  50% {
    transform: translate(-50px, 40px) scale(0.95);
  }
}

/* ===== LOGIN ===== */
#login {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
}
.login-card {
  width: 100%;
  max-width: 26rem;
  text-align: center;
  border: 1px solid var(--border);
  border-radius: 2rem;
  background: color-mix(in oklab, var(--card) 80%, transparent);
  backdrop-filter: blur(12px);
  padding: 2.5rem 2rem;
  box-shadow: var(--shadow-lift);
}
.login-card .logo {
  justify-content: center;
  margin-bottom: 2rem;
}
.login-card h1 {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 500;
  letter-spacing: -0.025em;
  line-height: 1.15;
}
.login-card h1 i {
  color: var(--primary);
}
.login-card p {
  margin-top: 0.75rem;
  color: var(--muted-foreground);
  font-size: 0.9rem;
}
.g-btn {
  width: 100%;
  margin-top: 2rem;
  padding: 0.9rem 1.25rem;
  font-size: 0.9rem;
  background: var(--card);
  border: 1px solid var(--border);
  box-shadow: 0 1px 2px color-mix(in oklab, var(--navy-900) 8%, transparent);
}
.note {
  margin-top: 1.25rem;
  font-size: 0.75rem;
  color: var(--muted-foreground);
}

/* ===== APP SHELL ===== */
#app {
  display: flex;
  min-height: 100vh;
}
aside {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 40;
  width: 16.5rem;
  display: flex;
  flex-direction: column;
  padding: 1.5rem 1rem;
  background: var(--side);
  color: var(--side-fg);
  transform: translateX(-100%);
  transition: transform 0.35s;
  padding-top: calc(1.5rem + env(safe-area-inset-top, 0px));
}
aside.open {
  transform: none;
}
aside .logo {
  padding: 0 0.5rem 1.75rem;
  color: #fff;
}
nav {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.nav-label {
  padding: 0.5rem 0.75rem;
  font-size: 0.68rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--navy-200);
  opacity: 0.7;
}
.nav-btn {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  border: 0;
  background: none;
  border-radius: 0.9rem;
  padding: 0.7rem 0.85rem;
  font-size: 0.9rem;
  text-align: left;
  color: var(--navy-200);
  cursor: pointer;
  transition:
    background 0.3s,
    color 0.3s;
}
.nav-btn:hover {
  background: color-mix(in oklab, #fff 8%, transparent);
  color: #fff;
}
.nav-btn.active {
  background: var(--primary);
  color: #fff;
  box-shadow: var(--shadow-glow);
}
.nav-btn svg {
  height: 1.1rem;
  width: 1.1rem;
  flex-shrink: 0;
}
.side-user {
  margin-top: auto;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  border: 1px solid color-mix(in oklab, #fff 10%, transparent);
  border-radius: 1.2rem;
  background: color-mix(in oklab, #fff 6%, transparent);
  padding: 0.75rem;
}
.side-user .meta {
  min-width: 0;
  flex: 1;
}
.side-user .n {
  font-size: 0.85rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.side-user .e {
  font-size: 0.7rem;
  color: var(--navy-200);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.icon-btn {
  border: 0;
  background: none;
  cursor: pointer;
  color: var(--navy-200);
  padding: 0.4rem;
  border-radius: 0.6rem;
  display: inline-flex;
}
.icon-btn:hover {
  color: #fff;
  background: color-mix(in oklab, #fff 10%, transparent);
}
.scrim {
  position: fixed;
  inset: 0;
  z-index: 30;
  background: color-mix(in oklab, var(--navy-900) 50%, transparent);
  display: none;
}
.scrim.on {
  display: block;
}
.content {
  flex: 1;
  min-width: 0;
}
.topbar {
  position: sticky;
  top: env(safe-area-inset-top, 0px);
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.9rem 1.25rem;
  border-bottom: 1px solid var(--border);
  background: color-mix(in oklab, var(--background) 80%, transparent);
  backdrop-filter: blur(20px);
  transition:
    background 0.3s,
    border-color 0.3s;
}
.top-l {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.menu-btn {
  border: 1px solid var(--border);
  background: none;
  border-radius: 0.8rem;
  padding: 0.45rem;
  cursor: pointer;
  display: inline-flex;
}
.top-title {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 600;
}
.top-r {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}
.pill {
  border: 1px solid var(--border);
  border-radius: 9999px;
  padding: 0.3rem 0.8rem;
  font-size: 0.72rem;
  color: var(--muted-foreground);
  white-space: nowrap;
}
.avatar {
  position: relative;              /* so children can absolutely position */
  overflow: hidden;
  height: 2.5rem;
  width: 2.5rem;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 0.8rem;
  background: var(--navy-900);
  color: #fff;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.95rem;
  overflow: hidden;
}
.avatar .avatar-fallback,
.avatar .avatar-img {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.avatar .avatar-fallback {
  font: inherit;
  color: inherit;
}

.avatar .avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: inherit;
  display: block;
}

/* If you used the simpler version without a wrapper span: */
.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: inherit;
  display: block;
}


.avatar.ember {
  background: var(--primary);
}
main {
  padding: 2rem 1.25rem 4rem;
  max-width: 72rem;
  margin-inline: auto;
}

/* ===== CARDS / STATS / BARS ===== */
.label {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ember);
  margin-bottom: 0.6rem;
}
h1.page {
  font-family: var(--font-display);
  font-size: clamp(2rem, 1.5rem + 2vw, 2.75rem);
  font-weight: 500;
  line-height: 1.15;
  letter-spacing: -0.025em;
}
h1.page i {
  color: var(--primary);
}
.lede {
  margin-top: 0.6rem;
  color: var(--muted-foreground);
  max-width: 36rem;
}
.stats {
  display: grid;
  gap: 1rem;
  margin-block: 2rem;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}
.card {
  border: 1px solid var(--border);
  border-radius: 1.5rem;
  background: color-mix(in oklab, var(--card) 70%, transparent);
  padding: 1.5rem;
  backdrop-filter: blur(8px);
  transition:
    transform 0.5s,
    box-shadow 0.5s,
    border-color 0.5s,
    background 0.3s;
}
.card:hover {
  transform: translateY(-4px);
  border-color: color-mix(in oklab, var(--primary) 40%, transparent);
  box-shadow: var(--shadow-lift);
}
.stat-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.badge {
  height: 2.5rem;
  width: 2.5rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 0.9rem;
  background: var(--accent);
  color: var(--ember);
}
.badge svg {
  height: 1.15rem;
  width: 1.15rem;
}
.stat-v {
  margin-top: 1rem;
  font-family: var(--font-display);
  font-size: 2.4rem;
  font-weight: 600;
  line-height: 1;
}
.stat-l {
  margin-top: 0.4rem;
  font-size: 0.85rem;
  color: var(--muted-foreground);
}
.grid2 {
  display: grid;
  gap: 1rem;
  grid-template-columns: 1fr;
}
@media (min-width: 900px) {
  .grid2 {
    grid-template-columns: 3fr 2fr;
  }
}
.card h3 {
  font-size: 1.05rem;
  font-weight: 600;
}
.card .sub {
  font-size: 0.8rem;
  color: var(--muted-foreground);
  margin-top: 0.15rem;
}
.bars {
  display: flex;
  align-items: flex-end;
  gap: 0.6rem;
  height: 11rem;
  margin-top: 1.5rem;
}
.bar {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 0.4rem;
  height: 100%;
  font-size: 0.7rem;
  color: var(--muted-foreground);
}
.bar span.b {
  width: 100%;
  border-radius: 0.6rem 0.6rem 0.2rem 0.2rem;
  background: linear-gradient(
    to top,
    var(--ember),
    color-mix(in oklab, var(--ember) 45%, var(--navy-400))
  );
}
.recent {
  margin-top: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}
.who {
  display: flex;
  align-items: center;
  gap: 0.8rem;
}
.name {
  font-weight: 600;
  font-size: 0.9rem;
}
.mail {
  font-size: 0.78rem;
  color: var(--muted-foreground);
}

/* ===== TABLE / TOOLS / TABS ===== */
.tools {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin: 1.75rem 0 1rem;
}
input[type="search"] {
  flex: 1;
  min-width: 200px;
  border: 1px solid var(--border);
  border-radius: 9999px;
  background: var(--card);
  color: var(--foreground);
  padding: 0.7rem 1.25rem;
  font: inherit;
  font-size: 0.875rem;
}
.tabs {
  display: flex;
  gap: 0.4rem;
}
.tab {
  border: 1px solid var(--border);
  background: none;
  border-radius: 9999px;
  padding: 0.55rem 1rem;
  font-size: 0.8rem;
  cursor: pointer;
}
.tab.active {
  background: var(--foreground);
  color: var(--background);
  border-color: transparent;
}
.wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 1.5rem;
  background: color-mix(in oklab, var(--card) 70%, transparent);
  backdrop-filter: blur(8px);
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
  min-width: 640px;
}
th {
  text-align: left;
  padding: 1rem 1.25rem;
  font-size: 0.7rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted-foreground);
  border-bottom: 1px solid var(--border);
}
td {
  padding: 0.9rem 1.25rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
tr:last-child td {
  border-bottom: 0;
}
.status {
  border-radius: 9999px;
  padding: 0.2rem 0.7rem;
  font-size: 0.72rem;
  font-weight: 600;
  background: var(--muted);
  color: var(--muted-foreground);
}
.status.on {
  background: var(--accent);
  color: var(--ember);
}
.actions {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
  flex-wrap: wrap;
}
.empty {
  padding: 2rem;
  text-align: center;
  color: var(--muted-foreground);
}
.meter {
  height: 0.4rem;
  width: 7rem;
  border-radius: 9999px;
  background: var(--muted);
  overflow: hidden;
  border: 1px solid var(--border);
}
.meter span {
  display: block;
  height: 100%;
  background: var(--navy-400);
}
.meter.full span {
  background: var(--ember);
}
.status.unl {
  background: color-mix(in oklab, var(--navy-400) 22%, transparent);
  color: var(--foreground);
}

/* ===== CHAT / CONVO ===== */
.chead {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-block: 1rem;
}
.avatar.big {
  height: 3.5rem;
  width: 3.5rem;
  font-size: 1.1rem;
  border-radius: 1rem;
}
h1.page.sm {
  font-size: 1.6rem;
}
.convo {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  margin-top: 1.25rem;
  max-height: 60vh;
  overflow-y: auto;
  padding-right: 0.25rem;
}
.convo .msg.bot {
  background: var(--muted);
  color: var(--foreground);
}
.msg {
  max-width: 82%;
  padding: 0.75rem 1rem;
  border-radius: 1.1rem;
  font-size: 0.875rem;
  line-height: 1.6;
}
.msg.user {
  align-self: flex-end;
  background: var(--ember);
  color: #fff;
  border-bottom-right-radius: 0.3rem;
}
.msg.bot {
  align-self: flex-start;
  background: color-mix(in oklab, #fff 10%, transparent);
  color: var(--navy-100);
  border-bottom-left-radius: 0.3rem;
}
.msg time {
  display: block;
  margin-top: 0.3rem;
  font-size: 0.68rem;
  opacity: 0.7;
}
.banner {
  margin-top: 1rem;
  border-radius: 1rem;
  background: var(--accent);
  color: var(--ember);
  padding: 0.7rem 1rem;
  font-size: 0.85rem;
}
.kv {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.7rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.875rem;
}
.kv span:first-child {
  color: var(--muted-foreground);
}
.full {
  width: 100%;
  margin-top: 1rem;
}
.card .gap {
  margin-top: 1.75rem;
}

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  border-radius: 9999px;
  border: 1px solid var(--border);
  background: transparent;
  padding: 0.5rem 1.1rem;
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition:
    transform 0.3s,
    background 0.3s;
}
.btn:hover {
  background: var(--muted);
  transform: translateY(-1px);
}
.btn-danger {
  background: var(--primary);
  color: #fff;
  border-color: transparent;
  box-shadow: var(--shadow-glow);
}
.btn-danger:hover {
  background: var(--primary);
  opacity: 0.9;
}
button:focus-visible,
input:focus-visible {
  outline: 3px solid color-mix(in oklab, var(--primary) 45%, transparent);
  outline-offset: 2px;
}

/* ===== REVEAL / MOTION ===== */
.reveal {
  opacity: 0;
  transform: translateY(28px);
}
.reveal.is-visible {
  opacity: 1;
  transform: none;
  transition:
    opacity 0.7s ease,
    transform 0.7s ease;
}

/* ===== RESPONSIVE ===== */
@media (min-width: 1024px) {
  aside {
    transform: none;
  }
  .content {
    margin-left: 16.5rem;
  }
  .menu-btn {
    display: none;
  }
  .scrim {
    display: none !important;
  }
  .topbar {
    padding-inline: 2rem;
  }
  main {
    padding-inline: 2rem;
  }
}
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition-duration: 0.01ms !important;
  }
  .reveal {
    opacity: 1;
    transform: none;
  }
}

/* ── login extras ────────────────────────────── */
.tabs {
  display: flex;
  gap: 0.4rem;
  margin: 0 auto 1.25rem;
  justify-content: center;
}
.tab {
  border: 1px solid var(--border);
  background: transparent;
  border-radius: 9999px;
  padding: 0.5rem 1rem;
  font-size: 0.8rem;
  cursor: pointer;
  color: var(--muted-foreground);
  transition: background 0.3s, color 0.3s;
}
.tab.active {
  background: var(--foreground);
  color: var(--background);
  border-color: transparent;
}
.field {
  margin-top: 1rem;
  text-align: left;
}
.field label {
  display: block;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted-foreground);
  margin-bottom: 0.35rem;
}
.field input {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 9999px;
  background: var(--card);
  color: var(--foreground);
  padding: 0.75rem 1.1rem;
  font: inherit;
  font-size: 0.9rem;
}
.field input:focus-visible {
  outline: 3px solid color-mix(in oklab, var(--primary) 45%, transparent);
  outline-offset: 2px;
}
.error-box {
  margin-top: 1rem;
  padding: 0.7rem 1rem;
  border-radius: 1rem;
  background: var(--accent);
  color: var(--ember);
  font-size: 0.85rem;
  display: none;
  text-align: left;
}
.error-box.on {
  display: block;
}

/* ── admins page extras ──────────────────────── */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: color-mix(in oklab, var(--navy-900) 55%, transparent);
  backdrop-filter: blur(6px);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.modal-backdrop.on {
  display: flex;
}
.modal {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 1.5rem;
  padding: 1.75rem;
  width: 100%;
  max-width: 32rem;
  box-shadow: var(--shadow-lift);
}
.modal h3 {
  font-family: var(--font-display);
  font-size: 1.3rem;
  margin-bottom: 1rem;
}
.modal .row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.85rem;
  margin-top: 0.85rem;
}
.modal .row.full {
  grid-template-columns: 1fr;
}
.modal label.check {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: var(--muted-foreground);
  margin-top: 0.85rem;
}
.modal input[type="text"],
.modal input[type="email"],
.modal input[type="password"],
.modal select {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 0.9rem;
  background: var(--card);
  color: var(--foreground);
  padding: 0.7rem 1rem;
  font: inherit;
  font-size: 0.875rem;
}
.modal .actions {
  margin-top: 1.25rem;
  justify-content: flex-end;
}

/* ═══════════════════════════════════════════════
   LOGIN — unified card
   ═══════════════════════════════════════════════ */
.login-card { text-align: left; }
.login-card .logo { justify-content: center; }
.login-card h1 {
  text-align: center;
  margin-bottom: 0.35rem;
}
.login-card .subhead {
  text-align: center;
  color: var(--muted-foreground);
  font-size: 0.9rem;
  margin-bottom: 2rem;
}

.field {
  margin-top: 1rem;
  text-align: left;
}
.field label {
  display: block;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted-foreground);
  margin-bottom: 0.4rem;
}
.field input {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 0.9rem;
  background: var(--card);
  color: var(--foreground);
  padding: 0.8rem 1.1rem;
  font: inherit;
  font-size: 0.9rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.field input::placeholder { color: color-mix(in oklab, var(--muted-foreground) 70%, transparent); }
.field input:focus-visible {
  outline: none;
  border-color: color-mix(in oklab, var(--primary) 55%, transparent);
  box-shadow: 0 0 0 3px color-mix(in oklab, var(--primary) 25%, transparent);
}

/* password + eye */
.pw-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
.pw-wrap input {
  padding-right: 3rem;         /* space for the toggle button */
}
.pw-toggle {
  position: absolute;
  right: 0.4rem;
  top: 50%;
  transform: translateY(-50%);
  width: 2.25rem;
  height: 2.25rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  background: transparent;
  color: var(--muted-foreground);
  border-radius: 0.6rem;
  cursor: pointer;
  transition: color 0.2s, background 0.2s;
}
.pw-toggle:hover { color: var(--foreground); background: var(--muted); }
.pw-toggle:focus-visible {
  outline: 2px solid color-mix(in oklab, var(--primary) 45%, transparent);
  outline-offset: 2px;
}
.pw-toggle svg { width: 1.1rem; height: 1.1rem; }
.pw-toggle .eye-on { display: none; }
.pw-toggle[aria-pressed="true"] .eye-on  { display: block; }
.pw-toggle[aria-pressed="true"] .eye-off { display: none; }

/* row with remember + forgot */
.row-between {
  margin-top: 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.82rem;
}
.remember {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  color: var(--muted-foreground);
  cursor: pointer;
  user-select: none;
}
.remember input { accent-color: var(--primary); }
.link-muted {
  color: var(--muted-foreground);
  text-decoration: none;
  transition: color 0.2s;
}
.link-muted:hover { color: var(--primary); }

/* error */
.error-box {
  margin-top: 1rem;
  padding: 0.7rem 1rem;
  border-radius: 0.9rem;
  background: var(--accent);
  color: var(--ember);
  font-size: 0.85rem;
  display: none;
  text-align: left;
  border: 1px solid color-mix(in oklab, var(--ember) 25%, transparent);
}
.error-box.on { display: block; }

/* primary CTA with spinner */
.g-btn {
  width: 100%;
  margin-top: 1.5rem;
  padding: 0.95rem 1.25rem;
  font-size: 0.9rem;
  background: var(--primary);
  color: var(--primary-foreground);
  border: 1px solid transparent;
  box-shadow: var(--shadow-glow);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  border-radius: 9999px;
  font-weight: 500;
  cursor: pointer;
  transition: transform 0.2s, opacity 0.2s;
}
.g-btn:hover { 
  transform: translateY(-1px); opacity: 0.95;
  background-color: var(--navy-900);
}
.g-btn:disabled { opacity: 0.65; cursor: not-allowed; transform: none; }

.g-btn-google {
  background: var(--card);
  color: var(--foreground);
  border: 1px solid var(--border);
  box-shadow: 0 1px 2px color-mix(in oklab, var(--navy-900) 8%, transparent);
}
.g-btn-google:hover { background: var(--muted); }

/* spinner */
.spinner {
  width: 1rem;
  height: 1rem;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.35);
  border-top-color: #fff;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* divider */
.divider {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 1.5rem 0 0;
  color: var(--muted-foreground);
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.divider::before,
.divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* footer note */
.note {
  margin-top: 1.5rem;
  font-size: 0.75rem;
  color: var(--muted-foreground);
  text-align: center;
}

/* small responsive tweak */
@media (max-width: 420px) {
  .login-card { padding: 2rem 1.5rem; border-radius: 1.5rem; }
  .login-card h1 { font-size: 1.7rem; }
}

.msg .msg-body > *:first-child { margin-top: 0; }
.msg .msg-body > *:last-child  { margin-bottom: 0; }
.msg .msg-body p { margin: 0.4rem 0; }
.msg .msg-body code {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.82em;
  background: color-mix(in oklab, currentColor 12%, transparent);
  padding: 0.1em 0.35em;
  border-radius: 0.35em;
}
.msg .msg-body pre {
  background: color-mix(in oklab, currentColor 12%, transparent);
  padding: 0.75rem;
  border-radius: 0.6rem;
  overflow-x: auto;
  font-size: 0.82em;
  margin: 0.5rem 0;
}
.msg .msg-body pre code { background: none; padding: 0; }
.msg .msg-body ul,
.msg .msg-body ol {
  margin: 0.4rem 0 0.4rem 1.2rem;
}
.msg .msg-body blockquote {
  border-left: 3px solid color-mix(in oklab, currentColor 40%, transparent);
  padding-left: 0.75rem;
  opacity: 0.85;
  margin: 0.5rem 0;
}
.msg .msg-body a { color: var(--primary); text-decoration: underline; }
.msg .msg-body table {
  border-collapse: collapse;
  margin: 0.5rem 0;
  font-size: 0.85em;
}
.msg .msg-body th,
.msg .msg-body td {
  border: 1px solid color-mix(in oklab, currentColor 25%, transparent);
  padding: 0.25rem 0.5rem;
  text-align: left;
}
.log-pane {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.78rem;
  line-height: 1.5;
  background: #0b0f1c;
  color: #d7deea;
  padding: 1rem 1.25rem;
  height: 60vh;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-word;
  scroll-behavior: smooth;
}
:root[data-theme="light"] .log-pane {
  background: #0f172a;
  color: #dbe4ff;
}
.log-line { padding: 0.05rem 0; }
.log-line:hover { background: rgba(255,255,255,0.04); }