:root {
    --bg: #f4efe7;
    --surface: rgba(255, 255, 255, 0.92);
    --surface-strong: #ffffff;
    --text: #1f2933;
    --muted: #667085;
    --line: #d7d2c9;
    --accent: #0e7490;
    --accent-soft: #d7f0f6;
    --danger: #b42318;
    --danger-soft: #fde7e4;
    --success: #027a48;
    --success-soft: #daf5e8;
    --shadow: 0 24px 60px rgba(31, 41, 51, 0.12);
    --radius: 24px;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    color: var(--text);
    font-family: "Trebuchet MS", "Segoe UI", sans-serif;
    background:
        radial-gradient(circle at top left, rgba(14, 116, 144, 0.18), transparent 30%),
        radial-gradient(circle at bottom right, rgba(244, 162, 97, 0.22), transparent 28%),
        linear-gradient(180deg, #f9f5ef 0%, var(--bg) 100%);
    position: relative;
    overflow-x: hidden;
}

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

.page-background {
    position: fixed;
    inset: 0;
    z-index: 0;
    display: grid;
    grid-template-columns: repeat(8, minmax(0, 1fr));
    align-content: stretch;
    gap: 0;
    opacity: 0.56;
    overflow: hidden;
}

.page-background__tile {
    display: block;
    width: 100%;
    height: 100%;
    aspect-ratio: 736 / 1104;
    background-position: center;
    background-repeat: no-repeat;
    background-size: 100% 100%;
    filter: saturate(1.02) contrast(1.01);
}

.page-overlay {
    position: fixed;
    inset: 0;
    z-index: 1;
    background:
        linear-gradient(180deg, rgba(248, 244, 238, 0.68), rgba(244, 239, 231, 0.8)),
        radial-gradient(circle at center, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.26));
}

.page-shell {
    position: relative;
    z-index: 2;
    min-height: 100vh;
}

.card {
    background: var(--surface);
    border: 1px solid rgba(255, 255, 255, 0.6);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    backdrop-filter: blur(10px);
}

.centered-card,
.bridge-card,
.auth-card,
.admin-card {
    padding: 32px;
}

.simple-status,
.bridge-layout,
.auth-layout {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
}

.bridge-card,
.auth-card,
.centered-card {
    width: min(100%, 520px);
    text-align: center;
}

.bridge-card {
    width: min(100%, 610px);
}

.bridge-card h1,
.auth-card h1,
.simple-status h1,
.admin-header h1 {
    margin: 0 0 12px;
    font-size: clamp(2rem, 4vw, 2.8rem);
    line-height: 1.05;
}

.bridge-card h1 {
    font-size: clamp(2.3rem, 5vw, 4rem);
}

.lead {
    margin: 0;
    color: var(--muted);
    font-size: 1.05rem;
}

.fine-print,
.eyebrow,
.link-muted {
    color: var(--muted);
}

.eyebrow {
    margin: 0 0 10px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    font-size: 0.8rem;
}

.loader {
    width: 72px;
    height: 72px;
    margin: 0 auto 22px;
    border: 6px solid rgba(14, 116, 144, 0.18);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.9s linear infinite;
}

.loader-muted {
    border-top-color: #94a3b8;
}

.progress {
    width: 100%;
    height: 10px;
    margin: 0 auto 24px;
    overflow: hidden;
    border-radius: 999px;
    background: rgba(14, 116, 144, 0.12);
}

