:root {
    --bg: #f4f7f5;
    --surface: #ffffff;
    --ink: #15201d;
    --muted: #62716c;
    --line: #dfe7e3;
    --brand: #0a6753;
    --brand-strong: #075242;
    --success: #137352;
    --warning: #936f1c;
    --radius: 14px;
    font-family: "Segoe UI", Arial, sans-serif;
}

* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    min-height: 100%;
    color: var(--ink);
    background: var(--bg);
}

html:has(.cash-modal-backdrop),
html:has(.cash-busy-overlay),
html:has(.pta-backdrop),
body:has(.cash-modal-backdrop),
body:has(.cash-busy-overlay),
body:has(.pta-backdrop) {
    overflow: hidden;
}

/* Ticket action dialogs are rendered inside a card. A hovered card has a
   transform, which otherwise turns position: fixed into a card-local layer. */
body .pt-card.pt-card:has(.pta-backdrop) {
    overflow: visible;
    transform: none;
    transition: none;
}

/* The logout dialog is rendered by NavMenu inside the sticky sidebar.
   Raise that stacking context only while the dialog is open so sticky
   table headers cannot paint above its backdrop. */
.sidebar:has(.logout-confirmation-backdrop) {
    z-index: 3100;
    overflow: visible;
}

a {
    color: var(--brand);
    text-decoration: none;
}

h1 {
    margin: 0.25rem 0 0;
    font-size: clamp(1.6rem, 3vw, 2rem);
}

/* Shared register toolbar -------------------------------------------------- */
.registry-toolbar-panel {
    margin-bottom: .75rem;
    padding: 1rem;
    container-type: inline-size;
}

.registry-toolbar-grid {
    display: flex;
    flex-wrap: wrap;
    gap: .7rem;
    align-items: flex-start;
}

.registry-field,
.registry-select-field {
    display: grid;
    grid-template-rows: 18px 44px;
    gap: .38rem;
    min-width: 0;
    margin: 0;
    color: var(--muted);
    font-size: .78rem;
    font-weight: 700;
}

.registry-field {
    flex: 1 1 115px;
}

.registry-field.registry-search {
    flex: 2 1 195px;
}

.registry-field.registry-page-size {
    flex: 0 1 85px;
}

.registry-field > input,
.registry-field > select {
    width: 100%;
    height: 44px;
    min-height: 44px;
    margin: 0;
    box-sizing: border-box;
}

.registry-select-field {
    flex: 0 0 112px;
}

.registry-select-all {
    display: flex;
    align-items: center;
    gap: .6rem;
    height: 44px;
    min-height: 44px;
    margin: 0 !important;
    padding: .45rem .6rem;
    border: 1px solid var(--line);
    border-radius: 9px;
    background: #f7faf9;
    color: var(--ink);
    cursor: pointer;
    box-sizing: border-box;
}

.registry-select-all input {
    flex: 0 0 auto;
    width: 18px !important;
    height: 18px;
    margin: 0;
    accent-color: #087965;
}

.registry-select-all span {
    display: flex;
    flex-direction: column;
    line-height: 1.15;
}

.registry-select-all strong {
    color: var(--ink);
    font-size: .78rem;
    white-space: nowrap;
}

.registry-select-all small {
    margin-top: .15rem;
    color: var(--muted);
    font-size: .67rem;
    font-weight: 550;
}

.registry-action-bar {
    max-height: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    margin: 0;
    padding: 0 1rem;
    border: 1px solid transparent;
    border-radius: 10px;
    background: #f0f8f6;
    transition: max-height .25s ease, opacity .2s ease, margin .25s ease,
        padding .25s ease, border-color .25s ease;
}

.registry-action-bar.visible {
    max-height: 96px;
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    margin-top: .9rem;
    padding: .75rem 1rem;
    border-color: #a8d5ca;
}

.registry-selection-summary,
.registry-bulk-actions {
    display: flex;
    align-items: center;
    gap: .65rem;
}

.registry-selection-icon {
    display: inline-grid;
    flex: 0 0 27px;
    place-items: center;
    width: 27px;
    height: 27px;
    border-radius: 50%;
    background: #087965;
    color: white;
    font-size: .78rem;
    font-weight: 800;
}

.registry-bulk-actions {
    flex-wrap: wrap;
    justify-content: flex-end;
}

.registry-toolbar-stats {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-top: .75rem;
    padding-top: .65rem;
    border-top: 1px solid var(--line);
    color: var(--muted);
    font-size: .8rem;
}

.registry-shown-count {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    white-space: nowrap;
}

.registry-count-value {
    display: inline-grid;
    place-items: center;
    min-width: 28px;
    height: 24px;
    padding: 0 .45rem;
    border-radius: 999px;
    background: #e9f7f3;
    color: #08705e;
    font-size: .78rem;
    line-height: 1;
}

.registry-total-value {
    color: var(--ink);
}

.registry-toolbar-stats-aside {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: .75rem;
    flex-wrap: wrap;
}

.registry-danger {
    background: #dc2626;
    border-color: #dc2626;
    color: white;
}

.registry-danger:hover:not(:disabled) {
    background: #b91c1c;
    border-color: #b91c1c;
}

@container (min-width: 701px) and (max-width: 1050px) {
    .registry-toolbar-grid--payments .registry-field:not(.registry-search):not(.registry-page-size) {
        flex-grow: 0;
    }
}

@media (max-width: 900px) {
    .registry-field {
        flex-basis: calc(33.333% - .7rem);
    }

    .registry-field.registry-search {
        flex-basis: calc(66.666% - .7rem);
    }
}

