/* PresentPals - one stylesheet.
   Four themes, chosen per person (Profile -> Theme). Each has a light and a dark
   version that follows the device setting. Default: evergreen.
   Festive through colour and type, not decoration. */

:root {
    --radius: 14px;
    --radius-sm: 9px;
    --font-display: "Fraunces", Georgia, "Times New Roman", serif;
    --font-body: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
}

/* ---- evergreen */
:root[data-theme="evergreen"], :root:not([data-theme]) {
    color-scheme: light;
    --paper: #f6f2e9;
    --surface: #fffdf8;
    --surface-muted: #efe8db;
    --ink: #1d2721;
    --ink-soft: #56635a;
    --ink-faint: #86918a;
    --line: #e3dacb;
    --line-strong: #d2c5b0;
    --pine: #1d4a37;
    --pine-hover: #153828;
    --pine-soft: #e3ede6;
    --on-pine: #fffdf8;
    --berry: #9b2335;
    --berry-soft: #f6e4e6;
    --gold: #a8792a;
    --gold-soft: #f3e8d0;
    --danger: #b42318;
    --header-bg: #183c2d;
    --header-ink: #f7f1e3;
    --header-muted: #c3d2c7;
    --header-hover: rgba(255,255,255,.08);
    --header-active-bg: rgba(255,255,255,.13);
    --header-active-ink: #ffffff;
    --header-rule: #c9a24f;
    --header-brand: #f7f1e3;
    --brand-ink: #1d4a37;
    --shadow-sm: 0 1px 2px rgba(31, 42, 36, 0.06);
    --shadow: 0 1px 2px rgba(31, 42, 36, 0.05), 0 6px 20px rgba(31, 42, 36, 0.07);
}
@media (prefers-color-scheme: dark) {
    :root[data-theme="evergreen"], :root:not([data-theme]) {
        color-scheme: dark;
        --paper: #0f1814;
        --surface: #15211b;
        --surface-muted: #1b2a23;
        --ink: #efe9dd;
        --ink-soft: #b1bab2;
        --ink-faint: #7f8b84;
        --line: #26372e;
        --line-strong: #34493d;
        --pine: #8fcaa9;
        --pine-hover: #a6d8bb;
        --pine-soft: #1d3329;
        --on-pine: #0f1814;
        --berry: #e8939b;
        --berry-soft: #3a2025;
        --gold: #d8b76f;
        --gold-soft: #33291a;
        --danger: #f07a6e;
        --header-bg: #0b1410;
        --header-ink: #efe9dd;
        --header-muted: #a3b0a7;
        --header-hover: rgba(255,255,255,.06);
        --header-active-bg: #1d3329;
        --header-active-ink: #a6d8bb;
        --header-rule: #d8b76f;
        --header-brand: #efe9dd;
        --brand-ink: #8fcaa9;
        --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
        --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.25);
    }
}

/* ---- midnight */
:root[data-theme="midnight"] {
    color-scheme: light;
    --paper: #f8f5ee;
    --surface: #ffffff;
    --surface-muted: #f0ebe1;
    --ink: #1a2233;
    --ink-soft: #5a6273;
    --ink-faint: #8b92a0;
    --line: #e5dfd3;
    --line-strong: #d5ccbb;
    --pine: #1b2a4a;
    --pine-hover: #121d35;
    --pine-soft: #e6eaf3;
    --on-pine: #fbf8f1;
    --berry: #a8323e;
    --berry-soft: #f7e6e7;
    --gold: #a8812f;
    --gold-soft: #f4ecda;
    --danger: #b42318;
    --header-bg: #141f38;
    --header-ink: #f5efe0;
    --header-muted: #b9c1d4;
    --header-hover: rgba(255,255,255,.07);
    --header-active-bg: rgba(217,182,100,.16);
    --header-active-ink: #f0d58e;
    --header-rule: #c9a34e;
    --header-brand: #d9b664;
    --brand-ink: #b08a3a;
    --shadow-sm: 0 1px 2px rgba(31, 42, 36, 0.06);
    --shadow: 0 1px 2px rgba(31, 42, 36, 0.05), 0 6px 20px rgba(31, 42, 36, 0.07);
}
@media (prefers-color-scheme: dark) {
    :root[data-theme="midnight"] {
        color-scheme: dark;
        --paper: #0e1322;
        --surface: #151c2f;
        --surface-muted: #1c2540;
        --ink: #efe9da;
        --ink-soft: #aeb5c6;
        --ink-faint: #7d8597;
        --line: #252f49;
        --line-strong: #334061;
        --pine: #dcbc6e;
        --pine-hover: #e8cb85;
        --pine-soft: #2c2a22;
        --on-pine: #0e1322;
        --berry: #e88d97;
        --berry-soft: #3b2129;
        --gold: #dcbc6e;
        --gold-soft: #2c2a22;
        --danger: #f07a6e;
        --header-bg: #0a0f1b;
        --header-ink: #efe9da;
        --header-muted: #a3abbd;
        --header-hover: rgba(255,255,255,.06);
        --header-active-bg: rgba(220,188,110,.14);
        --header-active-ink: #ecd08e;
        --header-rule: #dcbc6e;
        --header-brand: #dcbc6e;
        --brand-ink: #dcbc6e;
        --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
        --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.25);
    }
}

