:root {
    --bg: #f4f6f8;
    --surface: #ffffff;
    --ink: #1c2530;
    --muted: #64748b;
    --line: #d8dee8;
    --primary: #126b5f;
    --primary-dark: #0d554b;
    --accent: #315c91;
    --danger: #b42318;
    --warning: #b7791f;
    --ok: #16803c;
    --unknown: #7b8794;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: Arial, Helvetica, sans-serif;
    line-height: 1.45;
}

.topbar {
    align-items: center;
    background: #13202c;
    color: #fff;
    display: flex;
    justify-content: space-between;
    min-height: 64px;
    padding: 0 28px;
}

.brand,
.topbar a {
    color: #fff;
    text-decoration: none;
}

.brand {
    font-size: 18px;
    font-weight: 700;
}

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

.shell {
    margin: 0 auto;
    max-width: 1420px;
    padding: 28px;
}

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

.eyebrow {
    color: var(--accent);
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0;
    margin: 0 0 3px;
    text-transform: uppercase;
}

h1,
h2 {
    line-height: 1.2;
    margin: 0;
}

h1 {
    font-size: 30px;
}

h2 {
    font-size: 19px;
    margin-bottom: 18px;
}

.button {
    align-items: center;
    background: var(--primary);
    border: 1px solid var(--primary);
    border-radius: 6px;
    color: #fff;
    cursor: pointer;
    display: inline-flex;
    font-weight: 700;
    justify-content: center;
    min-height: 40px;
    padding: 8px 14px;
    text-decoration: none;
    white-space: nowrap;
}

.button:hover {
    background: var(--primary-dark);
}

.button.secondary {
    background: #fff;
    color: var(--primary);
}

.button.small {
    min-height: 34px;
}

.metrics {
    display: grid;
    gap: 14px;
    grid-template-columns: repeat(4, minmax(160px, 1fr));
    margin-bottom: 18px;
}

.metrics div,
.panel,
.table-wrap,
.filters {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
}

.metrics div {
    padding: 18px;
}

.metrics strong {
    display: block;
    font-size: 28px;
}

.metrics span,
.summary dt,
.empty {
    color: var(--muted);
}

.filters {
    align-items: center;
    display: grid;
    gap: 10px;
    grid-template-columns: minmax(220px, 1fr) 210px 210px auto auto auto;
    margin-bottom: 18px;
    padding: 12px;
}

input,
select,
textarea {
    background: #fff;
    border: 1px solid #c9d2df;
    border-radius: 6px;
    color: var(--ink);
    font: inherit;
    min-height: 40px;
    padding: 9px 10px;
    width: 100%;
}

textarea {
    resize: vertical;
}

label {
    color: #344256;
    display: grid;
    font-size: 13px;
    font-weight: 700;
    gap: 6px;
}

.check {
    align-items: center;
    display: flex;
    gap: 7px;
    min-height: 40px;
}

.check input {
    min-height: auto;
    width: auto;
}

.table-wrap {
    overflow: auto;
}

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

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

th {
    color: #475569;
    font-size: 13px;
    text-transform: uppercase;
}

tbody tr {
    cursor: pointer;
}

tbody tr:hover {
    background: #f8fafc;
}

.pill {
    background: #e8eef5;
    border-radius: 999px;
    display: inline-block;
    font-size: 12px;
    font-weight: 700;
    padding: 5px 9px;
}

.pill.status-open {
    background: #fff3d6;
    color: #8a4b00;
}

.pill.status-done {
    background: #dcfce7;
    color: #166534;
}

.mono {
    font-family: Consolas, Monaco, monospace;
}

.layout-grid {
    display: grid;
    gap: 18px;
    grid-template-columns: minmax(0, 1.35fr) minmax(320px, .65fr);
}

.span-2 {
    grid-column: span 2;
}

.panel {
    padding: 20px;
}

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

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

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

.inline-actions {
    margin-top: 0;
}

.summary {
    display: grid;
    gap: 8px 16px;
    grid-template-columns: 130px 1fr;
    margin: 0;
}

.summary dt {
    font-weight: 700;
}

.summary dd {
    margin: 0;
    overflow-wrap: anywhere;
}

.warranty-state {
    align-items: center;
    border: 1px solid var(--line);
    border-radius: 8px;
    display: flex;
    gap: 10px;
    margin-bottom: 16px;
    padding: 12px;
}

