@import 'tailwindcss';

:root {
    --blue: #0b5cff;
    --blue-strong: #0647c7;
    --blue-soft: #eaf2ff;
    --blue-gradient-start: #1677ff;
    --blue-gradient-mid: #0758d9;
    --blue-gradient-end: #04358f;
    --ink: #05070d;
    --black: #0b0f19;
    --white: #ffffff;
    --muted: #667085;
    --line: #e6eaf2;
    --surface: #f7f9fc;
    --surface-strong: #eef3fb;
    --shadow: 0 18px 50px rgba(5, 7, 13, 0.08);
    --shadow-soft: 0 10px 28px rgba(5, 7, 13, 0.06);
    --radius: 18px;
    --radius-sm: 12px;
}

* {
    box-sizing: border-box;
}

html {
    min-width: 320px;
}

body {
    margin: 0;
    min-height: 100vh;
    background:
        radial-gradient(circle at top left, rgba(11, 92, 255, 0.12), transparent 34rem),
        linear-gradient(180deg, #fff 0%, var(--surface) 52%, #fff 100%);
    color: var(--ink);
    font-family: "Aptos", "Bahnschrift", "Trebuchet MS", sans-serif;
    font-size: 15px;
}

body.login-body {
    background:
        radial-gradient(circle at 18% 16%, rgba(120, 190, 255, 0.42), transparent 24rem),
        radial-gradient(circle at 88% 88%, rgba(66, 153, 255, 0.32), transparent 28rem),
        linear-gradient(145deg, var(--blue-gradient-start) 0%, var(--blue-gradient-mid) 52%, var(--blue-gradient-end) 100%);
    overflow-x: hidden;
}

a {
    color: inherit;
    text-decoration: none;
}

button,
input,
select {
    font: inherit;
}

button {
    color: inherit;
}

.login-wrapper {
    min-height: 100vh;
    min-height: 100svh;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: clamp(16px, 4vw, 32px);
}

.login-card {
    width: min(100%, 430px);
    max-width: calc(100vw - 32px);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: clamp(20px, 5vw, 28px);
    background: rgba(255, 255, 255, 0.96);
    box-shadow: 0 28px 80px rgba(5, 7, 13, 0.24);
    padding: clamp(22px, 5vw, 34px);
}

.login-card > .brand-mark {
    margin-inline: auto;
}

.login-card > h1,
.login-card > p {
    text-align: center;
}

.login-card > p {
    margin: 10px 0 22px;
}

.manage-users-body {
    min-height: 100vh;
    min-height: 100svh;
}

.standalone-shell {
    width: min(1180px, calc(100% - 32px));
    margin: 0 auto;
    padding: clamp(22px, 5vw, 48px) 0;
}

.standalone-topbar {
    margin-bottom: 22px;
}

.user-form-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    align-items: end;
}

.form-submit-cell {
    display: flex;
    align-items: flex-end;
}

.table-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.table-toolbar {
    margin-bottom: 14px;
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 14px;
}

.table-toolbar h3 {
    margin: 0;
    font-size: 18px;
}

.table-toolbar p {
    margin: 6px 0 0;
    color: var(--muted);
}

.table-search {
    width: min(100%, 460px);
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    gap: 8px;
    align-items: end;
}

.table-search label {
    grid-column: 1 / -1;
    color: var(--black);
    font-size: 13px;
    font-weight: 850;
}

.table-search input {
    width: 100%;
    min-height: 38px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: #fff;
    outline: none;
    padding: 9px 14px;
}

.table-search input:focus {
    border-color: var(--blue);
    box-shadow: 0 0 0 4px rgba(11, 92, 255, 0.12);
}

.tabbed-table-form {
    display: grid;
    gap: 18px;
}

.tab-control {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.table-tab-controls {
    width: fit-content;
    max-width: 100%;
    padding: 6px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--surface);
}

.table-tab-label {
    min-height: 38px;
    padding: 9px 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border-radius: 999px;
    color: var(--muted);
    font-weight: 900;
    cursor: pointer;
    transition: background 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
}

.table-tab-label span {
    min-width: 24px;
    min-height: 24px;
    padding: 3px 7px;
    display: inline-grid;
    place-items: center;
    border-radius: 999px;
    background: #fff;
    color: var(--blue);
    font-size: 12px;
    box-shadow: inset 0 0 0 1px rgba(11, 92, 255, 0.14);
}