/* ---- nordic */
:root[data-theme="nordic"] {
    color-scheme: light;
    --paper: #f5f6f4;
    --surface: #ffffff;
    --surface-muted: #eceeeb;
    --ink: #1f2523;
    --ink-soft: #5c6662;
    --ink-faint: #8b9490;
    --line: #e1e5e2;
    --line-strong: #cdd3cf;
    --pine: #a51f2d;
    --pine-hover: #8a1824;
    --pine-soft: #f8e7e8;
    --on-pine: #ffffff;
    --berry: #2d5244;
    --berry-soft: #e2ece7;
    --gold: #3d6b58;
    --gold-soft: #e4efe9;
    --danger: #b42318;
    --header-bg: #ffffff;
    --header-ink: #1f2523;
    --header-muted: #5c6662;
    --header-hover: #f1f2f0;
    --header-active-bg: #f8e7e8;
    --header-active-ink: #a51f2d;
    --header-rule: #a51f2d;
    --header-brand: #a51f2d;
    --brand-ink: #a51f2d;
    --shadow-sm: 0 1px 2px rgba(31, 42, 36, 0.06);
    --shadow: 0 1px 2px rgba(31, 42, 36, 0.05), 0 6px 20px rgba(31, 42, 36, 0.07);
}
@media (prefers-color-scheme: dark) {
    :root[data-theme="nordic"] {
        color-scheme: dark;
        --paper: #131615;
        --surface: #1b1f1e;
        --surface-muted: #232827;
        --ink: #eef0ee;
        --ink-soft: #aeb5b1;
        --ink-faint: #7e8783;
        --line: #2b3130;
        --line-strong: #3a4240;
        --pine: #d9434f;
        --pine-hover: #e35b66;
        --pine-soft: #3a1e22;
        --on-pine: #ffffff;
        --berry: #8cc2aa;
        --berry-soft: #1f3229;
        --gold: #8cc2aa;
        --gold-soft: #1f3229;
        --danger: #f07a6e;
        --header-bg: #1b1f1e;
        --header-ink: #eef0ee;
        --header-muted: #a1a9a5;
        --header-hover: rgba(255,255,255,.06);
        --header-active-bg: #3a1e22;
        --header-active-ink: #f0838c;
        --header-rule: #d9434f;
        --header-brand: #e35b66;
        --brand-ink: #e35b66;
        --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
        --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.25);
    }
}