.progress-bar {
    display: block;
    width: 0;
    height: 100%;
    background: linear-gradient(90deg, #0891b2, #f97316);
    animation: fill 2s ease forwards;
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: 0;
    border-radius: 999px;
    padding: 12px 18px;
    font: inherit;
    cursor: pointer;
    text-decoration: none;
    transition: transform 0.2s ease, opacity 0.2s ease, background 0.2s ease;
}

.button:hover {
    transform: translateY(-1px);
}

.button-primary {
    background: var(--accent);
    color: #fff;
}

.button-secondary {
    background: #e8eef2;
    color: var(--text);
}

.button-danger {
    background: var(--danger-soft);
    color: var(--danger);
}

.button-block {
    width: 100%;
}

.stack {
    display: grid;
    gap: 16px;
    text-align: left;
}

.field {
    display: grid;
    gap: 8px;
}

.field span {
    font-weight: 600;
}

input[type="text"],
input[type="url"],
input[type="password"] {
    width: 100%;
    padding: 14px 16px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: var(--surface-strong);
    color: var(--text);
    font: inherit;
}

input:focus {
    outline: 2px solid rgba(14, 116, 144, 0.2);
    border-color: var(--accent);
}

.alert {
    margin: 0 0 18px;
    padding: 14px 16px;
    border-radius: 18px;
}

.alert-error {
    background: var(--danger-soft);
    color: var(--danger);
}

.alert-success {
    background: var(--success-soft);
    color: var(--success);
}

.admin-layout {
    max-width: 1680px;
    margin: 0 auto;
    padding: 32px 20px 48px;
}

.admin-header,
.section-heading,
.actions,
.copy-group {
    display: flex;
    align-items: center;
}

.admin-header,
.section-heading {
    justify-content: space-between;
    gap: 16px;
}

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

.table-wrap {
    overflow: visible;
}

.redirect-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
}

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

.redirect-table th {
    font-size: 0.85rem;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.col-slug {
    width: 11rem;
}

.col-target {
    width: auto;
}

.col-date {
    width: 7rem;
}

.col-copy {
    width: 16rem;
}

.col-clicks {
    width: 6rem;
}

.col-actions {
    width: 9rem;
}

.url-cell,
.url-cell a {
    word-break: break-word;
}

.target-link {
    display: -webkit-box;
    overflow: hidden;
    color: var(--accent);
    line-clamp: 2;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    text-decoration: none;
}

.target-link:hover {
    text-decoration: underline;
}

.copy-group {
    gap: 10px;
    min-width: 0;
}

.copy-group input {
    min-width: 0;
}

.actions {
    gap: 10px;
    flex-direction: column;
    align-items: stretch;
}

.actions form {
    margin: 0;
}

.actions .button,
.actions form .button {
    width: 100%;
}

.pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 12px;
    border-radius: 999px;
    background: var(--accent-soft);
    color: var(--accent);
    font-weight: 700;
}

.pill-neutral {
    background: rgba(255, 255, 255, 0.8);
    color: var(--text);
    border: 1px solid var(--line);
}

.empty-cell {
    color: var(--muted);
    text-align: center;
}

.pagination,
.pagination-pages {
    display: flex;
    align-items: center;
    gap: 10px;
}

.pagination {
    justify-content: space-between;
    margin-top: 24px;
    flex-wrap: wrap;
}

.pagination-pages {
    flex-wrap: wrap;
}

.pagination-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 42px;
    height: 42px;
    padding: 0 14px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.75);
    border: 1px solid var(--line);
    color: var(--text);
    text-decoration: none;
}

.pagination-link.is-active {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

code {
    font-family: "SFMono-Regular", Consolas, monospace;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

@keyframes fill {
    to {
        width: 100%;
    }
}

@media (max-width: 960px) {
    .grid {
        grid-template-columns: 1fr;
    }

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

    .redirect-table {
        table-layout: auto;
    }
}

@media (max-width: 640px) {
    .page-background {
        grid-template-columns: repeat(4, minmax(0, 1fr));
        opacity: 0.46;
    }

    .centered-card,
    .bridge-card,
    .auth-card,
    .admin-card {
        padding: 24px;
    }

    .admin-layout {
        padding: 24px 14px 36px;
    }

    .admin-header,
    .section-heading,
    .copy-group,
    .actions {
        align-items: stretch;
        flex-direction: column;
    }

    .copy-group {
        min-width: 0;
    }

    .button,
    .actions form,
    .actions form button {
        width: 100%;
    }

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

    .redirect-table th,
    .redirect-table td {
        min-width: 160px;
    }
}
