:root {
    --bg: #efe8dc;
    --bg-deep: #e3d7c2;
    --surface: rgba(255, 252, 246, 0.88);
    --surface-strong: #fffdf8;
    --ink: #181512;
    --muted: #6e655d;
    --soft: #9b9187;
    --line: rgba(81, 63, 45, 0.12);
    --accent: #154c52;
    --accent-strong: #0f3e43;
    --accent-soft: rgba(21, 76, 82, 0.1);
    --secondary: #8e5b3b;
    --danger: #9e3d45;
    --danger-soft: rgba(158, 61, 69, 0.12);
    --shadow-lg: 0 30px 60px rgba(35, 27, 20, 0.12);
    --shadow-md: 0 16px 32px rgba(35, 27, 20, 0.08);
    --radius-xl: 30px;
    --container: min(1180px, calc(100% - 32px));
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
    margin: 0;
    color: var(--ink);
    font-family: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
    background:
        radial-gradient(circle at top left, rgba(21, 76, 82, 0.14), transparent 26%),
        radial-gradient(circle at 85% 12%, rgba(142, 91, 59, 0.10), transparent 20%),
        linear-gradient(180deg, #f7f1e7 0%, var(--bg) 52%, var(--bg-deep) 100%);
    min-height: 100vh;
}
h1, h2, h3, strong, .brand strong {
    font-family: Georgia, "Times New Roman", serif;
    letter-spacing: -0.02em;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button, input, textarea, select { font: inherit; }

.bg-noise {
    position: fixed;
    inset: 0;
    pointer-events: none;
    opacity: 0.28;
    background-image:
        linear-gradient(rgba(255,255,255,0.04) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,0.04) 1px, transparent 1px);
    background-size: 22px 22px;
    mask-image: radial-gradient(circle at center, black, transparent 90%);
}

input, textarea, select {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: var(--surface-strong);
    color: var(--ink);
    padding: 0.95rem 1rem;
    transition: border-color 0.18s ease, box-shadow 0.18s ease;
}
input:focus, textarea:focus, select:focus {
    outline: none;
    border-color: rgba(21, 76, 82, 0.45);
    box-shadow: 0 0 0 4px rgba(21, 76, 82, 0.10);
}
label { display: grid; gap: 0.45rem; color: var(--muted); font-size: 0.95rem; }
label > span { font-weight: 600; color: var(--ink); }

.site-header, .site-footer, .page-wrap, .admin-main {
    width: var(--container);
    margin: 0 auto;
    position: relative;
    z-index: 1;
}

.shell-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    padding: 18px 22px;
    margin-top: 18px;
    background: rgba(255, 252, 246, 0.7);
    border: 1px solid rgba(81, 63, 45, 0.08);
    border-radius: 24px;
    backdrop-filter: blur(16px);
    box-shadow: var(--shadow-md);
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 0.9rem;
    min-width: 0;
}
.brand span:last-child { display: grid; }
.brand strong {
    font-size: 1.15rem;
    line-height: 1;
}
.brand small {
    margin-top: 0.2rem;
    color: var(--muted);
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.14em;
}
.brand-mark {
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    border-radius: 14px;
    background: linear-gradient(145deg, var(--accent) 0%, var(--accent-strong) 100%);
    color: #fff;
    font-weight: 800;
}

.main-nav, .footer-links, .hero-actions, .actions-row, .filter-row, .link-actions {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    flex-wrap: wrap;
}

.nav-link {
    display: inline-flex;
    align-items: center;
    min-height: 42px;
    padding: 0 0.9rem;
    border-radius: 999px;
    color: var(--muted);
    transition: background 0.18s ease, color 0.18s ease;
}
.nav-link:hover { background: rgba(255,255,255,0.55); color: var(--ink); }

.page-wrap { padding: 22px 0 56px; }
.app-main, .admin-main-shell { display: grid; gap: 18px; }
.site-footer { margin-bottom: 28px; }
.footer-card {
    display: flex;
    justify-content: space-between;
    gap: 1.5rem;
    align-items: flex-end;
}
.site-footer p {
    margin: 0.45rem 0 0;
    color: var(--muted);
    max-width: 44rem;
}

