:root {
    --paper: #eef3ef;
    --ink: #1a2420;
    --pine: #1f5c45;
    --pine-dark: #143d2e;
    --ribbon: #9a3b3f;
    --line: #cfd8d2;
    --card: #ffffff;
    --muted: #5a6660;
    --soft: #dfe8e2;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    min-height: 100vh;
    color: var(--ink);
    background:
        radial-gradient(circle at 12% 0%, rgba(31, 92, 69, 0.14), transparent 28rem),
        radial-gradient(circle at 90% 8%, rgba(154, 59, 63, 0.08), transparent 22rem),
        linear-gradient(180deg, #f7faf7 0%, var(--paper) 45%, #e7eee9 100%);
    font-family: Outfit, sans-serif;
}

a { color: var(--pine); }

h1, h2, h3 {
    font-family: Fraunces, serif;
    font-weight: 600;
    letter-spacing: -0.03em;
    margin: 0;
}

h1 { font-size: clamp(2rem, 4vw, 3.1rem); line-height: 1.05; }
h2 { font-size: 1.45rem; }
h3 { font-size: 1.1rem; }

.topbar, .wrap { width: min(1080px, calc(100% - 2rem)); margin: 0 auto; }

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    padding: 1rem 0;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 0.7rem;
    color: inherit;
    text-decoration: none;
    font-weight: 600;
}

.brand-mark {
    width: 0.85rem;
    height: 0.85rem;
    border-radius: 50%;
    background: var(--ribbon);
    box-shadow: 0.5rem 0 0 var(--pine);
}

.topbar-user {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.topbar-user form { margin: 0; }

.user-chip {
    display: grid;
    gap: 0.05rem;
    padding: 0.45rem 0.75rem;
    background: rgba(255, 255, 255, 0.72);
    border: 1px solid var(--line);
    border-radius: 999px;
    font-size: 0.92rem;
}

.user-chip small {
    color: var(--muted);
    font-size: 0.78rem;
}

.wrap { padding-bottom: 4rem; }

.page-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 0.75rem;
    margin: 0.5rem 0 1.5rem;
}

.page-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.55rem;
    justify-content: flex-end;
}

