:root {
  --bg: #f7f3ea;
  --bg-tint: #f1ebdc;
  --surface: #fffdf8;
  --surface-2: #fbf6ec;
  --surface-3: #f3ecdb;
  --gold: #b0894a;
  --gold-deep: #8a6a34;
  --gold-bright: #c9a860;
  --gold-soft: rgba(176, 137, 74, 0.12);
  --ember: #b5623f;
  --sage: #7c8a5c;
  --ink: #2c2416;
  --text: #3a3020;
  --text-dim: #6f6450;
  --text-faint: #9b9078;
  --border: rgba(176, 137, 74, 0.22);
  --border-bright: rgba(176, 137, 74, 0.5);
  --radius: 14px;
  --font-display: 'Fraunces', 'Iowan Old Style', serif;
  --font-body: 'Manrope', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-label: 'Cinzel', serif;
  --shadow-soft: 0 4px 16px -8px rgba(120, 95, 45, 0.25);
  --shadow-lift: 0 14px 36px -16px rgba(120, 95, 45, 0.35);
}

* { box-sizing: border-box; }
html { -webkit-tap-highlight-color: transparent; }

body {
  margin: 0;
  background:
    radial-gradient(120% 90% at 12% -8%, #fdfbf4 0%, var(--bg) 46%),
    var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
}

.atmosphere { position: fixed; inset: 0; pointer-events: none; z-index: 0; overflow: hidden; }
.wisp { position: absolute; border-radius: 50%; filter: blur(70px); opacity: 0.22; mix-blend-mode: multiply; animation: drift 28s ease-in-out infinite; }
.wisp.w1 { width: 460px; height: 460px; background: radial-gradient(circle, var(--gold-bright) 0%, transparent 70%); top: -12%; left: 6%; animation-duration: 32s; }
.wisp.w2 { width: 360px; height: 360px; background: radial-gradient(circle, var(--ember) 0%, transparent 72%); top: 42%; right: 4%; animation-duration: 26s; animation-delay: -7s; opacity: 0.14; }
.wisp.w3 { width: 320px; height: 320px; background: radial-gradient(circle, var(--sage) 0%, transparent 72%); bottom: -10%; left: 34%; animation-duration: 36s; animation-delay: -13s; opacity: 0.16; }
@keyframes drift { 0%, 100% { transform: translate(0, 0) scale(1); } 50% { transform: translate(3%, -4%) scale(1.08); } }
@media (prefers-reduced-motion: reduce) { .wisp { animation: none; } }

.eyebrow { font-family: var(--font-label); font-size: 11px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--gold-deep); margin: 0 0 6px; font-weight: 600; }
a { color: var(--gold-deep); }

