/* ═══════════════════════════════════════════════════
   HATTEN — Design System
   Färger, typografi, komponenter
═══════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Fraunces:ital,opsz,wght@0,9..144,300;0,9..144,400;0,9..144,500;0,9..144,600;0,9..144,700;1,9..144,400&family=Inter:wght@300;400;500;600&display=swap');

/* ─── CSS-VARIABLER ─────────────────────────────── */
:root {
  --bg-top:       #fdfaf3;
  --bg-bottom:    #f7eedd;
  --card-bg:      #fffdf7;
  --text-primary: #2a2520;
  --text-secondary: #999999;
  --text-tertiary: #b8a898;
  --border-soft:  #e8e0d0;
  --accent:       #c8553d;
  --accent-hover: #b14a35;
  --positive:     #5ba34e;
  --mode-open:    #8b6f47;
  --mode-goal:    #c8553d;
  --mode-equal:   #5d7a5e;
  --radius:       18px;
  --radius-sm:    12px;
  --shadow-card:  0 4px 24px -8px rgba(42,37,32,0.08);
}

/* ─── RESET & BASE ──────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  background: linear-gradient(to bottom, var(--bg-top), var(--bg-bottom));
  background-attachment: fixed;
  min-height: 100vh;
  color: var(--text-primary);
  font-family: 'Inter', sans-serif;
  font-size: 16px;
  line-height: 1.625;
  overflow-x: hidden;
}

h1, h2, h3, h4, h5, h6, .display {
  font-family: 'Fraunces', serif;
  color: var(--text-primary);
  line-height: 1.2;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

img { max-width: 100%; height: auto; }

/* ─── LAYOUT ────────────────────────────────────── */
.page-container {
  max-width: 640px;
  margin: 0 auto;
  padding: 0 20px 80px;
}

.page-container--wide {
  max-width: 900px;
  margin: 0 auto;
  padding: 0 20px 80px;
}

.centered {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  min-height: 60vh;
  padding: 40px 20px;
}

/* ─── HEADER ────────────────────────────────────── */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(253,250,243,0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-soft);
}

.header-inner {
  max-width: 900px;
  margin: 0 auto;
  padding: 0 20px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.header-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
}

.header-logo-icon { font-size: 24px; }

.header-logo-text {
  font-family: 'Fraunces', serif;
  font-size: 22px;
  font-weight: 600;
  color: var(--accent);
  letter-spacing: -0.02em;
}

.header-nav {
  display: flex;
  align-items: center;
  gap: 4px;
}

.header-nav a {
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  padding: 6px 12px;
  border-radius: 8px;
  transition: all 0.15s;
  text-decoration: none;
}

.header-nav a:hover,
.header-nav a.active {
  color: var(--text-primary);
  background: rgba(42,37,32,0.06);
}

.header-nav a.nav-org-login {
  color: var(--text-secondary);
  font-size: 13px;
}

.header-nav a.nav-dashboard {
  color: var(--accent);
  font-weight: 600;
}

/* Hamburger */
.hamburger {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  color: var(--text-primary);
  font-size: 22px;
}

.mobile-menu {
  display: none;
  flex-direction: column;
  background: var(--card-bg);
  border-top: 1px solid var(--border-soft);
  padding: 8px 0;
}

.mobile-menu a {
  display: block;
  padding: 14px 24px;
  color: var(--text-primary);
  font-size: 16px;
  font-weight: 500;
  text-decoration: none;
  border-bottom: 1px solid var(--border-soft);
}

.mobile-menu a:last-child { border-bottom: none; }
.mobile-menu a:hover { background: rgba(42,37,32,0.04); }

.mobile-menu-divider {
  height: 1px;
  background: var(--border-soft);
  margin: 4px 0;
}

.mobile-menu.open { display: flex; }

@media (max-width: 640px) {
  .header-nav { display: none; }
  .hamburger { display: flex; }
}

/* ─── FOOTER ────────────────────────────────────── */
.site-footer {
  text-align: center;
  padding: 32px 20px;
  color: var(--text-secondary);
  font-size: 13px;
  border-top: 1px solid var(--border-soft);
  margin-top: 60px;
}

.site-footer a {
  color: var(--text-secondary);
  text-decoration: underline;
}

/* ─── KORT ──────────────────────────────────────── */
.card {
  background: var(--card-bg);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 28px 24px;
  box-shadow: var(--shadow-card);
  margin-bottom: 16px;
}

