/* ============================================
   MEINUTOPIA PORTAL — Design Tokens
   Primary: #b91e27 (Utopia-Rot)
   Typography: System-Serif display / System-Sans body
   ============================================ */

:root {
  /* — Brand — */
  --u-red-50:  #fdf2f3;
  --u-red-100: #fbe3e5;
  --u-red-200: #f5c1c5;
  --u-red-300: #ec939a;
  --u-red-400: #e0626c;
  --u-red-500: #cf3a45;
  --u-red-600: #b91e27;   /* PRIMARY */
  --u-red-700: #9a1820;
  --u-red-800: #7d1820;
  --u-red-900: #5e1218;

  /* — Neutrals (warm) — */
  --u-ink-950: #1a1413;
  --u-ink-900: #2a2422;
  --u-ink-800: #3a3331;
  --u-ink-700: #524a47;
  --u-ink-600: #6e6562;
  --u-ink-500: #8c837f;
  --u-ink-400: #afa6a2;
  --u-ink-300: #d2c9c5;
  --u-ink-200: #e6dfdb;
  --u-ink-100: #f1ebe7;
  --u-ink-50:  #f9f6f3;
  --u-paper:   #fbf9f6;
  --u-white:   #ffffff;

  /* — Accent — */
  --u-violet-600: #6b3fa0;
  --u-violet-100: #ede5f7;
  --u-success: #2f7a4d;
  --u-success-bg: #e8f3ec;
  --u-warning: #c97a1f;

  /* — Semantic — */
  --u-bg:           var(--u-paper);
  --u-bg-elevated: var(--u-white);
  --u-bg-muted:    var(--u-ink-100);
  --u-text:        var(--u-ink-950);
  --u-text-muted:  var(--u-ink-600);
  --u-text-subtle: var(--u-ink-500);
  --u-border:      var(--u-ink-200);
  --u-border-strong: var(--u-ink-300);
  --u-primary:     var(--u-red-600);
  --u-primary-hover: var(--u-red-700);
  --u-primary-soft: var(--u-red-50);

  /* — Typography — */
  --u-font-display: ui-serif, "Iowan Old Style", "Charter", "Source Serif Pro", Georgia, "Times New Roman", serif;
  --u-font-sans:    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --u-font-mono:    ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;

  /* — Spacing (4px base) — */
  --u-s-1: 4px;
  --u-s-2: 8px;
  --u-s-3: 12px;
  --u-s-4: 16px;
  --u-s-5: 20px;
  --u-s-6: 24px;
  --u-s-8: 32px;
  --u-s-10: 40px;
  --u-s-12: 48px;
  --u-s-16: 64px;
  --u-s-20: 80px;

  /* — Radii — */
  --u-r-xs: 2px;
  --u-r-sm: 4px;
  --u-r-md: 8px;
  --u-r-lg: 12px;
  --u-r-xl: 16px;
  --u-r-2xl: 24px;
  --u-r-pill: 999px;

  /* — Shadows — */
  --u-shadow-sm: 0 1px 2px rgba(26,20,19,0.04), 0 1px 1px rgba(26,20,19,0.03);
  --u-shadow-md: 0 4px 12px rgba(26,20,19,0.06), 0 2px 4px rgba(26,20,19,0.04);
  --u-shadow-lg: 0 12px 32px rgba(26,20,19,0.08), 0 4px 8px rgba(26,20,19,0.04);
  --u-shadow-xl: 0 24px 60px rgba(26,20,19,0.14), 0 8px 24px rgba(26,20,19,0.08);
  --u-shadow-focus: 0 0 0 4px rgba(185,30,39,0.18);

  /* — Motion — */
  --u-ease: cubic-bezier(0.4, 0.0, 0.2, 1);
  --u-dur-fast: 120ms;
  --u-dur: 200ms;
}

/* ===== Buttons ===== */
.u-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-family: var(--u-font-sans);
  font-size: 15px; font-weight: 500; line-height: 1;
  padding: 12px 20px; border-radius: var(--u-r-md);
  border: 1px solid transparent; cursor: pointer;
  transition: background var(--u-dur) var(--u-ease), color var(--u-dur) var(--u-ease), border-color var(--u-dur) var(--u-ease), transform var(--u-dur-fast) var(--u-ease);
  text-decoration: none; white-space: nowrap;
}
.u-btn:focus-visible { outline: none; box-shadow: var(--u-shadow-focus); }
.u-btn:active { transform: translateY(1px); }
.u-btn--primary { background: var(--u-primary); color: var(--u-white); }
.u-btn--primary:hover { background: var(--u-primary-hover); text-decoration: none; }
.u-btn--secondary { background: var(--u-white); color: var(--u-ink-900); border-color: var(--u-border-strong); }
.u-btn--secondary:hover { background: var(--u-ink-50); text-decoration: none; }
.u-btn--ghost { background: transparent; color: var(--u-ink-900); }
.u-btn--ghost:hover { background: var(--u-ink-100); text-decoration: none; }
.u-btn--danger-ghost { background: transparent; color: var(--u-primary); }
.u-btn--danger-ghost:hover { background: var(--u-red-50); text-decoration: none; }
.u-btn--lg { font-size: 16px; padding: 14px 24px; }
.u-btn--sm { font-size: 13px; padding: 8px 14px; }
.u-btn--block { width: 100%; }

