/* ======================================================
   RISOLNET PORTAL - CUBIS STYLE 2.0
   Light industrial admin UI + TicketGen
====================================================== */

[hidden] {
    display: none !important;
}

:root {
    --bg: #f5f5f2;
    --panel: #ffffff;
    --text: #171717;
    --muted: #6b6b6b;
    --line: #deded8;
    --yellow: #ffed00;
    --dark: #111111;
    --ok: #087f5b;
    --warn: #b05c00;
    --bad: #b00020;
    --shadow: 0 18px 45px rgba(0,0,0,.08);
    --shadow-strong: 0 28px 90px rgba(0,0,0,.22);
    --accent-soft: rgba(255,237,0,.28);
    --radius: 8px;
    --radius-sm: 6px;
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    min-height: 100%;
}

body {
    font-family: Arial, Helvetica, sans-serif;
    background:
        radial-gradient(circle at top left, rgba(255,237,0,.35), transparent 34rem),
        var(--bg);
    color: var(--text);
    font-size: 15px;
    line-height: 1.55;
}

.crt-on {
    background:
        radial-gradient(circle at top left, rgba(255,237,0,.35), transparent 34rem),
        var(--bg);
}

body.amber {
    --bg: #070b08;
    --panel: #101611;
    --text: #55ff55;
    --muted: #29bd48;
    --line: #216f32;
    --yellow: #55ff55;
    --dark: #003b12;
    --ok: #55ff55;
    --warn: #ffff55;
    --bad: #ff5555;
    --shadow: 0 0 0 1px rgba(85,255,85,.08), 0 18px 45px rgba(0,0,0,.44);
    --shadow-strong: 0 0 0 1px rgba(85,255,85,.16), 0 28px 90px rgba(0,0,0,.72);
    --accent-soft: rgba(85,255,85,.16);
    background:
        radial-gradient(circle at top left, rgba(0,170,0,.12), transparent 34rem),
        var(--bg);
    color-scheme: dark;
    font-family: "Courier New", Courier, monospace;
    text-shadow: 0 0 5px rgba(85,255,85,.16);
}

body.crt-on::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: 9999;
    pointer-events: none;
    background:
        linear-gradient(rgba(255,255,255,.05) 50%, rgba(0,0,0,.035) 50%);
    background-size: 100% 4px;
    mix-blend-mode: multiply;
    opacity: .45;
}

body.amber.crt-on::before {
    background:
        linear-gradient(rgba(85,255,85,.035) 50%, rgba(0,0,0,.15) 50%);
    background-size: 100% 4px;
    mix-blend-mode: screen;
    opacity: .62;
}

.crt-screen {
    width: min(1180px, calc(100% - 32px));
    margin: 32px auto;
    padding: 0;
    border: 0;
    box-shadow: none;
    background: transparent;
}

.container {
    background: rgba(255,255,255,.9);
    border: 1px solid rgba(0,0,0,.06);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 28px;
    backdrop-filter: blur(10px);
}

body.crt-on .container,
body.crt-on .crt-header {
    border-color: rgba(17,17,17,.1);
    box-shadow: 0 18px 45px rgba(0,0,0,.08), inset 0 1px 0 rgba(255,255,255,.78);
}

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

h1 {
    font-size: clamp(38px, 5vw, 64px);
    line-height: 1;
    margin-bottom: 8px;
    letter-spacing: 0;
}

h2 {
    font-size: 24px;
    margin: 28px 0 16px;
    letter-spacing: 0;
}

h3 {
    font-size: 18px;
    margin-bottom: 12px;
}

.blink {
    color: var(--yellow);
    animation: blink 1s steps(2, start) infinite;
}

@keyframes blink {
    to { visibility: hidden; }
}

hr {
    border: 0;
    border-top: 1px solid var(--line);
    margin: 24px 0;
}

a {
    color: var(--text);
    font-weight: 700;
    text-decoration: none;
}

a:hover {
    color: #000;
    text-decoration: underline;
}

/* ================= HEADER / PAGE CHROME ================= */

.crt-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 16px;
    padding: 12px;
    border: 1px solid rgba(0,0,0,.08);
    border-radius: var(--radius);
    background: rgba(255,255,255,.92);
    box-shadow: 0 10px 30px rgba(0,0,0,.06);
    position: sticky;
    top: 12px;
    z-index: 20;
    backdrop-filter: blur(12px);
}

.header-brand {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
    color: var(--text);
}

.header-brand:hover {
    text-decoration: none;
}

.header-logo {
    width: 42px;
    height: 42px;
    object-fit: contain;
    flex: 0 0 auto;
    filter: drop-shadow(0 6px 10px rgba(0,0,0,.14));
}

.header-title {
    display: block;
    font-size: 18px;
    font-weight: 900;
    letter-spacing: 0;
}

.header-brand-copy {
    display: grid;
    gap: 1px;
}

.header-version,
.login-version {
    color: var(--muted);
    font-size: 10px;
    font-weight: 900;
    letter-spacing: 0;
}

.login-version {
    display: block;
    margin: -18px 0 22px;
}

.header-actions,
.page-actions,
.form-actions,
.row-actions,
.card-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.header-actions {
    justify-content: flex-end;
}

.page-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 18px;
    padding-bottom: 18px;
    border-bottom: 1px solid var(--line);
}

.page-subtitle {
    margin: 0;
    color: var(--muted);
    font-weight: 700;
}

.page-actions {
    justify-content: flex-end;
    padding-top: 4px;
}

.form-actions {
    margin-top: 18px;
    padding-top: 16px;
    border-top: 1px solid var(--line);
}

.row-actions {
    justify-content: flex-start;
    min-width: max-content;
}

.card-actions {
    justify-content: center;
    margin-top: 14px;
}

/* ================= MENU / ACTIONS ================= */

.menu,
.quick-actions,
.actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.quick-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
}

.menu a,
.quick-actions a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 12px 18px;
    border-radius: var(--radius-sm);
    border: 1px solid rgba(17,24,39,.16);
    background: #fff;
    color: #111827;
    font-weight: 800;
    box-shadow: 0 8px 18px rgba(17,24,39,.06);
    text-decoration: none;
    position: relative;
    isolation: isolate;
    overflow: hidden;
}