.card--accent {
  background: rgba(200,85,61,0.04);
  border-color: rgba(200,85,61,0.2);
}

.card--positive {
  background: rgba(91,163,78,0.04);
  border-color: rgba(91,163,78,0.2);
}

/* ─── KNAPPAR ───────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 24px;
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-weight: 500;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  transition: all 0.2s ease;
  border: none;
  text-decoration: none;
  line-height: 1;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

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

.btn-primary:hover:not(:disabled) {
  background: var(--accent-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(200,85,61,0.25);
  text-decoration: none;
  color: #fff;
}

.btn-secondary {
  background: transparent;
  color: var(--text-primary);
  border: 1px solid var(--border-soft);
}

.btn-secondary:hover:not(:disabled) {
  background: rgba(42,37,32,0.04);
  text-decoration: none;
}

.btn-positive {
  background: var(--positive);
  color: #fff;
}

.btn-positive:hover:not(:disabled) {
  background: #4e8f43;
  transform: translateY(-1px);
}

.btn-swish {
  background: var(--positive);
  color: #fff;
}

.btn-swish:hover:not(:disabled) {
  background: #4e8f43;
}

.btn--full { width: 100%; }
.btn--sm { padding: 8px 14px; font-size: 13px; }

/* ─── FORMULÄR ──────────────────────────────────── */
.form-group {
  margin-bottom: 20px;
}

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 8px;
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 14px 16px;
  border: 1.5px solid var(--border-soft);
  border-radius: var(--radius-sm);
  background: var(--card-bg);
  color: var(--text-primary);
  font-size: 16px;
  font-family: 'Inter', sans-serif;
  transition: border-color 0.15s;
  outline: none;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  border-color: var(--accent);
}

.form-input--error {
  border-color: var(--accent) !important;
}

.form-error {
  color: var(--accent);
  font-size: 13px;
  margin-top: 6px;
}

.form-hint {
  color: var(--text-secondary);
  font-size: 12px;
  margin-top: 6px;
}

.form-textarea {
  resize: vertical;
  min-height: 100px;
}

/* ─── PILLS (beloppsval) ────────────────────────── */
.pill-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.pill {
  padding: 8px 16px;
  border: 1.5px solid var(--border-soft);
  border-radius: 999px;
  background: transparent;
  color: var(--text-primary);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  font-family: 'Inter', sans-serif;
}

