:root {
    color-scheme: light;
    font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: #f2f5f3;
    color: #1c2520;
    --green-950: #17231c;
    --green-800: #245b34;
    --green-700: #2f7a42;
    --green-100: #e4f4e8;
    --red-700: #9b3a32;
    --red-100: #f7e8e6;
    --line: #dfe6e1;
    --muted: #657169;
    --surface: #ffffff;
    --shadow: 0 14px 38px rgba(25, 43, 33, .08);
}

* { box-sizing: border-box; }
html { min-height: 100%; }
body { margin: 0; min-height: 100%; }
body.modal-open { overflow: hidden; }
button, input { font: inherit; }

.container { max-width: 1420px; margin: 0 auto; padding: 42px 28px 72px; }
.page-header { display: flex; justify-content: space-between; gap: 30px; align-items: flex-end; margin-bottom: 30px; }
.eyebrow { color: var(--green-700); text-transform: uppercase; letter-spacing: .16em; font-weight: 850; margin: 0 0 9px; font-size: .76rem; }
h1 { margin: 0; font-size: clamp(2.2rem, 5vw, 4rem); line-height: 1; letter-spacing: -.045em; }
.subtitle { color: #58645d; margin: 12px 0 0; font-size: 1rem; }

.summary-grid { display: grid; grid-template-columns: repeat(3, minmax(112px, 1fr)); gap: 10px; }
.summary-card { min-width: 112px; border-radius: 16px; padding: 15px 18px; text-align: center; border: 1px solid var(--line); background: var(--surface); }
.summary-card strong { display: block; font-size: 1.75rem; line-height: 1.1; }
.summary-card span { display: block; margin-top: 5px; color: var(--muted); font-size: .8rem; font-weight: 700; }
.summary-total { background: var(--green-950); border-color: var(--green-950); color: white; }
.summary-total span { color: #cad5ce; }
.summary-online strong { color: var(--green-700); }
.summary-offline strong { color: var(--red-700); }

.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 20px; }
.search-box { position: relative; display: block; flex: 1; max-width: 590px; }
.search-icon { position: absolute; left: 16px; top: 50%; transform: translateY(-52%); color: #718078; font-size: 1.45rem; pointer-events: none; }
.search-box input { width: 100%; min-height: 48px; border: 1px solid #d9e1dc; border-radius: 13px; background: white; padding: 0 17px 0 46px; color: #1c2520; outline: none; box-shadow: 0 4px 16px rgba(24, 40, 31, .035); transition: border-color .18s ease, box-shadow .18s ease; }
.search-box input:focus { border-color: #70aa7e; box-shadow: 0 0 0 4px rgba(52, 139, 70, .12); }
.search-result { margin: 0; color: var(--muted); font-size: .9rem; font-weight: 700; white-space: nowrap; }

.device-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(315px, 1fr)); gap: 20px; }
.device-card, .empty, .error { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow); }
.device-card { position: relative; min-height: 338px; padding: 22px; cursor: pointer; outline: none; overflow: hidden; transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease; }
.device-card::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 4px; background: #45a45a; opacity: .9; }
.device-card.offline::before { background: #c9665d; }
.device-card:hover, .device-card:focus-visible { transform: translateY(-3px); border-color: #bdd1c3; box-shadow: 0 18px 45px rgba(25, 43, 33, .12); }
.device-card:focus-visible { box-shadow: 0 0 0 4px rgba(52, 139, 70, .15), 0 18px 45px rgba(25, 43, 33, .12); }
.device-card[hidden] { display: none; }

.device-card-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 15px; }
.device-identity { display: flex; gap: 11px; align-items: flex-start; min-width: 0; }
.device-state-dot { flex: 0 0 auto; width: 11px; height: 11px; margin-top: 8px; border-radius: 50%; background: #42a456; box-shadow: 0 0 0 5px #e5f4e8; }
.device-card.offline .device-state-dot, .device-state-dot.offline { background: #bd554c; box-shadow: 0 0 0 5px #f7e7e5; }
.device-state-dot.online { background: #42a456; box-shadow: 0 0 0 5px #e5f4e8; }
.device-card h2 { margin: 0; font-size: 1.45rem; line-height: 1.2; letter-spacing: -.02em; }
.device-identity p { margin: 4px 0 0; color: var(--muted); font-size: .88rem; overflow-wrap: anywhere; }
.status-badge { flex: 0 0 auto; font-weight: 850; font-size: .76rem; padding: 7px 11px; border-radius: 999px; }
.status-badge.online { background: var(--green-100); color: #1d7531; }
.status-badge.offline { background: var(--red-100); color: var(--red-700); }

.device-version { margin: 22px 0 19px; padding: 15px 16px; border-radius: 13px; background: #f4f7f5; border: 1px solid #e7ece9; }
.device-version .label { display: block; color: var(--muted); font-size: .75rem; font-weight: 750; text-transform: uppercase; letter-spacing: .08em; }
.device-version strong { display: block; margin-top: 5px; font-size: 1rem; overflow-wrap: anywhere; }
.device-card-facts { display: grid; grid-template-columns: 1fr 1fr; gap: 16px 18px; }
.device-card-facts > div { min-width: 0; }
.fact-label { display: block; color: var(--muted); font-size: .76rem; margin-bottom: 4px; }
.device-card-facts strong { display: block; font-size: .9rem; line-height: 1.35; overflow-wrap: anywhere; }
.device-card-footer { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 22px; padding-top: 16px; border-top: 1px solid #edf0ee; }
.health-indicator { color: #667169; font-size: .78rem; font-weight: 700; }
.health-indicator.healthy { color: #27753a; }
.health-indicator.healthy span { color: #3da653; }
.details-link { color: var(--green-800); font-weight: 800; font-size: .84rem; }

.empty { padding: 54px; text-align: center; }
.empty h2 { margin-top: 0; }
.error { padding: 20px; border-color: #d89791; background: #fff5f4; color: #8a2e27; }
.no-results { padding: 42px; margin: 0; text-align: center; color: var(--muted); background: white; border: 1px dashed #cbd5cf; border-radius: 16px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

.modal[hidden] { display: none; }
.modal { position: fixed; inset: 0; z-index: 1000; display: grid; place-items: center; padding: 28px; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(15, 23, 18, .68); backdrop-filter: blur(4px); }
.modal-panel { position: relative; width: min(1040px, 100%); max-height: min(88vh, 920px); overflow: hidden; display: flex; flex-direction: column; background: white; border-radius: 20px; box-shadow: 0 30px 90px rgba(4, 12, 7, .32); animation: modal-in .18s ease-out; }
@keyframes modal-in { from { opacity: 0; transform: translateY(10px) scale(.985); } to { opacity: 1; transform: translateY(0) scale(1); } }
.modal-header { display: flex; justify-content: space-between; align-items: center; gap: 20px; padding: 22px 25px; border-bottom: 1px solid var(--line); }
.modal-title-wrap { display: flex; align-items: flex-start; gap: 13px; }
.modal-title-wrap .device-state-dot { margin-top: 10px; }
.modal-kicker { margin: 0 0 3px; color: var(--green-700); font-size: .72rem; text-transform: uppercase; letter-spacing: .1em; font-weight: 850; }
.modal-header h2 { margin: 0; font-size: 1.65rem; }
.modal-header-actions { display: flex; align-items: center; gap: 12px; }
.modal-close { width: 40px; height: 40px; padding: 0 0 3px; border: 0; border-radius: 11px; background: #edf1ee; color: #354139; font-size: 1.7rem; line-height: 1; cursor: pointer; transition: background .15s ease; }
.modal-close:hover, .modal-close:focus-visible { background: #dde5df; outline: none; }
.modal-body { padding: 24px 25px 29px; overflow-y: auto; display: grid; grid-template-columns: 1fr 1fr; gap: 18px; background: #f7f9f8; }
.detail-section { background: white; border: 1px solid var(--line); border-radius: 15px; padding: 19px; }
.detail-section h3 { margin: 0 0 13px; font-size: 1rem; }
.detail-grid { margin: 0; }
.detail-grid div { display: grid; grid-template-columns: minmax(115px, .75fr) minmax(0, 1.4fr); gap: 13px; padding: 10px 0; border-bottom: 1px solid #edf1ee; }
.detail-grid div:last-child { border-bottom: 0; }
.detail-grid dt { color: var(--muted); font-size: .82rem; }
.detail-grid dd { margin: 0; font-weight: 700; font-size: .86rem; overflow-wrap: anywhere; }
.inline-state { display: inline-flex; align-items: center; padding: 4px 8px; border-radius: 999px; background: #eef1ef; color: #536057; font-size: .76rem; }
.inline-state.ok { background: var(--green-100); color: #1d7531; }
.inline-state.error-state { background: var(--red-100); color: var(--red-700); }

@media (max-width: 900px) {
    .page-header { align-items: flex-start; flex-direction: column; }
    .summary-grid { width: 100%; }
    .modal-body { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
    .container { padding: 28px 16px 52px; }
    .summary-grid { grid-template-columns: repeat(3, 1fr); }
    .summary-card { min-width: 0; padding: 13px 8px; }
    .toolbar { align-items: stretch; flex-direction: column; gap: 10px; }
    .search-box { max-width: none; }
    .search-result { padding-left: 2px; }
    .device-grid { grid-template-columns: 1fr; }
    .device-card { min-height: 0; }
    .modal { padding: 0; place-items: stretch; }
    .modal-panel { width: 100%; max-height: 100vh; min-height: 100vh; border-radius: 0; }
    .modal-header { padding: 18px 16px; }
    .modal-body { padding: 16px; }
    .modal-header-actions .status-badge { display: none; }
    .detail-grid div { grid-template-columns: 1fr; gap: 4px; }
}

/* Automation OS platform header */
.platform-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 28px;
    min-height: 56px;
    margin-bottom: 42px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--line);
}
.platform-brand {
    display: inline-flex;
    align-items: center;
    gap: 11px;
    color: var(--green-950);
    font-weight: 850;
    text-decoration: none;
    letter-spacing: -.01em;
}
.brand-mark {
    display: inline-grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border-radius: 10px;
    background: var(--green-950);
    color: #fff;
    font-size: .72rem;
    letter-spacing: .06em;
}
.platform-nav-links {
    display: flex;
    align-items: center;
    gap: 8px;
}
.platform-nav-links a,
.platform-nav-links span {
    display: inline-flex;
    align-items: center;
    min-height: 38px;
    padding: 0 13px;
    border-radius: 10px;
    color: #667169;
    font-size: .84rem;
    font-weight: 750;
    text-decoration: none;
    white-space: nowrap;
}
.platform-nav-links .active {
    background: var(--green-100);
    color: var(--green-800);
}
.platform-nav-links .planned {
    cursor: default;
    opacity: .58;
}
.page-heading { max-width: 760px; }

@media (max-width: 820px) {
    .platform-nav {
        align-items: flex-start;
        flex-direction: column;
        margin-bottom: 32px;
    }
    .platform-nav-links {
        width: 100%;
        overflow-x: auto;
        padding-bottom: 3px;
    }
}

@media (max-width: 480px) {
    .platform-nav-links .planned { display: none; }
}

/* Device Manager layout refinement */
.container {
    width: min(1700px, 95%);
    max-width: none;
    padding-top: 34px;
}

.platform-nav {
    margin-bottom: 50px;
}

.page-header {
    align-items: flex-end;
    margin-bottom: 44px;
}

.page-heading {
    max-width: 900px;
}

.summary-grid {
    margin-left: auto;
}

.toolbar {
    margin-bottom: 28px;
}

.device-grid {
    grid-template-columns: repeat(auto-fill, minmax(360px, 380px));
    gap: 24px;
    justify-content: start;
}

.device-card {
    min-height: 365px;
    padding: 24px;
}

.device-version {
    padding: 17px 18px;
}

.device-version strong {
    font-size: 1.08rem;
}

.version-build {
    display: block;
    margin-top: 4px;
    color: var(--muted);
    font-size: .78rem;
    font-weight: 700;
}

.device-card.online .device-state-dot,
.device-state-dot.online {
    animation: device-online-pulse 2.8s ease-out infinite;
}

@keyframes device-online-pulse {
    0%, 55%, 100% { box-shadow: 0 0 0 5px #e5f4e8; }
    72% { box-shadow: 0 0 0 9px rgba(66, 164, 86, .08); }
}

@media (prefers-reduced-motion: reduce) {
    .device-card.online .device-state-dot,
    .device-state-dot.online {
        animation: none;
    }
}

@media (max-width: 900px) {
    .container { width: auto; }
    .page-header { margin-bottom: 34px; }
    .summary-grid { margin-left: 0; }
}

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

/* Device detail: remote maintenance */
.remote-access-section {
    grid-column: 1 / -1;
    padding: 21px;
}
.remote-access-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 18px;
}
.remote-access-header h3 { margin-bottom: 4px; }
.remote-access-header p {
    margin: 0;
    color: var(--muted);
    font-size: .84rem;
}
.remote-status {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    flex: 0 0 auto;
    padding: 7px 11px;
    border-radius: 999px;
    font-size: .77rem;
    font-weight: 850;
    background: #eef1ef;
    color: #5a665f;
}
.remote-status.connected {
    background: var(--green-100);
    color: #1d7531;
}
.remote-status.connected span { color: #3da653; }
.remote-status.disconnected {
    background: var(--red-100);
    color: var(--red-700);
}
.remote-facts {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1px;
    margin: 0 0 18px;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 13px;
    background: var(--line);
}
.remote-facts > div {
    min-width: 0;
    padding: 13px 15px;
    background: #f7f9f8;
}
.remote-facts dt {
    margin-bottom: 4px;
    color: var(--muted);
    font-size: .73rem;
}
.remote-facts dd {
    margin: 0;
    font-size: .86rem;
    font-weight: 800;
    overflow-wrap: anywhere;
}
.remote-actions {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 10px;
}
.remote-action {
    min-width: 0;
    min-height: 64px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 12px;
    border: 1px solid #dbe4de;
    border-radius: 12px;
    background: #fff;
    color: #223029;
    text-align: left;
    text-decoration: none;
    cursor: pointer;
    transition: border-color .15s ease, background .15s ease, transform .15s ease;
}
.remote-action:hover,
.remote-action:focus-visible {
    border-color: #9fbea8;
    background: #f5f9f6;
    transform: translateY(-1px);
    outline: none;
}
.remote-action-primary {
    background: var(--green-950);
    border-color: var(--green-950);
    color: #fff;
}
.remote-action-primary:hover,
.remote-action-primary:focus-visible {
    background: #22372a;
    border-color: #22372a;
}
.remote-action.copied {
    background: var(--green-100);
    border-color: #9dcca8;
    color: #1d7531;
}
.remote-action-icon {
    flex: 0 0 auto;
    display: grid;
    place-items: center;
    width: 30px;
    height: 30px;
    border-radius: 8px;
    background: #edf2ee;
    color: var(--green-800);
    font-size: .68rem;
    font-weight: 900;
}
.remote-action-primary .remote-action-icon {
    background: rgba(255,255,255,.13);
    color: #fff;
}
.remote-action span:last-child { min-width: 0; }
.remote-action strong,
.remote-action small { display: block; }
.remote-action strong { font-size: .82rem; }
.remote-action small {
    margin-top: 2px;
    color: var(--muted);
    font-size: .68rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.remote-action-primary small { color: #c7d3cb; }
.remote-action.copied small { color: #27753a; }
.remote-hint {
    margin: 12px 0 0;
    color: var(--muted);
    font-size: .75rem;
}
.remote-unavailable {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 14px 15px;
    border: 1px dashed #cbd5cf;
    border-radius: 12px;
    background: #f8faf9;
}
.remote-unavailable strong { font-size: .84rem; }
.remote-unavailable span { color: var(--muted); font-size: .76rem; }

@media (max-width: 1000px) {
    .remote-actions { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 720px) {
    .remote-access-header { flex-direction: column; }
    .remote-facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .remote-actions { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 430px) {
    .remote-facts,
    .remote-actions { grid-template-columns: 1fr; }
}

/* Device detail polish: fixed header, larger workspace and compact sections */
.modal-panel {
    width: min(1180px, 96vw);
    height: min(92vh, 980px);
    max-height: 92vh;
}
.modal-header {
    flex: 0 0 auto;
    position: relative;
    z-index: 2;
    background: #fff;
}
.modal-body {
    flex: 1 1 auto;
    min-height: 0;
    align-content: start;
    scrollbar-gutter: stable;
}
.remote-access-section { order: 0; }
.remote-facts {
    gap: 12px;
    overflow: visible;
    border: 0;
    background: transparent;
}
.remote-facts > div {
    min-height: 78px;
    padding: 15px 16px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #f7f9f8;
}
.remote-facts dt {
    text-transform: uppercase;
    letter-spacing: .055em;
    font-weight: 750;
}
.remote-facts dd { font-size: .94rem; }
.remote-actions {
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 11px;
}
.remote-action {
    min-height: 74px;
    padding: 13px 14px;
}
.remote-action-icon {
    width: 34px;
    height: 34px;
}
.remote-action strong { font-size: .86rem; }
.remote-action small { font-size: .7rem; }
.remote-action-disabled {
    cursor: not-allowed;
    opacity: .58;
    background: #f4f6f5;
}
.remote-action-disabled:hover {
    transform: none;
    border-color: #dbe4de;
    background: #f4f6f5;
}
.registry-section .detail-grid div { padding: 9px 0; }

@media (max-width: 1120px) {
    .remote-actions { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
    .modal-panel { height: 100vh; max-height: 100vh; width: 100%; }
}


/* Global action feedback */
.app-toast {
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 1000;
    max-width: min(460px, calc(100vw - 32px));
    padding: 13px 16px;
    border: 1px solid rgba(255,255,255,.16);
    border-radius: 12px;
    background: #12261b;
    color: #fff;
    box-shadow: 0 16px 40px rgba(9, 30, 19, .28);
    font-size: .86rem;
    font-weight: 700;
    opacity: 0;
    transform: translateY(8px);
    transition: opacity .18s ease, transform .18s ease;
}
.app-toast.visible {
    opacity: 1;
    transform: translateY(0);
}
@media (max-width: 640px) {
    .app-toast { right: 16px; bottom: 16px; left: 16px; max-width: none; }
}

/* Remote access v1.0 final states */
.remote-status.standby {
    background: #fff4d6;
    color: #8a5a00;
}
.remote-status.standby span { color: #d79a18; }
.remote-status.not-configured {
    background: var(--red-100);
    color: var(--red-700);
}
.remote-status.not-configured span { color: #c84b4b; }
.remote-facts {
    grid-template-columns: repeat(5, minmax(0, 1fr));
}
.remote-action-disabled {
    cursor: not-allowed;
    opacity: .58;
    background: #f3f5f4;
    color: #69736d;
}
.remote-action-disabled:hover {
    border-color: #dbe4de;
    background: #f3f5f4;
    transform: none;
}
@media (max-width: 1000px) {
    .remote-facts { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 720px) {
    .remote-facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 430px) {
    .remote-facts { grid-template-columns: 1fr; }
}

/* Portal database bootstrap */
.bootstrap-panel { max-width: 720px; margin: 5vh auto; text-align: left; }
.bootstrap-form { display: grid; gap: 1rem; margin-top: 1.5rem; }
.bootstrap-form label { display: grid; gap: .4rem; font-weight: 600; }
.bootstrap-form input { width: 100%; padding: .8rem; border: 1px solid #3b4658; border-radius: 8px; background: #111827; color: #f8fafc; }
.bootstrap-form button, .button-link { display: inline-block; width: fit-content; padding: .8rem 1.2rem; border: 0; border-radius: 8px; background: #2563eb; color: #fff; font-weight: 700; text-decoration: none; cursor: pointer; }
.success { padding: 1rem; margin: 1rem 0; border: 1px solid #16a34a; border-radius: 8px; background: rgba(22, 163, 74, .12); }

/* Portal administration */
.success { padding: 18px 20px; border: 1px solid #9ac9a4; border-radius: 14px; background: #eef9f0; color: #236b34; }
.admin-message { margin-bottom: 20px; }
.admin-panel, .admin-table-wrap, .admin-card { background: var(--surface); border: 1px solid var(--line); border-radius: 17px; box-shadow: var(--shadow); }
.admin-panel { margin-bottom: 26px; overflow: hidden; }
.admin-panel > summary, .row-editor > summary, .permission-list > summary { cursor: pointer; font-weight: 800; color: var(--green-800); }
.admin-panel > summary { padding: 18px 22px; list-style-position: inside; }
.admin-panel[open] > summary { border-bottom: 1px solid var(--line); background: #f6f9f7; }
.admin-form { display: grid; grid-template-columns: repeat(3, minmax(180px, 1fr)); gap: 17px; padding: 22px; }
.admin-form.compact { grid-template-columns: repeat(2, minmax(190px, 1fr)); padding: 16px 0 2px; }
.admin-form label { display: grid; gap: 7px; color: #536057; font-size: .8rem; font-weight: 750; }
.admin-form input, .admin-form select { width: 100%; min-height: 43px; border: 1px solid #d4ddd7; border-radius: 10px; background: #fff; padding: 8px 11px; color: #1c2520; }
.admin-form input:focus, .admin-form select:focus { outline: none; border-color: #70aa7e; box-shadow: 0 0 0 3px rgba(52,139,70,.12); }
.admin-form button, .button-link { min-height: 42px; border: 0; border-radius: 10px; padding: 0 17px; background: var(--green-800); color: #fff; font-weight: 800; cursor: pointer; text-decoration: none; }
.form-actions { display: flex; align-items: end; }
.checkbox-label { display: flex !important; grid-column: 1 / -1; align-items: center; flex-direction: row; gap: 9px !important; }
.checkbox-label input { width: auto; min-height: auto; }
.admin-table-wrap { overflow-x: auto; }
.admin-table { width: 100%; border-collapse: collapse; min-width: 900px; }
.admin-table th, .admin-table td { padding: 16px 18px; border-bottom: 1px solid #e9eeeb; text-align: left; vertical-align: top; }
.admin-table th { background: #f5f8f6; color: #637068; font-size: .76rem; text-transform: uppercase; letter-spacing: .05em; }
.admin-table td { font-size: .88rem; }
.admin-table small { display: block; margin-top: 4px; color: var(--muted); }
.admin-table tr:last-child td { border-bottom: 0; }
.row-editor { min-width: 105px; }
.row-editor[open] { min-width: 520px; }
.admin-card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(350px, 1fr)); gap: 22px; }
.admin-card { padding: 22px; }
.admin-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 15px; margin-bottom: 16px; }
.admin-card-head h2 { margin: 0; font-size: 1.2rem; }
.admin-card-head p { margin: 4px 0 0; color: var(--muted); font-size: .8rem; }
.role-count { border-radius: 999px; background: #edf4ef; padding: 7px 10px; color: var(--green-800); font-size: .75rem; font-weight: 800; white-space: nowrap; }
.permission-list { margin-top: 18px; border-top: 1px solid var(--line); padding-top: 15px; }
.permission-list ul { list-style: none; margin: 14px 0 0; padding: 0; }
.permission-list li { padding: 9px 0; border-bottom: 1px solid #edf1ee; }
.permission-list li:last-child { border-bottom: 0; }
.permission-list small { display: block; margin-top: 3px; color: var(--muted); font-family: ui-monospace, monospace; }
@media (max-width: 900px) { .admin-form { grid-template-columns: 1fr 1fr; } }
@media (max-width: 640px) { .admin-form, .admin-form.compact { grid-template-columns: 1fr; } .admin-card-grid { grid-template-columns: 1fr; } .row-editor[open] { min-width: 280px; } }

.device-organization {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    margin-top: 1rem;
    padding: .7rem .8rem;
    border-radius: .65rem;
    background: var(--surface-muted, #f3f6f4);
    font-size: .82rem;
}
.device-organization span { color: var(--text-muted, #66736b); }
.device-organization strong { text-align: right; }
.section-description { margin: -.25rem 0 1rem; color: var(--text-muted, #66736b); }
.device-assignment-form { max-width: 720px; }

/* Customer dashboard and device master data */
.dashboard-hero { display:flex; align-items:flex-end; justify-content:space-between; gap:28px; margin:8px 0 34px; }
.dashboard-hero h1 { max-width:900px; }
.primary-link { display:inline-flex; align-items:center; gap:10px; min-height:46px; padding:0 18px; border-radius:12px; background:var(--green-950); color:#fff; text-decoration:none; font-weight:800; white-space:nowrap; }
.dashboard-kpis { display:grid; grid-template-columns:repeat(5,minmax(150px,1fr)); gap:16px; margin-bottom:36px; }
.dashboard-kpi { min-height:155px; padding:21px; border:1px solid var(--line); border-radius:17px; background:#fff; box-shadow:var(--shadow); }
.dashboard-kpi > span { display:block; color:var(--muted); font-size:.8rem; font-weight:800; }
.dashboard-kpi strong { display:block; margin:15px 0 10px; font-size:2.35rem; line-height:1; }
.dashboard-kpi small { color:var(--muted); line-height:1.35; }
.dashboard-kpi-dark { background:var(--green-950); border-color:var(--green-950); color:#fff; }
.dashboard-kpi-dark > span,.dashboard-kpi-dark small { color:#cbd6cf; }
.kpi-good { color:var(--green-700); }.kpi-bad { color:var(--red-700); }.kpi-warn { color:#a16516; }
.dashboard-section { margin-top:28px; padding:26px; border:1px solid var(--line); border-radius:19px; background:#fff; box-shadow:var(--shadow); }
.dashboard-section-head { display:flex; align-items:flex-end; justify-content:space-between; gap:24px; margin-bottom:18px; }
.dashboard-section-head h2,.dashboard-next h2 { margin:0; font-size:1.55rem; }
.dashboard-section-head a { color:var(--green-800); font-weight:800; text-decoration:none; }
.dashboard-device-list { border-top:1px solid var(--line); }
.dashboard-device-row { display:grid; grid-template-columns:auto minmax(220px,1.5fr) minmax(150px,.8fr) minmax(150px,.8fr) auto auto; gap:18px; align-items:center; min-height:82px; padding:14px 8px; border-bottom:1px solid var(--line); color:inherit; text-decoration:none; }
.dashboard-device-row:hover { background:#f6f9f7; }
.dashboard-device-row .device-state-dot { margin:0 3px; }
.dashboard-device-main strong,.dashboard-device-main small,.dashboard-device-meta strong,.dashboard-device-meta small { display:block; }
.dashboard-device-main small,.dashboard-device-meta small { margin-top:4px; color:var(--muted); font-size:.78rem; }
.dashboard-device-meta strong { margin-top:4px; font-size:.85rem; }
.dashboard-row-arrow { color:var(--green-800); font-weight:900; font-size:1.1rem; }
.dashboard-next { display:flex; justify-content:space-between; align-items:center; gap:30px; background:#f7faf8; }
.dashboard-next p { max-width:700px; color:var(--muted); }
.dashboard-next-grid { display:flex; align-items:center; gap:10px; flex-wrap:wrap; }
.dashboard-next-grid > span { padding:9px 13px; border:1px solid var(--line); border-radius:999px; background:#fff; color:var(--muted); font-weight:750; font-size:.8rem; }
.dashboard-remote-button {
    display:grid;
    grid-template-columns:auto 1fr auto;
    align-items:center;
    gap:11px;
    min-width:190px;
    padding:10px 12px;
    border:1px solid #b7d9c2;
    border-radius:14px;
    background:#fff;
    color:#174f2d;
    text-decoration:none;
    box-shadow:0 8px 22px rgba(19,76,43,.08);
    transition:border-color .18s ease, box-shadow .18s ease, transform .18s ease, background .18s ease;
}
.dashboard-remote-button:hover {
    border-color:#4fa56b;
    background:#f5fbf7;
    box-shadow:0 10px 28px rgba(19,76,43,.14);
    transform:translateY(-1px);
}
.dashboard-remote-button:focus-visible { outline:3px solid rgba(47,139,75,.22); outline-offset:2px; }
.dashboard-remote-button__icon {
    display:grid;
    place-items:center;
    width:34px;
    height:34px;
    padding:0;
    border:0;
    border-radius:10px;
    background:#e7f4eb;
    color:#237841;
    font-size:1rem;
}
.dashboard-remote-button__text { display:flex; align-items:center; min-width:0; padding:0; border:0; border-radius:0; background:transparent; }
.dashboard-remote-button__text strong { color:#174f2d; font-size:.88rem; line-height:1.2; }
.dashboard-remote-button__arrow { padding:0; border:0; border-radius:0; background:transparent; color:#237841; font-size:1rem; }
.section-title-row { display:flex; justify-content:space-between; align-items:center; gap:14px; }
.master-description,.customer-note { margin:14px 0 0; padding:13px 14px; border-radius:11px; background:#f5f8f6; color:#4f5c54; line-height:1.5; font-size:.87rem; }
.customer-note strong,.customer-note p { display:block; margin:0; }.customer-note p { margin-top:5px; }
.master-editor { margin-top:15px; }
.admin-form textarea { width:100%; resize:vertical; min-height:78px; }
.admin-form .form-wide { grid-column:1/-1; }

@media (max-width:1100px) {
    .dashboard-kpis { grid-template-columns:repeat(3,1fr); }
    .dashboard-device-row { grid-template-columns:auto minmax(200px,1fr) minmax(140px,.7fr) auto auto; }
    .dashboard-device-meta:nth-of-type(2) { display:none; }
}
@media (max-width:760px) {
    .dashboard-hero,.dashboard-section-head,.dashboard-next { align-items:flex-start; flex-direction:column; }
    .dashboard-kpis { grid-template-columns:1fr 1fr; }
    .dashboard-device-row { grid-template-columns:auto 1fr auto; gap:12px; }
    .dashboard-device-meta,.dashboard-row-arrow { display:none; }
}
@media (max-width:480px) { .dashboard-kpis { grid-template-columns:1fr; } }

/* Remote access workflow */
.remote-grant-panel { margin-bottom: 34px; }
.remote-grant-panel h2 { margin-top: 0; }
.remote-list { display: grid; gap: 18px; }
.remote-card { background: #fff; border: 1px solid var(--border); border-left: 5px solid #9ca3af; border-radius: 18px; padding: 22px; box-shadow: 0 8px 26px rgba(15,23,42,.05); }
.remote-card.open { border-left-color: #d59a20; }
.remote-card.active { border-left-color: #1f8a57; }
.remote-card-head { display:flex; justify-content:space-between; gap:18px; align-items:flex-start; margin-bottom:18px; }
.remote-card-head h3 { margin:2px 0 4px; font-size:1.25rem; }
.remote-card-head p { margin:0; color:var(--muted); }
.remote-actions { display:flex; flex-wrap:wrap; gap:10px; align-items:center; margin-top:18px; }
.remote-actions form { margin:0; }
.secondary-button { background:#fff; color:#7f1d1d; border:1px solid #fecaca; }
.secondary-button:hover { background:#fef2f2; }
.status-badge.standby { background:#fff7df; color:#805c06; }
@media (max-width:680px){.remote-card-head{flex-direction:column}.remote-actions{align-items:stretch}.remote-actions form,.remote-actions button,.remote-actions a{width:100%;text-align:center}}

/* Complete remote-access workflow */
.remote-hero { margin-bottom:22px; }
.remote-kpis { display:grid; grid-template-columns:repeat(3,minmax(180px,1fr)); gap:16px; margin:0 0 28px; }
.remote-kpis article { padding:20px; border:1px solid var(--line); border-radius:16px; background:#fff; box-shadow:var(--shadow); }
.remote-kpis span,.remote-kpis small { display:block; color:var(--muted); }
.remote-kpis span { font-size:.8rem; font-weight:800; }
.remote-kpis strong { display:block; margin:12px 0 8px; font-size:2rem; }
.remote-kpi-active { border-color:#b9dfc8 !important; background:#f2faf5 !important; }
.remote-panel-heading { display:flex; align-items:flex-start; justify-content:space-between; gap:24px; margin-bottom:20px; }
.remote-panel-heading h2 { margin:2px 0 0; }
.security-note { max-width:330px; padding:10px 12px; border-radius:10px; background:#eef6f1; color:#315d43; font-size:.78rem; font-weight:750; }
.remote-grant-form { grid-template-columns:1fr; }
.remote-choice { margin:0; padding:0; border:0; }
.remote-choice legend { margin-bottom:9px; color:var(--muted); font-size:.8rem; font-weight:800; }
.choice-grid { display:grid; grid-template-columns:repeat(5,minmax(120px,1fr)); gap:10px; }
.duration-grid { grid-template-columns:repeat(3,minmax(140px,1fr)); max-width:650px; }
.choice-grid label { position:relative; cursor:pointer; }
.choice-grid input { position:absolute; opacity:0; pointer-events:none; }
.choice-grid span { display:flex; align-items:center; justify-content:center; min-height:48px; padding:8px 12px; border:1px solid var(--line); border-radius:11px; background:#fff; font-weight:800; text-align:center; }
.choice-grid input:checked + span { border-color:var(--green-800); background:#edf7f0; color:var(--green-950); box-shadow:0 0 0 2px rgba(31,138,87,.12); }
.choice-grid input:focus-visible + span { outline:3px solid rgba(31,138,87,.25); outline-offset:2px; }
.consent-box { display:flex; flex-direction:column; gap:5px; padding:14px 16px; border-left:4px solid var(--green-700); border-radius:10px; background:#f5f9f6; font-size:.84rem; }
.consent-box span { color:var(--muted); }
.queue-count { padding:7px 11px; border-radius:999px; background:#fff7df; color:#805c06; font-weight:850; font-size:.78rem; }
.remote-detail-grid { grid-template-columns:repeat(4,minmax(130px,1fr)); }
.remote-comment { margin-top:16px; padding:14px 16px; border-radius:11px; background:#f5f8f6; }
.remote-comment strong { display:block; margin-bottom:5px; font-size:.8rem; }
.remote-comment p { margin:0; white-space:normal; line-height:1.5; color:#4f5c54; }
.remote-countdown { display:flex; align-items:center; justify-content:space-between; gap:18px; margin-top:16px; padding:13px 15px; border-radius:11px; background:#eef6f1; }
.remote-countdown span { color:#4e6757; font-size:.8rem; font-weight:800; }
.remote-countdown strong { font-variant-numeric:tabular-nums; font-size:1.18rem; }
.remote-countdown.urgent { background:#fff7df; color:#805c06; }
.remote-countdown.expired { background:#fef2f2; color:#991b1b; }
.claimed-note { padding:10px 12px; border-radius:9px; background:#f4f5f4; color:var(--muted); font-size:.8rem; font-weight:750; }
.remote-end-reason { margin:14px 0 0; color:var(--muted); font-size:.82rem; }
.empty.compact { padding:22px; }
.empty.compact p { margin:0; }

/* History section */
.remote-history { padding:0; overflow:hidden; }
.remote-history > summary { display:flex; justify-content:space-between; align-items:center; gap:20px; padding:22px 26px; cursor:pointer; list-style:none; }
.remote-history > summary::-webkit-details-marker { display:none; }
.remote-history > summary > span:first-child { display:flex; flex-direction:column; gap:3px; }
.remote-history > summary strong { font-size:1.2rem; }
.remote-history > summary > span:last-child { color:var(--muted); font-weight:800; font-size:.82rem; }
.history-content { padding:0 26px 26px; }
.remote-history .remote-list { gap:10px; }

/* History item accordion */
.remote-history-item { padding:0; overflow:hidden; }
.remote-history-item > summary::-webkit-details-marker { display:none; }
.remote-history-item > summary.remote-history-item-summary {
  display:grid;
  grid-template-columns:18px minmax(220px,1fr) minmax(150px,auto) auto;
  align-items:center;
  column-gap:18px;
  min-height:74px;
  padding:14px 20px;
  cursor:pointer;
  list-style:none;
}
.remote-history-item > summary.remote-history-item-summary:hover { background:#f8faf9; }
.remote-history-item[open] > summary.remote-history-item-summary { background:#f8faf9; border-bottom:1px solid var(--line); }
.remote-history-chevron { display:block; width:9px; height:9px; border-right:2px solid #66736b; border-bottom:2px solid #66736b; transform:rotate(-45deg); transition:transform .18s ease; }
.remote-history-item[open] .remote-history-chevron { transform:rotate(45deg); }
.remote-history-identity { display:grid; grid-template-columns:auto 1fr; align-items:baseline; gap:3px 10px; min-width:0; text-align:left; }
.remote-history-identity .eyebrow { grid-column:1 / -1; margin:0; }
.remote-history-device { font-size:1.05rem; font-weight:850; line-height:1.2; white-space:nowrap; }
.remote-history-device-id { color:var(--muted); font-size:.82rem; white-space:nowrap; }
.remote-history-date { color:var(--muted); font-size:.82rem; line-height:1.3; white-space:nowrap; }
.remote-history-device-id + .remote-history-date::before { content:'·'; margin-right:10px; }
.remote-history-technician { display:flex; flex-direction:column; align-items:flex-end; gap:2px; min-width:0; text-align:right; }
.remote-history-technician small { color:var(--muted); font-size:.7rem; font-weight:700; }
.remote-history-technician strong { font-size:.98rem; line-height:1.2; white-space:nowrap; }
.remote-history-item .status-badge { min-width:82px; justify-content:center; text-align:center; }
.remote-history-item .status-badge.ended { background:#f8e9e6; color:#a23627; }
.remote-history-item .status-badge.expired { background:#fff1dc; color:#956000; }
.remote-history-item .status-badge.revoked { background:#fde8e8; color:#a11d1d; }
.remote-history-details { padding:20px 22px 22px 56px; }
.remote-history-details .remote-detail-grid { grid-template-columns:repeat(3,minmax(150px,1fr)); }
.remote-history-details .remote-comment { margin-top:18px; }
.remote-history-details .remote-end-reason { margin-top:14px; padding-top:14px; border-top:1px solid var(--line); }
.remote-history-details .remote-actions:empty { display:none; }

@media (max-width:900px) {
  .choice-grid { grid-template-columns:repeat(2,1fr); }
  .remote-detail-grid { grid-template-columns:repeat(2,1fr); }
  .remote-history-item > summary.remote-history-item-summary { grid-template-columns:16px minmax(190px,1fr) auto; row-gap:7px; }
  .remote-history-technician { grid-column:2; grid-row:2; align-items:flex-start; flex-direction:row; gap:6px; text-align:left; }
  .remote-history-item .status-badge { grid-column:3; grid-row:1 / span 2; }
  .remote-history-details { padding-left:50px; }
}
@media (max-width:680px) {
  .remote-kpis { grid-template-columns:1fr; }
  .remote-panel-heading { flex-direction:column; }
  .choice-grid,.duration-grid,.remote-detail-grid { grid-template-columns:1fr; max-width:none; }
  .remote-countdown { align-items:flex-start; flex-direction:column; }
  .remote-history > summary { padding:18px; }
  .history-content { padding:0 14px 18px; }
  .remote-history-item > summary.remote-history-item-summary { grid-template-columns:14px 1fr auto; padding:14px; column-gap:12px; }
  .remote-history-identity { grid-template-columns:1fr; gap:2px; }
  .remote-history-device-id + .remote-history-date::before { content:none; }
  .remote-history-technician { grid-column:2; }
  .remote-history-technician small { display:none; }
  .remote-history-details { padding:16px; }
  .remote-history-details .remote-detail-grid { grid-template-columns:1fr; }
}

/* Phase A: live device status */
.live-status-section { grid-column: 1 / -1; background: linear-gradient(135deg, #f8fbf8 0%, #fff 70%); }
.live-status-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; margin-bottom: 16px; }
.live-status-heading h3 { margin: 2px 0 0; font-size: 1.1rem; }
.live-status-kicker { margin: 0; color: var(--green); font-size: .72rem; font-weight: 800; letter-spacing: .13em; text-transform: uppercase; }
.live-status-updated { flex: 0 0 auto; padding: 7px 10px; border-radius: 999px; background: #edf5ef; color: #2f6c3b; font-size: .76rem; font-weight: 700; }
.live-metric-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; }
.live-metric { min-width: 0; padding: 14px; border: 1px solid var(--line); border-radius: 13px; background: #fff; }
.live-metric-label { display: block; color: var(--muted); font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.live-metric strong { display: block; margin-top: 7px; font-size: 1.05rem; line-height: 1.2; overflow-wrap: anywhere; }
.live-meter { display: block; height: 5px; margin-top: 11px; overflow: hidden; border-radius: 999px; background: #e9eeeb; }
.live-meter > span { display: block; height: 100%; border-radius: inherit; background: #3aa65a; }
.live-metric.warning { border-color: #ead8a4; background: #fffaf0; }
.live-metric.warning .live-meter > span { background: #d39a19; }
.live-metric.critical { border-color: #edc0b9; background: #fff5f3; }
.live-metric.critical .live-meter > span { background: #c84d3c; }
.live-metric.unknown strong { color: var(--muted); }
@media (max-width: 1100px) { .live-metric-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 640px) {
  .live-status-heading { display: block; }
  .live-status-updated { display: inline-block; margin-top: 10px; }
  .live-metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}


/* Read-only service status in device details */
.services-status-section { grid-column: 1 / -1; }
.services-status-header { display:flex; align-items:flex-start; justify-content:space-between; gap:20px; margin-bottom:16px; }
.services-status-header h3 { margin:2px 0 4px; }
.services-status-header p:not(.services-status-kicker) { margin:0; color:var(--muted); font-size:.82rem; }
.services-status-kicker { margin:0; color:var(--green); font-size:.7rem; font-weight:800; letter-spacing:.12em; text-transform:uppercase; }
.services-settings-link { flex:0 0 auto; display:inline-flex; align-items:center; gap:8px; min-height:40px; padding:9px 14px; border-radius:11px; background:var(--dark); color:#fff; text-decoration:none; font-size:.8rem; font-weight:800; }
.services-settings-link:hover, .services-settings-link:focus-visible { transform:translateY(-1px); box-shadow:0 8px 20px rgba(18,43,29,.14); }
.services-settings-link.disabled { background:#edf1ee; color:#8a958e; cursor:not-allowed; box-shadow:none; transform:none; }
.services-status-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:9px 12px; }
.service-status-item { display:grid; grid-template-columns:auto minmax(0,1fr) auto; align-items:center; gap:10px; min-height:48px; padding:10px 12px; border:1px solid var(--line); border-radius:11px; background:#fafcfb; }
.service-status-dot { width:9px; height:9px; border-radius:50%; background:#9ca7a0; box-shadow:0 0 0 4px rgba(156,167,160,.12); }
.service-status-dot.ok { background:#38aa5d; box-shadow:0 0 0 4px rgba(56,170,93,.13); }
.service-status-dot.warning { background:#d69c24; box-shadow:0 0 0 4px rgba(214,156,36,.13); }
.service-status-dot.critical { background:#c9473a; box-shadow:0 0 0 4px rgba(201,71,58,.13); }
.service-status-dot.inactive { background:#8b9690; }
.service-status-name { min-width:0; font-size:.84rem; font-weight:750; }
.service-status-badge { padding:5px 8px; border-radius:999px; background:#edf1ee; color:#59645d; font-size:.68rem; font-weight:800; white-space:nowrap; }
.service-status-badge.ok { background:#e6f5e9; color:#24733a; }
.service-status-badge.warning { background:#fff2d8; color:#956300; }
.service-status-badge.critical { background:#fbe8e5; color:#a53227; }
.service-status-badge.inactive { background:#eef0ef; color:#626b66; }
@media (max-width:760px) {
  .services-status-header { display:block; }
  .services-settings-link { margin-top:12px; }
  .services-status-grid { grid-template-columns:1fr; }
}
.service-status-copy { min-width:0; display:flex; flex-direction:column; gap:2px; }
.service-status-since { color:var(--muted); font-size:.7rem; line-height:1.25; }

/* Keep the service settings shortcut visible in the section header. */
.services-status-header > .services-settings-link {
  align-self:flex-start;
  visibility:visible;
  opacity:1;
  white-space:nowrap;
  position:relative;
  z-index:1;
}

/* Dedicated settings shortcut below the service heading. Kept outside the header
   so it remains visible regardless of modal width or inherited header styles. */
.services-settings-row {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
  margin: -4px 0 14px;
}
.services-settings-action {
  width: auto;
  min-width: 220px;
  justify-content: flex-start;
  background: #fff;
}
.services-settings-action .services-settings-arrow {
  margin-left: auto;
  font-weight: 900;
}

.services-settings-action-netbird {
  border-color: #d8e1db;
}
.services-settings-action-netbird:hover,
.services-settings-action-netbird:focus-visible {
  border-color: #b8c9bd;
}
.remote-action-icon-netbird {
  background: #edf3ef;
  color: #315f45;
}

.services-settings-action.disabled {
  opacity: .58;
  cursor: not-allowed;
  pointer-events: none;
}
@media (max-width: 640px) {
  .services-settings-row { justify-content: stretch; align-items: stretch; flex-direction: column; }
  .services-settings-action { width: 100%; min-width: 0; }
}

.dashboard-pill{display:inline-flex;align-items:center;justify-content:center;padding:.45rem .9rem;border:1px solid #d9e2d8;border-radius:999px;background:#fff;color:inherit;text-decoration:none;font-size:.875rem;font-weight:600}.dashboard-pill:hover{background:#f6faf6;border-color:#b9d7be}
.dashboard-remote-button,.dashboard-remote-button__icon,.dashboard-remote-button__arrow,.dashboard-remote-button__text{all:unset}


/* Central update management */
.update-kpis { margin-bottom: 24px; }
.update-device-list { display: grid; gap: 16px; }
.update-device-card { background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 20px; box-shadow: var(--shadow); }
.update-device-head { display:flex; align-items:flex-start; justify-content:space-between; gap:18px; }
.update-device-head h3 { margin:0; font-size:1.2rem; }
.update-device-head p { margin:4px 0 0; color:var(--muted); font-size:.82rem; }
.status-badge.standby { background:#fff2cc; color:#8b6500; }
.status-badge.neutral { background:#eef1ef; color:#5f6a63; }
.update-version-grid { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:12px; margin-top:18px; }
.update-version-grid>div { padding:14px 15px; border:1px solid #e7ece9; border-radius:12px; background:#f7f9f8; min-width:0; }
.update-version-grid span,.update-job-line span { display:block; color:var(--muted); font-size:.72rem; text-transform:uppercase; letter-spacing:.06em; font-weight:800; }
.update-version-grid strong,.update-version-grid small { display:block; overflow-wrap:anywhere; }
.update-version-grid strong { margin-top:5px; }
.update-version-grid small { margin-top:4px; color:var(--muted); }
.update-actions { display:flex; justify-content:flex-end; gap:10px; margin-top:18px; padding-top:16px; border-top:1px solid #edf0ee; }
.update-actions form { margin:0; }
.update-actions button:disabled { opacity:.45; cursor:not-allowed; }
.update-command-pending { margin:14px 0 0; padding:10px 12px; border-radius:10px; background:#fff8df; color:#725b12; }
.update-changes { margin:14px 0 0; padding:14px 16px; border:1px solid #e0b84f; border-radius:12px; background:#fff8df; color:#4f421b; }
.update-changes-label { display:block; margin-bottom:9px; color:#725b12; font-size:.72rem; text-transform:uppercase; letter-spacing:.06em; font-weight:800; }
.update-commit-list { list-style:none; margin:0; padding:0; display:grid; gap:8px; }
.update-commit-list li { display:grid; grid-template-columns:max-content 1fr; gap:10px; align-items:start; line-height:1.4; }
.update-commit-list code { white-space:nowrap; font-weight:700; }
.update-commit-list span { overflow-wrap:anywhere; }
.update-job-line { margin-top:14px; padding:12px 14px; border-left:3px solid #85aa8d; background:#f7f9f8; }
.update-job-line strong,.update-job-line small { display:block; margin-top:4px; }
.update-job-line small { color:var(--muted); }
@media(max-width:760px){.update-version-grid{grid-template-columns:1fr}.update-device-head{flex-direction:column}.update-actions{justify-content:stretch;flex-direction:column}.update-actions button{width:100%}}

/* Fleet management */
.fleet-hero { gap:24px; }
.fleet-refresh { color:var(--muted); font-size:.78rem; font-weight:750; white-space:nowrap; }
.fleet-kpis { margin-bottom:28px; }
.fleet-section { margin-top:0; }
.fleet-actions { display:flex; align-items:center; gap:18px; flex-wrap:wrap; }
.fleet-table-wrap { width:100%; overflow-x:auto; border-top:1px solid var(--line); }
.fleet-table { width:100%; min-width:1180px; border-collapse:collapse; }
.fleet-table th { padding:13px 12px; color:var(--muted); font-size:.7rem; font-weight:850; text-align:left; text-transform:uppercase; letter-spacing:.06em; }
.fleet-table td { padding:16px 12px; border-top:1px solid var(--line); vertical-align:middle; font-size:.84rem; }
.fleet-table tbody tr:hover { background:#f7faf8; }
.fleet-table td > strong,.fleet-table td > small,.fleet-device strong,.fleet-device small { display:block; }
.fleet-table td > small,.fleet-device small { margin-top:4px; color:var(--muted); font-size:.73rem; }
.fleet-device { display:flex; align-items:center; gap:12px; min-width:150px; }
.fleet-device .device-state-dot { margin:0; }
.fleet-state { display:inline-flex; align-items:center; gap:6px; font-size:.78rem; font-weight:850; white-space:nowrap; }
.fleet-state::before { content:''; width:7px; height:7px; border-radius:50%; background:#8a948e; }
.fleet-state.ok { color:#24733a; }.fleet-state.ok::before { background:#42a456; }
.fleet-state.warn { color:#9a6513; }.fleet-state.warn::before { background:#d39a32; }
.fleet-state.muted { color:var(--muted); }
@media (max-width:760px) { .fleet-refresh { white-space:normal; } }

.fleet-location strong { display:block; }
.fleet-location small { display:flex !important; align-items:center; gap:7px; }
.fleet-location small span { color:#6f7a74; font-size:.66rem; font-weight:800; letter-spacing:.04em; text-transform:uppercase; }
.fleet-table td:nth-child(5) .status-badge { white-space:nowrap; }

/* Device record / fleet drill-down */
.device-record-hero { display:flex; align-items:flex-end; justify-content:space-between; gap:28px; margin:28px 0 28px; }
.device-record-back { display:inline-block; margin-bottom:22px; color:var(--green-800); font-size:.82rem; font-weight:800; text-decoration:none; }
.device-record-actions { display:flex; gap:10px; flex-wrap:wrap; justify-content:flex-end; }
.record-action { display:inline-flex; align-items:center; min-height:42px; padding:0 15px; border:1px solid var(--line); border-radius:11px; background:#fff; color:var(--green-950); font-size:.82rem; font-weight:800; text-decoration:none; }
.record-action.primary { background:var(--green-950); border-color:var(--green-950); color:#fff; }
.device-record-status { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:14px; margin-bottom:20px; }
.device-record-status article { min-height:116px; padding:18px 20px; background:#fff; border:1px solid var(--line); border-radius:16px; box-shadow:var(--shadow); }
.device-record-status article>span { display:block; color:var(--muted); font-size:.73rem; font-weight:800; }
.device-record-status article>strong { display:block; margin:10px 0 7px; font-size:1.15rem; }
.device-record-status article>small { color:var(--muted); font-size:.75rem; }
.record-state.ok { color:var(--green-700); }.record-state.bad { color:var(--red-700); }.record-state.muted { color:var(--muted); }
.device-record-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:18px; }
.device-record-card { padding:22px; background:#fff; border:1px solid var(--line); border-radius:17px; box-shadow:var(--shadow); }
.device-record-card h2 { margin:0 0 13px; font-size:1.18rem; }
.record-services { display:grid; gap:0; }
.record-services>div { display:grid; grid-template-columns:14px 1fr auto; align-items:center; gap:9px; padding:9px 0; border-bottom:1px solid #edf1ee; }
.record-services>div:last-child { border-bottom:0; }.record-services strong { font-size:.84rem; }
.device-record-events { grid-column:1/-1; }
.record-card-head { display:flex; align-items:flex-end; justify-content:space-between; gap:20px; }.record-card-head small { color:var(--muted); }
.record-event-list>div { display:grid; grid-template-columns:170px 1fr auto; gap:16px; align-items:center; padding:12px 0; border-top:1px solid #edf1ee; }
.record-event-list time { color:var(--muted); font-size:.78rem; }.record-event-list strong { font-size:.85rem; }.record-event-outcome { font-size:.72rem; font-weight:850; text-transform:uppercase; }.record-event-outcome.success { color:var(--green-700); }.record-event-outcome.failure,.record-event-outcome.denied { color:var(--red-700); }
.record-empty { padding:20px 0 4px; color:var(--muted); font-size:.84rem; border-top:1px solid #edf1ee; }
.fleet-device-link { color:inherit; text-decoration:none; }.fleet-device-link:hover strong { color:var(--green-700); text-decoration:underline; text-underline-offset:3px; }
@media(max-width:900px){.device-record-hero{align-items:flex-start;flex-direction:column}.device-record-actions{justify-content:flex-start}.device-record-status{grid-template-columns:repeat(2,1fr)}.device-record-grid{grid-template-columns:1fr}.device-record-events{grid-column:auto}}
@media(max-width:600px){.device-record-status{grid-template-columns:1fr}.record-event-list>div{grid-template-columns:1fr;gap:5px}}

/* Fleet health / device record polish */
.fleet-attention { display:block; margin-top:6px; color:var(--red-700); font-size:.68rem; font-weight:800; white-space:nowrap; }
.record-event-more { margin-top:4px; border-top:1px solid #edf1ee; }
.record-event-more summary { cursor:pointer; padding:14px 0 8px; color:var(--green-800); font-size:.78rem; font-weight:800; list-style:none; }
.record-event-more summary::-webkit-details-marker { display:none; }
.record-event-more summary::before { content:'▸'; display:inline-block; margin-right:7px; transition:transform .15s ease; }
.record-event-more[open] summary::before { transform:rotate(90deg); }
.record-event-outcome { text-transform:none; }
/* Fleet Software Management */
.update-fleet-kpis { display:grid; grid-template-columns:repeat(6,minmax(0,1fr)); gap:12px; margin-bottom:24px; }
.update-fleet-kpis article { background:#fff; border:1px solid var(--line); border-radius:14px; padding:17px 16px; box-shadow:var(--shadow); min-width:0; }
.update-fleet-kpis article.primary { background:#12271d; color:#fff; border-color:#12271d; }
.update-fleet-kpis span,.update-fleet-kpis small { display:block; }
.update-fleet-kpis span { font-size:.72rem; font-weight:800; }
.update-fleet-kpis strong { display:block; margin:8px 0 6px; font-size:1.65rem; line-height:1; }
.update-fleet-kpis article:not(.primary) strong { color:#187b3d; }
.update-fleet-kpis small { color:var(--muted); line-height:1.35; }
.update-fleet-kpis .primary small { color:#fff; opacity:.88; }
.update-device-link { color:inherit; text-decoration:none; }
.update-device-link:hover { color:#0a6a31; text-decoration:underline; }
.update-blockers { margin:14px 0 0; padding:10px 12px; border-radius:10px; background:#fff8df; color:#725b12; display:flex; gap:10px; align-items:baseline; }
.update-blockers span { font-size:.7rem; text-transform:uppercase; letter-spacing:.06em; font-weight:800; }
.update-record-link { align-self:center; margin-right:auto; font-weight:800; color:#0a6a31; text-decoration:none; }
.update-record-link:hover { text-decoration:underline; }
@media(max-width:1100px){.update-fleet-kpis{grid-template-columns:repeat(3,minmax(0,1fr))}}
@media(max-width:650px){.update-fleet-kpis{grid-template-columns:1fr 1fr}.update-blockers{align-items:flex-start;flex-direction:column}.update-record-link{margin:0 0 4px}}


/* Fleet central health evaluation */
.fleet-health-summary { margin:0 0 22px; padding:18px 22px; border:1px solid var(--line); border-radius:16px; background:#fff; box-shadow:var(--shadow); }
.fleet-health-summary.healthy { border-left:4px solid #42a456; }
.fleet-health-summary.needs-attention { border-left:4px solid #c55b4d; background:#fffdfc; }
.fleet-health-summary-head { display:flex; align-items:center; justify-content:space-between; gap:22px; }
.fleet-health-summary h2 { margin:2px 0 4px; font-size:1.08rem; }
.fleet-health-summary p:not(.eyebrow) { margin:0; color:var(--muted); font-size:.8rem; }
.fleet-health-count { display:grid; place-items:center; min-width:42px; height:42px; padding:0 12px; border-radius:12px; background:#e8f5eb; color:#24733a; font-size:1.2rem; font-weight:900; }
.fleet-health-summary.needs-attention .fleet-health-count { background:#f9e9e6; color:var(--red-700); }
.fleet-issue-list { margin-top:16px; border-top:1px solid var(--line); }
.fleet-issue-item { display:grid; grid-template-columns:minmax(160px,.8fr) minmax(320px,2fr) auto; align-items:center; gap:18px; padding:13px 0; border-bottom:1px solid var(--line); color:inherit; text-decoration:none; }
.fleet-issue-item:last-child { border-bottom:0; padding-bottom:0; }
.fleet-issue-device strong,.fleet-issue-device small { display:block; }
.fleet-issue-device small { margin-top:3px; color:var(--muted); font-size:.72rem; }
.fleet-issue-reasons { display:flex; flex-wrap:wrap; gap:7px; }
.fleet-issue-reasons span { padding:5px 8px; border-radius:999px; background:#f9e9e6; color:var(--red-700); font-size:.7rem; font-weight:800; }
.fleet-issue-open { color:var(--green-800); font-size:.76rem; font-weight:850; white-space:nowrap; }
.fleet-issue-item:hover .fleet-issue-open { text-decoration:underline; text-underline-offset:3px; }
.fleet-table tbody tr.fleet-row-attention { background:#fffaf8; box-shadow:inset 3px 0 0 #c55b4d; }
.fleet-table tbody tr.fleet-row-attention:hover { background:#fff6f2; }
@media(max-width:760px){.fleet-health-summary-head{align-items:flex-start}.fleet-issue-item{grid-template-columns:1fr;gap:8px}.fleet-issue-open{justify-self:start}}
