:root {
    --dark: #0f2b46;
    --green: #16a34a;
    --red: #dc2626;
    --gray: #64748b;
    --border: #d7dee6;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: Arial, Helvetica, sans-serif;
    background: #f2f4f8;
    color: #111;
}

[hidden] {
    display: none !important;
}

.container {
    padding: 20px;
}

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

.card {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 20px;
}

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

label {
    display: block;
    font-weight: 600;
    font-size: 13px;
    margin: 10px 0 4px;
}

input,
select {
    width: 100%;
    max-width: 480px;
    padding: 10px;
    border: 1px solid #c4ccd4;
    border-radius: 8px;
    font-size: 14px;
}

button.btn,
a.btn {
    display: inline-block;
    background: #2563eb;
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 10px 14px;
    font-size: 14px;
    cursor: pointer;
    text-decoration: none;
    margin: 10px 8px 0 0;
}

button.btn.green,
a.btn.green {
    background: var(--green);
}

button.btn.red,
a.btn.red {
    background: var(--red);
}

button.btn.gray,
a.btn.gray {
    background: var(--gray);
}

.topbar {
    background: var(--dark);
    color: #fff;
    padding: 12px 20px;
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: center;
    flex-wrap: wrap;
}

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

.muted {
    color: #555;
    font-size: 13px;
}

.muted-light {
    opacity: 0.85;
    margin-left: 10px;
    font-size: 13px;
}

.tabs {
    display: flex;
    gap: 8px;
    padding: 12px 20px;
    background: #fff;
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
}

.tabBtn {
    border: 1px solid #cfd6dd;
    background: #eef2f6;
    color: #111;
    padding: 10px 14px;
    border-radius: 10px;
    cursor: pointer;
}

.tabBtn.active {
    background: var(--dark);
    color: #fff;
    border-color: var(--dark);
}

.tab {
    padding: 20px;
}

.row {
    display: flex;
    gap: 20px;
    align-items: flex-end;
    flex-wrap: wrap;
}

.grid-2 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 14px;
}

.actions {
    margin-top: 10px;
}

.error {
    color: var(--red);
    margin-top: 10px;
}

.success {
    color: var(--green);
    margin-top: 10px;
    min-height: 18px;
}

.note {
    background: #fff8e1;
    border: 1px solid #f0d9a0;
    border-radius: 10px;
    padding: 10px 12px;
    font-size: 13px;
    margin: 10px 0;
}

table.sheet {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
    background: #fff;
}

table.sheet th,
table.sheet td {
    border: 1px solid #444;
    padding: 5px 6px;
    text-align: left;
    vertical-align: top;
}

table.sheet th {
    background: var(--dark);
    color: #fff;
}

tr.group td {
    background: #dceaf7;
    font-weight: 700;
}

.st-ok {
    background: #dff3e3;
    color: #0a7a2f;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 6px;
    white-space: nowrap;
}

.st-bad {
    background: #fdeaea;
    color: #b91c1c;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 6px;
    white-space: nowrap;
}

.banner-ok {
    background: var(--green);
    color: #fff;
    padding: 14px;
    border-radius: 12px;
    margin-top: 16px;
}

.banner-bad {
    background: var(--red);
    color: #fff;
    padding: 14px;
    border-radius: 12px;
    margin-top: 16px;
}

.summary {
    margin-top: 12px;
    font-size: 13px;
}

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

.sheet-head img {
    max-height: 56px;
    border-radius: 8px;
}

.sigs {
    display: flex;
    gap: 30px;
    margin-top: 30px;
}

.sigs div {
    flex: 1;
    border-top: 1px solid #333;
    padding-top: 6px;
    font-size: 12px;
}

.qr-grid {
    display: flex;
    gap: 24px;
    flex-wrap: wrap;
    margin-top: 20px;
}

.details-box {
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 14px;
    min-width: 300px;
    font-size: 14px;
}

.chart-wrap {
    height: 360px;
    margin-top: 20px;
}

#scanMap {
    height: 280px;
    border-radius: 12px;
    margin: 14px 0;
    border: 1px solid var(--border);
}

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

    body {
        background: #fff;
    }

    body * {
        visibility: hidden;
    }

    #printSheet,
    #printSheet * {
        visibility: visible;
    }

    #printSheet {
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
        margin: 0;
        padding: 0;
        border: none;
    }

    table.sheet {
        font-size: 10px;
    }

    table.sheet th,
    .st-ok,
    .st-bad,
    tr.group td {
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
}

@page {
    size: A4 landscape;
    margin: 8mm;
}