:root {
    color-scheme: dark;
    --ink: #f8fafc;
    --muted: #9fb0c7;
    --line: rgba(255, 255, 255, .18);
    --panel: rgba(9, 18, 32, .68);
    --panel-soft: rgba(255, 255, 255, .08);
    --cyan: #38bdf8;
    --blue: #2563eb;
    --green: #22c55e;
    --amber: #f59e0b;
    --red: #fb7185;
    --radius: 8px;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    background: #050812;
    color: var(--ink);
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -2;
    background-image:
        linear-gradient(115deg, rgba(5, 8, 18, .98), rgba(7, 17, 31, .75), rgba(8, 13, 28, .94)),
        url("/assets/djifcc-og.jpg");
    background-position: center;
    background-size: cover;
}

body::after {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -1;
    background:
        linear-gradient(180deg, rgba(56, 189, 248, .13), transparent 34%),
        repeating-linear-gradient(90deg, rgba(255,255,255,.035) 0, rgba(255,255,255,.035) 1px, transparent 1px, transparent 92px);
    mask-image: linear-gradient(to bottom, rgba(0,0,0,.9), rgba(0,0,0,.4));
}

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

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

.glass {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background:
        linear-gradient(145deg, rgba(255, 255, 255, .18), rgba(255, 255, 255, .055) 34%, rgba(4, 10, 22, .58)),
        var(--panel);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, .22),
        inset 0 -28px 70px rgba(255, 255, 255, .045),
        0 28px 80px rgba(0, 0, 0, .42);
    backdrop-filter: blur(26px) saturate(170%);
}

.site-frame {
    width: min(1180px, calc(100vw - 32px));
    margin: 0 auto;
    padding: 22px 0 48px;
}

.topbar,
.admin-page-head,
.filter-bar,
.form-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.topbar {
    margin-bottom: 24px;
}

.brand-lockup {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.brand-lockup strong,
.brand-lockup small {
    display: block;
}

.brand-lockup small {
    color: var(--muted);
    font-size: 12px;
}

.brand-mark {
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    border-radius: var(--radius);
    border: 1px solid rgba(255,255,255,.22);
    background: linear-gradient(145deg, rgba(56,189,248,.32), rgba(255,255,255,.08));
    color: white;
    font-weight: 800;
    letter-spacing: 0;
}

.ghost-link {
    color: #cbd5e1;
    border: 1px solid rgba(255,255,255,.16);
    border-radius: var(--radius);
    padding: 10px 14px;
    background: rgba(255,255,255,.06);
}

.order-grid {
    display: grid;
    grid-template-columns: minmax(0, .92fr) minmax(360px, .68fr);
    gap: 18px;
    align-items: stretch;
}

.order-visual,
.order-card,
.result-wrap {
    padding: clamp(22px, 4vw, 40px);
}

.order-visual {
    min-height: 620px;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    overflow: hidden;
    position: relative;
}

.visual-image {
    position: absolute;
    inset: 18px 18px auto 18px;
    height: min(42%, 280px);
    border-radius: var(--radius);
    overflow: hidden;
    border: 1px solid rgba(255,255,255,.18);
    opacity: .9;
}

.visual-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.order-kicker {
    color: var(--cyan);
    text-transform: uppercase;
    font-size: 12px;
    letter-spacing: .12em;
    font-weight: 800;
}

h1,
h2,
h3,
p {
    margin-top: 0;
}

h1 {
    font-size: clamp(36px, 5vw, 72px);
    line-height: .98;
    letter-spacing: 0;
    margin-bottom: 18px;
}

.admin-content h1 {
    font-size: clamp(28px, 4vw, 44px);
}

h2 {
    font-size: 22px;
    margin-bottom: 14px;
}

h3 {
    font-size: 16px;
    margin: 22px 0 10px;
}

p {
    color: #c7d2e1;
    line-height: 1.65;
}

.receipt {
    display: grid;
    grid-template-columns: max-content 1fr;
    gap: 8px 18px;
    margin-top: 28px;
    padding: 18px;
    border-radius: var(--radius);
    border: 1px solid rgba(255,255,255,.16);
    background: rgba(255,255,255,.07);
}

.receipt span,
.detail-list dt,
table small {
    color: var(--muted);
    font-size: 13px;
}

.receipt strong {
    min-width: 0;
}

.compact {
    max-width: 640px;
}

.switcher-form,
.payment-form,
.stack-form {
    display: grid;
    gap: 14px;
}

.switcher-form {
    grid-template-columns: minmax(0, 1fr) minmax(120px, .35fr) auto;
    align-items: end;
}

label {
    display: grid;
    gap: 7px;
}

label span {
    color: #dbeafe;
    font-size: 13px;
    font-weight: 700;
}

input,
select,
textarea {
    width: 100%;
    color: var(--ink);
    border: 1px solid rgba(255,255,255,.18);
    border-radius: var(--radius);
    background: rgba(2, 6, 23, .58);
    padding: 13px 14px;
    outline: none;
    transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}

textarea {
    resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
    border-color: rgba(56,189,248,.85);
    box-shadow: 0 0 0 4px rgba(56,189,248,.16);
    background: rgba(2, 6, 23, .72);
}

label em {
    color: #fecdd3;
    font-style: normal;
    font-size: 13px;
}

.divider {
    height: 1px;
    margin: 22px 0;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,.24), transparent);
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    border: 0;
    border-radius: var(--radius);
    padding: 0 18px;
    color: white;
    cursor: pointer;
    font-weight: 800;
    white-space: nowrap;
}