.auth-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.auth-card { position: relative; z-index: 1; width: min(380px, 88vw); background: linear-gradient(180deg, var(--surface) 0%, var(--surface-2) 100%); border: 1px solid var(--border); border-radius: var(--radius); padding: 40px 32px; box-shadow: var(--shadow-lift); text-align: center; }
.auth-title { font-family: var(--font-display); font-optical-sizing: auto; font-weight: 600; font-size: 42px; margin: 0 0 10px; background: linear-gradient(180deg, var(--gold-bright), var(--gold-deep)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.auth-sub { color: var(--text-dim); font-size: 14px; margin: 0 0 24px; }
.auth-error { color: var(--ember); font-size: 13px; margin: 0 0 14px; }
.auth-form { display: flex; flex-direction: column; gap: 14px; text-align: left; }
.auth-form label { font-size: 12px; color: var(--text-dim); display: flex; flex-direction: column; gap: 6px; }
.auth-form input { font-family: var(--font-body); background: var(--bg); border: 1px solid var(--border); border-radius: 8px; color: var(--text); padding: 10px 12px; font-size: 15px; }
.auth-form input:focus { outline: 2px solid var(--gold); outline-offset: 1px; border-color: var(--gold); }
.auth-form button { margin-top: 6px; font-family: var(--font-label); letter-spacing: 0.08em; text-transform: uppercase; font-size: 13px; background: linear-gradient(135deg, var(--gold-bright), var(--gold-deep)); color: #fffdf6; border: none; border-radius: 8px; padding: 12px; font-weight: 600; cursor: pointer; transition: transform .15s ease, box-shadow .15s ease; }
.auth-form button:hover { transform: translateY(-1px); box-shadow: 0 10px 22px -10px rgba(176,137,74,0.7); }

.shell { position: relative; z-index: 1; display: flex; min-height: 100vh; }
.rail { width: 240px; flex-shrink: 0; background: linear-gradient(180deg, var(--surface) 0%, var(--surface-2) 100%); border-right: 1px solid var(--border); display: flex; flex-direction: column; padding: 28px 0; position: sticky; top: 0; height: 100vh; box-shadow: 1px 0 0 rgba(255,255,255,0.6) inset; }
.rail-brand { padding: 0 24px 20px; border-bottom: 1px solid var(--border); margin-bottom: 10px; }
.rail-brand h1 { font-family: var(--font-display); font-size: 26px; margin: 0; font-weight: 600; color: var(--ink); }
.rail-tab { display: flex; align-items: center; gap: 12px; background: none; border: none; text-align: left; cursor: pointer; font-family: var(--font-body); font-size: 14.5px; font-weight: 500; color: var(--text-dim); padding: 12px 24px; position: relative; }
.rail-tab .tick { width: 10px; height: 1px; background: var(--border-bright); transition: width .2s ease, background .2s ease; }
.rail-tab:hover { color: var(--ink); }
.rail-tab:hover .tick { width: 18px; }
.rail-tab.active { color: var(--gold-deep); }
.rail-tab.active .tick { width: 22px; background: var(--gold); }
.rail-tab.active::before { content: ''; position: absolute; left: 0; top: 10%; bottom: 10%; width: 3px; background: linear-gradient(180deg, var(--gold-bright), var(--gold-deep)); border-radius: 0 2px 2px 0; }
.rail-spacer { flex: 1; }
.rail-user { padding: 16px 24px 0; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 4px; }
.rail-user .who { font-family: var(--font-label); font-size: 13px; color: var(--gold-deep); letter-spacing: 0.04em; }
.rail-user a { font-size: 12px; color: var(--text-faint); text-decoration: none; }
.rail-user a:hover { color: var(--text-dim); }

.stage { flex: 1; padding: 40px 44px 80px; max-width: 1180px; }
.panel { display: none; animation: fadein .35s ease; }
.panel.active { display: block; }
@keyframes fadein { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.panel-head { margin-bottom: 26px; position: relative; }
.panel-title { font-family: var(--font-display); font-weight: 600; font-size: 34px; margin: 0; color: var(--ink); }
.btn-gold { position: absolute; right: 0; top: 0; font-family: var(--font-label); font-size: 12px; letter-spacing: 0.06em; text-transform: uppercase; background: linear-gradient(135deg, var(--gold-bright), var(--gold-deep)); color: #fffdf6; border: none; border-radius: 8px; padding: 10px 18px; font-weight: 600; cursor: pointer; text-decoration: none; display: inline-block; transition: transform .15s ease, box-shadow .15s ease; box-shadow: var(--shadow-soft); }
.btn-gold:hover { transform: translateY(-1px); box-shadow: 0 10px 22px -10px rgba(176,137,74,0.6); }
.hint { color: var(--text-faint); font-size: 13px; line-height: 1.5; }

.toolbar { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 22px; }
.toolbar input[type="search"], .toolbar select, .toolbar input[type="text"] { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; color: var(--text); padding: 9px 12px; font-family: var(--font-body); font-size: 13.5px; box-shadow: var(--shadow-soft); }
.toolbar input[type="search"] { flex: 1; min-width: 200px; }
.toolbar select:focus, .toolbar input:focus { outline: 1px solid var(--gold); border-color: var(--gold); }

#weather-eyebrow { font-size: 12px; }
.pick-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 18px; margin-bottom: 40px; }
.pick-card { background: linear-gradient(160deg, var(--surface) 0%, var(--surface-2) 100%); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow-lift); position: relative; overflow: hidden; }
.pick-card::after { content: ''; position: absolute; top: -40%; right: -30%; width: 160px; height: 160px; border-radius: 50%; background: radial-gradient(circle, rgba(201,168,96,0.18), transparent 70%); }
.pick-card h4 { font-family: var(--font-display); font-size: 20px; margin: 0 0 2px; font-weight: 600; position: relative; color: var(--ink); }
.pick-card .brand { color: var(--gold-deep); font-size: 12px; letter-spacing: 0.04em; margin-bottom: 10px; position: relative; }
.pick-card .why { color: var(--text-dim); font-size: 13px; line-height: 1.5; margin-bottom: 14px; position: relative; }
.pick-card .accord-dots { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; position: relative; }
.subsection { margin-top: 44px; }
.subsection h3 { font-family: var(--font-display); font-size: 22px; font-weight: 600; margin: 0 0 4px; color: var(--ink); }

.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }
.frag-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; cursor: pointer; transition: border-color .15s ease, transform .15s ease, box-shadow .15s ease; display: flex; flex-direction: column; gap: 8px; box-shadow: var(--shadow-soft); }
.frag-card:hover { border-color: var(--border-bright); transform: translateY(-2px); box-shadow: var(--shadow-lift); }
.frag-card h4 { font-family: var(--font-display); font-size: 18px; margin: 0; font-weight: 600; color: var(--ink); }
.frag-card .brand { font-size: 11.5px; color: var(--gold-deep); text-transform: uppercase; letter-spacing: 0.05em; }
.frag-card .clone-of { font-size: 12px; color: var(--text-faint); font-style: italic; }
.frag-card .meta-row { display: flex; justify-content: space-between; align-items: center; margin-top: 4px; font-size: 12px; color: var(--text-dim); }
.rating-pill { background: var(--gold-soft); color: var(--gold-deep); border-radius: 20px; padding: 2px 9px; font-size: 12px; font-weight: 600; }
.accord-dots span { display: inline-block; padding: 3px 9px; border-radius: 20px; font-size: 10.5px; background: var(--surface-3); color: var(--text-dim); border: 1px solid var(--border); }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 28px; }
.stat-tile { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow-soft); }
.stat-tile .num { font-family: var(--font-display); font-size: 32px; font-weight: 600; color: var(--gold-deep); }
.stat-tile .lbl { font-size: 12px; color: var(--text-dim); margin-top: 4px; }
.chart-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 20px; margin-bottom: 24px; }
.chart-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow-soft); }
.chart-card h4 { font-family: var(--font-display); margin: 0 0 12px; font-size: 16px; font-weight: 600; color: var(--ink); }
.gem-card { background: linear-gradient(135deg, var(--gold-soft), var(--surface)); border: 1px solid var(--border-bright); border-radius: var(--radius); padding: 20px; margin-top: 8px; box-shadow: var(--shadow-soft); }
.gem-card .eyebrow { margin-bottom: 8px; }

