@import url("https://fonts.googleapis.com/css2?family=Cormorant+Garamond:wght@500;600;700&family=Noto+Sans+SC:wght@400;500;700&family=Rajdhani:wght@500;600;700&display=swap");

:root {
    color-scheme: dark;
    --bg-main: #071a24;
    --bg-body-solid: #041018;
    --bg-panel: rgba(10, 33, 46, 0.84);
    --bg-panel-soft: rgba(12, 40, 56, 0.66);
    --line: rgba(93, 149, 174, 0.35);
    --line-strong: rgba(120, 190, 220, 0.6);
    --text-main: #e7f6ff;
    --text-sub: #9ec2d8;
    --text-muted: #6d9ab2;
    --accent: #12b3c7;
    --accent-strong: #0ed8c8;
    --ok: #00b67a;
    --warn: #ffb74a;
    --danger: #ff5f6d;
    --shadow: 0 18px 42px rgba(1, 11, 18, 0.55);
    --radius-lg: 18px;
    --radius-md: 12px;
    --radius-sm: 8px;
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
    height: 100vh;
    overflow: hidden;
    background: var(--bg-body-solid);
}

body {
    min-height: 100vh;
    color: var(--text-main);
    font-family: "Noto Sans SC", "Microsoft YaHei", sans-serif;
    background: linear-gradient(160deg, #041018 0%, #0a2536 45%, #041018 100%);
}

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

button,
input,
textarea,
select {
    font: inherit;
}

input,
textarea,
select {
    color: #e4f6ff;
}

a {
    color: #9fefff;
}

/* Keep native controls and scrollbars in dark mode across pages. */
* {
    scrollbar-width: thin;
    scrollbar-color: rgba(117, 177, 205, 0.55) rgba(5, 23, 34, 0.78);
}

*::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

*::-webkit-scrollbar-track {
    background: rgba(5, 23, 34, 0.78);
}

*::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, rgba(18, 179, 199, 0.6), rgba(16, 122, 149, 0.75));
    border-radius: 999px;
}

*::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, rgba(18, 179, 199, 0.78), rgba(16, 122, 149, 0.9));
}

select,
option {
    background: #0a2b3d;
    color: #d9f6ff;
}

input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
textarea:-webkit-autofill,
textarea:-webkit-autofill:hover,
textarea:-webkit-autofill:focus {
    -webkit-text-fill-color: #e4f6ff;
    transition: background-color 9999s ease-in-out 0s;
    -webkit-box-shadow: 0 0 0 1000px rgba(6, 25, 36, 0.92) inset;
}

.industrial-bg {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: -1;
    background:
        radial-gradient(circle at 88% 12%, rgba(18, 179, 199, 0.28), transparent 40%),
        radial-gradient(circle at 10% 88%, rgba(14, 216, 200, 0.15), transparent 38%),
        linear-gradient(transparent 31px, rgba(126, 177, 202, 0.06) 32px),
        linear-gradient(90deg, transparent 31px, rgba(126, 177, 202, 0.06) 32px);
    background-size:
        auto,
        auto,
        32px 32px,
        32px 32px;
    animation: bgPulse 8s ease-in-out infinite;
}

@keyframes bgPulse {
    0%,
    100% {
        filter: saturate(100%);
    }
    50% {
        filter: saturate(120%);
    }
}

.login-wrap {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
}

.login-card {
    width: min(460px, 100%);
    border-radius: var(--radius-lg);
    border: 1px solid var(--line);
    background: var(--bg-panel);
    box-shadow: var(--shadow);
    padding: 30px;
    backdrop-filter: blur(5px);
}

.login-card h1 {
    font-family: "Rajdhani", "Noto Sans SC", sans-serif;
    letter-spacing: 0.08em;
    font-size: 35px;
    color: #9de8f7;
}

.subtitle {
    margin-top: 6px;
    color: var(--text-sub);
    font-size: 14px;
    margin-bottom: 18px;
}

.form-error {
    margin-bottom: 14px;
    border-radius: var(--radius-sm);
    border: 1px solid rgba(255, 95, 109, 0.55);
    background: rgba(255, 95, 109, 0.16);
    color: #ffd7da;
    padding: 9px 10px;
    font-size: 14px;
}

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

.login-form label {
    color: #b4d7e8;
    font-size: 14px;
    font-weight: 600;
}

.login-form input {
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    padding: 11px 12px;
    background: rgba(6, 25, 36, 0.86);
    outline: none;
}

.login-form input:focus {
    border-color: var(--line-strong);
    box-shadow: 0 0 0 3px rgba(18, 179, 199, 0.22);
}

