html,
body {
    color: #17211f;
    font-family: Inter, "Segoe UI", Arial, sans-serif;
    margin: 0;
}

.auth-page-shell {
    background: #ffffff;
    min-height: 100vh;
}

a,
.btn-link {
    color: #166050;
}

.btn-primary,
.btn-secondary {
    border-radius: 6px;
    font-weight: 700;
    min-height: 2.35rem;
    padding: 0.5rem 0.85rem;
}

.btn-primary {
    background: #166050;
    border: 1px solid #166050;
    color: #fff;
}

.btn-secondary {
    background: #ffffff;
    border: 1px solid #c8d4d0;
    color: #17211f;
}

.btn:focus,
.btn:active:focus,
.btn-link.nav-link:focus,
.form-control:focus,
.form-check-input:focus {
    box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #7fb3a5;
}

.content {
    padding: 1.5rem;
}

h1:focus {
    outline: none;
}

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

.page-header {
    align-items: center;
    display: flex;
    gap: 1rem;
    justify-content: space-between;
    margin-bottom: 1.25rem;
}

.page-header h1 {
    font-size: clamp(1.55rem, 2vw, 2.1rem);
    font-weight: 800;
    margin-bottom: 0;
}

.eyebrow {
    color: #5a6b65;
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0;
    margin-bottom: 0.25rem;
    text-transform: uppercase;
}

.header-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: flex-end;
}

.metric-grid {
    display: grid;
    gap: 0.85rem;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    margin-bottom: 1rem;
}

.metric-tile,
.panel,
.device-card {
    background: #ffffff;
    border: 1px solid #d9e1df;
    border-radius: 8px;
    box-shadow: 0 8px 22px rgba(19, 29, 26, 0.06);
}

.metric-tile {
    min-height: 8.5rem;
    padding: 1rem;
}

.metric-tile span,
.metric-tile small {
    color: #60716b;
    display: block;
    font-size: 0.82rem;
}

.metric-tile strong {
    display: block;
    font-size: 1.65rem;
    margin: 0.45rem 0;
}

.tone-success {
    border-left: 4px solid #1f8f64;
}

.tone-warning {
    border-left: 4px solid #c58b1b;
}

.tone-info {
    border-left: 4px solid #287a9a;
}

.tone-danger {
    border-left: 4px solid #b64c4c;
}

.work-grid,
.form-layout,
.settings-grid {
    display: grid;
    gap: 1rem;
    grid-template-columns: 2fr 1fr;
}

.panel {
    min-width: 0;
    padding: 1rem;
}

.panel-header {
    align-items: center;
    display: flex;
    gap: 1rem;
    justify-content: space-between;
    margin-bottom: 0.85rem;
}

.panel-header h2,
.device-card h2 {
    font-size: 1rem;
    font-weight: 800;
    margin-bottom: 0;
}

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

.ops-table {
    border-collapse: collapse;
    min-width: 760px;
    width: 100%;
}

.ops-table th,
.ops-table td {
    border-bottom: 1px solid #e3e9e7;
    padding: 0.78rem 0.65rem;
    text-align: left;
    vertical-align: middle;
    white-space: nowrap;
}

.ops-table th {
    color: #5a6b65;
    font-size: 0.76rem;
    text-transform: uppercase;
}

.status {
    border-radius: 999px;
    display: inline-flex;
    font-size: 0.74rem;
    font-weight: 800;
    justify-content: center;
    min-width: 4.75rem;
    padding: 0.25rem 0.55rem;
}

.status.paid,
.status.acknowledged,
.status.ready,
.status.online {
    background: #e2f6ed;
    color: #116344;
}

.status.pending,
.status.warning,
.status.degraded {
    background: #fff2d7;
    color: #8a5d08;
}

.status.failed,
.status.offline,
.status.danger {
    background: #fde6e6;
    color: #993232;
}

.status.disabled,
.status.expired {
    background: #e6e9ec;
    color: #4f5b61;
}

.health-list {
    display: grid;
    gap: 0.75rem;
}

.health-row {
    align-items: center;
    border-bottom: 1px solid #eef2f1;
    display: flex;
    gap: 1rem;
    justify-content: space-between;
    padding-bottom: 0.75rem;
}

.health-row:last-child {
    border-bottom: 0;
    padding-bottom: 0;
}

.health-row span,
.device-card span {
    color: #60716b;
    display: block;
    font-size: 0.82rem;
}

.toolbar {
    align-items: end;
    background: #ffffff;
    border: 1px solid #d9e1df;
    border-radius: 8px;
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1rem;
    padding: 1rem;
}

label {
    color: #4e615b;
    display: grid;
    font-size: 0.8rem;
    font-weight: 800;
    gap: 0.35rem;
}

input,
select {
    border: 1px solid #c8d4d0;
    border-radius: 6px;
    color: #17211f;
    min-height: 2.35rem;
    min-width: 14rem;
    padding: 0.45rem 0.65rem;
}

.signin-shell {
    margin: 0 auto;
    max-width: 1110px;
    padding: 2rem 1.5rem 4rem;
}

.signin-header {
    margin: 0 auto 2.5rem;
    max-width: 720px;
    text-align: center;
}

.signin-header.compact {
    margin-bottom: 1.5rem;
}

.signin-header img {
    display: block;
    height: auto;
    margin: 0 auto 1.1rem;
    width: min(180px, 48vw);
}

