:root {
  --bg: #f7f3ee; --surface: #ffffff; --surface-2: #f1ebe3; --border: #e3dacd;
  --text: #2a2220; --muted: #75685f; --faint: #a3968b;
  --accent: #7a3e5c; --accent-2: #a45a7d; --accent-soft: #f3e6ec; --on-accent: #fff;
  --official: #2f5d8a; --official-soft: #e5eef7;
  --confirmed: #2f7a55; --confirmed-soft: #e3f2ea;
  --verified: #6b4fb3; --verified-soft: #ece7f8;
  --voting: #a1661b; --voting-soft: #faf0e0;
  --danger: #b3423b; --danger-soft: #f9e5e3;
  --shadow: 0 1px 2px rgba(40, 25, 15, .06), 0 4px 16px rgba(40, 25, 15, .05);
  --radius: 14px;
  --serif: "Fraunces", Georgia, "Times New Roman", serif;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #17120f; --surface: #211a16; --surface-2: #2a221d; --border: #3a3029;
    --text: #f1e9e2; --muted: #b3a69b; --faint: #7e7168;
    --accent: #d08aac; --accent-2: #e2a3c2; --accent-soft: #3a2430; --on-accent: #1a1013;
    --official: #8bb6e0; --official-soft: #1e2b39;
    --confirmed: #79c79f; --confirmed-soft: #1b3127;
    --verified: #b9a4ee; --verified-soft: #2a2340;
    --voting: #e0ad62; --voting-soft: #3a2c17;
    --danger: #ee8a83; --danger-soft: #3d1e1c;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 16px rgba(0, 0, 0, .25);
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { overflow-x: hidden; background: var(--bg); color: var(--text); font: 15px/1.5 var(--sans); -webkit-font-smoothing: antialiased; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 { font-family: var(--serif); font-weight: 600; letter-spacing: -.01em; margin: 0; }
.wrap { max-width: 1080px; margin: 0 auto; padding: 0 16px; }

/* header */
.topbar { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--border); }
.topbar .wrap { display: flex; align-items: center; gap: 16px; height: 58px; }
.brand { font-family: var(--serif); font-size: 19px; font-weight: 600; color: var(--text); display: flex; align-items: center; gap: 8px; }
.brand:hover { text-decoration: none; }
.brand .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.nav { display: flex; gap: 4px; margin-left: auto; align-items: center; flex-wrap: wrap; }
.nav a { padding: 6px 10px; border-radius: 8px; color: var(--muted); font-size: 14px; }
.nav a.active, .nav a:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
@media (max-width: 640px) { .brand span.full { display: none; } .nav a { padding: 6px 7px; font-size: 13px; } }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid var(--border); background: var(--surface); padding: 8px 14px; border-radius: 10px; cursor: pointer; font-weight: 500; font-size: 14px; transition: background .15s, border-color .15s, transform .05s; }
.btn:hover { background: var(--surface-2); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn.primary:hover { background: var(--accent-2); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.danger { color: var(--danger); }
.btn.sm { padding: 5px 10px; font-size: 13px; border-radius: 8px; }
.btn.block { width: 100%; }

/* cards & layout */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.pad { padding: 20px; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: 13px; }
.eyebrow { font-size: 11.5px; letter-spacing: .12em; text-transform: uppercase; font-weight: 600; color: var(--muted); }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
.grid { display: grid; gap: 14px; }
.page { padding-top: 24px; padding-bottom: 64px; }
.stack > * + * { margin-top: 14px; }

/* perfume list */
.perfume-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(280px, 100%), 1fr)); gap: 14px; }
.perfume-card { padding: 18px; display: block; color: inherit; transition: transform .15s, box-shadow .15s; }
.perfume-card:hover { text-decoration: none; transform: translateY(-2px); }
.perfume-card h3 { font-size: 20px; margin: 4px 0 6px; }
.search { width: 100%; padding: 11px 14px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface); }
.search:focus, input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; }