/* ---- candlelight */
:root[data-theme="candlelight"] {
    color-scheme: light;
    --paper: #faf4ea;
    --surface: #fffaf2;
    --surface-muted: #f2e8d8;
    --ink: #2b211a;
    --ink-soft: #6b5b4b;
    --ink-faint: #9a8a78;
    --line: #eadfcc;
    --line-strong: #dccdb4;
    --pine: #3a2a1f;
    --pine-hover: #2a1e16;
    --pine-soft: #f1e5d2;
    --on-pine: #fff8ec;
    --berry: #b23a4b;
    --berry-soft: #f8e5e7;
    --gold: #a77b26;
    --gold-soft: #f5e9cf;
    --danger: #b42318;
    --header-bg: #2a201a;
    --header-ink: #f6ecdc;
    --header-muted: #cbbba5;
    --header-hover: rgba(255,255,255,.07);
    --header-active-bg: rgba(226,181,99,.16);
    --header-active-ink: #f0c879;
    --header-rule: #e2b563;
    --header-brand: #f6ecdc;
    --brand-ink: #3a2a1f;
    --shadow-sm: 0 1px 2px rgba(31, 42, 36, 0.06);
    --shadow: 0 1px 2px rgba(31, 42, 36, 0.05), 0 6px 20px rgba(31, 42, 36, 0.07);
}
@media (prefers-color-scheme: dark) {
    :root[data-theme="candlelight"] {
        color-scheme: dark;
        --paper: #1c1714;
        --surface: #26201b;
        --surface-muted: #302821;
        --ink: #f3eadb;
        --ink-soft: #c4b8a6;
        --ink-faint: #8f8476;
        --line: #3a3129;
        --line-strong: #4a3f35;
        --pine: #e2b563;
        --pine-hover: #ecc47a;
        --pine-soft: #3a2f1f;
        --on-pine: #1c1714;
        --berry: #d8576a;
        --berry-soft: #3d2228;
        --gold: #e2b563;
        --gold-soft: #3a2f1f;
        --danger: #f07a6e;
        --header-bg: #15110e;
        --header-ink: #f3eadb;
        --header-muted: #b7aa96;
        --header-hover: rgba(255,255,255,.06);
        --header-active-bg: #3a2f1f;
        --header-active-ink: #f0c879;
        --header-rule: #e2b563;
        --header-brand: #f3eadb;
        --brand-ink: #f3eadb;
        --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
        --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.25);
    }
}

*,
*::before,
*::after { box-sizing: border-box; }

[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    min-height: 100vh;
    background: var(--paper);
    color: var(--ink);
    font-family: var(--font-body);
    font-size: 16px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3 {
    font-family: var(--font-display);
    font-weight: 600;
    line-height: 1.2;
    letter-spacing: -0.01em;
    margin: 0 0 0.4em;
}
h1 { font-size: clamp(1.7rem, 3.5vw, 2.2rem); }
h2 { font-size: 1.35rem; }
h3 { font-size: 1.1rem; }
p { margin: 0 0 1em; }
a { color: var(--pine); text-underline-offset: 3px; }
a:hover { color: var(--pine-hover); }
img { max-width: 100%; }

.muted { color: var(--ink-soft); }
.faint { color: var(--ink-faint); font-size: 0.9rem; }
.eyebrow {
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--gold);
    margin-bottom: 6px;
}
.icon { width: 18px; height: 18px; flex: none; vertical-align: -3px; }
.sr-only {
    position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0, 0, 0, 0); border: 0;
}

/* ------------------------------------------------------------ layout */

.site-header {
    position: sticky;
    top: 0;
    z-index: 50;
    background: var(--header-bg);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--line);
}
.site-header::after {
    /* a hairline of gold - the only ornament */
    content: "";
    display: block;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--header-rule) 20%, var(--header-rule) 80%, transparent);
    opacity: 0.35;
}
.header-inner {
    max-width: 1100px;
    margin: 0 auto;
    padding: 12px 20px;
    display: flex;
    align-items: center;
    gap: 24px;
}
.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: var(--header-ink);
    font-family: var(--font-display);
    font-size: 1.3rem;
    font-weight: 600;
}
.brand:hover { color: var(--header-ink); }

/* The hipster Santa: an alpha mask, so it takes the theme colour */
.santa {
    display: inline-block;
    flex: none;
    width: 40px;
    height: 40px;
    background: var(--brand-ink);
    -webkit-mask: url("brand/santa-mark.png") center / contain no-repeat;
    mask: url("brand/santa-mark.png") center / contain no-repeat;
}
.santa.lg { width: 112px; height: 112px; }
.site-header .santa { background: var(--header-brand); }
.main-nav { display: flex; gap: 4px; flex: 1; }
.main-nav a {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 999px;
    text-decoration: none;
    color: var(--header-muted);
    font-weight: 500;
    font-size: 0.95rem;
}
.main-nav a:hover { color: var(--header-ink); background: var(--header-hover); }
.main-nav a[aria-current="page"] { color: var(--header-active-ink); background: var(--header-active-bg); }