.tab-panel {
    display: none;
}

#tab_registered_users:checked ~ .table-tab-controls label[for="tab_registered_users"],
#tab_login_history:checked ~ .table-tab-controls label[for="tab_login_history"] {
    background: var(--blue);
    color: var(--white);
    box-shadow: 0 10px 22px rgba(11, 92, 255, 0.18);
}

#tab_registered_users:checked ~ .tab-panels .tab-panel-users,
#tab_login_history:checked ~ .tab-panels .tab-panel-history {
    display: block;
}

.brand-mark {
    width: 96px;
    height: 96px;
    margin-bottom: 18px;
    display: grid;
    place-items: center;
    border-radius: 999px;
    background: transparent;
    overflow: hidden;
    padding: 3px;
    isolation: isolate;
    box-shadow: none;
}

.brand-mark.small {
    width: 44px;
    height: 44px;
    margin: 0;
    padding: 1px;
    box-shadow: none;
}

.brand-logo-image {
    width: 100%;
    height: 100%;
    display: block;
    border-radius: 999px;
    object-fit: cover;
    object-position: center 47%;
    transform: scale(1.27);
    transform-origin: center;
}

.login-card h1,
.topbar h1,
.panel h2,
.device-profile h2 {
    margin: 0;
    letter-spacing: -0.04em;
}

.login-card h1,
.topbar h1 {
    font-size: clamp(30px, 4vw, 44px);
    line-height: 0.98;
}

.panel h2,
.device-profile h2 {
    font-size: clamp(22px, 2vw, 28px);
}

.login-card p,
.panel p,
.device-profile p,
.sidebar-brand span,
.eyebrow {
    color: var(--muted);
}

.form-stack {
    display: grid;
    gap: 16px;
}

.field-group {
    display: grid;
    gap: 8px;
}

.field-group label {
    color: var(--black);
    font-size: 13px;
    font-weight: 850;
}

