:root {
    --bo-bg: #f3f5fd;
    --bo-surface: #ffffff;
    --bo-surface-soft: #f8f9ff;
    --bo-border: #e4e8f5;
    --bo-border-strong: #d8deef;
    --bo-text: #252a3f;
    --bo-muted: #7b829f;
    --bo-primary: #696cff;
    --bo-primary-strong: #5b5fe9;
    --bo-primary-soft: #eef0ff;
    --bo-primary-border: #d8ddff;
    --bo-primary-text: #2e367d;
    --bo-primary-focus: #e5e8ff;
    --bo-primary-rgb: 105, 108, 255;
    --bo-success: #16b06f;
    --bo-danger: #e05555;
    --bo-warning: #d39527;
    --bo-shadow-xs: 0 6px 20px rgba(26, 34, 78, 0.06);
    --bo-shadow-sm: 0 16px 28px rgba(26, 34, 78, 0.08);
    --bo-shadow-md: 0 22px 48px rgba(26, 34, 78, 0.12);
}

* { box-sizing: border-box; }

body.bo-body {
    margin: 0;
    font-family: Inter, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    color: var(--bo-text);
    background:
        radial-gradient(circle at 90% -20%, rgba(var(--bo-primary-rgb), .14) 0%, rgba(var(--bo-primary-rgb), 0) 45%),
        radial-gradient(circle at -15% 100%, rgba(var(--bo-primary-rgb), .10) 0%, rgba(var(--bo-primary-rgb), 0) 40%),
        linear-gradient(180deg, #f8f9ff 0%, #f3f5fd 100%);
}

a { color: inherit; text-decoration: none; }
.bo-content a:not(.btn):not(.page-link) { color: var(--bo-primary-text); }
.bo-content a:not(.btn):not(.page-link):hover { color: var(--bo-primary-strong); text-decoration: underline; }

.bo-shell { min-height: 100vh; display: flex; }

/* Sidebar - light premium */
.bo-sidebar {
    width: 280px;
    background: linear-gradient(180deg, #ffffff 0%, #f7f9ff 100%);
    color: #596286;
    padding: 1rem;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    overflow-y: auto;
    border-right: 1px solid #e4e9f8;
    box-shadow: 8px 0 24px rgba(34, 44, 84, 0.06);
}

.bo-brand {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1.2rem;
    padding: .75rem;
    min-height: 84px;
    border-radius: 16px;
    background: linear-gradient(180deg, #f8faff 0%, #f1f4ff 100%);
    border: 1px solid #e1e6f6;
}

.bo-brand-logo {
    width: 100%;
    max-height: 56px;
    object-fit: contain;
}

.bo-brand-fallback {
    width: 54px;
    height: 54px;
    border-radius: 14px;
    background: linear-gradient(140deg, #7f86ff, #9da5ff);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    color: #fff;
}

.bo-menu { display: grid; gap: .42rem; }

.bo-menu a {
    display: flex;
    align-items: center;
    gap: .55rem;
    padding: .66rem .78rem;
    border-radius: 11px;
    color: #4a5476;
    font-size: .94rem;
    font-weight: 500;
    letter-spacing: .01em;
    transition: .22s ease;
    border: 1px solid transparent;
    background: rgba(255,255,255,.7);
}

.bo-menu a:hover {
    background: #ffffff;
    color: #2f3758;
    border-color: #d8deef;
    transform: translateX(2px);
    box-shadow: var(--bo-shadow-xs);
}

.bo-menu a.is-active {
    background: linear-gradient(135deg, rgba(var(--bo-primary-rgb), .16), rgba(var(--bo-primary-rgb), .08));
    color: var(--bo-primary-text);
    border-color: rgba(var(--bo-primary-rgb), .35);
    box-shadow: inset 0 0 0 1px rgba(var(--bo-primary-rgb), .20);
}

.bo-sidebar-footer {
    margin-top: 1.4rem;
    padding-top: 1rem;
    border-top: 1px solid #e6eaf7;
}

.bo-main {
    margin-left: 280px;
    width: calc(100% - 280px);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Topbar */
.bo-topbar {
    position: sticky;
    top: 0;
    z-index: 40;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: .88rem 1.6rem;
    background: rgba(255, 255, 255, .78);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--bo-border-strong);
    overflow: visible;
}

.bo-topbar-left,
.bo-topbar-right {
    display: flex;
    align-items: center;
    gap: .75rem;
    position: relative;
    overflow: visible;
}

.bo-breadcrumbs {
    display: flex;
    gap: .44rem;
    color: var(--bo-muted);
    font-size: .9rem;
    flex-wrap: wrap;
}

.bo-user-pill {
    padding: .5rem .82rem;
    border: 1px solid var(--bo-border-strong);
    border-radius: 999px;
    background: var(--bo-surface);
    font-size: .84rem;
    color: #4d567f;
    font-weight: 600;
    box-shadow: var(--bo-shadow-xs);
    cursor: pointer;
    transition: .2s ease;
}

.bo-user-pill:hover {
    border-color: var(--bo-primary-border);
    color: var(--bo-primary-text);
}

.bo-user-pill:focus-visible {
    outline: 3px solid rgba(var(--bo-primary-rgb), .22);
    outline-offset: 1px;
}

.bo-burger {
    display: none;
    background: #fff;
    border: 1px solid var(--bo-border-strong);
    border-radius: 10px;
    height: 38px;
    width: 38px;
}

.bo-user-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 248px;
    background: #fff;
    border: 1px solid #e2e7f6;
    border-radius: 14px;
    box-shadow: var(--bo-shadow-sm);
    padding: .5rem;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-6px);
    transition: .18s ease;
    pointer-events: none;
    z-index: 999;
}

.bo-user-menu.is-open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    pointer-events: auto;
}

.bo-user-menu a,
.bo-user-menu button {
    width: 100%;
    text-align: left;
    border: 0;
    background: #fff;
    color: #3f4768;
    display: block;
    padding: .62rem .66rem;
    border-radius: 10px;
    font-size: .88rem;
    cursor: pointer;
}

.bo-user-menu a:hover,
.bo-user-menu button:hover,
.bo-user-menu a:focus-visible,
.bo-user-menu button:focus-visible {
    background: var(--bo-primary-soft);
    color: var(--bo-primary-text);
    outline: none;
}

/* Content */
.bo-content {
    padding: 1.4rem 1.6rem 2.2rem;
    max-width: 1560px;
    width: 100%;
}

.page-head {
    display:flex;
    align-items:flex-start;
    justify-content:space-between;
    gap: 1rem;
    margin-bottom: 1.15rem;
}

.page-head h1 {
    margin: 0 0 .28rem;
    font-size: 2rem;
    letter-spacing: -.03em;
    font-weight: 760;
}

.subtitle {
    color: var(--bo-muted);
    margin:0;
    font-size: 1rem;
    line-height:1.5;
}

.card {
    background: var(--bo-surface);
    border: 1px solid var(--bo-border);
    border-radius: 18px;
    padding: 1.15rem 1.2rem;
    box-shadow: var(--bo-shadow-xs);
    margin-bottom: 1rem;
}

.card h3 {
    margin: 0 0 .9rem;
    font-size: 1.45rem;
    letter-spacing: -.02em;
}

.section-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: .9rem;
}