.user-menu { position: relative; }
.avatar {
    display: inline-grid;
    place-items: center;
    flex: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--gold-soft);
    color: var(--gold);
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 1rem;
    border: 1px solid color-mix(in srgb, var(--gold) 35%, transparent);
}
.avatar.lg { width: 52px; height: 52px; font-size: 1.35rem; }
.avatar-button {
    display: flex;
    align-items: center;
    gap: 8px;
    background: none;
    border: 0;
    padding: 2px;
    border-radius: 999px;
    cursor: pointer;
    color: var(--ink);
    font: inherit;
}
.avatar-button:focus-visible { outline: 2px solid var(--pine); outline-offset: 2px; }
.menu {
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    min-width: 220px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow);
    padding: 6px;
    display: none;
}
.menu.open { display: block; }
.menu-header { padding: 8px 10px 10px; border-bottom: 1px solid var(--line); margin-bottom: 6px; }
.menu-header strong { display: block; }
.menu a,
.menu button {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 9px 10px;
    border: 0;
    background: none;
    border-radius: 7px;
    color: var(--ink);
    text-decoration: none;
    font: inherit;
    font-size: 0.95rem;
    cursor: pointer;
    text-align: left;
}
.menu a:hover,
.menu button:hover { background: var(--surface-muted); }

.page {
    max-width: 1100px;
    margin: 0 auto;
    padding: 32px 20px 96px;
}
.page-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 24px;
}
.page-head p { margin: 0; color: var(--ink-soft); max-width: 60ch; }
.section { margin-top: 40px; }
.section-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}
.section-head h2 { margin: 0; }

.grid { display: grid; gap: 16px; }
.grid.cols-2 { grid-template-columns: repeat(auto-fill, minmax(min(100%, 420px), 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr)); }
.two-col { display: grid; gap: 24px; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); align-items: start; }
@media (max-width: 860px) { .two-col { grid-template-columns: 1fr; } }

/* mobile: nav moves to a bottom tab bar */
.tab-bar { display: none; }
@media (max-width: 720px) {
    .main-nav { display: none; }
    .header-inner { justify-content: space-between; padding: 10px 16px; }
    .page { padding: 22px 16px 110px; }
    .tab-bar {
        position: fixed;
        inset: auto 0 0 0;
        z-index: 50;
        display: grid;
        grid-auto-flow: column;
        grid-auto-columns: 1fr;
        background: var(--surface);
        border-top: 1px solid var(--line);
        padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
    }
    .tab-bar a {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 2px;
        padding: 6px 0;
        font-size: 0.72rem;
        font-weight: 500;
        color: var(--ink-faint);
        text-decoration: none;
    }
    .tab-bar a .icon { width: 22px; height: 22px; }
    .tab-bar a[aria-current="page"] { color: var(--pine); }
}

/* ------------------------------------------------------------ buttons & forms */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 40px;
    padding: 8px 16px;
    border-radius: 999px;
    border: 1px solid transparent;
    font: inherit;
    font-weight: 600;
    font-size: 0.93rem;
    line-height: 1.2;
    text-decoration: none;
    cursor: pointer;
    white-space: nowrap;
    transition: background-color 0.15s, border-color 0.15s, color 0.15s;
}
.btn:focus-visible { outline: 2px solid var(--pine); outline-offset: 2px; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-primary { background: var(--pine); color: var(--on-pine); }
.btn-primary:hover { background: var(--pine-hover); color: var(--on-pine); }
.btn-secondary { background: var(--surface); color: var(--ink); border-color: var(--line-strong); }
.btn-secondary:hover { background: var(--surface-muted); color: var(--ink); }
.btn-ghost { background: none; color: var(--ink-soft); }
.btn-ghost:hover { background: var(--surface-muted); color: var(--ink); }
.btn-berry { background: var(--berry); color: #fff; }
.btn-berry:hover { filter: brightness(0.94); color: #fff; }
.btn-danger { background: none; color: var(--danger); border-color: color-mix(in srgb, var(--danger) 35%, transparent); }
.btn-danger:hover { background: color-mix(in srgb, var(--danger) 8%, transparent); }
.btn-sm { min-height: 32px; padding: 5px 12px; font-size: 0.85rem; }
.btn-icon { width: 34px; min-height: 34px; padding: 0; }
.btn-block { width: 100%; }
@media (prefers-color-scheme: dark) { .btn-berry, .btn-berry:hover { color: #1a0d10; } }

.field { display: grid; gap: 6px; margin-bottom: 14px; }
.field label { font-weight: 600; font-size: 0.9rem; }
.field .hint { font-size: 0.82rem; color: var(--ink-faint); }
.input,
.field input,
.field select,
.field textarea {
    width: 100%;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--line-strong);
    background: var(--surface);
    color: var(--ink);
    font: inherit;
}
.field textarea { resize: vertical; min-height: 80px; }
.input:focus,
.field input:focus,
.field select:focus,
.field textarea:focus {
    outline: none;
    border-color: var(--pine);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--pine) 18%, transparent);
}
.field-row { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
.actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; margin-top: 6px; }
.inline-form { display: flex; gap: 8px; align-items: center; }
.inline-form .input { flex: 1; min-width: 0; }

/* ------------------------------------------------------------ cards */

.card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    padding: 20px;
}
.card.pad-lg { padding: 28px; }
.card h2,
.card h3 { margin-bottom: 6px; }
a.card { display: block; color: inherit; text-decoration: none; transition: border-color 0.15s, box-shadow 0.15s; }
a.card:hover { border-color: var(--line-strong); box-shadow: var(--shadow); color: inherit; }

.pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 600;
    background: var(--surface-muted);
    color: var(--ink-soft);
    white-space: nowrap;
}
.pill.scheduled { background: var(--gold-soft); color: var(--gold); }
.pill.completed { background: var(--pine-soft); color: var(--pine); }
.pill.failed,
.pill.cancelled { background: var(--berry-soft); color: var(--berry); }
.pill.secret { background: var(--berry-soft); color: var(--berry); }