.eyebrow {
    margin: 0 0 0.4rem;
    color: var(--ribbon);
    font-size: 0.78rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.lede, .muted, .fine, .note { color: var(--muted); }

.auth-shell {
    min-height: calc(100vh - 6rem);
    display: grid;
    place-items: center;
    padding: 1rem 0 2rem;
}

.auth-card, .panel {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 1.25rem;
    padding: 1.4rem;
    box-shadow: 0 10px 30px rgba(26, 36, 32, 0.04);
}

.auth-card {
    width: min(26rem, 100%);
    margin: 0 auto;
    padding: 1.6rem;
}

.auth-card h1 { margin-bottom: 0.45rem; }
.auth-card .lede { margin: 0 0 1.1rem; }

.auth-actions {
    display: grid;
    gap: 0.7rem;
    margin-top: 0.3rem;
}

.auth-actions .button { width: 100%; text-align: center; }

.stack, .stack-panels, .group-list, .member-list { display: grid; gap: 0.8rem; }

label { display: grid; gap: 0.35rem; font-size: 0.92rem; font-weight: 500; }

input, textarea, select {
    width: 100%;
    border: 1px solid var(--line);
    background: #fff;
    color: inherit;
    border-radius: 0.85rem;
    padding: 0.8rem 0.9rem;
    font: inherit;
}

input:focus, textarea:focus, select:focus {
    outline: 2px solid rgba(31, 92, 69, 0.25);
    border-color: var(--pine);
}

.check {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 400;
}
.check input { width: auto; }

.button,
.linkish {
    font: inherit;
    cursor: pointer;
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    border: 0;
    border-radius: 999px;
    padding: 0.78rem 1.2rem;
    background: var(--pine);
    color: #f7f3ea;
    text-decoration: none;
    font-weight: 600;
    transition: background 0.15s ease, transform 0.15s ease;
}

.button:hover { background: var(--pine-dark); }
.button:active { transform: translateY(1px); }

.button-quiet {
    background: #fff;
    color: var(--pine);
    border: 1px solid var(--pine);
}

.button-quiet:hover {
    background: var(--soft);
    color: var(--pine-dark);
}

.button-ghost {
    background: transparent;
    color: var(--ink);
    border: 1px solid var(--line);
}

.button-ghost:hover {
    background: #fff;
    color: var(--pine-dark);
}

.button-admin {
    background: var(--ink);
    color: #f4f7f5;
}

.button-admin:hover { background: #0f1613; }

.button-sm {
    padding: 0.5rem 0.9rem;
    font-size: 0.9rem;
}

.button-danger {
    background: #fff;
    color: var(--ribbon);
    border: 1px solid var(--ribbon);
}

.button-danger:hover {
    background: #f8ecec;
    color: #7a2428;
}

.copy-row {
    display: flex;
    gap: 0.55rem;
    align-items: stretch;
}

.copy-row input {
    flex: 1;
    min-width: 0;
}

.copy-row .button {
    flex-shrink: 0;
}

.toast {
    position: fixed;
    left: 50%;
    bottom: 1.4rem;
    transform: translateX(-50%) translateY(1rem);
    background: var(--ink);
    color: #f4f7f5;
    padding: 0.75rem 1.1rem;
    border-radius: 999px;
    font-weight: 600;
    font-size: 0.92rem;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.18s ease, transform 0.18s ease;
    z-index: 40;
    box-shadow: 0 10px 24px rgba(15, 22, 19, 0.2);
}

.toast.is-visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.linkish {
    border: 0;
    background: transparent;
    color: var(--ribbon);
    padding: 0;
    text-decoration: underline;
    text-underline-offset: 0.18em;
}

.error { color: var(--ribbon); margin: 0; }
.status {
    background: #e7f2ec;
    border-radius: 0.8rem;
    padding: 0.75rem 1rem;
}

.columns {
    display: grid;
    grid-template-columns: 1.4fr 0.8fr;
    gap: 1rem;
    align-items: start;
}

.event-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin: 0 0 1rem;
    padding: 0.35rem;
    background: rgba(255, 255, 255, 0.75);
    border: 1px solid var(--line);
    border-radius: 999px;
    width: fit-content;
    max-width: 100%;
}

.event-tab {
    border: 0;
    background: transparent;
    color: var(--muted);
    font: inherit;
    font-weight: 600;
    padding: 0.6rem 1rem;
    border-radius: 999px;
    cursor: pointer;
}

.event-tab.is-active,
.event-tab:hover {
    background: var(--pine);
    color: #fff;
}

.tab-panels {
    display: grid;
    gap: 1rem;
}

.tab-panel h2 {
    margin-bottom: 0.45rem;
}

.panel-divider {
    border: 0;
    border-top: 1px solid var(--line);
    margin: 1.2rem 0;
}

.group-list { list-style: none; padding: 0; margin: 1rem 0 0; }
.group-list a, .member-list { list-style: none; }
.group-list a {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 1.1rem;
    border: 1px solid var(--line);
    border-radius: 1rem;
    background: var(--card);
    color: inherit;
    text-decoration: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}
.group-list a:hover {
    border-color: #9fb5aa;
    box-shadow: 0 8px 20px rgba(26, 36, 32, 0.06);
    transform: translateY(-1px);
}
.group-list small, .group-list em { color: var(--muted); font-style: normal; }
.group-list span, .product span { display: grid; gap: 0.2rem; }
.group-list em {
    align-self: center;
    padding: 0.28rem 0.65rem;
    border-radius: 999px;
    background: var(--soft);
    font-size: 0.82rem;
}

.member-list { padding: 0; margin: 0.8rem 0 0; }
.member-list em { color: var(--ribbon); font-style: normal; }

.chips { display: flex; flex-wrap: wrap; gap: 0.4rem; padding: 0; list-style: none; }
.chips li {
    background: var(--soft);
    border-radius: 999px;
    padding: 0.3rem 0.7rem;
}

.product-grid { display: grid; gap: 0.7rem; margin-top: 0.6rem; }
.product {
    display: grid;
    grid-template-columns: 72px 1fr;
    gap: 0.8rem;
    align-items: center;
    padding: 0.6rem;
    border-radius: 0.9rem;
    text-decoration: none;
    color: inherit;
    background: #fff;
    border: 1px solid var(--line);
}
.product img, .ph {
    width: 72px;
    height: 72px;
    object-fit: cover;
    border-radius: 0.6rem;
    background: #e8eee9;
}
.product em { font-style: normal; color: var(--pine); font-weight: 600; }
.product small { color: var(--ribbon); }
.product .store { color: var(--muted); display: block; }
.idea-block + .idea-block { margin-top: 1.2rem; }

.join-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}
.join-row input { flex: 1; }

