:root {
    --ink: #282420;
    --muted: #746d66;
    --cream: #f7f3ed;
    --paper: #fffdf9;
    --line: #e7dfd6;
    --accent: #a8435a;
    --accent-dark: #853145;
    --accent-soft: #f6e7eb;
    --sage: #567065;
    --sage-soft: #e6efea;
    --danger: #a33030;
    --shadow: 0 18px 50px rgba(73, 54, 42, .09);
    --radius: 22px;
}

* {
    box-sizing: border-box;
}

html {
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: var(--ink);
    background: var(--cream);
}

body {
    margin: 0;
    min-height: 100vh;
    background:
        radial-gradient(circle at 8% 8%, rgba(168, 67, 90, .08), transparent 27rem),
        radial-gradient(circle at 96% 26%, rgba(86, 112, 101, .08), transparent 25rem),
        var(--cream);
}

a {
    color: var(--accent-dark);
}

button,
input {
    font: inherit;
}

button,
a {
    -webkit-tap-highlight-color: transparent;
}

.site-header {
    width: min(1180px, calc(100% - 40px));
    min-height: 84px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    border-bottom: 1px solid rgba(116, 109, 102, .16);
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: var(--ink);
    font-family: Georgia, "Times New Roman", serif;
    font-size: 1.24rem;
    font-weight: 700;
    text-decoration: none;
}

.brand-mark {
    display: grid;
    width: 34px;
    height: 34px;
    place-items: center;
    border-radius: 50%;
    color: white;
    background: var(--accent);
    font-family: serif;
}

.admin-nav {
    display: flex;
    gap: 24px;
}

.admin-nav a {
    color: var(--muted);
    font-size: .93rem;
    font-weight: 650;
    text-decoration: none;
}

.admin-nav a:hover {
    color: var(--accent);
}

.page-shell {
    width: min(1180px, calc(100% - 40px));
    min-height: calc(100vh - 156px);
    margin: 0 auto;
    padding: 56px 0 80px;
}

.site-footer {
    width: min(1180px, calc(100% - 40px));
    margin: 0 auto;
    padding: 24px 0 32px;
    border-top: 1px solid rgba(116, 109, 102, .16);
    color: var(--muted);
    font-size: .85rem;
    text-align: center;
}

.admin-access {
    margin-left: 12px;
    color: var(--muted);
    font-size: .78rem;
    text-decoration: none;
}

.admin-access:hover {
    color: var(--accent);
    text-decoration: underline;
}

.hero {
    max-width: 760px;
    margin: 12px auto 56px;
    text-align: center;
}

.eyebrow {
    display: block;
    margin-bottom: 12px;
    color: var(--accent);
    font-size: .75rem;
    font-weight: 800;
    letter-spacing: .16em;
    text-transform: uppercase;
}

h1,
h2,
p {
    margin-top: 0;
}

h1,
h2 {
    font-family: Georgia, "Times New Roman", serif;
    line-height: 1.08;
}

h1 {
    margin-bottom: 20px;
    font-size: clamp(2.25rem, 6vw, 4.6rem);
    font-weight: 500;
    letter-spacing: -.04em;
}

.hero p {
    max-width: 620px;
    margin: 0 auto;
    color: var(--muted);
    font-size: 1.1rem;
    line-height: 1.65;
}

.gift-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 24px;
}

.gift-card {
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--paper);
    box-shadow: 0 6px 28px rgba(73, 54, 42, .04);
    transition: transform .2s ease, box-shadow .2s ease;
}

.gift-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow);
}

.gift-card-link {
    display: block;
    color: inherit;
    text-decoration: none;
}

.gift-image {
    display: grid;
    aspect-ratio: 4 / 3;
    overflow: hidden;
    place-items: center;
    background: #eee7df;
}

.gift-image img,
.gift-detail-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.image-placeholder {
    font-size: 3.4rem;
    filter: grayscale(.1);
}

.gift-card-body {
    padding: 24px;
}

.gift-card h2 {
    min-height: 2.3em;
    margin-bottom: 18px;
    font-size: 1.5rem;
    font-weight: 600;
}

.gift-meta {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 22px;
}

.gift-meta strong {
    color: var(--accent);
    font-size: 1.15rem;
}

.gift-meta span {
    color: var(--muted);
    font-size: .85rem;
}

.text-link,
.back-link {
    color: var(--ink);
    font-size: .9rem;
    font-weight: 750;
}

.text-link {
    display: flex;
    justify-content: space-between;
    padding-top: 18px;
    border-top: 1px solid var(--line);
}

.back-link {
    display: inline-flex;
    gap: 8px;
    margin-bottom: 28px;
    text-decoration: none;
}

