:root {
  /* Pastel is the built-in default palette everywhere (marketing, auth,
     admin, status pages). Other themes override via themes.Get(name).CSS()
     injected into <style> tags. Dark now lives in themes.go with explicit
     overrides - it is no longer the empty-vars baseline. */
  --accent: #22c55e;
  --bg: #ece4f2;
  --card-bg: #f5eff9;
  --text: #3a2d47;
  --text-muted: #7d7290;
  --border: #d6c9e3;
  --error: #c86683;
  --warn: #c6974a;
  --link: #8e5bbf;
  --btn-bg: #e0d3ed;
  --radius: 1rem;
  --radius-xl: 1.5rem;
  --font: 'Pretendard', system-ui, -apple-system, 'Apple SD Gothic Neo', 'Malgun Gothic', sans-serif;
  --font-display: 'Fraunces', 'Pretendard', Georgia, serif;
  --shadow-sm: 0 1px 2px rgba(76, 40, 100, 0.10);
  --shadow-md: 0 4px 12px rgba(76, 40, 100, 0.15);
  --shadow-lg: 0 12px 32px rgba(76, 40, 100, 0.22);
}

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

/* Reserve the scrollbar's gutter on every page so short pages don't
   shift left when taller pages would have added one. Modern browsers
   honor scrollbar-gutter; older ones fall back to the always-on
   scrollbar, which is ugly but never jitters. */
html {
  scrollbar-gutter: stable;
  overflow-y: scroll; /* fallback for pre-2022 browsers */
}

/* If both are honored, scrollbar-gutter wins and the track only
   appears when needed - so drop the forced scrollbar where possible. */
@supports (scrollbar-gutter: stable) {
  html { overflow-y: auto; }
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 1.125rem;
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: var(--link);
  text-decoration: none;
}

a:visited {
  color: var(--link);
}

a:hover {
  text-decoration: underline;
}

/* Display headings use Fraunces */
h1, h2, h3 {
  font-family: var(--font-display);
}

.wizard-shell {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 2rem 1rem;
}

.wizard-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 3rem;
  max-width: 560px;
  width: 100%;
  box-shadow: var(--shadow-lg);
}

.wizard-card > .emoji-anim {
  margin-bottom: 0.75rem;
}

/* Floating language picker for the install wizard - wraps the admin
   LangMenu component. Positioned absolutely so it doesn't fight the
   centered wizard-card layout. */
.wizard-lang-picker {
  position: absolute;
  top: 1rem;
  right: 1rem;
}

/* Input paired with inline action buttons (e.g. copy, regenerate).
   Input takes the free space; buttons keep their natural width on
   the right. */
.input-with-actions {
  display: flex;
  gap: 0.5rem;
  align-items: stretch;
}
.input-with-actions > input {
  flex: 1;
  min-width: 0;
}

h1 {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  letter-spacing: -0.01em;
}

.step-desc {
  color: var(--text-muted);
  margin-bottom: 1rem;
  font-size: 1rem;
}

.proof-box {
  margin-bottom: 1.25rem;
}

.proof-box label {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 0.375rem;
}

.proof-value {
  display: block;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  padding: 0.875rem 1rem;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 0.875rem;
  word-break: break-all;
  user-select: all;
}

.field {
  margin-bottom: 1rem;
}

.field label,
.field-inline label {
  display: block;
  font-size: 0.9375rem;
  font-weight: 500;
  margin-bottom: 0.5rem;
}

.checkbox-label {
  display: inline-flex !important;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
  width: auto;
  margin: 0;
}

.field input,
.field-inline input,
.field select {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  background: var(--input-bg, var(--bg));
  color: var(--text);
  font-size: 1rem;
  font-family: inherit;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.field select {
  appearance: none;
  padding-right: 2.5rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%239ca3af' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 1rem center;
  background-size: 1rem;
  cursor: pointer;
}

.view-link {
  color: var(--link);
  text-decoration: none;
  font-weight: 600;
  margin-left: 0.5rem;
}

.view-link:hover {
  text-decoration: underline;
}

.field input:focus,
.field-inline input:focus,
.field select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 20%, transparent);
}

.field input[type="color"] {
  height: 3rem;
  padding: 0.25rem;
  cursor: pointer;
}

.setup-steps {
  list-style: none;
  margin-bottom: 2rem;
}

.setup-steps li {
  padding: 0.5rem 0;
  padding-left: 1.75rem;
  position: relative;
  color: var(--text-muted);
  font-size: 1rem;
}

.setup-steps li::before {
  content: "\2192";
  position: absolute;
  left: 0;
  color: var(--accent);
  font-weight: 600;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.75rem;
  border: none;
  border-radius: 0.75rem;
  font-size: 1rem;
  line-height: 1.25;
  font-weight: 600;
  font-family: inherit;
  box-sizing: border-box;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s, box-shadow 0.15s;
  margin-top: 0.5rem;
  color: var(--text);
  background: var(--btn-bg);
  text-decoration: none;
}

a.btn, a.btn:visited, a.btn:hover {
  color: var(--text);
  text-decoration: none;
}

