* {
    box-sizing: border-box;
}

:root {
    --bg: #f3f6fb;
    --bg-accent: radial-gradient(circle at top left, rgba(19, 99, 223, 0.16), transparent 32%), radial-gradient(circle at right, rgba(16, 185, 129, 0.12), transparent 22%), linear-gradient(180deg, #f8fbff 0%, #eef3f9 100%);
    --surface: rgba(255, 255, 255, 0.92);
    --surface-strong: #ffffff;
    --surface-soft: #f6f8fc;
    --text: #142033;
    --muted: #64748b;
    --line: #dbe3ef;
    --primary: #155eef;
    --primary-strong: #0f4ac8;
    --success: #0f9f6e;
    --danger: #c43636;
    --warning: #f59e0b;
    --shadow: 0 18px 46px rgba(15, 23, 42, 0.10);
    --radius-xl: 24px;
    --radius-lg: 18px;
    --radius-md: 14px;
    --radius-sm: 10px;
}

html,
body {
    min-height: 100%;
}

body {
    margin: 0;
    color: var(--text);
    font-family: "Segoe UI", "Trebuchet MS", sans-serif;
    background: var(--bg-accent);
}

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

a:hover {
    text-decoration: underline;
}

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

button {
    cursor: pointer;
}

.app-shell {
    min-height: 100vh;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    padding: 18px 28px;
    background: rgba(10, 21, 39, 0.84);
    backdrop-filter: blur(16px);
    color: #f8fafc;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.brand {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.brand-badge {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: #93c5fd;
}

.brand-title {
    margin: 0;
    font-size: 20px;
    font-weight: 700;
}

.brand-subtitle {
    margin: 0;
    color: rgba(255, 255, 255, 0.72);
    font-size: 13px;
}

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

.page-shell {
    width: min(1200px, calc(100% - 32px));
    margin: 0 auto;
    padding: 28px 0 40px;
}

.page-stack {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.hero {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 18px;
    padding: 28px;
    border-radius: var(--radius-xl);
    background: linear-gradient(135deg, #13233f 0%, #155eef 100%);
    color: #fff;
    box-shadow: var(--shadow);
}

.hero h1,
.hero h2 {
    margin: 0 0 10px;
}

.hero p {
    margin: 0;
    color: rgba(255, 255, 255, 0.84);
    max-width: 720px;
}

.hero-meta {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.14);
    font-size: 13px;
    white-space: nowrap;
}

.card {
    background: var(--surface);
    border: 1px solid rgba(255, 255, 255, 0.7);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow);
    padding: 24px;
}

.card.compact {
    padding: 18px;
}

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

.card-title {
    margin: 0;
    font-size: 22px;
}

.card-subtitle {
    margin: 6px 0 0;
    color: var(--muted);
    font-size: 14px;
}

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

.grid {
    display: grid;
    gap: 18px;
}

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

.grid-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.kpi-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 22px;
    margin-bottom: 22px;
}

.kpi-grid + .stack-sm,
.kpi-grid + .page-stack {
    margin-top: 18px;
}

.kpi {
    padding: 18px;
    border-radius: var(--radius-lg);
    background: var(--surface-soft);
    border: 1px solid var(--line);
}

.kpi-label {
    display: block;
    color: var(--muted);
    font-size: 13px;
    margin-bottom: 8px;
}

.kpi-value {
    font-size: 28px;
    font-weight: 700;
}

.actions-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
}

