:root {
    --bg: #0b1220;
    --panel: #121a2a;
    --muted: #8aa0c2;
    --text: #e6ecf5;
    --line: #223047;
    --accent: #4da3ff;
}

* {
    box-sizing: border-box
}

html,
body {
    height: 100%
}

body {
    margin: 0;
    font-family: system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, "Helvetica Neue", Arial;
    color: var(--text);
    background: var(--bg);
}

/* Topbar */
.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.02);
}

.brand {
    display: flex;
    gap: 12px;
    align-items: center
}

.logo {
    font-size: 28px
}

.subtle {
    color: var(--muted);
    margin: 2px 0 0
}

.primary {
    background: var(--accent);
    color: #001b33;
    border: none;
    border-radius: 10px;
    padding: 10px 14px;
    cursor: pointer;
    font-weight: 600
}

.primary:disabled {
    opacity: .65;
    cursor: not-allowed
}

.ghost {
    background: transparent;
    color: var(--text);
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 8px 12px;
    cursor: pointer
}

/* Layout */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 16px
}

.summary {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 10px;
    margin: 12px 0 18px
}

.card {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 10px
}

.card-title {
    font-size: 12px;
    color: var(--muted)
}

.card-value {
    font-size: 20px;
    font-weight: 700
}

.toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px
}

.search {
    display: flex;
    gap: 8px;
    align-items: center
}

.search input {
    background: var(--panel);
    border: 1px solid var(--line);
    color: var(--text);
    padding: 8px 10px;
    border-radius: 10px;
    min-width: 280px
}

.filters {
    display: flex;
    gap: 10px
}

.field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    color: var(--muted)
}

.field select,
.field input {
    background: var(--panel);
    border: 1px solid var(--line);
    color: var(--text);
    padding: 8px 10px;
    border-radius: 10px
}

/* Table */
.table-wrap {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 14px;
    overflow: hidden
}

.scroll {
    overflow: auto
}

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

thead th {
    font-weight: 700;
    text-align: left;
    padding: 10px;
    border-bottom: 1px solid var(--line);
    cursor: pointer
}

tbody td {
    padding: 10px;
    border-bottom: 1px solid var(--line)
}

.badge {
    display: inline-block;
    padding: 2px 6px;
    border: 1px solid var(--line);
    border-radius: 999px;
    font-size: 12px
}

.center {
    text-align: center
}

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

/* Tracking link color */
#ordersTable td a {
    color: #efefef;
    text-decoration: underline;
}

#ordersTable td a:hover {
    color: #ffffff;
}

/* Pagination */
.pagination {
    display: flex;
    gap: 10px;
    align-items: center;
    justify-content: center;
    padding: 10px
}

/* Alerts */
.alerts {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 12px
}

.alert {
    background: #0f1828;
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 8px 12px
}

.alert.success {
    border-color: #1f7a3a
}

.alert.error {
    border-color: #a33
}

/* Loading overlay */
.loading {
    position: fixed;
    inset: 0;
    display: grid;
    place-items: center;
    gap: 10px;
    background: rgba(5, 8, 12, .45);
    z-index: 50
}

.loading.hidden {
    display: none
}

.spinner {
    width: 38px;
    height: 38px;
    border: 3px solid var(--line);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 1s linear infinite
}

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

/* Modal */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(5, 8, 12, .55);
    backdrop-filter: blur(3px);
    display: grid;
    place-items: center;
    z-index: 60
}

.modal.hidden {
    display: none
}

.modal-card {
    width: min(560px, 92vw);
    background: #0f141d;
    border: 1px solid #1f2632;
    border-radius: 16px;
    padding: 18px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, .4)
}

.modal-card h2 {
    margin: 0 0 6px
}

.modal-card .muted {
    margin: 0 0 12px;
    display: block
}

.modal-card .grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px
}

.modal-card .actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 14px
}

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

    .modal-card .grid-2 {
        grid-template-columns: 1fr
    }
}

/* Footer */
.footer {
    text-align: center;
    max-width: 1200px;
    margin: 18px auto;
    padding: 0 16px;
    color: var(--muted)
}