.menu a:hover,
.quick-actions a:hover {
    border-color: var(--yellow);
    box-shadow: 0 0 0 4px var(--accent-soft);
    text-decoration: none;
    transform: translateY(-1px);
}

.quick-actions a::before {
    content: "";
    position: absolute;
    inset: 0 auto 0 0;
    width: 5px;
    background: var(--yellow);
    z-index: -1;
}

.quick-actions a:hover::before {
    width: 100%;
    opacity: .2;
}

/* ================= FORMS ================= */

form {
    margin: 0;
}

.inline-form {
    display: inline;
}

label {
    display: block;
    margin: 16px 0 7px;
    font-size: 13px;
    font-weight: 800;
    color: #333;
}

input,
textarea,
select {
    width: 100%;
    min-height: 48px;
    border: 1px solid var(--line);
    background: #fff;
    border-radius: var(--radius-sm);
    padding: 13px 14px;
    font: inherit;
    color: var(--text);
}

textarea {
    min-height: 120px;
    resize: vertical;
}

input:focus,
textarea:focus,
select:focus {
    outline: 2px solid var(--yellow);
    outline-offset: 2px;
}

select {
    appearance: none;
    padding-right: 42px;
    background-image:
        linear-gradient(45deg, transparent 50%, #333 50%),
        linear-gradient(135deg, #333 50%, transparent 50%);
    background-position:
        calc(100% - 20px) 20px,
        calc(100% - 14px) 20px;
    background-size: 6px 6px;
    background-repeat: no-repeat;
}

input[readonly] {
    background: #f8fafc;
    color: #444;
}

input[type="checkbox"] {
    width: auto;
    min-height: auto;
}

/* ================= BUTTONS ================= */

button,
.btn {
    border: 0;
    background: var(--dark);
    color: #fff;
    font-weight: 800;
    border-radius: var(--radius-sm);
    padding: 13px 18px;
    min-height: 46px;
    cursor: pointer;
    transition: transform .15s ease, opacity .15s ease, box-shadow .15s ease, border-color .15s ease, background .15s ease;
    font: inherit;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

button:hover:not(:disabled),
.btn:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 10px 24px rgba(0,0,0,.16);
}

button:disabled,
.btn:disabled {
    opacity: .45;
    cursor: not-allowed;
}

button.secondary,
.btn-secondary,
.btn-muted,
button.btn-secondary,
button.btn-muted {
    background: #efefea;
    color: #222;
}

button.danger,
.btn-danger {
    background: #fff0f2;
    color: var(--bad);
}

.btn-ghost,
button.btn-ghost {
    background: #fff;
    color: #111827;
    border: 1px solid rgba(17,24,39,.16);
    box-shadow: 0 6px 16px rgba(17,24,39,.05);
}

.btn-toggle {
    padding-right: 11px;
}

.btn-toggle::after {
    content: attr(data-state);
    min-width: 34px;
    padding: 3px 7px;
    border-radius: var(--radius-sm);
    background: #f0f0ea;
    color: #555;
    font-size: 10px;
    font-weight: 900;
}

.btn-toggle.is-active {
    border-color: var(--yellow);
    box-shadow: 0 0 0 4px var(--accent-soft);
}

.btn-toggle.is-active::after {
    background: var(--yellow);
    color: #111;
}

.btn-small,
button.btn-small {
    min-height: 34px;
    padding: 8px 10px;
    font-size: 13px;
}

/* ================= TABLES ================= */

table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin-top: 20px;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #fff;
}

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

th {
    background: #fffbe0;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0;
    color: #444;
}

body.amber th {
    background: #fff3cf;
}

tr:last-child td {
    border-bottom: 0;
}

/* ================= GRID / CARDS ================= */

.grid {
    display: grid;
    grid-template-columns: 420px 1fr;
    gap: 24px;
    align-items: start;
}

.dashboard-top {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 20px;
}

.dashboard-grid,
.item-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 18px;
    margin-top: 20px;
}

.card,
.item-card,
.component-box {
    background: #fff;
    border: 1px solid rgba(0,0,0,.06);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 22px;
    transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}

.card:hover,
.item-card:hover,
.component-box:hover {
    transform: translateY(-1px);
    border-color: rgba(17,17,17,.12);
    box-shadow: 0 20px 50px rgba(0,0,0,.10);
}

.card h3 {
    color: var(--muted);
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0;
}

.big {
    font-size: 38px;
    font-weight: 900;
    line-height: 1;
}

/* ================= MCA/CUB MONITOR ================= */

.mca-monitor-status {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    margin: 24px 0 18px;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #fff;
}

.mca-monitor-status > div {
    min-height: 104px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 8px;
    padding: 18px 22px;
    border-right: 1px solid var(--line);
}

.mca-monitor-status > div:last-child {
    border-right: 0;
}

.mca-monitor-status span {
    color: var(--muted);
    font-size: 12px;
    font-weight: 900;
}

.mca-monitor-status strong {
    font-size: 30px;
    line-height: 1;
}

.mca-monitor-status .mca-online { color: var(--ok); }
.mca-monitor-status .mca-has-offline { color: var(--bad); }

.mca-monitor-table-wrap {
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #fff;
}

.mca-monitor-table { table-layout: fixed; }
.mca-monitor-table th:nth-child(1) { width: 27%; }
.mca-monitor-table th:nth-child(2) { width: 12%; }
.mca-monitor-table th:nth-child(3) { width: 21%; }
.mca-monitor-table th:nth-child(4) { width: 12%; }
.mca-monitor-table th:nth-child(5) { width: 14%; }
.mca-monitor-table th:nth-child(6) { width: 14%; }

.mca-monitor-table td strong,
.mca-monitor-table td small { display: block; }

.mca-monitor-table td small {
    margin-top: 3px;
    color: var(--muted);
    font-size: 11px;
}

.mca-monitor-weight {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.mca-monitor-weight strong {
    display: inline;
    font-size: 24px;
}

.mca-monitor-weight small {
    display: inline;
    margin-left: 7px;
    font-size: 13px;
    font-weight: 800;
}

.mca-monitor-empty {
    height: 120px;
    color: var(--muted);
    text-align: center;
}

/* ================= ITEMS / IMAGES ================= */

.item-card {
    text-align: center;
}

.item-card img,
.thumb {
    width: 100%;
    max-width: 180px;
    height: 160px;
    object-fit: cover;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #f7f7f3;
    cursor: pointer;
    margin-bottom: 12px;
}

.image-placeholder {
    width: 100%;
    height: 160px;
    display: grid;
    place-items: center;
    border: 1px dashed var(--line);
    border-radius: var(--radius);
    background: #f7f7f3;
    color: var(--muted);
    font-weight: 800;
    margin-bottom: 12px;
}

.entity-list {
    display: grid;
    gap: 10px;
    list-style: none;
    margin: 0;
    padding: 0;
}

.entity-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #fff;
}

