:root {
    --bg: #faf6f1;
    --surface: #ffffff;
    --text: #2b2330;
    --muted: #7a6f7f;
    --border: #ece4dc;
    --primary: #c8385a;
    --primary-dark: #a52a48;
    --primary-soft: #fbe8ed;
    --gold: #f2a900;
    --ok: #2f8f5b;
    --ok-soft: #e3f4ea;
    --danger: #c0392b;
    --danger-soft: #fdecea;
    --info-soft: #e8f0fb;
    --radius: 14px;
    --shadow: 0 1px 2px rgba(43, 35, 48, .05), 0 4px 16px rgba(43, 35, 48, .06);
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--bg); color: var(--text); line-height: 1.5; }
a { color: var(--primary); }
a:hover { color: var(--primary-dark); }
h1, h2, h3, h4 { line-height: 1.25; margin: 0 0 .6em; }
h1 { font-size: 1.9rem; }
h2 { font-size: 1.3rem; }
h3 { font-size: 1.1rem; }
p { margin: 0 0 .8em; }
.container { max-width: 1100px; margin: 0 auto; padding: 0 1.25rem; }

/* ---------- Header / footer ---------- */
.site-header { background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 10; }
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 1rem; min-height: 60px; flex-wrap: wrap; }
.brand { font-weight: 700; font-size: 1.15rem; color: var(--text); text-decoration: none; }
.nav { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.nav a { color: var(--muted); text-decoration: none; font-weight: 500; }
.nav a.active, .nav a:hover { color: var(--primary); }
.nav a.btn { color: #fff; }
main.container { padding-top: 1.75rem; padding-bottom: 2rem; min-height: calc(100vh - 140px); }
.site-footer { color: var(--muted); font-size: .85rem; text-align: center; padding-bottom: 1.5rem; }

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: .35em;
    background: var(--primary); color: #fff; border: 1px solid var(--primary);
    padding: .6em 1.15em; border-radius: 999px; font: inherit; font-weight: 600;
    text-decoration: none; cursor: pointer; transition: background .15s, transform .05s;
}
.btn:hover { background: var(--primary-dark); color: #fff; }
.btn:active { transform: translateY(1px); }
.btn-small { padding: .35em .85em; font-size: .88rem; }
.btn-ghost { background: transparent; color: var(--primary); }
.btn-ghost:hover { background: var(--primary-soft); color: var(--primary-dark); }
.btn-danger { background: var(--danger); border-color: var(--danger); }
.btn-danger:hover { background: #a93226; }
button.link { background: none; border: 0; padding: 0; font: inherit; color: var(--muted); cursor: pointer; text-decoration: underline; }
button.link:hover { color: var(--primary); }
.icon-btn {
    display: inline-flex; align-items: center; justify-content: center;
    width: 2.1rem; height: 2.1rem; border-radius: 50%;
    border: 1px solid var(--border); background: var(--surface); cursor: pointer;
    font-size: 1rem; text-decoration: none; color: var(--text); line-height: 1;
}
.icon-btn:hover { background: var(--primary-soft); border-color: var(--primary-soft); }
.icon-btn.small { width: 1.7rem; height: 1.7rem; font-size: .8rem; }
.icon-btn.danger:hover { background: var(--danger-soft); border-color: var(--danger-soft); }
.star { color: #c9bfb5; font-size: 1.15rem; }
.star.on { color: var(--gold); }
form.inline { display: inline; margin: 0; }

/* ---------- Cards & layout ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.35rem; margin-bottom: 1.25rem; }
.card.narrow { max-width: 440px; margin: 1rem auto; }
.narrow-wide { max-width: 720px; margin: 0 auto; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 1.25rem; margin-bottom: 1.5rem; }
.cards .card { margin-bottom: 0; }
.card-link { display: block; color: inherit; text-decoration: none; transition: transform .15s, box-shadow .15s; }
.card-link:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(43, 35, 48, .1); color: inherit; }
.card-link h3 { color: var(--primary); }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.page-head h1 { margin: 0; }
.layout-2 { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 1.5rem; align-items: start; }
.col-side { position: sticky; top: 80px; }
.breadcrumb { margin-bottom: .5rem; font-size: .9rem; }
.breadcrumb a { text-decoration: none; }
.actions { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin-top: .75rem; }
.danger-zone { border-color: #f3c7c2; }

.hero { text-align: center; padding: 2.5rem 1rem 2rem; }
.hero h1 { font-size: 2.3rem; }
.hero p { color: var(--muted); max-width: 560px; margin-left: auto; margin-right: auto; }
.hero-actions { display: flex; gap: .75rem; justify-content: center; flex-wrap: wrap; margin-top: 1.25rem; }
.list-hero { margin-bottom: 1.25rem; }
.list-hero h1 { margin-bottom: .2em; }

/* ---------- Text helpers ---------- */
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.center { text-align: center; }
.hint { color: var(--muted); font-size: .85rem; }
.empty { color: var(--muted); font-style: italic; padding: 1rem 0; }
.desc { color: var(--text); white-space: pre-line; }
.stats { display: flex; gap: .5rem; flex-wrap: wrap; margin: 0; }
.stats span { background: var(--bg); border: 1px solid var(--border); border-radius: 999px; padding: .1em .7em; font-size: .82rem; color: var(--muted); }
.count { background: var(--primary-soft); color: var(--primary); border-radius: 999px; padding: .05em .6em; font-size: .85rem; vertical-align: middle; }
.badge { display: inline-block; font-size: .75rem; font-weight: 600; padding: .15em .6em; border-radius: 999px; background: #eee7f0; color: var(--muted); vertical-align: middle; }
.badge-ok { background: var(--ok-soft); color: var(--ok); }
.badge-reserved { background: var(--ok-soft); color: var(--ok); font-size: .82rem; }

/* ---------- Flash ---------- */
.flash { padding: .8rem 1rem; border-radius: 10px; margin-bottom: 1rem; border: 1px solid transparent; transition: opacity .4s; }
.flash ul { margin: 0; padding-left: 1.2rem; }
.flash-success { background: var(--ok-soft); border-color: #bfe5cf; color: #1f6b42; }
.flash-error { background: var(--danger-soft); border-color: #f5c6c0; color: #922b21; }
.flash-info { background: var(--info-soft); border-color: #c9dbf3; color: #234a7d; }

/* ---------- Forms ---------- */
.stack { display: flex; flex-direction: column; gap: .9rem; }
.field { display: flex; flex-direction: column; gap: .3rem; }
.field > span { font-weight: 600; font-size: .9rem; }
.field em { color: var(--primary); font-style: normal; }
.field small { font-weight: 400; color: var(--muted); }
input[type=text], input[type=email], input[type=password], input[type=url], select, textarea {
    width: 100%; font: inherit; color: inherit; background: #fff;
    border: 1px solid var(--border); border-radius: 10px; padding: .55em .75em;
    transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
textarea { resize: vertical; }
.check { display: inline-flex; align-items: center; gap: .45rem; cursor: pointer; }
.check input { width: 1.05rem; height: 1.05rem; accent-color: var(--primary); }
.checks { display: flex; gap: 1.25rem; flex-wrap: wrap; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: .9rem; margin-bottom: 1rem; }
.span-2 { grid-column: span 2; }

.share { display: flex; gap: .5rem; margin-bottom: .5rem; }
.share input { font-size: .85rem; color: var(--muted); }

/* ---------- Categories ---------- */
.cat-list { list-style: none; padding: 0; margin: 0 0 1rem; }
.cat-list li { display: flex; align-items: flex-start; justify-content: space-between; gap: .5rem; padding: .45rem 0; border-bottom: 1px solid var(--border); }
.cat-list details { flex: 1; min-width: 0; }
.cat-list summary { cursor: pointer; font-weight: 500; }
.cat-actions { display: flex; gap: .25rem; flex-shrink: 0; }
.cat-rename, .cat-add { display: flex; gap: .4rem; margin-top: .4rem; }

/* ---------- Gifts ---------- */
.group { margin-bottom: 1.5rem; }
.group-title { font-size: 1rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); border-bottom: 2px solid var(--border); padding-bottom: .35rem; margin-bottom: .8rem; }
.gift {
    display: flex; justify-content: space-between; gap: 1rem; align-items: flex-start;
    background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--border);
    border-radius: var(--radius); padding: 1rem 1.1rem; margin-bottom: .75rem; box-shadow: var(--shadow);
}
.gift.is-fav { border-left-color: var(--gold); }
.gift.is-hidden { opacity: .6; background: repeating-linear-gradient(-45deg, #fff, #fff 10px, #faf7f4 10px, #faf7f4 20px); }
.gift-body { min-width: 0; flex: 1; }
.gift-title { font-size: 1.05rem; margin-bottom: .3rem; overflow-wrap: anywhere; }
.gift-meta { display: flex; gap: 1rem; flex-wrap: wrap; align-items: center; margin-bottom: .3rem; font-size: .92rem; }
.price { font-weight: 700; color: var(--text); }
.gift-comment { color: var(--muted); font-size: .92rem; margin: 0; overflow-wrap: anywhere; }
.gift-actions { display: flex; gap: .35rem; flex-shrink: 0; }

.gift-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 1rem; }
.gift.public { flex-direction: column; margin: 0; }
.gift.public .gift-status { width: 100%; display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; margin-top: auto; padding-top: .6rem; border-top: 1px dashed var(--border); }
.gift.is-reserved { background: #fbfaf8; }
.gift.is-reserved .gift-title { color: var(--muted); }
.reserve summary { list-style: none; }
.reserve summary::-webkit-details-marker { display: none; }
.reserve[open] summary { display: none; }
.reserve-form { display: flex; gap: .4rem; }

/* ---------- Filters ---------- */
.filters { display: flex; flex-direction: column; gap: .5rem; margin-bottom: 1.5rem; padding: .9rem 1rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.filter-group { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; }
.chip { display: inline-block; padding: .3em .85em; border-radius: 999px; border: 1px solid var(--border); background: var(--bg); color: var(--text); text-decoration: none; font-size: .88rem; }
.chip:hover { border-color: var(--primary); color: var(--primary); }
.chip.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.chip-reset { color: var(--muted); background: transparent; }
.sep { width: 1px; height: 1.4rem; background: var(--border); margin: 0 .3rem; }

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
    .layout-2 { grid-template-columns: 1fr; }
    .col-side { position: static; order: -1; }
}
@media (max-width: 560px) {
    h1 { font-size: 1.5rem; }
    .hero h1 { font-size: 1.8rem; }
    .grid-2 { grid-template-columns: 1fr; }
    .span-2 { grid-column: auto; }
    .gift { flex-direction: column; }
    .gift-actions { align-self: flex-end; }
    .gift-grid { grid-template-columns: 1fr; }
    .sep { display: none; }
}