.pill:hover { border-color: var(--accent); color: var(--accent); }
.pill.active { background: var(--accent); color: #fff; border-color: var(--accent); }

/* ─── PROGRESS BAR ──────────────────────────────── */
.bar {
  height: 10px;
  background: rgba(42,37,32,0.08);
  border-radius: 999px;
  overflow: hidden;
  display: flex;
}

.bar-confirmed {
  background: linear-gradient(90deg, var(--positive), #6fb858);
  transition: width 0.5s ease;
}

.bar-pending {
  background: repeating-linear-gradient(
    45deg,
    rgba(91,163,78,0.3),
    rgba(91,163,78,0.3) 4px,
    rgba(91,163,78,0.15) 4px,
    rgba(91,163,78,0.15) 8px
  );
  transition: width 0.5s ease;
}

/* ─── BADGE ─────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.badge-open   { background: rgba(139,111,71,0.12); color: var(--mode-open); }
.badge-goal   { background: rgba(200,85,61,0.12);  color: var(--mode-goal); }
.badge-equal  { background: rgba(93,122,94,0.12);  color: var(--mode-equal); }
.badge-provperiod { background: rgba(200,85,61,0.1); color: var(--accent); }
.badge-aktiv  { background: rgba(91,163,78,0.1);   color: var(--positive); }
.badge-utgangen { background: rgba(42,37,32,0.08); color: var(--text-secondary); }

/* ─── SPINNER ───────────────────────────────────── */
.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--border-soft);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 16px;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ─── EYEBROW ───────────────────────────────────── */
.eyebrow {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

/* ─── GRID ──────────────────────────────────────── */
.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

@media (max-width: 640px) {
  .grid-3 { grid-template-columns: 1fr; }
  .grid-2 { grid-template-columns: 1fr; }
}

/* ─── MODAL ─────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(42,37,32,0.4);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 20px;
}

@media (min-width: 640px) {
  .modal-overlay { align-items: center; }
}

.modal {
  background: var(--card-bg);
  border-radius: var(--radius) var(--radius) 0 0;
  padding: 32px 24px;
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  animation: slideUp 0.3s ease;
}

@media (min-width: 640px) {
  .modal { border-radius: var(--radius); animation: fadeIn 0.2s ease; }
}

@keyframes slideUp {
  from { transform: translateY(100%); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

@keyframes fadeIn {
  from { opacity: 0; transform: scale(0.96); }
  to   { opacity: 1; transform: scale(1); }
}

.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  color: var(--text-secondary);
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background 0.15s;
}

.modal-close:hover { background: rgba(42,37,32,0.08); }

/* ─── LANDNINGSSIDAN ────────────────────────────── */
.landing-hero {
  padding: 60px 0 48px;
  text-align: center;
}

.landing-title {
  font-size: clamp(2rem, 6vw, 3rem);
  font-weight: 700;
  margin-bottom: 16px;
  letter-spacing: -0.02em;
}

.landing-subtitle {
  font-size: 18px;
  color: var(--text-secondary);
  max-width: 480px;
  margin: 0 auto 32px;
  line-height: 1.6;
}

.landing-section {
  padding: 40px 0;
  border-top: 1px solid var(--border-soft);
}

.landing-section-title {
  font-size: 1.5rem;
  text-align: center;
  margin-bottom: 28px;
}

/* Mode-kort */
.mode-card {
  background: var(--card-bg);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 24px 20px;
  transition: box-shadow 0.2s;
}

.mode-card:hover {
  box-shadow: 0 8px 32px -8px rgba(42,37,32,0.12);
}

.mode-icon-wrapper {
  font-size: 28px;
  margin-bottom: 12px;
  display: block;
}

.mode-title {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 8px;
}

.mode-desc {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 10px;
}

.mode-example {
  font-size: 13px;
  color: var(--text-tertiary);
  font-style: italic;
}

/* Steg-kort */
.step-card {
  text-align: center;
  padding: 20px;
}

.step-number {
  width: 44px;
  height: 44px;
  background: var(--accent);
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Fraunces', serif;
  font-size: 20px;
  font-weight: 700;
  margin: 0 auto 16px;
}

.step-title {
  font-size: 1rem;
  margin-bottom: 8px;
}

.step-desc {
  font-size: 14px;
  color: var(--text-secondary);
}

/* FAQ */
.faq-list { display: flex; flex-direction: column; gap: 8px; }

.faq-item {
  background: var(--card-bg);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.faq-summary {
  padding: 16px 20px;
  cursor: pointer;
  font-weight: 500;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  user-select: none;
}

.faq-summary::after { content: '+'; font-size: 20px; color: var(--accent); }
.faq-item[open] .faq-summary::after { content: '−'; }

.faq-content {
  padding: 0 20px 16px;
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1.6;
}

/* ─── NOTISER ───────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--text-primary);
  color: var(--bg-top);
  padding: 12px 24px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 500;
  z-index: 9999;
  animation: fadeIn 0.3s ease;
  white-space: nowrap;
}

/* ─── FEEDBACK BUTTON ───────────────────────────── */
.feedback-btn {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 999px;
  padding: 12px 20px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 4px 16px rgba(200,85,61,0.3);
  z-index: 500;
  transition: all 0.2s;
  font-family: 'Inter', sans-serif;
}

.feedback-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(200,85,61,0.4);
}

/* ─── TABELL ────────────────────────────────────── */
.table-wrapper { overflow-x: auto; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

th {
  text-align: left;
  padding: 12px 16px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border-soft);
}

td {
  padding: 14px 16px;
  border-bottom: 1px solid rgba(232,224,208,0.5);
  vertical-align: middle;
}

tr:last-child td { border-bottom: none; }
tr:hover td { background: rgba(42,37,32,0.02); }

/* ─── STATS GRID ────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 32px;
}

@media (max-width: 768px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
}

.stat-card {
  background: var(--card-bg);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  padding: 16px;
  text-align: center;
}

.stat-number {
  font-family: 'Fraunces', serif;
  font-size: 28px;
  font-weight: 700;
  display: block;
  line-height: 1;
  margin-bottom: 6px;
}

.stat-label {
  font-size: 11px;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ─── RESPONSIVE ────────────────────────────────── */
@media (max-width: 480px) {
  .card { padding: 20px 16px; }
  .landing-hero { padding: 40px 0 32px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
}