.button, .link-button {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    min-height: 46px;
    padding: 0.85rem 1.2rem;
    border-radius: 999px;
    border: 1px solid transparent;
    background: linear-gradient(180deg, var(--accent) 0%, var(--accent-strong) 100%);
    color: #fff;
    box-shadow: 0 12px 24px rgba(21, 76, 82, 0.18);
    transition: transform 0.16s ease, box-shadow 0.16s ease;
}
.button:hover, .link-button:hover {
    transform: translateY(-1px);
    box-shadow: 0 18px 26px rgba(21, 76, 82, 0.22);
}
.button.subtle, .link-button {
    background: rgba(255, 255, 255, 0.55);
    color: var(--ink);
    border-color: var(--line);
    box-shadow: none;
}
.button.danger {
    background: linear-gradient(180deg, #b24b54 0%, var(--danger) 100%);
}
.button.full, .full { width: 100%; }

.hero {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) 360px;
    gap: 18px;
    align-items: stretch;
}
.hero-copy, .card, .glass-card {
    position: relative;
    overflow: hidden;
    background: var(--surface);
    border: 1px solid rgba(81, 63, 45, 0.08);
    border-radius: var(--radius-xl);
    backdrop-filter: blur(14px);
    box-shadow: var(--shadow-lg);
}
.hero-copy::before, .card::before, .glass-card::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(255,255,255,0.32), rgba(255,255,255,0));
    pointer-events: none;
}
.hero-copy { padding: 42px; }
.hero-copy h1 {
    font-size: clamp(3rem, 6vw, 5.4rem);
    line-height: 0.92;
    margin: 0.2rem 0 1rem;
    max-width: 12ch;
}
.hero-copy p {
    max-width: 56rem;
    color: var(--muted);
    font-size: 1.08rem;
    line-height: 1.7;
    margin-bottom: 1.4rem;
}
.glass-card {
    width: 100%;
    padding: 28px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 1rem;
}
.panel-kicker {
    display: inline-flex;
    align-items: center;
    width: fit-content;
    padding: 0.35rem 0.7rem;
    border-radius: 999px;
    background: var(--accent-soft);
    color: var(--accent);
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}
.mini-terminal {
    display: grid;
    gap: 0.55rem;
    padding: 1rem 1.05rem;
    border-radius: 18px;
    background: #161310;
    color: #f5efe7;
    font-family: Consolas, monospace;
    font-size: 0.84rem;
}

.hero-stat-row {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 1.3rem;
}
.hero-stat {
    padding: 0.95rem 1rem;
    background: rgba(255,255,255,0.52);
    border: 1px solid var(--line);
    border-radius: 18px;
}
.hero-stat strong {
    display: block;
    font-size: 1.35rem;
}
.hero-stat span {
    display: block;
    margin-top: 0.2rem;
    color: var(--muted);
    font-size: 0.88rem;
}

.eyebrow {
    display: inline-block;
    text-transform: uppercase;
    letter-spacing: 0.16em;
    font-size: 0.76rem;
    color: var(--secondary);
    font-weight: 700;
}
.section-lead {
    margin: 0.4rem 0 0;
    color: var(--muted);
    max-width: 54rem;
    line-height: 1.7;
}

.grid { display: grid; gap: 18px; margin-bottom: 18px; }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.card { padding: 26px; }
.card h1 {
    font-size: clamp(2rem, 4vw, 3.2rem);
    line-height: 0.98;
    margin: 0.25rem 0 0.8rem;
}
.card h2 {
    font-size: 1.5rem;
    margin: 0 0 0.65rem;
}
.card p {
    color: var(--muted);
    line-height: 1.7;
}
.section-card { padding: 28px; }
.feature-card {
    min-height: 220px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}
.faq-list details {
    padding: 1rem 0;
    border-top: 1px solid var(--line);
}
.faq-list summary {
    cursor: pointer;
    font-weight: 700;
    list-style: none;
}
.faq-list summary::-webkit-details-marker { display: none; }
.clean-list {
    margin: 0;
    padding-left: 1.1rem;
    color: var(--muted);
    line-height: 1.8;
}