.crt-row {
    margin-bottom: 14px;
}

.code-output {
    min-height: 170px;
    max-height: 420px;
}

.is-hidden {
    display: none !important;
}

.output-panel {
    margin-top: 16px;
}

.entity-main {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.entity-main .thumb {
    width: 58px;
    height: 58px;
    margin: 0;
    flex: 0 0 auto;
}

.item-card strong {
    display: block;
    margin-bottom: 6px;
}

/* ================= MODALS ================= */

.crt-modal {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.54);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 999;
    padding: 22px;
}

.crt-modal.is-open {
    display: flex;
}

.crt-modal-box {
    width: min(950px, 100%);
    max-height: 92vh;
    overflow: auto;
    background: #fff;
    color: var(--text);
    border: 0;
    border-radius: var(--radius);
    padding: 26px;
    box-shadow: var(--shadow-strong);
}

#imageModal {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.82);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    padding: 24px;
}

#imageModal.is-open {
    display: flex;
}

#imageModal img {
    max-width: 92%;
    max-height: 90vh;
    border-radius: var(--radius);
    box-shadow: 0 28px 90px rgba(0,0,0,.45);
    background: #fff;
}

/* ================= PRE / RESPONSE ================= */

pre {
    background: #f8fafc;
    border: 1px solid var(--line);
    color: #111;
    border-radius: var(--radius);
    padding: 15px;
    max-height: 380px;
    overflow: auto;
    white-space: pre-wrap;
    word-break: break-word;
}

#mcaResponse,
#deployResult {
    margin-top: 15px;
    border: 1px solid var(--line);
    background: #f8fafc;
    border-radius: var(--radius);
    padding: 15px;
    min-height: 60px;
}

/* ================= STATUS / BADGES ================= */

.badge,
.badge-success,
.badge-failed,
.badge-delete {
    display: inline-flex;
    align-items: center;
    padding: 5px 9px;
    border-radius: var(--radius-sm);
    font-weight: 900;
    font-size: 12px;
}

.badge-success {
    background: #e6f6ef;
    color: var(--ok);
}

.badge-failed {
    background: #fff0f2;
    color: var(--bad);
}

.badge-delete {
    background: #fff3dc;
    color: var(--warn);
}

.error {
    background: #fff0f2;
    border: 1px solid #f0a7b2;
    color: var(--bad);
    border-radius: var(--radius);
    padding: 14px;
    margin-bottom: 16px;
}

.notice {
    background: #fff8d0;
    border: 1px solid #e7d56e;
    color: #534300;
    border-radius: var(--radius);
    padding: 14px;
    margin-bottom: 16px;
}

.notice-success {
    background: #e6f6ef;
    border: 1px solid #8ed7bc;
    color: var(--ok);
    border-radius: var(--radius);
    padding: 14px;
    margin-bottom: 16px;
    font-weight: 800;
}

/* ================= MCA DEVICE DISCOVERY ================= */

.mca-scan-panel {
    overflow: hidden;
    margin-bottom: 22px;
    border: 1px solid var(--line);
    border-top: 4px solid var(--yellow);
    border-radius: var(--radius);
    background: var(--panel);
    box-shadow: var(--shadow);
}

.mca-scan-heading,
.mca-scan-controls {
    display: grid;
    grid-template-columns: minmax(260px, 1.25fr) minmax(190px, .7fr) minmax(220px, .9fr) 150px;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 18px 20px;
}

.mca-scan-heading {
    border-bottom: 1px solid var(--line);
}

.mca-scan-heading h2,
.mca-scan-heading p {
    margin: 0;
}

.mca-scan-heading p {
    margin-top: 3px;
    color: var(--muted);
    font-weight: 700;
}

.scan-protocol {
    color: var(--muted);
    font-size: 12px;
    font-weight: 900;
    white-space: nowrap;
}

.mca-scan-controls label {
    margin: 0;
}

.mca-scan-controls .label-note {
    color: var(--muted);
    font-size: 11px;
    text-transform: lowercase;
}

.mca-scan-controls .btn {
    flex: 0 0 150px;
    min-height: 48px;
    border: 1px solid #d4c300;
    background: var(--yellow);
    color: #111;
}

.mca-scan-status {
    margin: 0;
    padding: 12px 20px;
    border-top: 1px solid var(--line);
    color: var(--muted);
    font-weight: 800;
}

.mca-scan-status.is-running {
    color: var(--warn);
}

.mca-scan-status.is-complete {
    color: var(--ok);
}

.mca-scan-status.is-error {
    color: var(--bad);
}

.mca-scan-results {
    overflow-x: auto;
    border-top: 1px solid var(--line);
}

.mca-scan-results table {
    margin: 0;
    border: 0;
    border-radius: 0;
}

.mca-scan-results td strong,
.mca-scan-results td small {
    display: block;
}

.mca-scan-results td small {
    color: var(--muted);
    font-weight: 800;
}

.scan-result-action {
    text-align: right;
}

.scan-diagnostic-row td {
    color: var(--bad);
    font-weight: 800;
}

.scan-diagnostic-row .scan-diagnostic-message {
    min-width: 280px;
}

.scan-empty {
    padding: 24px !important;
    color: var(--muted);
    text-align: center;
    font-weight: 800;
}

.device-edit-modal .crt-modal-box {
    width: min(720px, 100%);
}

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

.device-edit-grid .device-location-field,
.device-edit-grid .device-enabled-field {
    grid-column: 1 / -1;
}

.device-enabled-field {
    display: flex;
    align-items: center;
    gap: 9px;
}

.device-enabled-field input {
    width: auto;
    min-height: auto;
}

.item-editor-modal .crt-modal-box {
    width: min(760px, 100%);
}

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

.item-editor-wide {
    grid-column: 1 / -1;
}