.meta { display: flex; flex-wrap: wrap; gap: 6px 18px; color: var(--ink-soft); font-size: 0.92rem; }
.meta span { display: inline-flex; align-items: center; gap: 6px; }

.empty {
    border: 1px dashed var(--line-strong);
    border-radius: var(--radius);
    padding: 28px 20px;
    text-align: center;
    color: var(--ink-soft);
}
.empty h3 { color: var(--ink); }

.notice {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    padding: 14px 16px;
    border-radius: var(--radius-sm);
    background: var(--gold-soft);
    color: var(--ink);
    font-size: 0.92rem;
}
.notice .icon { color: var(--gold); margin-top: 2px; }
.notice.secret { background: var(--berry-soft); }
.notice.secret .icon { color: var(--berry); }

/* ------------------------------------------------------------ home */

.greeting { margin-bottom: 28px; }
.greeting h1 { margin-bottom: 4px; }

.exchange-card { position: relative; overflow: hidden; display: grid; gap: 14px; }
.exchange-card.upcoming { border-top: 3px solid var(--berry); }
.exchange-card .top { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.exchange-card h3 { margin: 0; font-size: 1.25rem; }
.santa-slot {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px;
    border-radius: var(--radius-sm);
    background: var(--surface-muted);
}
.santa-slot .label { font-size: 0.82rem; color: var(--ink-soft); }
.santa-slot strong { font-family: var(--font-display); font-size: 1.15rem; }

.countdown { display: flex; gap: 6px; align-items: baseline; font-variant-numeric: tabular-nums; }
.countdown .unit {
    display: grid;
    min-width: 46px;
    padding: 6px 4px;
    text-align: center;
    border-radius: 8px;
    background: var(--surface-muted);
}
.countdown .value { font-family: var(--font-display); font-size: 1.25rem; font-weight: 600; line-height: 1.1; }
.countdown .name { font-size: 0.68rem; color: var(--ink-faint); text-transform: uppercase; letter-spacing: 0.06em; }

.person-card { display: flex; gap: 14px; align-items: center; }
.person-card .counts { font-size: 0.88rem; color: var(--ink-soft); }

.list-plain { list-style: none; padding: 0; margin: 0; }
.list-plain li { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.list-plain li:last-child { border-bottom: 0; }

/* ------------------------------------------------------------ gift items */

.items { display: grid; gap: 12px; }
.item {
    display: grid;
    grid-template-columns: 72px minmax(0, 1fr) auto;
    gap: 16px;
    align-items: start;
    padding: 14px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
}
.item-thumb {
    width: 72px;
    height: 72px;
    border-radius: 10px;
    background: var(--surface-muted);
    display: grid;
    place-items: center;
    overflow: hidden;
    color: var(--ink-faint);
}
.item-thumb img { width: 100%; height: 100%; object-fit: cover; }
.item-title { font-weight: 600; margin: 0 0 2px; overflow-wrap: anywhere; }
.item-title a { color: var(--ink); text-decoration: none; }
.item-title a:hover { color: var(--pine); text-decoration: underline; }
.item-notes { font-size: 0.9rem; color: var(--ink-soft); margin: 4px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.item-meta { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 0.85rem; color: var(--ink-faint); margin-top: 6px; }
.item-meta .priority-high { color: var(--berry); font-weight: 600; }
.item-actions { display: flex; flex-direction: column; gap: 6px; align-items: flex-end; }
@media (max-width: 560px) {
    .item { grid-template-columns: 56px minmax(0, 1fr); }
    .item-thumb { width: 56px; height: 56px; }
    .item-actions { grid-column: 1 / -1; flex-direction: row; justify-content: flex-end; flex-wrap: wrap; }
}

.add-panel summary {
    list-style: none;
    cursor: pointer;
}
.add-panel summary::-webkit-details-marker { display: none; }
.add-panel[open] summary { margin-bottom: 16px; }
.add-panel:not([open]) summary h2 { color: var(--pine); }
@media (min-width: 861px) { .add-panel summary { pointer-events: none; } }

.preview-status { font-size: 0.85rem; color: var(--ink-faint); min-height: 1.2em; }

/* ------------------------------------------------------------ exchange page */

.reveal-box {
    position: relative;
    display: grid;
    place-items: center;
    min-height: 150px;
    border-radius: var(--radius);
    background:
        radial-gradient(circle at 20% 20%, color-mix(in srgb, var(--gold) 14%, transparent), transparent 55%),
        var(--pine);
    color: var(--on-pine);
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
    touch-action: none;
    overflow: hidden;
}
.reveal-box .reveal-name {
    font-family: var(--font-display);
    font-size: clamp(2rem, 6vw, 2.8rem);
    font-weight: 600;
    filter: blur(14px);
    opacity: 0.35;
    transition: filter 0.25s, opacity 0.25s;
}
.reveal-box.revealed .reveal-name { filter: none; opacity: 1; }
.reveal-box .reveal-hint {
    position: absolute;
    bottom: 14px;
    font-size: 0.85rem;
    opacity: 0.85;
}
.reveal-box.revealed .reveal-hint { display: none; }
.reveal-progress {
    position: absolute;
    left: 0;
    bottom: 0;
    height: 4px;
    width: 0;
    background: var(--gold);
}

.chat { display: grid; gap: 10px; max-height: 320px; overflow-y: auto; padding: 4px 2px; }
.bubble {
    max-width: 82%;
    padding: 9px 13px;
    border-radius: 16px;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    font-size: 0.95rem;
}
.bubble.me { justify-self: end; background: var(--pine); color: var(--on-pine); border-bottom-right-radius: 5px; }
.bubble.them { justify-self: start; background: var(--surface-muted); border-bottom-left-radius: 5px; }
.bubble time { display: block; font-size: 0.72rem; opacity: 0.7; margin-top: 3px; }
.chat-form { display: flex; gap: 8px; align-items: flex-end; margin-top: 12px; }
.chat-form textarea {
    flex: 1;
    min-width: 0;
    min-height: 44px;
    max-height: 160px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--line-strong);
    background: var(--surface);
    color: var(--ink);
    font: inherit;
    resize: vertical;
}

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 18px; overflow-x: auto; }
.tabs button,
.tabs a {
    padding: 10px 14px;
    border: 0;
    border-bottom: 2px solid transparent;
    background: none;
    color: var(--ink-soft);
    font: inherit;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;
}
.tabs [aria-selected="true"] { color: var(--pine); border-bottom-color: var(--pine); }
.tab-count {
    display: inline-block;
    min-width: 20px;
    padding: 0 6px;
    margin-left: 4px;
    border-radius: 999px;
    background: var(--berry);
    color: #fff;
    font-size: 0.75rem;
    line-height: 20px;
    text-align: center;
}

/* ------------------------------------------------------------ admin */

.table { width: 100%; border-collapse: collapse; font-size: 0.93rem; }
.table th {
    text-align: left;
    font-size: 0.78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--ink-faint);
    padding: 8px 10px;
    border-bottom: 1px solid var(--line);
}
.table td { padding: 12px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table .row-actions { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; }
.table-wrap { overflow-x: auto; }
@media (max-width: 640px) {
    .table.stack thead { display: none; }
    .table.stack tr { display: grid; gap: 4px; padding: 12px 0; border-bottom: 1px solid var(--line); }
    .table.stack td { padding: 0; border: 0; }
    .table.stack .row-actions { justify-content: flex-start; margin-top: 6px; }
}
.selectable tr[data-href] { cursor: pointer; }
.selectable tr[data-href]:hover td { background: var(--surface-muted); }
.selectable tr.selected td { background: var(--pine-soft); }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 6px 5px 12px;
    border-radius: 999px;
    border: 1px solid var(--line-strong);
    background: var(--surface);
    font-size: 0.9rem;
}
.chip .exclusion { font-size: 0.78rem; color: var(--berry); }
.chip button {
    display: grid;
    place-items: center;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 0;
    background: none;
    color: var(--ink-faint);
    cursor: pointer;
}
.chip button:hover { background: var(--berry-soft); color: var(--berry); }
.chip.static { padding-right: 12px; }

