:root {
    --ink: #2d1b14;
    --ink-soft: #6b5347;
    --maroon: #8c2342;
    --maroon-dark: #5e162c;
    --gold: #c08a2e;
    --gold-soft: #e8c87d;
    --cream: #fffaf3;
    --blush: #fbeee4;
    --line: #ecd9c6;
    --green: #2f7d4f;
    --red: #b63b3b;
    --amber: #b5791d;
    --radius: 16px;
    --shadow: 0 10px 30px rgba(94, 22, 44, .10);
    --shadow-lg: 0 20px 55px rgba(94, 22, 44, .18);
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
    background:
        radial-gradient(1100px 520px at 12% -12%, #fdf0e2 0%, rgba(253, 240, 226, 0) 60%),
        radial-gradient(900px 480px at 92% 0%, #fbe6ec 0%, rgba(251, 230, 236, 0) 55%),
        var(--cream);
    color: var(--ink);
    font-family: "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, Helvetica, Arial, sans-serif;
    font-size: 16px;
    line-height: 1.55;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, .serif {
    font-family: "Gill Sans", Georgia, "Times New Roman", serif;
    letter-spacing: .01em;
    color: var(--maroon-dark);
    margin: 0 0 .4em;
    font-weight: 600;
}

h1 { font-size: clamp(1.9rem, 5vw, 2.9rem); line-height: 1.15; }
h2 { font-size: clamp(1.3rem, 3vw, 1.7rem); }
h3 { font-size: 1.08rem; }

a { color: var(--maroon); text-decoration: none; }
a:hover { text-decoration: underline; }

.wrap { max-width: 1140px; margin: 0 auto; padding: 0 20px; }
.narrow { max-width: 760px; }

.muted { color: var(--ink-soft); }
.small { font-size: .85rem; }
.tiny { font-size: .78rem; }
.mono { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: .85em; }
.center { text-align: center; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spread { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.stack { display: grid; gap: 14px; }
.hidden { display: none !important; }
.grow { flex: 1 1 auto; min-width: 0; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.ornament {
    display: flex; align-items: center; gap: 12px;
    color: var(--gold); justify-content: center; margin: 10px 0 18px;
}
.ornament::before, .ornament::after {
    content: ""; height: 1px; flex: 1 1 60px; max-width: 150px;
    background: linear-gradient(90deg, transparent, var(--gold-soft), transparent);
}

.card {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 20px;
}
.card.flat { box-shadow: none; }
.card + .card { margin-top: 16px; }

.grid { display: grid; gap: 16px; }
.grid.cols-2 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.grid.cols-4 { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    padding: 10px 18px; border-radius: 999px; border: 1px solid transparent;
    background: linear-gradient(135deg, var(--maroon), var(--maroon-dark));
    color: #fff; font-weight: 600; font-size: .95rem; cursor: pointer;
    transition: transform .12s ease, box-shadow .12s ease, opacity .12s ease;
    text-decoration: none; line-height: 1.2;
}
.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow); text-decoration: none; }
.btn:disabled, .btn[disabled] { opacity: .5; cursor: not-allowed; transform: none; }
.btn.ghost { background: #fff; color: var(--maroon); border-color: var(--line); }
.btn.gold { background: linear-gradient(135deg, var(--gold), #a9731f); }
.btn.green { background: linear-gradient(135deg, #2f7d4f, #1f5c39); }
.btn.danger { background: #fff; color: var(--red); border-color: #efc9c9; }
.btn.sm { padding: 6px 13px; font-size: .83rem; }
.btn.block { width: 100%; }

label.field { display: block; margin-bottom: 12px; }
label.field > span {
    display: block; font-size: .8rem; font-weight: 700; letter-spacing: .04em;
    text-transform: uppercase; color: var(--ink-soft); margin-bottom: 5px;
}
input[type=text], input[type=tel], input[type=date], input[type=number],
input[type=password], input[type=url], input[type=file], select, textarea {
    width: 100%; padding: 10px 13px; border: 1px solid var(--line); border-radius: 11px;
    background: #fff; font: inherit; font-size: .95rem; color: var(--ink);
}
input:focus, select:focus, textarea:focus {
    outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(232, 200, 125, .35);
}
textarea { min-height: 86px; resize: vertical; }
.field-row { display: grid; gap: 12px; grid-template-columns: 1fr 1fr; }
@media (max-width: 560px) { .field-row { grid-template-columns: 1fr; } }

.pill {
    display: inline-flex; align-items: center; gap: 5px; padding: 3px 11px;
    border-radius: 999px; font-size: .74rem; font-weight: 700; letter-spacing: .03em;
    background: var(--blush); color: var(--maroon-dark); border: 1px solid var(--line);
    white-space: nowrap;
}
.pill.green { background: #e7f4ec; color: #1f5c39; border-color: #bfe0cd; }
.pill.red { background: #fbeaea; color: #8d2b2b; border-color: #efc9c9; }
.pill.amber { background: #fdf3df; color: #8a5a10; border-color: #f0dcae; }
.pill.grey { background: #f2efec; color: #6b5347; border-color: #e3dcd5; }
.pill.blue { background: #e8eff9; color: #28527f; border-color: #c7d8ee; }

.stat {
    background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
    padding: 15px 17px; box-shadow: var(--shadow);
}
.stat b { display: block; font-size: 1.85rem; line-height: 1.1; color: var(--maroon-dark); font-family: Georgia, serif; }
.stat span { font-size: .76rem; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-soft); font-weight: 700; }

.table-wrap { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--line); background: #fff; }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th, td { padding: 11px 13px; text-align: left; border-bottom: 1px solid #f3e8dc; vertical-align: middle; }
th { background: var(--blush); font-size: .74rem; text-transform: uppercase; letter-spacing: .06em; color: var(--maroon-dark); font-weight: 800; white-space: nowrap; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: #fffdf9; }

.video-frame {
    position: relative; border-radius: 20px; overflow: hidden;
    background: #16100d; box-shadow: var(--shadow-lg); border: 1px solid var(--line);
}
.video-frame video, .video-frame iframe {
    display: block; width: 100%; max-height: 74vh; border: 0; aspect-ratio: 16 / 9; background: #000;
}
.video-frame video { object-fit: contain; }

#toast {
    position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%) translateY(24px);
    background: var(--maroon-dark); color: #fff; padding: 11px 20px; border-radius: 999px;
    box-shadow: var(--shadow-lg); opacity: 0; pointer-events: none; transition: all .22s ease;
    z-index: 999; font-size: .9rem; max-width: 92vw; text-align: center;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
#toast.err { background: var(--red); }

.overlay {
    position: fixed; inset: 0; background: rgba(45, 27, 20, .45);
    display: flex; align-items: flex-start; justify-content: center;
    padding: 28px 14px; overflow-y: auto; z-index: 500; backdrop-filter: blur(2px);
}
.modal {
    background: var(--cream); border-radius: 20px; width: min(760px, 100%);
    box-shadow: var(--shadow-lg); border: 1px solid var(--line); padding: 22px;
}
.modal.wide { width: min(1000px, 100%); }

.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 18px; }
.tab {
    padding: 8px 17px; border-radius: 999px; border: 1px solid var(--line);
    background: #fff; cursor: pointer; font-weight: 600; font-size: .9rem; color: var(--ink-soft);
}
.tab.active { background: linear-gradient(135deg, var(--maroon), var(--maroon-dark)); color: #fff; border-color: transparent; }

.topbar {
    background: rgba(255, 250, 243, .92); border-bottom: 1px solid var(--line);
    position: sticky; top: 0; z-index: 100; backdrop-filter: blur(8px);
}
.topbar .wrap { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding-top: 12px; padding-bottom: 12px; }
.brand { display: flex; align-items: center; gap: 10px; font-family: Georgia, serif; font-size: 1.12rem; color: var(--maroon-dark); font-weight: 700; }
.brand .mark {
    width: 34px; height: 34px; border-radius: 50%; flex: none;
    background: linear-gradient(135deg, var(--gold), var(--maroon));
    display: grid; place-items: center; color: #fff; font-size: 1rem;
}

.empty { padding: 36px 18px; text-align: center; color: var(--ink-soft); }
.linkbox {
    display: flex; gap: 8px; align-items: center; background: var(--blush);
    border: 1px dashed var(--gold-soft); border-radius: 11px; padding: 8px 12px;
}
.linkbox code { flex: 1 1 auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .82rem; }
.timeline { display: grid; gap: 9px; }
.timeline .ev {
    border-left: 3px solid var(--gold-soft); padding: 8px 12px; background: #fff;
    border-radius: 0 11px 11px 0; border-top: 1px solid var(--line);
    border-right: 1px solid var(--line); border-bottom: 1px solid var(--line);
}
.spinner {
    width: 16px; height: 16px; border-radius: 50%; display: inline-block;
    border: 2px solid var(--gold-soft); border-top-color: var(--maroon);
    animation: spin .7s linear infinite; vertical-align: -3px;
}
@keyframes spin { to { transform: rotate(360deg); } }

.fade-in { animation: fade .5s ease both; }
@keyframes fade { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
