:root {
    --maroon: #991b2f;
    --maroon-dark: #741428;
    --blue: #2563eb;
    --navy: #172554;
    --bg: #f5f7fb;
    --card: #ffffff;
    --text: #182033;
    --muted: #6b7280;
    --line: #e5e7eb;
    --success: #15803d;
    --warning: #a16207;
    --danger: #b42318;
    --radius: 20px;
    --shadow: 0 18px 42px rgba(23, 32, 51, .08);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: var(--text);
    background: var(--bg);
    line-height: 1.5;
}

a {
    color: var(--blue);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

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

.topbar {
    min-height: 74px;
    background: rgba(255, 255, 255, .96);
    border-bottom: 1px solid var(--line);
    padding: 12px max(18px, calc((100vw - 1160px) / 2));
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 20;
    backdrop-filter: blur(12px);
}

.adminbar {
    background: var(--navy);
    border-color: transparent;
}

.brand {
    display: flex;
    align-items: center;
    gap: 11px;
    color: inherit;
}

.adminbar .brand,
.adminbar nav a {
    color: #fff;
}

.brand:hover {
    text-decoration: none;
}

.logo {
    width: 43px;
    height: 43px;
    border-radius: 50%;
    background: var(--maroon);
    color: #fff;
    display: grid;
    place-items: center;
    font-weight: 800;
    box-shadow: 0 8px 20px rgba(153, 27, 47, .22);
}

.brand > span:last-child {
    display: flex;
    flex-direction: column;
    line-height: 1.12;
}

.brand small {
    color: var(--muted);
    margin-top: 4px;
}

.adminbar .brand small {
    color: #c7d2fe;
}

.topbar nav {
    display: flex;
    align-items: center;
    gap: 20px;
}

.topbar nav a {
    color: var(--text);
    font-size: 14px;
    font-weight: 700;
}

.container {
    width: min(900px, calc(100% - 30px));
    margin: 38px auto;
    min-height: calc(100vh - 190px);
}

.admin-container {
    width: min(1200px, calc(100% - 34px));
    margin: 32px auto 60px;
}

.card,
.admin-card {
    background: var(--card);
    border: 1px solid rgba(229, 231, 235, .9);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.card {
    padding: 32px;
}

.admin-card {
    padding: 24px;
    margin-bottom: 18px;
}

.hero {
    text-align: center;
    padding: 42px;
}

.hero.compact {
    padding: 34px;
}

.hero-icon {
    width: 68px;
    height: 68px;
    border-radius: 22px;
    background: linear-gradient(145deg, var(--maroon), #c62f4b);
    color: #fff;
    display: grid;
    place-items: center;
    font-size: 30px;
    font-weight: 800;
    margin: 0 auto 18px;
    box-shadow: 0 15px 28px rgba(153, 27, 47, .2);
}

.eyebrow {
    margin: 0 0 8px;
    color: var(--maroon);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: .14em;
}

h1,
h2,
h3 {
    line-height: 1.22;
}

h1 {
    margin: 0 0 12px;
    font-size: clamp(28px, 5vw, 42px);
}

h2 {
    margin: 0;
    font-size: 24px;
}

h3 {
    margin: 0 0 10px;
}

.lead {
    max-width: 650px;
    margin: 0 auto 26px;
    color: var(--muted);
}

.muted {
    color: var(--muted);
}

.lookup {
    margin-top: 26px;
    text-align: left;
}

.input-row {
    display: flex;
    gap: 10px;
}

input,
select,
textarea {
    width: 100%;
    border: 1px solid #d5d9e2;
    border-radius: 12px;
    padding: 13px 14px;
    color: var(--text);
    background: #fff;
    outline: none;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--blue);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, .12);
}

textarea {
    resize: vertical;
}

label {
    display: block;
    font-size: 14px;
    font-weight: 700;
}

label small,
.lookup small {
    display: block;
    margin-top: 5px;
    color: var(--muted);
    font-size: 12px;
}

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

.checkbox {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 500;
}

.checkbox input {
    width: auto;
}

.button {
    border: 0;
    border-radius: 12px;
    padding: 12px 17px;
    font-weight: 800;
    cursor: pointer;
    display: inline-flex;
    justify-content: center;
    align-items: center;
    white-space: nowrap;
}

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

.primary {
    color: #fff;
    background: linear-gradient(135deg, var(--blue), #1d4ed8);
}

.secondary {
    color: var(--navy);
    background: #eef2ff;
    border: 1px solid #dbe3ff;
}

.ghost {
    color: var(--muted);
    background: transparent;
}

.danger {
    color: #fff;
    background: var(--danger);
}

.block {
    width: 100%;
}

.alert {
    margin: 16px 0;
    padding: 13px 15px;
    border-radius: 13px;
    border: 1px solid transparent;
    text-align: left;
}

.alert.error {
    background: #fff1f1;
    color: #8d1717;
    border-color: #ffd1d1;
}

.alert.success {
    background: #ecfdf3;
    color: #096b3c;
    border-color: #b7efce;
}

.alert.info {
    background: #eff6ff;
    color: #174ea6;
    border-color: #cfe0ff;
}

.alert.warning {
    background: #fff8e8;
    color: #8a4b08;
    border-color: #f8dda4;
}

.order-card {
    margin-top: 22px;
}

.flex-head,
.toolbar,
.page-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}

.summary,
.detail {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    margin: 24px 0;
}

.summary div,
.detail div {
    background: #fafbfe;
    border: 1px solid var(--line);
    border-radius: 13px;
    padding: 13px;
}

dt {
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
    margin-bottom: 4px;
}

dd {
    margin: 0;
    font-weight: 700;
    overflow-wrap: anywhere;
}

hr {
    border: 0;
    border-top: 1px solid var(--line);
    margin: 28px 0;
}

.badge {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 6px 10px;
    font-size: 12px;
    font-weight: 800;
    white-space: nowrap;
}

.badge.warning {
    background: #fff3d6;
    color: #945400;
}

.badge.info {
    background: #eaf3ff;
    color: #145bb8;
}

.badge.primary {
    background: #e8ecff;
    color: #3446b5;
}

.badge.success {
    background: #dcfce7;
    color: #10703d;
}

.badge.danger {
    background: #fee2e2;
    color: #a31919;
}

.success-box {
    display: grid;
    gap: 5px;
    margin-top: 20px;
    padding: 18px;
    border-radius: 14px;
    background: #ecfdf3;
    border: 1px solid #b7efce;
}

.steps {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-top: 22px;
}

.steps div {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 17px;
    display: flex;
    align-items: center;
    gap: 11px;
}

.steps b {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #edf2ff;
    color: var(--blue);
    display: grid;
    place-items: center;
}

.steps span {
    font-size: 13px;
    font-weight: 700;
}

.narrow {
    max-width: 560px;
    margin: 0 auto;
}

.center {
    text-align: center;
}

.success-big {
    width: 90px;
    height: 90px;
    border-radius: 50%;
    background: var(--success);
    color: #fff;
    display: grid;
    place-items: center;
    font-size: 44px;
    font-weight: 800;
    margin: 0 auto 20px;
}

.ticket {
    margin: 24px 0;
    padding: 18px;
    background: #f0f5ff;
    border: 1px dashed #9db7f2;
    border-radius: 14px;
}

.ticket small {
    display: block;
    color: var(--muted);
}

.ticket strong {
    font-size: 23px;
    letter-spacing: .05em;
}

.list {
    margin: 18px 0;
    text-align: left;
}

.list div {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    padding: 10px 0;
    border-bottom: 1px solid var(--line);
}

.progress {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    margin: 28px 0;
}

.progress div {
    text-align: center;
    color: var(--muted);
}

.progress b {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: #edf0f5;
    display: grid;
    place-items: center;
    margin: 0 auto 7px;
}

.progress .done b {
    color: #fff;
    background: var(--success);
}

.progress small {
    display: block;
}

footer {
    text-align: center;
    color: var(--muted);
    font-size: 13px;
    padding: 18px 16px 32px;
}

.page-heading {
    align-items: center;
    margin-bottom: 20px;
}

.page-heading h1 {
    margin: 0;
    font-size: 30px;
}

.admin-name {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 9px 13px;
    font-weight: 800;
}

.stats {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 12px;
    margin-bottom: 18px;
}

.stats a {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 15px;
    padding: 17px;
    color: var(--text);
}

.stats a:hover {
    text-decoration: none;
    border-color: #b9c8ee;
}

.stats span {
    display: block;
    color: var(--muted);
    font-size: 12px;
    margin-bottom: 8px;
}

.stats b {
    font-size: 27px;
}

.toolbar {
    align-items: center;
    margin-bottom: 18px;
}

.toolbar h2,
.toolbar p {
    margin: 0;
}

.actions {
    display: flex;
    gap: 9px;
    align-items: center;
}

.actions.end {
    justify-content: flex-end;
}

.filters {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr auto auto;
    gap: 9px;
    margin-bottom: 18px;
    padding: 12px;
    border-radius: 14px;
    background: #f8f9fc;
}

.table-wrap {
    overflow-x: auto;
    border: 1px solid var(--line);
    border-radius: 13px;
}

table {
    width: 100%;
    min-width: 850px;
    border-collapse: collapse;
}

th,
td {
    padding: 13px 14px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: middle;
}

th {
    background: #f8f9fc;
    color: var(--muted);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .06em;
}

td {
    font-size: 13px;
}

td small {
    display: block;
    margin-top: 3px;
    color: var(--muted);
}

tr:last-child td {
    border-bottom: 0;
}

.empty {
    text-align: center;
    color: var(--muted);
    padding: 28px;
}

.pagination {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 7px;
    margin-top: 18px;
}

.pagination a {
    min-width: 34px;
    height: 34px;
    border-radius: 9px;
    background: #eff1f6;
    color: var(--text);
    display: grid;
    place-items: center;
}

.pagination a.active {
    background: var(--blue);
    color: #fff;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
}

.timeline {
    margin-top: 16px;
}

.timeline > div {
    display: grid;
    grid-template-columns: 18px 1fr;
    gap: 10px;
    padding-bottom: 16px;
}

.timeline > div > span {
    width: 12px;
    height: 12px;
    margin-top: 5px;
    border-radius: 50%;
    background: var(--blue);
    box-shadow: 0 0 0 5px #e8efff;
}

.timeline p {
    margin: 0;
}

@media (max-width: 900px) {
    .stats {
        grid-template-columns: repeat(2, 1fr);
    }

    .summary,
    .detail {
        grid-template-columns: repeat(2, 1fr);
    }

    .filters {
        grid-template-columns: 1fr 1fr;
    }

    .filters input {
        grid-column: 1 / -1;
    }
}

@media (max-width: 640px) {
    .topbar {
        min-height: 66px;
        padding: 11px 15px;
    }

    .topbar nav a:first-child {
        display: none;
    }

    .adminbar nav a:not(:last-child) {
        display: none;
    }

    .container {
        width: min(100% - 20px, 900px);
        margin: 20px auto;
    }

    .admin-container {
        width: min(100% - 20px, 1200px);
        margin-top: 20px;
    }

    .card,
    .admin-card {
        padding: 19px 16px;
        border-radius: 16px;
    }

    .hero {
        text-align: left;
    }

    .hero-icon {
        margin-left: 0;
    }

    .hero .lead {
        margin-left: 0;
    }

    .input-row,
    .toolbar,
    .flex-head,
    .page-heading {
        flex-direction: column;
    }

    .input-row .button {
        width: 100%;
    }

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

    .steps {
        grid-template-columns: 1fr;
    }

    .progress {
        overflow-x: auto;
        grid-template-columns: repeat(4, minmax(100px, 1fr));
    }

    .stats {
        grid-template-columns: repeat(2, 1fr);
    }

    .actions {
        width: 100%;
    }

    .actions .button {
        flex: 1;
    }

    .filters {
        grid-template-columns: 1fr;
    }

    .filters input {
        grid-column: auto;
    }

    .form-grid {
        grid-template-columns: 1fr;
    }

    .list div {
        flex-direction: column;
        gap: 3px;
    }
}