/* ================= JOBS CREATOR ================= */

.jobs-creator-page h1 {
    font-size: 38px;
}

.jobs-creator-page .page-heading {
    margin-bottom: 8px;
    padding-bottom: 12px;
}

.jobs-creator-page .container {
    padding-top: 22px;
}

.jobs-creator-page input,
.jobs-creator-page textarea,
.jobs-creator-page select {
    min-height: 42px;
    padding-top: 9px;
    padding-bottom: 9px;
}

.job-section {
    padding: 14px 0 16px;
    border-bottom: 1px solid var(--line);
}

.job-section-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 10px;
}

.job-section-heading h2 {
    display: flex;
    align-items: center;
    gap: 9px;
    margin: 0;
    font-size: 18px;
    text-transform: uppercase;
}

.job-section-heading-accent {
    min-height: 48px;
    padding: 7px 10px 7px 14px;
    background: var(--yellow);
    color: #111;
    border-radius: var(--radius-sm);
}

.count-badge {
    display: inline-grid;
    place-items: center;
    min-width: 25px;
    height: 25px;
    padding: 0 7px;
    border-radius: var(--radius-sm);
    background: #111;
    color: #fff;
    font-size: 12px;
}

.job-main-grid {
    display: grid;
    grid-template-columns: minmax(170px, 1.2fr) minmax(220px, 2fr) minmax(110px, .7fr) minmax(170px, 1.2fr) auto;
    gap: 12px;
    align-items: end;
}

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

.field-group {
    min-width: 0;
}

.field-group label {
    margin: 0 0 6px;
}

.job-checkbox-field {
    min-height: 42px;
    margin: 0;
    padding: 0 14px;
    display: inline-flex;
    align-items: center;
    gap: 9px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: #f8fafc;
    color: var(--text);
    cursor: pointer;
}

.job-checkbox-field input {
    width: 18px;
    height: 18px;
    margin: 0;
    accent-color: var(--dark);
}

.components-list {
    display: grid;
    gap: 12px;
}

.jobs-creator-page .component-box {
    padding: 12px 14px;
    box-shadow: none;
}

.component-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 9px;
    padding-bottom: 7px;
    border-bottom: 1px solid var(--line);
}

.component-heading h3 {
    margin: 0;
    color: var(--text);
}

.remove-component,
button.remove-component {
    width: 34px;
    min-height: 34px;
    padding: 0;
    flex: 0 0 34px;
    background: #fff0f2;
    color: var(--bad);
    border: 1px solid #f0a7b2;
    font-size: 22px;
    line-height: 1;
}

.component-fields-grid {
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    gap: 10px;
    align-items: end;
}

.component-name-field {
    grid-column: span 3;
}

.component-description-field {
    grid-column: span 6;
}

.component-lot-field {
    grid-column: span 3;
}

.component-instruction-field {
    grid-column: span 5;
}

.component-target-field,
.component-decimals-field {
    grid-column: span 2;
}

.component-unit-field {
    grid-column: span 3;
}

.component-options-row {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px 18px;
    min-height: 34px;
    padding: 5px 0 0;
}

.component-option {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    color: var(--text);
    cursor: pointer;
}

.component-option input {
    width: 18px;
    height: 18px;
    margin: 0;
    accent-color: var(--dark);
}

.tolerance-fields {
    grid-column: span 6;
    display: grid;
    grid-template-columns: auto minmax(100px, 1fr) minmax(100px, 1fr);
    align-items: end;
    gap: 10px;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: #f8fafc;
}

.tolerance-fields > strong {
    align-self: center;
    font-size: 12px;
    text-transform: uppercase;
}

.jobs-command-bar {
    position: static;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: end;
    gap: 14px;
    margin: 0 -10px;
    padding: 10px;
    background: rgba(255,255,255,.94);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: 0 12px 30px rgba(0,0,0,.14);
    backdrop-filter: blur(10px);
}

.jobs-command-bar .job-deploy-grid {
    grid-template-columns: minmax(190px, 1fr) minmax(190px, 1fr);
}

.jobs-primary-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    padding-bottom: 1px;
}

.jobs-output-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    margin-top: 18px;
}

.jobs-technical-panel {
    min-width: 0;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: #fff;
}

.jobs-technical-panel summary {
    padding: 12px 14px;
    color: var(--text);
    font-weight: 900;
    cursor: pointer;
}

.jobs-technical-panel[open] {
    grid-column: 1 / -1;
}

.jobs-technical-panel pre {
    margin: 0 12px 12px;
}

.jobs-technical-panel .form-actions {
    margin: 0 12px 12px;
    padding-top: 0;
    border-top: 0;
}

/* ================= IBM GREEN MONITOR THEME ================= */

body.amber .container,
body.amber .crt-header,
body.amber .card,
body.amber .item-card,
body.amber .component-box,
body.amber .entity-row,
body.amber .crt-modal-box {
    background: rgba(12,19,14,.96);
    border-color: var(--line);
    box-shadow: var(--shadow);
    backdrop-filter: none;
}

body.amber.crt-on .container,
body.amber.crt-on .crt-header {
    border-color: var(--line);
    box-shadow: var(--shadow), inset 0 0 24px rgba(0,170,0,.035);
}

body.amber .crt-header {
    border-bottom-width: 3px;
}

body.amber .header-logo {
    filter: grayscale(1) sepia(1) hue-rotate(70deg) saturate(7) brightness(1.2) drop-shadow(0 0 7px rgba(85,255,85,.35));
}

body.amber a,
body.amber label,
body.amber .header-brand,
body.amber .header-title {
    color: var(--text);
}

body.amber a:hover {
    color: #aaffaa;
    text-shadow: 0 0 8px rgba(85,255,85,.55);
}

body.amber .page-heading {
    border-bottom-style: dashed;
}

body.amber .menu a,
body.amber .quick-actions a,
body.amber .btn-ghost,
body.amber button.btn-ghost {
    background: #0b140d;
    color: var(--text);
    border-color: var(--line);
    box-shadow: inset 0 0 12px rgba(0,170,0,.035);
}

body.amber .menu a:hover,
body.amber .quick-actions a:hover,
body.amber .btn-ghost:hover,
body.amber button.btn-ghost:hover {
    background: #102817;
    border-color: var(--text);
}

body.amber .quick-actions a::before {
    background: #00aa00;
}