@media (max-width: 700px) {
    .registry-select-field,
    .registry-field.registry-search {
        flex: 1 1 100%;
    }

    .registry-field {
        flex-basis: calc(50% - .7rem);
    }

    .registry-toolbar-stats,
    .registry-action-bar.visible {
        align-items: stretch;
        flex-direction: column;
    }

    .registry-toolbar-stats-aside {
        justify-content: flex-start;
    }

    .registry-action-bar.visible {
        max-height: 180px;
    }

    .registry-selection-summary,
    .registry-bulk-actions {
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .registry-field {
        flex-basis: 100%;
    }

    .registry-bulk-actions .button {
        flex: 1 1 100%;
    }
}

h1:focus {
    outline: none;
}

h2 {
    font-size: 1.05rem;
    margin: 0 0 1rem;
}

p {
    color: var(--muted);
}

button, input, select, textarea {
    font: inherit;
}

input, select, textarea {
    width: 100%;
    margin-top: 0.45rem;
    padding: 0.7rem 0.8rem;
    border: 1px solid var(--line);
    border-radius: 9px;
    background: #fff;
}

textarea {
    min-height: 110px;
    resize: vertical;
}

input:focus, select:focus, textarea:focus {
    outline: 2px solid #9bcbbf;
    border-color: var(--brand);
}

label {
    color: var(--ink);
    display: block;
    margin: 0.7rem 0;
    font-size: 0.9rem;
}

.page-heading {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.6rem;
}

.eyebrow {
    margin: 0;
    color: var(--brand);
    text-transform: uppercase;
    letter-spacing: 0.12em;
    font-size: 0.7rem;
    font-weight: 700;
}

.status {
    border-radius: 20px;
    padding: 0.45rem 0.8rem;
    font-size: 0.82rem;
    font-weight: 600;
}

.healthy {
    color: var(--success);
    background: #daf4ea;
}

.planned {
    color: var(--warning);
    background: #fcf0d4;
}

.metrics {
    display: grid;
    grid-template-columns: repeat(4, minmax(130px, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}

.metric, .panel {
    min-width: 0;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 1.2rem;
}

.metric strong {
    display: block;
    font-size: 1.7rem;
}

.metric span {
    color: var(--muted);
    font-size: 0.86rem;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: minmax(260px, 0.9fr) minmax(380px, 1.25fr);
    gap: 1rem;
}

.event-panel {
    grid-column: 1 / -1;
}

.device-scenario-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(280px, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}

.plain-list,
.event-feed {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    gap: .7rem;
}

.plain-list li,
.event-feed li {
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: .7rem .8rem;
}

.plain-list span,
.event-feed span {
    display: block;
    color: var(--muted);
    font-size: .82rem;
}

.event-feed p {
    margin: .25rem 0 0;
}

.lane-board {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: .75rem;
}

.lane-board div {
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: .8rem;
    background: #f8fbf9;
}

.lane-board strong,
.lane-board span,
.lane-board small {
    display: block;
}

.lane-board span,
.lane-board small {
    color: var(--muted);
}

.lane-board p {
    margin: .45rem 0;
    color: var(--ink);
    font-weight: 700;
}

.vehicle-pass-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: .9rem;
}

.vehicle-pass-card {
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: .9rem;
    background: #f8fbf9;
}

.vehicle-pass-head {
    display: flex;
    justify-content: space-between;
    gap: .75rem;
    align-items: flex-start;
    margin-bottom: .75rem;
}

.vehicle-pass-head strong,
.vehicle-pass-head span {
    display: block;
}

.vehicle-pass-head span {
    color: var(--muted);
    font-size: .82rem;
}

.vehicle-pass-head b {
    max-width: 45%;
    text-align: right;
    overflow-wrap: anywhere;
    font-size: .86rem;
}

.vehicle-pass-images {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: .65rem;
}

.vehicle-pass-images figure {
    margin: 0;
}

.vehicle-pass-images img {
    width: 100%;
    height: 140px;
    object-fit: contain;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
}

.vehicle-pass-images figcaption {
    margin-top: .3rem;
    color: var(--muted);
    font-size: .78rem;
}

.device-counts {
    display: grid;
    grid-template-columns: repeat(4, minmax(90px, 1fr));
    gap: .75rem;
    margin-bottom: 1rem;
}

.device-counts div {
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: .75rem;
}

.device-counts strong,
.device-counts span {
    display: block;
}

.device-counts span {
    color: var(--muted);
    font-size: .82rem;
}

.device-two-columns {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .75rem;
}

.manual-barrier-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: .75rem;
}

.manual-barrier-grid > div {
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: .85rem;
}

.manual-barrier-grid strong,
.manual-barrier-grid span {
    display: block;
}

.manual-barrier-grid span {
    color: var(--muted);
    margin-bottom: .6rem;
}

.scenario-editor-grid {
    display: grid;
    grid-template-columns: minmax(280px, .75fr) minmax(320px, 1fr);
    gap: 1rem;
    margin-bottom: 1rem;
}

.scenario-builder {
    margin-bottom: 1rem;
}

.scenario-add-actions {
    margin-bottom: 1rem;
}

.scenario-step-list {
    display: grid;
    gap: .9rem;
}

.scenario-step {
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: .9rem;
    background: #fbfdfc;
}

.scenario-step-head {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: flex-start;
    margin-bottom: .8rem;
}

.scenario-step-head span {
    display: block;
    color: var(--muted);
    font-size: .85rem;
    margin-top: .2rem;
}

.scenario-step-fields {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: .75rem;
}

.scenario-step-fields label {
    margin: 0;
}

.check {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 1rem 0;
}

.check input {
    width: auto;
    margin: 0;
}

.actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
}

.button {
    display: inline-flex;
    border: 1px solid transparent;
    border-radius: 9px;
    padding: 0.7rem 1rem;
    cursor: pointer;
    font-weight: 600;
}

.button.compact {
    width: auto;
    padding: .4rem .55rem;
    margin: .15rem;
    font-size: .78rem;
}

.button:disabled {
    cursor: wait;
    opacity: 0.55;
}

/* Shared action layout for physical-device and cash-register cards. */
.inventory-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .45rem;
    width: 100%;
    min-width: 0;
}

.inventory-actions .button {
    width: 100%;
    min-width: 0;
    min-height: 32px;
    display: inline-flex;
    gap: .35rem;
    align-items: center;
    justify-content: center;
    margin: 0;
    padding: .38rem .5rem;
    border-radius: 7px;
    font-size: .76rem;
    font-weight: 650;
    line-height: 1.05;
    white-space: nowrap;
    transition: color .16s ease, background-color .16s ease,
        border-color .16s ease, box-shadow .16s ease, transform .16s ease;
}

.device-action-icon {
    width: 14px;
    height: 14px;
    flex: 0 0 14px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.9;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.page-heading .actions .button {
    display: inline-flex;
    gap: .45rem;
    align-items: center;
    justify-content: center;
}

.inventory-actions .inventory-action-secondary {
    color: var(--brand);
    border-color: #a8d5ca;
    background: #f3faf7;
}

.inventory-actions .inventory-action-secondary:hover:not(:disabled) {
    color: #fff;
    border-color: var(--brand);
    background: var(--brand);
    box-shadow: 0 3px 9px rgba(10, 103, 83, .16);
    transform: translateY(-1px);
}

.inventory-actions .inventory-action-primary {
    color: #fff;
    border-color: var(--brand);
    background: var(--brand);
}

.inventory-actions .inventory-action-primary:hover:not(:disabled) {
    color: #fff;
    border-color: var(--brand-strong);
    background: var(--brand-strong);
    box-shadow: 0 3px 10px rgba(7, 82, 66, .22);
    transform: translateY(-1px);
}

.inventory-actions .inventory-action-danger {
    color: #fff;
    border-color: #b33a3a;
    background: #b33a3a;
}

.inventory-actions .inventory-action-danger:hover:not(:disabled) {
    color: #fff;
    border-color: #8f2c2c;
    background: #8f2c2c;
    box-shadow: 0 3px 10px rgba(143, 44, 44, .2);
    transform: translateY(-1px);
}

.inventory-actions .button:focus-visible {
    outline: 3px solid rgba(10, 103, 83, .22);
    outline-offset: 2px;
}

.primary {
    color: #fff;
    background: var(--brand);
}

.primary:hover {
    background: var(--brand-strong);
}

.secondary {
    color: var(--brand);
    border-color: #aad3c8;
    background: #eef8f5;
}

.notice {
    color: var(--success);
    margin: 1rem 0 0;
    padding: 0.65rem 0.75rem;
    border-radius: 8px;
    background: #e4f6ef;
    font-size: 0.9rem;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

th {
    color: var(--muted);
    font-weight: 600;
    text-align: left;
}

td, th {
    padding: 0.65rem 0.45rem;
    border-bottom: 1px solid var(--line);
}

.pill {
    border-radius: 12px;
    padding: 0.25rem 0.45rem;
    color: var(--success);
    background: #edf8f4;
    font-size: 0.78rem;
}

.event {
    display: flex;
    gap: 1rem;
    padding: 0.55rem 0;
    border-bottom: 1px solid var(--line);
}

.event time {
    color: var(--muted);
    font-size: 0.84rem;
}

.event p {
    display: inline;
    margin: 0 0 0 0.65rem;
    font-size: 0.9rem;
}

.empty-state {
    max-width: 720px;
    padding: 2.2rem;
    text-align: center;
}

.login-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    max-width: 400px;
    margin: 8vh auto;
    padding: 2rem;
}

.login-card .button {
    width: 100%;
    justify-content: center;
    margin-top: 0.7rem;
}

.login-error {
    display: grid;
    gap: .2rem;
    margin: 1rem 0 .3rem;
    padding: .8rem .9rem;
    color: #8f1d18;
    border: 1px solid #efb9b5;
    border-radius: 9px;
    background: #fff1f0;
    font-size: .86rem;
    line-height: 1.35;
}

.login-error strong {
    font-size: .9rem;
}

.login-card input[aria-invalid="true"] {
    border-color: #d44a42;
    box-shadow: 0 0 0 3px rgba(212, 74, 66, .12);
}

.table-responsive {
    width: 100%;
    min-width: 0;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.login-install-link {
    display: block;
    margin-top: 1rem;
    text-align: center;
    font-size: .9rem;
    font-weight: 600;
}

.settings-table input {
    min-width: 180px;
}

.report-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(280px, 1fr));
    gap: 1rem;
}