.auth-panel {
    display: grid;
    place-items: center;
    min-height: 72vh;
}
.admin-auth-shell {
    min-height: 100vh;
}
.admin-auth-wrap {
    width: var(--container);
    margin: 0 auto;
    padding: 28px 0 40px;
    position: relative;
    z-index: 1;
}
.admin-auth-grid {
    width: 100%;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(360px, 460px);
    gap: 18px;
    align-items: stretch;
}
.admin-auth-copy,
.admin-auth-card {
    min-height: 100%;
}
.admin-auth-copy {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}
.admin-auth-copy h1 {
    max-width: 11ch;
}
.admin-auth-copy p {
    max-width: 56ch;
}
.admin-auth-steps {
    display: grid;
    gap: 12px;
    margin: 1.4rem 0 1.2rem;
}
.auth-step {
    display: grid;
    grid-template-columns: 42px 1fr;
    gap: 12px;
    align-items: center;
    padding: 0.9rem 1rem;
    border-radius: 18px;
    border: 1px solid var(--line);
    background: rgba(255,255,255,0.42);
}
.auth-step strong {
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    border-radius: 14px;
    background: var(--accent-soft);
    color: var(--accent);
    font-size: 1rem;
}
.auth-step span {
    color: var(--muted);
    line-height: 1.6;
}
.inline-link {
    width: fit-content;
    padding-left: 0;
    padding-right: 0;
}
.narrow {
    width: min(680px, 100%);
    margin: 0 auto;
}
.stack { display: grid; gap: 1rem; }
.secret-box {
    font-family: Consolas, monospace;
    font-size: 1.28rem;
    line-height: 1.7;
    letter-spacing: 0.08em;
    padding: 1rem 1.1rem;
    border-radius: 20px;
    background: linear-gradient(180deg, #171310 0%, #0e0b09 100%);
    color: #f4ede5;
    margin: 1rem 0;
}

.dashboard-header, .table-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 1rem;
    margin-bottom: 0.8rem;
}

.metrics strong {
    display: block;
    font-size: 2.3rem;
    line-height: 1;
}
.metrics span { color: var(--muted); }
.metric-card {
    background:
        radial-gradient(circle at top right, rgba(21, 76, 82, 0.09), transparent 36%),
        var(--surface);
}

.link-list {
    display: grid;
    gap: 14px;
}
.link-card {
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: 24px;
    background: rgba(255,255,255,0.46);
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) 140px minmax(0, 0.9fr);
    gap: 18px;
    align-items: center;
}
.link-primary h3 {
    font-size: 1.25rem;
    margin: 0.55rem 0 0.4rem;
}
.link-primary p { margin: 0 0 0.35rem; }
.link-primary a {
    color: var(--accent);
    font-weight: 700;
}
.truncate-line {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.truncate-inline {
    display: inline-block;
    max-width: 240px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    vertical-align: bottom;
}
.table-subline {
    margin-top: 0.25rem;
    color: var(--muted);
    font-size: 0.85rem;
    line-height: 1.45;
    word-break: break-word;
}
.badge-row {
    display: flex;
    gap: 0.35rem;
    flex-wrap: wrap;
    align-items: center;
}
.status-badge {
    display: inline-flex;
    align-items: center;
    min-height: 26px;
    padding: 0 0.65rem;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    background: rgba(24, 21, 18, 0.08);
    color: var(--ink);
}
.status-badge.muted {
    background: rgba(24, 21, 18, 0.08);
    color: var(--muted);
}
.status-badge.warning {
    background: rgba(142, 91, 59, 0.14);
    color: #7a492d;
}
.status-badge.danger {
    background: rgba(158, 61, 69, 0.14);
    color: #7b2d35;
}
.link-badges {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}
.tag {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: 0 0.7rem;
    border-radius: 999px;
    background: rgba(21, 76, 82, 0.12);
    color: var(--accent);
    font-size: 0.78rem;
    font-weight: 700;
}
.tag.muted {
    background: rgba(24, 21, 18, 0.06);
    color: var(--muted);
}
.link-meta {
    display: grid;
    gap: 0.65rem;
    justify-items: center;
    color: var(--muted);
}
.meta-note {
    font-size: 0.85rem;
    text-align: center;
}
.qr-thumb, .qr-large {
    background: #fff;
    border: 1px solid var(--line);
    box-shadow: var(--shadow-md);
}
.qr-thumb {
    width: 92px;
    height: 92px;
    border-radius: 18px;
    padding: 0.4rem;
}
.qr-large {
    width: 220px;
    border-radius: 24px;
    padding: 1rem;
}
.link-actions { justify-content: flex-end; }
.link-actions form { margin: 0; }

.table-wrap {
    overflow-x: auto;
    border: 1px solid var(--line);
    border-radius: 22px;
    background: rgba(255,255,255,0.46);
}
table { width: 100%; border-collapse: collapse; }
th, td {
    text-align: left;
    padding: 0.95rem 1rem;
    border-bottom: 1px solid var(--line);
    vertical-align: top;
}
thead th { background: rgba(255,255,255,0.6); }
th {
    font-size: 0.76rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--soft);
}
tbody tr:hover { background: rgba(255,255,255,0.35); }