/* perfume detail */
.hero { padding: 26px; display: grid; gap: 22px; grid-template-columns: 1.5fr 1fr; }
@media (max-width: 800px) { .hero { grid-template-columns: minmax(0, 1fr); padding: 18px; } }
.hero h1 { font-size: clamp(28px, 5vw, 40px); line-height: 1.1; margin: 6px 0 4px; }
.pill { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: 999px; background: var(--surface-2); color: var(--muted); white-space: nowrap; }
.pill.live::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--confirmed); }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.stat { background: var(--surface-2); border-radius: 12px; padding: 12px 14px; }
.stat b { display: block; font-family: var(--serif); font-size: 26px; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat span { font-size: 12px; color: var(--muted); }
.disclaimer { font-size: 12.5px; color: var(--muted); background: var(--surface-2); border-radius: 10px; padding: 10px 12px; border-left: 3px solid var(--accent); }

.filters { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: thin; }
.chip { border: 1px solid var(--border); background: var(--surface); padding: 6px 12px; border-radius: 999px; font-size: 13px; cursor: pointer; white-space: nowrap; color: var(--muted); }
.chip.on { background: var(--text); color: var(--bg); border-color: var(--text); }

.layer { margin-top: 26px; }
.layer-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 10px; border-bottom: 1px solid var(--border); padding-bottom: 8px; }
.layer-head h2 { font-size: 20px; }
.notes { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr)); gap: 12px; }
@media (max-width: 420px) { .notes { grid-template-columns: 1fr; } }
.note { padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; }
.note .top { display: flex; gap: 10px; align-items: flex-start; }
.note .name { font-family: var(--serif); font-size: 18px; font-weight: 600; background: none; border: 0; padding: 0; cursor: pointer; text-align: left; color: var(--text); }
.note .name:hover { color: var(--accent); }
.note .family { font-size: 12.5px; color: var(--muted); }
.pct { margin-left: auto; text-align: right; }
.pct b { font-family: var(--serif); font-size: 24px; line-height: 1; font-variant-numeric: tabular-nums; }
.pct span { display: block; font-size: 11.5px; color: var(--muted); }
.bar { height: 6px; border-radius: 99px; background: var(--danger-soft); overflow: hidden; display: flex; }
.bar i { display: block; height: 100%; background: var(--confirmed); transition: width .3s; }
.bar.empty { background: var(--surface-2); }
.badges { display: flex; gap: 6px; flex-wrap: wrap; }
.badge { font-size: 11.5px; font-weight: 600; padding: 2px 8px; border-radius: 6px; white-space: nowrap; }
.b-official { background: var(--official-soft); color: var(--official); }
.b-community_confirmed { background: var(--confirmed-soft); color: var(--confirmed); }
.b-admin_verified { background: var(--verified-soft); color: var(--verified); }
.b-voting, .b-suggested { background: var(--voting-soft); color: var(--voting); }
.b-needs_revision { background: var(--voting-soft); color: var(--voting); }
.b-rejected, .b-archived { background: var(--danger-soft); color: var(--danger); }
.b-community { background: var(--accent-soft); color: var(--accent); }
.b-neutral { background: var(--surface-2); color: var(--muted); }
.vote { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.vote button { border: 1px solid var(--border); background: var(--surface); border-radius: 10px; padding: 8px; cursor: pointer; font-weight: 500; font-size: 13.5px; display: flex; align-items: center; justify-content: center; gap: 6px; }
.vote button:hover:not(:disabled) { background: var(--surface-2); }
.vote button.on.yes { background: var(--confirmed); border-color: var(--confirmed); color: var(--bg); }
.vote button.on.no { background: var(--danger); border-color: var(--danger); color: var(--bg); }
.vote button:disabled { opacity: .55; cursor: not-allowed; }
.note .foot { font-size: 12px; color: var(--muted); }
.note .more { font-size: 13px; color: var(--muted); border-top: 1px dashed var(--border); padding-top: 8px; }
.note.flash { animation: flash 1.2s ease; }
@keyframes flash { 0%, 40% { box-shadow: 0 0 0 3px var(--accent); } 100% { box-shadow: var(--shadow); } }
.empty-layer { padding: 16px; border: 1px dashed var(--border); border-radius: 12px; color: var(--muted); font-size: 14px; }

/* modal */
.overlay { position: fixed; inset: 0; background: rgba(20, 12, 8, .45); display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 50; animation: fade .15s; }
@keyframes fade { from { opacity: 0; } }
.modal { width: min(520px, 100%); max-height: calc(100vh - 32px); overflow: auto; padding: 22px; }
.modal.wide { width: min(860px, 100%); }
.modal h2 { font-size: 22px; margin-bottom: 4px; }
.modal-x { float: right; background: none; border: 0; font-size: 22px; cursor: pointer; color: var(--muted); line-height: 1; }
label.f { display: block; font-size: 13px; font-weight: 600; margin: 12px 0 5px; }
.inp, select.inp, textarea.inp { width: 100%; padding: 9px 12px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); }
textarea.inp { min-height: 80px; resize: vertical; }
.steps { display: flex; gap: 6px; margin: 12px 0 16px; }
.steps i { flex: 1; height: 4px; border-radius: 4px; background: var(--surface-2); }
.steps i.on { background: var(--accent); }
.choice { display: grid; gap: 8px; }
.choice button { text-align: left; border: 1px solid var(--border); background: var(--surface); padding: 12px 14px; border-radius: 12px; cursor: pointer; }
.choice button:hover { border-color: var(--accent); }
.choice button.on { border-color: var(--accent); background: var(--accent-soft); }
.choice button:disabled { opacity: .5; cursor: not-allowed; }
.choice b { display: block; }
.result-list { max-height: 260px; overflow: auto; margin-top: 8px; }
.err { color: var(--danger); font-size: 13.5px; margin-top: 10px; }
.notice { background: var(--surface-2); border-radius: 10px; padding: 10px 12px; font-size: 13.5px; margin-top: 10px; }

