/* Reset, layout shell, typography. Shared by admin-ui and public-ui. */

*, *::before, *::after { box-sizing: border-box; }

html, body { height: 100%; overflow: hidden; }

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  color: var(--text-1);
  background: var(--bg);
  background-image: var(--bg-glow);
  background-attachment: fixed;
  transition: var(--transition-theme);
  -webkit-font-smoothing: antialiased;
}

::selection { background: var(--accent-soft); color: var(--text-1); }

* { scrollbar-width: thin; scrollbar-color: var(--scroll-thumb) transparent; }

h1, h2, h3, h4 { font-family: var(--font-display); margin: 0; font-weight: 600; letter-spacing: -0.01em; }
p { margin: 0; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code, .mono { font-family: var(--font-mono); font-size: 0.92em; }
button { font: inherit; }
input, select, textarea { font: inherit; color: inherit; }
svg.icon { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* The mono uppercase eyebrow — the UI's signature label. */
.eyebrow {
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-3);
}

/* ---------- App shell ---------- */

.app-root { height: 100%; overflow: hidden; }

.shell { display: grid; grid-template-columns: 232px 1fr; height: 100%; overflow: hidden; }

.sidebar {
  background: var(--ink-1);
  color: var(--ink-text);
  display: flex;
  flex-direction: column;
  padding: 18px 12px;
  gap: 4px;
  overflow: hidden;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px 18px;
  color: #fff;
}

.sidebar-brand .brand-mark {
  width: 32px; height: 32px; border-radius: 8px; flex: none;
  background: linear-gradient(135deg, var(--accent) 0%, #0a5650 100%);
  display: grid; place-items: center;
  font-family: var(--font-display); font-weight: 700; font-size: 16px; color: #fff;
}

.sidebar-brand .brand-name { font-family: var(--font-display); font-weight: 600; font-size: 14px; line-height: 1.25; }
.sidebar-brand .brand-sub { font-family: var(--font-mono); font-size: 9.5px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-text-dim); }

.nav-item {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 11px;
  border: 0; border-radius: var(--radius-ctl);
  background: transparent; color: var(--ink-text);
  cursor: pointer; width: 100%; text-align: left;
  font-weight: 500; font-size: 13.5px;
  transition: background-color 0.15s var(--ease-swift), color 0.15s var(--ease-swift);
  position: relative;
}

.nav-item:hover { background: rgba(255, 255, 255, 0.06); color: #fff; }

.nav-item.active { background: rgba(255, 255, 255, 0.09); color: #fff; }

.nav-item.active::before {
  content: ""; position: absolute; left: -12px; top: 7px; bottom: 7px; width: 3px;
  border-radius: 0 3px 3px 0; background: var(--accent);
}

.sidebar-footer { margin-top: auto; border-top: 1px solid var(--ink-line); padding-top: 10px; display: flex; flex-direction: column; gap: 4px; }

.main { display: flex; flex-direction: column; min-width: 0; overflow: hidden; }

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 28px;
  border-bottom: 1px solid var(--line-1);
  background: color-mix(in srgb, var(--surface) 65%, transparent);
  backdrop-filter: blur(8px);
}

.topbar .crumbs { display: flex; align-items: baseline; gap: 10px; }
.topbar h1 { font-size: 17px; }

.content { flex: 1; overflow-y: auto; padding: 26px 28px 48px; }
.content-inner { max-width: 1060px; margin: 0 auto; }

/* Staggered view entrance. */
@keyframes rise-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}
.view-enter > * { animation: rise-in 0.4s var(--ease-swift) backwards; }
.view-enter > *:nth-child(1) { animation-delay: 0.02s; }
.view-enter > *:nth-child(2) { animation-delay: 0.07s; }
.view-enter > *:nth-child(3) { animation-delay: 0.12s; }
.view-enter > *:nth-child(4) { animation-delay: 0.17s; }
.view-enter > *:nth-child(5) { animation-delay: 0.22s; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* ---------- Auth screens (setup / login / key entry) ---------- */

.auth-stage {
  min-height: 100%;
  display: grid; place-items: center;
  padding: 40px 20px;
}

.auth-card {
  width: 100%; max-width: 410px;
  background: var(--surface);
  border: 1px solid var(--line-1);
  border-radius: 16px;
  box-shadow: var(--shadow-pop);
  padding: 34px 34px 30px;
  animation: rise-in 0.45s var(--ease-swift) backwards;
}

.auth-card.wide { max-width: 470px; }

.auth-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 26px; }
.auth-brand .brand-mark {
  width: 40px; height: 40px; border-radius: 10px;
  background: linear-gradient(135deg, var(--accent) 0%, #0a5650 100%);
  display: grid; place-items: center;
  font-family: var(--font-display); font-weight: 700; font-size: 20px; color: #fff;
}

.auth-title { font-size: 19px; margin-bottom: 4px; }
.auth-sub { color: var(--text-2); font-size: 13px; margin-bottom: 22px; }

/* Each authentication step keeps its explanatory text, form, and alternate
   methods comfortably separated without needing page-specific inline styles. */
.auth-flow { display: grid; gap: 18px; }
.auth-flow .auth-sub { margin-bottom: 0; }
.auth-flow .form-error { margin-bottom: 0; }
.auth-actions { display: grid; gap: 10px; }
.auth-method-separator { height: 1px; background: var(--line-1); margin: 4px 0; }

.wizard-steps { display: flex; gap: 6px; margin-bottom: 24px; }
.wizard-steps .step {
  height: 4px; flex: 1; border-radius: 2px;
  background: var(--line-1);
  transition: background-color 0.3s var(--ease-swift);
}
.wizard-steps .step.done { background: var(--accent); }
