:root {
    --paper: #fffaf0;
    --surface: #ffffff;
    --ink: #173b3f;
    --muted: #6c7a7c;
    --sea: #0f7c8c;
    --sand: #ead9b8;
    --gold: #c79a35;
    --line: #e8dfcf;
}

* { box-sizing: border-box; }
body {
    margin: 0;
    background:
        linear-gradient(180deg, rgba(255, 250, 240, .04), rgba(255, 250, 240, .12)),
        url('/assets/tlo.png') center top / cover fixed no-repeat,
        var(--paper);
    color: var(--ink);
    font-family: "Inter", "Manrope", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
a { color: var(--sea); text-decoration: none; }
img { max-width: 100%; display: block; }
.topbar {
    height: 68px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 28px;
    background: var(--surface);
    border-bottom: 1px solid var(--line);
}
.brand { font-weight: 800; color: var(--ink); }
.shell { width: min(1180px, calc(100% - 32px)); margin: 28px auto 60px; }
.page-head {
    display: flex;
    justify-content: space-between;
    gap: 18px;
    align-items: center;
    margin-bottom: 24px;
}
h1, h2 { margin: 0 0 10px; }
p { color: var(--muted); line-height: 1.6; }
.btn {
    border: 1px solid var(--line);
    background: var(--surface);
    color: var(--ink);
    padding: 10px 14px;
    border-radius: 8px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    font-weight: 700;
}
.btn.primary { background: var(--sea); color: #fff; border-color: var(--sea); }
.btn.ghost { background: transparent; }
.btn.danger { background: #b42318; color: #fff; border-color: #b42318; }
.btn.danger:hover { background: #97180f; border-color: #97180f; }
.btn.small { padding: 7px 10px; min-height: 32px; font-size: 14px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.inline-form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.inline-form input[type="number"] { width: 96px; padding: 7px 9px; }
.muted-text { color: var(--muted); font-size: 13px; }
.admin-thumb { width: 96px; height: 58px; object-fit: cover; border-radius: 6px; border: 1px solid var(--line); }
.admin-preview { max-width: 420px; border-radius: 8px; border: 1px solid var(--line); }
.alert { padding: 12px 14px; border-radius: 8px; background: #e8f6f8; margin-bottom: 18px; border: 1px solid #c9e6eb; }
.alert.danger { background: #fff0ec; border-color: #f0c3b9; }
.alert-link { display: inline-flex; margin-left: 10px; font-weight: 800; }
.auth-panel, .panel, .table-wrap {
    background: rgba(255, 255, 255, .9);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 22px;
    margin-bottom: 22px;
    backdrop-filter: blur(14px);
}
.auth-panel { max-width: 420px; margin: 60px auto; }
.home-hero {
    min-height: calc(100vh - 132px);
    display: grid;
    align-items: center;
    padding: clamp(40px, 8vw, 96px) 0;
}
.home-hero__content {
    max-width: 820px;
    margin-left: auto;
    padding: clamp(20px, 4vw, 44px) 0;
    text-shadow: 0 2px 18px rgba(255, 248, 232, .72);
}
.home-hero__brand {
    margin: 0 0 14px;
    color: var(--sea);
    font-family: "Cormorant Upright", serif;
    font-size: clamp(28px, 4vw, 42px);
    font-weight: 900;
    line-height: 1;
    letter-spacing: 0;
}
.home-hero h1,
.home-hero h2 {
    max-width: 720px;
    font-family: "Cormorant Upright", serif;
    font-weight: 700;
    font-size: clamp(34px, 5.4vw, 58px);
    line-height: 1.08;
    letter-spacing: 0;
    color: #173b3f;
}
.home-hero p {
    max-width: 620px;
    font-size: 18px;
    color: #33434d;
    font-weight: 600;
}
.home-hero__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 26px;
}
.home-sections {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
}
.home-sections article {
    min-height: 170px;
    padding: 22px;
    border: 1px solid rgba(255, 255, 255, .72);
    border-radius: 8px;
    background: rgba(255, 255, 255, .78);
    box-shadow: 0 18px 44px rgba(23, 59, 63, .1);
    backdrop-filter: blur(12px);
}
.auth-panel.installer { max-width: 620px; }
.installer h2 { margin-top: 18px; font-size: 18px; }
.form { display: grid; gap: 14px; }
.grid-form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-form label:has(textarea), .grid-form .checks, .grid-form .form-section, .grid-form button { grid-column: 1 / -1; }
label { display: grid; gap: 7px; font-weight: 700; }
input, textarea, select {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 11px 12px;
    font: inherit;
    background: #fff;
}
table { width: 100%; border-collapse: collapse; }
th, td { padding: 14px; text-align: left; border-bottom: 1px solid var(--line); }
th { color: var(--muted); font-size: 13px; text-transform: uppercase; }
.badge { background: #f5ead2; color: #765a18; border-radius: 999px; padding: 5px 9px; font-size: 13px; }
.upload { display: flex; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.photo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
    gap: 14px;
}
.photo-grid figure {
    margin: 0;
    background: #fbf7ed;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 8px;
}
.photo-grid img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 6px; }
figcaption { margin: 8px 0; color: var(--muted); font-size: 13px; overflow-wrap: anywhere; }
.checks {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 8px;
    max-height: 220px;
    overflow: auto;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 12px;
}
.checks label { display: flex; align-items: center; gap: 8px; font-weight: 500; }
.checks input { width: auto; }
.form-section {
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 18px;
    background: #fffdf8;
}
.form-section__head {
    margin-bottom: 14px;
}
.form-section__head h3 {
    margin: 0 0 4px;
    font-size: 18px;
}
.form-section__head p {
    margin: 0;
}
.form-hint {
    display: inline-flex;
    margin-top: 8px;
    padding: 6px 9px;
    border-radius: 999px;
    background: #e8f6f8;
    color: var(--sea);
    font-size: 13px;
    font-weight: 800;
}
.background-options {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 12px;
}
.background-tile {
    display: grid;
    gap: 8px;
    padding: 9px;
    border: 2px solid transparent;
    border-radius: 8px;
    background: #fff;
    cursor: pointer;
    transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease;
}
.background-tile:hover,
.background-tile.is-selected,
.background-tile:has(input:checked) {
    border-color: var(--sea);
    box-shadow: 0 10px 24px rgba(15, 124, 140, .14);
    transform: translateY(-1px);
}
.background-tile input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}
.background-tile__preview {
    display: block;
    width: 100%;
    aspect-ratio: 16 / 10;
    border-radius: 6px;
    background-color: #f4efe4;
    background-image: linear-gradient(135deg, #f8f1de, #d8eef1);
    background-position: center;
    background-size: cover;
    border: 1px solid var(--line);
}
.background-tile--empty .background-tile__preview {
    background-image:
        linear-gradient(45deg, #f3ead8 25%, transparent 25%),
        linear-gradient(-45deg, #f3ead8 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, #f3ead8 75%),
        linear-gradient(-45deg, transparent 75%, #f3ead8 75%);
    background-size: 18px 18px;
    background-position: 0 0, 0 9px, 9px -9px, -9px 0;
}
.background-tile--custom .background-tile__preview {
    background-image: linear-gradient(135deg, #ffffff, #e8f6f8 52%, #ead9b8);
}
.background-tile strong {
    font-size: 13px;
    line-height: 1.25;
}
.background-upload,
.background-opacity {
    margin-top: 14px;
}
.background-opacity {
    grid-template-columns: 1fr auto;
    align-items: center;
}
.background-opacity input {
    grid-column: 1 / -1;
    padding: 0;
}
.background-opacity span {
    color: var(--muted);
    font-weight: 700;
}
.background-opacity small {
    grid-column: 1 / -1;
    color: var(--muted);
    font-weight: 600;
}
.page-list { display: grid; gap: 12px; margin-top: 18px; }
.page-list article { border-left: 4px solid var(--gold); background: #fffaf0; padding: 14px; border-radius: 0 8px 8px 0; }

.account-panel {
    display: grid;
    gap: 20px;
}
.account-summary {
    display: flex;
    align-items: center;
    gap: 16px;
}
.account-avatar {
    width: 58px;
    height: 58px;
    display: inline-grid;
    place-items: center;
    border-radius: 50%;
    background: var(--sea);
    color: #fff;
    font-size: 26px;
    font-weight: 900;
}
.details-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 12px;
    margin: 0;
}
.details-list div {
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(255, 250, 240, .7);
}
.details-list dt {
    color: var(--muted);
    font-size: 13px;
    font-weight: 800;
    text-transform: uppercase;
}
.details-list dd {
    margin: 6px 0 0;
    color: var(--ink);
    font-size: 18px;
    font-weight: 800;
}

.public-album { background: #fffdf7; }
.cover {
    min-height: 86vh;
    display: grid;
    align-items: end;
    position: relative;
    overflow: hidden;
    background: #173b3f;
}
.cover > img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: .72;
}
.cover-copy {
    position: relative;
    width: min(920px, calc(100% - 32px));
    margin: 0 auto 8vh;
    color: #fff;
}
.cover-copy h1 { font-size: clamp(42px, 8vw, 88px); line-height: 1; }
.cover-copy p, .cover-copy span { color: #fff8e8; font-size: 18px; }
.album-pages { width: min(1160px, calc(100% - 32px)); margin: 44px auto; display: grid; gap: 38px; }
.album-page {
    display: grid;
    grid-template-columns: minmax(220px, 330px) 1fr;
    gap: 26px;
    align-items: start;
    padding-bottom: 38px;
    border-bottom: 1px solid var(--line);
}
.page-copy { position: sticky; top: 24px; }
.page-copy h2 { font-size: 32px; }
.album-photo-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}
.layout-single .album-photo-grid, .layout-hero_text .album-photo-grid { grid-template-columns: 1fr; }
.layout-collage .album-photo-grid { grid-template-columns: 1.2fr 1fr 1fr; }
.lightbox-trigger {
    border: 0;
    padding: 0;
    background: transparent;
    cursor: zoom-in;
}
.lightbox-trigger img {
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    border-radius: 8px;
}
.layout-single .lightbox-trigger img, .layout-hero_text .lightbox-trigger img { aspect-ratio: 16 / 10; }
.qr { width: 132px; height: 132px; border: 8px solid #fff; box-shadow: 0 8px 30px rgba(0,0,0,.12); }
dialog#lightbox {
    width: min(1100px, 92vw);
    border: 0;
    padding: 0;
    background: transparent;
}
dialog#lightbox::backdrop { background: rgba(0,0,0,.82); }
#lightbox img { width: 100%; max-height: 86vh; object-fit: contain; }
.close-lightbox { margin-bottom: 10px; float: right; border: 0; padding: 9px 12px; border-radius: 8px; }

@media (max-width: 760px) {
    .page-head, .album-page { grid-template-columns: 1fr; display: grid; }
    .grid-form { grid-template-columns: 1fr; }
    .home-sections { grid-template-columns: 1fr; }
    .home-hero { min-height: auto; padding-top: 52px; }
    .home-hero__content {
        margin-left: 0;
        padding: 24px;
        border-radius: 8px;
        background: rgba(255, 250, 240, .64);
    }
    .album-photo-grid, .layout-collage .album-photo-grid { grid-template-columns: 1fr; }
    .page-copy { position: static; }
    .topbar { padding: 0 16px; }
}