.login-form button {
    margin-top: 8px;
    border: 0;
    border-radius: var(--radius-sm);
    padding: 11px 14px;
    background: linear-gradient(120deg, #0ea9c0, #12d2bf);
    color: #03202e;
    font-weight: 700;
    cursor: pointer;
}

.hint {
    margin-top: 11px;
    font-size: 13px;
    color: var(--text-muted);
}

.ops-layout {
    height: 100vh;
    display: grid;
    grid-template-columns: 260px 1fr;
    gap: 14px;
    padding: 14px;
    align-items: stretch;
    overflow: hidden;
}

.ops-layout.screen-mode {
    grid-template-columns: 1fr;
    gap: 0;
    padding: 0;
}

.ops-sidebar {
    border-radius: var(--radius-lg);
    background: var(--bg-panel-soft);
    border: 1px solid var(--line);
    box-shadow: var(--shadow);
    padding: 18px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    min-height: 0;
    overflow: auto;
}

.brand-block {
    display: flex;
    align-items: center;
    gap: 10px;
}

.brand-dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: linear-gradient(120deg, #09e0cf, #14aed3);
    box-shadow: 0 0 18px rgba(9, 224, 207, 0.6);
}

.brand-block h1 {
    font-family: "Rajdhani", "Noto Sans SC", sans-serif;
    font-size: 28px;
    letter-spacing: 0.08em;
    color: #bff6ff;
}

.brand-block p {
    margin-top: 2px;
    color: var(--text-muted);
    font-size: 12px;
}

.side-tag-list {
    display: grid;
    gap: 8px;
}

.side-tag {
    width: 100%;
    text-align: left;
    cursor: pointer;
    appearance: none;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    padding: 8px 10px;
    color: var(--text-sub);
    font-size: 13px;
    background: rgba(9, 33, 47, 0.65);
}

.side-tag.active {
    border-color: var(--line-strong);
    color: #c8f8ff;
    background: linear-gradient(90deg, rgba(18, 179, 199, 0.24), rgba(7, 42, 58, 0.22));
}

.env-card {
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    background: rgba(8, 30, 44, 0.76);
    padding: 12px;
}

.env-card p {
    font-size: 12px;
    color: var(--text-muted);
}

.env-card h3 {
    margin-top: 5px;
    color: #c8f8ff;
    font-family: "Rajdhani", "Noto Sans SC", sans-serif;
    letter-spacing: 0.05em;
    font-size: 23px;
}

.env-subtitle {
    margin-top: 6px;
    font-size: 12px;
}

.env-card.compact h3 {
    font-size: 22px;
}

.sidebar-meta {
    margin-top: auto;
    display: grid;
    gap: 12px;
}

.ops-main {
    display: grid;
    grid-template-rows: auto auto minmax(0, 1fr);
    gap: 12px;
    align-self: stretch;
    height: 100%;
    min-height: 0;
    overflow: hidden;
}

.ops-layout.screen-mode .ops-sidebar,
.ops-layout.screen-mode .ops-header {
    display: none;
}

.ops-layout.screen-mode .ops-main {
    grid-template-rows: minmax(0, 1fr);
    gap: 0;
}

.module-panel {
    display: none;
    gap: 12px;
    height: 100%;
    min-height: 0;
}

.module-panel.active {
    display: grid;
    align-self: stretch;
    align-content: start;
    overflow: auto;
    padding-right: 4px;
}

.ops-layout.screen-mode .module-panel.active {
    padding-right: 0;
}

.ops-header {
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background: var(--bg-panel-soft);
    padding: 16px 18px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.ops-header h2 {
    font-family: "Rajdhani", "Noto Sans SC", sans-serif;
    font-size: 31px;
    letter-spacing: 0.05em;
    color: #c9f8ff;
}

.ops-header p {
    margin-top: 5px;
    color: var(--text-sub);
    font-size: 14px;
}

.ghost-btn {
    border: 1px solid var(--line-strong);
    color: #cdf8ff;
    background: rgba(7, 42, 58, 0.3);
    border-radius: 999px;
    padding: 8px 16px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.ghost-btn:hover {
    transform: translateY(-1px);
    background: rgba(18, 179, 199, 0.2);
}

.feedback {
    position: fixed;
    top: 18px;
    right: 18px;
    z-index: 1200;
    width: min(360px, calc(100vw - 24px));
    border-radius: var(--radius-sm);
    padding: 10px 12px;
    border: 1px solid;
    font-size: 13px;
    line-height: 1.45;
    box-shadow: 0 14px 34px rgba(0, 0, 0, 0.28);
    backdrop-filter: blur(8px);
    pointer-events: none;
    animation: toastIn 0.2s ease;
}

@keyframes toastIn {
    from {
        opacity: 0;
        transform: translate3d(0, -8px, 0);
    }
    to {
        opacity: 1;
        transform: translate3d(0, 0, 0);
    }
}

.feedback.success {
    border-color: rgba(0, 182, 122, 0.55);
    color: #bdf9e4;
    background: rgba(0, 182, 122, 0.15);
}

.feedback.error {
    border-color: rgba(255, 95, 109, 0.6);
    color: #ffd7dc;
    background: rgba(255, 95, 109, 0.16);
}

.license-tool-shell {
    height: 100%;
    min-height: 0;
    display: grid;
    grid-template-rows: minmax(0, 1fr);
    overflow: hidden;
    flex: 1 1 auto;
}

body.license-tool-page {
    height: 100vh;
    min-height: 100vh;
    display: grid;
    grid-template-rows: minmax(0, 1fr);
    overflow: hidden;
}

.license-tool-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
}

.license-tool-header h1 {
    font-family: "Rajdhani", "Noto Sans SC", sans-serif;
    font-size: 30px;
    letter-spacing: 0.05em;
    color: #cbf8ff;
}

.license-tool-header p {
    margin-top: 6px;
    color: var(--text-sub);
    font-size: 14px;
}

.license-tool-user {
    min-height: 42px;
    display: inline-flex;
    align-items: center;
    padding: 0 14px;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: rgba(10, 35, 49, 0.66);
    color: #c9f5ff;
    font-size: 13px;
}

.license-tool-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(320px, 0.85fr) minmax(280px, 0.8fr);
    grid-template-rows: minmax(0, 1fr);
    gap: 14px;
    align-items: stretch;
    align-content: stretch;
    min-height: 0;
    height: 100%;
    padding: 18px;
}

.license-tool-card,
.license-guide-card {
    min-height: 0;
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

.license-tool-card-body {
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding-right: 4px;
}

.license-form {
    display: grid;
    gap: 10px;
}

.license-form label {
    display: grid;
    gap: 6px;
    color: #aed4e8;
    font-size: 13px;
    font-weight: 600;
}

.license-remark-input {
    min-height: 108px;
    resize: vertical;
}

.license-upload-tip,
.license-output-tip {
    margin-top: 2px;
    border-radius: var(--radius-md);
    border: 1px solid rgba(93, 149, 174, 0.24);
    background: rgba(4, 12, 18, 0.82);
    padding: 10px 12px;
    color: #b5dcee;
    font-size: 13px;
    line-height: 1.6;
}

.license-upload-tip code,
.license-output-tip code,
.license-preview-item strong {
    color: #aef7ff;
}

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

.license-preview-item {
    border-radius: var(--radius-md);
    border: 1px solid rgba(93, 149, 174, 0.24);
    background: rgba(4, 12, 18, 0.88);
    padding: 12px 13px;
    display: grid;
    gap: 6px;
}

.license-preview-item span {
    color: var(--text-sub);
    font-size: 12px;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.license-preview-item strong {
    font-size: 14px;
    font-weight: 600;
    word-break: break-all;
}

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

.license-guide {
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
    display: grid;
    align-content: start;
    gap: 14px;
    padding-right: 4px;
}

.license-guide-chip-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.license-chip {
    display: inline-flex;
    align-items: center;
    min-height: 30px;
    padding: 0 12px;
    border-radius: 999px;
    border: 1px solid rgba(18, 179, 199, 0.35);
    background: rgba(4, 12, 18, 0.9);
    color: #c9f9ff;
    font-size: 12px;
    letter-spacing: 0.04em;
}

.license-guide-block {
    border-radius: var(--radius-md);
    border: 1px solid rgba(93, 149, 174, 0.24);
    background: rgba(4, 12, 18, 0.88);
    padding: 12px 13px;
    display: grid;
    gap: 8px;
}

.license-guide-block h4 {
    margin: 0;
    font-size: 14px;
    color: #cbf8ff;
    letter-spacing: 0.04em;
}

.license-guide-block p {
    margin: 0;
    color: #a7d1e4;
    font-size: 13px;
    line-height: 1.7;
}

.license-records-panel {
    grid-template-rows: auto minmax(0, 1fr);
    min-height: 0;
    overflow: hidden;
}

.license-record-table {
    --license-col-id: 180px;
    --license-col-time: 150px;
    --license-col-remark: 180px;
    --license-col-detail: 96px;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    display: grid;
    align-content: start;
    gap: 8px;
}

.license-record-list {
    min-height: 0;
    display: grid;
    align-content: start;
    gap: 8px;
}

.license-record-header,
.license-record-row {
    width: 100%;
    display: grid;
    grid-template-columns:
        minmax(0, var(--license-col-id))
        minmax(0, var(--license-col-time))
        minmax(0, var(--license-col-remark))
        minmax(0, var(--license-col-detail));
    align-items: stretch;
}

.license-record-header {
    position: sticky;
    top: 0;
    z-index: 2;
    border-radius: 14px;
    border: 1px solid rgba(93, 149, 174, 0.24);
    background: rgba(4, 11, 17, 0.97);
    backdrop-filter: blur(12px);
}

.license-record-head-cell {
    position: relative;
    min-width: 0;
    min-height: 42px;
    padding: 0 14px;
    display: flex;
    align-items: center;
    color: #caefff;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.04em;
}

.license-record-head-cell:not(:last-child),
.license-record-cell:not(:last-child) {
    border-right: 1px solid rgba(93, 149, 174, 0.18);
}

.license-record-head-cell-action {
    justify-content: center;
}

.license-record-resize-handle {
    position: absolute;
    top: 0;
    right: -7px;
    width: 14px;
    height: 100%;
    padding: 0;
    border: 0;
    background: transparent;
    cursor: col-resize;
    touch-action: none;
    z-index: 3;
}

.license-record-resize-handle::before {
    content: "";
    position: absolute;
    top: 10px;
    bottom: 10px;
    left: 6px;
    width: 2px;
    border-radius: 999px;
    background: rgba(143, 205, 233, 0.22);
    transition: background 0.2s ease, box-shadow 0.2s ease;
}

.license-record-resize-handle:hover::before,
.license-record-resize-handle.dragging::before {
    background: rgba(79, 214, 255, 0.92);
    box-shadow: 0 0 0 1px rgba(79, 214, 255, 0.28);
}

.license-record-empty {
    border-radius: var(--radius-md);
    border: 1px dashed rgba(93, 149, 174, 0.28);
    background: rgba(4, 12, 18, 0.7);
    padding: 16px 14px;
    color: var(--text-muted);
    font-size: 13px;
    text-align: center;
}

.license-record-item {
    border-radius: var(--radius-md);
    border: 1px solid rgba(93, 149, 174, 0.24);
    background: rgba(4, 12, 18, 0.9);
    overflow: hidden;
}

.license-record-row {
    min-width: 0;
}

.license-record-cell {
    min-width: 0;
    min-height: 46px;
    padding: 0 12px;
    display: flex;
    align-items: center;
    background: rgba(3, 9, 14, 0.82);
}

.license-record-cell strong {
    color: #e5f7ff;
    font-size: 13px;
    font-weight: 600;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.license-record-detail-btn {
    min-width: 64px;
}

.license-record-cell-action {
    justify-content: center;
    background: rgba(3, 9, 14, 0.94);
}

.license-record-status {
    flex: none;
}

.license-record-status.active {
    color: #043527;
    background: #88f3cc;
}

.license-record-status.expired {
    color: #5b3500;
    background: #ffd596;
}

.license-record-status.invalid,
.license-record-status.other {
    color: #4f0a12;
    background: #ffb3bb;
}

.license-record-modal[hidden] {
    display: none !important;
}

.license-record-modal {
    position: fixed;
    inset: 0;
    z-index: 140;
    display: grid;
    place-items: center;
    padding: 24px;
    background: rgba(2, 10, 16, 0.76);
    backdrop-filter: blur(10px);
}

.license-record-modal-card {
    width: min(780px, 100%);
    max-height: min(82vh, 860px);
    overflow: auto;
    border-radius: 24px;
    border: 1px solid rgba(93, 149, 174, 0.3);
    background: linear-gradient(180deg, rgba(4, 11, 17, 0.98) 0%, rgba(2, 7, 11, 0.98) 100%);
    box-shadow: 0 32px 80px rgba(0, 0, 0, 0.42);
    padding: 18px;
    display: grid;
    gap: 16px;
}

.license-record-modal-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
}

.license-record-modal-title {
    min-width: 0;
}

.license-record-modal-title h4 {
    margin: 0;
    color: #d8fbff;
    font-size: 22px;
    line-height: 1.15;
}

.license-record-modal-title p {
    margin: 6px 0 0;
    color: var(--text-muted);
    font-size: 13px;
    line-height: 1.6;
    word-break: break-all;
}

.license-record-modal-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.license-record-modal-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.license-record-modal-field {
    display: grid;
    gap: 6px;
    padding: 12px 13px;
    border-radius: 14px;
    border: 1px solid rgba(93, 149, 174, 0.22);
    background: rgba(4, 12, 18, 0.88);
}

.license-tool-shell .small-btn,
.license-record-modal .small-btn {
    background: rgba(4, 12, 18, 0.88);
}

.license-tool-shell .small-btn.primary,
.license-record-modal .small-btn.primary {
    background: rgba(4, 12, 18, 0.94);
}

.license-record-modal-field.wide {
    grid-column: 1 / -1;
}

.license-record-modal-field span {
    color: var(--text-sub);
    font-size: 11px;
    letter-spacing: 0.06em;
}

.license-record-modal-field strong {
    color: #e4f6ff;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.6;
    word-break: break-all;
}

body.license-record-modal-open {
    overflow: hidden;
}

body.license-record-resizing,
body.license-record-resizing * {
    cursor: col-resize !important;
    user-select: none !important;
}

@media (max-width: 1360px) {
    .license-tool-grid {
        grid-template-columns: minmax(0, 1fr) minmax(320px, 0.92fr);
        grid-auto-rows: minmax(0, 1fr);
    }

    .license-guide-card {
        grid-column: 1 / -1;
    }
}

@media (max-width: 980px) {
    .license-tool-shell {
        height: auto;
        min-height: 100%;
        overflow: auto;
    }

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

    .license-tool-grid {
        grid-template-columns: 1fr;
        grid-auto-rows: auto;
        height: auto;
        padding: 14px;
    }

    .license-preview-grid {
        grid-template-columns: 1fr;
    }

    .license-record-table {
        --license-col-id: 150px;
        --license-col-time: 128px;
        --license-col-remark: 140px;
        --license-col-detail: 82px;
    }

    .license-record-modal {
        padding: 12px;
    }

    .license-record-modal-card {
        padding: 14px;
        border-radius: 18px;
    }

    .license-record-modal-head {
        flex-direction: column;
        align-items: stretch;
    }

    .license-record-modal-actions {
        justify-content: space-between;
    }

    .license-record-modal-grid {
        grid-template-columns: 1fr;
    }

    .license-record-modal-field.wide {
        grid-column: auto;
    }
}

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

.kpi-card {
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    background: var(--bg-panel);
    padding: 14px;
    animation: cardRise 0.45s ease both;
}

.kpi-card:nth-child(2) {
    animation-delay: 0.06s;
}

.kpi-card:nth-child(3) {
    animation-delay: 0.12s;
}

.kpi-card:nth-child(4) {
    animation-delay: 0.18s;
}

@keyframes cardRise {
    from {
        opacity: 0;
        transform: translateY(9px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.kpi-card p {
    color: var(--text-sub);
    font-size: 13px;
}

.kpi-card h3 {
    margin-top: 7px;
    font-family: "Rajdhani", "Noto Sans SC", sans-serif;
    font-size: 37px;
    color: #d8fbff;
    line-height: 1;
}

.kpi-card span {
    margin-top: 7px;
    display: block;
    font-size: 12px;
    color: var(--text-muted);
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.kpi-card.success {
    border-color: rgba(0, 182, 122, 0.45);
}

.kpi-card.success h3 {
    color: #8af4ce;
}

.kpi-card.danger {
    border-color: rgba(255, 95, 109, 0.45);
}

.kpi-card.danger h3 {
    color: #ffb3bb;
}

.kpi-card.warning {
    border-color: rgba(255, 183, 74, 0.45);
}

.kpi-card.warning h3 {
    color: #ffd596;
}

.workspace-grid {
    display: grid;
    grid-template-columns: minmax(0, 2.05fr) minmax(360px, 0.78fr);
    gap: 12px;
}

.glass-card {
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background: var(--bg-panel);
    box-shadow: var(--shadow);
    padding: 14px;
    transition: border-color 0.25s ease, transform 0.25s ease;
}

.glass-card:hover {
    border-color: var(--line-strong);
    transform: translateY(-1px);
}

.card-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    margin-bottom: 11px;
}

.card-title.slim {
    margin-top: 10px;
}

.card-title h3 {
    font-family: "Rajdhani", "Noto Sans SC", sans-serif;
    font-size: 23px;
    color: #c8f8ff;
    letter-spacing: 0.06em;
}

.inline-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.mini-kpi {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    border-radius: 999px;
    font-size: 12px;
    border: 1px solid var(--line);
}

.mini-kpi.critical {
    color: #ffc4cb;
    border-color: rgba(255, 95, 109, 0.6);
    background: rgba(255, 95, 109, 0.16);
}

.mini-kpi.warn {
    color: #ffe3ae;
    border-color: rgba(255, 183, 74, 0.55);
    background: rgba(255, 183, 74, 0.16);
}

.small-btn {
    border-radius: 999px;
    border: 1px solid var(--line);
    color: #c8f8ff;
    background: rgba(9, 37, 53, 0.64);
    padding: 6px 12px;
    font-size: 13px;
    cursor: pointer;
}

.small-btn.primary {
    border-color: rgba(18, 179, 199, 0.7);
    background: rgba(18, 179, 199, 0.24);
}

.small-btn.warn {
    border-color: rgba(255, 95, 109, 0.6);
    color: #ffd4d8;
    background: rgba(255, 95, 109, 0.14);
}

.small-btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.select-input {
    min-width: 260px;
    border-radius: 999px;
    border: 1px solid var(--line);
    color: #d4f6ff;
    background: rgba(9, 37, 53, 0.64);
    padding: 6px 12px;
    outline: none;
}

.select-input:focus {
    border-color: var(--line-strong);
}

.select-input:disabled {
    opacity: 0.6;
}

.text-input {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: rgba(6, 27, 40, 0.88);
    color: #dff6ff;
    padding: 8px 10px;
    outline: none;
}

.text-input:focus {
    border-color: var(--line-strong);
    box-shadow: 0 0 0 3px rgba(18, 179, 199, 0.22);
}

.table-wrap {
    width: 100%;
    overflow: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 700px;
}

thead th {
    text-align: left;
    color: var(--text-sub);
    border-bottom: 1px solid var(--line);
    padding: 10px 8px;
    font-size: 13px;
    letter-spacing: 0.02em;
    font-weight: 600;
}

tbody td {
    border-bottom: 1px solid rgba(93, 149, 174, 0.16);
    padding: 11px 8px;
    font-size: 14px;
    color: #def4ff;
}

.empty-tip {
    text-align: center;
    color: var(--text-muted);
    padding: 26px 0;
}

.device-form {
    display: grid;
    gap: 9px;
}

.device-form label {
    font-size: 13px;
    color: #aed4e8;
    font-weight: 600;
}

.device-form input,
.device-form textarea {
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: rgba(6, 27, 40, 0.88);
    padding: 9px 10px;
    outline: none;
}

.device-form textarea {
    min-height: 96px;
    line-height: 1.5;
    resize: vertical;
}

.double-input {
    display: grid;
    gap: 5px;
}

.double-input label {
    font-size: 13px;
    color: #aed4e8;
    font-weight: 600;
}

.device-form input::placeholder,
.device-form textarea::placeholder {
    color: #5b889f;
}

.device-form input:focus,
.device-form textarea:focus {
    border-color: var(--line-strong);
    box-shadow: 0 0 0 3px rgba(18, 179, 199, 0.22);
}

.license-form label.switch-row {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 6px;
    margin-top: 2px;
}

.switch-row input {
    accent-color: #12b3c7;
    margin: 0;
    flex: none;
}

.switch-row span {
    line-height: 1.2;
}

.button-row {
    margin-top: 6px;
    display: flex;
    gap: 8px;
    justify-content: center;
}

.primary-action,
.secondary-btn {
    border-radius: var(--radius-sm);
    padding: 9px 12px;
    cursor: pointer;
    border: 1px solid transparent;
    font-size: 14px;
    font-weight: 600;
}

.primary-action {
    color: #03222f;
    border-color: rgba(18, 179, 199, 0.8);
    background: linear-gradient(120deg, #0ea9c0, #13dac5);
}

.secondary-btn {
    color: #ccefff;
    border-color: var(--line);
    background: rgba(8, 34, 48, 0.58);
}

.status-badge {
    display: inline-block;
    border-radius: 999px;
    padding: 3px 10px;
    font-size: 12px;
    font-weight: 700;
}

.status-online {
    color: #043527;
    background: #88f3cc;
}

.status-offline {
    color: #4f0a12;
    background: #ffb3bb;
}

.status-unknown {
    color: #5b3500;
    background: #ffd596;
}

.action-wrap {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.action-btn {
    min-height: 30px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: rgba(8, 35, 49, 0.6);
    color: #d0f2ff;
    padding: 4px 10px;
    font-size: 11px;
    cursor: pointer;
    white-space: nowrap;
}

.action-cell {
    width: 1%;
    white-space: nowrap;
}

.device-action-wrap {
    flex-wrap: nowrap;
}

.device-action-wrap .action-btn {
    min-width: 62px;
    padding: 4px 8px;
}

.action-btn.primary {
    border-color: rgba(18, 179, 199, 0.75);
    color: #9ffaff;
}

.action-btn.warn {
    border-color: rgba(255, 95, 109, 0.6);
    color: #ffc8ce;
}

.token-cell code {
    display: inline-block;
    max-width: 220px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 12px;
    color: #97e6ff;
}

.agent-grid {
    display: grid;
    grid-template-columns: 1.4fr 1fr;
    gap: 10px;
    margin-bottom: 10px;
    align-items: end;
}

.agent-grid label {
    display: grid;
    gap: 6px;
    font-size: 13px;
    color: #aed4e8;
    font-weight: 600;
}

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

.agent-form-tip {
    margin: 0 0 10px;
    color: rgba(163, 193, 216, 0.82);
    font-size: 12px;
    line-height: 1.7;
}

.agent-cmd-output {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: rgba(6, 24, 35, 0.9);
    color: #c9f8ff;
    font-family: "Consolas", "Courier New", monospace;
    font-size: 12px;
    padding: 10px;
    resize: vertical;
}

.ota-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.ota-manifest-output {
    min-height: 300px;
}

.release-plan-list {
    display: grid;
    gap: 10px;
}

.release-plan-item {
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: rgba(8, 34, 48, 0.38);
    padding: 10px;
}

.release-plan-row {
    display: grid;
    grid-template-columns: minmax(220px, 0.9fr) minmax(280px, 1.3fr) auto;
    gap: 10px;
    align-items: end;
}

.release-plan-field {
    display: grid;
    gap: 6px;
    font-size: 13px;
    color: #aed4e8;
    font-weight: 600;
}

.release-plan-select {
    min-width: 0;
    width: 100%;
}

.release-plan-remove {
    min-width: 74px;
}

.release-plan-meta {
    margin-top: 8px;
    font-size: 12px;
    line-height: 1.6;
    color: #8fb8cb;
    word-break: break-all;
}

.ota-device-list {
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: rgba(8, 34, 48, 0.58);
    padding: 8px;
    max-height: 180px;
    overflow: auto;
    display: grid;
    gap: 6px;
}

.release-upload-grid {
    display: grid;
    grid-template-columns: 1.1fr 0.8fr 0.8fr;
    gap: 10px;
    margin-bottom: 12px;
}

.release-upload-grid label {
    display: grid;
    gap: 6px;
    font-size: 13px;
    color: #aed4e8;
    font-weight: 600;
}

.release-artifact-type {
    min-width: 0;
    width: 100%;
}

.file-input {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: rgba(6, 27, 40, 0.88);
    color: #dff6ff;
    padding: 8px 10px;
}

.file-input::file-selector-button {
    border: 1px solid rgba(18, 179, 199, 0.5);
    border-radius: 999px;
    background: rgba(18, 179, 199, 0.18);
    color: #dff6ff;
    padding: 6px 10px;
    margin-right: 10px;
    cursor: pointer;
}

.artifact-name {
    display: grid;
    gap: 2px;
}

.artifact-name strong {
    color: #dff6ff;
    font-size: 14px;
}

.artifact-name span {
    color: #82b8d0;
    font-size: 12px;
}

.ota-device-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: #d4f0ff;
}

.ota-device-item input {
    accent-color: #12b3c7;
}

.row-selected {
    background: rgba(18, 179, 199, 0.14);
}

.terminal-panel {
    margin-top: 12px;
}

.terminal-meta {
    display: flex;
    align-items: center;
    gap: 10px;
}

.terminal-device {
    font-size: 13px;
    color: #aad2e8;
}

.status-pill {
    font-size: 12px;
    border-radius: 999px;
    padding: 4px 10px;
    border: 1px solid;
}

.status-pill.idle {
    color: #b6d8ea;
    border-color: rgba(113, 165, 190, 0.55);
    background: rgba(9, 38, 54, 0.48);
}

.status-pill.connecting {
    color: #ffe1a8;
    border-color: rgba(255, 183, 74, 0.55);
    background: rgba(255, 183, 74, 0.18);
}

.status-pill.connected {
    color: #90f5d0;
    border-color: rgba(0, 182, 122, 0.6);
    background: rgba(0, 182, 122, 0.18);
}

.status-pill.error {
    color: #ffc4cb;
    border-color: rgba(255, 95, 109, 0.6);
    background: rgba(255, 95, 109, 0.16);
}

#terminal {
    height: 100%;
    min-height: 390px;
    border-radius: var(--radius-md);
    border: 1px solid rgba(52, 108, 136, 0.8);
    background: #02121d;
    overflow: hidden;
}

.terminal-help {
    margin-top: 9px;
    font-size: 13px;
    color: var(--text-muted);
}

@media (max-width: 1320px) {
    .ops-layout {
        grid-template-columns: 220px 1fr;
    }

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

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

@media (max-width: 900px) {
    .ops-layout {
        grid-template-columns: 1fr;
        grid-template-rows: auto 1fr;
    }

    .ops-sidebar {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 10px;
        align-content: start;
    }

    .brand-block,
    .side-tag-list,
    .sidebar-meta {
        grid-column: 1 / -1;
    }

    .sidebar-meta {
        margin-top: 0;
    }

    .ops-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .ops-main {
        grid-template-rows: auto auto 1fr;
    }
}

@media (max-width: 640px) {
    .ops-layout {
        padding: 10px;
    }

    .ops-sidebar {
        padding: 12px;
    }

    .ops-header {
        padding: 12px;
    }

    .ops-header h2 {
        font-size: 24px;
    }

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

    .glass-card {
        padding: 11px;
    }

    .button-row {
        flex-direction: column;
    }

    #terminal {
        height: 290px;
    }

    .terminal-meta {
        align-items: flex-start;
        flex-direction: column;
        gap: 6px;
    }

    .inline-actions {
        width: 100%;
        flex-direction: column;
        align-items: stretch;
    }

    .select-input {
        min-width: 0;
        width: 100%;
    }

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

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

    .release-upload-grid {
        grid-template-columns: 1fr;
    }

    .release-plan-row {
        grid-template-columns: 1fr;
    }

    .device-action-wrap {
        flex-wrap: wrap;
    }
}

/* Dark theme override: force a neutral black industrial style across all pages. */
:root {
    --bg-main: #03050a;
    --bg-body-solid: #03050a;
    --bg-panel: linear-gradient(180deg, rgba(7, 11, 18, 0.94), rgba(3, 6, 11, 0.96));
    --bg-panel-soft: linear-gradient(180deg, rgba(7, 11, 18, 0.96), rgba(3, 6, 11, 0.98));
    --line: rgba(255, 255, 255, 0.12);
    --line-strong: rgba(255, 255, 255, 0.28);
    --text-main: #eef2f6;
    --text-sub: #c3cbd6;
    --text-muted: #8b95a1;
    --accent: #52a8ff;
    --accent-strong: #79bdff;
    --shadow: 0 18px 42px rgba(0, 0, 0, 0.52);
}

body {
    background:
        radial-gradient(circle at 50% 16%, rgba(114, 178, 255, 0.08), transparent 28%),
        radial-gradient(circle at 18% 82%, rgba(84, 170, 255, 0.05), transparent 30%),
        linear-gradient(180deg, rgba(3, 6, 11, 0.98), rgba(3, 5, 10, 0.99));
}

.industrial-bg {
    background:
        radial-gradient(circle at 50% 16%, rgba(114, 178, 255, 0.08), transparent 24%),
        radial-gradient(circle at 18% 82%, rgba(84, 170, 255, 0.05), transparent 26%),
        linear-gradient(transparent 39px, rgba(116, 171, 216, 0.035) 40px),
        linear-gradient(90deg, transparent 39px, rgba(116, 171, 216, 0.035) 40px);
    background-size:
        auto,
        auto,
        40px 40px,
        40px 40px;
}

.login-card,
.ops-sidebar,
.ops-header,
.glass-card,
.env-card,
.kpi-card {
    background: var(--bg-panel);
    border-color: var(--line);
    box-shadow: var(--shadow);
}

.side-tag,
.small-btn,
.action-btn,
.secondary-btn,
.ghost-btn,
.select-input,
.text-input,
.device-form input,
.device-form textarea,
.agent-cmd-output,
.ota-device-list {
    background: rgba(7, 12, 18, 0.88);
    border-color: var(--line);
}

.side-tag.active,
.small-btn.primary,
.action-btn.primary {
    background: rgba(82, 168, 255, 0.16);
    border-color: rgba(121, 189, 255, 0.55);
}

.primary-action,
.login-form button {
    color: #08121d;
    background: linear-gradient(120deg, #4e9cff, #7fc0ff);
}

thead th {
    color: #c9d3de;
    border-bottom-color: rgba(255, 255, 255, 0.12);
}

tbody td {
    color: #e2e8ee;
    border-bottom-color: rgba(255, 255, 255, 0.08);
}

.status-online {
    color: #082617;
    background: #81e6b7;
}

.status-offline {
    color: #3b0808;
    background: #ffb3b3;
}

.status-unknown {
    color: #3f2b04;
    background: #ffd89b;
}

#terminal {
    background: #020304;
    border-color: rgba(255, 255, 255, 0.2);
}

/* Full-height module layout: pin every module to bottom, scroll inside containers. */
.module-panel.active {
    height: 100%;
    min-height: 0;
    overflow: hidden;
    align-content: stretch;
}

.glass-card,
.table-wrap {
    min-height: 0;
}

.module-panel[data-panel="monitor"] {
    grid-template-rows:
        auto
        minmax(240px, 1.18fr)
        minmax(170px, 0.78fr)
        minmax(220px, 0.96fr);
    align-content: stretch;
    overflow: hidden;
}

.module-panel[data-panel="monitor"].active {
    overflow: hidden;
}

.monitor-metrics-card,
.monitor-alerts-card {
    min-height: 0;
    height: 100%;
    overflow: hidden;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
}

.monitor-metrics-card .table-wrap,
.monitor-alerts-card .table-wrap {
    min-height: 0;
    height: 100%;
    overflow: auto;
}

.monitor-agent-card {
    min-height: 0;
    height: 100%;
    overflow: hidden;
    display: grid;
    grid-template-rows: auto auto minmax(0, 1fr);
    align-content: stretch;
}

#agentCommandOutput {
    height: 100%;
    min-height: clamp(160px, 22vh, 260px);
    max-height: 100%;
    resize: none;
}

/* Login redesign for SE9: stable two-column layout with minimal text. */
@supports selector(html:has(body)) {
    html:has(body.login-page) {
        height: 100%;
        overflow: hidden;
        background: #07111d;
    }
}

body.login-page {
    height: 100vh;
    min-height: 100vh;
    overflow: hidden;
    color-scheme: dark;
    color: #e7f3ff;
    background:
        radial-gradient(circle at 16% 18%, rgba(29, 104, 255, 0.16), transparent 24%),
        radial-gradient(circle at 78% 24%, rgba(0, 208, 255, 0.14), transparent 18%),
        radial-gradient(circle at 54% 60%, rgba(18, 63, 120, 0.3), transparent 34%),
        linear-gradient(140deg, #030914 0%, #08131f 38%, #0a1c2e 72%, #040a12 100%);
}

body.login-page * {
    scrollbar-width: none;
}

body.login-page *::-webkit-scrollbar {
    width: 0;
    height: 0;
}

body.login-page input,
body.login-page textarea,
body.login-page select {
    color: #eaf6ff;
}

body.login-page input:-webkit-autofill,
body.login-page input:-webkit-autofill:hover,
body.login-page input:-webkit-autofill:focus,
body.login-page textarea:-webkit-autofill,
body.login-page textarea:-webkit-autofill:hover,
body.login-page textarea:-webkit-autofill:focus {
    -webkit-text-fill-color: #eaf6ff;
    -webkit-box-shadow: 0 0 0 1000px rgba(8, 21, 36, 0.96) inset;
}

.login-showcase {
    position: relative;
    display: grid;
    place-items: center;
    width: 100%;
    height: 100vh;
    padding: clamp(24px, 4vw, 40px);
    overflow: hidden;
    isolation: isolate;
}

.login-showcase::before {
    content: "";
    position: absolute;
    inset: 0;
    background:
        linear-gradient(rgba(85, 137, 216, 0.05) 1px, transparent 1px),
        linear-gradient(90deg, rgba(85, 137, 216, 0.05) 1px, transparent 1px);
    background-size: 72px 72px;
    opacity: 0.24;
    z-index: -3;
}

.login-showcase::after {
    content: "";
    position: absolute;
    left: 50%;
    top: 50%;
    width: min(54vw, 780px);
    aspect-ratio: 1;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    background: radial-gradient(circle, rgba(56, 148, 255, 0.16), rgba(7, 21, 35, 0.03) 42%, transparent 74%);
    filter: blur(42px);
    z-index: -2;
}

.login-ambient {
    position: absolute;
    border-radius: 50%;
    pointer-events: none;
    z-index: -1;
    filter: blur(16px);
}

.login-ambient--one {
    top: -6%;
    right: 18%;
    width: clamp(220px, 30vw, 440px);
    height: clamp(220px, 30vw, 440px);
    background: radial-gradient(circle, rgba(39, 147, 255, 0.22), transparent 68%);
}

.login-ambient--two {
    left: -10%;
    bottom: -12%;
    width: clamp(260px, 36vw, 520px);
    height: clamp(260px, 36vw, 520px);
    background: radial-gradient(circle, rgba(0, 220, 188, 0.16), transparent 70%);
}

.login-hero {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.login-stage {
    position: absolute;
    left: 50%;
    top: 50%;
    width: min(72vw, 900px);
    aspect-ratio: 1;
    transform: translate(-50%, -50%);
    background: none;
    border: 0;
    box-shadow: none;
    overflow: visible;
}

.login-stage::before {
    content: "";
    position: absolute;
    inset: 24% 24%;
    border-radius: 50%;
    background:
        radial-gradient(circle, rgba(45, 145, 255, 0.14) 0%, rgba(45, 145, 255, 0.06) 30%, transparent 70%);
    filter: blur(6px);
}

.login-stage::after {
    display: none;
}

.login-stage__glow {
    position: absolute;
    inset: 20%;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(35, 137, 255, 0.24), transparent 66%);
    filter: blur(24px);
}

.login-stage__core,
.login-stage__beam,
.login-stage__core-ring,
.login-stage__pulse,
.login-stage__node {
    position: absolute;
}

.login-stage__core {
    left: 50%;
    top: 50%;
    width: 14%;
    aspect-ratio: 1;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    background:
        radial-gradient(circle at 35% 35%, rgba(255, 255, 255, 0.95) 0 12%, transparent 13%),
        radial-gradient(circle at 63% 36%, rgba(255, 255, 255, 0.9) 0 10%, transparent 11%),
        radial-gradient(circle at 42% 60%, rgba(255, 255, 255, 0.92) 0 10%, transparent 11%),
        radial-gradient(circle at 58% 62%, rgba(255, 255, 255, 0.9) 0 9%, transparent 10%),
        radial-gradient(circle, rgba(223, 247, 255, 0.9) 0%, rgba(97, 206, 255, 0.92) 34%, rgba(25, 124, 226, 0.95) 72%, rgba(25, 124, 226, 0.18) 100%);
    box-shadow:
        0 0 30px rgba(98, 191, 255, 0.82),
        0 0 80px rgba(31, 120, 255, 0.3);
}

.login-stage__beam--x {
    left: 26%;
    right: 26%;
    top: 50%;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(96, 184, 255, 0.28), transparent);
}

.login-stage__beam--y {
    top: 26%;
    bottom: 26%;
    left: 50%;
    width: 1px;
    background: linear-gradient(180deg, transparent, rgba(32, 207, 255, 0.24), transparent);
}

.login-stage__core-ring {
    left: 50%;
    top: 50%;
    border-radius: 50%;
    transform: translate(-50%, -50%);
}

.login-stage__core-ring--outer {
    width: 34%;
    aspect-ratio: 1;
    border: 1px solid rgba(89, 154, 230, 0.22);
    animation: ringRotate 20s linear infinite;
}

.login-stage__core-ring--middle {
    width: 24%;
    aspect-ratio: 1;
    border: 1px dashed rgba(0, 213, 197, 0.24);
    animation: ringRotateReverse 16s linear infinite;
}

.login-stage__core-ring--inner {
    width: 16%;
    aspect-ratio: 1;
    border: 1px solid rgba(168, 221, 255, 0.26);
}

.login-stage__pulse {
    left: 50%;
    top: 50%;
    width: 20%;
    aspect-ratio: 1;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    border: 1px solid rgba(89, 189, 255, 0.24);
    animation: pulseExpand 2.8s ease-out infinite;
}

.login-stage__node {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #d7f5ff;
    box-shadow: 0 0 14px rgba(90, 201, 255, 0.7);
}

.login-stage__node::before {
    content: "";
    position: absolute;
    inset: -14px;
    border-radius: 50%;
    border: 1px solid rgba(104, 183, 255, 0.12);
}

.login-stage__node--a {
    left: 50%;
    top: 34%;
    transform: translateX(-50%);
}

.login-stage__node--b {
    right: 38%;
    top: 44%;
}

.login-stage__node--c {
    right: 42%;
    bottom: 40%;
}

.login-stage__node--d {
    left: 42%;
    bottom: 40%;
}

.login-stage__node--e {
    left: 38%;
    top: 44%;
}

.login-stage__node--f {
    left: 50%;
    bottom: 34%;
    transform: translateX(-50%);
}

body.login-page .login-card {
    position: relative;
    width: min(430px, 100%);
    justify-self: center;
    padding: 30px;
    border-radius: 32px;
    border: 1px solid rgba(103, 160, 236, 0.16);
    background:
        linear-gradient(180deg, rgba(9, 21, 36, 0.94), rgba(7, 17, 29, 0.86)),
        radial-gradient(circle at 100% 0%, rgba(33, 120, 205, 0.08), transparent 34%);
    box-shadow:
        0 28px 72px rgba(0, 0, 0, 0.34),
        inset 0 1px 0 rgba(157, 214, 255, 0.08);
    backdrop-filter: blur(22px);
}

body.login-page .login-card::before {
    content: "";
    position: absolute;
    inset: 14px;
    border-radius: 24px;
    border: 1px solid rgba(137, 193, 255, 0.08);
    pointer-events: none;
}

.login-card__head,
.login-card__footer {
    position: relative;
    z-index: 1;
}

.login-card__head {
    margin-bottom: 20px;
}

.login-card__brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 18px;
    color: #79ccff;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.18em;
    text-transform: uppercase;
}

.login-card__brand-mark {
    width: 12px;
    height: 12px;
    border-radius: 4px;
    background: linear-gradient(135deg, #36cfff, #1992ff);
    box-shadow: 0 0 14px rgba(48, 180, 255, 0.6);
}

body.login-page .login-card h1 {
    margin: 0;
    font-family: "Rajdhani", "Noto Sans SC", sans-serif;
    font-size: clamp(40px, 4vw, 50px);
    line-height: 0.94;
    font-weight: 700;
    letter-spacing: 0.02em;
    color: #f2fbff;
}

body.login-page .subtitle {
    margin-top: 12px;
    margin-bottom: 0;
    color: #8eaec8;
    font-size: 14px;
    line-height: 1.7;
}

body.login-page .form-error {
    position: relative;
    z-index: 1;
    margin-bottom: 16px;
    border-radius: 16px;
    border: 1px solid rgba(255, 107, 107, 0.22);
    background: rgba(164, 32, 40, 0.12);
    color: #ffb0b5;
    padding: 12px 14px;
    font-size: 14px;
}

body.login-page .login-form {
    position: relative;
    z-index: 1;
    display: grid;
    gap: 14px;
}

body.login-page .login-form label {
    margin-top: 6px;
    color: #8faed0;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.16em;
    text-transform: uppercase;
}

body.login-page .login-form input {
    border: 1px solid rgba(92, 146, 214, 0.14);
    border-radius: 18px;
    padding: 15px 17px;
    background: rgba(36, 53, 78, 0.76);
    box-shadow:
        inset 0 1px 0 rgba(166, 215, 255, 0.05),
        0 10px 24px rgba(0, 0, 0, 0.08);
}

body.login-page .login-form input::placeholder {
    color: #8ea2bd;
}

body.login-page .login-form input:focus {
    border-color: rgba(85, 187, 255, 0.56);
    box-shadow:
        0 0 0 4px rgba(49, 137, 255, 0.14),
        0 0 32px rgba(0, 200, 255, 0.1);
}

body.login-page .login-form button {
    margin-top: 14px;
    padding: 16px 18px;
    border-radius: 20px;
    background: linear-gradient(135deg, #1795ff, #36cfff 60%, #19f0d1 100%);
    color: #03101a;
    box-shadow: 0 18px 34px rgba(20, 141, 255, 0.26);
    font-weight: 800;
    transition:
        transform 180ms ease,
        box-shadow 180ms ease,
        filter 180ms ease;
}

body.login-page .login-form button:hover {
    transform: translateY(-1px);
    filter: brightness(1.03);
    box-shadow: 0 22px 40px rgba(20, 141, 255, 0.32);
}

body.login-page .login-form button:active {
    transform: translateY(0);
}

.login-card__footer {
    margin-top: 20px;
}

body.login-page .hint {
    margin-top: 0;
    color: #7f98b4;
    font-size: 13px;
}

@keyframes ringRotate {
    from {
        transform: translate(-50%, -50%) rotate(0deg);
    }
    to {
        transform: translate(-50%, -50%) rotate(360deg);
    }
}

@keyframes ringRotateReverse {
    from {
        transform: translate(-50%, -50%) rotate(360deg);
    }
    to {
        transform: translate(-50%, -50%) rotate(0deg);
    }
}

@keyframes pulseExpand {
    0% {
        opacity: 0.72;
        transform: translate(-50%, -50%) scale(0.84);
    }
    100% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(1.18);
    }
}

@media (max-width: 1080px) {
    .login-showcase {
        padding: 18px;
    }

    .login-stage {
        width: min(90vw, 720px);
    }

    body.login-page .login-card {
        width: min(100%, 520px);
        justify-self: center;
    }
}

@media (max-width: 560px) {
    .login-showcase {
        padding: 14px;
    }

    .login-stage {
        width: min(120vw, 560px);
    }

    body.login-page .login-card {
        padding: 22px 18px;
        border-radius: 24px;
    }

    body.login-page .login-card::before {
        inset: 10px;
        border-radius: 16px;
    }

    body.login-page .login-card h1 {
        font-size: 36px;
    }
}

.module-panel[data-panel="devices"] {
    grid-template-rows: minmax(0, 1fr);
}

.workspace-grid {
    min-height: 0;
    height: 100%;
}

.device-panel,
.form-panel {
    min-height: 0;
    height: 100%;
}

.device-panel {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
}

.device-panel table {
    min-width: 1420px;
}

.device-panel .table-wrap {
    overflow: auto;
}

.form-panel {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
}

.form-panel .device-form {
    min-height: 0;
    overflow: auto;
    align-content: start;
    padding-right: 4px;
}

#description {
    min-height: 108px;
}

.module-panel[data-panel="license"] {
    grid-template-rows: minmax(0, 1fr);
    min-height: 0;
    overflow: hidden;
}

.module-panel[data-panel="license"].active {
    display: grid;
    grid-template-rows: minmax(0, 1fr);
    align-items: stretch;
    align-content: stretch;
    min-height: 0;
    height: 100%;
}

.license-frame-card {
    min-height: 0;
    height: 100%;
    padding: 0;
    overflow: hidden;
    display: grid;
    grid-template-rows: minmax(0, 1fr);
    align-self: stretch;
}

.license-frame-card > .license-tool-shell {
    min-height: 0;
    height: 100%;
}

.module-panel[data-panel="terminal"] {
    grid-template-rows: minmax(0, 1fr);
    height: 100%;
}

.terminal-card {
    min-height: 0;
    height: 100%;
    max-height: 100%;
    display: grid;
    grid-template-rows: auto auto minmax(0, 1fr) auto;
    overflow: hidden;
}

#terminal {
    height: 100%;
    min-height: 320px;
}

.module-panel[data-panel="ota"] {
    grid-template-columns: minmax(0, 1.18fr) minmax(360px, 0.82fr);
    grid-template-rows: minmax(360px, 0.95fr) minmax(320px, 1.05fr);
    grid-template-areas:
        "config library"
        "tasks tasks";
    overflow: hidden;
}

.ota-config-card,
.release-library-card,
.ota-task-card {
    min-height: 0;
    height: 100%;
}

.ota-config-card {
    grid-area: config;
    display: block;
    overflow: auto;
}

.release-library-card {
    grid-area: library;
    display: grid;
    grid-template-rows: auto auto auto minmax(0, 1fr) auto;
    overflow: hidden;
}

.release-library-card .table-wrap {
    overflow: auto;
}

.ota-task-card {
    grid-area: tasks;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto minmax(120px, 0.8fr);
    overflow: hidden;
}

.ota-task-card .table-wrap {
    overflow: auto;
}

.ota-device-list {
    max-height: none;
    min-height: 140px;
    height: auto;
}

#otaTaskOutput {
    min-height: 160px;
    height: 100%;
    max-height: 100%;
    resize: none;
}

.module-panel[data-panel="audit"] {
    grid-template-rows: minmax(0, 1fr);
}

.audit-card {
    min-height: 0;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
}

.audit-card .table-wrap {
    overflow: auto;
}

@media (max-width: 1320px) {
    .module-panel.active {
        overflow: auto;
        align-content: start;
    }

    .module-panel[data-panel="monitor"],
    .module-panel[data-panel="devices"],
    .module-panel[data-panel="license"],
    .module-panel[data-panel="terminal"],
    .module-panel[data-panel="ota"],
    .module-panel[data-panel="audit"] {
        grid-template-rows: none;
    }

    .workspace-grid,
    .device-panel,
    .form-panel,
    .license-table-card,
    .license-guide-card,
    .terminal-card,
    .ota-config-card,
    .release-library-card,
    .ota-task-card,
    .audit-card {
        height: auto;
    }

    #terminal {
        min-height: 290px;
    }
}

@media (max-width: 1320px) {
    .module-panel[data-panel="license"] {
        overflow: auto;
    }

    .module-panel[data-panel="ota"] {
        grid-template-columns: 1fr;
        grid-template-rows: auto auto minmax(0, 1fr);
        grid-template-areas:
            "config"
            "library"
            "tasks";
        overflow: auto;
    }
}

.module-panel[data-panel="screen"] {
    grid-template-rows: minmax(0, 1fr);
    overflow: hidden;
}

.module-panel[data-panel="screen"].active {
    overflow: hidden;
    align-content: stretch;
}

.bigscreen-shell {
    position: relative;
    min-height: 0;
    height: 100%;
    border-radius: 24px;
    padding: 18px;
    overflow: hidden;
    border: 1px solid rgba(120, 190, 255, 0.28);
    background:
        radial-gradient(circle at 50% 16%, rgba(114, 178, 255, 0.12), transparent 26%),
        radial-gradient(circle at 18% 82%, rgba(84, 170, 255, 0.08), transparent 28%),
        linear-gradient(180deg, rgba(3, 6, 11, 0.96), rgba(3, 5, 10, 0.98));
    box-shadow:
        inset 0 0 0 1px rgba(255, 255, 255, 0.02),
        0 24px 46px rgba(0, 0, 0, 0.45);
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    gap: 18px;
}

.ops-layout.screen-mode .bigscreen-shell {
    height: 100vh;
    border-radius: 0;
    border-left: 0;
    border-right: 0;
    padding: 18px 18px 16px;
    gap: 16px;
}

.bigscreen-shell::before {
    content: "";
    position: absolute;
    inset: 10px;
    border-radius: 20px;
    border: 1px solid rgba(117, 188, 255, 0.12);
    pointer-events: none;
}

.ops-layout.screen-mode .bigscreen-shell::before {
    inset: 12px;
    border-radius: 18px;
}

.bigscreen-shell::after {
    content: "";
    position: absolute;
    inset: 0;
    background:
        linear-gradient(transparent 39px, rgba(116, 171, 216, 0.035) 40px),
        linear-gradient(90deg, transparent 39px, rgba(116, 171, 216, 0.035) 40px);
    background-size: 40px 40px;
    opacity: 0.35;
    pointer-events: none;
}

.bigscreen-banner {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    align-items: center;
    gap: 14px;
    padding-right: 238px;
}

.screen-shell-actions {
    position: absolute;
    top: 18px;
    right: 18px;
    z-index: 5;
    display: flex;
    align-items: center;
    gap: 10px;
}

.screen-shell-actions form {
    margin: 0;
}

.screen-shell-btn {
    appearance: none;
    border: 1px solid rgba(126, 198, 255, 0.22);
    border-radius: 999px;
    padding: 9px 16px;
    background: rgba(7, 12, 18, 0.88);
    color: #dff1ff;
    cursor: pointer;
    font-size: 13px;
    letter-spacing: 0.04em;
    transition: border-color 0.2s ease, background 0.2s ease, transform 0.2s ease;
}

.screen-shell-btn:hover {
    border-color: rgba(126, 198, 255, 0.46);
    background: rgba(84, 168, 255, 0.14);
    transform: translateY(-1px);
}

.screen-shell-btn.ghost {
    background: rgba(8, 11, 16, 0.82);
}

.screen-banner-side {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.screen-banner-side.align-right {
    justify-content: flex-end;
}

.screen-banner-chip {
    appearance: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 12px;
    border-radius: 999px;
    border: 1px solid rgba(127, 198, 255, 0.28);
    background: linear-gradient(180deg, rgba(18, 30, 48, 0.82), rgba(7, 13, 20, 0.9));
    color: #cfe7ff;
    font-size: 12px;
    letter-spacing: 0.08em;
    cursor: pointer;
    transition: border-color 0.2s ease, background 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.screen-banner-chip:hover,
.screen-stage-chip:hover {
    border-color: rgba(126, 198, 255, 0.44);
    background: rgba(84, 168, 255, 0.12);
    color: #f2f7ff;
    transform: translateY(-1px);
}

.screen-banner-chip.active {
    color: #f2f7ff;
    background: rgba(84, 168, 255, 0.16);
    border-color: rgba(123, 188, 255, 0.34);
}

.screen-shell-btn:focus-visible,
.screen-banner-chip:focus-visible,
.screen-stage-chip:focus-visible {
    outline: 2px solid rgba(126, 198, 255, 0.5);
    outline-offset: 2px;
}

.screen-banner-title {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    min-width: 0;
}

.screen-banner-wave {
    width: min(18vw, 160px);
    height: 16px;
    border-top: 1px solid rgba(126, 198, 255, 0.7);
    border-bottom: 1px solid rgba(126, 198, 255, 0.18);
    border-radius: 999px;
    background: linear-gradient(90deg, transparent 0%, rgba(126, 198, 255, 0.55) 50%, transparent 100%);
    opacity: 0.9;
}

.screen-banner-title div {
    min-width: 0;
    text-align: center;
}

.screen-banner-title h3 {
    font-family: "Rajdhani", "Noto Sans SC", sans-serif;
    font-size: clamp(30px, 2.7vw, 48px);
    line-height: 1;
    letter-spacing: 0.12em;
    color: #f2f7ff;
    text-shadow: 0 0 24px rgba(116, 182, 255, 0.25);
}

.screen-banner-title p {
    margin-top: 6px;
    font-size: 12px;
    letter-spacing: 0.35em;
    color: rgba(190, 212, 235, 0.72);
}

.bigscreen-grid {
    position: relative;
    z-index: 1;
    min-height: 0;
    display: grid;
    grid-template-columns: 300px minmax(0, 1fr) 300px;
    gap: 14px;
}

.ops-layout.screen-mode .bigscreen-grid {
    grid-template-columns: minmax(280px, 0.8fr) minmax(0, 1.78fr) minmax(280px, 0.82fr);
    gap: 16px;
}

.bigscreen-column,
.bigscreen-center {
    min-height: 0;
    display: grid;
    gap: 16px;
}

.bigscreen-column {
    grid-auto-rows: minmax(0, auto);
}

.bigscreen-column-left {
    grid-template-rows: minmax(0, 1fr) minmax(0, 0.78fr) minmax(0, 1.22fr);
}

.bigscreen-column-right {
    grid-template-rows: auto minmax(0, 1fr);
}

.bigscreen-center {
    grid-template-rows: minmax(0, 1fr);
}

.screen-card,
.screen-alert-strip,
.screen-stage {
    position: relative;
    border-radius: 20px;
    overflow: hidden;
    border: 1px solid rgba(123, 188, 255, 0.2);
    background:
        linear-gradient(180deg, rgba(7, 11, 18, 0.94), rgba(3, 6, 11, 0.96));
    box-shadow:
        inset 0 0 24px rgba(95, 163, 255, 0.05),
        0 14px 28px rgba(0, 0, 0, 0.28);
}

.screen-card::before,
.screen-alert-strip::before,
.screen-stage::before {
    content: "";
    position: absolute;
    top: 0;
    left: 18px;
    width: 88px;
    height: 2px;
    border-radius: 999px;
    background: linear-gradient(90deg, rgba(135, 211, 255, 0.9), transparent);
    pointer-events: none;
}

.screen-card {
    padding: 16px;
}

.ops-layout.screen-mode .screen-card {
    padding: 16px;
}

.screen-overview-card,
.screen-radar-card,
.screen-status-panel,
.screen-online-card {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    min-height: 0;
}

.screen-overview-card {
    grid-template-rows: auto minmax(0, 1fr) auto;
}

.screen-radar-card .screen-card-title {
    margin-bottom: 4px;
}

.screen-card-title {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 12px;
}

.screen-card-title.slim {
    margin-top: 14px;
    margin-bottom: 12px;
}

.screen-card-title h3 {
    font-family: "Rajdhani", "Noto Sans SC", sans-serif;
    font-size: clamp(21px, 1.45vw, 26px);
    letter-spacing: 0.05em;
    color: #e9f4ff;
}

.screen-card-title span {
    font-size: 12px;
    color: rgba(170, 196, 221, 0.7);
    letter-spacing: 0.08em;
}

.screen-twin-metrics {
    display: grid;
    gap: 12px;
}

.screen-twin-metrics.compact {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.screen-metric-card {
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr);
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border-radius: 16px;
    border: 1px solid rgba(122, 187, 255, 0.16);
    background: rgba(7, 12, 18, 0.8);
}

.screen-metric-icon {
    width: 44px;
    height: 44px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    font-family: "Rajdhani", "Noto Sans SC", sans-serif;
    font-size: 22px;
    font-weight: 700;
    color: #eff7ff;
    background: radial-gradient(circle at 30% 30%, rgba(160, 219, 255, 0.32), rgba(74, 138, 255, 0.18));
    border: 1px solid rgba(129, 197, 255, 0.34);
    box-shadow: 0 0 22px rgba(81, 160, 255, 0.18);
}

.screen-metric-icon.alert {
    background: radial-gradient(circle at 30% 30%, rgba(255, 159, 159, 0.36), rgba(255, 89, 104, 0.18));
    border-color: rgba(255, 116, 141, 0.42);
}

.screen-metric-icon.online {
    background: radial-gradient(circle at 30% 30%, rgba(171, 255, 223, 0.34), rgba(45, 212, 149, 0.16));
    border-color: rgba(93, 255, 188, 0.38);
}

.screen-metric-card p,
.screen-status-card p {
    font-size: 13px;
    color: rgba(176, 198, 221, 0.78);
}

.screen-metric-card strong {
    display: block;
    margin-top: 4px;
    font-family: "Rajdhani", "Noto Sans SC", sans-serif;
    font-size: 30px;
    line-height: 1;
    color: #f4f8ff;
}

.screen-metric-card span,
.screen-status-card span {
    display: block;
    margin-top: 4px;
    font-size: 12px;
    color: rgba(143, 170, 198, 0.76);
}

.screen-overview-meta {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin-top: 0;
}

.screen-overview-meta div,
.screen-online-row {
    padding: 12px 14px;
    border-radius: 14px;
    border: 1px solid rgba(123, 188, 255, 0.14);
    background: rgba(7, 12, 18, 0.76);
}

.screen-overview-meta span {
    display: block;
    font-size: 12px;
    color: rgba(172, 196, 220, 0.72);
}

.screen-overview-meta b {
    display: block;
    margin-top: 6px;
    color: #edf5ff;
    font-family: "Rajdhani", "Noto Sans SC", sans-serif;
    font-size: 18px;
    line-height: 1.2;
}

.screen-load-panel {
    display: grid;
    grid-template-columns: 156px minmax(0, 1fr);
    align-items: center;
    gap: 12px;
}

.screen-load-ring,
.screen-health-gauge,
.screen-mini-donut {
    position: relative;
    isolation: isolate;
}

.screen-load-ring {
    --value: 0;
    width: 156px;
    aspect-ratio: 1;
    border-radius: 50%;
    margin: 0 auto;
    background:
        conic-gradient(#71d7ff calc(var(--value) * 1turn), rgba(41, 58, 78, 0.85) 0);
    display: grid;
    place-items: center;
    box-shadow:
        0 0 36px rgba(69, 151, 255, 0.16),
        inset 0 0 26px rgba(113, 215, 255, 0.1);
}

.screen-load-ring::before,
.screen-health-gauge::before,
.screen-mini-donut::before {
    content: "";
    position: absolute;
    inset: 13px;
    border-radius: 50%;
    background: radial-gradient(circle at 50% 42%, rgba(12, 17, 26, 0.98), rgba(4, 7, 12, 0.98));
    border: 1px solid rgba(123, 188, 255, 0.12);
    z-index: 0;
}

.screen-load-ring::after {
    content: "";
    position: absolute;
    inset: 26px;
    border-radius: 50%;
    border: 1px solid rgba(123, 188, 255, 0.14);
    box-shadow: inset 0 0 18px rgba(113, 215, 255, 0.08);
}

.screen-load-core,
.screen-health-inner,
.screen-mini-donut strong {
    position: relative;
    z-index: 1;
}

.screen-load-core {
    text-align: center;
}

.screen-load-core strong {
    display: block;
    font-family: "Rajdhani", "Noto Sans SC", sans-serif;
    font-size: 34px;
    color: #f3f8ff;
    line-height: 1;
}

.screen-load-core span {
    display: block;
    margin-top: 4px;
    font-size: 12px;
    letter-spacing: 0.08em;
    color: rgba(153, 178, 204, 0.74);
}

.screen-load-list {
    display: grid;
    gap: 10px;
}

.screen-load-list div {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border-radius: 14px;
    border: 1px solid rgba(123, 188, 255, 0.14);
    background: rgba(7, 12, 18, 0.76);
}

.screen-load-list span,
.screen-health-details span,
.screen-stage-stat span {
    color: rgba(178, 201, 223, 0.78);
    font-size: 13px;
}

.screen-load-list b,
.screen-health-details b,
.screen-stage-stat strong,
.screen-ranking-head b {
    color: #f2f7ff;
    font-family: "Rajdhani", "Noto Sans SC", sans-serif;
    font-size: 24px;
    line-height: 1;
    font-weight: 700;
}

.screen-ranking-list,
.screen-online-list {
    display: grid;
    gap: 12px;
}

.screen-ranking-row {
    padding: 12px 14px;
    border-radius: 16px;
    border: 1px solid rgba(123, 188, 255, 0.14);
    background: rgba(7, 12, 18, 0.76);
}

.screen-ranking-head,
.screen-stage-head,
.screen-health-panel,
.screen-card-title {
    position: relative;
    z-index: 1;
}

.screen-ranking-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.screen-ranking-label {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.screen-ranking-label span {
    width: 28px;
    height: 28px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    border: 1px solid rgba(122, 186, 255, 0.2);
    background: rgba(8, 15, 24, 0.86);
    color: rgba(174, 204, 230, 0.82);
    font-size: 12px;
}

.screen-ranking-label strong {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 15px;
    color: #edf5ff;
}

.screen-ranking-row small {
    display: block;
    margin-top: 8px;
    color: rgba(145, 168, 191, 0.76);
    font-size: 12px;
}

.screen-ranking-bar {
    margin-top: 10px;
    height: 8px;
    overflow: hidden;
    border-radius: 999px;
    background: rgba(61, 81, 106, 0.45);
}

.screen-ranking-fill {
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #64c7ff 0%, #8ef2ff 100%);
    box-shadow: 0 0 18px rgba(118, 221, 255, 0.34);
}

.screen-alert-strip {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    gap: 14px;
    padding: 14px 18px;
}

.screen-alert-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 88px;
    padding: 8px 14px;
    border-radius: 999px;
    border: 1px solid rgba(255, 122, 144, 0.34);
    background: linear-gradient(180deg, rgba(73, 18, 28, 0.9), rgba(42, 12, 18, 0.9));
    color: #ffd7df;
    font-family: "Rajdhani", "Noto Sans SC", sans-serif;
    font-size: 22px;
    letter-spacing: 0.08em;
}

.screen-alert-track {
    overflow: hidden;
    min-width: 0;
}

.screen-alert-message {
    display: inline-block;
    min-width: 100%;
    white-space: nowrap;
    color: #d8ecff;
    font-size: 14px;
    letter-spacing: 0.04em;
    animation: screenTicker 20s linear infinite;
}

@keyframes screenTicker {
    from {
        transform: translateX(100%);
    }
    to {
        transform: translateX(-100%);
    }
}

.screen-stage {
    min-height: 0;
    padding: 16px;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
    gap: 14px;
}

.ops-layout.screen-mode .screen-stage {
    padding: 16px 16px 14px;
}

.screen-stage-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 14px;
}

.screen-stage-tabs {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.screen-stage-chip {
    appearance: none;
    padding: 7px 12px;
    border-radius: 999px;
    border: 1px solid rgba(123, 188, 255, 0.16);
    background: rgba(6, 12, 20, 0.82);
    color: rgba(183, 206, 229, 0.78);
    font-size: 12px;
    letter-spacing: 0.08em;
    cursor: pointer;
    transition: border-color 0.2s ease, background 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.screen-stage-chip.active {
    color: #f2f7ff;
    background: rgba(84, 168, 255, 0.16);
    border-color: rgba(123, 188, 255, 0.34);
}

.screen-stage-clock {
    text-align: right;
}

.screen-stage-clock span {
    display: block;
    font-size: 12px;
    color: rgba(154, 177, 201, 0.7);
}

.screen-stage-clock strong {
    display: block;
    margin-top: 4px;
    color: #f4f8ff;
    font-family: "Rajdhani", "Noto Sans SC", sans-serif;
    font-size: 24px;
    letter-spacing: 0.06em;
}

.screen-stage-map {
    position: relative;
    min-height: 0;
    border-radius: 22px;
    overflow: hidden;
    border: 1px solid rgba(123, 188, 255, 0.16);
    background:
        radial-gradient(circle at 50% 42%, rgba(61, 128, 212, 0.18), transparent 36%),
        linear-gradient(180deg, rgba(4, 7, 12, 0.96), rgba(2, 4, 8, 0.96));
}

.ops-layout.screen-mode .screen-stage-map {
    min-height: clamp(320px, 44vh, 470px);
}

.screen-stage-grid {
    position: absolute;
    inset: 0;
    background:
        linear-gradient(transparent 35px, rgba(118, 173, 216, 0.05) 36px),
        linear-gradient(90deg, transparent 35px, rgba(118, 173, 216, 0.05) 36px);
    background-size: 36px 36px;
    opacity: 0.55;
}

.screen-stage-glow {
    position: absolute;
    inset: 18% 20%;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(73, 153, 255, 0.18), transparent 72%);
    filter: blur(26px);
}

.screen-map-shadow {
    position: absolute;
    inset: 22% 20% 10%;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(72, 152, 255, 0.22), transparent 72%);
    filter: blur(34px);
}

.screen-map-chart {
    position: absolute;
    inset: 4% 1.5% 9%;
    z-index: 2;
    min-height: 0;
}

.screen-map-toggle {
    position: absolute;
    right: 18px;
    bottom: 46px;
    z-index: 3;
    width: 36px;
    height: 36px;
    display: grid;
    place-items: center;
    padding: 0;
    border-radius: 50%;
    border: 1px solid rgba(123, 188, 255, 0.16);
    background: rgba(4, 8, 14, 0.78);
    color: rgba(171, 198, 225, 0.76);
    backdrop-filter: blur(4px);
    cursor: pointer;
    transition:
        border-color 0.18s ease,
        color 0.18s ease,
        box-shadow 0.18s ease,
        background 0.18s ease;
}

.screen-map-toggle:hover,
.screen-map-toggle:focus-visible {
    border-color: rgba(123, 188, 255, 0.34);
    color: #e8f4ff;
    box-shadow: 0 0 18px rgba(105, 179, 255, 0.18);
    outline: none;
}

.screen-map-toggle.active {
    color: #8de7ff;
    border-color: rgba(120, 234, 255, 0.34);
    background: rgba(7, 15, 22, 0.92);
    box-shadow:
        0 0 18px rgba(112, 223, 255, 0.2),
        inset 0 0 12px rgba(112, 223, 255, 0.08);
}

.screen-map-toggle-icon {
    width: 18px;
    height: 18px;
}

.screen-map-toggle .icon-visible {
    display: none;
}

.screen-map-toggle .icon-hidden {
    display: block;
}

.screen-map-toggle.active .icon-visible {
    display: block;
}

.screen-map-toggle.active .icon-hidden {
    display: none;
}

.screen-map-legend {
    position: absolute;
    left: 18px;
    bottom: 16px;
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
    color: rgba(175, 199, 223, 0.78);
    font-size: 12px;
}

.screen-map-legend span {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.screen-map-legend i {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
}

.screen-map-legend i.online {
    background: #81ffe2;
}

.screen-map-legend i.offline {
    background: #ff9cab;
}

.screen-map-legend i.never {
    background: #ffd8a0;
}

.screen-map-legend i.disabled {
    background: #b5bfd0;
}

.screen-stage-summary {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
}

.screen-stage-stat {
    padding: 12px 14px;
    border-radius: 16px;
    border: 1px solid rgba(123, 188, 255, 0.14);
    background: rgba(7, 12, 18, 0.76);
}

.screen-stage-stat strong {
    display: block;
    margin-top: 6px;
    font-size: 28px;
}

.screen-health-panel {
    display: grid;
    grid-template-columns: 130px minmax(0, 1fr);
    align-items: center;
    gap: 12px;
}

.screen-health-gauge {
    --value: 0;
    width: 130px;
    aspect-ratio: 1;
    border-radius: 50%;
    margin: 0 auto;
    background: conic-gradient(#77d3ff calc(var(--value) * 1turn), rgba(38, 55, 74, 0.8) 0);
    display: grid;
    place-items: center;
    box-shadow:
        0 0 28px rgba(85, 166, 255, 0.16),
        inset 0 0 20px rgba(119, 211, 255, 0.08);
}

.screen-health-inner {
    display: grid;
    gap: 4px;
    text-align: center;
}

.screen-health-inner strong {
    font-family: "Rajdhani", "Noto Sans SC", sans-serif;
    font-size: 26px;
    color: #f3f8ff;
    line-height: 1;
}

.screen-health-inner span {
    font-size: 12px;
    color: rgba(166, 189, 212, 0.76);
}

.screen-health-details {
    display: grid;
    gap: 8px;
}

.screen-health-details div {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 14px;
    border: 1px solid rgba(123, 188, 255, 0.14);
    background: rgba(7, 12, 18, 0.76);
}

.screen-health-details b {
    font-size: 16px;
    text-align: right;
    line-height: 1.2;
}

.screen-radar-wrap {
    position: relative;
    min-height: 0;
    height: 100%;
    padding: 0 14px 20px;
    display: grid;
    place-items: start center;
    align-content: start;
    overflow: visible;
}

.screen-radar-svg {
    display: block;
    width: auto;
    max-width: min(100%, 220px);
    height: 100%;
    max-height: 176px;
    transform: translateY(-24px);
    overflow: visible;
}

.screen-radar-grid,
.screen-radar-axis-line {
    fill: none;
    stroke: rgba(126, 189, 255, 0.18);
    stroke-width: 1;
}

.screen-radar-area {
    fill: rgba(109, 204, 255, 0.22);
    stroke: #9ae5ff;
    stroke-width: 2;
    filter: drop-shadow(0 0 10px rgba(108, 204, 255, 0.26));
}

.screen-radar-axis-text {
    fill: rgba(177, 202, 227, 0.82);
    font-size: 11.5px;
    font-weight: 600;
    letter-spacing: 0.02em;
    dominant-baseline: middle;
}

.screen-status-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-rows: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin-top: 2px;
    min-height: 0;
    height: 100%;
}

.screen-status-card {
    min-height: 0;
    display: grid;
    grid-template-rows: auto auto;
    align-content: center;
    justify-items: center;
    gap: 6px;
    padding: 10px 8px;
    border-radius: 16px;
    border: 1px solid rgba(123, 188, 255, 0.14);
    background: rgba(7, 12, 18, 0.76);
    text-align: center;
}

.screen-mini-donut {
    --value: 0;
    width: 68px;
    aspect-ratio: 1;
    margin: 0 auto 4px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: conic-gradient(var(--donut-color) calc(var(--value) * 1turn), rgba(41, 58, 78, 0.8) 0);
    box-shadow: inset 0 0 22px rgba(255, 255, 255, 0.02);
}

.screen-mini-donut::before {
    inset: 10px;
}

.screen-mini-donut.online {
    --donut-color: #78ffd9;
}

.screen-mini-donut.offline {
    --donut-color: #ff9dad;
}

.screen-mini-donut.never {
    --donut-color: #ffd7a2;
}

.screen-mini-donut.disabled {
    --donut-color: #bcc5d2;
}

.screen-mini-donut strong {
    display: block;
    font-family: "Rajdhani", "Noto Sans SC", sans-serif;
    font-size: 18px;
    color: #f4f8ff;
    line-height: 1;
}

.screen-status-card p {
    font-size: 12px;
}

.screen-status-card span {
    margin-top: 0;
    font-size: 11px;
}

.screen-status-meta {
    display: inline-flex;
    align-items: baseline;
    justify-content: center;
    gap: 6px;
    white-space: nowrap;
}

.screen-status-meta p,
.screen-status-meta span {
    display: inline;
    margin: 0;
}

.screen-online-list {
    align-content: start;
    min-height: 0;
    overflow: auto;
    padding-right: 4px;
}

.screen-online-row {
    display: grid;
}

.screen-online-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.screen-online-title {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.screen-online-badge {
    width: 26px;
    height: 26px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: rgba(114, 255, 210, 0.14);
    border: 1px solid rgba(114, 255, 210, 0.26);
    color: #86ffe0;
    font-size: 12px;
    flex: none;
}

.screen-online-title strong,
.screen-online-time strong {
    color: #edf5ff;
}

.screen-online-title strong {
    display: block;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 14px;
}

.screen-online-title small,
.screen-online-time span {
    display: block;
    color: rgba(156, 183, 208, 0.76);
    font-size: 12px;
}

.screen-online-time {
    flex: none;
    text-align: right;
    white-space: nowrap;
}

.screen-online-time strong {
    display: block;
    margin-top: 4px;
    font-size: 13px;
    line-height: 1.2;
}

@media (max-width: 1640px) {
    .bigscreen-grid {
        grid-template-columns: 288px minmax(0, 1fr) 288px;
    }

    .screen-banner-chip {
        padding-inline: 10px;
    }
}

@media (max-width: 1320px) {
    .module-panel[data-panel="screen"].active {
        overflow: auto;
    }

    .ops-layout.screen-mode {
        height: auto;
        overflow: auto;
    }

    .ops-layout.screen-mode .module-panel[data-panel="screen"].active {
        overflow: auto;
    }

    .bigscreen-shell {
        min-height: 100%;
        height: auto;
    }

    .ops-layout.screen-mode .bigscreen-shell {
        min-height: 100vh;
        height: auto;
    }

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

    .bigscreen-center {
        order: -1;
    }
}

@media (max-width: 900px) {
    .bigscreen-banner {
        padding-right: 0;
    }

    .screen-shell-actions {
        position: static;
        justify-content: flex-end;
        margin-bottom: 4px;
    }

    .screen-banner-title {
        gap: 10px;
    }

    .screen-banner-wave {
        width: 72px;
    }

    .screen-load-panel,
    .screen-health-panel {
        grid-template-columns: 1fr;
    }

    .screen-twin-metrics.compact,
    .screen-overview-meta {
        grid-template-columns: 1fr;
    }

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

@media (max-width: 640px) {
    .bigscreen-shell {
        padding: 12px;
        gap: 12px;
    }

    .ops-layout.screen-mode .bigscreen-shell {
        padding: 12px;
    }

    .bigscreen-banner {
        grid-template-columns: 1fr;
        justify-items: center;
    }

    .screen-shell-actions {
        width: 100%;
        justify-content: center;
        flex-wrap: wrap;
    }

    .screen-banner-side,
    .screen-banner-side.align-right {
        justify-content: center;
    }

    .screen-banner-title {
        width: 100%;
    }

    .screen-banner-title h3 {
        font-size: 24px;
    }

    .screen-card,
    .screen-stage {
        padding: 12px;
    }

    .screen-alert-strip {
        grid-template-columns: 1fr;
        justify-items: start;
    }

    .screen-stage-head {
        flex-direction: column;
        align-items: flex-start;
    }

    .screen-stage-map {
        min-height: 360px;
    }

    .screen-map-chart {
        inset: 10% 3% 16%;
    }

    .screen-stage-summary,
    .screen-status-grid {
        grid-template-columns: 1fr;
    }

    .screen-radar-svg {
        max-width: 100%;
        max-height: 194px;
        transform: translateY(-16px);
    }
}

/* Dashboard visual sync: align the legacy control console with the sc-datav screen. */
.ops-layout {
    --bg-main: #000000;
    --bg-body-solid: #000000;
    --bg-panel: linear-gradient(180deg, rgba(4, 9, 24, 0.94), rgba(0, 0, 0, 0.96));
    --bg-panel-soft: linear-gradient(180deg, rgba(6, 12, 32, 0.92), rgba(0, 0, 0, 0.95));
    --line: rgba(189, 207, 255, 0.24);
    --line-strong: rgba(48, 97, 219, 0.8);
    --text-main: #e8efff;
    --text-sub: rgba(232, 239, 255, 0.72);
    --text-muted: rgba(189, 207, 255, 0.58);
    --accent: #3061db;
    --accent-strong: #bdcfff;
    --shadow: 0 24px 68px rgba(0, 0, 0, 0.62);
    grid-template-columns: 250px 1fr;
    gap: 18px;
    padding: 18px;
    background:
        radial-gradient(circle at 52% 44%, rgba(48, 97, 219, 0.13), transparent 32%),
        radial-gradient(circle at 9% 12%, rgba(189, 207, 255, 0.08), transparent 24%),
        linear-gradient(rgba(48, 97, 219, 0.045) 1px, transparent 1px),
        linear-gradient(90deg, rgba(48, 97, 219, 0.045) 1px, transparent 1px),
        #000;
    background-size:
        auto,
        auto,
        48px 48px,
        48px 48px,
        auto;
}

@supports selector(body:has(.ops-layout)) {
    body:has(.ops-layout) {
        background: #000;
    }

    body:has(.ops-layout) .industrial-bg {
        background:
            radial-gradient(circle at 50% 42%, rgba(48, 97, 219, 0.12), transparent 34%),
            linear-gradient(rgba(48, 97, 219, 0.045) 1px, transparent 1px),
            linear-gradient(90deg, rgba(48, 97, 219, 0.045) 1px, transparent 1px),
            #000;
        background-size: auto, 48px 48px, 48px 48px, auto;
        animation: dashboardGridDrift 16s linear infinite;
    }
}

@keyframes dashboardGridDrift {
    from {
        background-position: 0 0, 0 0, 0 0, 0 0;
    }
    to {
        background-position: 0 0, 48px 48px, 48px 48px, 0 0;
    }
}

.ops-sidebar,
.ops-header,
.glass-card,
.env-card,
.kpi-card,
.license-record-modal-card,
.license-record-item,
.license-record-header,
.license-record-modal-field,
.license-guide-block,
.license-preview-item,
.license-upload-tip,
.license-output-tip {
    position: relative;
    border-color: rgba(189, 207, 255, 0.22);
    background:
        linear-gradient(180deg, rgba(7, 13, 34, 0.92), rgba(0, 0, 0, 0.94)),
        radial-gradient(circle at 50% 0%, rgba(48, 97, 219, 0.2), transparent 48%);
    box-shadow:
        inset 0 0 0 1px rgba(48, 97, 219, 0.12),
        0 20px 54px rgba(0, 0, 0, 0.58);
}

.ops-sidebar::before,
.ops-header::before,
.glass-card::before,
.kpi-card::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    pointer-events: none;
    background:
        linear-gradient(90deg, rgba(48, 97, 219, 0.78), transparent 18%, transparent 82%, rgba(48, 97, 219, 0.78)) 0 0 / 100% 1px no-repeat,
        linear-gradient(90deg, rgba(48, 97, 219, 0.55), transparent 34%, transparent 66%, rgba(48, 97, 219, 0.55)) 0 100% / 100% 1px no-repeat;
    opacity: 0.72;
}

.ops-sidebar {
    border-radius: 0;
    padding: 18px 16px;
}

.brand-block {
    min-height: 72px;
    padding-bottom: 16px;
    border-bottom: 1px solid rgba(189, 207, 255, 0.18);
}

.brand-dot {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background:
        linear-gradient(135deg, rgba(189, 207, 255, 0.95), rgba(48, 97, 219, 0.86)),
        #3061db;
    box-shadow:
        0 0 18px rgba(48, 97, 219, 0.88),
        inset 0 0 0 1px rgba(255, 255, 255, 0.28);
}

.brand-block h1,
.ops-header h2,
.card-title h3,
.kpi-card h3,
.env-card h3,
.license-tool-header h1 {
    color: #bdcfff;
    text-shadow: 0 0 14px rgba(48, 97, 219, 0.55);
}

.brand-block h1 {
    font-size: 26px;
    letter-spacing: 0.12em;
}

.brand-block p,
.ops-header p,
.env-card p,
.kpi-card p,
.card-title span,
.terminal-device,
.terminal-help,
.agent-form-tip,
.release-plan-meta,
.artifact-name span {
    color: rgba(189, 207, 255, 0.66);
}

.side-tag-list {
    gap: 10px;
}

.side-tag {
    position: relative;
    min-height: 42px;
    border-radius: 0;
    padding: 0 14px 0 18px;
    color: rgba(232, 239, 255, 0.76);
    background:
        linear-gradient(90deg, rgba(48, 97, 219, 0.1), rgba(0, 0, 0, 0.52));
    border-color: rgba(189, 207, 255, 0.18);
    letter-spacing: 0.04em;
    transition:
        color 0.2s ease,
        background 0.2s ease,
        border-color 0.2s ease,
        transform 0.2s ease;
}

.side-tag::before {
    content: "";
    position: absolute;
    left: 0;
    top: 9px;
    bottom: 9px;
    width: 3px;
    background: rgba(189, 207, 255, 0.22);
    box-shadow: none;
}

.side-tag:hover,
.side-tag.active {
    color: #ffffff;
    border-color: rgba(48, 97, 219, 0.86);
    background:
        linear-gradient(90deg, rgba(48, 97, 219, 0.34), rgba(48, 97, 219, 0.08) 58%, rgba(0, 0, 0, 0.58));
    box-shadow:
        inset 0 0 0 1px rgba(189, 207, 255, 0.12),
        0 0 18px rgba(48, 97, 219, 0.2);
    transform: translateX(2px);
}

.side-tag.active::before {
    background: #bdcfff;
    box-shadow: 0 0 12px rgba(189, 207, 255, 0.9);
}

.env-card {
    border-radius: 0;
    background:
        linear-gradient(180deg, rgba(48, 97, 219, 0.16), rgba(0, 0, 0, 0.72));
}

.ops-main {
    gap: 14px;
}

.ops-header {
    border-radius: 0;
    min-height: 86px;
    padding: 16px 22px;
}

.ops-header h2 {
    font-size: 34px;
    letter-spacing: 0.11em;
}

.ghost-btn,
.small-btn,
.action-btn,
.primary-action,
.secondary-btn,
.screen-shell-btn,
.select-input,
.text-input,
.device-form input,
.device-form textarea,
.agent-cmd-output,
.file-input,
.ota-device-list {
    border-radius: 0;
    border-color: rgba(189, 207, 255, 0.24);
    color: #e8efff;
    background: rgba(0, 0, 0, 0.58);
    box-shadow: inset 0 0 0 1px rgba(48, 97, 219, 0.08);
}

.ghost-btn:hover,
.small-btn:hover,
.action-btn:hover,
.secondary-btn:hover {
    border-color: rgba(48, 97, 219, 0.88);
    color: #ffffff;
    background: rgba(48, 97, 219, 0.18);
    box-shadow: 0 0 16px rgba(48, 97, 219, 0.22);
}

.small-btn.primary,
.action-btn.primary,
.primary-action,
.login-form button {
    color: #f5f8ff;
    border-color: rgba(48, 97, 219, 0.9);
    background:
        linear-gradient(90deg, rgba(48, 97, 219, 0.92), rgba(48, 97, 219, 0.44));
    box-shadow:
        inset 0 0 0 1px rgba(189, 207, 255, 0.2),
        0 0 18px rgba(48, 97, 219, 0.28);
}

.small-btn.warn,
.action-btn.warn {
    border-color: rgba(234, 88, 12, 0.66);
    color: #ffcead;
    background: rgba(234, 88, 12, 0.12);
}

.glass-card {
    border-radius: 0;
    padding: 16px;
}

.glass-card:hover {
    border-color: rgba(48, 97, 219, 0.78);
    transform: translateY(-1px);
}

.card-title {
    min-height: 42px;
    border-bottom: 1px solid rgba(189, 207, 255, 0.22);
    padding-bottom: 10px;
}

.card-title h3 {
    position: relative;
    font-size: 21px;
    letter-spacing: 0.08em;
}

.card-title h3::before {
    content: "";
    display: inline-block;
    width: 34px;
    height: 3px;
    margin-right: 10px;
    vertical-align: middle;
    background: #3061db;
    box-shadow: 0 0 10px rgba(48, 97, 219, 0.75);
}

.kpi-grid {
    gap: 16px;
}

.kpi-card {
    border-radius: 0;
    min-height: 132px;
    padding: 18px;
    overflow: hidden;
}

.kpi-card::after {
    content: "";
    position: absolute;
    right: -34px;
    top: -46px;
    width: 118px;
    height: 118px;
    border-radius: 50%;
    border: 1px solid rgba(48, 97, 219, 0.26);
    box-shadow: inset 0 0 30px rgba(48, 97, 219, 0.1);
}

.kpi-card h3 {
    margin-top: 10px;
    font-size: 42px;
    color: #3061db;
}

.kpi-card.success,
.kpi-card.danger,
.kpi-card.warning {
    border-color: rgba(189, 207, 255, 0.24);
}

.kpi-card.success h3,
.kpi-card.danger h3,
.kpi-card.warning h3 {
    color: #3061db;
}

.table-wrap {
    border: 1px solid rgba(189, 207, 255, 0.14);
    background:
        linear-gradient(180deg, rgba(3, 7, 18, 0.88), rgba(0, 0, 0, 0.82));
}

table {
    border-collapse: separate;
    border-spacing: 0;
}

thead th {
    color: rgba(189, 207, 255, 0.86);
    background: rgba(48, 97, 219, 0.12);
    border-bottom-color: rgba(48, 97, 219, 0.46);
    padding: 12px 10px;
    font-size: 13px;
}

tbody td {
    color: rgba(232, 239, 255, 0.9);
    border-bottom-color: rgba(189, 207, 255, 0.1);
    padding: 12px 10px;
}

tbody tr:hover td {
    background: rgba(48, 97, 219, 0.08);
}

.empty-tip {
    color: rgba(189, 207, 255, 0.6);
}

.text-input:focus,
.select-input:focus,
.device-form input:focus,
.device-form textarea:focus,
.agent-cmd-output:focus,
.file-input:focus {
    border-color: rgba(48, 97, 219, 0.9);
    box-shadow:
        inset 0 0 0 1px rgba(189, 207, 255, 0.12),
        0 0 0 3px rgba(48, 97, 219, 0.16);
}

.status-badge,
.status-pill,
.mini-kpi,
.license-chip,
.license-record-status {
    border-radius: 0;
}

.status-online,
.status-pill.connected,
.license-record-status.active {
    color: #bdcfff;
    border: 1px solid rgba(48, 97, 219, 0.62);
    background: rgba(48, 97, 219, 0.18);
}

.status-offline,
.status-pill.error,
.mini-kpi.critical,
.license-record-status.invalid,
.license-record-status.other {
    color: #ffb99a;
    border-color: rgba(234, 88, 12, 0.62);
    background: rgba(234, 88, 12, 0.16);
}

.status-unknown,
.status-pill.connecting,
.mini-kpi.warn,
.license-record-status.expired {
    color: #f4d58d;
    border-color: rgba(182, 147, 45, 0.62);
    background: rgba(182, 147, 45, 0.16);
}

.token-cell code,
.license-upload-tip code,
.license-output-tip code,
.license-preview-item strong,
.artifact-name strong,
.license-record-cell strong,
.license-record-modal-field strong {
    color: #bdcfff;
}

.agent-cmd-output,
#otaTaskOutput,
#terminal {
    background:
        linear-gradient(180deg, rgba(0, 0, 0, 0.92), rgba(3, 7, 18, 0.96));
    border-color: rgba(48, 97, 219, 0.38);
}

#terminal {
    border-radius: 0;
    box-shadow:
        inset 0 0 0 1px rgba(189, 207, 255, 0.1),
        0 0 22px rgba(48, 97, 219, 0.16);
}

.license-frame-card {
    padding: 0;
}

.license-tool-grid {
    padding: 16px;
}

.license-record-cell,
.license-record-cell-action {
    background: rgba(0, 0, 0, 0.58);
}

*::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.84);
}

*::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, rgba(48, 97, 219, 0.78), rgba(189, 207, 255, 0.5));
}