/* ------------------------------------------------------------ dialogs & toasts */

dialog {
    width: min(520px, calc(100vw - 32px));
    max-height: calc(100vh - 48px);
    padding: 0;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--ink);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
}
dialog::backdrop { background: rgba(15, 24, 20, 0.45); backdrop-filter: blur(2px); }
.dialog-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 22px 0;
}
.dialog-head h2 { margin: 0; }
.dialog-body { padding: 16px 22px 22px; }

#toasts {
    position: fixed;
    right: 16px;
    left: 16px;
    bottom: 16px;
    z-index: 200;
    display: grid;
    justify-items: end;
    gap: 8px;
    pointer-events: none;
}
@media (max-width: 720px) { #toasts { bottom: 84px; } }
.toast {
    display: flex;
    align-items: center;
    gap: 10px;
    max-width: 420px;
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    background: var(--ink);
    color: var(--paper);
    box-shadow: var(--shadow);
    font-size: 0.93rem;
    pointer-events: auto;
    animation: toast-in 0.18s ease-out;
}
.toast.error { background: var(--danger); color: #fff; }
.toast button { border: 0; background: none; color: inherit; cursor: pointer; opacity: 0.7; font-size: 1.1rem; }
@keyframes toast-in { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ------------------------------------------------------------ auth pages */

.auth {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px 16px;
    background:
        radial-gradient(1200px 500px at 50% -10%, var(--pine-soft), transparent 70%),
        var(--paper);
}
.auth-card { width: min(420px, 100%); }
.auth-brand { text-align: center; margin-bottom: 22px; }
.auth-brand .santa { display: block; margin: 0 auto 10px; }
.auth-brand h1 { margin-bottom: 4px; }
.auth-links { text-align: center; margin-top: 16px; font-size: 0.92rem; }
.flash-stack { display: grid; gap: 8px; margin-bottom: 16px; }
.flash {
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    background: var(--pine-soft);
    color: var(--ink);
    font-size: 0.92rem;
}
.flash.error { background: var(--berry-soft); }

.site-footer { text-align: center; padding: 32px 16px 40px; font-size: 0.85rem; color: var(--ink-faint); }
@media (max-width: 720px) { .site-footer { display: none; } }
@media (max-width: 860px) {
    .two-col.aside-first > aside { order: -1; }
}

/* ------------------------------------------------------------ theme picker */

.theme-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 230px), 1fr)); }
.theme-option {
    position: relative;
    display: grid;
    gap: 6px;
    padding: 16px;
    border-radius: var(--radius);
    border: 2px solid var(--line);
    background: var(--surface);
    cursor: pointer;
}
.theme-option:hover { border-color: var(--line-strong); }
.theme-option:has(input:checked) { border-color: var(--pine); box-shadow: 0 0 0 3px color-mix(in srgb, var(--pine) 15%, transparent); }
.theme-option input { position: absolute; opacity: 0; pointer-events: none; }
.theme-option:has(input:focus-visible) { outline: 2px solid var(--pine); outline-offset: 2px; }
.theme-swatches { display: flex; height: 44px; border-radius: 10px; overflow: hidden; border: 1px solid var(--line); margin-bottom: 4px; }
.theme-swatches span { flex: 1; }
.theme-swatches span:first-child { flex: 1.6; }