.modal-overlay { position: fixed; inset: 0; background: rgba(60, 48, 25, 0.35); backdrop-filter: blur(3px); display: flex; align-items: flex-start; justify-content: center; padding: 40px 16px; z-index: 50; overflow-y: auto; }
.modal { background: linear-gradient(160deg, var(--surface), var(--surface-2)); border: 1px solid var(--border-bright); border-radius: var(--radius); width: min(640px, 100%); padding: 28px 30px; box-shadow: var(--shadow-lift); position: relative; }
.modal-close { position: absolute; top: 16px; right: 18px; background: none; border: none; color: var(--text-dim); font-size: 20px; cursor: pointer; line-height: 1; }
.modal-close:hover { color: var(--ink); }
.modal h2 { font-family: var(--font-display); font-size: 26px; margin: 0 0 2px; font-weight: 600; color: var(--ink); }
.modal .brand { color: var(--gold-deep); font-size: 13px; margin-bottom: 14px; }
.modal-section { margin: 16px 0; }
.modal-section h5 { font-family: var(--font-label); font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-faint); margin: 0 0 6px; }
.notes-line { font-size: 13.5px; color: var(--text-dim); line-height: 1.6; }
.rating-row { display: flex; justify-content: space-between; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--border); }
.rating-row:last-child { border-bottom: none; }
.stars { color: var(--gold-deep); font-family: var(--font-display); font-weight: 600; }
.consumption-bar { height: 8px; border-radius: 6px; background: var(--surface-3); overflow: hidden; margin: 6px 0; border: 1px solid var(--border); }
.consumption-fill { height: 100%; background: linear-gradient(90deg, var(--ember), var(--gold-bright)); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-grid .full { grid-column: 1 / -1; }
.form-grid label { display: flex; flex-direction: column; gap: 5px; font-size: 12px; color: var(--text-dim); }
.form-grid input, .form-grid select, .form-grid textarea { background: var(--bg); border: 1px solid var(--border); border-radius: 7px; color: var(--text); padding: 8px 10px; font-family: var(--font-body); font-size: 13.5px; }
.form-grid input:focus, .form-grid select:focus, .form-grid textarea:focus { outline: 1px solid var(--gold); border-color: var(--gold); }
.chip-toggle { display: flex; flex-wrap: wrap; gap: 6px; }
.chip-toggle button { background: var(--surface-3); border: 1px solid var(--border); color: var(--text-dim); border-radius: 20px; padding: 5px 12px; font-size: 12px; cursor: pointer; }
.chip-toggle button.on { background: var(--gold-soft); border-color: var(--gold); color: var(--gold-deep); font-weight: 600; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; flex-wrap: wrap; }
.btn-ghost { background: var(--surface); border: 1px solid var(--border); color: var(--text-dim); border-radius: 8px; padding: 9px 16px; cursor: pointer; font-family: var(--font-body); font-size: 13px; }
.btn-ghost:hover { border-color: var(--border-bright); color: var(--ink); }
.btn-danger { background: none; border: 1px solid rgba(181,98,63,0.45); color: var(--ember); border-radius: 8px; padding: 9px 16px; cursor: pointer; font-family: var(--font-body); font-size: 13px; }
.btn-danger:hover { background: rgba(181,98,63,0.08); }

.seg { display: flex; gap: 8px; }
.seg button { background: var(--surface); border: 1px solid var(--border); color: var(--text-dim); border-radius: 20px; padding: 7px 16px; font-size: 13px; cursor: pointer; }
.seg button.on { background: var(--gold-soft); border-color: var(--gold); color: var(--gold-deep); font-weight: 600; }
.log-list { display: flex; flex-direction: column; gap: 8px; }
.log-row { display: flex; justify-content: space-between; align-items: center; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 10px 16px; font-size: 13.5px; box-shadow: var(--shadow-soft); }
.log-row button { background: none; border: none; color: var(--text-faint); cursor: pointer; font-size: 16px; }
.log-row button:hover { color: var(--ember); }

.match-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; }
.match-col h3 { font-family: var(--font-display); font-size: 18px; margin: 0 0 10px; color: var(--ink); }
.match-col input { width: 100%; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; color: var(--text); padding: 9px 12px; margin-bottom: 14px; font-family: var(--font-body); box-shadow: var(--shadow-soft); }
.compare-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.compare-col { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow-soft); }
.compare-col h4 { font-family: var(--font-display); font-size: 20px; margin: 0 0 4px; color: var(--ink); }
.compare-row { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.compare-row span:first-child { color: var(--text-faint); }
.compare-row span:last-child { text-align: right; color: var(--text); max-width: 60%; }

.admin-block { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px 24px; margin-bottom: 20px; box-shadow: var(--shadow-soft); }
.admin-block h3 { font-family: var(--font-display); font-size: 18px; margin: 0 0 6px; color: var(--ink); }
.admin-block textarea { width: 100%; background: var(--bg); border: 1px solid var(--border); border-radius: 8px; color: var(--text); padding: 10px 12px; font-family: monospace; font-size: 12.5px; margin: 12px 0; }
.admin-block code { background: var(--surface-3); padding: 1px 5px; border-radius: 4px; font-size: 11.5px; }
.empty-state { text-align: center; padding: 50px 20px; color: var(--text-faint); border: 1px dashed var(--border-bright); border-radius: var(--radius); background: var(--surface-2); }
.empty-state h4 { font-family: var(--font-display); color: var(--text-dim); font-size: 18px; margin: 0 0 6px; }

@media (max-width: 900px) {
  .shell { flex-direction: column; }
  .rail { position: static; width: 100%; height: auto; flex-direction: row; overflow-x: auto; padding: 14px 0; align-items: center; }
  .rail-brand { display: none; }
  .rail-tab { padding: 8px 14px; white-space: nowrap; }
  .rail-tab.active::before { display: none; }
  .rail-spacer { display: none; }
  .rail-user { border-top: none; border-left: 1px solid var(--border); padding: 0 16px; flex-direction: row; align-items: center; gap: 10px; }
  .stage { padding: 24px 18px 60px; }
  .form-grid { grid-template-columns: 1fr; }
  .match-grid, .compare-grid { grid-template-columns: 1fr; }
  .btn-gold { position: static; margin-top: 10px; }
}
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

/* scent preference toggle on today panel */
.pref-row { display: flex; align-items: center; gap: 12px; margin-top: 14px; }
.pref-label { font-size: 12.5px; color: var(--text-dim); font-family: var(--font-body); }
@media (max-width: 900px) { .pref-row { flex-wrap: wrap; } }

/* rating editor in detail modal */
.rate-box { background: var(--gold-soft); border: 1px solid var(--border-bright); border-radius: var(--radius); padding: 16px 18px; }
.rate-editor { margin-top: 12px; }
.rate-label { font-size: 12.5px; color: var(--text-dim); margin-bottom: 7px; font-weight: 600; }
.rate-scale { display: flex; gap: 5px; flex-wrap: wrap; }
.rate-num {
  width: 34px; height: 34px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text-dim); font-family: var(--font-display); font-size: 15px; font-weight: 600;
  cursor: pointer; transition: all .12s ease;
}
.rate-num:hover { border-color: var(--gold); color: var(--gold-deep); transform: translateY(-1px); }
.rate-num.on { background: linear-gradient(135deg, var(--gold-bright), var(--gold-deep)); color: #fffdf6; border-color: var(--gold-deep); }
.repurchase-seg button { min-width: 64px; }
.rate-comment-input {
  width: 100%; margin-top: 12px; background: var(--surface); border: 1px solid var(--border); border-radius: 8px;
  color: var(--text); padding: 9px 12px; font-family: var(--font-body); font-size: 13.5px;
}
.rate-comment-input:focus { outline: 1px solid var(--gold); border-color: var(--gold); }
.repurchase-yes { color: var(--sage); font-size: 11.5px; font-weight: 600; }
.repurchase-no { color: var(--text-faint); font-size: 11.5px; }

/* primary accord highlight on cards */
.accord-dots span.accord-primary {
  background: linear-gradient(135deg, var(--gold-bright), var(--gold)); color: #fffdf6; border-color: var(--gold-deep); font-weight: 600;
}

/* tones management tab */
.tones-add { display: flex; gap: 10px; margin-bottom: 22px; flex-wrap: wrap; }
.tones-add input { flex: 1; min-width: 220px; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; color: var(--text); padding: 10px 12px; font-family: var(--font-body); font-size: 14px; box-shadow: var(--shadow-soft); }
.tones-add input:focus { outline: 1px solid var(--gold); border-color: var(--gold); }
.tones-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px; }
.tone-chip { display: flex; align-items: center; gap: 8px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 10px 14px; box-shadow: var(--shadow-soft); }
.tone-name { font-family: var(--font-display); font-size: 15px; color: var(--ink); flex: 1; }
.tone-used { font-size: 11px; color: var(--text-faint); }
.tone-del { background: none; border: none; color: var(--text-faint); cursor: pointer; font-size: 14px; padding: 2px 4px; }
.tone-del:hover { color: var(--ember); }