* {
    scrollbar-color: rgba(48, 97, 219, 0.78) rgba(0, 0, 0, 0.84);
}

@media (max-width: 900px) {
    .ops-layout {
        padding: 12px;
        gap: 12px;
    }

    .ops-sidebar,
    .ops-header,
    .glass-card,
    .kpi-card {
        border-radius: 0;
    }
}

/* Dashboard layout breathing room: loosen module pages without touching behavior. */
.ops-layout:not(.screen-mode) {
    grid-template-columns: 252px minmax(0, 1fr);
    gap: 22px;
    padding: 22px;
}

.ops-layout:not(.screen-mode) .ops-main {
    gap: 18px;
    overflow: hidden;
}

.ops-layout:not(.screen-mode) .module-panel.active {
    gap: 22px;
    padding: 2px 8px 18px 2px;
    align-content: start;
    overflow: auto;
}

.ops-layout:not(.screen-mode) .glass-card {
    padding: 22px;
}

.ops-layout:not(.screen-mode) .card-title {
    min-height: 54px;
    margin-bottom: 18px;
    padding-bottom: 14px;
}

.ops-layout:not(.screen-mode) .card-title.slim {
    margin-top: 22px;
    margin-bottom: 14px;
}

.ops-layout:not(.screen-mode) .inline-actions {
    gap: 12px;
    flex-wrap: wrap;
}