body.amber input,
body.amber textarea,
body.amber select {
    background-color: #050906;
    border-color: var(--line);
    color: var(--text);
    caret-color: var(--text);
    box-shadow: inset 0 0 12px rgba(0,0,0,.55);
}

body.amber input::placeholder,
body.amber textarea::placeholder {
    color: #238e3b;
    opacity: 1;
}

body.amber select {
    background-image:
        linear-gradient(45deg, transparent 50%, #55ff55 50%),
        linear-gradient(135deg, #55ff55 50%, transparent 50%);
}

body.amber input[readonly] {
    background: #101812;
    color: var(--muted);
}

body.amber button,
body.amber .btn {
    background: #006b1f;
    color: #e8ffe8;
    border: 1px solid #35d653;
    box-shadow: inset 0 0 12px rgba(0,0,0,.28);
    text-shadow: 0 0 5px rgba(85,255,85,.35);
}

body.amber button:hover:not(:disabled),
body.amber .btn:hover:not(:disabled) {
    background: #008f2a;
    border-color: #aaffaa;
    box-shadow: 0 0 14px rgba(85,255,85,.25), inset 0 0 12px rgba(0,0,0,.2);
}

body.amber .btn-ghost,
body.amber button.btn-ghost {
    background: #0b140d;
    color: var(--text);
    border-color: var(--line);
}

body.amber .btn-ghost:hover,
body.amber button.btn-ghost:hover {
    background: #102817;
    border-color: var(--text);
}

body.amber button.secondary,
body.amber .btn-secondary,
body.amber .btn-muted,
body.amber button.btn-secondary,
body.amber button.btn-muted {
    background: #172019;
    color: var(--text);
    border-color: var(--line);
}

body.amber button.danger,
body.amber .btn-danger {
    background: #2b0b0b;
    color: #ff7777;
    border-color: #aa3333;
}

body.amber .btn-toggle::after {
    background: #172019;
    color: var(--muted);
    border: 1px solid #255d31;
}

body.amber .btn-toggle.is-active::after {
    background: var(--text);
    color: #031006;
    border-color: var(--text);
    text-shadow: none;
}

body.amber table {
    background: #080d09;
    border-color: var(--line);
}

body.amber th {
    background: #102817;
    color: #aaffaa;
}

body.amber th,
body.amber td {
    border-bottom-color: var(--line);
}

body.amber tr:hover td {
    background: rgba(0,170,0,.075);
}

body.amber .item-card img,
body.amber .thumb,
body.amber .image-placeholder {
    background: #050906;
    border-color: var(--line);
}

body.amber pre,
body.amber #mcaResponse,
body.amber #deployResult {
    background: #020503;
    color: var(--text);
    border-color: var(--line);
    text-shadow: 0 0 5px rgba(85,255,85,.22);
}

body.amber .badge-success {
    background: #0b3215;
    color: #55ff55;
}

body.amber .badge-failed,
body.amber .error {
    background: #2b0b0b;
    color: #ff7777;
    border-color: #aa3333;
}

body.amber .badge-delete,
body.amber .notice {
    background: #292600;
    color: #ffff77;
    border-color: #99912c;
}

body.amber .notice-success {
    background: #0b3215;
    color: #55ff55;
    border-color: #35d653;
}

body.amber .crt-modal,
body.amber #imageModal {
    background: rgba(0,4,1,.88);
}

body.amber #previewReceipt {
    text-shadow: none;
}

body.amber .job-section-heading-accent {
    background: #10341a;
    color: #aaffaa;
    border: 1px solid var(--line);
}

body.amber .count-badge {
    background: var(--text);
    color: #031006;
    text-shadow: none;
}

body.amber .job-checkbox-field,
body.amber .jobs-technical-panel {
    background: #080d09;
    border-color: var(--line);
}

body.amber .job-checkbox-field input {
    accent-color: var(--text);
}

body.amber .component-option input {
    accent-color: var(--text);
}

body.amber .tolerance-fields {
    background: #050906;
    border-color: var(--line);
}

body.amber .jobs-command-bar {
    background: rgba(8,13,9,.96);
    border-color: var(--line);
    box-shadow: 0 0 0 1px rgba(85,255,85,.08), 0 12px 30px rgba(0,0,0,.5);
}

body.amber .remove-component,
body.amber button.remove-component {
    background: #2b0b0b;
    color: #ff7777;
    border-color: #aa3333;
}

/* ================= LOGIN SCREEN ================= */

.login-wrapper,
.login-screen {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 32px;
    background:
        radial-gradient(circle at top left, rgba(255,237,0,.35), transparent 34rem),
        var(--bg);
}

.login-box,
.login-card {
    width: min(440px, 100%);
    background: #fff;
    border: 1px solid rgba(0,0,0,.08);
    border-radius: var(--radius);
    padding: 32px;
    box-shadow: 0 24px 70px rgba(0,0,0,.12);
    text-align: center;
}

.logo {
    font-size: 38px;
    letter-spacing: 0;
    font-weight: 900;
    margin-bottom: 6px;
}

.logo-sub {
    font-size: 12px;
    letter-spacing: 0;
    color: var(--muted);
    font-weight: 800;
    margin-bottom: 26px;
}

.login-box input,
.login-card input {
    text-align: center;
}

.login-box button,
.login-card button {
    width: 100%;
    margin-top: 18px;
}

/* ======================================================
   TICKETGEN
====================================================== */

#previewReceipt {
    width: 210mm;
    min-height: 297mm;
    background: #fff;
    margin: 12px auto 0;
    padding: 14mm;
    box-shadow: 0 18px 45px rgba(0,0,0,.10);
    box-sizing: border-box;
    font-family: "Arial Narrow", Arial, Helvetica, sans-serif;
    font-size: 12px;
    line-height: 1.12;
    color: #111;
    border-radius: 0;
    overflow: hidden;
}

#previewReceipt * {
    box-sizing: border-box;
}

#receiptHeader {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 18px;
}

#ticketLogoBox {
    width: 120px;
    height: 70px;
    display: grid;
    place-items: center;
    border: 2px solid #111;
    font-size: 15px;
    letter-spacing: 0;
    font-weight: 900;
}