.button-primary {
    background: linear-gradient(135deg, #0891b2, #2563eb 62%, #0f766e);
    box-shadow: 0 14px 34px rgba(37,99,235,.36);
}

.button-muted,
.button-small {
    background: rgba(255,255,255,.08);
    border: 1px solid rgba(255,255,255,.15);
}

.button-small {
    min-height: 34px;
    padding: 0 12px;
    font-size: 13px;
}

.button:disabled {
    cursor: not-allowed;
    opacity: .55;
}

.alert {
    padding: 13px 14px;
    border-radius: var(--radius);
    border: 1px solid rgba(255,255,255,.16);
    margin-bottom: 14px;
}

.alert-error {
    background: rgba(251, 113, 133, .14);
    color: #ffe4e6;
}

.alert-warning {
    background: rgba(245, 158, 11, .14);
    color: #fef3c7;
}

.alert-success {
    background: rgba(34, 197, 94, .13);
    color: #dcfce7;
}

.result-wrap {
    max-width: 820px;
    margin: 9vh auto 0;
}

.status-pill {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    border-radius: var(--radius);
    padding: 4px 9px;
    font-size: 12px;
    font-weight: 800;
    color: #e0f2fe;
    background: rgba(56,189,248,.16);
    border: 1px solid rgba(56,189,248,.25);
}

.status-fulfilled,
.status-sent {
    color: #dcfce7;
    background: rgba(34,197,94,.16);
    border-color: rgba(34,197,94,.28);
}

.status-paid,
.status-pending_payment {
    color: #dbeafe;
    background: rgba(37,99,235,.18);
    border-color: rgba(37,99,235,.3);
}

.status-payment_error,
.status-paid_action_failed,
.status-mail_failed,
.status-failed,
.status-error {
    color: #ffe4e6;
    background: rgba(251,113,133,.17);
    border-color: rgba(251,113,133,.3);
}

.status-cancelled {
    color: #fed7aa;
    background: rgba(245,158,11,.17);
    border-color: rgba(245,158,11,.3);
}

.admin-shell {
    display: grid;
    grid-template-columns: 260px minmax(0, 1fr);
    gap: 18px;
    width: min(1420px, calc(100vw - 32px));
    min-height: calc(100vh - 32px);
    margin: 16px auto;
}

.admin-sidebar {
    position: sticky;
    top: 16px;
    height: calc(100vh - 32px);
    padding: 18px;
    display: flex;
    flex-direction: column;
}

.admin-nav {
    display: grid;
    gap: 8px;
    margin-top: 28px;
}

.admin-nav a,
.admin-user {
    border-radius: var(--radius);
    padding: 11px 12px;
    background: rgba(255,255,255,.06);
    color: #dbeafe;
}

.admin-user {
    margin-top: auto;
    display: grid;
    gap: 8px;
}

.admin-user a {
    color: var(--cyan);
}

.admin-content {
    min-width: 0;
    display: grid;
    gap: 16px;
}

.admin-login {
    width: min(420px, calc(100vw - 32px));
    margin: 16vh auto;
    padding: 28px;
}

.filter-bar {
    padding: 14px;
    display: grid;
    grid-template-columns: minmax(180px, 1fr) 210px 280px auto;
}

.table-wrap,
.detail-panel {
    padding: 16px;
    overflow-x: auto;
}

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

th,
td {
    text-align: left;
    padding: 14px 12px;
    border-bottom: 1px solid rgba(255,255,255,.1);
    vertical-align: middle;
}

th {
    color: #cbd5e1;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .08em;
}

td {
    color: #edf2fb;
}

td small {
    display: block;
    margin-top: 4px;
}

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

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

.detail-list {
    display: grid;
    grid-template-columns: 170px minmax(0, 1fr);
    gap: 10px 16px;
    margin: 0;
}

.detail-list dd {
    margin: 0;
    min-width: 0;
    overflow-wrap: anywhere;
}

.inline-actions {
    margin-bottom: 10px;
}

.admin-page-head .inline-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.log-entry {
    border: 1px solid rgba(255,255,255,.12);
    border-radius: var(--radius);
    padding: 12px;
    background: rgba(255,255,255,.045);
    margin-top: 10px;
}

.log-entry small {
    display: block;
    color: var(--muted);
    margin-top: 6px;
}

pre {
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    color: #dbeafe;
    background: rgba(2,6,23,.72);
    border-radius: var(--radius);
    padding: 12px;
}

.price-input {
    max-width: 150px;
}

@media (max-width: 920px) {
    .order-grid,
    .admin-shell,
    .admin-detail-grid {
        grid-template-columns: 1fr;
    }

    .order-visual {
        min-height: auto;
        padding-top: 250px;
    }

    .admin-sidebar {
        position: relative;
        top: 0;
        height: auto;
    }

    .filter-bar,
    .switcher-form {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 560px) {
    .site-frame,
    .admin-shell {
        width: min(100vw - 20px, 1180px);
    }

    .topbar,
    .admin-page-head {
        align-items: stretch;
        flex-direction: column;
    }

    h1 {
        font-size: 34px;
    }

    .order-visual {
        padding-top: 210px;
    }

    .detail-list,
    .receipt {
        grid-template-columns: 1fr;
    }

    th,
    td {
        padding: 11px 9px;
    }
}