.split {
    display: flex;
    align-items: stretch;
    gap: 0.75rem;
}
.split label { flex: 1; }

.section-title { margin: 1.6rem 0 0.7rem; font-size: 1.2rem; }

.role-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin-top: 0.35rem;
}

.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.18rem 0.55rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1.2;
}

.badge-owner {
    background: #1f5c45;
    color: #f4faf6;
}

.badge-member {
    background: #e7eee9;
    color: #31453c;
}

.badge-ready {
    background: #dff3e7;
    color: #1f5c45;
}

.badge-pending {
    background: #f8ecec;
    color: #8d2e32;
}

.wishlist {
    list-style: none;
    padding: 0;
    margin: 0.6rem 0 1rem;
    display: grid;
    gap: 0.45rem;
}

.wishlist a {
    display: block;
    word-break: break-all;
    padding: 0.65rem 0.8rem;
    border: 1px solid var(--line);
    border-radius: 0.8rem;
    background: #f7faf8;
    text-decoration: none;
    font-size: 0.9rem;
}

.wishlist a:hover {
    border-color: #9fb5aa;
    background: #fff;
}

.admin-nav {
    display: flex;
    gap: 0.5rem;
    margin: 0 0 1rem;
    padding: 0.35rem;
    background: rgba(255, 255, 255, 0.7);
    border: 1px solid var(--line);
    border-radius: 999px;
    width: fit-content;
}
.admin-nav a {
    text-decoration: none;
    color: var(--muted);
    padding: 0.55rem 1rem;
    border-radius: 999px;
    font-weight: 600;
}
.admin-nav a.active,
.admin-nav a:hover {
    color: #fff;
    background: var(--pine);
}

.split-actions { display: grid; gap: 0.7rem; }
.member-list li {
    display: flex;
    justify-content: space-between;
    gap: 0.8rem;
    align-items: center;
}
.member-list small { color: var(--muted); display: block; }

.demo {
    margin-top: 1.2rem;
    padding-top: 1rem;
    border-top: 1px solid var(--line);
}
.demo > p {
    margin: 0 0 0.7rem;
    color: var(--muted);
    font-size: 0.9rem;
}
.demo-list {
    display: grid;
    gap: 0.45rem;
    padding: 0;
    margin: 0;
    list-style: none;
}
.demo-list button {
    width: 100%;
    display: flex;
    justify-content: space-between;
    gap: 0.75rem;
    align-items: center;
    border: 1px solid var(--line);
    background: #f7faf8;
    border-radius: 0.85rem;
    padding: 0.7rem 0.85rem;
    font: inherit;
    color: inherit;
    cursor: pointer;
    text-align: left;
}
.demo-list button:hover {
    border-color: #9fb5aa;
    background: #fff;
}
.demo-list strong { font-size: 0.95rem; }
.demo-list span { color: var(--muted); font-size: 0.82rem; }

.auth-footer {
    margin: 1rem 0 0;
    text-align: center;
}
.auth-footer a {
    font-weight: 600;
    text-decoration: none;
}
.auth-footer a:hover { text-decoration: underline; }

@media (max-width: 800px) {
    .columns, .page-head, .split, .join-row, .copy-row { display: grid; }
    .page-head { align-items: start; }
    .admin-nav, .event-tabs { width: 100%; }
    .admin-nav a, .event-tab { flex: 1; text-align: center; }
    .topbar-user { width: 100%; }
}