.ticketRightBlock {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.companyBlock,
.fixedField {
    text-align: right;
    width: 100%;
}

.companyBlock .name {
    font-size: 15px;
    font-weight: 900;
}

.companyBlock div,
.fixedField div {
    font-size: 11px;
    line-height: 1.15;
}

.ticketMeta {
    margin-top: 14px;
    display: flex;
    justify-content: space-between;
    gap: 18px;
    font-size: 12px;
}

#previewReceipt.layout-singola .ticketDetail {
    margin-top: 18px;
}

#previewReceipt.layout-ar .ticketDetail {
    margin-top: 34px;
}

.ticketHead {
    display: flex;
    font-weight: 900;
    border-bottom: 1px solid #dedede;
    padding-bottom: 5px;
    font-size: 12px;
}

.ticketRow {
    display: flex;
    padding: 7px 0;
    border-bottom: 1px dashed #eee;
    font-size: 12px;
}

.c-cod {
    flex: 0 0 80px;
}

.c-desc {
    flex: 1 1 auto;
    padding-left: 6px;
}

.c-qta {
    flex: 0 0 60px;
    text-align: right;
}

.c-pu {
    flex: 0 0 80px;
    text-align: right;
}

.c-tl {
    flex: 0 0 90px;
    text-align: right;
}

#previewReceipt.layout-ar .c-cod {
    flex-basis: 65px;
}

#previewReceipt.layout-ar .c-desc {
    flex-basis: 330px;
    max-width: 330px;
}

.ticketTotals {
    margin-top: 12px;
    display: flex;
    justify-content: flex-end;
    gap: 14px;
    font-size: 13px;
}

.ticketTotals .label {
    font-weight: 900;
}

.ticketTotals .value {
    min-width: 110px;
    text-align: right;
    font-weight: 900;
}

.ticketPayment {
    margin-top: 14px;
}

#previewReceipt.layout-singola .ticketPayment {
    text-align: left;
}

#previewReceipt.layout-ar .ticketPayment {
    text-align: right;
}

.ticketFooter {
    margin-top: 25mm;
    font-size: 10px;
    color: #666;
    text-align: left;
}

#previewReceiptExport {
    font-family: "Arial Narrow", Arial, Helvetica, sans-serif !important;
}

/* ================= RESPONSIVE ================= */

/* ================= REMOTE VIEW ================= */

.remote-view-page .container {
    max-width: none;
}

.remote-toolbar {
    display: grid;
    grid-template-columns: minmax(280px, 1.5fr) minmax(250px, 1fr) auto;
    gap: 18px;
    align-items: end;
    margin-bottom: 22px;
    padding-bottom: 22px;
    border-bottom: 1px solid var(--line);
}

.remote-toolbar label,
.remote-message-row label {
    margin-top: 0;
}

.label-optional {
    color: var(--muted);
    font-weight: 600;
}

.remote-connection {
    display: flex;
    align-items: center;
    gap: 11px;
    min-height: 48px;
    padding: 8px 0;
    min-width: 190px;
}

.remote-connection strong,
.remote-connection small {
    display: block;
}

.remote-connection small {
    color: var(--muted);
}

.status-dot {
    width: 13px;
    height: 13px;
    flex: 0 0 13px;
    border-radius: 50%;
    background: #9ca3af;
    box-shadow: 0 0 0 4px rgba(156,163,175,.16);
}

.status-dot-online {
    background: var(--ok);
    box-shadow: 0 0 0 4px rgba(8,127,91,.14);
}

.status-dot-offline {
    background: var(--bad);
    box-shadow: 0 0 0 4px rgba(176,0,32,.12);
}

.status-dot-loading {
    background: var(--warn);
    animation: remote-pulse 1s ease-in-out infinite;
}

@keyframes remote-pulse {
    50% { opacity: .35; }
}

.remote-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.7fr) minmax(280px, .8fr);
    gap: 18px;
}

.remote-display-panel,
.remote-info-panel,
.remote-controls {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--panel);
}

.remote-display-panel,
.remote-info-panel {
    min-height: 330px;
}

.remote-side-stack {
    display: grid;
    align-content: start;
    gap: 18px;
}

.remote-side-stack .remote-info-panel {
    min-height: 0;
}

.remote-instrument-panel {
    overflow: hidden;
}

.remote-panel-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    padding: 16px 18px;
    border-bottom: 1px solid var(--line);
}

.remote-panel-heading h2,
.remote-panel-heading p {
    margin: 0;
}

.remote-panel-heading h2 {
    font-size: 18px;
}

.remote-panel-heading p {
    margin-top: 3px;
    color: var(--muted);
}

.badge-neutral,
.badge-warning {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 900;
}

.badge-neutral {
    background: #ecefeb;
    color: #596159;
}

.badge-warning {
    background: #fff3d6;
    color: #7a4300;
}

.remote-hmi-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    flex-wrap: wrap;
}

.remote-hmi-stage {
    position: relative;
    aspect-ratio: 1024 / 600;
    display: grid;
    place-items: center;
    overflow: hidden;
    background: #050505;
    outline: 0;
    touch-action: none;
}

.remote-hmi-stage:focus-visible {
    box-shadow: inset 0 0 0 4px var(--yellow);
}

.remote-hmi-stage img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: contain;
    user-select: none;
    -webkit-user-drag: none;
}

.remote-hmi-stage.is-control img {
    cursor: crosshair;
}

.remote-hmi-placeholder {
    position: absolute;
    inset: 0;
    z-index: 2;
    display: grid;
    place-content: center;
    gap: 7px;
    padding: 24px;
    background: #111;
    color: #fff;
    text-align: center;
}

.remote-hmi-placeholder span {
    color: #aeb3b8;
    font-size: 13px;
}

.remote-hmi-cursor {
    position: absolute;
    z-index: 3;
    width: 20px;
    height: 20px;
    translate: -50% -50%;
    border: 2px solid #fff;
    border-radius: 50%;
    background: rgba(255,237,0,.52);
    box-shadow: 0 0 0 2px rgba(0,0,0,.58);
    pointer-events: none;
}

.remote-hmi-notice {
    min-height: 42px;
    margin: 0;
    padding: 12px 18px;
    border-top: 1px solid var(--line);
    color: var(--muted);
    font-size: 12px;
    font-weight: 750;
}

.remote-fallback-display {
    border-top: 1px solid var(--line);
}

.remote-fallback-heading h3 {
    margin: 0;
    font-size: 14px;
}