.ops-layout:not(.screen-mode) .small-btn,
.ops-layout:not(.screen-mode) .action-btn,
.ops-layout:not(.screen-mode) .ghost-btn,
.ops-layout:not(.screen-mode) .primary-action,
.ops-layout:not(.screen-mode) .secondary-btn {
    min-height: 36px;
    padding-inline: 16px;
}

.ops-layout:not(.screen-mode) .text-input,
.ops-layout:not(.screen-mode) .select-input,
.ops-layout:not(.screen-mode) .device-form input,
.ops-layout:not(.screen-mode) .device-form textarea,
.ops-layout:not(.screen-mode) .file-input {
    min-height: 42px;
    padding: 10px 12px;
}

.ops-layout:not(.screen-mode) .table-wrap {
    padding: 6px;
}

.ops-layout:not(.screen-mode) thead th {
    padding: 14px 12px;
}

.ops-layout:not(.screen-mode) tbody td {
    padding: 14px 12px;
}

.module-panel[data-panel="monitor"] {
    grid-template-rows:
        auto
        minmax(320px, auto)
        minmax(240px, auto)
        minmax(280px, auto);
    overflow: visible;
}

.module-panel[data-panel="monitor"].active {
    overflow: auto;
}

.monitor-metrics-card,
.monitor-alerts-card,
.monitor-agent-card {
    height: auto;
    min-height: 0;
}

