:root {
    --bg: #f6efe7;
    --bg-accent: #efe1d3;
    --panel: rgba(255, 255, 255, 0.86);
    --line: rgba(86, 56, 34, 0.14);
    --text: #2f241c;
    --muted: #6e5746;
    --brand: #ab4e2a;
    --brand-dark: #7b3217;
    --danger: #a13232;
    --warning: #aa6a17;
    --shadow: 0 22px 60px rgba(73, 38, 18, 0.14);
    --radius: 24px;
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    min-height: 100%;
    font-family: Georgia, "Times New Roman", serif;
    color: var(--text);
    background:
        radial-gradient(circle at top left, rgba(255, 208, 170, 0.6), transparent 30%),
        radial-gradient(circle at right, rgba(204, 145, 96, 0.16), transparent 22%),
        linear-gradient(135deg, var(--bg), #f9f6f0 42%, #f3e7d9);
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    background-image: linear-gradient(rgba(255,255,255,0.1) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,0.1) 1px, transparent 1px);
    background-size: 24px 24px;
    pointer-events: none;
    opacity: 0.22;
}

a {
    color: inherit;
    text-decoration: none;
}

img {
    max-width: 100%;
    display: block;
}

.page-shell {
    position: relative;
    z-index: 1;
    width: min(1180px, calc(100% - 32px));
    margin: 0 auto;
    padding: 22px 0 40px;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 18px;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: rgba(255, 248, 241, 0.78);
    backdrop-filter: blur(18px);
    box-shadow: var(--shadow);
}

.brand {
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.topbar-links {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
}

.topbar-links a,
.link-button {
    font-size: 0.95rem;
    color: var(--muted);
}

.page-content {
    padding-top: 24px;
}

.hero,
.panel,
.viewer-shell,
.empty-state {
    border: 1px solid var(--line);
    background: var(--panel);
    backdrop-filter: blur(16px);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 26px;
}

.hero,
.admin-header,
.viewer-header,
.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
}

.hero h1,
.viewer-header h1,
.panel h1,
.empty-state h1 {
    margin: 8px 0 10px;
    font-size: clamp(2rem, 4vw, 3.6rem);
    line-height: 0.96;
}

.eyebrow,
.meta-text {
    font-size: 0.82rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--muted);
}

.lead,
.small-text,
small {
    color: var(--muted);
    line-height: 1.6;
}

.button,
button,
input,
textarea {
    font: inherit;
}

.button,
button[type="submit"] {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: 0;
    border-radius: 999px;
    padding: 12px 18px;
    background: linear-gradient(135deg, var(--brand), var(--brand-dark));
    color: #fff9f4;
    cursor: pointer;
    transition: transform 0.18s ease, box-shadow 0.18s ease;
    box-shadow: 0 14px 24px rgba(123, 50, 23, 0.2);
}

.button:hover,
button[type="submit"]:hover {
    transform: translateY(-1px);
}

.button.secondary {
    background: linear-gradient(135deg, #ecd7c4, #d7b497);
    color: var(--text);
}

.button.ghost {
    background: rgba(255, 255, 255, 0.64);
    color: var(--text);
    box-shadow: none;
    border: 1px solid var(--line);
}

.button.danger {
    background: linear-gradient(135deg, #b33e3e, #862626);
}

.button.small {
    padding: 9px 14px;
    font-size: 0.88rem;
}

.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-top: 24px;
}

.site-card {
    display: grid;
    gap: 16px;
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: rgba(255, 251, 246, 0.76);
    box-shadow: 0 16px 40px rgba(73, 38, 18, 0.08);
}

.logo-wrap {
    padding: 16px;
    border-radius: 20px;
    background: linear-gradient(180deg, rgba(255,255,255,0.72), rgba(240,222,206,0.8));
    min-height: 140px;
    display: grid;
    place-items: center;
}

.site-logo {
    max-height: 100px;
    object-fit: contain;
}

.site-logo.placeholder {
    width: 84px;
    height: 84px;
    border-radius: 24px;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, #f4d4b5, #d89d71);
    color: #5a2c10;
    font-size: 2rem;
    font-weight: 700;
}

.site-card-body {
    display: grid;
    gap: 10px;
}

.site-card-body h2,
.panel-header h1 {
    margin: 0;
    font-size: 1.5rem;
}

.flash {
    margin-bottom: 18px;
    padding: 14px 16px;
    border-radius: 18px;
    border: 1px solid transparent;
}

.flash-success {
    background: rgba(184, 227, 199, 0.4);
    border-color: rgba(86, 145, 102, 0.26);
}

.flash-error {
    background: rgba(232, 173, 173, 0.35);
    border-color: rgba(161, 50, 50, 0.24);
}

.flash-warning {
    background: rgba(237, 213, 163, 0.42);
    border-color: rgba(170, 106, 23, 0.28);
}

.auth-panel,
.empty-state {
    max-width: 680px;
    margin: 0 auto;
}

.form-grid {
    display: grid;
    gap: 18px;
}

.form-grid label {
    display: grid;
    gap: 8px;
}

.form-grid input,
.form-grid textarea {
    width: 100%;
    padding: 13px 15px;
    border-radius: 18px;
    border: 1px solid rgba(88, 56, 34, 0.16);
    background: rgba(255, 253, 250, 0.94);
    color: var(--text);
}

.form-grid textarea {
    resize: vertical;
    min-height: 170px;
}

.field-error {
    color: var(--danger);
}

.full-width {
    grid-column: 1 / -1;
}

.preview-logo {
    width: 96px;
    height: 96px;
    object-fit: contain;
    padding: 12px;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.88);
    border: 1px solid var(--line);
}

.table-wrap {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th,
.data-table td {
    padding: 14px 12px;
    text-align: left;
    border-bottom: 1px solid var(--line);
    vertical-align: top;
}

.actions-cell {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.actions-cell form,
.inline-form {
    display: inline-flex;
    margin: 0;
}

.link-button {
    padding: 0;
    background: transparent;
    border: 0;
    cursor: pointer;
}

.viewer-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.viewer-frame-wrap {
    margin-top: 20px;
    border-radius: 18px;
    overflow: hidden;
    border: 1px solid var(--line);
    background: #fff;
    min-height: 72vh;
}

.viewer-frame {
    width: 100%;
    min-height: 72vh;
    border: 0;
    background: #fff;
}

@media (max-width: 768px) {
    .page-shell {
        width: min(100% - 20px, 1180px);
    }

    .topbar,
    .hero,
    .admin-header,
    .viewer-header,
    .panel-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .hero h1,
    .viewer-header h1,
    .panel h1,
    .empty-state h1 {
        font-size: 2.2rem;
    }

    .viewer-frame,
    .viewer-frame-wrap {
        min-height: 62vh;
    }
}