.reports-help-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}

.report-presets {
    margin-bottom: 1rem;
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: .9rem;
    background: linear-gradient(135deg, #f8fbfa, #f1f8f5);
}

.report-presets-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: .7rem;
}

.report-presets-heading h2 {
    margin: 0;
    font-size: 1rem;
}

.report-presets-heading p {
    margin: .18rem 0 0;
    color: var(--muted);
    font-size: .8rem;
}

.report-preset-selected {
    flex: 0 0 auto;
    border-radius: 999px;
    padding: .3rem .6rem;
    color: #075c4e;
    background: #d7f2e9;
    font-size: .72rem;
    font-weight: 700;
}

.report-preset-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(150px, 1fr));
    gap: .55rem;
}

.report-preset-card {
    display: grid;
    grid-template-columns: 32px 1fr;
    grid-template-areas:
        "icon copy"
        "action action";
    gap: .35rem .55rem;
    min-width: 0;
    border: 1px solid #d5e2de;
    border-radius: 11px;
    padding: .68rem .72rem;
    color: #23473f;
    background: #fff;
    cursor: pointer;
    font: inherit;
    text-align: left;
    transition: border-color .16s ease, box-shadow .16s ease, transform .16s ease;
}

.report-preset-card:hover {
    border-color: #78b7a7;
    box-shadow: 0 5px 14px rgba(23, 80, 67, .08);
    transform: translateY(-1px);
}

.report-preset-card.is-selected {
    border-color: #16816e;
    box-shadow: 0 0 0 2px rgba(22, 129, 110, .11);
    background: #f1fbf7;
}

.report-preset-icon {
    grid-area: icon;
    display: grid;
    place-items: center;
    width: 32px;
    height: 32px;
    border-radius: 9px;
    color: #08715f;
    background: #e4f5ef;
    font-size: .82rem;
    font-weight: 800;
}

.report-preset-copy {
    grid-area: copy;
    display: grid;
    min-width: 0;
    gap: .18rem;
}

.report-preset-copy strong {
    font-size: .82rem;
}

.report-preset-copy small {
    color: var(--muted);
    font-size: .7rem;
    line-height: 1.3;
}

.report-preset-action {
    grid-area: action;
    color: #08715f;
    font-size: .7rem;
    font-weight: 700;
    text-align: right;
}

.reports-help-card h2 {
    margin: 0 0 .45rem;
    font-size: 1rem;
}

.reports-help-card p {
    margin: 0;
    color: var(--muted);
    line-height: 1.5;
    font-size: .9rem;
}

.report-photo-link {
    display: inline-flex;
    align-items: center;
}

.report-photo-thumb {
    width: 74px;
    height: 48px;
    object-fit: cover;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #f8fbf9;
}

.reports-detail-wrap {
    overflow-x: auto;
}

.reports-detail-table {
    min-width: 1380px;
}

.report-summary-title {
    margin: 1.1rem 0 .65rem;
    font-size: 1rem;
}

.report-summary-metrics {
    grid-template-columns: repeat(auto-fit, minmax(175px, 1fr));
}

.report-metric {
    position: relative;
    overflow: hidden;
}

.report-metric::before {
    content: '';
    position: absolute;
    inset: 0 0 auto;
    height: 3px;
    background: #94a3b8;
}