.gift-detail {
    display: grid;
    grid-template-columns: minmax(0, 1.45fr) minmax(330px, .72fr);
    gap: 28px;
    align-items: start;
}

.gift-detail-card,
.buyers-card,
.form-card,
.auth-card,
.narrow-card {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--paper);
    box-shadow: var(--shadow);
}

.gift-detail-card {
    overflow: hidden;
}

.gift-detail-image {
    display: grid;
    aspect-ratio: 16 / 10;
    overflow: hidden;
    place-items: center;
    background: #eee7df;
}

.gift-detail-copy {
    padding: 34px;
}

.gift-detail-copy h1,
.form-card h1,
.auth-card h1,
.narrow-card h1 {
    margin-bottom: 14px;
    font-size: clamp(2rem, 4vw, 3.35rem);
}

.detail-price {
    margin-bottom: 26px;
    color: var(--accent);
    font-size: 1.4rem;
    font-weight: 800;
}

.buyers-card {
    position: sticky;
    top: 24px;
    padding: 30px;
}

.buyers-card h2 {
    margin-bottom: 18px;
    font-size: 1.8rem;
}

.buyer-list,
.admin-buyer-list {
    padding: 0;
    list-style: none;
}

.buyer-list {
    display: flex;
    flex-wrap: wrap;
    gap: 9px;
    margin: 0 0 24px;
}

.buyer-list li {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 6px 11px 6px 6px;
    border: 1px solid #d7e2dc;
    border-radius: 999px;
    background: var(--sage-soft);
    color: #3d554a;
    font-size: .86rem;
    font-weight: 700;
}

.buyer-avatar {
    display: inline-grid;
    width: 28px;
    height: 28px;
    flex: 0 0 auto;
    place-items: center;
    border-radius: 50%;
    color: white;
    background: var(--sage);
    font-size: .75rem;
    font-weight: 800;
}

.muted {
    color: var(--muted);
}

.join-form {
    padding-top: 24px;
    border-top: 1px solid var(--line);
}

label {
    display: block;
    color: #4d4742;
    font-size: .88rem;
    font-weight: 750;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="url"],
input[type="number"] {
    width: 100%;
    min-height: 48px;
    margin-top: 8px;
    padding: 0 14px;
    border: 1px solid #d8cfc5;
    border-radius: 11px;
    outline: none;
    color: var(--ink);
    background: white;
    transition: border .15s ease, box-shadow .15s ease;
}

input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(168, 67, 90, .12);
}

input[type="file"] {
    width: 100%;
    margin-top: 10px;
    padding: 11px;
    border: 1px dashed #cfc1b4;
    border-radius: 11px;
    background: #fbf8f4;
}

.inline-form {
    display: flex;
    gap: 10px;
}

.inline-form input {
    flex: 1 1 auto;
}

.inline-form .button {
    align-self: end;
    min-height: 48px;
    white-space: nowrap;
}

small {
    display: block;
    margin-top: 8px;
    color: var(--muted);
    font-size: .76rem;
    font-weight: 500;
    line-height: 1.5;
}

.button {
    display: inline-flex;
    min-height: 46px;
    align-items: center;
    justify-content: center;
    padding: 0 20px;
    border: 1px solid var(--accent);
    border-radius: 12px;
    color: white;
    background: var(--accent);
    font-weight: 750;
    text-decoration: none;
    cursor: pointer;
    transition: background .15s ease, transform .15s ease;
}

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

.button-secondary {
    color: var(--accent-dark);
    background: var(--accent-soft);
}

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

.empty-state {
    padding: 72px 30px;
    border: 1px dashed #cfc3b7;
    border-radius: var(--radius);
    text-align: center;
}

.empty-state h1,
.empty-state h2 {
    margin-bottom: 12px;
    font-size: 2rem;
}

.empty-state p {
    margin-bottom: 24px;
    color: var(--muted);
}

.empty-icon {
    display: block;
    margin-bottom: 14px;
    font-size: 2.8rem;
}

.alert {
    margin-bottom: 24px;
    padding: 14px 16px;
    border-radius: 12px;
    font-size: .92rem;
    line-height: 1.5;
}

.alert ul {
    margin: 0;
    padding-left: 20px;
}

.alert-success {
    border: 1px solid #c8dbd0;
    color: #365247;
    background: var(--sage-soft);
}

.alert-error {
    border: 1px solid #e8c9c9;
    color: #812e2e;
    background: #faeaea;
}

.auth-card,
.narrow-card {
    max-width: 510px;
    margin: 30px auto;
    padding: clamp(28px, 5vw, 48px);
}

.auth-card p,
.narrow-card p {
    color: var(--muted);
    line-height: 1.6;
}