.field-group input,
.field-group select {
    width: 100%;
    min-width: 0;
    min-height: 46px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: #fff;
    outline: none;
    padding: 12px 14px;
    transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.field-group input:focus,
.field-group select:focus {
    border-color: var(--blue);
    box-shadow: 0 0 0 4px rgba(11, 92, 255, 0.12);
}

.form-hint {
    margin: 0;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.5;
}

.check-row {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    color: var(--muted);
    font-size: 14px;
    font-weight: 750;
}

.check-row input {
    width: 16px;
    height: 16px;
}

.btn {
    min-height: 42px;
    border: 1px solid transparent;
    border-radius: 999px;
    padding: 10px 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-weight: 850;
    line-height: 1.2;
    cursor: pointer;
    transition: transform 0.18s ease, background 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.btn .fi,
.modal-close .fi,
.sidebar-toggle .fi,
.command-menu .fi {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.btn .fi {
    font-size: 1.05em;
}

.btn:hover {
    transform: translateY(-1px);
}

.btn-primary {
    background: var(--blue);
    color: var(--white);
    box-shadow: 0 12px 26px rgba(11, 92, 255, 0.18);
}

.btn-primary:hover {
    background: var(--blue-strong);
}

.btn-outline {
    border-color: rgba(11, 92, 255, 0.24);
    background: #fff;
    color: var(--blue);
}

.btn-light {
    border-color: var(--line);
    background: #fff;
    color: var(--black);
}

.btn-danger {
    background: #dc2626;
    color: var(--white);
    box-shadow: 0 12px 26px rgba(220, 38, 38, 0.18);
}

.btn-danger:hover {
    background: #b91c1c;
}

.btn-sm {
    min-height: 34px;
    padding: 8px 12px;
    font-size: 13px;
}

.btn-full {
    width: 100%;
}

.hint-box {
    margin-top: 18px;
    border: 1px solid rgba(11, 92, 255, 0.14);
    border-radius: var(--radius-sm);
    background: var(--blue-soft);
    color: var(--blue-strong);
    padding: 12px;
    font-size: 14px;
}

.alert {
    margin-bottom: 18px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    padding: 13px 15px;
    font-weight: 800;
}

.alert-error {
    background: #fff;
    color: var(--black);
}

.alert-success {
    background: var(--blue-soft);
    color: var(--blue-strong);
}

.app-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 286px minmax(0, 1fr);
    transition: grid-template-columns 0.22s ease;
}

.app-shell.sidebar-collapsed {
    grid-template-columns: 76px minmax(0, 1fr);
}

.sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    gap: 24px;
    border-right: 1px solid rgba(255, 255, 255, 0.2);
    background:
        radial-gradient(circle at 20% 6%, rgba(255, 255, 255, 0.18), transparent 14rem),
        linear-gradient(165deg, var(--blue-gradient-start) 0%, var(--blue-gradient-mid) 48%, var(--blue-gradient-end) 100%);
    color: var(--white);
    padding: 22px;
    box-shadow: 14px 0 34px rgba(4, 53, 143, 0.16);
    transition: padding 0.22s ease;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.sidebar-brand h2 {
    margin: 0;
    color: #fff;
    font-size: 18px;
    line-height: 1;
}

.sidebar-brand span {
    display: block;
    margin-top: 3px;
    color: rgba(255, 255, 255, 0.64);
    font-size: 12px;
    font-weight: 750;
}

.sidebar-toggle {
    margin-left: auto;
    min-height: 34px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    font-size: 12px;
    font-weight: 900;
    padding: 7px 10px;
}

.sidebar-toggle span {
    margin: 0;
    color: inherit;
    font: inherit;
}

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

.side-nav a,
.logout-link {
    width: 100%;
    min-height: 46px;
    border: 1px solid transparent;
    border-radius: 16px;
    padding: 12px;
    display: flex;
    align-items: center;
    gap: 10px;
    background: transparent;
    color: rgba(255, 255, 255, 0.72);
    font-weight: 850;
    text-align: left;
    transition: background 0.18s ease, color 0.18s ease, border-color 0.18s ease;
}

.side-nav a:hover,
.side-nav a.active,
.logout-link:hover {
    border-color: rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.11);
    color: #fff;
}

.side-nav a.active .sidebar-icon {
    background: #fff;
    color: var(--blue-strong);
    box-shadow: 0 8px 18px rgba(3, 45, 120, 0.22);
}

.sidebar-icon {
    width: 26px;
    min-width: 26px;
    height: 26px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    font-size: 12px;
    font-weight: 950;
}

.sidebar-icon .fi {
    height: 1em;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    line-height: 1;
}

.logout-form {
    margin-top: auto;
}

.modal-anchor-reset {
    position: fixed;
    width: 0;
    height: 0;
    overflow: hidden;
}

.sidebar-collapsed .sidebar {
    align-items: center;
    padding: 16px 10px;
}

.sidebar-collapsed .brand-copy,
.sidebar-collapsed .sidebar-label {
    display: none;
}

.sidebar-collapsed .sidebar-brand {
    width: 100%;
    flex-direction: column;
    justify-content: center;
    gap: 12px;
}

.sidebar-collapsed .brand-mark.small {
    width: 42px;
    height: 42px;
    border-radius: 999px;
    padding: 2px;
}

.sidebar-collapsed .sidebar-toggle {
    width: 42px;
    height: 42px;
    min-height: 42px;
    margin-left: 0;
    overflow: hidden;
    padding-inline: 0;
    text-indent: -999px;
}

.sidebar-collapsed .sidebar-toggle::after {
    content: ">";
    display: block;
    color: #fff;
    font-size: 18px;
    line-height: 1;
    text-indent: 0;
}

.sidebar-collapsed .side-nav,
.sidebar-collapsed .logout-form {
    width: 100%;
    display: grid;
    justify-items: center;
}

.sidebar-collapsed .side-nav a,
.sidebar-collapsed .logout-link {
    width: 52px;
    min-height: 52px;
    justify-content: center;
    border-radius: 18px;
    padding: 0;
}

.sidebar-collapsed .sidebar-icon {
    width: 30px;
    min-width: 30px;
    height: 30px;
    border-radius: 12px;
}

.main-content {
    width: 100%;
    min-width: 0;
    max-width: 1440px;
    padding: clamp(20px, 3vw, 38px);
}

.topbar {
    margin-bottom: 24px;
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
}

.topbar-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 10px;
}

.viewer-frame-shell {
    min-height: 720px;
    height: calc(100vh - 150px);
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #fff;
    box-shadow: var(--shadow-soft);
}

.viewer-frame {
    width: 100%;
    height: 100%;
    display: block;
    border: 0;
    background: var(--surface);
}

