:root {
    --ink: #162033;
    --muted: #657189;
    --line: #dde3ee;
    --panel: #ffffff;
    --soft: #f4f7fb;
    --brand: #ff6a00;
    --accent: #1268f3;
    --ok: #148a48;
    --danger: #c93535;
    --shadow: 0 18px 40px rgba(20, 32, 51, .08);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
    color: var(--ink);
    background: var(--soft);
}

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

.login-shell {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
    background: linear-gradient(135deg, #fff7f0 0%, #eef5ff 100%);
}

.login-box {
    width: min(440px, 100%);
    background: var(--panel);
    border: 1px solid var(--line);
    box-shadow: var(--shadow);
    border-radius: 8px;
    padding: 28px;
}

.login-logo {
    width: 210px;
    max-width: 70%;
    display: block;
    margin-bottom: 18px;
}

.app {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 260px minmax(0, 1fr);
}

.sidebar {
    background: #ffffff;
    border-right: 1px solid var(--line);
    padding: 22px 18px;
    position: sticky;
    top: 0;
    height: 100vh;
}

.brand-logo {
    width: 190px;
    max-width: 100%;
    display: block;
    margin-bottom: 10px;
}

.shop-title {
    font-weight: 800;
    font-size: 18px;
    margin: 8px 0 22px;
}

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

.nav a {
    padding: 12px 14px;
    border-radius: 8px;
    color: var(--muted);
    font-weight: 700;
}

.nav a.active,
.nav a:hover {
    background: #eef5ff;
    color: var(--accent);
}

.main {
    min-width: 0;
    padding: 28px;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 22px;
}

.topbar h1 {
    margin: 0;
    font-size: 28px;
}

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

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

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

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

.card {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
    padding: 18px;
}

.stat {
    min-height: 116px;
}

.stat b {
    display: block;
    font-size: 30px;
    margin-top: 12px;
}

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

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

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

label {
    font-weight: 800;
    font-size: 13px;
}

input,
select,
textarea {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    padding: 12px 13px;
    font: inherit;
    color: var(--ink);
}

textarea {
    min-height: 92px;
    resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
    outline: 3px solid rgba(18, 104, 243, .14);
    border-color: var(--accent);
}

.actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    margin-top: 16px;
}

.btn {
    border: 0;
    border-radius: 8px;
    padding: 11px 15px;
    background: #e9eef6;
    color: var(--ink);
    font-weight: 800;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
}

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

.btn.orange {
    background: var(--brand);
    color: #fff;
}

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

.btn.small {
    min-height: 34px;
    padding: 8px 10px;
    font-size: 13px;
}

.alert {
    padding: 12px 14px;
    border-radius: 8px;
    margin-bottom: 16px;
    border: 1px solid var(--line);
}

.alert.error {
    background: #fff2f2;
    color: #9b1c1c;
}

.alert.ok {
    background: #effaf3;
    color: #0f6f3a;
}

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

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

th,
td {
    text-align: left;
    padding: 12px;
    border-bottom: 1px solid var(--line);
    white-space: nowrap;
}

th {
    color: var(--muted);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.badge {
    display: inline-flex;
    align-items: center;
    min-height: 26px;
    padding: 4px 9px;
    border-radius: 999px;
    background: #eef5ff;
    color: var(--accent);
    font-weight: 800;
    font-size: 12px;
}

.print-page {
    background: #fff;
    color: #101828;
    min-height: 100vh;
    padding: 18px;
}

.sheet {
    width: 210mm;
    min-height: 297mm;
    margin: 0 auto;
    background: #fff;
    padding: 14mm;
    border: 1px solid #d7dce5;
}

.sheet.landscape {
    width: 297mm;
    min-height: 210mm;
    page: landscape;
}

.sheet-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 18px;
    border-bottom: 2px solid #101828;
    padding-bottom: 10px;
    margin-bottom: 12px;
}

.sheet-logo {
    width: 155px;
}

.sheet h1,
.sheet h2 {
    margin: 0;
}

.print-table th,
.print-table td {
    white-space: normal;
    border: 1px solid #c7ceda;
    padding: 8px;
    font-size: 13px;
}

.id-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 12px;
}

.id-box {
    border: 1px solid #c7ceda;
    min-height: 68mm;
    display: grid;
    place-items: center;
    overflow: hidden;
}

.id-box img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.sold-text {
    min-height: 130mm;
    display: grid;
    place-items: center;
    text-align: center;
    font-size: 34px;
    line-height: 1.32;
    font-weight: 800;
}

.service-number {
    font-size: 86px;
    font-weight: 900;
    color: var(--brand);
    line-height: 1;
}

.mobile-head {
    display: none;
    background: #fff;
    border-bottom: 1px solid var(--line);
    padding: 14px 18px;
    align-items: center;
    justify-content: space-between;
}

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

    .mobile-head {
        display: flex;
    }

    .sidebar {
        position: static;
        height: auto;
        border-right: 0;
        border-bottom: 1px solid var(--line);
    }

    .brand-logo,
    .shop-title {
        display: none;
    }

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

    .main {
        padding: 18px;
    }

    .topbar {
        align-items: flex-start;
        flex-direction: column;
    }

    .grid.cols-2,
    .grid.cols-3,
    .form-grid {
        grid-template-columns: 1fr;
    }
}

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

    .no-print {
        display: none !important;
    }

    .print-page {
        padding: 0;
    }

    .sheet {
        border: 0;
        margin: 0;
        width: 210mm;
        min-height: 297mm;
        box-shadow: none;
    }

    .sheet.landscape {
        width: 297mm;
        min-height: 210mm;
    }
}

@page {
    size: A4 portrait;
    margin: 0;
}

@page landscape {
    size: A4 landscape;
    margin: 0;
}