.action-card {
    display: block;
    padding: 20px;
    border-radius: var(--radius-lg);
    background: var(--surface-soft);
    border: 1px solid var(--line);
    color: inherit;
    transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.action-card:hover {
    transform: translateY(-2px);
    border-color: rgba(21, 94, 239, 0.28);
    box-shadow: 0 12px 28px rgba(21, 94, 239, 0.10);
    text-decoration: none;
}

.action-title {
    display: block;
    font-weight: 700;
    margin-bottom: 6px;
}

.action-copy {
    display: block;
    color: var(--muted);
    font-size: 14px;
}

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

.field {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.field.full {
    grid-column: 1 / -1;
}

.field label {
    font-size: 13px;
    font-weight: 700;
    color: #334155;
}

.field input,
.field select,
.field textarea {
    width: 100%;
    min-height: 46px;
    padding: 12px 14px;
    border-radius: var(--radius-md);
    border: 1px solid var(--line);
    background: var(--surface-strong);
    color: var(--text);
    transition: border-color 0.16s ease, box-shadow 0.16s ease;
}

.field textarea {
    min-height: 108px;
    resize: vertical;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
    outline: none;
    border-color: rgba(21, 94, 239, 0.6);
    box-shadow: 0 0 0 4px rgba(21, 94, 239, 0.12);
}

.inline-form {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: end;
}

.inline-form .field {
    flex: 1 1 180px;
}

.stack-sm {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.payment-options {
    margin-top: 14px;
}

.payment-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px 18px;
}

.payment-option {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 36px;
    padding: 0 14px;
    border-radius: 999px;
    background: #e8eef8;
    color: #24406d;
    font-weight: 700;
}

.payment-option input {
    width: 16px;
    height: 16px;
    margin: 0;
}

.payment-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 16px;
}

.payment-actions .btn {
    min-width: 220px;
}

.payment-options > .btn,
.payment-options > .btn-secondary,
.payment-options > .btn-danger,
.payment-options > .btn-ghost {
    margin-top: 16px;
}

.btn,
.btn-secondary,
.btn-danger,
.btn-ghost {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    min-height: 44px;
    padding: 0 18px;
    border-radius: 999px;
    border: none;
    font-weight: 700;
    transition: transform 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}

.btn {
    color: #fff;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-strong) 100%);
    box-shadow: 0 10px 24px rgba(21, 94, 239, 0.20);
}

.btn-secondary {
    color: var(--text);
    background: #e8eef8;
}

.btn-danger {
    color: #fff;
    background: linear-gradient(135deg, #d9485f 0%, var(--danger) 100%);
}

.btn-ghost {
    color: var(--primary);
    background: transparent;
    border: 1px solid rgba(21, 94, 239, 0.24);
}

.btn:hover,
.btn-secondary:hover,
.btn-danger:hover,
.btn-ghost:hover {
    transform: translateY(-1px);
    text-decoration: none;
}

.table-card {
    overflow: hidden;
}

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

table.data-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 720px;
}

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

.data-table th {
    font-size: 12px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--muted);
    background: rgba(148, 163, 184, 0.08);
}

.data-table tr:last-child td {
    border-bottom: none;
}

.table-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

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

.pill {
    display: inline-flex;
    align-items: center;
    padding: 6px 10px;
    border-radius: 999px;
    background: #e8eef8;
    color: #24406d;
    font-size: 12px;
    font-weight: 700;
}

.pill.success {
    background: rgba(15, 159, 110, 0.12);
    color: #0c7a55;
}

.pill.warning {
    background: rgba(245, 158, 11, 0.14);
    color: #a16207;
}

.summary-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.summary-line {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px dashed var(--line);
}

.summary-line:last-child {
    border-bottom: none;
}

.auth-shell {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
}

.auth-card {
    width: min(460px, 100%);
    padding: 30px;
    border-radius: 28px;
    background: rgba(255, 255, 255, 0.96);
    box-shadow: 0 24px 64px rgba(15, 23, 42, 0.16);
    border: 1px solid rgba(255, 255, 255, 0.8);
}

.auth-brand {
    margin-bottom: 24px;
}

.auth-brand h1 {
    margin: 10px 0 8px;
    font-size: 30px;
}

.auth-brand p {
    margin: 0;
    color: var(--muted);
}

.receipt {
    width: min(680px, 100%);
    margin: 0 auto;
}

.receipt-paper {
    background: #fff;
    color: #111827;
    border-radius: 22px;
    padding: 24px;
    box-shadow: var(--shadow);
    border: 1px solid #e5e7eb;
}

.empty-state {
    display: grid;
    place-items: center;
    min-height: 180px;
    border-radius: var(--radius-lg);
    border: 1px dashed var(--line);
    background: rgba(255, 255, 255, 0.45);
    color: var(--muted);
    text-align: center;
    padding: 18px;
}

@media (max-width: 900px) {
    .grid-2,
    .grid-3,
    .actions-grid,
    .kpi-grid,
    .form-grid,
    .payment-grid {
        grid-template-columns: 1fr;
    }

    .hero {
        flex-direction: column;
    }

    .page-shell {
        width: min(100% - 20px, 1200px);
    }
}

@media (max-width: 640px) {
    .topbar {
        padding: 16px 18px;
        flex-direction: column;
        align-items: stretch;
    }

    .topbar-actions {
        justify-content: stretch;
    }

    .topbar-actions a {
        flex: 1;
    }

    .topbar-actions .btn,
    .topbar-actions .btn-secondary,
    .topbar-actions .btn-danger,
    .topbar-actions .btn-ghost {
        width: 100%;
    }

    .card,
    .auth-card {
        padding: 18px;
    }

    .page-shell {
        padding-top: 18px;
    }
}

@media print {
    body {
        background: #fff;
    }

    .topbar,
    .toolbar {
        display: none !important;
    }

    .page-shell {
        width: 100%;
        margin: 0;
        padding: 0;
    }

    .receipt-paper {
        box-shadow: none;
        border: none;
        border-radius: 0;
        padding: 0;
    }
}