.empty-state, .center {
    text-align: center;
    color: var(--muted);
    padding: 2.6rem 1rem;
}
.form-grid .full-span { grid-column: 1 / -1; }
.checkbox {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-height: 48px;
    padding: 0.8rem 1rem;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: rgba(255,255,255,0.48);
}
.checkbox input { width: auto; margin: 0; }

.flash {
    padding: 1rem 1.1rem;
    border-radius: 18px;
    border: 1px solid transparent;
    margin-bottom: 1rem;
    box-shadow: var(--shadow-md);
}
.flash.success {
    background: rgba(21, 76, 82, 0.12);
    color: #09373b;
    border-color: rgba(21, 76, 82, 0.14);
}
.flash.error {
    background: var(--danger-soft);
    color: #74262e;
    border-color: rgba(158, 61, 69, 0.14);
}

.admin-shell {
    display: grid;
    grid-template-columns: 300px 1fr;
    min-height: 100vh;
    position: relative;
}
.admin-sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    padding: 22px;
    border-right: 1px solid var(--line);
    background: rgba(255, 251, 245, 0.72);
    backdrop-filter: blur(16px);
    display: flex;
    flex-direction: column;
    gap: 18px;
    z-index: 1;
}
.admin-nav {
    display: grid;
    gap: 6px;
}
.admin-nav-link {
    display: flex;
    align-items: center;
    min-height: 46px;
    padding: 0 14px;
    border-radius: 14px;
    color: var(--muted);
    transition: background 0.18s ease, color 0.18s ease, transform 0.18s ease;
}
.admin-nav-link:hover {
    background: rgba(255,255,255,0.56);
    color: var(--ink);
    transform: translateX(2px);
}
.admin-main { padding: 24px 0; }

.settings-grid {
    display: grid;
    gap: 12px;
    grid-template-columns: repeat(3, minmax(0, 1fr));
}
.settings-grid div {
    padding: 1rem;
    background: rgba(255,255,255,0.46);
    border-radius: 18px;
    border: 1px solid var(--line);
    display: grid;
    gap: 0.35rem;
}
.settings-grid strong { font-size: 0.95rem; }
.settings-grid span {
    color: var(--muted);
    font-size: 0.92rem;
    word-break: break-word;
}
.prose-card h1 { font-size: 2.8rem; }
.legal-card {
    max-width: 920px;
    margin: 0 auto;
}
.legal-card h2 {
    margin-top: 1.8rem;
    margin-bottom: 0.55rem;
}
.legal-card p {
    max-width: 72ch;
}

@media (max-width: 1080px) {
    .hero,
    .admin-auth-grid,
    .grid.three,
    .grid.four,
    .link-card,
    .admin-shell,
    .grid.two,
    .settings-grid,
    .hero-stat-row {
        grid-template-columns: 1fr;
    }

    .site-header,
    .site-footer,
    .dashboard-header,
    .table-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .footer-card { align-items: flex-start; }
    .admin-sidebar {
        position: relative;
        height: auto;
        border-right: 0;
        border-bottom: 1px solid var(--line);
    }
    .link-actions { justify-content: flex-start; }
}

@media (max-width: 640px) {
    :root { --container: min(100% - 20px, 1180px); }
    .shell-bar, .hero-copy, .card, .glass-card { border-radius: 22px; }
    .hero-copy { padding: 28px 22px; }
    .card { padding: 22px; }
    .admin-auth-wrap { padding-top: 18px; }
    .button, .link-button, .nav-link { width: 100%; }
    .main-nav { width: 100%; }
}