.monitor-metrics-card {
    min-height: 360px;
}

.monitor-alerts-card {
    min-height: 280px;
}

.monitor-agent-card {
    min-height: 330px;
}

.monitor-metrics-card .table-wrap,
.monitor-alerts-card .table-wrap {
    max-height: min(45vh, 520px);
}

.agent-grid {
    gap: 16px;
    margin-bottom: 16px;
}

#agentCommandOutput {
    min-height: 190px;
}

.module-panel[data-panel="devices"] {
    overflow: visible;
}

.workspace-grid {
    grid-template-columns: minmax(0, 1.72fr) minmax(360px, 0.72fr);
    gap: 22px;
    height: auto;
    align-items: start;
}

.device-panel {
    min-height: 620px;
}

.device-panel .table-wrap {
    max-height: calc(100vh - 230px);
}

.form-panel {
    min-height: 620px;
}

.form-panel .device-form {
    gap: 14px;
    overflow: visible;
    padding-right: 0;
}

.device-form label,
.double-input label,
.agent-grid label,
.release-upload-grid label,
.release-plan-field,
.license-form label {
    gap: 8px;
    color: rgba(189, 207, 255, 0.78);
}

.button-row {
    margin-top: 16px;
    gap: 12px;
}

#description {
    min-height: 132px;
}