.section-title .help { margin-top: 0; }

.table-card table { margin-bottom: 0; }
.logs-card .bo-log-item:last-child { margin-bottom: 0; }

.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}

.kpi-card {
    border-radius: 16px;
    border: 1px solid #e3e8f8;
    background: linear-gradient(180deg, #fff 0%, #fafbff 100%);
    box-shadow: 0 14px 26px rgba(36, 44, 86, 0.08);
    padding: 1rem 1.05rem;
}

.kpi-card .label {
    font-size: .84rem;
    color: #7d86ab;
    margin-bottom: .48rem;
    font-weight: 600;
}

.kpi-card .value {
    font-size: 2.15rem;
    line-height: 1;
    font-weight: 760;
    letter-spacing: -.02em;
    margin-bottom: .5rem;
    color: #2a314c;
}

.kpi-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .6rem;
}

.bo-log-item {
    margin-bottom: .55rem;
    padding: .8rem .92rem;
    border-radius: 12px;
    background: #f8f9ff;
    border: 1px solid #e9edfb;
}

.btn {
    display:inline-flex;
    align-items:center;
    justify-content:center;
    gap:.4rem;
    border:1px solid var(--bo-border-strong);
    background:#fff;
    color:#45507a;
    border-radius:12px;
    padding:.6rem 1rem;
    font-size:.9rem;
    font-weight: 650;
    cursor:pointer;
    transition: .2s ease;
}