.remote-hmi-login-modal .crt-modal-box {
    width: min(520px, 100%);
}

.remote-hmi-login-modal .error {
    margin-top: 12px;
}

.remote-hmi-stage:fullscreen {
    width: 100vw;
    height: 100vh;
    aspect-ratio: auto;
    background: #000;
}

.remote-weight {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: center;
    gap: 10px;
    min-height: 270px;
    padding: 20px 28px 24px;
    background: #f8f8f6;
    color: #090a09;
    font-family: Arial, Helvetica, sans-serif;
    font-variant-numeric: tabular-nums;
    overflow: hidden;
}

.remote-display-topline {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
    min-height: 46px;
}

.remote-isocal {
    border: 0;
    padding: 10px 13px;
    background: #d4d4d2;
    color: #090a09;
    font-size: 17px;
    font-weight: 900;
    cursor: pointer;
}

.remote-calibration-actions {
    display: flex;
    align-items: stretch;
    gap: 8px;
}

.remote-calibration-cancel {
    border: 0;
    padding: 10px 13px;
    background: #efc4c4;
    color: #7e1717;
    font-size: 15px;
    font-weight: 900;
    cursor: pointer;
}

.remote-isocal:disabled,
.remote-calibration-cancel:disabled {
    cursor: not-allowed;
    opacity: .58;
}

.remote-metrology {
    color: #777a77;
    font-size: 15px;
    line-height: 1.3;
    text-align: right;
    white-space: nowrap;
}

.remote-display-message {
    max-width: 100%;
    font-size: clamp(16px, 1.8vw, 24px);
    line-height: 1.2;
    font-weight: 700;
    text-align: right;
    overflow-wrap: anywhere;
}

.remote-display-type {
    min-height: 34px;
    font-size: clamp(22px, 2.4vw, 32px);
    font-weight: 800;
}

.remote-weight-value {
    display: flex;
    align-items: baseline;
    justify-content: flex-end;
    gap: 14px;
    width: 100%;
}

#remoteWeight {
    min-width: 0;
    font-size: clamp(74px, 10vw, 148px);
    line-height: 1;
    font-weight: 500;
    white-space: nowrap;
}

.remote-sign {
    align-self: center;
    font-size: clamp(52px, 6vw, 88px);
    line-height: 1;
    font-weight: 600;
}

.remote-unit {
    min-width: 86px;
    padding: 8px 16px;
    background: #d4d4d2;
    font-size: 32px;
    font-weight: 800;
    text-align: left;
}

.remote-unit-picker {
    position: relative;
    display: inline-flex;
    align-self: baseline;
    cursor: pointer;
}

.remote-unit-picker select {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    opacity: 0;
    cursor: pointer;
}

.remote-unit-picker:focus-within {
    outline: 3px solid var(--yellow);
    outline-offset: 3px;
}

.remote-unit-picker:has(select:disabled) {
    cursor: not-allowed;
    opacity: .62;
}

.remote-unit-picker select:disabled {
    cursor: not-allowed;
}

.remote-display-baseline {
    width: 84%;
    height: 7px;
    margin: 4px auto 0;
    border-radius: 999px;
    background: #dededc;
}

.remote-measure-meta {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    margin: 0;
    border-top: 1px solid var(--line);
}

.remote-measure-meta div {
    padding: 13px 16px;
    border-right: 1px solid var(--line);
}

.remote-measure-meta div:last-child {
    border-right: 0;
}

.remote-measure-meta dt,
.remote-device-info dt {
    color: var(--muted);
    font-size: 11px;
    font-weight: 900;
    text-transform: uppercase;
}

.remote-measure-meta dd,
.remote-device-info dd {
    margin: 3px 0 0;
    font-weight: 800;
    overflow-wrap: anywhere;
}

.remote-device-info {
    margin: 0;
}

.remote-edit-field label,
.remote-screen-fields label {
    margin-top: 0;
}

.remote-last-calibration {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 13px 18px;
    border-top: 1px solid var(--line);
}

.remote-last-calibration span {
    color: var(--muted);
    font-size: 12px;
    font-weight: 900;
    text-transform: uppercase;
}

.remote-last-calibration strong {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.remote-identification-fields {
    padding: 4px 18px 12px;
}

.remote-edit-field {
    padding: 10px 0;
    border-bottom: 1px solid var(--line);
}

.remote-edit-field:last-child {
    border-bottom: 0;
}

.remote-edit-field > div {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
}

.remote-edit-field input {
    min-height: 42px;
    padding: 9px 11px;
}

.remote-edit-field button {
    min-height: 42px;
    min-width: 72px;
}

.remote-device-info div {
    display: grid;
    grid-template-columns: 95px minmax(0, 1fr);
    gap: 14px;
    padding: 14px 18px;
    border-bottom: 1px solid var(--line);
}

.remote-device-info div:last-child {
    border-bottom: 0;
}

.remote-device-info dd {
    text-align: right;
}

.remote-controls {
    margin-top: 18px;
}

.remote-command-state {
    color: var(--muted);
    font-weight: 800;
    text-align: right;
}

.remote-command-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    padding: 18px;
}

.remote-command-button {
    min-height: 62px;
    font-size: 17px;
}

.remote-takeover {
    background: var(--yellow);
    color: #111;
}

.remote-takeover-modal .crt-modal-box {
    width: min(520px, 100%);
}

.remote-takeover-modal h2 {
    margin-bottom: 18px;
}

.remote-comment-meta {
    margin-top: 5px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
    text-align: right;
}

.remote-message-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    gap: 12px;
    align-items: end;
    padding: 0 18px 18px;
}

.remote-message-row button {
    min-width: 120px;
}

.remote-screen-fields {
    display: grid;
    grid-template-columns: minmax(180px, .7fr) minmax(260px, 1.3fr) auto auto;
    gap: 12px;
    align-items: end;
    padding: 18px;
}

.remote-screen-fields button {
    min-width: 150px;
}

.remote-network-notice {
    margin: 18px 0 0;
}

body.amber .remote-weight {
    background: #020603;
    border-color: #216f32;
    color: #55ff55;
    font-family: "Courier New", Courier, monospace;
}

body.amber .remote-isocal,
body.amber .remote-unit {
    background: #17311c;
    color: #55ff55;
}