a.btn-primary, a.btn-primary:visited, a.btn-primary:hover {
  color: #fff;
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
  filter: brightness(1.08);
  box-shadow: var(--shadow-md);
}

.error {
  color: var(--error);
  font-size: 0.9375rem;
  margin-bottom: 1.25rem;
  padding: 0.75rem 1rem;
  background: color-mix(in srgb, var(--error) 10%, transparent);
  border-radius: 0.75rem;
}

/* Small prompt that sits below tier-limit messages, linking to /pricing. */
.upgrade-hint {
  margin: -0.75rem 0 1.5rem;
  font-size: 0.875rem;
  color: var(--text-muted);
  display: flex;
  gap: 0.375rem;
  flex-wrap: wrap;
}

/* Version update toast - shown when /api/version detects a deploy */
.update-toast {
  position: fixed;
  top: 1rem;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  background: var(--card-bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
  z-index: 9999;
  font-size: 0.875rem;
  max-width: calc(100vw - 2rem);
}
@media (max-width: 480px) {
  .update-toast {
    width: calc(100vw - 1rem);
    top: 0.5rem;
    gap: 0.5rem;
    padding: 0.625rem 0.75rem;
    font-size: 0.8125rem;
  }
  .update-toast > span {
    flex: 1;
    min-width: 0;
  }
}
.update-toast button {
  background: var(--accent);
  color: white;
  border: none;
  padding: 0.375rem 0.75rem;
  border-radius: 0.25rem;
  cursor: pointer;
}


/* ─── Language dropdown ────────────────────────────────────────────────
   Custom popover used by admin nav, public status-page footer, marketing
   footer. Fully theme-matched (unlike native <select> whose options list
   is OS-rendered). Two-tap interaction (open then pick) so a stray touch
   only opens - nothing changes until the second tap commits. */
.lang-menu {
  position: relative;
  display: inline-flex;
  justify-content: center;
  margin-top: 0.75rem;
}

.lang-menu-trigger {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.375rem 0.875rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: color-mix(in srgb, var(--card-bg) 85%, transparent);
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.8125rem;
  font-weight: 500;
  line-height: 1.25;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s, background 0.15s, transform 0.1s;
}

.lang-menu-trigger:hover,
.lang-menu[data-open="true"] .lang-menu-trigger {
  color: var(--text);
  border-color: color-mix(in srgb, var(--accent) 50%, var(--border));
  background: var(--card-bg);
}

.lang-menu-trigger:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.lang-menu-trigger:active {
  transform: scale(0.97);
}

.lang-menu-flag {
  display: inline-flex;
  font-size: 1rem;
  line-height: 1;
  /* Regional-indicator glyphs render wider on some platforms; give them
     a consistent slot so trigger + options stay vertically aligned. */
  min-width: 1.25em;
  justify-content: center;
}

.lang-menu-chevron {
  font-size: 0.65rem;
  opacity: 0.6;
  transition: transform 0.15s;
}

.lang-menu[data-open="true"] .lang-menu-chevron {
  transform: rotate(180deg);
}

.lang-menu-options {
  position: absolute;
  left: 0;
  right: auto;
  min-width: 160px;
  margin: 0;
  padding: 0.375rem;
  list-style: none;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.25);
  z-index: 1000;
}

.lang-menu[data-direction="up"] .lang-menu-options {
  bottom: calc(100% + 0.5rem);
}

.lang-menu[data-direction="down"] .lang-menu-options,
.lang-menu:not([data-direction]) .lang-menu-options {
  top: calc(100% + 0.5rem);
}

.lang-menu-options li {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.625rem;
  border-radius: 0.5rem;
  color: var(--text-muted);
  font-size: 0.875rem;
  line-height: 1.25;
  cursor: pointer;
  list-style: none;
  transition: background 0.12s, color 0.12s;
}

.lang-menu-options li:hover,
.lang-menu-options li:focus-visible {
  background: color-mix(in srgb, var(--accent) 18%, transparent);
  color: var(--text);
  outline: none;
}

.lang-menu-options li[aria-selected="true"] {
  color: var(--text);
  font-weight: 600;
}

.lang-menu-check {
  display: inline-flex;
  width: 1rem;
  justify-content: center;
  color: var(--accent);
  font-size: 0.875rem;
  visibility: hidden;
}

.lang-menu-options li[aria-selected="true"] .lang-menu-check {
  visibility: visible;
}

/* Pills */
.pill {
  display: inline-block;
  padding: 0.1875rem 0.625rem;
  border-radius: 9999px;
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.pill-up {
  background: color-mix(in srgb, var(--accent) 15%, transparent);
  color: var(--accent);
}

.pill-down {
  background: color-mix(in srgb, var(--error) 15%, transparent);
  color: var(--error);
}

.pill-warn {
  background: color-mix(in srgb, var(--warn) 15%, transparent);
  color: var(--warn);
}

.pill-muted {
  background: var(--bg);
  color: var(--text-muted);
}

/* Empty state */
.empty-state {
  color: var(--text-muted);
  text-align: center;
  padding: 4rem 1rem;
  font-size: 1rem;
}
