  :root {
    --ink: #1a1612;
    --ink-muted: #6b5f54;
    --ink-faint: #c4b8ad;
    --paper: #f7f3ee;
    --paper-warm: #ede7de;
    --paper-card: #ffffff;
    --accent: #c17b3f;
    --accent-light: #f0e0cc;
    --fact: #3a6b5c;
    --fact-light: #d4ede7;
    --emotion: #8c4a6e;
    --emotion-light: #f0d4e4;
    --danger: #b84040;
    --purple: #8b7cc8;
    --purple-light: #f5f3ff;
    --border: #ddd5c8;
    --shadow: 0 2px 16px rgba(26,22,18,0.08);
    --shadow-lg: 0 8px 40px rgba(26,22,18,0.12);
  }
  * { box-sizing: border-box; margin: 0; padding: 0; }
  body {
    font-family: 'DM Sans', sans-serif;
    background: var(--paper);
    color: var(--ink);
    min-height: 100vh;
    font-size: 15px;
  }
  /* Subtle texture overlay */
  body::before {
    content: '';
    position: fixed; inset: 0; z-index: 0;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.75' numOctaves='4' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='300' height='300' filter='url(%23n)' opacity='0.025'/%3E%3C/svg%3E");
    pointer-events: none;
  }

  /* HEADER */
  header {
    border-bottom: 1px solid var(--border);
    padding: 20px 40px;
    display: flex; align-items: center; gap: 12px;
    background: var(--paper);
    position: sticky; top: 0; z-index: 100;
  }
  .logo {
    font-family: 'Playfair Display', serif;
    font-size: 22px; font-weight: 600;
    letter-spacing: -0.5px;
  }
  .logo-dot { color: var(--accent); }
  .tagline { font-size: 12px; color: var(--ink-muted); font-weight: 300; letter-spacing: 0.5px; }

  /* MAIN LAYOUT */
  main {
    max-width: 900px; margin: 0 auto;
    padding: 40px 24px 80px;
    position: relative; z-index: 1;
  }

  /* STEP SYSTEM */
  .step { display: none; animation: fadeUp 0.35s ease both; }
  .step.active { display: block; }
  @keyframes fadeUp {
    from { opacity: 0; transform: translateY(14px); }
    to { opacity: 1; transform: translateY(0); }
  }

  /* STEP HEADER */
  .step-label {
    font-size: 11px; font-weight: 500; letter-spacing: 2px; text-transform: uppercase;
    color: var(--accent); margin-bottom: 8px;
  }
  h1.step-title {
    font-family: 'Playfair Display', serif;
    font-size: 32px; font-weight: 600; line-height: 1.2;
    margin-bottom: 8px;
  }
  .step-sub {
    font-size: 14px; color: var(--ink-muted); margin-bottom: 32px;
    max-width: 540px; line-height: 1.6;
  }

  /* CARDS */
  .card {
    background: var(--paper-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 28px;
    margin-bottom: 16px;
    box-shadow: var(--shadow);
  }

  /* DECISION TYPE SELECTOR */
  .type-grid {
    display: grid; grid-template-columns: 1fr 1fr; gap: 16px;
    margin-bottom: 28px;
  }
  .type-card {
    border: 2px solid var(--border);
    border-radius: 12px; padding: 24px 20px;
    cursor: pointer; background: var(--paper-card);
    transition: all 0.2s; text-align: left;
    box-shadow: var(--shadow);
  }
  .type-card:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: var(--shadow-lg); }
  .type-card.selected { border-color: var(--accent); background: #fffaf5; }
  .type-icon { font-size: 28px; margin-bottom: 12px; }
  .type-name { font-family: 'Playfair Display', serif; font-size: 18px; margin-bottom: 6px; }
  .type-desc { font-size: 13px; color: var(--ink-muted); line-height: 1.5; }

  /* INPUTS */
  label { display: block; font-size: 13px; font-weight: 500; margin-bottom: 6px; color: var(--ink-muted); }
  input[type="text"], textarea {
    width: 100%; border: 1px solid var(--border);
    border-radius: 8px; padding: 12px 14px;
    font-family: 'DM Sans', sans-serif; font-size: 15px;
    background: var(--paper); color: var(--ink);
    transition: border-color 0.2s;
    outline: none;
  }
  input[type="text"]:focus, textarea:focus { border-color: var(--accent); background: white; }
  textarea { resize: vertical; min-height: 60px; }

  /* PROS/CONS AREA */
  .pc-header {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 12px;
  }
  .pc-title {
    font-family: 'Playfair Display', serif; font-size: 16px;
  }
  .pc-title.pro { color: var(--fact); }
  .pc-title.con { color: var(--danger); }

  .item-row {
    display: grid; grid-template-columns: 1fr auto auto;
    gap: 8px; align-items: center; margin-bottom: 8px;
    background: var(--paper); border-radius: 8px;
    padding: 8px 12px;
    border: 1px solid var(--border);
    transition: box-shadow 0.15s;
  }
  .item-row:hover { box-shadow: 0 2px 8px rgba(26,22,18,0.06); }
  .item-text { font-size: 14px; }
  .item-tag {
    font-size: 10px; font-weight: 500; letter-spacing: 0.5px;
    padding: 3px 8px; border-radius: 10px; cursor: pointer;
    white-space: nowrap; transition: all 0.15s;
  }
  .item-tag.fact { background: var(--fact-light); color: var(--fact); }
  .item-tag.emotion { background: var(--emotion-light); color: var(--emotion); }
  .item-tag:hover { opacity: 0.75; }
  .item-score {
    width: 40px; border: 1px solid var(--border); border-radius: 6px;
    padding: 4px 6px; text-align: center; font-size: 13px; font-weight: 500;
    background: white; color: var(--ink);
    font-family: 'DM Sans', sans-serif;
  }
  .item-score:focus { outline: none; border-color: var(--accent); }
  .item-del {
    background: none; border: none; cursor: pointer;
    color: var(--ink-faint); font-size: 16px; padding: 0 4px;
    transition: color 0.15s;
  }
  .item-del:hover { color: var(--danger); }

  /* ADD ITEM FORM */
  .add-form {
    display: flex; gap: 8px; align-items: stretch; margin-top: 10px;
  }
  .add-form input { flex: 1; }
  .btn-add {
    background: var(--accent); color: white; border: none;
    border-radius: 8px; padding: 0 16px; cursor: pointer;
    font-size: 20px; line-height: 1; transition: opacity 0.15s;
  }
  .btn-add:hover { opacity: 0.85; }

  /* CHOICES */
  .choice-card {
    border: 1px solid var(--border); border-radius: 10px;
    margin-bottom: 16px; overflow: hidden;
    box-shadow: var(--shadow);
  }
  .choice-header {
    background: var(--paper-warm); padding: 14px 20px;
    display: flex; justify-content: space-between; align-items: center;
  }
  .choice-name {
    font-family: 'Playfair Display', serif; font-size: 16px; font-weight: 600;
  }
  .choice-body { padding: 16px 20px; background: white; }
  .btn-del-choice {
    background: none; border: 1px solid var(--border); border-radius: 6px;
    padding: 4px 10px; cursor: pointer; font-size: 12px;
    color: var(--ink-muted); transition: all 0.15s;
  }
  .btn-del-choice:hover { border-color: var(--danger); color: var(--danger); }

  /* PRE-MORTEM */
  .premortem-box {
    background: linear-gradient(135deg, #fff8f0 0%, #fff0e8 100%);
    border: 1px solid #e8c9a0; border-radius: 12px; padding: 24px;
    margin-bottom: 24px;
  }
  .premortem-icon { font-size: 24px; margin-bottom: 8px; }
  .premortem-box h3 { font-family: 'Playfair Display', serif; font-size: 17px; margin-bottom: 6px; }
  .premortem-box p { font-size: 13px; color: var(--ink-muted); margin-bottom: 14px; line-height: 1.6; }

  /* BUTTONS */
  .btn {
    display: inline-flex; align-items: center; gap: 8px;
    border: none; border-radius: 8px; padding: 12px 24px;
    font-family: 'DM Sans', sans-serif; font-size: 15px; font-weight: 500;
    cursor: pointer; transition: all 0.2s;
  }
  .btn-primary { background: var(--ink); color: white; }
  .btn-primary:hover { background: #2e2820; transform: translateY(-1px); box-shadow: 0 4px 16px rgba(26,22,18,0.2); }
  .btn-secondary {
    background: transparent; color: var(--ink-muted);
    border: 1px solid var(--border);
  }
  .btn-secondary:hover { background: var(--paper-warm); color: var(--ink); }
  .btn-accent { background: var(--accent); color: white; }
  .btn-accent:hover { opacity: 0.88; transform: translateY(-1px); }
  .btn-row { display: flex; gap: 12px; margin-top: 28px; flex-wrap: wrap; }

  /* INSIGHT PILL */
  .insight {
    display: inline-flex; align-items: center; gap: 6px;
    font-size: 12px; padding: 5px 12px; border-radius: 20px;
    background: var(--accent-light); color: var(--accent);
    font-weight: 500; margin-bottom: 20px;
  }

  /* RESULTS */
  .results-grid { display: grid; gap: 16px; }
  .result-card {
    background: white; border: 2px solid var(--border);
    border-radius: 14px; padding: 24px;
    transition: all 0.3s;
    position: relative; overflow: hidden;
  }
  .result-card.winner {
    border-color: var(--accent);
    box-shadow: 0 4px 24px rgba(193,123,63,0.15);
  }
  .result-card.leans-yes { border-color: var(--fact); box-shadow: 0 4px 24px rgba(58,107,92,0.12); }
  .result-card.leans-no { border-color: var(--danger); box-shadow: 0 4px 24px rgba(184,64,64,0.12); }
  .result-card.balanced { border-color: var(--purple); box-shadow: 0 4px 24px rgba(139,124,200,0.12); }
  .verdict-hero {
    display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 20px;
  }
  .verdict-label {
    font-family: 'Playfair Display', serif;
    font-size: 32px; font-weight: 600; line-height: 1.1; margin-bottom: 4px;
  }
  .verdict-supporting {
    font-size: 13px; color: var(--ink-muted); margin-top: 2px;
  }
  .verdict-badge {
    flex: 0 0 auto; border-radius: 8px; padding: 6px 14px;
    font-size: 12px; font-weight: 600; letter-spacing: 0.3px;
    margin-top: 4px;
  }
  .verdict-badge.yes { background: var(--fact-light); color: var(--fact); }
  .verdict-badge.no { background: #fde8e8; color: var(--danger); }
  .verdict-badge.balanced { background: var(--purple-light, #f5f3ff); color: var(--purple); }
  .result-subtitle { font-size: 13px; color: var(--ink-muted); margin-bottom: 16px; }
  .score-bar-wrap { margin-bottom: 6px; }
  .score-bar-label {
    display: flex; justify-content: space-between;
    font-size: 12px; color: var(--ink-muted); margin-bottom: 4px;
  }
  .score-bar-track {
    height: 8px; background: var(--paper-warm); border-radius: 4px; overflow: hidden;
  }
  .score-bar-fill {
    height: 100%; border-radius: 4px;
    background: var(--accent);
    transition: width 0.8s cubic-bezier(0.16, 1, 0.3, 1);
  }
  .score-bar-fill.negative { background: var(--danger); }
  .score-big {
    font-family: 'Playfair Display', serif;
    font-size: 40px; font-weight: 600; color: var(--ink);
    line-height: 1;
  }
  .score-unit { font-size: 15px; color: var(--ink-muted); }
  .breakdown-row {
    display: flex; justify-content: space-between;
    font-size: 13px; padding: 6px 0;
    border-bottom: 1px solid var(--border);
  }
  .breakdown-row:last-child { border-bottom: none; }
  .tag-fact { color: var(--fact); font-size: 11px; }
  .tag-emotion { color: var(--emotion); font-size: 11px; }

  /* BAR CHART */
  .bar-chart {
    display: flex; align-items: flex-end; gap: 10px;
    height: 180px; padding: 0 8px 0; margin-bottom: 8px;
  }
  .bar-chart-group {
    display: flex; flex-direction: column; align-items: center;
    flex: 1; height: 100%; justify-content: flex-end;
  }
  .bar-chart-bars { display: flex; align-items: flex-end; gap: 4px; width: 100%; justify-content: center; }
  .bar {
    flex: 1; max-width: 36px; border-radius: 4px 4px 0 0;
    transition: height 0.8s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative; cursor: default;
  }
  .bar:hover::after {
    content: attr(data-val);
    position: absolute; top: -22px; left: 50%; transform: translateX(-50%);
    background: var(--ink); color: white; font-size: 10px; font-weight: 600;
    padding: 2px 6px; border-radius: 4px; white-space: nowrap;
  }
  .bar-fact-pro  { background: var(--fact); }
  .bar-fact-con  { background: var(--danger); }
  .bar-feel-pro  { background: var(--emotion); }
  .bar-feel-con  { background: #d4607a; }
  .bar-axis-label {
    font-size: 11px; color: var(--ink-muted); text-align: center;
    margin-top: 6px; line-height: 1.3;
  }
  .bar-y-axis {
    display: flex; flex-direction: column; justify-content: space-between;
    height: 180px; padding-bottom: 28px; padding-right: 6px;
  }
  .bar-y-tick { font-size: 10px; color: var(--ink-faint); text-align: right; }
  .bar-chart-wrap {
    display: flex; gap: 0; align-items: flex-start;
    margin-bottom: 16px; position: relative;
  }
  .bar-chart-gridlines {
    position: absolute; left: 36px; right: 0; top: 0; height: 180px;
    display: flex; flex-direction: column; justify-content: space-between;
    pointer-events: none; padding-bottom: 28px;
  }
  .bar-grid-line {
    width: 100%; border-top: 1px dashed var(--border);
  }
  .bar-legend {
    display: flex; flex-wrap: wrap; gap: 12px; font-size: 12px;
    color: var(--ink-muted); margin-bottom: 20px; padding-left: 42px;
  }
  .bar-legend-item { display: flex; align-items: center; gap: 5px; }
  .bar-legend-dot { width: 10px; height: 10px; border-radius: 2px; flex: 0 0 auto; }

  /* GUT VALIDATION */
  .gut-validation {
    background: var(--paper-warm); border: 1px solid var(--border);
    border-radius: 12px; padding: 20px; margin-top: 16px;
  }
  .gut-validation-title {
    font-family: 'Playfair Display', serif; font-size: 17px;
    margin-bottom: 6px; color: var(--ink);
  }
  .gut-validation-sub { font-size: 13px; color: var(--ink-muted); margin-bottom: 16px; line-height: 1.6; }
  .gut-val-btns { display: flex; gap: 10px; flex-wrap: wrap; }
  .gut-val-btn {
    border: 1px solid var(--border); border-radius: 20px;
    padding: 9px 20px; font-size: 14px; cursor: pointer;
    background: white; font-family: 'DM Sans', sans-serif;
    transition: all 0.15s; font-weight: 500;
  }
  .gut-val-btn.yes:hover, .gut-val-btn.yes.selected { background: var(--fact); color: white; border-color: var(--fact); }
  .gut-val-btn.no:hover, .gut-val-btn.no.selected { background: var(--danger); color: white; border-color: var(--danger); }
  .gut-val-response {
    margin-top: 14px; padding: 14px 16px;
    border-radius: 10px; font-size: 13px; line-height: 1.6;
    animation: fadeUp 0.3s ease both;
  }
  .gut-val-response.aligned { background: var(--fact-light); border: 1px solid #a0d4c4; color: var(--fact); }
  .gut-val-response.misaligned { background: #fff5f5; border: 1px solid #f0b4b4; color: var(--danger); }
  .gut-val-update-btns { display: flex; gap: 10px; margin-top: 12px; flex-wrap: wrap; }

  /* PROGRESS BAR */
  /* PROGRESS BAR */
  .progress-dots {
    display: flex; gap: 6px; margin-bottom: 32px;
  }
  .dot {
    width: 28px; height: 4px; border-radius: 2px;
    background: var(--border); transition: background 0.3s;
  }
  .dot.done { background: var(--accent); }
  .dot.active { background: var(--ink); }

  /* RESPONSIVE */
  @media (max-width: 600px) {
    header { padding: 16px 20px; }
    main { padding: 28px 16px 60px; }
    .type-grid { grid-template-columns: 1fr; }
    h1.step-title { font-size: 24px; }
  }

  /* TAG LEGEND */
  .legend {
    display: flex; gap: 16px; font-size: 12px; margin-bottom: 16px; flex-wrap: wrap;
  }
  .legend-item { display: flex; align-items: center; gap: 5px; }
  .legend-dot { width: 8px; height: 8px; border-radius: 50%; }

  /* TIE HANDLING */
  .result-card.tied {
    border-color: #8b7cc8;
    box-shadow: 0 4px 24px rgba(139,124,200,0.15);
  }
  .tie-banner {
    display: flex; align-items: flex-start; gap: 12px;
    background: #f5f3ff; border: 1px solid #c4b8f0;
    border-radius: 10px; padding: 18px; margin-bottom: 20px;
    font-size: 14px; line-height: 1.6;
  }
  .tiebreaker-box {
    background: white; border: 1px solid var(--border);
    border-radius: 14px; padding: 24px; margin-top: 20px;
    box-shadow: var(--shadow);
  }
  .tiebreaker-box h3 {
    font-family: 'Playfair Display', serif; font-size: 18px; margin-bottom: 6px;
  }
  .tiebreaker-box p { font-size: 13px; color: var(--ink-muted); margin-bottom: 20px; line-height: 1.6; }
  .tb-question {
    border: 1px solid var(--border); border-radius: 10px; padding: 16px 18px;
    margin-bottom: 12px; cursor: pointer; transition: all 0.2s;
    display: flex; align-items: flex-start; gap: 12px;
  }
  .tb-question:hover { border-color: #8b7cc8; background: #f9f8ff; }
  .tb-question.answered { border-color: #8b7cc8; background: #f5f3ff; }
  .tb-q-icon { font-size: 20px; flex: 0 0 auto; margin-top: 1px; }
  .tb-q-label { font-size: 13px; font-weight: 500; margin-bottom: 4px; }
  .tb-q-sub { font-size: 12px; color: var(--ink-muted); }
  .tb-choices { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
  .tb-choice-btn {
    border: 1px solid var(--border); border-radius: 20px;
    padding: 6px 14px; font-size: 13px; cursor: pointer;
    background: var(--paper-card); font-family: 'DM Sans', sans-serif;
    transition: all 0.15s;
  }
  .tb-choice-btn:hover { border-color: #8b7cc8; background: #f5f3ff; }
  .tb-choice-btn.selected { background: #8b7cc8; color: white; border-color: #8b7cc8; }
  .tiebreaker-verdict {
    background: linear-gradient(135deg, #f5f3ff, #ede8ff);
    border: 2px solid #8b7cc8; border-radius: 12px; padding: 20px;
    margin-top: 16px; display: none;
  }
  .tiebreaker-verdict h4 {
    font-family: 'Playfair Display', serif; font-size: 16px; margin-bottom: 6px; color: #5a4ba0;
  }
  .tiebreaker-verdict p { font-size: 13px; color: var(--ink-muted); line-height: 1.6; }


  /* History filter buttons */
  .hfilter-btn {
    padding:6px 10px; border:1px solid #ddd5c8; border-radius:8px;
    background:white; font-size:12px; cursor:pointer; color:#6b5f54;
    font-family:'DM Sans',sans-serif; white-space:nowrap; transition:all 0.15s;
  }
  .hfilter-btn.hfilter-active {
    background:#1a1612; color:white; border-color:#1a1612;
  }
  /* Star rating */
  .star-btn {
    font-size:24px; cursor:pointer; color:#ddd5c8; transition:color 0.1s; user-select:none;
  }
  .star-btn.active { color:#c17b3f; }
  /* History card action buttons */
  .hcard-action {
    padding:5px 12px; border:1px solid #ddd5c8; border-radius:6px;
    background:transparent; font-size:11px; cursor:pointer; color:#6b5f54;
    font-family:'DM Sans',sans-serif; transition:all 0.15s;
  }
  .hcard-action:hover { background:#1a1612; color:white; border-color:#1a1612; }
  .hcard-action.danger:hover { background:#b84040; color:white; border-color:#b84040; }
  /* Overdue badge */
  .overdue-badge {
    font-size:10px; background:#fff3cd; color:#856404; padding:2px 8px;
    border-radius:10px; font-weight:600; border:1px solid #ffc107;
  }
  /* Version badge */
  .version-badge {
    font-size:10px; background:#f5f3ff; color:#8b7cc8; padding:2px 8px;
    border-radius:10px; font-weight:600; border:1px solid #d4c8f0;
    cursor:pointer;
  }
  .version-badge:hover { background:#8b7cc8; color:white; }
  [id^="hcard-"] { transition: box-shadow 0.2s; }
  [id^="hcard-"]:hover { box-shadow: 0 2px 12px rgba(0,0,0,0.08); }