.module-panel[data-panel="license"].active {
    overflow: auto;
}

.license-frame-card {
    min-height: 680px;
    overflow: visible;
}

.license-frame-card > .license-tool-shell {
    height: auto;
    overflow: visible;
}

.license-tool-grid {
    grid-template-columns: minmax(320px, 0.92fr) minmax(320px, 0.82fr) minmax(420px, 1.16fr);
    gap: 22px;
    padding: 22px;
    height: auto;
    align-items: start;
}

.license-tool-card,
.license-guide-card {
    min-height: 560px;
}

.license-tool-card-body,
.license-guide {
    gap: 16px;
    overflow: visible;
}

.license-preview-grid {
    gap: 14px;
}

.license-preview-item,
.license-guide-block,
.license-upload-tip,
.license-output-tip {
    padding: 15px 16px;
}

.license-record-table {
    min-height: 420px;
    max-height: calc(100vh - 300px);
    overflow: auto;
}

.module-panel[data-panel="terminal"] {
    overflow: visible;
}

.terminal-card {
    min-height: calc(100vh - 170px);
    padding: 24px;
}

.terminal-meta {
    margin-bottom: 12px;
}

#terminal {
    min-height: 560px;
}

.module-panel[data-panel="ota"] {
    grid-template-columns: minmax(0, 1.08fr) minmax(420px, 0.92fr);
    grid-template-rows: auto minmax(420px, auto);
    gap: 22px;
    overflow: visible;
}

