:root {
  --bg: #f7f5f0;
  --surface: #ffffff;
  --surface-raised: #fefdfb;
  --border: #e8e4dc;
  --border-strong: #d4cfc4;
  --text: #1a1814;
  --text-muted: #6b6560;
  --text-subtle: #9a948c;
  --accent: #c45c26;
  --accent-hover: #a84d1f;
  --accent-soft: #fdf0e8;
  --accent-green: #2d6a4f;
  --accent-green-soft: #e8f5ef;
  --shadow-sm: 0 1px 2px rgba(26, 24, 20, 0.06);
  --shadow-md: 0 4px 16px rgba(26, 24, 20, 0.08);
  --shadow-lg: 0 12px 40px rgba(26, 24, 20, 0.12);
  --radius: 12px;
  --radius-lg: 20px;
  --font: 'DM Sans', system-ui, sans-serif;
  --font-display: 'Instrument Serif', Georgia, serif;
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

img {
  max-width: 100%;
  height: auto;
}

/* Header */
.header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(8px);
}

.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0.875rem 1.1rem;
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  flex-shrink: 0;
}

.user-menu {
  display: flex;
  align-items: center;
  gap: 0.625rem;
}

.user-name {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-muted);
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.btn-sm {
  padding: 0.4375rem 0.875rem;
  font-size: 0.8125rem;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  text-decoration: none;
  color: var(--text);
  flex-shrink: 0;
}

.logo-mark {
  width: 36px;
  height: 36px;
  background: var(--accent);
  color: white;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1.425rem;
}

.logo-text {
  font-family: var(--font-display);
  font-size: 1.475rem;
  font-weight: 500;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.525rem 1.025rem;
  border: none;
  border-radius: 999px;
  font: inherit;
  font-size: 0.9375rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s, box-shadow 0.15s;
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  background: var(--accent);
  color: white;
}

.btn-primary:hover {
  background: var(--accent-hover);
  box-shadow: var(--shadow-md);
}

.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  background: var(--bg);
  border-color: var(--border-strong);
}

.btn-danger {
  background: #fef2f2;
  color: #b91c1c;
  border: 1px solid #fecaca;
}

.btn-danger:hover {
  background: #fee2e2;
}

.btn-lg {
  padding: 0.875rem 1.1rem;
  font-size: 1rem;
  width: 100%;
  justify-content: center;
}

/* Main */
.main {
  flex: 1;
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem 1.1rem 3rem;
  width: 100%;
}

.view {
  display: none;
  animation: fadeIn 0.25s ease;
}

.view.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Hero */
.hero {
  margin-bottom: 2rem;
}

.hero h1 {
  font-family: var(--font-display);
  font-size: clamp(2rem, 5vw, 3rem);
  font-weight: 400;
  line-height: 1.15;
  margin-bottom: 0.5rem;
}

.hero h1 em {
  font-style: italic;
  color: var(--accent);
}

.hero p {
  color: var(--text-muted);
  font-size: 1.0625rem;
  max-width: 520px;
}

.switch {
  color: var(--text-muted);
  font-weight: 200;
  font-size: 1.0625rem;
  font-style: italic;
  color: var(--accent);
  margin-bottom: 2rem;
}

/* Toolbar */
.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.1rem;
}

.select {
  padding: 0.5rem 2rem 0.5rem 0.875rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font: inherit;
  font-size: 0.875rem;
  background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b6560' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 0.625rem center;
  appearance: none;
  cursor: pointer;
}

.select:focus {
  outline: none;
  border-color: var(--accent);
}

.hidden {
  display: none !important;
}

/* Back Link */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  background: none;
  border: none;
  font: inherit;
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  margin-bottom: 1.1rem;
  padding: 0;
  transition: color 0.15s;
}

.back-link:hover {
  color: var(--accent);
}

.optional {
  font-weight: 400;
  color: var(--text-subtle);
}

@media (max-width: 540px) {
  .form-row {
    grid-template-columns: 1fr;
  }

  .header-inner {
    flex-wrap: wrap;
  }
}

/* Footer */
.footer {
  border-top: 1px solid var(--border);
  padding: 1.25rem 1.1rem;
  text-align: center;
  font-size: 0.8125rem;
  color: var(--text-subtle);
  background: var(--surface);
}

/* Toast */
.toast {
  position: fixed;
  bottom: 1.1rem;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: var(--text);
  color: white;
  padding: 0.75rem 1.25rem;
  border-radius: 999px;
  font-size: 0.9375rem;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  z-index: 200;
  transition: transform 0.3s ease;
  pointer-events: none;
}

.toast.show {
  transform: translateX(-50%) translateY(0);
}

.loading {
  text-align: center;
  color: var(--text-muted);
  padding: 2rem;
}

.error-msg {
  text-align: center;
  color: #b91c1c;
  padding: 2rem;
}

@media (max-width: 540px) {
  .user-name {
    display: none;
  }

  .header-actions {
    gap: 0.375rem;
  }
}