.btn:hover {
    border-color: #bfc8e6;
    color: #2f3758;
    transform: translateY(-1px);
}

.btn:focus-visible { outline: 3px solid #dde2ff; outline-offset: 1px; }
.btn:focus-visible { outline-color: rgba(var(--bo-primary-rgb), .22); }

.btn-primary {
    background: linear-gradient(135deg, var(--bo-primary), var(--bo-primary-strong));
    color: #fff;
    border-color: transparent;
    box-shadow: 0 10px 20px rgba(86, 95, 235, 0.32);
}

.btn-primary:hover { filter: brightness(1.02); color: #fff; }

.btn-danger { background: var(--bo-danger); border-color: var(--bo-danger); color: #fff; }
.btn-ghost { background: transparent; border-color: #cfd7f3; color: #3f4b74; }
.btn-block { width: 100%; }
.btn-small { padding:.44rem .72rem; font-size:.8rem; border-radius:10px; }
button:not([class]) {
    border:1px solid transparent;
    background: linear-gradient(135deg, var(--bo-primary), var(--bo-primary-strong));
    color:#fff;
    border-radius:12px;
    padding:.6rem 1rem;
    font-weight:650;
    cursor:pointer;
}

.badge {
    display:inline-flex;
    align-items:center;
    border-radius:999px;
    padding:.24rem .64rem;
    font-size:.74rem;
    font-weight:700;
}
.badge-accent { background: var(--bo-primary-soft); color: var(--bo-primary-text); border: 1px solid var(--bo-primary-border); }
.badge-ok { background: #dcf9ee; color: #0a8756; }
.badge-off { background: #ffe9e9; color: #af3131; }
.badge-warn { background: #fff3dc; color: #9f6b05; }

/* Tables / lists */
table {
    width:100%;
    border-collapse: separate;
    border-spacing: 0;
    overflow: hidden;
    border: 1px solid var(--bo-border-strong);
    border-radius: 14px;
    background: #fff;
    box-shadow: var(--bo-shadow-xs);
    margin-bottom: .8rem;
}

th {
    text-align: left;
    background: #f2f5ff;
    color: #566086;
    padding: .84rem .88rem;
    font-size: .8rem;
    text-transform: uppercase;
    letter-spacing: .04em;
    font-weight: 700;
}

td {
    padding: .86rem .88rem;
    border-top: 1px solid #edf1fb;
    vertical-align: top;
}

tr:hover td { background: #fbfcff; }
.js-clickable-row { cursor: pointer; }
.js-clickable-row:hover td { background: #f7f8fc; }
tr.js-clickable-row:focus-visible { outline: 2px solid var(--bo-primary); outline-offset: -2px; }

.bo-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0;
    border-bottom: 1px solid #e5e7eb;
    background: #f8fafc;
    padding: 0 16px;
    border-radius: 16px 16px 0 0;
}

.bo-tab {
    display: inline-flex;
    align-items: center;
    padding: 14px 18px;
    border: 1px solid transparent;
    border-bottom: 0;
    color: #64748b;
    font-weight: 600;
    text-decoration: none;
    border-radius: 12px 12px 0 0;
    margin-bottom: -1px;
}

.bo-tab:hover {
    color: #111827;
    background: #eef2ff;
}

.bo-tab.is-active {
    color: #111827;
    background: #ffffff;
    border-color: #e5e7eb;
    box-shadow: 0 -1px 0 rgba(15, 23, 42, 0.03);
}

.bo-tab-panel {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-top: 0;
    border-radius: 0 0 16px 16px;
    padding: 24px;
}
.json-box { max-height: 240px; overflow: auto; background: #0f172a; color: #e2e8f0; padding: 10px; border-radius: 8px; font-size: 12px; }

.row-actions { display:flex; gap:.45rem; flex-wrap: wrap; align-items:center; }
.actions-top { margin-bottom: .8rem; display:flex; gap:.5rem; }

label { display:block; font-weight:600; font-size:.9rem; margin-bottom:.36rem; color:#424a68; }
input, select, textarea {
    width:100%;
    max-width:100%;
    border:1px solid #dce1f2;
    background:#fff;
    border-radius:12px;
    padding:.62rem .74rem;
    font-size:.92rem;
    color: #2d3142;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--bo-primary-border);
    box-shadow: 0 0 0 3px rgba(var(--bo-primary-rgb), .12);
}

input[type="checkbox"] { width: 16px; height: 16px; }
video, img { max-width: 100%; border-radius: 10px; }

.help { font-size: .82rem; color: var(--bo-muted); margin-top: .35rem; }
.empty {
    border: 1px dashed #ccd4f0;
    border-radius: 12px;
    background: #f9faff;
    padding: .95rem;
    color: #687196;
}

.alert {
    border-radius: 12px;
    border: 1px solid transparent;
    padding: .75rem .9rem;
    margin-bottom: .9rem;
}
.alert.ok { background: #ddf7ee; color: #09653f; border-color: #bdeed8; }
.alert.err { background: #ffe9e9; color: #8a2121; border-color: #f5cccc; }
.alert ul { margin:.4rem 0 0 1rem; }

.pagination {
    display: flex;
    gap: .35rem;
    flex-wrap: wrap;
}

.pagination .page-link {
    border:1px solid var(--bo-border);
    border-radius:9px;
    min-width: 34px;
    text-align:center;
    padding: .35rem .48rem;
}

.pagination .active .page-link {
    background: var(--bo-primary);
    color: #fff;
    border-color: var(--bo-primary);
}

/* Login */
.login-shell {
    min-height: 100vh;
    display: grid;
    place-items: center;
    background: radial-gradient(circle at 20% 0%, rgba(var(--bo-primary-rgb), .72) 0%, var(--bo-primary) 42%, var(--bo-primary-strong) 100%);
    padding: 1rem;
}

.login-shell-light {
    background:
        radial-gradient(circle at 10% -20%, rgba(var(--bo-primary-rgb), .10) 0%, rgba(var(--bo-primary-rgb), 0) 45%),
        radial-gradient(circle at 90% 130%, rgba(var(--bo-primary-rgb), .07) 0%, rgba(var(--bo-primary-rgb), 0) 40%),
        linear-gradient(180deg, #fafbff 0%, #f4f6fd 100%);
}

.login-card {
    width: min(460px, 100%);
    border-radius: 18px;
    background: rgba(255,255,255,.96);
    padding: 1.5rem;
    box-shadow: 0 24px 54px rgba(8, 16, 80, 0.32);
}

.login-card h1 { margin: 0 0 .35rem; font-size: 1.45rem; }
.login-card p { margin: 0 0 1rem; color: #687196; }
.login-card .btn-primary { width: 100%; margin-top: .4rem; }
.login-brand-logo { display: block; max-width: 230px; max-height: 68px; object-fit: contain; margin-bottom: .8rem; }
.login-brand-logo-lg { max-width: 320px; max-height: 96px; margin: 0 auto 1rem; }
.login-brand-fallback {
    width: 60px;
    height: 60px;
    border-radius: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: .8rem;
    font-weight: 800;
    color: #fff;
    background: linear-gradient(140deg, var(--bo-primary), var(--bo-primary-strong));
}

@media (max-width: 1024px) {
    .bo-sidebar { transform: translateX(-100%); transition: transform .24s ease; z-index: 90; }
    .bo-sidebar.is-open { transform: translateX(0); }
    .bo-main { margin-left: 0; width: 100%; }
    .bo-burger { display: inline-flex; align-items:center; justify-content:center; }
    .bo-content { padding: 1rem; }
    .page-head h1 { font-size: 1.65rem; }
}

.device-filters-toolbar{display:flex;gap:.6rem;margin-bottom:.8rem}
.device-filter-list{display:grid;gap:.8rem}
.device-filter-card{border:1px solid #d8dee9;border-radius:12px;background:#fff;overflow:hidden}
.device-filter-card summary{display:flex;justify-content:space-between;align-items:center;cursor:pointer;list-style:none;padding:.9rem 1rem;background:#f7f9fc}
.device-filter-card summary::-webkit-details-marker{display:none}
.device-filter-status{font-size:.82rem;color:#4b5b74}
.device-filter-grid{display:grid;grid-template-columns:1fr 1fr;gap:1rem;padding:1rem}
.device-filter-block h4{margin:0 0 .5rem 0;font-size:.95rem}
.device-filter-block ul{margin:0;padding-left:1rem;color:#38465b}
.device-filter-block select{min-height:90px}
@media(max-width:1100px){.device-filter-grid{grid-template-columns:1fr}}

.bo-modal{position:fixed;inset:0;background:rgba(0,0,0,.45);z-index:9999;display:flex;align-items:center;justify-content:center}
.bo-modal-card{background:#fff;border-radius:12px;padding:20px;max-width:520px;width:90%;box-shadow:0 20px 50px rgba(0,0,0,.2)}

/* Responsive backoffice foundation */
html { max-width: 100%; overflow-x: hidden; }
body.bo-body { max-width: 100%; overflow-x: hidden; }
.bo-shell, .bo-main, .bo-content, .card, .page-head, .bo-topbar-left { min-width: 0; }
.bo-sidebar { z-index: 100; }
.bo-sidebar-backdrop {
    position: fixed;
    inset: 0;
    display: none;
    border: 0;
    padding: 0;
    background: rgba(25, 31, 55, .42);
    cursor: pointer;
    z-index: 80;
}
.bo-sidebar-backdrop.is-open { display: block; }

.table-responsive {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    -webkit-overflow-scrolling: touch;
    border-radius: 12px;
}
.table-responsive > table { margin-bottom: 0; }
.table-responsive::after {
    content: "";
    display: block;
    height: 1px;
}
table { min-width: 680px; }
.table-responsive table[style*="table-layout:fixed"] { min-width: 840px; }
th, td { overflow-wrap: anywhere; }
.row-actions form { margin: 0; }
.row-actions .btn { white-space: nowrap; }

input, select, textarea, button { max-width: 100%; }
input[type="file"] { width: 100%; }
textarea { resize: vertical; }
.bo-tabs { max-width: 100%; overflow-x: auto; overscroll-behavior-inline: contain; scrollbar-width: thin; }
.bo-tabs a, .bo-tabs button { white-space: nowrap; }
.pagination { max-width: 100%; overflow-x: auto; padding-bottom: .2rem; }
.alert { overflow-wrap: anywhere; }
.bo-modal { padding: 1rem; }
.bo-modal-card { max-height: min(90vh, 720px); overflow-y: auto; }
.device-map-layout { min-width: 0; }

@media (max-width: 1024px) {
    .bo-sidebar { width: min(86vw, 300px); }
    .bo-content { max-width: 100%; }
    .bo-topbar { padding: .78rem 1rem; }
    .device-map-layout { grid-template-columns: 1fr !important; grid-template-rows: auto !important; }
    #device-detail { border-left: 0 !important; border-top: 1px solid #e5e7eb; }
}

@media (max-width: 768px) {
    .bo-content { padding: .82rem .72rem 1.4rem; }
    .bo-topbar { gap: .55rem; padding: .65rem .72rem; }
    .bo-topbar-left, .bo-topbar-right { gap: .45rem; }
    .bo-breadcrumbs { display: none; }
    .bo-user-pill { max-width: 46vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .bo-user-menu { width: min(86vw, 248px); }
    .page-head { align-items: stretch; flex-direction: column; gap: .75rem; margin-bottom: .85rem; }
    .page-head h1 { font-size: 1.38rem; line-height: 1.15; }
    .page-head .btn { align-self: flex-start; }
    .subtitle { font-size: .88rem; }
    .card { padding: .85rem; border-radius: 12px; }
    .grid-2, .grid-3, .grid-4, .stats-grid, .device-filter-grid { grid-template-columns: minmax(0, 1fr) !important; }
    form [style*="grid-template-columns"] { grid-template-columns: minmax(0, 1fr) !important; }
    .row-actions, .device-filters-toolbar { gap: .42rem; }
    .row-actions .btn, .row-actions form, .row-actions form .btn { max-width: 100%; }
    .btn { min-height: 42px; padding: .58rem .76rem; }
    .btn-small { min-height: 38px; padding: .5rem .64rem; }
    table { min-width: 620px; font-size: .86rem; }
    th, td { padding: .62rem .58rem; }
    .bo-modal { align-items: flex-end; padding: .55rem; }
    .bo-modal-card { width: 100%; max-width: 100%; max-height: 88vh; padding: 1rem; border-radius: 14px; }
    .bo-modal-card .row-actions, .bo-modal-card footer { flex-wrap: wrap; }
    .login-card { padding: 1.1rem; border-radius: 14px; }
    .login-brand-logo-lg { max-width: min(260px, 100%); }
}

@media (max-width: 430px) {
    .bo-sidebar { width: min(90vw, 292px); padding: .8rem; }
    .bo-brand { min-height: 70px; margin-bottom: .8rem; }
    .bo-menu { gap: .3rem; }
    .bo-menu a { padding: .62rem .7rem; font-size: .9rem; }
    .bo-content { padding-inline: .58rem; }
    .card { padding: .72rem; }
    .row-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); width: 100%; }
    .row-actions > *, .row-actions .btn { width: 100%; }
    .row-actions .btn { justify-content: center; text-align: center; }
    .device-filters-toolbar { flex-wrap: wrap; }
    .device-filters-toolbar > * { flex: 1 1 100%; }
    table { min-width: 580px; }
}

/* Final compact safeguards for legacy inline page markup */
.bo-main, .bo-content { overflow-x: clip; }
.actions-top, .section-title { flex-wrap: wrap; }
pre, code, .json-box { max-width: 100%; overflow-wrap: anywhere; }
@media (max-width: 768px) {
    .card [style*="grid-template-columns"] { grid-template-columns: minmax(0, 1fr) !important; }
    .bo-tab-panel { padding: .82rem; }
    .kpi-grid { grid-template-columns: minmax(0, 1fr); gap: .72rem; }
    .kpi-card { padding: .82rem; }
    .kpi-card .value { font-size: 1.8rem; }
}

/* Device listing: preserve readable operational status columns on narrow screens. */
.badge { white-space: nowrap; }
.devices-table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.devices-table { min-width: 1040px; }
.devices-table th { white-space: nowrap; }
.devices-table .col-id { min-width: 54px; }
.devices-table .col-name { min-width: 150px; }
.devices-table .col-state { min-width: 94px; }
.devices-table .col-approval { min-width: 112px; }
.devices-table .col-datetime { min-width: 112px; }
.devices-table .col-ip { min-width: 118px; }
.devices-table .col-version { min-width: 100px; }
.devices-table .col-actions { min-width: 176px; }
.devices-table .row-actions { flex-wrap: nowrap; min-width: 0; }
.device-datetime {
    display: inline-flex;
    flex-direction: column;
    gap: .12rem;
    line-height: 1.18;
    white-space: nowrap;
}
.device-datetime-date,
.device-datetime-time { display: block; }
.device-datetime-time { color: #475569; font-variant-numeric: tabular-nums; }
.device-icon-actions { align-items: center; gap: .42rem; }
.device-icon-actions form { flex: 0 0 auto; }
.devices-table .icon-action {
    align-items: center;
    background: var(--icon-action-bg) !important;
    border: 1px solid var(--icon-action-border) !important;
    border-radius: 11px;
    box-shadow: 0 8px 18px rgba(15, 23, 42, .08), inset 0 0 0 1px rgba(255, 255, 255, .72);
    color: var(--icon-action-color) !important;
    display: inline-flex;
    height: 38px;
    justify-content: center;
    min-height: 38px;
    padding: 0;
    transition: background-color .18s ease, border-color .18s ease, box-shadow .18s ease, color .18s ease, transform .18s ease;
    width: 38px;
}
.devices-table .icon-action svg {
    fill: none;
    height: 20px;
    opacity: 1;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 2.55;
    width: 20px;
}
.devices-table .icon-action-refresh {
    --icon-action-bg: #dbeafe;
    --icon-action-border: #93c5fd;
    --icon-action-color: #1d4ed8;
}
.devices-table .icon-action-token {
    --icon-action-bg: #ede9fe;
    --icon-action-border: #c4b5fd;
    --icon-action-color: #6d28d9;
}
.devices-table .icon-action-approve {
    --icon-action-bg: #dcfce7;
    --icon-action-border: #86efac;
    --icon-action-color: #047857;
}
.devices-table .icon-action-reject {
    --icon-action-bg: #ffedd5;
    --icon-action-border: #fdba74;
    --icon-action-color: #c2410c;
}
.devices-table .icon-action-delete {
    --icon-action-bg: #fee2e2;
    --icon-action-border: #fca5a5;
    --icon-action-color: #b91c1c;
}
.devices-table .icon-action:hover {
    background: #fff !important;
    border-color: var(--icon-action-color) !important;
    box-shadow: 0 12px 24px rgba(15, 23, 42, .14), 0 0 0 3px color-mix(in srgb, var(--icon-action-color) 16%, transparent);
    color: var(--icon-action-color) !important;
    filter: none;
    transform: translateY(-2px);
}
.devices-table .icon-action:focus-visible {
    outline: 3px solid color-mix(in srgb, var(--icon-action-color) 26%, transparent);
    outline-offset: 2px;
}

/* Dashboard interaction chart: real APK interaction events, dependency-free. */
.interaction-card { overflow: hidden; }
.interaction-card-head {
    align-items: flex-start;
    gap: 1rem;
}
.interaction-periods {
    display: flex;
    flex-wrap: wrap;
    gap: .4rem;
    justify-content: flex-end;
}
.interaction-summary {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: .8rem 1.2rem;
    justify-content: space-between;
    margin: .9rem 0 1rem;
}
.interaction-total {
    color: var(--bo-primary-text);
    display: inline-block;
    font-size: 2rem;
    font-weight: 800;
    line-height: 1;
    margin-right: .35rem;
}
.interaction-layout {
    display: grid;
    gap: 1rem;
    grid-template-columns: minmax(0, 1fr) minmax(190px, 240px);
}
.interaction-chart {
    align-items: end;
    border: 1px solid var(--bo-border);
    border-radius: 14px;
    display: grid;
    gap: .34rem;
    grid-template-columns: repeat(var(--interaction-days, 30), minmax(18px, 1fr));
    min-height: 260px;
    overflow-x: auto;
    padding: 1rem .9rem .8rem;
    scrollbar-width: thin;
}
.interaction-day {
    align-items: center;
    display: grid;
    gap: .28rem;
    grid-template-rows: 1fr auto auto;
    min-width: 22px;
    text-align: center;
}
.interaction-bar-wrap {
    align-items: end;
    background: linear-gradient(180deg, #f8f9ff 0%, #eef2ff 100%);
    border-radius: 999px;
    display: flex;
    height: 170px;
    justify-content: center;
    overflow: hidden;
    width: 100%;
}
.interaction-bar {
    background: linear-gradient(180deg, var(--bo-primary) 0%, var(--bo-primary-strong) 100%);
    border-radius: 999px 999px 0 0;
    box-shadow: 0 8px 18px rgba(var(--bo-primary-rgb), .22);
    min-height: 0;
    width: 72%;
}
.interaction-count {
    color: #334155;
    font-size: .72rem;
    font-variant-numeric: tabular-nums;
    font-weight: 750;
    line-height: 1;
}
.interaction-label {
    color: var(--bo-muted);
    font-size: .68rem;
    line-height: 1;
    white-space: nowrap;
}
.interaction-ranking {
    background: var(--bo-surface-soft);
    border: 1px solid var(--bo-border);
    border-radius: 14px;
    padding: .85rem;
}
.interaction-ranking h4 {
    margin: 0 0 .7rem;
}
.interaction-device-row {
    align-items: center;
    border-top: 1px solid var(--bo-border);
    display: flex;
    gap: .7rem;
    justify-content: space-between;
    padding: .55rem 0;
}
.interaction-device-row:first-of-type { border-top: 0; }
.interaction-device-row span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.interaction-device-row strong {
    color: var(--bo-primary-text);
    font-variant-numeric: tabular-nums;
}

@media (max-width: 900px) {
    .interaction-layout { grid-template-columns: 1fr; }
    .interaction-periods { justify-content: flex-start; }
}

@media (max-width: 768px) {
    .interaction-summary { align-items: flex-start; flex-direction: column; }
    .interaction-chart { min-height: 230px; padding-inline: .7rem; }
    .interaction-bar-wrap { height: 140px; }
}
.interaction-types {
    border-top: 1px solid var(--bo-border);
    margin-top: 1rem;
    padding-top: .9rem;
}
.interaction-types h4 { margin: 0 0 .65rem; }
.interaction-type-list {
    display: flex;
    flex-wrap: wrap;
    gap: .45rem;
}
.interaction-type-pill {
    background: var(--bo-primary-soft);
    border: 1px solid var(--bo-primary-border);
    border-radius: 999px;
    color: var(--bo-primary-text);
    display: inline-flex;
    gap: .35rem;
    padding: .36rem .6rem;
    white-space: nowrap;
}