.eyebrow {
    margin: 0 0 8px;
    color: var(--blue);
    font-size: 12px;
    font-weight: 950;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.stats-grid {
    margin-bottom: 20px;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
}

.stat-card,
.panel,
.device-profile {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: rgba(255, 255, 255, 0.92);
    box-shadow: var(--shadow-soft);
}

.stat-card {
    min-height: 112px;
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    overflow: hidden;
}

.stat-card span {
    color: var(--muted);
    font-weight: 850;
}

.stat-card strong {
    display: block;
    margin-top: 8px;
    color: var(--black);
    font-size: 36px;
    line-height: 1;
    letter-spacing: -0.05em;
}

.stat-card-copy {
    min-width: 0;
}

.stat-card-gif {
    width: 56px;
    height: 56px;
    flex: 0 0 auto;
    border: 1px solid rgba(11, 92, 255, 0.12);
    border-radius: 16px;
    background: #fff;
    box-shadow: 0 10px 24px rgba(11, 92, 255, 0.12);
    object-fit: cover;
}

.dark-card {
    border-color: rgba(11, 92, 255, 0.28);
    background:
        radial-gradient(circle at 90% 12%, rgba(255, 255, 255, 0.18), transparent 8rem),
        linear-gradient(135deg, var(--blue-gradient-start) 0%, var(--blue-gradient-mid) 56%, var(--blue-gradient-end) 100%);
    color: var(--white);
    box-shadow: 0 16px 34px rgba(7, 88, 217, 0.22);
}

.dark-card span,
.dark-card strong {
    color: var(--white);
}

.panel {
    margin-bottom: 20px;
    padding: clamp(18px, 2vw, 24px);
}

.panel-header {
    margin-bottom: 16px;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 15px;
}

.panel-header p {
    margin: 6px 0 0;
}

.table-wrapper {
    width: 100%;
    overflow-x: auto;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: #fff;
}

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

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

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

th {
    background: #fff;
    color: var(--black);
    font-size: 12px;
    font-weight: 950;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

tbody tr:hover {
    background: #f8fbff;
}

code {
    max-width: 280px;
    display: inline-block;
    overflow-wrap: anywhere;
    border-radius: 10px;
    background: var(--blue-soft);
    color: var(--blue-strong);
    padding: 5px 8px;
    font-size: 12px;
}

.muted-line {
    display: block;
    margin-top: 4px;
    color: var(--muted);
    font-size: 12px;
}

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

.device-table-wrapper {
    border-radius: 12px;
    overscroll-behavior-inline: contain;
    scrollbar-gutter: stable;
    -webkit-overflow-scrolling: touch;
}

.device-table {
    min-width: 920px;
    font-size: 13px;
}

.device-table th,
.device-table td {
    padding: 9px 10px;
    white-space: nowrap;
}

.device-table th {
    font-size: 11px;
}

.device-table code {
    max-width: none;
    padding: 3px 6px;
    overflow-wrap: normal;
    white-space: nowrap;
}

.device-table .status-badge {
    padding: 4px 9px 4px 5px;
    font-size: 11px;
}

.device-table .action-cell {
    display: table-cell;
}

.device-actions {
    display: flex;
    flex-wrap: nowrap;
    gap: 6px;
}

.device-actions .btn {
    flex: 0 0 auto;
}

.empty-state {
    padding: 30px;
    color: var(--muted);
    text-align: center;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border-radius: 999px;
    padding: 7px 11px;
    font-size: 12px;
    font-weight: 950;
    line-height: 1;
}

.status-icon {
    width: 22px;
    height: 22px;
    flex: 0 0 auto;
    border-radius: 50%;
    background: #ffffff;
    object-fit: cover;
}

.device-status-badge {
    padding: 5px 12px 5px 6px;
    font-size: 13px;
}

.device-status-badge .status-icon {
    width: 30px;
    height: 30px;
}

.status-badge.online,
.status-badge.done {
    background: #dcfce7;
    color: #166534;
}

.status-badge.offline,
.status-badge.failed {
    background: #fee2e2;
    color: #991b1b;
}

.status-badge.pending,
.status-badge.processing {
    background: #fef3c7;
    color: #92400e;
    box-shadow: inset 0 0 0 1px rgba(245, 158, 11, 0.28);
}

.status-badge.admin {
    background: #dbeafe;
    color: #1d4ed8;
}

.status-badge.operator {
    background: #e0f2fe;
    color: #0369a1;
}

.status-badge.viewer {
    background: #f3f4f6;
    color: #374151;
}

.modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 50;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(5, 7, 13, 0.68);
    backdrop-filter: blur(7px);
}

.modal-backdrop.show,
.modal-backdrop:target {
    display: flex;
}

.modal-card {
    width: 100%;
    max-width: 520px;
    max-height: calc(100vh - 36px);
    overflow: auto;
    border: 1px solid rgba(255, 255, 255, 0.8);
    border-radius: 24px;
    background: var(--white);
    box-shadow: var(--shadow);
    padding: 24px;
}

.modal-card-wide {
    max-width: min(1080px, calc(100vw - 32px));
}

.modal-table-wrapper {
    max-height: 62vh;
}

.modal-header {
    margin-bottom: 18px;
    display: flex;
    justify-content: space-between;
    gap: 14px;
}

.modal-header h2,
.modal-header p {
    margin: 0;
}

.modal-close {
    width: 38px;
    min-width: 38px;
    height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: #fff;
    color: var(--black);
    font-size: 24px;
    line-height: 1;
    text-decoration: none;
    cursor: pointer;
}

.modal-close .fi {
    font-size: 18px;
}

.modal-actions {
    margin-top: 6px;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.danger-copy {
    border: 1px solid #fecaca;
    border-radius: var(--radius-sm);
    background: #fff5f5;
    color: #991b1b;
    padding: 12px;
}

.device-profile {
    padding: clamp(18px, 2vw, 24px);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.api-box {
    min-width: 260px;
    display: grid;
    gap: 8px;
}

.api-box span {
    color: var(--muted);
    font-size: 13px;
    font-weight: 950;
}

.device-page-header {
    align-items: center;
    margin-bottom: 18px;
}

.device-page-heading {
    min-width: 0;
}

.device-page-heading .eyebrow {
    margin-bottom: 6px;
}

.device-page-meta {
    margin: 9px 0 0;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 800;
}

.device-header-actions {
    align-self: flex-end;
}

.device-override-button {
    border-color: rgba(220, 38, 38, 0.28);
    color: #b91c1c;
}

.device-override-button:hover {
    background: #fff5f5;
}

.device-overview-grid {
    margin-bottom: 20px;
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(320px, 0.85fr);
    gap: 18px;
}

.device-overview-grid > .panel {
    margin-bottom: 0;
}

.device-connection-card {
    background:
        radial-gradient(circle at 100% 0, rgba(22, 119, 255, 0.12), transparent 18rem),
        linear-gradient(135deg, #fff 0%, #f6faff 100%);
}

.device-card-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
}

.device-card-heading .eyebrow {
    margin-bottom: 6px;
}

.device-connection-message {
    margin-top: 22px;
    display: flex;
    align-items: center;
    gap: 14px;
}

.device-connection-symbol {
    width: 48px;
    height: 48px;
    flex: 0 0 48px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 16px;
    font-size: 20px;
}

.device-connection-symbol.online {
    background: #dcfce7;
    color: #15803d;
}

.device-connection-symbol.offline {
    background: #fee2e2;
    color: #b91c1c;
}

.device-connection-message strong {
    display: block;
    font-size: 17px;
}

.device-connection-message p {
    max-width: 52ch;
    margin: 4px 0 0;
}

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

.device-time-item {
    min-width: 0;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.88);
    padding: 13px;
}

.device-time-item span {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 900;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.device-time-item strong {
    display: block;
    margin-top: 7px;
    overflow-wrap: anywhere;
    color: var(--black);
    font-size: 13px;
}

.device-time-cell > span:first-child {
    display: block;
}

.device-time-warning,
.device-time-item .device-time-warning {
    display: inline-flex;
    align-items: flex-start;
    gap: 6px;
    margin-top: 6px;
    color: #b45309;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0;
    line-height: 1.35;
    text-transform: none;
    white-space: normal;
}

.device-time-warning .fi {
    flex: 0 0 auto;
    margin-top: 1px;
}

.device-information-card {
    background: #fff;
}

.device-information-list {
    margin: 20px 0 0;
    display: grid;
    gap: 0;
}

.device-information-list > div {
    border-top: 1px solid var(--line);
    padding: 12px 0;
    display: grid;
    grid-template-columns: minmax(130px, 0.7fr) minmax(0, 1fr);
    align-items: center;
    gap: 16px;
}

.device-information-list dt {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 900;
}

.device-information-list dt .fi {
    color: var(--blue);
}

.device-information-list dd {
    min-width: 0;
    margin: 0;
    overflow-wrap: anywhere;
    color: var(--black);
    font-weight: 900;
    text-align: right;
}

.device-information-list code {
    display: inline-block;
    max-width: 100%;
    overflow-wrap: anywhere;
}

.command-center-panel {
    padding: clamp(20px, 2.5vw, 28px);
}

.command-center-header {
    align-items: center;
}

.command-center-header .eyebrow {
    margin-bottom: 6px;
}

.command-availability {
    min-height: 36px;
    border-radius: 999px;
    padding: 8px 11px;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-size: 12px;
    font-weight: 950;
    white-space: nowrap;
}

.command-availability.ready {
    background: #dcfce7;
    color: #166534;
}

.command-availability.busy {
    background: #fef3c7;
    color: #92400e;
}

.command-availability.offline {
    background: #fee2e2;
    color: #991b1b;
}

.command-select-card {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(300px, 460px);
    align-items: center;
    gap: 16px;
    border: 1px solid rgba(11, 92, 255, 0.16);
    border-radius: 18px;
    background:
        linear-gradient(135deg, #fff 0%, #f7fbff 100%);
    padding: 16px;
}

.command-select-copy {
    display: flex;
    align-items: center;
    gap: 12px;
}

.command-step-badge {
    width: 38px;
    height: 38px;
    flex: 0 0 38px;
    border-radius: 12px;
    background: var(--blue);
    box-shadow: 0 10px 20px rgba(11, 92, 255, 0.18);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 12px;
    font-weight: 950;
}

.command-select-label {
    display: block;
    color: var(--black);
    font-size: 13px;
    font-weight: 950;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.command-select-card p {
    margin: 6px 0 0;
    color: var(--muted);
}

.command-picker {
    min-width: 0;
}

.command-menu {
    position: relative;
    width: 100%;
    min-width: 0;
}

.command-menu-summary {
    min-height: 46px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: #fff;
    color: var(--black);
    outline: none;
    padding: 12px 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    cursor: pointer;
    font-weight: 850;
    list-style: none;
}

.command-menu-summary::-webkit-details-marker {
    display: none;
}

.command-menu-summary-label {
    display: inline-flex;
    align-items: center;
    gap: 9px;
}

.command-menu-summary-label > .fi {
    color: var(--blue);
}

.command-menu-chevron {
    color: var(--muted);
    transition: transform 0.18s ease;
}

.command-menu[open] .command-menu-chevron {
    transform: rotate(180deg);
}

.command-menu[data-disabled] .command-menu-summary {
    cursor: not-allowed;
    opacity: 0.58;
    pointer-events: none;
}

.command-menu-list {
    position: absolute;
    z-index: 40;
    top: calc(100% + 8px);
    right: 0;
    width: min(100%, 460px);
    max-height: 360px;
    overflow-y: auto;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: #fff;
    box-shadow: 0 22px 50px rgba(15, 23, 42, 0.18);
    padding: 8px;
}

.command-menu-option,
.command-menu-empty {
    width: 100%;
    min-height: 54px;
    border-radius: 12px;
    padding: 10px 12px;
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--black);
    text-align: left;
}

.command-menu-option {
    transition: background 0.16s ease, color 0.16s ease, transform 0.16s ease;
}

.command-menu-option:hover,
.command-menu-option:focus-visible {
    background: var(--blue-soft);
    color: var(--blue-strong);
    transform: translateX(2px);
}

.command-menu-option > .fi,
.command-menu-empty > .fi {
    width: 34px;
    height: 34px;
    flex: 0 0 34px;
    border-radius: 10px;
    background: var(--blue-soft);
    color: var(--blue);
    font-size: 17px;
}

.command-menu-option span,
.command-menu-empty span {
    min-width: 0;
    display: grid;
    gap: 2px;
}

.command-menu-option small {
    color: var(--muted);
    font-size: 10px;
    font-weight: 900;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.command-menu-option strong {
    font-size: 13px;
}

.command-menu-empty {
    color: var(--muted);
    font-size: 13px;
    font-weight: 850;
}

.command-queue-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 14px;
}

.command-queue-header .eyebrow {
    margin: 0 0 5px;
}

.command-queue-count {
    border-radius: 999px;
    background: var(--blue-soft);
    padding: 7px 10px;
    color: var(--blue-strong);
    font-size: 11px;
    font-weight: 950;
}

.command-queue-wrapper {
    border-radius: 14px;
}

.command-queue-table {
    min-width: 980px;
}

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

.subsection-header {
    margin: 24px 0 14px;
    padding-top: 20px;
    border-top: 1px solid var(--line);
}

.subsection-header h3,
.subsection-header p {
    margin: 0;
}

.subsection-header p {
    margin-top: 4px;
    color: var(--muted);
}

.command-grid form {
    min-width: 0;
}

.command-card {
    min-height: 122px;
    display: block;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: #fff;
    color: inherit;
    cursor: pointer;
    padding: 18px;
    text-align: left;
    text-decoration: none;
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.command-card:hover {
    border-color: rgba(11, 92, 255, 0.28);
    box-shadow: 0 18px 34px rgba(11, 92, 255, 0.1);
    transform: translateY(-3px);
}

.command-card span {
    color: var(--blue);
    font-size: 12px;
    font-weight: 950;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.command-card strong {
    display: block;
    margin-top: 12px;
    color: var(--black);
    font-size: 20px;
    line-height: 1.12;
    letter-spacing: -0.03em;
}

.command-card small {
    display: block;
    margin-top: 12px;
    color: var(--black);
    font-weight: 850;
}

.command-card-disabled {
    cursor: not-allowed;
    opacity: 0.56;
}

.command-card-disabled:hover {
    border-color: var(--line);
    box-shadow: none;
    transform: none;
}

.danger-command {
    border-color: #fecaca;
    background: linear-gradient(180deg, #fff 0%, #fff5f5 100%);
}

.date-range-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.schedule-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
}

.schedule-group {
    border: 1px solid var(--line);
    border-radius: 18px;
    background: #fff;
    padding: 16px;
}

.schedule-group h3 {
    margin: 0 0 14px;
    color: var(--blue-strong);
    font-size: 16px;
}

.schedule-row {
    display: grid;
    gap: 10px;
    padding-block: 12px;
    border-top: 1px solid var(--line);
}

.schedule-row:first-of-type {
    border-top: 0;
    padding-top: 0;
}

.schedule-row strong {
    color: var(--black);
}

.schedule-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
}

.pager {
    margin-top: 16px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
}

.pager-link {
    min-height: 36px;
    border: 1px solid rgba(11, 92, 255, 0.22);
    border-radius: 999px;
    padding: 8px 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    color: var(--blue);
    font-weight: 850;
}

.pager-link.disabled {
    border-color: var(--line);
    color: var(--muted);
    opacity: 0.7;
}

.pager-meta {
    color: var(--muted);
    font-size: 13px;
    font-weight: 850;
}

.fade-in {
    animation: fadeIn 0.4s ease both;
}

.slide-in-left {
    animation: slideInLeft 0.4s ease both;
}

.pop-in {
    animation: popIn 0.22s ease both;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes popIn {
    from {
        opacity: 0;
        transform: scale(0.96);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

@media (max-width: 1020px) {
    .app-shell,
    .app-shell.sidebar-collapsed {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: sticky;
        top: 0;
        z-index: 20;
        height: auto;
        border-right: 0;
        border-bottom: 1px solid rgba(255, 255, 255, 0.12);
        padding: 14px 16px;
    }

    .sidebar-brand {
        align-items: center;
    }

    .side-nav {
        grid-template-columns: repeat(2, minmax(0, max-content));
    }

    .logout-form {
        margin-top: 0;
    }

    .sidebar-collapsed .brand-copy,
    .sidebar-collapsed .sidebar-label {
        display: initial;
    }

    .sidebar-collapsed .side-nav a,
    .sidebar-collapsed .logout-link {
        justify-content: flex-start;
    }

    .sidebar-collapsed .sidebar-toggle {
        width: auto;
        height: auto;
        min-height: 34px;
        text-indent: 0;
        padding-inline: 10px;
    }

    .sidebar-collapsed .sidebar-toggle::after {
        content: none;
    }

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

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

    .device-header-actions {
        align-self: stretch;
    }

    .command-select-card,
    .schedule-grid {
        grid-template-columns: 1fr;
    }

    .device-profile,
    .topbar {
        align-items: flex-start;
        flex-direction: column;
    }

    .topbar-actions {
        justify-content: flex-start;
    }
}

@media (max-width: 640px) {
    body {
        font-size: 14px;
        overflow-x: hidden;
    }

    .main-content {
        padding: 18px 16px calc(112px + env(safe-area-inset-bottom));
    }

    .sidebar {
        position: fixed;
        inset: auto 12px calc(12px + env(safe-area-inset-bottom)) 12px;
        z-index: 60;
        height: auto;
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 8px;
        border: 1px solid rgba(255, 255, 255, 0.14);
        border-radius: 24px;
        background:
            linear-gradient(180deg, rgba(5, 7, 13, 0.96) 0%, rgba(7, 26, 64, 0.96) 100%);
        box-shadow: 0 18px 46px rgba(5, 7, 13, 0.36);
        padding: 8px;
    }

    .sidebar-brand {
        display: none;
    }

    .side-nav,
    .logout-form,
    .sidebar-collapsed .side-nav,
    .sidebar-collapsed .logout-form {
        display: contents;
        width: auto;
    }

    .side-nav a,
    .logout-link,
    .sidebar-collapsed .side-nav a,
    .sidebar-collapsed .logout-link {
        width: 100%;
        min-height: 58px;
        justify-content: center;
        flex-direction: column;
        gap: 5px;
        border-radius: 18px;
        padding: 8px;
        text-align: center;
    }

    .sidebar-label,
    .sidebar-collapsed .sidebar-label {
        display: inline;
        font-size: 11px;
        line-height: 1;
    }

    .sidebar-icon,
    .sidebar-collapsed .sidebar-icon {
        width: 26px;
        min-width: 26px;
        height: 26px;
        border-radius: 10px;
    }

    .login-card {
        padding: 22px;
    }

    .stats-grid,
    .command-grid,
    .date-range-grid {
        grid-template-columns: 1fr;
    }

    .command-picker,
    .schedule-actions {
        grid-template-columns: 1fr;
        flex-direction: column;
        align-items: stretch;
    }

    .command-picker .btn,
    .schedule-actions .btn {
        width: 100%;
    }

    .api-box {
        min-width: 0;
        width: 100%;
    }

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

    .device-information-list > div {
        grid-template-columns: 1fr;
        gap: 6px;
    }

    .device-information-list dd {
        text-align: left;
    }

    .device-card-heading,
    .command-center-header,
    .command-queue-header {
        align-items: flex-start;
        flex-direction: column;
    }

    .command-availability {
        align-self: flex-start;
    }

    .command-select-copy {
        align-items: flex-start;
    }

    .topbar-actions,
    .topbar-actions .btn {
        width: 100%;
    }

    .modal-actions {
        flex-direction: column-reverse;
    }

    .modal-actions .btn {
        width: 100%;
    }

    .pager {
        justify-content: stretch;
    }

    .pager-link,
    .pager-meta {
        flex: 1;
        text-align: center;
    }

    .table-toolbar,
    .table-search {
        grid-template-columns: 1fr;
    }

    .table-toolbar {
        align-items: stretch;
    }

    .device-table {
        width: max-content;
        min-width: 920px;
    }

    .device-table th,
    .device-table td {
        padding: 8px 9px;
    }

    .user-form-grid {
        grid-template-columns: 1fr;
    }

    .viewer-frame-shell {
        min-height: 680px;
        height: calc(100svh - 180px);
        border-radius: 16px;
    }
}

@media (max-width: 420px) {
    .main-content {
        padding-inline: 12px;
    }

    .sidebar {
        inset-inline: 8px;
        bottom: calc(8px + env(safe-area-inset-bottom));
        border-radius: 22px;
    }

    .login-wrapper {
        align-items: flex-start;
        padding: 12px;
        padding-top: max(18px, env(safe-area-inset-top));
    }

    .login-card {
        max-width: 100%;
        border-radius: 20px;
        padding: 20px;
    }

    .login-card h1 {
        font-size: clamp(26px, 9vw, 34px);
        line-height: 1;
    }

    .login-card .brand-mark {
        width: 78px;
        height: 78px;
    }
}

@media (max-height: 620px) {
    .login-wrapper {
        align-items: flex-start;
    }

    .login-card {
        margin-block: 12px;
    }
}
