:root {
    --brand-start: #013bf8;
    --brand-end: #3fb6e0;
    --link-color: #2058bc;
    --text-color: #0e0e27;
    --muted-color: #52627a;
    --border-color: #dce6f5;
    --page-width: 760px;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: system-ui, sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background-color: #fff;
}

/* A subtle dot pattern for on-screen pages. */
@media screen {
    body:not(.qr-page) {
        min-height: 100vh;
        background-image:
            radial-gradient(ellipse at top right,
                rgb(63 182 224 / 8%),
                transparent 55%),
            radial-gradient(circle,
                rgb(39 108 245 / 8%) 1px,
                transparent 1px);
        background-size: 100% 32rem, 20px 20px;
        background-repeat: no-repeat, repeat;
    }
}

.site-header {
    padding: 16px 24px;
    background-color: #fff;
    border-bottom: 1px solid var(--border-color);
}

.brand {
    color: var(--link-color);
    font-size: 22px;
    font-weight: 700;
    letter-spacing: -0.03em;
    text-decoration: none;
}

.welcome {
    max-width: var(--page-width);
    margin: clamp(24px, 6vw, 64px) auto;
    padding: 16px clamp(16px, 4vw, 32px);
}

.eyebrow {
    color: var(--link-color);
    font-weight: 600;
}

h1 {
    margin: 16px 0;
    font-size: clamp(32px, 6vw, 56px);
    line-height: 1.15;
    letter-spacing: -0.035em;
}

.description {
    max-width: 560px;
    color: var(--muted-color);
    font-size: 18px;
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 10px 20px;
    border: 0;
    border-radius: 12px;
    color: #fff;
    font: inherit;
    font-weight: 650;
    line-height: 1.4;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
}

.button:not(.button-danger) {
    color: #000;
    background-color: var(--brand-start);
    background-image: linear-gradient(110deg,
            var(--brand-start),
            var(--brand-end));
}

@media (hover: hover) {
    .button:not(.button-danger):hover {
        box-shadow: 0 3px 12px rgb(39 108 245 / 22%);
    }
}

.brand:focus-visible,
.button:focus-visible {
    outline: 3px solid var(--link-color);
    outline-offset: 4px;
}

.company-card {
    margin-top: 20px;
    padding: 24px;
    border: 1px solid #dce6f5;
    border-radius: 12px;
    background-color: #ffffff;
}

.company-card h2 {
    margin-top: 0;
}

.company-form {
    max-width: 480px;
}

.form-field {
    margin-bottom: 20px;
}

.form-field label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
}

.form-field input,
.form-field select,
.form-field textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid #52627a;
    border-radius: 8px;
    background-color: #ffffff;
    color: #172b4d;
    font: inherit;
}

.form-field input:focus-visible,
.form-field select:focus-visible,
.form-field textarea:focus-visible {
    outline: 3px solid #1d4ed8;
    outline-offset: 2px;
}

.errorlist {
    padding-left: 20px;
    color: #b91c1c;
}

.danger-notice {
    margin: 24px 0;
    padding: 20px;
    border: 1px solid #b91c1c;
    border-radius: 8px;
    background-color: #fff1f2;
    color: #991b1b;
}

.button-danger {
    background-color: #b91c1c;
}

.button-danger:hover {
    background-color: #991b1b;
}

.status-message {
    max-width: 760px;
    margin: 20px auto;
    padding: 16px 24px;
    border: 1px solid #166534;
    border-radius: 8px;
    background-color: #f0fdf4;
    color: #166534;
}

.table-wrapper {
    overflow-x: auto;
    margin: 24px 0;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
}

.data-table th,
.data-table td {
    padding: 12px 16px;
    border-bottom: 1px solid #dbe5f1;
    text-align: left;
}

.data-table th {
    background: #eaf2ff;
}

.data-table th,
.data-table td:first-child,
.data-table td:nth-child(2) {
    white-space: nowrap;
}

.month-options {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin: 24px 0;
}

.month-option {
    flex: 1 1 150px;
    padding: 18px;
    border: 2px solid #dbe5f1;
    border-radius: 10px;
    background: white;
    color: #172b4d;
    text-align: center;
    text-decoration: none;
    font-weight: 600;
}

.month-option:hover {
    border-color: #2563eb;
}

.month-option.is-selected {
    border-color: #2563eb;
    background: #eaf2ff;
    color: #1d4ed8;
}

.month-option:focus-visible {
    outline: 3px solid #2563eb;
    outline-offset: 3px;
}

.icon-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border: 1px solid #cbd9ee;
    border-radius: 8px;
    background: white;
    color: #2563eb;
    font-size: 22px;
    text-decoration: none;
}

.icon-button:hover {
    background: #eaf2ff;
    border-color: #2563eb;
}

.icon-button:focus-visible {
    outline: 3px solid #2563eb;
    outline-offset: 3px;
}

.edited-mark {
    display: inline-block;
    margin-left: 4px;
    color: #2563eb;
    font-size: 18px;
}

.qr-page {
    background: white;
    color: black;
}

.qr-label {
    width: 100%;
    max-width: 420px;
    margin: 32px auto;
    padding: 24px;
    border: 1px solid #dbe5f1;
    text-align: center;
    overflow-wrap: anywhere;
}

.qr-label h1 {
    font-size: 28px;
}