.stacked-form {
    display: grid;
    gap: 18px;
    margin-top: 28px;
}

.stacked-form .button {
    margin-top: 4px;
}

.admin-heading {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 34px;
}

.admin-heading h1 {
    margin-bottom: 8px;
    font-size: clamp(2.2rem, 5vw, 4rem);
}

.admin-heading p {
    margin: 0;
    color: var(--muted);
}

.admin-table-wrap {
    overflow-x: auto;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: var(--paper);
    box-shadow: var(--shadow);
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

.admin-table th,
.admin-table td {
    padding: 16px 18px;
    border-bottom: 1px solid var(--line);
}

.admin-table th {
    color: var(--muted);
    background: #fbf8f4;
    font-size: .73rem;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.admin-table tr:last-child td {
    border-bottom: 0;
}

.table-gift {
    display: flex;
    min-width: 220px;
    align-items: center;
    gap: 12px;
}

.table-gift img,
.table-placeholder {
    width: 54px;
    height: 54px;
    flex: 0 0 auto;
    border-radius: 10px;
    object-fit: cover;
}

.table-placeholder {
    display: grid;
    place-items: center;
    background: #eee7df;
}

.status {
    display: inline-block;
    padding: 5px 9px;
    border-radius: 999px;
    font-size: .74rem;
    font-weight: 800;
}

.status-active {
    color: #365247;
    background: var(--sage-soft);
}

.status-hidden {
    color: #645e58;
    background: #eae6e2;
}

.table-actions {
    white-space: nowrap;
}

.table-actions form {
    display: inline;
    margin-left: 10px;
}

.danger-link {
    padding: 0;
    border: 0;
    color: var(--danger);
    background: none;
    text-decoration: underline;
    cursor: pointer;
}

.form-card {
    max-width: 760px;
    padding: clamp(26px, 5vw, 46px);
}

.form-card-heading {
    margin-bottom: 28px;
}

.gift-form {
    display: grid;
    grid-template-columns: 1fr 180px;
    gap: 22px;
}

.field-wide {
    grid-column: 1 / -1;
}

.price-input {
    position: relative;
}

.price-input input {
    padding-right: 40px;
}

.price-input span {
    position: absolute;
    right: 15px;
    bottom: 14px;
    color: var(--muted);
    font-weight: 700;
}

.checkbox {
    display: flex;
    align-items: center;
    gap: 9px;
}

.checkbox input {
    width: 18px;
    height: 18px;
    accent-color: var(--accent);
}

.current-photo {
    display: flex;
    align-items: center;
    gap: 16px;
}

.current-photo img {
    width: 96px;
    height: 76px;
    border-radius: 10px;
    object-fit: cover;
}

.form-actions {
    display: flex;
    gap: 10px;
    padding-top: 6px;
}

.empty-inline {
    margin-top: 28px;
    padding: 22px;
    border-radius: 12px;
    color: var(--muted);
    background: #f7f2ed;
}

.admin-buyer-list {
    margin: 28px 0 0;
}

.admin-buyer-list li {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 0;
    border-bottom: 1px solid var(--line);
}

.admin-buyer-list li:last-child {
    border-bottom: 0;
}

.buyer-info {
    display: flex;
    flex: 1;
    flex-direction: column;
}

.buyer-info small {
    margin-top: 3px;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
}

code {
    padding: 2px 5px;
    border-radius: 5px;
    background: #eee8e2;
}

@media (max-width: 900px) {
    .gift-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .gift-detail {
        grid-template-columns: 1fr;
    }

    .buyers-card {
        position: static;
    }
}

@media (max-width: 620px) {
    .site-header,
    .page-shell,
    .site-footer {
        width: min(100% - 28px, 1180px);
    }

    .site-header {
        min-height: 72px;
    }

    .brand {
        font-size: 1.05rem;
    }

    .admin-nav {
        gap: 12px;
    }

    .admin-nav a {
        font-size: .82rem;
    }

    .page-shell {
        padding: 38px 0 58px;
    }

    .hero {
        margin-bottom: 36px;
    }

    .hero h1 {
        font-size: 2.65rem;
    }

    .gift-grid {
        grid-template-columns: 1fr;
    }

    .gift-card h2 {
        min-height: auto;
    }

    .gift-detail-copy,
    .buyers-card {
        padding: 24px;
    }

    .inline-form {
        flex-direction: column;
    }

    .inline-form .button {
        width: 100%;
    }

    .admin-heading {
        align-items: stretch;
        flex-direction: column;
    }

    .admin-heading .button {
        align-self: flex-start;
    }

    .gift-form {
        grid-template-columns: 1fr;
    }

    .field-wide {
        grid-column: auto;
    }

    .form-actions {
        flex-direction: column;
    }
}