.lamp {
    border-radius: 50%;
    display: inline-block;
    flex: 0 0 auto;
    height: 12px;
    width: 12px;
}

.lamp.active {
    background: var(--ok);
}

.lamp.expired {
    background: var(--danger);
}

.lamp.unknown,
.lamp.failed {
    background: var(--unknown);
}

.lamp.unclear {
    background: var(--warning);
}

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

.process-copy h3 {
    color: var(--ink);
    margin: 0 0 10px;
}

.process-copy ol,
.process-copy ul,
.checklist {
    padding-left: 22px;
}

.process-copy pre {
    background: #f2f5f8;
    border: 1px solid var(--line);
    border-radius: 6px;
    overflow: auto;
    padding: 12px;
    white-space: pre-wrap;
}

.notice {
    border-left: 4px solid var(--accent);
    background: #f7fbff;
    margin: 0 0 14px;
    padding: 10px 12px;
}

.flash {
    background: #e9f8ef;
    border: 1px solid #9ed4b4;
    border-radius: 8px;
    color: #14532d;
    font-weight: 700;
    margin-bottom: 16px;
    padding: 12px 14px;
}

.flash.error {
    background: #fff1f0;
    border-color: #f0a8a1;
    color: #9f1d16;
}

.login-page {
    align-items: center;
    background: #eef2f6;
    display: flex;
    min-height: 100vh;
    padding: 20px;
}

.login-card {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: 0 18px 50px rgba(20, 32, 44, .12);
    margin: 0 auto;
    max-width: 420px;
    padding: 28px;
    width: 100%;
}

.login-card h1 {
    font-size: 26px;
    margin-bottom: 22px;
}

.login-card form {
    display: grid;
    gap: 16px;
}

.print-page {
    background: #e7ebf0;
}

.print-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin: 20px auto;
    max-width: 980px;
}

.print-sheet {
    background: #fff;
    box-shadow: 0 18px 50px rgba(20, 32, 44, .15);
    margin: 0 auto 32px;
    max-width: 980px;
    padding: 34px;
}

.print-head,
.print-footer,
.print-grid {
    display: grid;
    gap: 18px;
    grid-template-columns: 1fr 1fr;
}

.print-head {
    align-items: start;
    border-bottom: 2px solid var(--ink);
    margin-bottom: 18px;
    padding-bottom: 14px;
}

.print-meta {
    display: grid;
    gap: 4px;
    justify-items: end;
}

.print-notice,
.print-box {
    border: 1px solid #aeb8c5;
    margin-bottom: 14px;
    padding: 14px;
}

.print-notice {
    background: #f7fbff;
}

.print-box h2 {
    font-size: 15px;
    margin-bottom: 10px;
    text-transform: uppercase;
}

.print-box dl {
    display: grid;
    gap: 6px 12px;
    grid-template-columns: 140px 1fr;
    margin: 0;
}

.print-box dl.wide {
    grid-template-columns: 170px 1fr;
}

.print-box dt {
    color: #475569;
    font-weight: 700;
}

.print-box dd {
    margin: 0;
    overflow-wrap: anywhere;
}

.serial {
    font-family: Consolas, Monaco, monospace;
    font-size: 18px;
    font-weight: 700;
}

.preline {
    margin: 0;
    white-space: pre-line;
}

.print-footer {
    border-top: 1px solid #aeb8c5;
    color: #475569;
    font-size: 12px;
    margin-top: 18px;
    padding-top: 10px;
}

.print-footer span:last-child {
    text-align: right;
}

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

    .print-actions {
        display: none;
    }

    .print-sheet {
        box-shadow: none;
        margin: 0;
        max-width: none;
        padding: 0;
    }

    .print-notice,
    .print-box {
        break-inside: avoid;
    }
}

@media (max-width: 920px) {
    .topbar,
    .page-title {
        align-items: flex-start;
        flex-direction: column;
    }

    .shell {
        padding: 18px;
    }

    .metrics,
    .filters,
    .layout-grid,
    .form-grid,
    .print-head,
    .print-footer,
    .print-grid {
        grid-template-columns: 1fr;
    }

    .print-sheet {
        padding: 18px;
    }

    .print-meta {
        justify-items: start;
    }

    .print-footer span:last-child {
        text-align: left;
    }

    .span-2,
    .full {
        grid-column: auto;
    }

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