body.amber .remote-metrology {
    color: #55ff55;
}

body.amber #remoteWeight,
body.amber .remote-display-message {
    text-shadow: 0 0 12px rgba(85,255,85,.34);
}

body.amber .remote-display-baseline {
    background: #216f32;
}

body.amber .badge-neutral {
    background: #172219;
    color: #29bd48;
}

body.amber .badge-warning {
    background: #302f0d;
    color: #ffff55;
}

body.amber .status-dot-online {
    background: #55ff55;
    box-shadow: 0 0 8px rgba(85,255,85,.7);
}

@media (max-width: 1180px) {
    .grid {
        grid-template-columns: 1fr;
    }

    #previewReceipt {
        transform: scale(.72);
        transform-origin: top center;
        margin-bottom: -80mm;
    }
}

@media (max-width: 980px) {
    .crt-screen {
        width: min(100% - 20px, 1180px);
        margin: 20px auto;
    }

    .container {
        padding: 22px;
    }

    .dashboard-top {
        display: block;
    }

    .crt-header,
    .page-heading {
        display: grid;
        grid-template-columns: 1fr;
    }

    .header-actions,
    .page-actions {
        justify-content: flex-start;
    }

    h1 {
        font-size: clamp(34px, 10vw, 52px);
    }

    .jobs-creator-page h1 {
        font-size: 38px;
    }

    .job-main-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .field-description {
        grid-column: 1 / -1;
    }

    .component-fields-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .component-name-field,
    .component-lot-field,
    .component-target-field,
    .component-unit-field,
    .component-decimals-field {
        grid-column: span 1;
    }

    .component-description-field,
    .component-instruction-field {
        grid-column: 1 / -1;
    }

    .component-options-row,
    .tolerance-fields {
        grid-column: 1 / -1;
    }

    .jobs-output-grid {
        grid-template-columns: 1fr;
    }

    .jobs-command-bar {
        grid-template-columns: 1fr;
    }

    .jobs-primary-actions {
        justify-content: flex-end;
    }

    .remote-toolbar {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .remote-connection {
        grid-column: 1 / -1;
    }

    .remote-layout {
        grid-template-columns: 1fr;
    }

    .remote-display-panel,
    .remote-info-panel {
        min-height: 0;
    }

    .remote-screen-fields {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 720px) {
    .mca-monitor-status {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .mca-monitor-status > div:nth-child(2) {
        border-right: 0;
    }

    .mca-monitor-status > div:nth-child(-n+2) {
        border-bottom: 1px solid var(--line);
    }

    .menu,
    .quick-actions,
    .actions,
    .form-actions,
    .row-actions,
    .card-actions {
        display: grid;
        grid-template-columns: 1fr;
    }

    .header-actions {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .mca-scan-heading,
    .mca-scan-controls {
        display: grid;
        grid-template-columns: 1fr;
    }

    .mca-scan-controls .btn {
        width: 100%;
    }

    .device-edit-grid {
        grid-template-columns: 1fr;
    }

    .item-editor-grid {
        grid-template-columns: 1fr;
    }

    .item-editor-wide {
        grid-column: auto;
    }

    .header-actions .inline-form,
    .header-actions .btn,
    .form-actions .btn,
    .form-actions button,
    .row-actions .btn,
    .row-actions button,
    .card-actions .btn,
    .card-actions button {
        width: 100%;
    }

    .entity-row {
        align-items: stretch;
        display: grid;
    }

    table {
        font-size: 13px;
        display: block;
        overflow-x: auto;
    }

    .crt-modal-box {
        padding: 20px;
    }

    #previewReceipt {
        transform: scale(.46);
        margin-left: 50%;
        translate: -50% 0;
        margin-bottom: -150mm;
    }

    .ticketMeta {
        display: block;
    }

    .jobs-creator-page h1 {
        font-size: 34px;
    }

    .job-main-grid,
    .job-deploy-grid,
    .component-fields-grid {
        grid-template-columns: 1fr;
    }

    .field-description,
    .component-name-field,
    .component-description-field,
    .component-lot-field,
    .component-instruction-field,
    .component-target-field,
    .component-unit-field,
    .component-decimals-field,
    .component-options-row,
    .tolerance-fields {
        grid-column: 1;
    }

    .tolerance-fields {
        grid-template-columns: 1fr;
    }

    .job-section-heading {
        align-items: stretch;
    }

    .job-section-heading-accent {
        display: grid;
    }

    .jobs-command-bar {
        position: static;
        display: grid;
        grid-template-columns: 1fr;
        margin: 14px 0 0;
    }

    .jobs-command-bar .job-deploy-grid,
    .jobs-primary-actions {
        display: grid;
        grid-template-columns: 1fr;
    }

    .remote-toolbar,
    .remote-command-grid,
    .remote-message-row,
    .remote-screen-fields {
        grid-template-columns: 1fr;
    }

    .remote-connection {
        grid-column: 1;
    }

    .remote-message-row button {
        width: 100%;
    }

    .remote-screen-fields button {
        width: 100%;
    }

    .remote-hmi-actions {
        justify-content: flex-start;
    }

    .remote-last-calibration {
        align-items: flex-start;
        flex-direction: column;
        gap: 4px;
    }

    .remote-last-calibration strong {
        text-align: left;
    }

    .remote-weight {
        min-height: 230px;
        padding: 16px 14px 18px;
        gap: 8px;
    }

    .remote-display-topline {
        min-height: 38px;
    }

    .remote-isocal {
        padding: 8px 10px;
        font-size: 14px;
    }

    .remote-metrology {
        max-width: 65%;
        font-size: 12px;
        white-space: normal;
    }

    .remote-display-message {
        font-size: 15px;
    }

    .remote-display-type {
        min-height: 25px;
        font-size: 20px;
    }

    .remote-weight-value {
        gap: 8px;
    }

    #remoteWeight {
        font-size: clamp(58px, 18vw, 82px);
    }

    .remote-unit {
        min-width: 58px;
        padding: 6px 10px;
        font-size: 23px;
    }

    .remote-sign {
        font-size: 42px;
    }

    .remote-measure-meta {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .remote-measure-meta div:nth-child(2) {
        border-right: 0;
    }

    .remote-measure-meta div:nth-child(-n+2) {
        border-bottom: 1px solid var(--line);
    }
}