.ota-config-card,
.release-library-card,
.ota-task-card {
    height: auto;
    min-height: 0;
}

.ota-config-card {
    min-height: 560px;
    overflow: visible;
}

.release-library-card {
    min-height: 560px;
}

.ota-task-card {
    min-height: 520px;
}

.ota-grid,
.release-upload-grid {
    gap: 16px;
    margin-bottom: 20px;
}

.release-upload-grid {
    grid-template-columns: minmax(0, 1fr) minmax(0, 0.86fr) minmax(180px, 0.72fr);
}

.release-plan-list {
    gap: 14px;
}

.release-plan-item {
    padding: 16px;
}

.release-plan-row {
    gap: 14px;
}

.ota-device-list {
    min-height: 220px;
    max-height: 340px;
    padding: 12px;
    gap: 10px;
}

.release-library-card .table-wrap,
.ota-task-card .table-wrap {
    max-height: 340px;
}

#otaTaskOutput {
    min-height: 220px;
}

.module-panel[data-panel="audit"] {
    overflow: visible;
}

.audit-card {
    min-height: calc(100vh - 170px);
}

.audit-card .table-wrap {
    max-height: calc(100vh - 270px);
}

@media (max-width: 1500px) {
    .workspace-grid,
    .module-panel[data-panel="ota"],
    .license-tool-grid {
        grid-template-columns: 1fr;
    }

    .module-panel[data-panel="ota"] {
        grid-template-areas:
            "config"
            "library"
            "tasks";
    }

    .device-panel,
    .form-panel,
    .license-tool-card,
    .license-guide-card,
    .terminal-card,
    .audit-card {
        min-height: auto;
    }

    #terminal {
        min-height: 460px;
    }
}

@media (max-width: 900px) {
    .ops-layout:not(.screen-mode) {
        grid-template-columns: 1fr;
        padding: 12px;
        gap: 12px;
    }

    .ops-layout:not(.screen-mode) .module-panel.active {
        gap: 14px;
        padding: 0 0 14px;
    }

    .ops-layout:not(.screen-mode) .glass-card {
        padding: 16px;
    }

    .release-upload-grid,
    .ota-grid,
    .agent-grid {
        grid-template-columns: 1fr;
    }
}

/* Dashboard paged modules: no page-level vertical scrollbar, split dense tools into tabs. */
.ops-layout:not(.screen-mode) {
    height: 100vh;
    overflow: hidden;
}

.ops-layout:not(.screen-mode) .ops-main {
    min-height: 0;
    overflow: hidden;
}

.ops-layout:not(.screen-mode) .module-panel.active {
    height: 100%;
    min-height: 0;
    overflow: hidden;
    align-content: stretch;
    padding: 0;
}

.subpage-tabs {
    display: flex;
    align-items: center;
    gap: 14px;
    min-height: 52px;
    padding: 6px;
    border: 1px solid rgba(189, 207, 255, 0.2);
    background:
        linear-gradient(90deg, rgba(48, 97, 219, 0.12), rgba(0, 0, 0, 0.62));
    box-shadow: inset 0 0 0 1px rgba(48, 97, 219, 0.08);
}

.subpage-tab {
    min-width: 118px;
    min-height: 38px;
    padding: 0 18px;
    cursor: pointer;
    border: 1px solid rgba(189, 207, 255, 0.18);
    color: rgba(232, 239, 255, 0.72);
    background: rgba(0, 0, 0, 0.48);
    letter-spacing: 0.04em;
    transition:
        color 0.2s ease,
        border-color 0.2s ease,
        background 0.2s ease,
        box-shadow 0.2s ease;
}

.subpage-tab:hover,
.subpage-tab.active {
    color: #ffffff;
    border-color: rgba(48, 97, 219, 0.88);
    background: linear-gradient(90deg, rgba(48, 97, 219, 0.72), rgba(48, 97, 219, 0.18));
    box-shadow:
        inset 0 0 0 1px rgba(189, 207, 255, 0.16),
        0 0 18px rgba(48, 97, 219, 0.24);
}

.module-subpage {
    display: none !important;
    min-height: 0;
}

.module-subpage.active {
    display: grid !important;
}

.module-panel[data-panel="monitor"] {
    grid-template-rows: auto minmax(0, 1fr);
}

.module-panel[data-panel="monitor"] > .module-subpage.active {
    height: 100%;
    min-height: 0;
}

.module-panel[data-panel="monitor"] > .module-subpage[data-subpage="overview"].active {
    align-content: start;
}

.module-panel[data-panel="monitor"] .kpi-grid {
    align-self: start;
}

.monitor-metrics-card,
.monitor-alerts-card,
.monitor-agent-card {
    height: 100%;
    min-height: 0;
}

.monitor-metrics-card .table-wrap,
.monitor-alerts-card .table-wrap {
    max-height: none;
}

#agentCommandOutput {
    min-height: 0;
    height: 100%;
}

.module-panel[data-panel="devices"] {
    grid-template-rows: auto minmax(0, 1fr);
}

.module-panel[data-panel="devices"] .workspace-grid {
    display: block;
    height: 100%;
    min-height: 0;
}

.device-panel.module-subpage.active,
.form-panel.module-subpage.active {
    height: 100%;
    min-height: 0;
}

.device-panel {
    min-height: 0;
}

.device-panel .table-wrap {
    max-height: none;
}

.form-panel {
    min-height: 0;
}

.form-panel .device-form {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px 22px;
    overflow: hidden;
}

.form-panel .device-form > input[type="hidden"] {
    display: none;
}

.form-panel .device-form label,
.form-panel .device-form .double-input {
    min-width: 0;
}

.form-panel .device-form label[for="description"] {
    display: none;
}

#description {
    grid-column: 1 / -1;
    min-height: 118px;
}

.form-panel .button-row {
    grid-column: 1 / -1;
    align-self: end;
}

.module-panel[data-panel="license"].active {
    overflow: hidden;
}

.license-frame-card {
    height: 100%;
    min-height: 0;
    overflow: hidden;
}

.license-frame-card > .license-tool-shell {
    height: 100%;
    min-height: 0;
    overflow: hidden;
}

.license-tool-grid {
    height: 100%;
    min-height: 0;
    grid-template-columns: minmax(300px, 0.9fr) minmax(300px, 0.82fr) minmax(420px, 1.18fr);
    align-items: stretch;
}

.license-tool-card,
.license-guide-card {
    height: 100%;
    min-height: 0;
    overflow: hidden;
}

.license-tool-card-body,
.license-guide {
    overflow: auto;
}

.license-record-table {
    min-height: 0;
    max-height: none;
}

.module-panel[data-panel="terminal"] {
    grid-template-rows: minmax(0, 1fr);
}

.terminal-card {
    height: 100%;
    min-height: 0;
}

#terminal {
    height: 100%;
    min-height: 0;
}

.module-panel[data-panel="ota"] {
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(0, 1fr);
    grid-template-areas: none;
}

.module-panel[data-panel="ota"] > .glass-card {
    grid-area: auto;
}

.ota-config-card.module-subpage.active,
.release-library-card.module-subpage.active,
.ota-task-card.module-subpage.active {
    height: 100%;
    min-height: 0;
}

.ota-config-card {
    overflow: hidden;
}

.ota-config-card.module-subpage.active {
    grid-template-rows: auto auto auto auto auto auto minmax(0, 1fr);
}

.ota-device-list {
    min-height: 0;
    max-height: none;
    overflow: auto;
}

.release-library-card,
.ota-task-card {
    min-height: 0;
}

.release-library-card .table-wrap,
.ota-task-card .table-wrap {
    max-height: none;
}

#otaTaskOutput {
    min-height: 0;
}

.audit-card {
    height: 100%;
    min-height: 0;
}

.audit-card .table-wrap {
    max-height: none;
}

@media (max-width: 1500px) {
    .license-tool-grid {
        grid-template-columns: minmax(0, 1fr);
        overflow: auto;
    }

    .license-tool-card,
    .license-guide-card {
        min-height: 460px;
    }
}

@media (max-width: 900px) {
    .ops-layout:not(.screen-mode) {
        height: auto;
        min-height: 100vh;
        overflow: auto;
    }

    .ops-layout:not(.screen-mode) .module-panel.active {
        overflow: visible;
    }

    .subpage-tabs {
        overflow-x: auto;
    }

    .form-panel .device-form {
        grid-template-columns: 1fr;
        overflow: auto;
    }
}

/* License and OTA refinement for paged modules. */
.license-tool-shell {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    gap: 22px;
    height: 100%;
    min-height: 0;
}

.license-subpage-tabs {
    margin: 0 22px;
}

.license-tool-grid {
    grid-template-columns: minmax(0, 1fr);
    padding: 0 22px 22px;
    overflow: hidden;
}

.license-subpage {
    display: none !important;
    min-height: 0;
}

.license-subpage.active {
    display: flex !important;
    height: 100%;
}

.license-subpage[data-license-subpage-panel="key"] .license-tool-card-body {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
}

.license-subpage[data-license-subpage-panel="key"] .license-preview-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    align-content: start;
}

.license-subpage[data-license-subpage-panel="generate"] .license-tool-card-body {
    justify-content: center;
}

.license-subpage[data-license-subpage-panel="generate"] .license-form {
    width: min(760px, 100%);
    margin: 0 auto;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px 22px;
}

.license-subpage[data-license-subpage-panel="generate"] .license-form .license-remark-field,
.license-subpage[data-license-subpage-panel="generate"] .button-row {
    grid-column: 1 / -1;
}

.license-subpage[data-license-subpage-panel="records"] .license-guide {
    grid-template-rows: auto minmax(0, 1fr);
    overflow: hidden;
}

.license-subpage[data-license-subpage-panel="records"] .license-record-table {
    overflow: auto;
}

.module-panel[data-panel="ota"] {
    gap: 22px;
}

.ota-config-card.module-subpage.active {
    display: grid !important;
    grid-template-columns: minmax(0, 0.92fr) minmax(420px, 1.08fr);
    grid-template-rows: auto auto minmax(0, 1fr);
    grid-template-areas:
        "title title"
        "basic plan"
        "devices plan";
    gap: 18px 24px;
}

.ota-config-card > .card-title:first-child {
    grid-area: title;
    margin-bottom: 0;
}

.ota-config-card > .ota-basic-grid {
    grid-area: basic;
    align-self: start;
    grid-template-columns: 1fr;
    margin-bottom: 0;
}

.ota-config-card > .ota-plan-title {
    grid-area: plan;
    align-self: start;
}

.ota-config-card > .release-plan-list,
.ota-config-card > #otaReleaseManifest {
    grid-area: plan;
}

.ota-config-card > .release-plan-list {
    min-height: 0;
    overflow: auto;
    align-self: stretch;
    padding-right: 4px;
}

.ota-config-card > .ota-device-title {
    grid-area: devices;
    align-self: start;
}

.ota-config-card > .ota-device-list {
    grid-area: devices;
}

.ota-config-card > .ota-device-list {
    min-height: 0;
    overflow: auto;
}

.release-library-card.module-subpage.active {
    display: grid !important;
    grid-template-rows: auto auto minmax(0, 1fr);
    gap: 18px;
}

.release-library-card .release-upload-grid {
    grid-template-columns: minmax(0, 1fr) minmax(0, 0.8fr) minmax(200px, 0.62fr);
    margin-bottom: 0;
}

.release-library-card .table-wrap {
    min-height: 0;
    overflow: auto;
}

.ota-task-card.module-subpage.active {
    display: grid !important;
    grid-template-rows: auto minmax(0, 1.05fr) auto minmax(180px, 0.7fr);
    gap: 16px;
}

.ota-task-card .table-wrap,
.ota-task-card #otaTaskOutput {
    min-height: 0;
    overflow: auto;
}

@media (max-width: 1500px) {
    .license-subpage[data-license-subpage-panel="key"] .license-preview-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .ota-config-card.module-subpage.active {
        grid-template-columns: 1fr;
        grid-template-areas:
            "title"
            "basic"
            "plan"
            "devices";
    }
}

@media (max-width: 900px) {
    .license-subpage-tabs,
    .license-tool-grid {
        margin: 0;
        padding-inline: 0;
    }

    .license-subpage[data-license-subpage-panel="key"] .license-preview-grid,
    .license-subpage[data-license-subpage-panel="generate"] .license-form,
    .release-library-card .release-upload-grid {
        grid-template-columns: 1fr;
    }
}

/* Absolute final desktop fill override. Keep this block last. */
@media (min-width: 901px) {
    .ops-layout:not(.screen-mode),
    html:has(.ops-layout:not(.screen-mode)),
    body:has(.ops-layout:not(.screen-mode)) {
        height: 100vh;
        overflow: hidden;
    }

    .ops-layout:not(.screen-mode) .ops-main {
        grid-template-rows: auto auto minmax(0, 1fr);
        min-height: 0;
        overflow: hidden;
    }

    .ops-layout:not(.screen-mode) .module-panel.active {
        height: 100%;
        min-height: 0;
        overflow: hidden;
        align-content: stretch;
    }

    .module-panel[data-panel="devices"].active,
    .module-panel[data-panel="ota"].active {
        grid-template-rows: auto minmax(0, 1fr);
    }

    .module-panel[data-panel="license"].active,
    .module-panel[data-panel="terminal"].active,
    .module-panel[data-panel="audit"].active {
        grid-template-rows: minmax(0, 1fr);
    }

    .module-panel[data-panel="devices"] .workspace-grid {
        display: grid !important;
        grid-template-columns: minmax(0, 1fr) !important;
        grid-template-rows: minmax(0, 1fr);
        height: 100%;
        min-height: 0;
        align-items: stretch;
    }

    .device-panel.module-subpage.active,
    .form-panel.module-subpage.active {
        display: grid !important;
        grid-template-rows: auto minmax(0, 1fr);
        height: 100%;
        min-height: 0;
        overflow: hidden;
    }

    .device-panel .table-wrap {
        height: 100%;
        min-height: 0;
        max-height: none;
        overflow: auto;
        padding: 10px;
        border-radius: 18px;
    }

    .device-panel table {
        min-width: 1260px;
    }

    .form-panel .device-form {
        height: 100%;
        min-height: 0;
        overflow: auto;
        align-content: start;
        gap: 18px 22px;
        padding-right: 6px;
    }

    .terminal-card {
        display: grid;
        grid-template-rows: auto auto minmax(0, 1fr);
        gap: 14px;
        height: 100%;
        min-height: 0;
        overflow: hidden;
    }

    .terminal-card .terminal-meta {
        margin-bottom: 0;
    }

    #terminal {
        height: 100% !important;
        min-height: 0 !important;
        max-height: none;
    }

    .license-frame-card {
        display: grid;
        grid-template-rows: minmax(0, 1fr);
        height: 100%;
        min-height: 0;
        padding: 0;
        overflow: hidden;
    }

    .license-frame-card > .license-tool-shell,
    .license-tool-grid,
    .license-subpage.active {
        height: 100%;
        min-height: 0;
        overflow: hidden;
    }

    .license-frame-card > .license-tool-shell {
        grid-template-rows: auto minmax(0, 1fr);
        gap: 16px;
    }

    .license-tool-grid {
        grid-template-columns: minmax(0, 1fr);
        grid-template-rows: minmax(0, 1fr);
        padding: 0 18px 18px;
    }

    .license-subpage[data-license-subpage-panel="records"].active,
    .license-subpage[data-license-subpage-panel="records"] .license-guide,
    .license-record-table {
        display: grid !important;
        grid-template-rows: auto minmax(0, 1fr);
        height: 100%;
        min-height: 0;
        overflow: hidden;
    }

    .license-record-header {
        position: relative;
        top: auto;
    }

    .license-record-list {
        min-height: 0;
        overflow: auto;
        align-content: start;
        gap: 10px;
        padding-right: 6px;
    }

    .license-record-cell {
        min-height: 54px;
        padding: 0 14px;
    }
}