/* toast */
#toasts { position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%); display: grid; gap: 8px; z-index: 60; width: min(420px, calc(100% - 32px)); }
.toast { background: var(--text); color: var(--bg); padding: 10px 14px; border-radius: 10px; font-size: 14px; box-shadow: var(--shadow); animation: fade .2s; }
.toast.error { background: var(--danger); color: #fff; }

/* tables */
.table-wrap { overflow-x: auto; }
table.t { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.t th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; padding: 8px 10px; border-bottom: 1px solid var(--border); white-space: nowrap; }
table.t td { padding: 9px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
table.t tr.click { cursor: pointer; }
table.t tr.click:hover td { background: var(--surface-2); }
.num { font-variant-numeric: tabular-nums; text-align: right; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 18px; overflow-x: auto; }
.tabs a { padding: 9px 12px; color: var(--muted); border-bottom: 2px solid transparent; white-space: nowrap; font-size: 14px; }
.tabs a.on { color: var(--text); border-bottom-color: var(--accent); text-decoration: none; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.tile { padding: 14px 16px; }
.tile b { display: block; font-family: var(--serif); font-size: 28px; line-height: 1.1; font-variant-numeric: tabular-nums; }
.tile span { font-size: 12.5px; color: var(--muted); }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 760px) { .two { grid-template-columns: 1fr; } }
.trend { display: flex; align-items: flex-end; gap: 4px; height: 140px; padding-top: 10px; }
.trend .col { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; height: 100%; gap: 4px; min-width: 0; }
.trend .col i { width: 100%; max-width: 26px; border-radius: 4px 4px 0 0; background: var(--accent); display: block; }
.trend .col i.chg { background: var(--voting); border-radius: 0; }
.trend .col span { font-size: 10px; color: var(--faint); }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 4px 14px; font-size: 13.5px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
.audit { font-size: 13px; }
.audit li { padding: 6px 0; border-bottom: 1px solid var(--border); list-style: none; }
.audit { padding: 0; margin: 0; }
code { font-size: 12px; background: var(--surface-2); padding: 1px 5px; border-radius: 5px; }
.hide { display: none !important; }