.signin-header h1 {
    color: #004a91;
    font-size: 2rem;
    font-weight: 800;
    margin-bottom: 0.4rem;
}

.signin-header p {
    color: #4f5b61;
    font-size: 1rem;
    margin-bottom: 0;
}

.signin-grid {
    display: grid;
    gap: 1.5rem;
    grid-template-columns: 1fr 1fr;
}

.signin-info,
.signin-card {
    background: #ffffff;
    border: 1px solid #d9dfe3;
    border-radius: 8px;
}

.signin-info {
    align-self: start;
    padding: 1.4rem 1.6rem;
    text-align: center;
}

.signin-info h2,
.signin-card h2 {
    color: #004a91;
    font-size: 1.55rem;
    font-weight: 800;
    margin-bottom: 0.85rem;
}

.signin-info p,
.signin-muted {
    color: #46565f;
    line-height: 1.55;
}

.signin-quote {
    align-items: center;
    color: #46565f;
    display: inline-flex;
    gap: 0.8rem;
    justify-content: center;
    margin-top: 1rem;
}

.signin-quote span {
    align-items: center;
    background: #eaf3fb;
    border: 1px solid #c9dceb;
    border-radius: 6px;
    color: #004a91;
    display: inline-flex;
    font-size: 0.78rem;
    font-weight: 900;
    height: 1.5rem;
    justify-content: center;
    width: 2rem;
}

.signin-card {
    box-shadow: 0 8px 18px rgba(27, 39, 48, 0.12);
    padding: 1.4rem 1.55rem;
}

.signin-card.standalone {
    margin: 0 auto;
    max-width: 520px;
    text-align: center;
}

.signin-card form {
    display: grid;
    gap: 1rem;
}

.signin-card input {
    min-width: 100%;
}

.btn-qrph-primary,
.btn-qrph-outline {
    align-items: center;
    border-radius: 6px;
    display: inline-flex;
    font-weight: 700;
    justify-content: center;
    min-height: 2.45rem;
    padding: 0.55rem 0.85rem;
    text-decoration: none;
    width: 100%;
}

.btn-qrph-primary {
    background: #004a91;
    border: 1px solid #004a91;
    color: #ffffff;
}

.btn-qrph-primary:hover {
    background: #003c78;
    color: #ffffff;
}

.btn-qrph-outline {
    background: #ffffff;
    border: 2px solid #d0281f;
    color: #d0281f;
    margin-top: 1rem;
}

.btn-qrph-outline:hover {
    background: #d0281f;
    color: #ffffff;
}

.link-button {
    margin-top: 1rem;
}

.signin-link {
    color: #004a91;
    display: block;
    margin-top: 1rem;
    text-align: center;
}

.signin-error {
    background: #fde6e6;
    border: 1px solid #f2bcbc;
    border-radius: 6px;
    color: #993232;
    font-size: 0.9rem;
    font-weight: 700;
    margin-bottom: 1rem;
    padding: 0.75rem;
}

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

.device-card {
    padding: 1rem;
}

.device-card-header {
    align-items: start;
    display: flex;
    gap: 1rem;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.device-card dl,
.qr-preview dl {
    display: grid;
    gap: 0.65rem;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin: 0;
}

.device-card dl div,
.qr-preview dl div {
    background: #f7faf9;
    border-radius: 6px;
    padding: 0.7rem;
}

dt {
    color: #62736d;
    font-size: 0.72rem;
    font-weight: 800;
    text-transform: uppercase;
}

dd {
    margin: 0.15rem 0 0;
}

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

.qr-preview {
    display: grid;
    gap: 1rem;
}

.qr-box {
    align-items: center;
    aspect-ratio: 1;
    background: #f7faf9;
    border: 1px dashed #9fb1ab;
    border-radius: 8px;
    color: #17211f;
    display: flex;
    font-weight: 800;
    justify-content: center;
    min-height: 14rem;
}

.check-list {
    display: grid;
    gap: 0.6rem;
}

.check-list span {
    background: #f7faf9;
    border: 1px solid #e3e9e7;
    border-radius: 6px;
    display: block;
    padding: 0.7rem;
}

.loading-text {
    color: #60716b;
}

.valid.modified:not([type=checkbox]) {
    outline: 1px solid #26b050;
}

.invalid {
    outline: 1px solid #e50000;
}

.validation-message {
    color: #e50000;
}

.blazor-error-boundary {
    background: #b32121;
    color: white;
    padding: 1rem;
}

.blazor-error-boundary::after {
    content: "An error has occurred.";
}

.darker-border-checkbox.form-check-input {
    border-color: #929292;
}

.form-floating > .form-control-plaintext::placeholder,
.form-floating > .form-control::placeholder {
    color: var(--bs-secondary-color);
    text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder,
.form-floating > .form-control:focus::placeholder {
    text-align: start;
}

@media (max-width: 980px) {
    .metric-grid,
    .work-grid,
    .form-layout,
    .settings-grid,
    .signin-grid,
    .device-grid {
        grid-template-columns: 1fr;
    }

    .ops-table {
        min-width: 680px;
    }
}

@media (max-width: 640px) {
    .content {
        padding: 1rem;
    }

    .page-header {
        align-items: stretch;
        flex-direction: column;
    }

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

    .header-actions button {
        flex: 1;
    }

    input,
    select {
        min-width: 100%;
    }

    .signin-shell {
        padding: 1.5rem 1rem 3rem;
    }

    .signin-header h1 {
        font-size: 1.65rem;
    }
}