.report-metric.total::before,
.report-metric.automatic::before { background: #0f766e; }
.report-metric.cash::before { background: #059669; }
.report-metric.card::before,
.report-metric.subscription::before { background: #2563eb; }
.report-metric.manual::before { background: #ef4444; }
.report-metric.special::before { background: #f59e0b; }

.report-metric small {
    display: block;
    margin-top: .35rem;
    color: var(--muted);
    font-size: .72rem;
}

.report-breakdown-panel {
    margin-bottom: 1rem;
}

.report-analytics-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
    margin: 1rem 0;
}

.report-analysis-panel {
    min-width: 0;
}

.analysis-total-row {
    display: flex;
    flex-wrap: wrap;
    gap: .55rem 1.25rem;
    margin: .8rem 0 1rem;
    color: var(--muted);
    font-size: .82rem;
}

.analysis-total-row strong {
    color: var(--ink);
    font-size: 1.1rem;
}

.analysis-list {
    display: grid;
    gap: .85rem;
}

.analysis-row-head {
    display: flex;
    justify-content: space-between;
    gap: .75rem;
    margin-bottom: .35rem;
    font-size: .8rem;
}

.analysis-row-head span {
    color: var(--muted);
    text-align: right;
}

.analysis-track {
    height: 8px;
    overflow: hidden;
    border-radius: 999px;
    background: #e2e8f0;
}

.analysis-track span {
    display: block;
    height: 100%;
    border-radius: inherit;
    transition: width .5s ease;
}

.analysis-track .subscription-bar {
    background: linear-gradient(90deg, #2563eb, #60a5fa);
}

.analysis-track .special-bar {
    background: linear-gradient(90deg, #f59e0b, #fb923c);
}

.report-breakdown-table {
    width: 100%;
    min-width: 1040px;
}

@media (max-width: 900px) {
    .report-analytics-grid {
        grid-template-columns: 1fr;
    }
}

.passage-mode {
    display: inline-flex;
    padding: .22rem .5rem;
    border-radius: 999px;
    font-size: .72rem;
    font-weight: 700;
}

.passage-mode.automatic {
    color: #0f766e;
    background: #d1fae5;
}

.passage-mode.manual {
    color: #b91c1c;
    background: #fee2e2;
}

.report-card p {
    margin-bottom: 0;
}

.report-filter,
.scheduler-form,
.send-provider-form {
    margin-bottom: 1rem;
}

.report-filter,
.scheduler-grid,
.send-provider-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: .75rem;
    align-items: end;
}

.report-filter label,
.scheduler-grid label,
.send-provider-grid label {
    margin: 0;
}

.report-filter .report-photo-option {
    display: grid;
    grid-template-columns: 28px minmax(0, 1fr) auto;
    gap: .55rem;
    align-items: center;
    align-self: center;
    height: 46px;
    min-height: 46px;
    box-sizing: border-box;
    border: 1px solid #cfdeda;
    border-radius: 9px;
    padding: .3rem .55rem;
    background: #f8fbfa;
    cursor: pointer;
}

.report-filter .report-photo-option.is-active {
    border-color: #6eb5a3;
    background: #eef9f5;
}

.report-photo-icon {
    display: grid;
    place-items: center;
    width: 28px;
    height: 28px;
    border-radius: 7px;
    color: #08715f;
    background: #dff3ec;
}

.report-photo-icon svg {
    width: 16px;
    height: 16px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.report-photo-copy {
    display: grid;
    gap: .16rem;
    min-width: 0;
}

.report-photo-copy strong {
    color: #23473f;
    font-size: .84rem;
}

.report-photo-copy small {
    display: none;
}

.report-photo-switch {
    position: relative;
    display: block;
    width: 42px;
    height: 24px;
}

.report-photo-switch input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
}

.report-photo-switch > span {
    position: absolute;
    inset: 0;
    border-radius: 999px;
    background: #aebfba;
    transition: background .16s ease;
}

.report-photo-switch > span::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .18);
    transition: transform .16s ease;
}

.report-photo-switch input:checked + span {
    background: #0d806c;
}

.report-photo-switch input:checked + span::after {
    transform: translateX(18px);
}

.report-photo-switch input:focus-visible + span {
    outline: 3px solid rgba(13, 128, 108, .2);
    outline-offset: 2px;
}

.report-filter-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-column: span 2;
    width: 100%;
    align-self: center;
    gap: .7rem;
}

.report-filter-control {
    display: grid;
    align-content: start;
    min-width: 0;
}

.report-filter-label-spacer {
    display: block;
    height: 1.08rem;
    margin-bottom: .45rem;
}

.report-filter {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    align-items: center;
    gap: .7rem;
}

.report-filter.has-plate-field {
    grid-template-columns:
        repeat(3, minmax(0, 1fr))
        minmax(300px, 1.5fr)
        repeat(3, minmax(0, 1fr));
}

.report-filter > label:not(.report-photo-option) {
    width: 100%;
    min-width: 0;
}

.report-filter > .report-photo-control {
    width: 100%;
    min-width: 0;
    max-width: none;
}

.report-filter > .report-plate-field {
    min-width: 0;
}

.report-filter > label > .field-hint,
.report-filter-control > .field-hint {
    min-height: 2.5em;
    line-height: 1.25;
}

.report-action-button {
    width: 100%;
    justify-content: center;
    gap: .42rem;
    min-height: 40px;
    white-space: nowrap;
    font-weight: 750;
    transition: border-color .16s ease, background .16s ease, color .16s ease, box-shadow .16s ease, transform .16s ease;
}

.report-action-button:hover:not(:disabled) {
    transform: translateY(-1px);
}

.report-generate-button {
    border-color: #087965;
    background: #087965;
    color: #fff;
}

.report-generate-button:hover:not(:disabled) {
    border-color: #065f50;
    background: #065f50;
    color: #fff;
    box-shadow: 0 5px 12px rgba(8, 121, 101, .22);
}

.report-export-button {
    border-color: #78aee0;
    background: #eaf4ff;
    color: #1f619b;
}

.report-export-button:hover:not(:disabled) {
    border-color: #2676b8;
    background: #2676b8;
    color: #fff;
    box-shadow: 0 5px 12px rgba(38, 118, 184, .2);
}

.report-action-button svg {
    flex: 0 0 16px;
    width: 16px;
    height: 16px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.report-export-spinner {
    flex: 0 0 16px;
    width: 16px;
    height: 16px;
    box-sizing: border-box;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: report-export-spin .75s linear infinite;
}

.report-export-progress {
    display: grid;
    gap: .7rem;
    margin: -.25rem 0 1rem;
    border: 1px solid #9fd4c7;
    border-radius: 11px;
    padding: .8rem .9rem;
    color: #174f43;
    background: #f1faf7;
}

.report-export-progress-head {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: .65rem;
}

.report-export-progress-head > div {
    display: grid;
    gap: .12rem;
}

.report-export-progress-head strong {
    font-size: .86rem;
}

.report-export-progress-head small {
    color: var(--muted);
    font-size: .72rem;
}

.report-export-progress-head b {
    font-size: .86rem;
}

.report-export-progress-track {
    height: 8px;
    overflow: hidden;
    border-radius: 999px;
    background: #cfe5df;
    box-shadow: inset 0 1px 2px rgba(10, 76, 64, .12);
}

.report-export-progress-track > span {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #087965, #40b89c);
    transition: width .3s ease;
}

.report-export-steps {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: .45rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.report-export-steps li {
    display: flex;
    align-items: center;
    gap: .38rem;
    min-width: 0;
    color: #789088;
    font-size: .7rem;
}

.report-export-steps li > span {
    display: grid;
    place-items: center;
    flex: 0 0 20px;
    width: 20px;
    height: 20px;
    border: 1px solid #bdd2cc;
    border-radius: 50%;
    font-size: .66rem;
    font-weight: 800;
}

.report-export-steps li > strong {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.report-export-steps .is-complete,
.report-export-steps .is-current {
    color: #08715f;
}

.report-export-steps .is-complete > span {
    border-color: #71b8a5;
    color: #fff;
    background: #16816e;
}

.report-export-steps .is-current > span {
    border-color: #16816e;
    box-shadow: 0 0 0 3px rgba(22, 129, 110, .12);
    background: #e4f5ef;
}

@keyframes report-export-spin {
    to { transform: rotate(360deg); }
}

.report-type-modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 5000;
    display: grid;
    place-items: center;
    padding: 1rem;
    background: rgba(7, 30, 24, .55);
}

.report-type-modal {
    display: grid;
    gap: 1rem;
    width: min(760px, 100%);
    max-height: calc(100dvh - 2rem);
    overflow: auto;
    border-radius: 15px;
    padding: 1.1rem;
    background: #fff;
    box-shadow: 0 28px 80px rgba(7, 30, 24, .3);
}

.report-type-modal > header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
}

.report-type-modal > header p,
.report-type-modal > header h2,
.report-type-modal > header span {
    margin: 0;
}

.report-type-modal > header p {
    color: #08715f;
    font-size: .7rem;
    font-weight: 800;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.report-type-modal > header h2 {
    margin-top: .2rem;
    font-size: 1.1rem;
}

.report-type-modal > header span {
    display: block;
    margin-top: .3rem;
    color: var(--muted);
    font-size: .78rem;
}

.report-type-modal-close {
    display: grid;
    flex: 0 0 34px;
    place-items: center;
    width: 34px;
    height: 34px;
    border: 1px solid var(--line);
    border-radius: 8px;
    color: #405b54;
    background: #fff;
    cursor: pointer;
    font-size: 1.2rem;
}

.report-type-mode-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .7rem;
}

.report-type-mode {
    display: grid;
    grid-template-columns: 34px minmax(0, 1fr);
    gap: .2rem .65rem;
    border: 1px solid #ceddd8;
    border-radius: 11px;
    padding: .75rem;
    color: #294b43;
    background: #f9fbfa;
    cursor: pointer;
    font: inherit;
    text-align: left;
}

.report-type-mode > span {
    grid-row: span 2;
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border-radius: 9px;
    color: #08715f;
    background: #e3f3ee;
    font-weight: 800;
}

.report-type-mode strong {
    font-size: .86rem;
}

.report-type-mode small {
    color: var(--muted);
    font-size: .72rem;
}

.report-type-mode.is-selected {
    border-color: #16816e;
    box-shadow: 0 0 0 3px rgba(22, 129, 110, .1);
    background: #eff9f5;
}

.report-type-picker {
    display: grid;
    gap: .65rem;
    border: 1px solid var(--line);
    border-radius: 11px;
    padding: .8rem;
    background: #f9fbfa;
}

.report-type-picker-toolbar {
    display: grid;
    grid-template-columns: minmax(220px, 1fr) auto;
    align-items: end;
    gap: .7rem;
}

.report-type-picker-toolbar label {
    margin: 0;
    font-size: .76rem;
    font-weight: 700;
}

.report-type-picker-toolbar input {
    margin-top: .35rem;
}

.report-type-picker-toolbar > div {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: .5rem;
    padding-bottom: .15rem;
    color: var(--muted);
    font-size: .72rem;
}

.report-type-picker-toolbar button {
    border: 0;
    padding: .2rem;
    color: #08715f;
    background: transparent;
    cursor: pointer;
    font: inherit;
    font-weight: 750;
}

.report-type-options {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .45rem;
    max-height: 280px;
    overflow: auto;
}

.report-type-option {
    display: grid;
    grid-template-columns: auto 32px minmax(0, 1fr);
    align-items: center;
    gap: .55rem;
    margin: 0;
    border: 1px solid #d8e3df;
    border-radius: 9px;
    padding: .55rem .65rem;
    background: #fff;
    cursor: pointer;
}

.report-type-option:has(input:checked) {
    border-color: #71b8a5;
    background: #eef9f5;
}

.report-type-option input {
    width: 17px;
    height: 17px;
    margin: 0;
    padding: 0;
}

.report-type-option-icon {
    display: grid;
    place-items: center;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: #e5f4ef;
}

.report-type-option > span:last-child {
    display: grid;
    min-width: 0;
    gap: .12rem;
}

.report-type-option strong {
    overflow: hidden;
    font-size: .8rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.report-type-option small {
    color: var(--muted);
    font-size: .68rem;
}

.report-type-picker-empty,
.report-type-modal-error {
    margin: 0;
    border-radius: 8px;
    padding: .65rem .75rem;
    font-size: .78rem;
}

.report-type-picker-empty {
    background: #fff;
}

.report-type-modal-error {
    color: #9b2823;
    background: #fff0ef;
}

.report-type-modal > footer {
    display: flex;
    justify-content: flex-end;
    gap: .6rem;
    border-top: 1px solid var(--line);
    padding-top: .9rem;
}

@media (max-width: 1180px) {
    .report-preset-grid {
        grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    }

    .report-filter {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .report-filter.has-plate-field {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .report-filter > .report-photo-control {
        grid-column: auto;
        width: 100%;
        min-width: 0;
        max-width: none;
    }

    .report-filter > label:not(.report-photo-option),
    .report-filter-actions {
        width: 100%;
    }

    .report-filter-actions {
        grid-column: 1 / -1;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .report-export-steps {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 560px) {
    .report-presets-heading {
        align-items: flex-start;
        flex-direction: column;
    }

    .report-preset-grid {
        grid-template-columns: 1fr;
    }

    .report-filter {
        grid-template-columns: 1fr;
    }

    .report-filter > .report-photo-control,
    .report-filter-actions {
        grid-column: auto;
    }

    .report-filter-actions {
        grid-template-columns: 1fr;
    }

    .report-filter-actions .button {
        justify-content: center;
    }

    .report-export-steps {
        grid-template-columns: 1fr;
    }

    .report-export-steps li > strong {
        white-space: normal;
    }

    .report-type-modal-backdrop {
        place-items: end center;
        padding: .5rem;
    }

    .report-type-modal {
        max-height: calc(100dvh - 1rem);
        border-radius: 15px 15px 8px 8px;
        padding: .9rem;
    }

    .report-type-mode-grid,
    .report-type-picker-toolbar,
    .report-type-options {
        grid-template-columns: 1fr;
    }

    .report-type-picker-toolbar > div {
        justify-content: flex-start;
        flex-wrap: wrap;
    }

    .report-type-modal > footer {
        display: grid;
        grid-template-columns: 1fr;
    }

}

@media (prefers-reduced-motion: reduce) {
    .report-export-spinner {
        animation-duration: 1.8s;
    }

    .report-export-progress-track > span {
        transition: none;
    }
}

.scheduler-grid .full-width {
    grid-column: 1 / -1;
}

.send-provider-form {
    width: 100%;
    max-width: none;
}

.send-provider-form > .actions,
.scheduler-form > .actions {
    margin-top: 1rem;
}

.send-provider-card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1rem;
}

.send-provider-card {
    display: flex;
    min-height: 245px;
    flex-direction: column;
    border-top: 4px solid #9fb8af;
}

.send-provider-card.telegram {
    border-top-color: #2a9bd8;
}

.send-provider-card.email {
    border-top-color: #087965;
}

.send-provider-card-head {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: flex-start;
    gap: .8rem;
}

.send-provider-card-head h2 {
    margin: 0;
    font-size: 1.05rem;
    overflow-wrap: break-word;
    word-break: normal;
    hyphens: none;
}

.send-provider-card-title { min-width: 0; }
.send-provider-card-badges {
    grid-column: 2;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: .35rem;
}

.send-provider-icon {
    display: inline-grid;
    place-items: center;
    width: 42px;
    height: 42px;
    border-radius: 10px;
    color: #087965;
    background: #e6f6f1;
}

.send-provider-card.telegram .send-provider-icon {
    color: #167eb5;
    background: #e5f4fb;
}

.send-provider-icon svg {
    width: 22px;
    height: 22px;
}

.send-provider-channel {
    display: block;
    margin-top: .2rem;
    color: var(--muted);
    font-size: .84rem;
}

.send-provider-meta {
    display: grid;
    gap: .75rem;
    margin: 1rem 0;
}

.send-provider-meta div {
    display: grid;
    gap: .25rem;
}

.send-provider-meta dt {
    color: var(--muted);
    font-size: .78rem;
    font-weight: 600;
    text-transform: uppercase;
}

.send-provider-meta dd {
    margin: 0;
    overflow-wrap: anywhere;
    font-weight: 600;
}

.send-provider-card .actions {
    margin-top: auto;
}

.send-provider-create-card {
    display: grid;
    width: 100%;
    min-height: 245px;
    place-items: center;
    align-content: center;
    gap: .6rem;
    padding: 1.2rem;
    color: #8da0bb;
    border: 2px dashed #c9d8ef;
    border-radius: var(--radius);
    background: rgba(255, 255, 255, .45);
    font: inherit;
    font-weight: 700;
    cursor: pointer;
    text-align: center;
}

.send-provider-create-card:hover {
    color: var(--brand);
    border-color: #9ccfc2;
    background: #f7fcfa;
}

.send-provider-create-plus {
    display: inline-grid;
    place-items: center;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: 1px solid currentColor;
    font-size: 1.35rem;
    line-height: 1;
}

.scheduler-create-card {
    min-height: 270px;
}

.scheduler-card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
    gap: 1rem;
}

.scheduler-card {
    display: flex;
    min-height: 270px;
    flex-direction: column;
    border-top: 4px solid #9fb8af;
}

.scheduler-card.summary {
    border-top-color: #087965;
}

.scheduler-card.cars {
    border-top-color: #2563eb;
}

.scheduler-card.special {
    border-top-color: #c2410c;
}

.scheduler-card.subscriptions {
    border-top-color: #7c3aed;
}

.scheduler-card.inside {
    border-top-color: #0f766e;
}

.scheduler-card-head {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: .75rem;
    align-items: flex-start;
}

.scheduler-card-icon {
    display: inline-grid;
    place-items: center;
    width: 42px;
    height: 42px;
    border-radius: 10px;
    color: #087965;
    background: #e6f6f1;
}

.scheduler-card.cars .scheduler-card-icon {
    color: #2563eb;
    background: #e8f0ff;
}

.scheduler-card.special .scheduler-card-icon {
    color: #c2410c;
    background: #fff0e7;
}

.scheduler-card.subscriptions .scheduler-card-icon {
    color: #7c3aed;
    background: #f1ebff;
}

.scheduler-card.inside .scheduler-card-icon {
    color: #0f766e;
    background: #e3f6f1;
}

.scheduler-card-icon svg {
    width: 22px;
    height: 22px;
}

.scheduler-card-head h2 {
    margin-bottom: .25rem;
    overflow-wrap: anywhere;
}

.scheduler-card-head span:not(.pill) {
    color: var(--muted);
    font-size: .86rem;
}

.scheduler-card-meta {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: .45rem .8rem;
    margin: 1rem 0;
    font-size: .88rem;
}

.scheduler-card-meta dt {
    color: var(--muted);
}

.scheduler-card-meta dd {
    margin: 0;
    overflow-wrap: anywhere;
}

.scheduler-card .actions {
    margin-top: auto;
}

.device-summary {
    display: grid;
    grid-template-columns: minmax(280px, 2fr) repeat(3, minmax(120px, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}

.device-summary .caption {
    display: block;
    color: var(--muted);
    font-size: 0.8rem;
    margin-bottom: 0.35rem;
}

.device-summary strong {
    overflow-wrap: anywhere;
}

.online {
    color: var(--success);
}

.offline {
    color: #b53f3f;
}

.hardware-error {
    color: #9b2f2f;
    background: #fbe8e7;
    border-radius: 8px;
    padding: 0.8rem;
}

.io-grid {
    display: grid;
    grid-template-columns: 0.86fr 1.4fr;
    gap: 1rem;
    margin-bottom: 1rem;
}

.muted-note, .warning-note {
    font-size: 0.86rem;
}

.warning-note {
    color: #854c18;
    background: #fff2df;
    border-radius: 8px;
    padding: 0.65rem;
}

.channels {
    display: grid;
    grid-template-columns: repeat(2, minmax(120px, 1fr));
    gap: 0.55rem;
}

.channel, .relay {
    border: 1px solid var(--line);
    border-radius: 9px;
    padding: 0.6rem;
}

.channel strong, .relay strong {
    font-size: 0.82rem;
    margin-right: 0.5rem;
}

.signal {
    display: inline-flex;
    border-radius: 14px;
    padding: 0.2rem 0.45rem;
    font-size: 0.75rem;
    font-weight: 600;
}

.closed, .on {
    color: #116749;
    background: #daf4ea;
}

.open, .off {
    color: #67736f;
    background: #ebefee;
}

.relays {
    display: grid;
    gap: 0.55rem;
}

.relay {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
}

.relay-actions {
    display: flex;
    gap: 0.35rem;
}

.mini {
    border: 1px solid var(--line);
    background: white;
    border-radius: 6px;
    font-size: 0.78rem;
    padding: 0.3rem 0.48rem;
    cursor: pointer;
}

.on-button {
    color: #116749;
}

.off-button {
    color: #8b3434;
}

.pulse-button {
    color: var(--brand);
}

.section-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: .75rem;
}

.section-head > * {
    min-width: 0;
}

.section-head span {
    color: var(--muted);
    font-size: 0.84rem;
    overflow-wrap: anywhere;
    text-align: right;
}

.settings-links {
    margin: 1rem 0;
}

.module-links, .log-level-options {
    display: flex;
    flex-wrap: wrap;
    gap: .6rem;
}

.library-log-settings {
    margin-bottom: 1rem;
}

.library-log-settings .check {
    background: #f4f7f5;
    border-radius: 8px;
    padding: .5rem .65rem;
}

.anpr-test {
    margin-bottom: 1rem;
}

.anpr-test > p {
    max-width: 860px;
    margin: .35rem 0 1rem;
    color: var(--muted);
    line-height: 1.55;
}

.anpr-upload-zone {
    position: relative;
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 1rem;
    min-height: 116px;
    padding: 1.25rem 1.4rem;
    overflow: hidden;
    border: 2px dashed #a9c8bf;
    border-radius: 14px;
    background: linear-gradient(135deg, #f8fbfa 0%, #f2f8f6 100%);
    color: var(--ink);
    cursor: pointer;
    transition: border-color .18s ease, background .18s ease, box-shadow .18s ease, transform .18s ease;
}

.anpr-upload-zone:hover,
.anpr-upload-zone:has(.anpr-upload-input:focus-visible) {
    border-color: var(--brand);
    background: #f0f8f5;
    box-shadow: 0 0 0 4px rgba(25, 111, 87, .1);
}

.anpr-upload-zone:active {
    transform: translateY(1px);
}

.anpr-upload-input {
    position: absolute;
    inset: 0;
    z-index: 2;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

.anpr-upload-icon {
    display: grid;
    place-items: center;
    width: 52px;
    height: 52px;
    border-radius: 14px;
    background: #dceee8;
    color: var(--brand);
}

.anpr-upload-icon svg {
    width: 27px;
    height: 27px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.anpr-upload-copy {
    display: grid;
    gap: .25rem;
}

.anpr-upload-copy strong {
    font-size: 1rem;
}

.anpr-upload-copy span,
.anpr-upload-meta {
    color: var(--muted);
    font-size: .86rem;
}

.anpr-upload-meta {
    padding: .45rem .65rem;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: rgba(255, 255, 255, .82);
    white-space: nowrap;
}

.selected-file {
    align-self: center;
    color: var(--muted);
    font-size: 0.9rem;
}

.anpr-test-grid {
    display: grid;
    grid-template-columns: minmax(280px, 1.25fr) minmax(260px, 0.9fr);
    gap: 1rem;
    margin-top: 1.2rem;
}

.anpr-diagnostics-grid {
    display: grid;
    grid-template-columns: minmax(320px, 1.35fr) minmax(280px, .75fr);
    gap: 1rem;
    margin-top: 1.2rem;
    align-items: start;
}

.anpr-preview .caption, .anpr-result .caption {
    display: block;
    color: var(--muted);
    font-size: 0.82rem;
    margin-bottom: 0.55rem;
}

.anpr-preview img {
    display: block;
    width: 100%;
    max-height: 430px;
    object-fit: contain;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #f4f7f5;
}

.anpr-overlay {
    display: block;
    width: 100%;
    max-height: 560px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #f4f7f5;
}

.anpr-overlay image {
    pointer-events: none;
}

.anpr-box {
    fill: rgba(220, 38, 38, .08);
    stroke: #dc2626;
    stroke-width: 4;
    vector-effect: non-scaling-stroke;
}

.anpr-box-best {
    fill: rgba(22, 163, 74, .12);
    stroke: #16a34a;
}

.anpr-result {
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 1rem;
}

.plate-value {
    display: block;
    font-size: 1.55rem;
    margin: 0.2rem 0 1rem;
}

.anpr-result dl {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0.55rem 0.8rem;
    margin: 0;
    font-size: 0.9rem;
}

.anpr-result dt {
    color: var(--muted);
}

.anpr-result dd {
    margin: 0;
}

.anpr-candidates {
    margin-bottom: 1rem;
}

.anpr-pipeline {
    margin-bottom: 1rem;
}

.anpr-visual-steps {
    margin-bottom: 1rem;
}

.anpr-step-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
    gap: 1rem;
}

.anpr-step-card {
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: .9rem;
}

.anpr-step-card-head {
    display: flex;
    justify-content: space-between;
    gap: .75rem;
    align-items: baseline;
    margin-bottom: .8rem;
}

.anpr-step-card-head span {
    color: var(--muted);
    font-size: .88rem;
    white-space: nowrap;
}

.anpr-step-images {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .75rem;
}

.anpr-step-images img,
.anpr-step-empty {
    width: 100%;
    height: 150px;
    object-fit: contain;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #f4f7f5;
}

.anpr-step-empty {
    display: grid;
    place-items: center;
    color: var(--muted);
    font-size: .85rem;
}

.anpr-step-card dl {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: .35rem .75rem;
    margin: .85rem 0 0;
    font-size: .85rem;
}

.anpr-step-card dt {
    color: var(--muted);
}

.anpr-step-card dd {
    margin: 0;
}

.anpr-stage-list {
    display: grid;
    gap: .65rem;
}

.anpr-stage {
    display: grid;
    grid-template-columns: minmax(180px, .8fr) minmax(160px, 1fr) auto;
    gap: .75rem;
    align-items: center;
    padding: .7rem .8rem;
    border: 1px solid var(--line);
    border-radius: 8px;
}

.anpr-stage strong {
    display: block;
}

.anpr-stage span {
    display: block;
    color: var(--muted);
    font-size: .82rem;
}

.anpr-stage b {
    font-size: .9rem;
    white-space: nowrap;
}

.anpr-stage-meter {
    height: 10px;
    overflow: hidden;
    border-radius: 999px;
    background: #e8eee9;
}

.anpr-stage-meter span {
    display: block;
    width: var(--bar);
    height: 100%;
    border-radius: inherit;
    background: #2563eb;
}

.anpr-candidates table {
    font-size: .86rem;
}

.anpr-candidates th,
.anpr-candidates td {
    white-space: nowrap;
}

.anpr-candidates .best-candidate {
    background: #eef8f0;
}

.camera-settings-grid {
    display: grid;
    grid-template-columns: minmax(340px, .9fr) minmax(380px, 1.1fr);
    gap: 1rem;
    margin-bottom: 1rem;
}

.camera-actions {
    margin-top: 1rem;
}

.camera-identity {
    padding: .65rem .8rem;
    margin-top: .75rem;
    border-radius: 9px;
    background: #f4f7f5;
}

.camera-identity .caption {
    display: block;
    color: var(--muted);
    font-size: .8rem;
    margin-bottom: .25rem;
}

.camera-preview-empty {
    min-height: 280px;
    display: grid;
    place-items: center;
    text-align: center;
    border: 1px dashed var(--line);
    border-radius: 10px;
    padding: 1.2rem;
}

.camera-preview img {
    display: block;
    width: 100%;
    max-height: 500px;
    object-fit: contain;
    border-radius: 10px;
    border: 1px solid var(--line);
    background: #f4f7f5;
}

.camera-metadata {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: .55rem .8rem;
    margin: 1rem 0 0;
    font-size: .9rem;
}

.camera-metadata dt {
    color: var(--muted);
}

.camera-metadata dd {
    margin: 0;
    overflow-wrap: anywhere;
}

.vk-log td {
    font-family: "Cascadia Mono", Consolas, monospace;
    font-size: 0.8rem;
}

.level-error {
    color: #b53f3f;
}

.level-information {
    color: var(--success);
}

.page-description {
    margin: .45rem 0 0;
}

.add-user-button {
    align-items: center;
    gap: .35rem;
    white-space: nowrap;
}

.user-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
    gap: 1rem;
}

.user-toolbar {
    display: flex;
    flex-direction: column;
    min-height: 66px;
    align-items: stretch;
    padding: .75rem;
    margin-bottom: 1rem;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--surface);
}

.user-filters,
.bulk-actions,
.user-list-meta,
.user-card-controls {
    display: flex;
    align-items: center;
    gap: .65rem;
}

.user-action-bar {
    max-height: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    overflow: hidden;
    opacity: 0;
    margin: 0;
    padding: 0 1rem;
    border: 1px solid transparent;
    border-radius: 10px;
    background: #f0f8f6;
    transition: max-height .25s ease, opacity .2s ease, margin .25s ease, padding .25s ease, border-color .25s ease;
}

.user-action-bar.visible {
    max-height: 82px;
    opacity: 1;
    margin-top: .9rem;
    padding: .75rem 1rem;
    border-color: #a8d5ca;
}

.user-action-bar > div {
    display: flex;
    align-items: center;
    gap: .65rem;
}

.user-action-icon {
    display: inline-grid;
    place-items: center;
    width: 27px;
    height: 27px;
    border-radius: 50%;
    background: #087965;
    color: white;
    font-size: .78rem;
    font-weight: 800;
}

.user-bulk {
    display: flex;
    align-items: center;
    gap: .55rem;
}

.user-filters label {
    margin: 0;
}

.search-field {
    position: relative;
    min-width: min(330px, 40vw);
}

.search-field input,
.role-filter select {
    margin: 0;
}

.search-field input {
    padding-left: 2.35rem;
}

.search-icon {
    position: absolute;
    z-index: 1;
    left: .85rem;
    top: 50%;
    color: var(--muted);
    font-size: 1.15rem;
    transform: translateY(-50%);
}

.role-filter select {
    min-width: 190px;
}

.bulk-actions strong {
    margin-right: .15rem;
    font-size: .85rem;
    white-space: nowrap;
}

.button.danger {
    color: #fff;
    background: #b33a3a;
}

.button.danger:hover {
    background: #952f2f;
}

.user-action-message {
    padding: .75rem .9rem;
    border: 1px solid #ecc4c4;
    border-radius: 9px;
    background: #fff2f2;
}

.user-list-meta {
    justify-content: space-between;
    margin: 0 0 .75rem;
    color: var(--muted);
    font-size: .84rem;
}

.select-all {
    display: flex;
    align-items: center;
    gap: .5rem;
    margin: 0;
}

.select-all input,
.card-selector input {
    width: 18px;
    height: 18px;
    margin: 0;
    accent-color: var(--brand);
}

.user-card {
    display: flex;
    min-height: 250px;
    flex-direction: column;
    overflow: hidden;
    color: var(--ink);
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease;
}

.user-card.is-selected {
    border-color: var(--brand);
    box-shadow: 0 0 0 2px rgba(10, 103, 83, .12);
}

.user-card:hover {
    transform: translateY(-2px);
    border-color: #9bcbbf;
    box-shadow: 0 10px 24px rgba(21, 32, 29, .08);
}

.user-card-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 1.25rem 1.25rem .5rem;
}

.user-avatar {
    display: grid;
    width: 54px;
    height: 54px;
    place-items: center;
    border-radius: 16px;
    color: #fff;
    background: linear-gradient(145deg, var(--brand), #159479);
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: .04em;
}

.user-avatar.large {
    width: 64px;
    height: 64px;
    flex: 0 0 auto;
    border-radius: 18px;
    font-size: 1.35rem;
}

.user-state {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    border-radius: 999px;
    padding: .35rem .55rem;
    font-size: .76rem;
    font-weight: 600;
}

.user-state.active {
    color: var(--success);
    background: #e4f6ef;
}

.user-state.inactive {
    color: #6b7471;
    background: #edf0ef;
}

.state-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: currentColor;
}

.user-card-body {
    flex: 1;
    padding: .5rem 1.25rem 1.1rem;
}

.user-card-body h2 {
    margin: .25rem 0 .65rem;
    overflow-wrap: anywhere;
    font-size: 1.2rem;
}

.user-card-body p {
    margin: .8rem 0 0;
    font-size: .82rem;
}

.role-badge {
    display: inline-flex;
    padding: .35rem .55rem;
    border-radius: 7px;
    color: var(--brand);
    background: #eef8f5;
    font-size: .78rem;
    font-weight: 600;
}

.user-card-footer {
    display: flex;
    justify-content: space-between;
    padding: .85rem 1.25rem;
    color: var(--brand);
    background: #f8fbf9;
    border-top: 1px solid var(--line);
    font-size: .88rem;
    font-weight: 600;
}

.user-card-footer:hover {
    background: #eef8f5;
}

.add-new-user-card {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    min-height: 250px;
    background: transparent;
    border: 2px dashed #b1cbe2;
    border-radius: var(--radius);
    text-decoration: none;
    color: #7b95b0;
    transition: transform .18s ease, border-color .18s ease, background-color .18s ease;
    cursor: pointer;
}

.add-new-user-card:hover {
    border-color: #8faecc;
    background: #f8fbfb;
    color: #65819d;
    transform: translateY(-2px);
}

.add-new-user-icon {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 48px;
    height: 48px;
    border: 1px solid currentColor;
    border-radius: 50%;
    font-size: 1.5rem;
    font-weight: 400;
    margin-bottom: 1rem;
}

.add-new-user-text {
    font-weight: 600;
    font-size: 1rem;
}

.card-selector {
    display: grid;
    margin: 0;
    cursor: pointer;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    clip-path: inset(50%);
}

.user-search-empty {
    margin-top: 1rem;
}

.user-form-panel {
    width: 100%;
    max-width: none;
    min-width: 0;
}

.user-form-intro {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding-bottom: 1.2rem;
    margin-bottom: .5rem;
    border-bottom: 1px solid var(--line);
}

.user-form-intro h2,
.user-form-intro p {
    margin: 0;
}

.user-form-intro p {
    margin-top: .25rem;
}

.user-form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0 1rem;
}

.user-form-grid .full-width {
    grid-column: 1 / -1;
}

.field-hint {
    display: block;
    margin-top: .4rem;
    color: var(--muted);
    font-size: .78rem;
}

.user-active-toggle {
    display: flex;
    align-items: flex-start;
    gap: .75rem;
    margin: 1.25rem 0;
    padding: .9rem;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #f8fbf9;
}

.user-active-toggle input {
    width: auto;
    margin: .2rem 0 0;
}

.user-active-toggle strong,
.user-active-toggle small {
    display: block;
}

.user-active-toggle small {
    margin-top: .2rem;
    color: var(--muted);
}

.user-form-actions {
    display: flex;
    justify-content: flex-end;
    gap: .65rem;
    padding-top: 1.1rem;
    border-top: 1px solid var(--line);
}

.form-error,
.validation-message {
    color: #a33333;
    font-size: .84rem;
}

@media (max-width: 900px) {
    .metrics, .dashboard-grid, .report-grid, .device-summary, .io-grid, .anpr-test-grid, .anpr-diagnostics-grid, .camera-settings-grid, .device-scenario-grid, .scenario-editor-grid {
        grid-template-columns: 1fr;
    }

    .scenario-step-head {
        flex-direction: column;
    }

    .device-two-columns {
        grid-template-columns: 1fr;
    }

    .anpr-stage {
        grid-template-columns: 1fr;
    }

    .anpr-step-images {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 600px) {
    .anpr-upload-zone {
        grid-template-columns: auto 1fr;
        padding: 1rem;
    }

    .anpr-upload-meta {
        grid-column: 1 / -1;
        justify-self: start;
        margin-left: 68px;
    }

    .page-heading,
    .user-edit-heading {
        align-items: stretch;
        flex-direction: column;
    }

    .add-user-button {
        justify-content: center;
    }

    .user-grid,
    .user-form-grid {
        grid-template-columns: 1fr;
    }

    .user-form-actions {
        flex-direction: column-reverse;
    }

    .user-form-actions .button {
        justify-content: center;
    }

    .user-toolbar,
    .user-filters,
    .bulk-actions {
        align-items: stretch;
        flex-direction: column;
    }

    .search-field,
    .role-filter select {
        width: 100%;
        min-width: 0;
    }

    .bulk-actions .button {
        justify-content: center;
    }
}

/* Event automation graph: global form styles must not stretch checkboxes. */
.event-graph-shell .event-palette .choice,
.event-graph-shell .event-palette .palette-choice {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 9px 0;
    font-size: 11px;
    line-height: 1.35;
    white-space: normal;
}

.event-graph-shell input[type="checkbox"] {
    width: 16px;
    height: 16px;
    flex: 0 0 16px;
    margin: 0;
    padding: 0;
    accent-color: #0d6efd;
}