/* Absolute final desktop fill override. Keep this at the end of the file. */
@media (min-width: 901px) {
    .ops-layout:not(.screen-mode),
    html:has(.ops-layout:not(.screen-mode)),
    body:has(.ops-layout:not(.screen-mode)) {
        height: 100vh;
        overflow: hidden;
    }

    .ops-layout:not(.screen-mode) .ops-main {
        display: grid;
        grid-template-rows: auto auto minmax(0, 1fr);
        min-height: 0;
        overflow: hidden;
    }

    .ops-layout:not(.screen-mode) .module-panel.active {
        height: 100%;
        min-height: 0;
        overflow: hidden;
        align-content: stretch;
    }

    .module-panel[data-panel="devices"].active,
    .module-panel[data-panel="ota"].active {
        display: grid;
        grid-template-rows: auto minmax(0, 1fr);
        min-height: 0;
    }

    .module-panel[data-panel="license"].active,
    .module-panel[data-panel="terminal"].active,
    .module-panel[data-panel="audit"].active {
        display: grid;
        grid-template-rows: minmax(0, 1fr);
        min-height: 0;
    }

    .module-panel[data-panel="devices"] .workspace-grid {
        display: grid !important;
        grid-template-columns: minmax(0, 1fr) !important;
        grid-template-rows: minmax(0, 1fr);
        height: 100%;
        min-height: 0;
        align-items: stretch;
    }

    .device-panel.module-subpage.active,
    .form-panel.module-subpage.active {
        display: grid !important;
        grid-template-rows: auto minmax(0, 1fr);
        height: 100%;
        min-height: 0;
        overflow: hidden;
    }

    .device-panel .card-title,
    .form-panel .card-title,
    .terminal-card .card-title {
        margin-bottom: 14px;
    }

    .device-panel .table-wrap {
        height: 100%;
        min-height: 0;
        max-height: none;
        overflow: auto;
        padding: 10px;
        border-radius: 18px;
    }

    .device-panel table {
        min-width: 1260px;
    }

    .form-panel .device-form {
        height: 100%;
        min-height: 0;
        overflow: auto;
        align-content: start;
        gap: 18px 22px;
        padding-right: 6px;
    }

    .terminal-card {
        display: grid;
        grid-template-rows: auto auto minmax(0, 1fr);
        gap: 14px;
        height: 100%;
        min-height: 0;
        overflow: hidden;
    }

    .terminal-card .terminal-meta {
        margin-bottom: 0;
    }

    #terminal {
        height: 100% !important;
        min-height: 0 !important;
        max-height: none;
    }

    #terminal .xterm,
    #terminal .xterm-viewport,
    #terminal .xterm-screen {
        height: 100%;
    }

    .license-frame-card {
        display: grid;
        grid-template-rows: minmax(0, 1fr);
        height: 100%;
        min-height: 0;
        padding: 0;
        overflow: hidden;
    }

    .license-frame-card > .license-tool-shell {
        display: grid;
        grid-template-rows: auto minmax(0, 1fr);
        gap: 16px;
        height: 100%;
        min-height: 0;
        overflow: hidden;
    }

    .license-subpage-tabs {
        margin: 0 18px;
    }

    .license-tool-grid {
        display: grid;
        grid-template-columns: minmax(0, 1fr);
        grid-template-rows: minmax(0, 1fr);
        height: 100%;
        min-height: 0;
        padding: 0 18px 18px;
        overflow: hidden;
    }

    .license-subpage.active {
        height: 100%;
        min-height: 0;
        overflow: hidden;
    }

    .license-subpage[data-license-subpage-panel="key"].active,
    .license-subpage[data-license-subpage-panel="generate"].active,
    .license-subpage[data-license-subpage-panel="records"].active {
        display: grid !important;
        grid-template-rows: auto minmax(0, 1fr);
    }

    .license-subpage[data-license-subpage-panel="records"] .license-guide {
        display: grid;
        grid-template-rows: auto minmax(0, 1fr);
        gap: 16px;
        height: 100%;
        min-height: 0;
        overflow: hidden;
        padding-right: 0;
    }

    .license-record-table {
        display: grid;
        grid-template-rows: auto minmax(0, 1fr);
        align-content: stretch;
        height: 100%;
        min-height: 0;
        max-height: none;
        overflow: hidden;
        gap: 10px;
    }

    .license-record-header {
        position: relative;
        top: auto;
    }

    .license-record-list {
        min-height: 0;
        overflow: auto;
        align-content: start;
        gap: 10px;
        padding-right: 6px;
    }

    .license-record-item {
        border-radius: 16px;
    }

    .license-record-head-cell {
        min-height: 46px;
    }

    .license-record-cell {
        min-height: 54px;
        padding: 0 14px;
    }

    .license-record-cell strong {
        font-size: 13px;
        line-height: 1.35;
    }

    .release-library-card.module-subpage.active,
    .ota-task-card.module-subpage.active,
    .audit-card {
        height: 100%;
        min-height: 0;
        overflow: hidden;
    }
}

/* Unified desktop module height pass: devices, license, terminal and OTA share one viewport-bound shell. */
@media (min-width: 901px) {
    .ops-layout:not(.screen-mode) {
        height: 100vh;
        overflow: hidden;
    }

    .ops-layout:not(.screen-mode) .ops-main {
        display: grid;
        grid-template-rows: auto auto minmax(0, 1fr);
        min-height: 0;
        overflow: hidden;
    }

    .ops-layout:not(.screen-mode) .module-panel.active {
        height: 100%;
        min-height: 0;
        overflow: hidden;
        align-content: stretch;
    }

    .module-panel[data-panel="devices"].active,
    .module-panel[data-panel="ota"].active {
        display: grid;
        grid-template-rows: auto minmax(0, 1fr);
        min-height: 0;
    }

    .module-panel[data-panel="license"].active,
    .module-panel[data-panel="terminal"].active,
    .module-panel[data-panel="audit"].active {
        display: grid;
        grid-template-rows: minmax(0, 1fr);
        min-height: 0;
    }

    .module-panel[data-panel="devices"] .workspace-grid {
        display: grid !important;
        grid-template-columns: minmax(0, 1fr) !important;
        grid-template-rows: minmax(0, 1fr);
        height: 100%;
        min-height: 0;
        align-items: stretch;
    }

    .device-panel.module-subpage.active,
    .form-panel.module-subpage.active {
        display: grid !important;
        grid-template-rows: auto minmax(0, 1fr);
        height: 100%;
        min-height: 0;
        overflow: hidden;
    }

    .device-panel .card-title,
    .form-panel .card-title,
    .terminal-card .card-title {
        margin-bottom: 14px;
    }

    .device-panel .table-wrap {
        height: 100%;
        min-height: 0;
        max-height: none;
        overflow: auto;
        padding: 10px;
        border-radius: 18px;
    }

    .device-panel table {
        min-width: 1260px;
    }

    .form-panel .device-form {
        height: 100%;
        min-height: 0;
        overflow: auto;
        align-content: start;
        gap: 18px 22px;
        padding-right: 6px;
    }

    .terminal-card {
        display: grid;
        grid-template-rows: auto auto minmax(0, 1fr);
        gap: 14px;
        height: 100%;
        min-height: 0;
        overflow: hidden;
    }

    .terminal-card .terminal-meta {
        margin-bottom: 0;
    }

    #terminal {
        height: 100% !important;
        min-height: 0 !important;
        max-height: none;
    }

    #terminal .xterm,
    #terminal .xterm-viewport,
    #terminal .xterm-screen {
        height: 100%;
    }

    .license-frame-card {
        display: grid;
        grid-template-rows: minmax(0, 1fr);
        height: 100%;
        min-height: 0;
        padding: 0;
        overflow: hidden;
    }

    .license-frame-card > .license-tool-shell {
        display: grid;
        grid-template-rows: auto minmax(0, 1fr);
        gap: 16px;
        height: 100%;
        min-height: 0;
        overflow: hidden;
    }

    .license-subpage-tabs {
        margin: 0 18px;
    }

    .license-tool-grid {
        display: grid;
        grid-template-columns: minmax(0, 1fr);
        grid-template-rows: minmax(0, 1fr);
        height: 100%;
        min-height: 0;
        padding: 0 18px 18px;
        overflow: hidden;
    }

    .license-subpage.active {
        height: 100%;
        min-height: 0;
        overflow: hidden;
    }

    .license-subpage[data-license-subpage-panel="key"].active,
    .license-subpage[data-license-subpage-panel="generate"].active {
        display: grid !important;
        grid-template-rows: auto minmax(0, 1fr);
    }

    .license-subpage[data-license-subpage-panel="records"].active {
        display: grid !important;
        grid-template-rows: auto minmax(0, 1fr);
    }

    .license-subpage[data-license-subpage-panel="records"] .license-guide {
        display: grid;
        grid-template-rows: auto minmax(0, 1fr);
        gap: 16px;
        height: 100%;
        min-height: 0;
        overflow: hidden;
        padding-right: 0;
    }

    .license-record-table {
        display: grid;
        grid-template-rows: auto minmax(0, 1fr);
        align-content: stretch;
        height: 100%;
        min-height: 0;
        max-height: none;
        overflow: hidden;
        gap: 10px;
    }

    .license-record-header {
        position: relative;
        top: auto;
    }

    .license-record-list {
        min-height: 0;
        overflow: auto;
        align-content: start;
        gap: 10px;
        padding-right: 6px;
    }

    .license-record-item {
        border-radius: 16px;
    }

    .license-record-head-cell {
        min-height: 46px;
    }

    .license-record-cell {
        min-height: 54px;
        padding: 0 14px;
    }

    .license-record-cell strong {
        font-size: 13px;
        line-height: 1.35;
    }

    .release-library-card.module-subpage.active,
    .ota-task-card.module-subpage.active,
    .audit-card {
        height: 100%;
        min-height: 0;
        overflow: hidden;
    }
}

/* Final layout lock: keep module pages viewport-bound and push scrolling into cards only. */
.ops-layout:not(.screen-mode),
html:has(.ops-layout:not(.screen-mode)),
body:has(.ops-layout:not(.screen-mode)) {
    height: 100vh;
    overflow: hidden;
}

.ops-layout:not(.screen-mode) .ops-main {
    grid-template-rows: auto auto minmax(0, 1fr);
    min-height: 0;
    overflow: hidden;
}

.ops-layout:not(.screen-mode) .module-panel.active {
    height: 100%;
    min-height: 0;
    overflow: hidden;
    align-content: stretch;
}

.ops-layout:not(.screen-mode) .module-panel[data-panel="monitor"],
.ops-layout:not(.screen-mode) .module-panel[data-panel="devices"],
.ops-layout:not(.screen-mode) .module-panel[data-panel="ota"] {
    grid-template-rows: auto minmax(0, 1fr);
    min-height: 0;
    overflow: hidden;
}

.ops-layout:not(.screen-mode) .module-panel[data-panel="terminal"].active,
.ops-layout:not(.screen-mode) .module-panel[data-panel="license"].active,
.ops-layout:not(.screen-mode) .module-panel[data-panel="audit"].active {
    grid-template-rows: minmax(0, 1fr);
    min-height: 0;
    overflow: hidden;
}

.ops-layout:not(.screen-mode) .module-panel[data-panel="devices"] .workspace-grid {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    grid-template-rows: minmax(0, 1fr);
    height: 100%;
    min-height: 0;
    align-items: stretch;
}

.device-panel.module-subpage.active,
.form-panel.module-subpage.active {
    height: 100%;
    min-height: 0;
}

.device-panel {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    min-height: 0;
    height: 100%;
}

.device-panel .table-wrap {
    height: 100%;
    min-height: 0;
    max-height: none;
    overflow: auto;
    padding: 10px;
    border-radius: 18px;
}

.device-panel table {
    min-width: 1260px;
}

.form-panel {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    min-height: 0;
    height: 100%;
}

.form-panel .device-form {
    height: 100%;
    min-height: 0;
    overflow: auto;
    align-content: start;
    gap: 18px 22px;
    padding-right: 6px;
}

.terminal-card {
    display: grid;
    grid-template-rows: auto auto minmax(0, 1fr);
    gap: 14px;
    height: 100%;
    min-height: 0;
    overflow: hidden;
}

.terminal-card .card-title {
    margin-bottom: 0;
}

.terminal-card .terminal-meta {
    margin-bottom: 0;
}

#terminal {
    height: 100% !important;
    min-height: 0 !important;
    max-height: none;
}

.module-panel[data-panel="license"] {
    grid-template-rows: minmax(0, 1fr);
    min-height: 0;
    overflow: hidden;
}

.module-panel[data-panel="license"].active {
    height: 100%;
    min-height: 0;
}

.license-frame-card {
    height: 100%;
    min-height: 0;
    overflow: hidden;
}

.license-frame-card > .license-tool-shell {
    height: 100%;
    min-height: 0;
    overflow: hidden;
}

.license-tool-shell {
    grid-template-rows: auto minmax(0, 1fr);
    gap: 16px;
}

.license-subpage-tabs {
    margin: 0 18px;
}

.license-tool-grid {
    height: 100%;
    min-height: 0;
    padding: 0 18px 18px;
}

.license-tool-card,
.license-guide-card {
    height: 100%;
    min-height: 0;
    overflow: hidden;
}

.license-tool-card-body,
.license-guide {
    min-height: 0;
    overflow: auto;
}

.license-records-panel {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    min-height: 0;
}

.license-record-table {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    align-content: stretch;
    height: 100%;
    min-height: 0;
    max-height: none;
    overflow: hidden;
    gap: 10px;
}

.license-record-header {
    position: relative;
    top: auto;
}

.license-record-list {
    min-height: 0;
    overflow: auto;
    align-content: start;
    gap: 10px;
    padding-right: 6px;
}

.license-record-cell {
    min-height: 54px;
    padding: 0 14px;
}

.module-panel[data-panel="ota"] {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr);
    grid-template-areas: none;
    min-height: 0;
    overflow: hidden;
}

.ota-config-card.module-subpage.active {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto auto minmax(0, 1fr) minmax(0, 1fr);
    gap: 18px;
    height: 100%;
    min-height: 0;
}

.ota-panel-section {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    gap: 12px;
    min-height: 0;
    overflow: hidden;
}

.ota-basic-grid {
    margin-bottom: 0;
}

.release-plan-list,
.ota-device-list {
    min-height: 0;
    max-height: none;
    overflow: auto;
}

.release-library-card.module-subpage.active {
    display: grid !important;
    grid-template-rows: auto auto minmax(0, 1fr);
    height: 100%;
    min-height: 0;
}

.release-library-card .table-wrap {
    min-height: 0;
    overflow: auto;
}

.ota-task-card.module-subpage.active {
    display: grid !important;
    grid-template-rows: auto minmax(0, 1fr) auto minmax(0, 0.8fr);
    height: 100%;
    min-height: 0;
}

.ota-task-card .table-wrap,
#otaTaskOutput {
    min-height: 0;
    overflow: auto;
}

.module-panel[data-panel="audit"] {
    grid-template-rows: minmax(0, 1fr);
    min-height: 0;
    overflow: hidden;
}

.audit-card {
    height: 100%;
    min-height: 0;
}

.audit-card .table-wrap {
    min-height: 0;
    overflow: auto;
}

@media (max-width: 1500px) {
    .license-tool-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .license-subpage[data-license-subpage-panel="key"] .license-preview-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .ota-config-card.module-subpage.active {
        grid-template-rows: auto auto minmax(0, 1fr) minmax(0, 1fr);
    }
}

@media (max-width: 900px) {
    .ops-layout:not(.screen-mode) {
        height: auto;
        min-height: 100vh;
        overflow: auto;
    }

    .ops-layout:not(.screen-mode) .module-panel.active {
        overflow: visible;
    }

    .license-subpage-tabs,
    .license-tool-grid {
        margin: 0;
        padding-inline: 0;
    }

    .license-tool-grid,
    .release-upload-grid,
    .ota-grid,
    .agent-grid {
        grid-template-columns: 1fr;
    }

    .ota-config-card.module-subpage.active {
        grid-template-rows: auto auto auto auto;
    }

    .license-subpage[data-license-subpage-panel="key"] .license-preview-grid,
    .license-subpage[data-license-subpage-panel="generate"] .license-form,
    .release-library-card .release-upload-grid {
        grid-template-columns: 1fr;
    }
}