.qr-label p {
    margin: 8px 0;
}

.qr-image {
    max-width: 280px;
    margin: 20px auto;
    background: white;
}

.qr-image svg {
    display: block;
    width: 100%;
    height: auto;
}

.qr-actions {
    padding: 0 20px 32px;
    text-align: center;
}

@media print {
    .qr-page .qr-actions {
        display: none;
    }

    .qr-page .qr-label {
        width: 100mm;
        max-width: 100%;
        margin: 10mm auto;
        padding: 5mm;
        border: 1px solid black;
        break-inside: avoid;
    }

    .qr-page .qr-image {
        width: 65mm;
        max-width: 100%;
    }
}

.dashboard-stats {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin: 24px 0 32px;
}

.dashboard-stat {
    padding: 20px;
    border: 1px solid #dbe5f1;
    border-radius: 10px;
    background: white;
}

.dashboard-stat strong {
    display: block;
    font-size: 32px;
    line-height: 1.2;
    margin-bottom: 8px;
}

.dashboard-stat span {
    display: block;
}

.check-status {
    display: inline-block;
    padding: 5px 9px;
    border-radius: 6px;
    font-weight: 600;
    white-space: nowrap;
}

.check-status-ok {
    background: #dcfce7;
    color: #166534;
}

.check-status-missing {
    background: #fef3c7;
    color: #92400e;
}

.check-status-issue {
    background: #fee2e2;
    color: #991b1b;
}

.corrective-action {
    min-width: 180px;
    max-width: 300px;
    margin: 8px 0 0;
    overflow-wrap: anywhere;
}

@media (min-width: 700px) {
    .dashboard-stats {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

.company-overview {
    max-width: 1060px;
}

.location-card {
    margin-block: 24px;
    padding: clamp(20px, 4vw, 40px);
    border: 1px solid #6099ed;
    border-radius: 24px;
    background: linear-gradient(180deg, white 62%, #f2f7ff 84%, #d3e3ff);
}

.location-card-header,
.location-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 12px;
}

.location-card-header {
    justify-content: space-between;
}

.location-card-header h3 {
    margin: 0;
    font-size: clamp(24px, 4vw, 38px);
    line-height: 1.2;
    overflow-wrap: anywhere;
}

.location-card-header p {
    margin: 4px 0 0;
    color: var(--muted-color);
    overflow-wrap: anywhere;
}

.location-actions {
    margin-block: 22px;
    align-items: center;
}

.location-qr {
    margin-inline-start: auto;
}

.location-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 8px 14px;
    border: 1px solid #76a1df;
    border-radius: 10px;
    background: #fff;
    color: var(--link-color);
    text-decoration: none;
    text-align: center;
    font-weight: 600;
    overflow-wrap: anywhere;
}

.location-link:hover {
    background: #edf5ff;
}

.location-link:focus-visible {
    outline: 3px solid var(--link-color);
    outline-offset: 3px;
}

.location-fridges {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 12px;
    margin: clamp(28px, 6vw, 72px) 0 0;
    padding: 0;
    list-style: none;
}

.location-fridges .location-link {
    width: 100%;
    height: 100%;
}

.location-empty {
    grid-column: 1 / -1;
}

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

@media (max-width: 700px) {
    .location-fridges {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .location-qr {
        margin-inline-start: 0;
    }
}

/* Shared layout for data-entry and confirmation forms. */
.form-card {
    width: min(650px, calc(100% - 32px));
    margin: clamp(20px, 5vw, 56px) auto;
    padding: clamp(24px, 6vw, 56px) clamp(16px, 5vw, 48px) clamp(48px, 9vw, 104px);
    border: 1px solid #438eee;
    border-radius: 24px;
    background: linear-gradient(180deg, #fff 0%, #fff 72%, #edf5ff 92%, #c5d6ff 100%);
}

.form-card>* {
    max-width: 430px;
    margin-inline: auto;
}

.form-card>h1,
.form-card>h2 {
    max-width: 100%;
    margin-block: 0 32px;
    text-align: center;
    font-size: clamp(26px, 5vw, 38px);
    font-weight: 550;
    line-height: 1.2;
    overflow-wrap: anywhere;
}

.form-card>.eyebrow {
    text-align: center;
}

.form-card>form {
    margin-top: clamp(24px, 5vw, 48px);
}

.form-card .form-field {
    margin-bottom: 20px;
}

.form-card .form-field :is(input:not([type="checkbox"]):not([type="radio"]), select, textarea) {
    width: 100%;
    min-height: 52px;
    padding: 12px 14px;
    border: 1px solid #588bd0;
    border-radius: 8px;
    color: #172b4d;
    background: linear-gradient(110deg, #f4f7ff, #fff 70%);
    font: inherit;
}

.form-card textarea {
    resize: vertical;
}

.form-card .form-field p {
    margin-block: 6px;
}

.form-actions {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 28px;
}

.form-actions .button {
    min-width: min(116px, 100%);
    max-width: 100%;
    text-align: center;
}

.form-actions .button.form-cancel {
    background: #b91c1c;
    color: white;
}

.form-actions .button.form-cancel:hover {
    background: #991b1b;
}

.form-actions .button.form-cancel-neutral {
    border: 1px solid #588bd0;
    background: white;
    color: #2058bc;
}