/* ===== Form ===== */
.u-input, .u-select, .u-textarea {
  width: 100%; font-family: var(--u-font-sans); font-size: 15px;
  padding: 12px 14px; background: var(--u-white);
  border: 1px solid var(--u-border-strong); border-radius: var(--u-r-md);
  color: var(--u-text); transition: border-color var(--u-dur) var(--u-ease), box-shadow var(--u-dur) var(--u-ease);
}
.u-input:hover, .u-select:hover, .u-textarea:hover { border-color: var(--u-ink-500); }
.u-input:focus, .u-select:focus, .u-textarea:focus {
  outline: none; border-color: var(--u-primary); box-shadow: var(--u-shadow-focus);
}
.u-input::placeholder { color: var(--u-text-subtle); }
.u-label { display: block; font-size: 13px; font-weight: 500; color: var(--u-ink-800); margin-bottom: 6px; letter-spacing: 0.01em; }
.u-help  { font-size: 12px; color: var(--u-text-muted); margin-top: 6px; }

.u-check { display: inline-flex; align-items: flex-start; gap: 12px; cursor: pointer; padding: 10px 0; font-size: 14px; }
.u-check input {
  appearance: none; width: 18px; height: 18px;
  border: 1.5px solid var(--u-border-strong); border-radius: 4px;
  background: var(--u-white); cursor: pointer; flex-shrink: 0; margin-top: 1px;
  transition: all var(--u-dur) var(--u-ease); position: relative;
}
.u-check input[type="radio"] { border-radius: 50%; }
.u-check input:checked { background: var(--u-primary); border-color: var(--u-primary); }
.u-check input[type="checkbox"]:checked::after {
  content: ''; position: absolute; left: 4px; top: 1px; width: 5px; height: 9px;
  border: solid white; border-width: 0 2px 2px 0; transform: rotate(45deg);
}
.u-check input[type="radio"]:checked::after {
  content: ''; position: absolute; left: 4px; top: 4px;
  width: 6px; height: 6px; border-radius: 50%; background: white;
}

.u-toggle { position: relative; display: inline-block; width: 40px; height: 24px; flex-shrink: 0; }
.u-toggle input { opacity: 0; width: 0; height: 0; }
.u-toggle-track {
  position: absolute; cursor: pointer; inset: 0;
  background: var(--u-ink-300); border-radius: 999px;
  transition: background var(--u-dur) var(--u-ease);
}
.u-toggle-track::before {
  content: ''; position: absolute; left: 3px; top: 3px;
  width: 18px; height: 18px; border-radius: 50%;
  background: white; box-shadow: 0 1px 3px rgba(0,0,0,0.2);
  transition: transform var(--u-dur) var(--u-ease);
}
.u-toggle input:checked + .u-toggle-track { background: var(--u-primary); }
.u-toggle input:checked + .u-toggle-track::before { transform: translateX(16px); }

/* ===== Cards / Misc ===== */
.u-card { background: var(--u-white); border: 1px solid var(--u-border); border-radius: var(--u-r-lg); padding: 24px; }
.u-card--elev { box-shadow: var(--u-shadow-md); border-color: transparent; }

.u-badge { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: var(--u-r-pill); font-size: 12px; font-weight: 500; letter-spacing: 0.02em; }
.u-badge--red    { background: var(--u-red-50); color: var(--u-red-700); }
.u-badge--violet { background: var(--u-violet-100); color: var(--u-violet-600); }
.u-badge--neutral{ background: var(--u-ink-100); color: var(--u-ink-800); }
.u-badge--success{ background: var(--u-success-bg); color: var(--u-success); }
.u-badge--solid  { background: var(--u-primary); color: white; }

.u-eyebrow { text-transform: uppercase; font-size: 11px; letter-spacing: 0.14em; font-weight: 600; color: var(--u-primary); font-family: var(--u-font-sans); }
.u-hr { border: 0; border-top: 1px solid var(--u-border); margin: 24px 0; }

.u-avatar {
  width: 40px; height: 40px; border-radius: 50%;
  background: var(--u-red-100); color: var(--u-red-700);
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 600; font-size: 14px; flex-shrink: 0;
}

/* ===== Portal Page Header ===== */
.portal-page-header {
  padding: var(--u-s-10) 0 var(--u-s-8);
  border-bottom: 1px solid var(--u-border);
  margin-bottom: var(--u-s-8);
}
.portal-page-header .u-eyebrow { margin-bottom: var(--u-s-2); display: block; }
.portal-page-header h1 {
  font-family: var(--u-font-display);
  font-size: clamp(32px, 4vw, 44px);
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--u-ink-950);
  margin: 0 0 var(--u-s-2);
  line-height: 1.15;
}
.portal-page-header p {
  font-size: 16px;
  color: var(--u-text-muted);
  margin: 0;
  line-height: 1.55;
}

/* ===== Portal Wrap ===== */
.portal-wrap {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 var(--u-s-8);
}
@media (max-width: 640px) {
  .portal-wrap { padding: 0 var(--u-s-4); }
  .portal-page-header { padding: var(--u-s-8) 0 var(--u-s-6); }
}
