:root {
    --bg: #eef3f1;
    --bg-accent: #dceae6;
    --card: #ffffff;
    --text: #14231f;
    --muted: #5b6b66;
    --primary: #0f6f64;
    --primary-dark: #0b574e;
    --primary-soft: #d8f3ee;
    --border: #d7e2de;
    --danger: #b42318;
    --danger-soft: #fee4e2;
    --ok: #067647;
    --ok-soft: #d1fadf;
    --warn: #b54708;
    --warn-soft: #fef0c7;
    --sidebar: #10241f;
    --sidebar-2: #16352e;
    --shadow: 0 12px 30px rgba(16, 36, 31, 0.08);
    --radius: 14px;
    --font: "Manrope", "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    min-height: 100vh;
    font-family: var(--font);
    color: var(--text);
    background:
        radial-gradient(circle at top left, rgba(15, 111, 100, 0.12), transparent 28%),
        linear-gradient(160deg, #eef6f3 0%, #eef3f1 42%, #e8eef8 100%);
}

/* Admin shell: lock document scroll; sidebar + main scroll independently */
html:has(.app-shell),
body:has(.app-shell),
html:has(body.admin-app),
body.admin-app {
    height: 100%;
    max-height: 100%;
    overflow: hidden;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3 { margin: 0 0 8px; letter-spacing: -0.02em; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

.wrap { max-width: 920px; margin: 40px auto; padding: 0 16px 40px; }
.login-wrap { max-width: 440px; margin: 8vh auto; padding: 0 16px; }

.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 20px;
    min-width: 0;
    max-width: 100%;
    /* Keep visible so field-help tooltips are not clipped by section boundaries.
       Scrollable regions (tables, grids) use their own overflow on .table-wrap etc. */
    overflow: visible;
}

.brand { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.brand-mark {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: linear-gradient(135deg, #0f6f64, #0b574e);
    color: #fff;
    display: grid;
    place-items: center;
    font-weight: 800;
    box-shadow: 0 8px 18px rgba(15, 111, 100, 0.28);
}
.app-logo {
    width: 44px;
    height: 44px;
    flex: 0 0 44px;
    border-radius: 12px;
    object-fit: contain;
    background: #fff;
    padding: 4px;
}
.branding-preview {
    display: flex;
    align-items: center;
    min-height: 64px;
    margin-top: 10px;
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: #f8fafc;
}
.branding-preview img {
    max-width: 180px;
    max-height: 56px;
    object-fit: contain;
}
.branding-preview.favicon img {
    width: 32px;
    height: 32px;
}
.login-support {
    margin-top: 18px;
    padding-top: 14px;
    border-top: 1px solid var(--border);
    text-align: center;
}

.steps { display: flex; gap: 8px; flex-wrap: wrap; margin: 18px 0 24px; }
.step-pill {
    padding: 8px 12px;
    border-radius: 999px;
    background: #f8fafc;
    border: 1px solid var(--border);
    font-size: 13px;
    color: var(--muted);
}
.step-pill.active {
    background: var(--primary-soft);
    border-color: #9fd9cf;
    color: #0b574e;
    font-weight: 700;
}
.step-pill.done {
    background: var(--ok-soft);
    border-color: #a6f4c5;
    color: var(--ok);
}

table.data-table {
    width: 100%;
    border-collapse: collapse;
    margin: 0;
}
table.data-table th,
table.data-table td {
    text-align: left;
    padding: 10px 10px;
    border-bottom: 1px solid var(--border);
    font-size: 12.5px;
    line-height: 1.35;
    vertical-align: middle;
    color: var(--text);
}
table.data-table th {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--muted);
    background: #f4f8f6;
    white-space: nowrap;
}
table.data-table tbody tr:nth-child(even) td { background: #fbfcfc; }
table.data-table tr:hover td { background: #f3faf7; }
table.data-table td .muted,
table.data-table td .small { font-size: 11px; }
table.data-table .badge { font-size: 11px; padding: 3px 8px; }
table.data-table .row-actions {
    display: inline-flex;
    align-items: stretch;
    justify-content: flex-end;
    flex-wrap: nowrap;
    gap: 0;
    white-space: nowrap;
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
    box-shadow: 0 1px 0 rgba(16, 36, 31, 0.02);
}
table.data-table .row-actions > a,
table.data-table .row-actions > button,
table.data-table .row-actions > form {
    display: inline-flex;
    margin: 0;
}
table.data-table .row-actions > * + * {
    border-left: 1px solid var(--border);
}
table.data-table .row-actions form {
    padding: 0;
    background: transparent;
}
table.data-table .row-actions .btn,
table.data-table .row-actions .btn-sm {
    /* legacy text buttons still fit the group if any remain */
    border: 0;
    border-radius: 0;
    padding: 7px 10px;
    font-size: 12px;
    line-height: 1.2;
    white-space: nowrap;
    box-shadow: none;
}

.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
}
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.fail, .badge.danger { background: var(--danger-soft); color: var(--danger); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.neutral { background: #eef2f6; color: #475467; }

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}
.form-grid .full { grid-column: 1 / -1; }

label {
    display: block;
    font-size: 12px;
    font-weight: 700;
    margin-bottom: 5px;
}
.field-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 6px;
}
.field-label-text {
    line-height: 1.2;
}
.field-required {
    color: #d92d20;
    margin-left: 2px;
    font-weight: 800;
}
.field-help {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    flex: 0 0 auto;
    cursor: help;
    z-index: 2;
}
.field-help-icon {
    width: 16px;
    height: 16px;
    border-radius: 999px;
    border: 1px solid #98a2b3;
    color: #667085;
    background: #fff;
    font-size: 10px;
    font-weight: 800;
    line-height: 14px;
    text-align: center;
    user-select: none;
}
.field-help-tip {
    position: absolute;
    left: 50%;
    bottom: calc(100% + 8px);
    transform: translateX(-50%) translateY(4px);
    width: max-content;
    max-width: 280px;
    padding: 8px 10px;
    border-radius: 8px;
    background: #101828;
    color: #fff;
    font-size: 12px;
    font-weight: 500;
    line-height: 1.35;
    box-shadow: 0 8px 20px rgba(16, 24, 40, 0.18);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity .15s ease, transform .15s ease, visibility .15s ease;
    z-index: 10050;
    white-space: normal;
    text-align: left;
}
.field-help-tip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: #101828;
}
.field-help:hover,
.field-help:focus,
.field-help:focus-within {
    z-index: 10060;
}
.field-help:hover .field-help-tip,
.field-help:focus .field-help-tip,
.field-help:focus-within .field-help-tip {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

/* When a tip would sit under a sticky header / near the top of a scroll area,
   flip it below the help icon instead of clipping it. */
.field-help.is-tip-below .field-help-tip {
    top: calc(100% + 8px);
    bottom: auto;
    transform: translateX(-50%) translateY(-4px);
}
.field-help.is-tip-below .field-help-tip::after {
    top: auto;
    bottom: 100%;
    border-top-color: transparent;
    border-bottom-color: #101828;
}
.field-help.is-tip-below:hover .field-help-tip,
.field-help.is-tip-below:focus .field-help-tip,
.field-help.is-tip-below:focus-within .field-help-tip {
    transform: translateX(-50%) translateY(0);
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="search"],
input[type="url"],
input[type="date"],
input[type="time"],
input[type="month"],
input[type="datetime-local"],
select,
textarea {
    width: 100%;
    padding: 11px 12px;
    border: 1px solid var(--border);
    border-radius: 12px;
    font-size: 14px;
    font-family: inherit;
    background: #fff;
    color: var(--text);
    outline: none;
    transition: border-color .15s ease, box-shadow .15s ease;
    box-sizing: border-box;
    min-height: 42px;
}
input:focus,
select:focus,
textarea:focus {
    border-color: #7bc4b8;
    box-shadow: 0 0 0 4px rgba(15, 111, 100, 0.12);
}

/* Compact fields used in toolbars / filter rows */
.input-sm,
select.input-sm,
input.input-sm {
    width: auto;
    min-width: 0;
    min-height: 34px;
    height: 34px;
    padding: 6px 10px;
    font-size: 13px;
    border-radius: 10px;
}

.input-group {
    display: flex;
    align-items: stretch;
    width: 100%;
    gap: 0;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: #fff;
    overflow: hidden;
    transition: border-color .15s ease, box-shadow .15s ease;
}
.input-group:focus-within {
    border-color: #7bc4b8;
    box-shadow: 0 0 0 4px rgba(15, 111, 100, 0.12);
}
.input-group > input[type="hidden"] {
    display: none;
}
.input-group > input:not([type="hidden"]),
.input-group > select {
    flex: 1 1 auto;
    width: auto;
    min-width: 0;
    min-height: 42px;
    height: 42px;
    margin: 0;
    padding: 0 14px;
    border: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    background: transparent;
    color: var(--text);
    font-size: 14px;
    font-weight: 500;
    line-height: 1.2;
    -webkit-appearance: none;
    appearance: none;
}
.input-group > input:not([type="hidden"])::placeholder {
    color: var(--muted);
    opacity: 1;
    font-weight: 500;
}
.input-group > .btn {
    flex: 0 0 auto;
    align-self: stretch;
    margin: 0;
    min-width: 72px;
    min-height: 42px;
    height: auto;
    padding: 0 16px;
    border: 0 !important;
    border-radius: 0 !important;
    border-left: 1px solid var(--border) !important;
    background: #f8fafc !important;
    color: var(--text) !important;
    font-size: 13px;
    font-weight: 700;
    transform: none !important;
    box-shadow: none !important;
}
.input-group > .btn:hover {
    background: #eef2f6 !important;
    color: var(--text) !important;
    transform: none !important;
}
.input-group > .btn.btn-danger {
    background: #fef3f2 !important;
    color: var(--danger) !important;
    border-left-color: var(--border) !important;
}
.input-group > .btn.btn-danger:hover {
    background: #fee4e2 !important;
    color: #912018 !important;
}
.input-group > .btn.btn-sm {
    min-height: 34px;
    padding: 0 12px;
}
.input-group > input.input-sm:not([type="hidden"]),
.input-group > select.input-sm {
    min-height: 34px;
    height: 34px;
    padding: 0 10px;
    font-size: 13px;
}

.icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #fff;
    color: #334155;
    cursor: pointer;
    transition: background .15s ease, border-color .15s ease, color .15s ease;
}
.icon-btn:hover {
    background: #eef4f2;
    border-color: #bfd4ce;
    color: var(--sidebar, #0f3d33);
    text-decoration: none;
}

.actions {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-top: 22px;
    align-items: center;
    flex-wrap: wrap;
}
.actions.end { justify-content: flex-end; }

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 16px;
    border-radius: 12px;
    border: 1px solid transparent;
    font-weight: 700;
    cursor: pointer;
    font-size: 14px;
    font-family: inherit;
    text-decoration: none;
    transition: .15s ease;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); color: #fff; }
.btn-secondary { background: #fff; border-color: var(--border); color: var(--text); }
.btn-secondary:hover { background: #f8fafc; color: var(--text); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #912018; color: #fff; }
.btn-sm { padding: 7px 11px; font-size: 13px; border-radius: 10px; }
.btn-link {
    background: transparent;
    border: none;
    color: var(--primary);
    padding: 0;
    font-weight: 700;
    cursor: pointer;
}
.btn-link.danger { color: var(--danger); }

.alert {
    padding: 12px 14px;
    border-radius: 12px;
    margin-bottom: 16px;
    font-size: 14px;
}
.alert.error { background: #fef2f2; color: var(--danger); border: 1px solid #fecaca; }
.alert.success { background: #f0fdf4; color: var(--ok); border: 1px solid #bbf7d0; }
.alert.info { background: #eff6ff; color: #1d4ed8; border: 1px solid #bfdbfe; }

.app-shell {
    display: grid;
    grid-template-columns: 208px minmax(0, 1fr);
    grid-template-rows: 64px minmax(0, 1fr);
    height: 100vh;
    height: 100dvh;
    width: 100%;
    max-width: 100vw;
    overflow: hidden; /* no page-level scroll; children scroll */
}
.sidebar {
    background: linear-gradient(180deg, var(--sidebar) 0%, var(--sidebar-2) 100%);
    color: #e2e8f0;
    padding: 14px 10px;
    position: relative; /* stays in grid cell; does not scroll with main */
    height: 100%;
    max-height: 100%;
    min-height: 0;
    overflow: hidden;
    align-self: stretch;
}
.sidebar-inner {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
    position: relative;
    padding-bottom: 4px;
}
.sidebar .logo {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 18px;
    padding: 6px 8px 16px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}
.sidebar .logo-text { font-weight: 800; font-size: 16px; color: #fff; }
.sidebar .logo-sub { font-size: 12px; color: #9fh5ab; color: #9db7b0; }
.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1 1 auto;
    overflow-x: hidden;
    overflow-y: auto;
    min-height: 0;
    padding-bottom: 8px;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
}
.sidebar-nav::-webkit-scrollbar { width: 6px; }
.sidebar-nav::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.22);
    border-radius: 999px;
}
.sidebar-nav::-webkit-scrollbar-track { background: transparent; }
.sidebar a.nav-link {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #c9ddd7;
    padding: 8px 10px;
    border-radius: 9px;
    text-decoration: none;
    font-weight: 600;
    font-size: 12.5px;
}
.sidebar a.nav-link:hover,
.sidebar a.nav-link.active {
    background: rgba(255,255,255,0.08);
    color: #fff;
}
.sidebar a.nav-link .nav-icon,
.ui-icon.nav-icon {
    width: 16px;
    height: 16px;
    flex: 0 0 auto;
    opacity: 0.9;
}
.sidebar a.nav-link.active .nav-icon {
    opacity: 1;
    color: #5eead4;
}
.dropdown-item {
    display: flex;
    width: 100%;
    align-items: center;
    gap: 10px;
    padding: 10px 11px;
    border-radius: 10px;
    border: 0;
    background: transparent;
    color: var(--text);
    font: inherit;
    font-size: 14px;
    font-weight: 700;
    text-align: left;
    cursor: pointer;
    text-decoration: none;
}
.dropdown-item .dropdown-icon,
.ui-icon.dropdown-icon {
    width: 16px;
    height: 16px;
    flex: 0 0 auto;
    color: var(--muted);
}
.dropdown-item.danger .dropdown-icon {
    color: var(--danger);
}
.user-caret {
    margin-left: auto;
    color: #9db7b0;
    display: inline-flex;
    transition: transform .15s ease;
}
.user-caret .caret-icon {
    width: 16px;
    height: 16px;
}
.btn-with-icon {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}
.btn-lead-icon {
    width: 16px;
    height: 16px;
    flex: 0 0 auto;
}
.sidebar-user {
    margin-top: auto;
    flex: 0 0 auto;
    padding-top: 16px;
    background: linear-gradient(180deg, rgba(22,53,46,0), var(--sidebar-2) 22%);
}
.user-menu {
    position: relative;
}
.user-menu summary {
    list-style: none;
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px;
    border-radius: 14px;
    cursor: pointer;
    color: #fff;
    background: rgba(255,255,255,0.07);
    border: 1px solid rgba(255,255,255,0.08);
}
.user-menu summary::-webkit-details-marker { display: none; }
.user-menu[open] summary,
.user-menu summary:hover {
    background: rgba(255,255,255,0.12);
}
.user-avatar {
    flex: 0 0 auto;
    width: 36px;
    height: 36px;
    border-radius: 11px;
    display: grid;
    place-items: center;
    background: #d8f3ee;
    color: var(--primary-dark);
    font-size: 13px;
    font-weight: 800;
}
.user-meta {
    min-width: 0;
    display: flex;
    flex-direction: column;
    line-height: 1.25;
}
.user-name {
    max-width: 145px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 14px;
    font-weight: 800;
}
.user-role {
    max-width: 145px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #9db7b0;
    font-size: 12px;
    font-weight: 600;
}
.user-menu[open] .user-caret {
    transform: rotate(180deg);
}
.user-dropdown {
    position: absolute;
    left: 0;
    right: 0;
    bottom: calc(100% + 10px);
    padding: 8px;
    border-radius: 14px;
    background: #fff;
    border: 1px solid var(--border);
    box-shadow: 0 18px 36px rgba(16, 36, 31, 0.18);
    z-index: 20;
}
.dropdown-item:hover {
    background: #f3f7f6;
    text-decoration: none;
}
.dropdown-item.danger {
    color: var(--danger);
}
.main {
    padding: 0;
    min-width: 0;
    min-height: 0;
    height: 100%;
    max-height: 100%;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    align-self: stretch;
}
.main-content {
    padding: 22px;
    min-width: 0;
    max-width: 100%;
    /* clip (not hidden) so vertical field-help tooltips are not forced into a scrollport */
    overflow-x: clip;
    overflow-y: visible;
}
.page-header {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: 0 4px 14px rgba(16, 36, 31, 0.04);
    padding: 16px 20px;
    margin: 0 0 18px;
}
.page-header-title {
    min-width: 0;
    flex: 1 1 auto;
    display: grid;
    grid-template-columns: auto auto minmax(0, 1fr);
    column-gap: 12px;
    row-gap: 2px;
    align-items: center;
}
/* Flatten heading so icon sits beside title+subtitle stack */
.page-header-heading {
    display: contents;
    min-width: 0;
}
.page-header-title .page-title-icon {
    grid-column: 1;
    grid-row: 1 / span 2;
    align-self: center;
    width: 40px;
    height: 40px;
    flex: 0 0 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 5px;
}
.page-title-icon-svg {
    width: 20px;
    height: 20px;
}
.page-title-icon--teal { background: #d8f3ee; color: #0b574e; }
.page-title-icon--cyan { background: #dff7fb; color: #0e7490; }
.page-title-icon--blue { background: #e0edff; color: #1d4ed8; }
.page-title-icon--indigo { background: #e8e7ff; color: #4338ca; }
.page-title-icon--violet { background: #f0e7ff; color: #6d28d9; }
.page-title-icon--pink { background: #fce7f3; color: #be185d; }
.page-title-icon--rose { background: #ffe4e6; color: #be123c; }
.page-title-icon--red { background: #fee4e2; color: #b42318; }
.page-title-icon--orange { background: #ffedd5; color: #c2410c; }
.page-title-icon--amber { background: #fef0c7; color: #b54708; }
.page-title-icon--green { background: #dcfce7; color: #15803d; }
.page-title-icon--emerald { background: #d1fae5; color: #047857; }
.page-title-icon--slate { background: #eef2f6; color: #334155; }
.page-header-title h1 {
    grid-column: 2;
    grid-row: 1;
    font-size: 18px;
    font-weight: 700;
    margin: 0;
    letter-spacing: -0.02em;
    line-height: 1.25;
    color: var(--text);
    align-self: end;
    width: max-content;
    max-width: 100%;
}
.page-header-counts {
    grid-column: 3;
    grid-row: 1;
    justify-self: start;
    align-self: center;
    margin-left: 0;
}
.page-header-title > .muted {
    display: block;
    grid-column: 2 / -1;
    grid-row: 2;
    margin-top: 0;
    font-size: 12.5px;
    line-height: 1.4;
    font-weight: 500;
    color: #9aada6;
    align-self: start;
}
/* No icon: stack title + subtitle in one column */
.page-header-title:not(:has(.page-title-icon)) {
    grid-template-columns: minmax(0, 1fr);
}
.page-header-title:not(:has(.page-title-icon)) h1,
.page-header-title:not(:has(.page-title-icon)) > .muted,
.page-header-title:not(:has(.page-title-icon)) .page-header-counts {
    grid-column: 1;
}

.page-header-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    flex-wrap: wrap;
    flex: 0 0 auto;
    margin-left: auto;
}
.page-header-actions form {
    display: inline-flex;
    margin: 0;
}
.page-header-rule {
    border: none;
    border-top: 1px dashed #c5d4cf;
    margin: 16px 0 20px;
    height: 0;
}

/* Back-compat alias */
.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin-bottom: 18px;
    flex-wrap: nowrap;
}
.page-title h1 { font-size: 22px; }
.page-title .muted { margin-top: 4px; }

.btn-icon {
    width: 40px;
    height: 40px;
    padding: 0;
    display: inline-grid;
    place-items: center;
    border-radius: 12px;
}
.btn-icon svg {
    width: 18px;
    height: 18px;
    display: block;
}
.btn-icon.is-active,
.btn-icon[aria-expanded="true"] {
    background: var(--primary-soft);
    border-color: #9fd9cf;
    color: var(--primary-dark);
}

.filter-panel {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 16px 18px;
    margin-bottom: 16px;
}
.filter-panel[hidden] {
    display: none !important;
}
.filter-panel-form {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: flex-end;
}
.filter-panel-form .filter-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 160px;
}
.filter-panel-form .filter-field label {
    font-size: 12px;
    font-weight: 700;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.filter-panel-form .filter-actions {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-left: auto;
}
.filter-meta {
    margin-left: auto;
    color: var(--muted);
    font-size: 13px;
    align-self: center;
}

.dashboard-hero {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 18px;
    flex-wrap: wrap;
}
.dashboard-quick {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
}
.dashboard-quick a {
    display: block;
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: #f8fbfa;
    color: inherit;
    text-decoration: none;
    transition: border-color .15s, transform .15s, background .15s;
}
.dashboard-quick a:hover {
    border-color: #9fd9cf;
    background: var(--primary-soft);
    transform: translateY(-1px);
    text-decoration: none;
}
.dashboard-quick h3 {
    margin: 0 0 4px;
    font-size: 15px;
}
.tabs-row {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.period-filter {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 16px;
    padding: 16px 18px;
    flex-wrap: wrap;
}
.period-filter-main {
    display: flex;
    flex-direction: column;
    gap: 14px;
    min-width: min(100%, 520px);
    flex: 1 1 420px;
}
.period-filter-label {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.period-filter-label strong {
    font-size: 16px;
    letter-spacing: -0.02em;
}
.period-filter-options {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: flex-end;
    align-items: flex-start;
    margin-left: auto;
}
.period-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    text-decoration: none !important;
}
.period-btn-icon {
    display: inline-flex;
    line-height: 0;
}
.period-filter-extra {
    display: flex;
    flex-wrap: wrap;
    gap: 14px 18px;
    align-items: flex-end;
}
.period-extra-form {
    display: flex;
    flex-direction: column;
    gap: 6px;
    align-items: stretch;
}
.period-extra-form > label {
    font-size: 12px;
    font-weight: 600;
    color: var(--muted);
}
.period-extra-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}
.period-extra-form select,
.period-extra-form input[type="date"] {
    width: auto;
    min-width: 0;
}
.period-extra-form #month {
    min-width: 160px;
    max-width: 200px;
}
.period-extra-custom .period-extra-row input[type="date"] {
    min-width: 138px;
    max-width: 150px;
}
.period-extra-custom .period-extra-row .btn {
    height: 34px;
    min-height: 34px;
}

.remote-mgmt-card .panel-header {
    align-items: center;
}
.remote-mgmt-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}
.remote-mgmt-group {
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 14px;
    background: #f8fafb;
}
.remote-mgmt-group-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 700;
    color: #334155;
    margin-bottom: 12px;
}
.remote-mgmt-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.remote-mgmt-inline.input-group {
    width: 100%;
}

.entity-row {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}
.entity-icon {
    position: relative;
    flex: 0 0 auto;
    width: 28px;
    height: 28px;
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
    border: 1px solid var(--border);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.entity-icon-sm { width: 22px; height: 22px; border-radius: 6px; }
.entity-icon img {
    display: block;
    width: 18px;
    height: 18px;
    object-fit: contain;
    object-position: center center;
    padding: 0;
    margin: 0;
    border: 0;
    background: transparent;
    flex: 0 0 auto;
}
.entity-icon-sm img {
    width: 14px;
    height: 14px;
}
.entity-icon-fallback {
    position: absolute;
    inset: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 12px;
    font-weight: 800;
    line-height: 1;
}
.entity-icon-fallback[hidden] {
    display: none !important;
}
.entity-icon-sm .entity-icon-fallback { font-size: 10px; }

.software-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}
.software-search,
.software-filter {
    min-height: 36px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: #fff;
    color: var(--text);
    padding: 0 12px;
    font: inherit;
}
.software-search {
    min-width: 220px;
    width: min(320px, 100%);
}
.software-filter { min-width: 140px; }
.software-table .entity-row { align-items: center; }
.software-path {
    overflow-wrap: anywhere;
    max-width: 360px;
}
.software-publisher {
    display: inline-block;
    max-width: 180px;
    overflow-wrap: anywhere;
}
.software-version {
    font-size: 12px;
    background: #f3f6f8;
    border-radius: 6px;
    padding: 2px 6px;
}

.app-modal {
    position: fixed;
    inset: 0;
    z-index: 1200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    overscroll-behavior: contain;
}
.app-modal[hidden] { display: none !important; }
.app-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
}
.app-modal-dialog {
    position: relative;
    width: min(760px, 100%);
    max-height: min(82vh, 820px);
    display: flex;
    flex-direction: column;
    background: #fff;
    border-radius: 16px;
    border: 1px solid var(--border);
    box-shadow: 0 24px 60px rgba(15, 23, 42, 0.28);
    overflow: hidden;
}
.app-modal-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 18px 20px;
    border-bottom: 1px solid var(--border);
}
.app-modal-body {
    overflow: auto;
    padding: 16px 20px 20px;
    display: grid;
    gap: 12px;
}
.command-result-card {
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 14px;
    background: #fbfcfd;
}
.command-result-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 8px;
}
.command-result-meta { line-height: 1.45; }
.command-result-output {
    margin: 10px 0 0;
    padding: 12px;
    border-radius: 10px;
    background: #0f172a;
    color: #e2e8f0;
    font-size: 12px;
    line-height: 1.5;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    max-height: 240px;
    overflow: auto;
}
.command-result-output.is-error {
    background: #450a0a;
    color: #fecaca;
}

@media (max-width: 900px) {
    .remote-mgmt-grid { grid-template-columns: 1fr; }
    .period-filter-options { justify-content: flex-start; margin-left: 0; width: 100%; }
}

.stat-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
    margin-bottom: 18px;
}
.stat-grid-5 {
    grid-template-columns: repeat(5, minmax(0, 1fr));
}
.stat-grid-6 {
    grid-template-columns: repeat(6, minmax(0, 1fr));
}
.stat-card {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 18px;
    box-shadow: var(--shadow);
}
.stat-card .label { color: var(--muted); font-size: 13px; font-weight: 600; }
.stat-card .value { font-size: 24px; font-weight: 800; margin-top: 6px; letter-spacing: -0.03em; }
.stat-card-iconed .stat-card-top {
    display: flex;
    align-items: center;
    gap: 10px;
}
.stat-card-iconed .value { margin-top: 12px; }
.stat-icon {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.stat-icon svg {
    width: 20px;
    height: 20px;
}
.stat-icon-teal {
    background: #ccfbf1;
    color: #0f766e;
    box-shadow: inset 0 0 0 1px #99f6e4;
}
.stat-icon-slate {
    background: #e2e8f0;
    color: #475569;
    box-shadow: inset 0 0 0 1px #cbd5e1;
}
.stat-icon-blue {
    background: #dbeafe;
    color: #1d4ed8;
    box-shadow: inset 0 0 0 1px #bfdbfe;
}
.stat-icon-amber {
    background: #fef3c7;
    color: #b45309;
    box-shadow: inset 0 0 0 1px #fde68a;
}
.stat-icon-violet {
    background: #ede9fe;
    color: #6d28d9;
    box-shadow: inset 0 0 0 1px #ddd6fe;
}
.stat-icon-rose {
    background: #ffe4e6;
    color: #be123c;
    box-shadow: inset 0 0 0 1px #fecdd3;
}
.stat-icon-emerald {
    background: #d1fae5;
    color: #047857;
    box-shadow: inset 0 0 0 1px #a7f3d0;
}

.dash-charts {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px;
    align-items: stretch;
}
.dash-chart-card { margin: 0; }
.dash-hero {
    display: grid;
    grid-template-columns: 200px 1fr;
    gap: 18px;
    align-items: stretch;
}
.dash-hero-score {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 22px 16px;
}
.dash-score-ring {
    position: relative;
    width: 120px;
    height: 120px;
    margin: 10px 0 8px;
}
.dash-score-value {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}
.dash-score-value strong {
    font-size: 32px;
    letter-spacing: -0.03em;
    line-height: 1;
}
.dash-score-value span {
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
}
.dash-hero-stats {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
}
.profile-hero {
    display: grid;
    grid-template-columns: 1.55fr 1fr;
    gap: 16px;
    margin-bottom: 16px;
}
.profile-identity {
    display: flex;
    gap: 18px;
    align-items: flex-start;
}
.profile-avatar {
    width: 76px;
    height: 76px;
    border-radius: 22px;
    background: linear-gradient(145deg, #0f766e, #0ea5a4);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
    font-weight: 800;
    flex-shrink: 0;
    box-shadow: 0 10px 24px rgba(15, 118, 110, 0.28);
}
.profile-meta-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px 16px;
    margin-top: 16px;
}
.insight-list {
    margin: 0;
    padding: 0;
    list-style: none;
    display: grid;
    gap: 8px;
}
.insight-list li {
    padding: 10px 12px;
    border-radius: 10px;
    background: #f7fbfa;
    border: 1px solid var(--border);
    font-size: 13px;
    line-height: 1.45;
    color: var(--text);
}
.security-pill-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}
.chart-wrap {
    position: relative;
    height: 240px;
    margin-top: 8px;
}
.chart-wrap-sm { height: 200px; }
.dash-legend {
    list-style: none;
    margin: 12px 0 0;
    padding: 0;
    display: grid;
    gap: 8px;
}
.device-status-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: stretch;
    gap: 0;
    margin-bottom: 16px;
    padding: 0;
    overflow: hidden;
}
.device-status-item {
    flex: 1 1 0;
    min-width: 120px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 6px;
    padding: 14px 16px;
    border-right: 1px solid var(--border);
}
.device-status-item:last-child {
    border-right: none;
}
.device-status-label {
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}
.device-status-item strong {
    font-size: 13px;
    font-weight: 700;
    color: var(--text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.device-status-item .badge {
    align-self: flex-start;
}
.usage-bar {
    height: 6px;
    border-radius: 999px;
    background: #e8eef0;
    overflow: hidden;
    margin-top: 10px;
}
.usage-bar span {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #0f766e, #14b8a6);
}
.usage-bar-idle span {
    background: linear-gradient(90deg, #94a3b8, #cbd5e1);
}

.schedule-panel {
    margin-top: 18px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: #fff;
    overflow: hidden;
}
.schedule-panel-head {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
    background: #f7faf9;
}
.schedule-panel-title {
    font-size: 14px;
    font-weight: 800;
    letter-spacing: -0.02em;
    margin-bottom: 2px;
}
.schedule-panel-body {
    padding: 16px;
    display: grid;
    gap: 16px;
}
.schedule-field label {
    margin-bottom: 8px;
}
.schedule-range {
    display: grid;
    grid-template-columns: 1fr 56px 1fr;
    gap: 12px;
    align-items: end;
}
.schedule-range-sep {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding-bottom: 12px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}
.schedule-range-sep span {
    width: 1px;
    height: 10px;
    background: #d0d5dd;
}
.schedule-range-sep em {
    font-style: normal;
}
.time-input-wrap {
    position: relative;
}
.input-time {
    width: 100%;
    min-height: 44px;
    padding: 11px 12px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: #fff;
    color: var(--text);
    font-family: inherit;
    font-size: 15px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.01em;
    line-height: 1.2;
    color-scheme: light;
    outline: none;
    transition: border-color .15s ease, box-shadow .15s ease;
}
.input-time:focus {
    border-color: #7bc4b8;
    box-shadow: 0 0 0 4px rgba(15, 111, 100, 0.12);
}
.input-time::-webkit-calendar-picker-indicator {
    cursor: pointer;
    opacity: 0.55;
    margin-left: 6px;
}
.input-time::-webkit-datetime-edit,
.input-time::-webkit-datetime-edit-fields-wrapper,
.input-time::-webkit-datetime-edit-hour-field,
.input-time::-webkit-datetime-edit-minute-field,
.input-time::-webkit-datetime-edit-ampm-field,
.input-time::-webkit-datetime-edit-text {
    font-family: inherit;
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
    padding: 0;
}

.off-days-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.off-day-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: #fff;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
}
.off-day-chip input {
    margin: 0;
}
.off-day-chip:has(input:checked) {
    border-color: #0f766e;
    background: #f0fdfa;
    color: #0f766e;
}

.toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}
.toolbar-left, .toolbar-right {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.empty-state {
    text-align: center;
    padding: 48px 20px;
    color: var(--muted);
}
.empty-state h3 { color: var(--text); margin-bottom: 8px; }

.row-actions {
    display: inline-flex;
    align-items: stretch;
    justify-content: flex-end;
    flex-wrap: nowrap;
    gap: 0;
    border: 1px solid var(--border);
    border-radius: 10px;
    overflow: hidden;
    background: #fff;
}
.row-actions > a,
.row-actions > button,
.row-actions > form {
    display: inline-flex;
    margin: 0;
}
.row-actions > * + * {
    border-left: 1px solid var(--border);
}



.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 18px;
}

.shot-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 14px;
    position: relative;
    z-index: 1;
}
.shot-card {
    border: 1px solid var(--border);
    border-radius: 14px;
    overflow: hidden;
    background: #fff;
    position: relative;
    z-index: 1;
}
.shot-thumb {
    display: block;
    width: 100%;
    padding: 0;
    border: 0;
    cursor: pointer;
    aspect-ratio: 16 / 10;
    background: #e8efec;
    overflow: hidden;
    position: relative;
    z-index: 2;
}
.shot-thumb img {
    pointer-events: none; /* clicks hit the button reliably */
}
.shot-thumb img,
.shot-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.shot-thumb:hover img {
    transform: scale(1.03);
    transition: transform .2s ease;
}
.shot-meta { padding: 12px; }
.shot-preview {
    border: 1px solid var(--border);
    border-radius: 14px;
    overflow: hidden;
    background: #0f172a;
}
.shot-preview img {
    width: 100%;
    height: auto;
    object-fit: contain;
    max-height: 75vh;
}

body.modal-open {
    overflow: hidden;
}
.shot-lightbox {
    position: fixed;
    inset: 0;
    z-index: 1200;
    display: flex;
    align-items: stretch;
    justify-content: center;
}
.shot-lightbox[hidden] {
    display: none !important;
}
.shot-lightbox-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.72);
}
.shot-lightbox-dialog {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    width: 100vw;
    margin: 0;
    max-height: 100vh;
    height: 100vh;
    background: #0b1220;
    border: 0;
    border-radius: 0;
    overflow: hidden;
    color: #e8eef7;
    box-shadow: none;
}
.shot-lightbox-top {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: flex-start;
    padding: 14px 16px;
    background: rgba(255,255,255,0.04);
    border-bottom: 1px solid rgba(255,255,255,0.08);
    flex-wrap: wrap;
}
.shot-lightbox-meta strong {
    display: block;
    font-size: 15px;
    margin-bottom: 4px;
}
.shot-lightbox-meta-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    font-size: 12px;
    color: #a8b3c7;
}
.shot-lightbox-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}
.shot-lightbox-actions .btn-secondary {
    background: rgba(255,255,255,0.08);
    color: #e8eef7;
    border-color: rgba(255,255,255,0.12);
}
.shot-lightbox-actions .btn-secondary:hover {
    background: rgba(255,255,255,0.14);
    color: #fff;
}
.shot-lightbox-stage {
    position: relative;
    flex: 1;
    min-height: 0;
    display: grid;
    grid-template-columns: 48px 1fr 48px;
    align-items: stretch;
    gap: 0;
}
.shot-lightbox-viewport {
    overflow: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    min-height: 420px;
}
.shot-lightbox-viewport.is-zoomed {
    align-items: flex-start;
    justify-content: flex-start;
}
.shot-lightbox-viewport img {
    max-width: 100%;
    max-height: calc(100vh - 180px);
    width: auto;
    height: auto;
    object-fit: contain;
    transform-origin: center center;
    transition: transform .15s ease;
    user-select: none;
}
.shot-lightbox-viewport.is-zoomed img {
    max-width: none;
    max-height: none;
    transform-origin: top left;
}
.shot-nav {
    border: 0;
    background: transparent;
    color: #e8eef7;
    font-size: 42px;
    line-height: 1;
    cursor: pointer;
    opacity: 0.7;
}
.shot-nav:hover:not(:disabled) {
    opacity: 1;
    background: rgba(255,255,255,0.04);
}
.shot-nav:disabled {
    opacity: 0.25;
    cursor: default;
}

@media (max-width: 720px) {
    .shot-lightbox-stage {
        grid-template-columns: 36px 1fr 36px;
    }
    .shot-lightbox-viewport {
        min-height: 280px;
        padding: 8px;
    }
}

.timeline-card-shell {
    padding-bottom: 20px;
}
.timeline-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0 0 22px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}
.timeline-legend-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 10px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: #f8fbfa;
    font-size: 12px;
    color: var(--muted);
}
.timeline-legend-item strong {
    color: var(--text);
    font-weight: 700;
}
.timeline-legend-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #98a2b3;
}
.timeline-legend-item.type-session .timeline-legend-dot { background: #12b76a; }
.timeline-legend-item.type-app .timeline-legend-dot { background: #667085; }
.timeline-legend-item.type-website .timeline-legend-dot { background: #2e90fa; }
.timeline-legend-item.type-event .timeline-legend-dot { background: #0f6f64; }
.timeline-legend-item.type-process .timeline-legend-dot { background: #7a5af8; }
.timeline-legend-item.type-screenshot .timeline-legend-dot { background: #15b79e; }
.timeline-legend-item.type-alert .timeline-legend-dot { background: #f04438; }

.timeline {
    display: flex;
    flex-direction: column;
    gap: 28px;
}
.timeline-day-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}
.timeline-day-title {
    font-size: 15px;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--text);
}

.timeline-rail {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 0;
    padding-left: 2px;
}
.timeline-rail::before {
    content: "";
    position: absolute;
    left: 86px;
    top: 8px;
    bottom: 8px;
    width: 2px;
    background: linear-gradient(180deg, #d7e2de 0%, #e8eef0 100%);
    border-radius: 2px;
}

.timeline-item {
    position: relative;
    display: grid;
    grid-template-columns: 72px 16px minmax(0, 1fr);
    gap: 0 12px;
    align-items: start;
    padding: 0 0 16px;
    border: 0;
    background: transparent;
}
.timeline-item:last-child {
    padding-bottom: 0;
}
.timeline-marker {
    grid-column: 2;
    width: 12px;
    height: 12px;
    margin-top: 8px;
    border-radius: 50%;
    border: 2px solid #fff;
    background: #98a2b3;
    box-shadow: 0 0 0 1px #d0d5dd;
    z-index: 1;
}
.timeline-item.type-session .timeline-marker { background: #12b76a; box-shadow: 0 0 0 1px #abefc6; }
.timeline-item.type-app .timeline-marker { background: #667085; box-shadow: 0 0 0 1px #d0d5dd; }
.timeline-item.type-website .timeline-marker { background: #2e90fa; box-shadow: 0 0 0 1px #b2ddff; }
.timeline-item.type-event .timeline-marker { background: #0f6f64; box-shadow: 0 0 0 1px #a6f4c5; }
.timeline-item.type-process .timeline-marker { background: #7a5af8; box-shadow: 0 0 0 1px #d9d6fe; }
.timeline-item.type-screenshot .timeline-marker { background: #15b79e; box-shadow: 0 0 0 1px #99f6e0; }
.timeline-item.type-alert .timeline-marker { background: #f04438; box-shadow: 0 0 0 1px #fecdca; }

.timeline-time {
    grid-column: 1;
    grid-row: 1;
    margin: 0;
    padding-top: 6px;
    font-size: 12px;
    font-weight: 700;
    color: var(--muted);
    text-align: right;
    line-height: 1.3;
    white-space: nowrap;
}
.timeline-body {
    grid-column: 3;
    min-width: 0;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: #fff;
}
.timeline-item.type-session .timeline-body { border-color: #bbf7d0; background: #f6fffb; }
.timeline-item.type-website .timeline-body { border-color: #b2ddff; background: #f7fbff; }
.timeline-item.type-screenshot .timeline-body { border-color: #99f6e0; background: #f3fffb; }
.timeline-item.type-alert .timeline-body { border-color: #fecdca; background: #fff8f6; }
.timeline-item.type-event .timeline-body { border-color: #a6f4c5; background: #f5fffa; }
.timeline-item.type-process .timeline-body { border-color: #d9d6fe; background: #faf9ff; }

.timeline-body-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 6px;
}
.timeline-kind {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 999px;
    background: #eef2f6;
    color: #475467;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.01em;
    text-transform: capitalize;
}
.timeline-item.type-session .timeline-kind { background: #d1fadf; color: #067647; }
.timeline-item.type-website .timeline-kind { background: #d1e9ff; color: #175cd3; }
.timeline-item.type-screenshot .timeline-kind { background: #ccfbf1; color: #0f766e; }
.timeline-item.type-alert .timeline-kind { background: #fee4e2; color: #b42318; }
.timeline-item.type-event .timeline-kind { background: #d8f3ee; color: #0f6f64; }
.timeline-item.type-process .timeline-kind { background: #ebe9fe; color: #5925dc; }
.timeline-item.type-app .timeline-kind { background: #f2f4f7; color: #344054; }

.timeline-link {
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
}
.timeline-main {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    min-width: 0;
}
.timeline-copy {
    min-width: 0;
    flex: 1;
}
.timeline-title {
    display: block;
    margin: 0 0 2px;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: -0.01em;
    color: var(--text);
    line-height: 1.35;
    overflow-wrap: anywhere;
}
.timeline-detail {
    margin: 0;
    font-size: 13px;
    line-height: 1.45;
    color: var(--muted);
    overflow-wrap: anywhere;
}
.timeline-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}
.timeline-chip {
    display: inline-flex;
    align-items: baseline;
    gap: 5px;
    padding: 3px 8px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.85);
    border: 1px solid rgba(215, 226, 222, 0.95);
    font-size: 12px;
    line-height: 1.3;
}
.timeline-chip-label {
    color: var(--muted);
    font-weight: 600;
}
.timeline-chip-value {
    color: var(--text);
    font-weight: 700;
}

@media (max-width: 960px) {
    .timeline-rail::before { left: 18px; }
    .timeline-item {
        grid-template-columns: 16px minmax(0, 1fr);
        padding-left: 12px;
    }
    .timeline-marker {
        grid-column: 1;
        grid-row: 1 / span 2;
        margin-top: 4px;
    }
    .timeline-time {
        grid-column: 2;
        grid-row: 1;
        text-align: left;
        padding-top: 0;
        margin-bottom: 4px;
    }
    .timeline-body {
        grid-column: 2;
        grid-row: 2;
    }
}

.detail-meta code {
    font-size: 12px;
    background: #f2f5f4;
    padding: 4px 8px;
    border-radius: 8px;
}

.token-box {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: #f7fbfa;
}
.token-box code {
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.04em;
    word-break: break-all;
    flex: 1;
}

.office-check-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 8px;
    margin-top: 8px;
}
.office-check {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: #fbfefe;
    cursor: pointer;
}
.office-check input { margin-top: 3px; }

/* ===== Agent release upload form ===== */
.release-upload-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) minmax(260px, 0.8fr);
    gap: 18px;
    align-items: start;
}
.release-upload-card,
.release-help-card {
    padding: 22px 22px 20px;
}
.release-upload-card .panel-header {
    margin: 0 0 18px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--border);
}
.release-field {
    margin-bottom: 18px;
}
.release-field input[type="text"],
.release-field input:not([type]),
.release-field input[name="version"],
.release-field textarea {
    width: 100%;
}
.field-desc {
    margin: 8px 0 0;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.45;
}
.field-desc code {
    font-size: 12px;
    background: #f2f6f5;
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 1px 6px;
}
.field-error {
    margin-top: 8px;
    color: var(--danger);
    font-size: 13px;
    font-weight: 600;
}
.file-drop {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 148px;
    padding: 22px 18px;
    border: 1.5px dashed #9db5ae;
    border-radius: 14px;
    background:
        linear-gradient(180deg, #f7fbfa 0%, #f3f8f6 100%);
    cursor: pointer;
    text-align: center;
    transition: border-color .15s ease, background .15s ease, box-shadow .15s ease;
}
.file-drop:hover,
.file-drop.dragover {
    border-color: var(--primary);
    background: var(--primary-soft);
    box-shadow: 0 0 0 3px rgba(15, 111, 100, 0.08);
    text-decoration: none;
}
.file-drop.has-file {
    border-style: solid;
    border-color: var(--primary);
    background: #fff;
}
.file-drop-icon {
    display: inline-flex;
    color: var(--primary);
}
.file-drop-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--text);
}
.file-drop-title code {
    font-size: 12px;
    font-weight: 700;
}
.file-drop-meta {
    font-size: 13px;
    color: var(--muted);
}
.file-drop-btn {
    margin-top: 4px;
    pointer-events: none;
}
.release-latest-check {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    padding: 14px 16px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: #f8fbfa;
    cursor: pointer;
}
.release-latest-check input {
    margin-top: 3px;
    width: 16px;
    height: 16px;
    accent-color: var(--primary);
}
.release-upload-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 8px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}
.release-help-card h3 {
    margin: 0 0 12px;
    font-size: 16px;
}
.release-help-list {
    margin: 0;
    padding: 0;
    list-style: none;
    display: grid;
    gap: 12px;
}
.release-help-list li {
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: #fbfefe;
}
.release-help-list strong {
    display: block;
    margin-bottom: 4px;
    font-size: 13px;
}
.release-help-list span {
    display: block;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.4;
}
.release-help-list code {
    font-size: 12px;
}
.release-help-callout {
    margin-top: 14px;
    padding: 14px;
    border-radius: 12px;
    background: var(--primary-soft);
    border: 1px solid #b7e0d8;
}
@media (max-width: 960px) {
    .release-upload-layout { grid-template-columns: 1fr; }
}

@media (max-width: 960px) {
    .form-grid, .stat-grid, .stat-grid-5, .app-shell, .dashboard-quick, .dash-charts, .dash-hero, .profile-hero { grid-template-columns: 1fr; }
    .dash-hero-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .profile-meta-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .device-status-bar { flex-wrap: wrap; }
    .device-status-item {
        flex: 1 1 calc(50% - 1px);
        border-bottom: 1px solid var(--border);
    }
    .device-status-item:nth-child(2n) { border-right: none; }
    .page-header {
        flex-wrap: wrap;
        align-items: flex-start;
    }
    .page-header-actions {
        width: 100%;
        justify-content: flex-end;
        margin-left: 0;
    }
    .filter-panel-form .filter-actions { margin-left: 0; width: 100%; }
}

@media (max-width: 560px) {
    .schedule-range { grid-template-columns: 1fr; gap: 10px; }
    .schedule-range-sep {
        flex-direction: row;
        padding: 0;
        gap: 10px;
    }
    .schedule-range-sep span {
        width: 24px;
        height: 1px;
    }
    .device-status-item {
        flex: 1 1 100%;
        border-right: none;
    }
    .stat-grid, .stat-grid-5 { grid-template-columns: 1fr; }
}

/* ===== Sticky app header (brand + topbar share one row) ===== */
.app-header {
    grid-column: 1 / -1;
    position: relative;
    z-index: 900;
    display: grid;
    grid-template-columns: 208px minmax(0, 1fr);
    height: 64px;
    width: 100%;
    max-width: 100vw;
    flex-shrink: 0;
}
.app-header-brand {
    display: flex;
    align-items: center;
    height: 64px;
    padding: 0 14px;
    background: linear-gradient(180deg, var(--sidebar) 0%, var(--sidebar) 100%);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    overflow: hidden;
}
.app-header-brand .logo {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    padding: 0;
    border-bottom: 0;
    min-width: 0;
}
.app-header-brand .app-logo {
    width: 34px;
    height: 34px;
    flex-basis: 34px;
    border-radius: 9px;
    padding: 3px;
}
.app-header-brand .brand-mark {
    width: 34px;
    height: 34px;
    border-radius: 9px;
    font-size: 12px;
}
.app-header-brand .logo-text {
    font-weight: 700;
    font-size: 12.5px;
    line-height: 1.2;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 140px;
}
.app-header-brand .logo-sub {
    font-size: 10px;
    color: #9db7b0;
    white-space: nowrap;
}
.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    height: 64px;
    padding: 0 28px;
    background: #fff;
    border-bottom: 1px solid var(--border);
    min-width: 0;
}
.topbar-left {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1 1 auto;
    min-width: 0;
}
.topbar-right {
    display: flex;
    align-items: center;
    gap: 8px;
}
.topbar-icon-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: 1px solid transparent;
    border-radius: 10px;
    background: transparent;
    color: #475467;
    cursor: pointer;
    transition: background .15s ease, color .15s ease;
}
.topbar-icon-btn:hover,
.topbar-icon-btn[aria-expanded="true"] {
    background: #eef4f2;
    color: var(--sidebar, #0f3d33);
}
.topbar-menu-toggle { display: none; }
.topbar-badge {
    position: absolute;
    top: -2px;
    right: 2px;
    min-width: 17px;
    height: 17px;
    padding: 0 4px;
    border-radius: 999px;
    background: var(--danger, #dc2626);
    color: #fff;
    font-size: 10px;
    font-weight: 800;
    line-height: 17px;
    text-align: center;
}
.topbar-search {
    position: relative;
    flex: 0 1 420px;
    min-width: 0;
    display: flex;
    align-items: center;
}
.topbar-search-icon {
    position: absolute;
    left: 12px;
    color: #98a2b3;
    pointer-events: none;
}
.topbar-search input {
    width: 100%;
    height: 40px;
    padding: 0 12px 0 36px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: #f7fafc;
    font: inherit;
    font-size: 14px;
    color: inherit;
    outline: none;
    transition: border-color .15s ease, background .15s ease;
}
.topbar-search input:focus {
    border-color: var(--sidebar, #0f3d33);
    background: #fff;
}
.topbar-item { position: relative; }
.topbar-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 340px;
    max-width: calc(100vw - 32px);
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: 0 18px 40px rgba(15, 23, 42, .16);
    padding: 10px;
    z-index: 950;
}
.topbar-search-results {
    left: 0;
    right: auto;
    width: 100%;
    max-height: min(420px, 70vh);
    overflow: auto;
}
.topbar-dropdown-title {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: #667085;
    padding: 6px 8px;
}
.topbar-dropdown-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 6px;
}
.topbar-link-btn {
    border: 0;
    background: transparent;
    color: var(--sidebar, #0f3d33);
    font: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 8px;
}
.topbar-link-btn:hover { background: #eef4f2; }
.topbar-dropdown-footer {
    display: block;
    text-align: center;
    padding: 9px 8px 5px;
    border-top: 1px solid var(--border);
    margin-top: 6px;
    font-size: 13px;
    font-weight: 700;
    color: var(--sidebar, #0f3d33);
    text-decoration: none;
}
.topbar-dropdown-footer:hover { text-decoration: underline; }
.quick-menu-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.quick-menu-item {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 12px;
    padding: 10px 10px;
    border-radius: 10px;
    text-decoration: none;
    color: #344054;
    font-size: 14px;
    font-weight: 600;
    transition: background .15s ease;
}
.quick-menu-item:hover {
    background: #eef4f2;
    color: var(--sidebar, #0f3d33);
    text-decoration: none;
}
.quick-menu-icon { width: 18px; height: 18px; flex: 0 0 auto; }
.topbar-notifications { width: 380px; }
.topbar-notification-list {
    max-height: 320px;
    overflow: auto;
    display: flex;
    flex-direction: column;
}
.topbar-notification {
    display: flex;
    gap: 10px;
    padding: 10px 8px;
    border-radius: 10px;
}
.topbar-notification:hover { background: #f7fafc; }
.topbar-notification-dot {
    flex: 0 0 auto;
    width: 8px;
    height: 8px;
    margin-top: 6px;
    border-radius: 50%;
    background: var(--warn, #d97706);
}
.topbar-notification-body { min-width: 0; font-size: 14px; }
.topbar-notification-who {
    font-size: 13px;
    font-weight: 600;
    color: var(--sidebar, #0f3d33);
    margin-top: 2px;
    overflow-wrap: anywhere;
}
.topbar-empty { padding: 18px 8px; text-align: center; }
.topbar-search-group + .topbar-search-group { margin-top: 4px; border-top: 1px solid var(--border); padding-top: 4px; }
.topbar-search-item {
    display: flex;
    flex-direction: column;
    gap: 1px;
    padding: 8px;
    border-radius: 8px;
    text-decoration: none;
    color: #172033;
    font-size: 14px;
}
.topbar-search-item:hover { background: #eef4f2; text-decoration: none; }
.sidebar-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, .45);
    z-index: 990;
}

/* ===== Responsive shell with off-canvas sidebar ===== */
@media (max-width: 1440px) {
    .app-shell { grid-template-columns: 188px minmax(0, 1fr); }
    .app-header { grid-template-columns: 188px minmax(0, 1fr); }
    .main-content { padding: 20px; }
    .topbar { padding: 0 16px; }
    .topbar-search { flex-basis: 260px; max-width: 360px; }
    .app-header-brand .logo-sub { display: none; }
}

/* Laptops / small desktops: off-canvas nav so tables have full width */
@media (max-width: 1280px) {
    .app-shell { grid-template-columns: 1fr; }
    .app-header { grid-template-columns: minmax(0, auto) minmax(0, 1fr); }
    .app-header-brand {
        padding: 0 12px;
        min-width: 0;
    }
    .app-header-brand .logo-sub { display: none; }
    .sidebar {
        position: fixed !important;
        top: 64px;
        left: 0;
        bottom: 0;
        width: min(288px, 86vw);
        height: calc(100vh - 64px);
        max-height: calc(100vh - 64px);
        z-index: 1000;
        overflow-y: auto;
        overflow-x: hidden;
        transform: translateX(-105%);
        transition: transform .2s ease;
        padding: 14px 12px;
        box-shadow: 12px 0 40px rgba(0,0,0,.18);
    }
    .sidebar-inner { min-height: auto; height: 100%; }
    body.sidebar-open .sidebar { transform: translateX(0); }
    body.sidebar-open { overflow: hidden; }
    .sidebar-backdrop {
        top: 64px;
        display: block;
    }
    .sidebar-backdrop[hidden] { display: none !important; }
    .topbar { padding: 0 12px; gap: 10px; }
    .topbar-menu-toggle { display: inline-flex; }
    .topbar-search { flex: 1 1 auto; max-width: none; }
    .main-content { padding: 16px; }
    .page-header { flex-wrap: wrap; }
    .page-header-actions {
        width: 100%;
        justify-content: flex-start;
        margin-left: 0;
    }
}

@media (max-width: 720px) {
    .app-header { grid-template-columns: 1fr; }
    .app-header-brand { display: none; }
    .topbar { gap: 8px; padding: 0 10px; }
    .topbar-search input {
        font-size: 13px;
        height: 38px;
    }
    .topbar-notifications,
    .topbar-dropdown {
        width: min(360px, calc(100vw - 16px));
        right: -8px;
    }
    .topbar-search-results {
        left: 0;
        right: 0;
        width: auto;
    }
    .main-content { padding: 12px; }
    .page-header {
        padding: 14px;
        gap: 12px;
    }
    .page-header-title h1 { font-size: 16px; }
    .page-header-counts {
        width: 100%;
        margin-left: 0;
    }
    .page-title-icon { width: 36px; height: 36px; flex-basis: 36px; }
}

@media (max-width: 480px) {
    .topbar-icon-btn { width: 36px; height: 36px; }
    .topbar-right { gap: 4px; }
    .card { padding: 18px 14px; }
}

/* Table pagination (shared admin UI) */
.table-pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px 16px;
    flex-wrap: wrap;
    margin-top: 16px;
    padding-top: 14px;
    border-top: 1px solid var(--border);
}
.table-pagination .pagination-meta {
    margin: 0;
}
.pagination-nav {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-left: auto;
}
.pagination-pages {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}
.pagination-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 34px;
    padding: 0 11px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: #fff;
    color: var(--text);
    font-size: 13px;
    font-weight: 700;
    font-family: inherit;
    line-height: 1;
    text-decoration: none;
    cursor: pointer;
    transition: .15s ease;
}
a.pagination-btn:hover {
    background: #f8fafc;
    text-decoration: none;
    transform: translateY(-1px);
}
.pagination-btn.is-current {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
    cursor: default;
}
.pagination-btn.is-disabled {
    opacity: .45;
    cursor: default;
    pointer-events: none;
}
.pagination-ellipsis {
    color: var(--muted);
    padding: 0 4px;
    font-weight: 700;
}
@media (max-width: 640px) {
    .table-pagination {
        flex-direction: column;
        align-items: stretch;
    }
    .pagination-nav {
        margin-left: 0;
        justify-content: space-between;
    }
}

/* ===== Shared data-table tools (search / sort / export) ===== */
.table-wrap {
    display: block;
    width: 100%;
    max-width: 100%;
    overflow: visible; /* toolbar stays put; only .table-scroll moves */
}
.table-scroll {
    position: relative;
    display: block;
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    overflow-y: hidden; /* keep vertical scroll on .main, not nested */
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
    margin: 0;
    padding: 0 0 6px;
}
.table-scroll > table.data-table,
.table-wrap > table.data-table {
    width: max-content;
    min-width: 100%;
}
.table-scroll::-webkit-scrollbar { height: 8px; }
.table-scroll::-webkit-scrollbar-thumb {
    background: #c5d3ce;
    border-radius: 999px;
}
.table-scroll::-webkit-scrollbar-track { background: #eef3f1; border-radius: 999px; }

/* Horizontal scroll hint (small / overflow tables) */
.table-scroll-hint {
    position: absolute;
    top: 8px;
    z-index: 5;
    display: none;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 999px;
    border: 1px solid rgba(15, 111, 100, 0.22);
    background: rgba(255, 255, 255, 0.96);
    color: var(--primary-dark);
    box-shadow: 0 8px 20px rgba(16, 36, 31, 0.14);
    pointer-events: none;
    opacity: 0;
    transform: scale(0.92);
    transition: opacity .18s ease, transform .18s ease, left .18s ease, right .18s ease;
}
.table-scroll.is-scrollable .table-scroll-hint {
    display: inline-flex;
    opacity: 1;
    transform: scale(1);
}
.table-scroll-hint[data-edge="start"] {
    right: 10px;
    left: auto;
}
.table-scroll-hint[data-edge="end"] {
    left: 10px;
    right: auto;
}
.table-scroll-hint[data-edge="mid"] {
    right: 10px;
    left: auto;
}
.table-scroll-hint svg {
    width: 18px;
    height: 18px;
    display: none;
}
.table-scroll-hint[data-edge="start"] [data-hint="right"],
.table-scroll-hint[data-edge="mid"] [data-hint="right"] {
    display: block;
}
.table-scroll-hint[data-edge="end"] [data-hint="left"] {
    display: block;
}
@media (min-width: 1281px) {
    /* Still show when overflow exists on large screens, but softer */
    .table-scroll.is-scrollable .table-scroll-hint {
        opacity: 0.92;
    }
}
/* Column headers travel with horizontal table scroll (same table row) */
.table-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px 18px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}
.table-toolbar-left,
.table-toolbar-right {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}
.table-export-group {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 0;
    border: 0;
    background: transparent;
}
.table-icon-btn {
    width: 34px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    border: 1px solid var(--border);
    color: var(--text);
    background: #fff;
    text-decoration: none;
    transition: .15s ease;
}
.table-icon-btn:hover {
    border-color: #9fd9cf;
    color: var(--primary-dark);
    background: var(--primary-soft);
    text-decoration: none;
    transform: translateY(-1px);
}
.table-toolbar-count {
    white-space: nowrap;
    font-size: 12.5px;
}
.table-toolbar-count strong { color: var(--text); font-weight: 800; }
.table-search {
    position: relative;
    display: inline-flex;
    align-items: center;
    width: min(100%, 420px);
    min-width: 320px;
}
.table-search-icon {
    position: absolute;
    left: 12px;
    color: var(--muted);
    pointer-events: none;
}
.table-search input {
    width: 100%;
    min-width: 0;
    padding: 10px 14px 10px 38px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: #fff;
    font: inherit;
    font-size: 13px;
    color: var(--text);
    box-shadow: 0 1px 0 rgba(16, 36, 31, 0.02);
}
.table-search input:focus {
    outline: none;
    border-color: #9fd9cf;
    box-shadow: 0 0 0 3px rgba(15, 111, 100, 0.12);
}
table.data-table thead th.is-sortable {
    cursor: pointer;
    user-select: none;
    position: relative;
    padding-right: 22px;
}
table.data-table thead th.is-sortable:hover { color: var(--primary-dark); }
table.data-table thead th.is-sortable::after {
    content: '↕';
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 10px;
    opacity: .35;
}
table.data-table thead th.sort-asc::after { content: '↑'; opacity: .9; color: var(--primary); }
table.data-table thead th.sort-desc::after { content: '↓'; opacity: .9; color: var(--primary); }
table.data-table thead th.no-sort { cursor: default; }
table.data-table thead th.no-sort::after { content: none; }
@media (max-width: 720px) {
    .table-toolbar { align-items: stretch; }
    .table-toolbar-left, .table-toolbar-right { width: 100%; }
    .table-toolbar-right { justify-content: stretch; }
    .table-search { min-width: 0; width: 100%; }
}

/* ===== Office show ===== */
.office-show {
    display: grid;
    gap: 16px;
}
.office-show-hero {
    display: grid;
    grid-template-columns: 1.55fr 1fr;
    gap: 16px;
    align-items: stretch;
}
.office-identity-card,
.office-token-card,
.office-remote-card {
    height: 100%;
}
.office-identity-body {
    flex: 1;
    min-width: 0;
}
.office-identity-title {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}
.office-identity-title h2 {
    margin: 0;
    font-size: 22px;
    letter-spacing: -0.03em;
}
.office-identity-sub {
    margin-top: 4px;
}
.office-meta-grid {
    margin-top: 18px;
}
.office-meta-item {
    min-width: 0;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: #f7fbfa;
}
.office-meta-item .muted.small {
    margin-bottom: 4px;
}
.office-meta-item strong {
    display: block;
    font-size: 14px;
    line-height: 1.35;
    word-break: break-word;
}
.office-section-header {
    align-items: flex-start;
    margin-bottom: 14px;
}
.office-section-header h2 {
    margin: 0 0 4px;
    font-size: 17px;
}
.office-token-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}
.office-token-hint {
    margin: 12px 0 0;
}
.office-stat-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    margin: 0;
}
.office-remote-badges {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
}
.office-remote-empty {
    padding: 8px 0 4px;
    display: grid;
    gap: 12px;
    justify-items: start;
}
.office-usb-actions {
    align-items: center;
}
.office-usb-status {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    width: 100%;
    margin-bottom: 4px;
}
.office-usb-hint {
    flex-basis: 100%;
    margin: 4px 0 0;
}
.stat-icon-violet {
    background: #ede9fe;
    color: #6d28d9;
    box-shadow: inset 0 0 0 1px #ddd6fe;
}
.stat-icon-rose {
    background: #ffe4e6;
    color: #be123c;
    box-shadow: inset 0 0 0 1px #fecdd3;
}
@media (max-width: 1100px) {
    .office-show-hero,
    .office-stat-grid {
        grid-template-columns: 1fr 1fr;
    }
}
@media (max-width: 720px) {
    .office-show-hero,
    .office-stat-grid,
    .office-meta-grid {
        grid-template-columns: 1fr;
    }
    .office-section-header {
        flex-direction: column;
    }
}

/* ===== Auth pages ===== */
.auth-body {
    min-height: 100vh;
    margin: 0;
    background: #0b1f1b;
}
.auth-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: minmax(320px, 1.05fr) minmax(360px, 0.95fr);
}
.auth-brand-panel {
    position: relative;
    overflow: hidden;
    color: #f4fffb;
    background:
        radial-gradient(circle at 18% 18%, rgba(45, 212, 191, 0.28), transparent 36%),
        radial-gradient(circle at 88% 12%, rgba(14, 165, 233, 0.18), transparent 32%),
        linear-gradient(165deg, #10241f 0%, #0f3d36 48%, #0b574e 100%);
    padding: 48px 56px;
    display: flex;
    align-items: stretch;
}
.auth-brand-glow {
    position: absolute;
    inset: auto -20% -30% 20%;
    height: 55%;
    background: radial-gradient(circle, rgba(255,255,255,0.12), transparent 65%);
    pointer-events: none;
}
.auth-brand-inner {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 460px;
    margin: auto 0;
    display: grid;
    gap: 28px;
}
.auth-brand-mark-wrap {
    display: flex;
    align-items: center;
}
.auth-brand-logo {
    width: auto;
    height: 64px;
    max-width: 220px;
    object-fit: contain;
    background: rgba(255,255,255,0.96);
    border-radius: 16px;
    padding: 10px 14px;
    box-shadow: 0 14px 34px rgba(0,0,0,0.22);
}
.auth-brand-mark {
    width: 72px;
    height: 72px;
    border-radius: 20px;
    display: grid;
    place-items: center;
    font-size: 26px;
    font-weight: 800;
    letter-spacing: -0.03em;
    color: #0b574e;
    background: #fff;
    box-shadow: 0 14px 34px rgba(0,0,0,0.22);
}
.auth-brand-eyebrow {
    margin: 0 0 10px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: rgba(244, 255, 251, 0.72);
}
.auth-brand-title {
    margin: 0;
    font-size: clamp(28px, 3.2vw, 40px);
    line-height: 1.1;
    letter-spacing: -0.04em;
    font-weight: 800;
}
.auth-brand-tagline {
    margin: 14px 0 0;
    font-size: 15px;
    line-height: 1.6;
    color: rgba(244, 255, 251, 0.82);
    max-width: 38ch;
}
.auth-brand-points {
    margin: 0;
    padding: 0;
    list-style: none;
    display: grid;
    gap: 10px;
}
.auth-brand-points li {
    position: relative;
    padding: 12px 14px 12px 38px;
    border-radius: 12px;
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.12);
    font-size: 14px;
    line-height: 1.45;
}
.auth-brand-points li::before {
    content: '';
    position: absolute;
    left: 14px;
    top: 50%;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    transform: translateY(-50%);
    background: #5eead4;
    box-shadow: 0 0 0 4px rgba(94, 234, 212, 0.18);
}
.auth-brand-support {
    display: grid;
    gap: 6px;
    padding-top: 8px;
    border-top: 1px solid rgba(255,255,255,0.14);
}
.auth-brand-support-label {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: rgba(244, 255, 251, 0.65);
}
.auth-brand-support a {
    color: #fff;
    font-weight: 600;
    text-decoration: none;
}
.auth-brand-support a:hover { text-decoration: underline; }
.auth-brand-location {
    color: rgba(244, 255, 251, 0.72);
    font-size: 13px;
    line-height: 1.45;
}

.auth-main {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 28px;
    min-width: 0;
    background:
        radial-gradient(circle at top right, rgba(15, 111, 100, 0.10), transparent 36%),
        linear-gradient(160deg, #eef6f3 0%, #eef3f1 48%, #e8eef8 100%);
}
.auth-card {
    width: 100%;
    max-width: min(440px, 100%);
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 20px;
    box-shadow: 0 22px 50px rgba(16, 36, 31, 0.12);
    padding: 34px 32px;
    animation: auth-card-in 420ms ease both;
}
@keyframes auth-card-in {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}
.auth-card-brand-mobile {
    display: none;
    align-items: center;
    gap: 12px;
    margin-bottom: 22px;
    padding-bottom: 18px;
    border-bottom: 1px solid var(--border);
}
.auth-mobile-logo {
    width: 48px;
    height: 48px;
    object-fit: contain;
    border-radius: 12px;
    background: #fff;
    border: 1px solid var(--border);
    padding: 4px;
}
.auth-mobile-mark {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    font-weight: 800;
    color: #fff;
    background: linear-gradient(135deg, #0f6f64, #0b574e);
}
.auth-mobile-name {
    font-weight: 800;
    letter-spacing: -0.02em;
}
.auth-card-header {
    margin-bottom: 22px;
}
.auth-card-header h2 {
    margin: 0 0 8px;
    font-size: 26px;
    letter-spacing: -0.03em;
}
.auth-card-header .muted {
    margin: 0;
    line-height: 1.5;
}
.auth-alert { margin-bottom: 16px; }
.auth-form {
    display: grid;
    gap: 16px;
}
.auth-field label {
    margin-bottom: 7px;
}
.auth-label-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 7px;
}
.auth-label-row label { margin-bottom: 0; }
.auth-inline-link {
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
}
.auth-form input[type="email"],
.auth-form input[type="password"],
.auth-form input[type="text"] {
    width: 100%;
    height: 46px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: #fbfefe;
    padding: 0 14px;
    font: inherit;
    color: var(--text);
    transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}
.auth-form input:focus {
    outline: none;
    border-color: #0f6f64;
    background: #fff;
    box-shadow: 0 0 0 4px rgba(15, 111, 100, 0.14);
}
.auth-remember {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    margin: 2px 0 4px;
    cursor: pointer;
}
.auth-remember input {
    width: 16px;
    height: 16px;
    accent-color: var(--primary);
}
.auth-submit,
.auth-secondary {
    width: 100%;
    justify-content: center;
    height: 46px;
    border-radius: 12px;
    font-weight: 700;
}
.auth-submit { margin-top: 4px; }
.auth-card-footer {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}

@media (max-width: 960px) {
    .auth-shell { grid-template-columns: 1fr; }
    .auth-brand-panel { display: none; }
    .auth-card-brand-mobile { display: flex; }
    .auth-main {
        min-height: 100vh;
        padding: 28px 16px 40px;
    }
    .auth-card { padding: 28px 22px; }
}

@media (prefers-reduced-motion: reduce) {
    .auth-card { animation: none; }
}

/* ===== Page header counts ===== */
.page-header-counts {
    display: inline-flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-left: 4px;
}
.page-count-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    line-height: 1;
    border: 1px solid transparent;
    white-space: nowrap;
}
.page-count-badge strong {
    font-size: 13px;
    font-weight: 800;
    letter-spacing: -0.02em;
}
.page-count-badge-icon {
    width: 14px;
    height: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.page-count-badge-icon svg {
    width: 14px;
    height: 14px;
}
.page-count-badge.is-online {
    background: #d1fadf;
    color: #067647;
    border-color: #a6f4c5;
}
.page-count-badge.is-offline {
    background: #eef2f6;
    color: #475467;
    border-color: #d0d5dd;
}
@media (max-width: 720px) {
    .page-header-heading {
        flex-wrap: wrap;
    }
    .page-header-counts {
        width: 100%;
        margin-left: 52px;
    }
}

/* ===== Restriction form suggestions ===== */
.restriction-form-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(280px, 0.85fr);
    gap: 16px;
    align-items: start;
}
.restriction-form-card,
.restriction-suggestions-card {
    margin: 0;
}
.restriction-suggestions-card {
    position: sticky;
    top: 88px;
}
.restriction-suggestions-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
}
.restriction-suggestions-title {
    margin: 0 0 4px;
    font-size: 17px;
}
.restriction-suggestions-meta {
    margin-bottom: 12px;
    line-height: 1.45;
}
.restriction-suggestion-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    max-height: min(62vh, 560px);
    overflow: auto;
    padding-right: 2px;
}
.restriction-tag {
    appearance: none;
    border: 1px solid var(--border);
    background: #f7fbfa;
    color: var(--text);
    border-radius: 999px;
    padding: 7px 12px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font: inherit;
    font-size: 13px;
    font-weight: 650;
    line-height: 1.2;
    transition: background .15s ease, border-color .15s ease, box-shadow .15s ease, transform .12s ease;
}
.restriction-tag:hover {
    background: #fff;
    border-color: #9fd0c7;
    box-shadow: 0 6px 16px rgba(15, 111, 100, 0.10);
    transform: translateY(-1px);
}
.restriction-tag.is-selected {
    background: var(--primary-soft);
    border-color: #7bc4b8;
    color: var(--primary-dark);
}
.restriction-tag-label {
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.restriction-tag-meta,
.restriction-tag-source {
    font-size: 11px;
    font-weight: 700;
    color: var(--muted);
}
.restriction-tag-source {
    padding: 2px 6px;
    border-radius: 999px;
    background: #eef2f6;
}
.restriction-suggestions-empty {
    padding: 18px 4px;
}
input.is-suggestion-filled,
select.is-suggestion-filled {
    border-color: #0f6f64 !important;
    box-shadow: 0 0 0 4px rgba(15, 111, 100, 0.14);
}
@media (max-width: 960px) {
    .restriction-form-layout {
        grid-template-columns: 1fr;
    }
    .restriction-suggestions-card {
        position: static;
        order: -1;
    }
}

/* ===== Global responsive foundation ===== */
*,
*::before,
*::after { box-sizing: border-box; }

html {
    overflow-x: hidden;
    max-width: 100%;
}
body {
    overflow-x: hidden;
    max-width: 100vw;
}
img, svg, video, canvas {
    max-width: 100%;
    height: auto;
}
.card,
.panel,
.stat-card,
.filter-panel,
.token-box,
.alert {
    max-width: 100%;
}
.main,
.main-content,
.page-header-title,
.page-header-heading,
.form-grid,
.card,
.table-toolbar,
.filter-panel-form {
    min-width: 0;
}

/* Prevent long unbroken strings from blowing layouts */
.main-content,
.card,
.topbar-notification-body,
.token-box code,
td, th {
    overflow-wrap: anywhere;
    word-break: break-word;
}
table.data-table td,
table.data-table th {
    word-break: normal;
    overflow-wrap: anywhere;
}

/* Forms / actions */
.actions {
    flex-wrap: wrap;
    gap: 10px;
}
.actions .btn { max-width: 100%; }
.filter-panel-form {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: flex-end;
}
.filter-field { min-width: min(100%, 180px); flex: 1 1 180px; }
.filter-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

/* Shared multi-column layouts collapse cleanly */
@media (max-width: 1200px) {
    .stat-grid-5,
    .stat-grid-6 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .office-stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .restriction-form-layout { grid-template-columns: 1fr; }
    .restriction-suggestions-card { position: static; }
}

@media (max-width: 1280px) {
    .form-grid { grid-template-columns: 1fr 1fr; }
    .dash-charts,
    .dash-hero,
    .profile-hero,
    .office-show-hero,
    .auth-shell,
    .release-upload-layout { grid-template-columns: 1fr; }
    .dashboard-quick { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .period-filter-bar,
    .device-tabs,
    .panel-header {
        flex-wrap: wrap;
    }
    .device-tabs { gap: 8px; overflow-x: auto; }
}

@media (max-width: 720px) {
    .form-grid,
    .stat-grid,
    .stat-grid-5,
    .stat-grid-6,
    .dashboard-quick,
    .dash-hero-stats,
    .profile-meta-grid,
    .office-stat-grid,
    .office-meta-grid,
    .office-show-hero { grid-template-columns: 1fr !important; }

    .page-header-actions,
    .panel-header,
    .table-toolbar,
    .table-toolbar-left,
    .table-toolbar-right,
    .table-pagination,
    .pagination-nav {
        width: 100%;
        justify-content: flex-start;
        margin-left: 0;
    }
    .table-toolbar { flex-direction: column; align-items: stretch; }
    .table-search { width: 100%; min-width: 0; }
    .row-actions {
        flex-wrap: nowrap;
        justify-content: flex-start;
    }
    .btn, .btn-sm { white-space: normal; }
    .token-box { align-items: stretch; }
    .token-box code { font-size: 12px; }
    .auth-brand-panel { display: none; }
    .auth-card-brand-mobile { display: flex; }
    .auth-main {
        min-height: 100vh;
        padding: 20px 14px 32px;
    }
    .auth-card { padding: 24px 18px; }
    .user-menu summary,
    .dropdown-item { max-width: 100%; }
}

@media (max-width: 480px) {
    .main-content { padding: 10px; }
    .page-header { border-radius: 10px; padding: 12px; }
    .stat-card .value { font-size: 24px; }
    .pagination-pages { gap: 4px; }
    .pagination-btn { min-width: 32px; height: 32px; padding: 0 8px; }
}

/* Sticky trailing actions column for wide tables */
table.data-table th.col-actions,
table.data-table td.col-actions {
    position: sticky;
    right: 0;
    background: #fff;
    z-index: 2;
    box-shadow: -8px 0 12px rgba(16, 36, 31, 0.06);
}
table.data-table tbody tr:nth-child(even) td.col-actions { background: #fbfcfc; }
table.data-table tr:hover td.col-actions { background: #f3faf7; }



/* Grouped icon row actions */
.row-action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: #fff;
    color: var(--text);
    text-decoration: none;
    cursor: pointer;
    transition: background .15s ease, color .15s ease;
}
.row-action-btn:hover {
    background: #f3faf7;
    color: var(--primary-dark);
    text-decoration: none;
}
.row-action-btn:disabled,
.row-action-btn[disabled] {
    opacity: 0.4;
    cursor: not-allowed;
}
.row-action-btn.is-primary {
    background: var(--primary);
    color: #fff;
}
.row-action-btn.is-primary:hover {
    background: var(--primary-dark);
    color: #fff;
}
.row-action-btn.is-secondary {
    background: #fff;
    color: var(--text);
}
.row-action-btn.is-danger {
    background: #fff;
    color: var(--danger);
}
.row-action-btn.is-danger:hover {
    background: #fef2f2;
    color: var(--danger);
}
.row-action-svg,
.row-action-btn .ui-icon {
    width: 14px;
    height: 14px;
    flex: 0 0 auto;
}


/* ===== Page skeletons (heavy pages soft-load) ===== */
.page-skeleton {
    display: grid;
    gap: 18px;
    animation: skel-fade-in .18s ease;
}
@keyframes skel-fade-in {
    from { opacity: .55; }
    to { opacity: 1; }
}
.skel-shimmer {
    background: linear-gradient(90deg, #e8eef0 0%, #f5f8f9 45%, #e8eef0 90%);
    background-size: 200% 100%;
    animation: skel-shimmer 1.15s ease-in-out infinite;
    border-radius: 8px;
}
@keyframes skel-shimmer {
    0% { background-position: 100% 0; }
    100% { background-position: -100% 0; }
}
.skel-line {
    height: 12px;
    border-radius: 999px;
}
.skel-line.lg { height: 18px; width: 42%; }
.skel-line.md { height: 12px; width: 68%; }
.skel-line.sm { height: 10px; width: 34%; }
.skel-line.xs { height: 8px; width: 22%; }
.skel-block {
    border: 1px solid var(--border);
    border-radius: 14px;
    background: #fff;
    box-shadow: 0 4px 14px rgba(16, 36, 31, 0.04);
    padding: 16px 18px;
}
.skel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    padding: 16px 20px;
}
.skel-header-left { display: grid; gap: 10px; flex: 1; }
.skel-header-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}
.skel-pill {
    width: 132px;
    height: 36px;
    border-radius: 10px;
}
.skel-stats {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 14px;
}
.skel-stat {
    padding: 16px;
    display: grid;
    gap: 12px;
    min-height: 92px;
}
.skel-stat .skel-line.lg { width: 48%; height: 22px; margin-top: 4px; }
.skel-charts {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}
.skel-chart-card { min-height: 280px; display: flex; flex-direction: column; gap: 14px; }
.skel-chart-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
}
.skel-chart-meta { display: grid; gap: 8px; width: 42%; }
.skel-chart-meta-right { display: grid; gap: 8px; width: 28%; justify-items: end; }
.skel-chart-plot {
    flex: 1;
    min-height: 160px;
    border-radius: 12px;
    position: relative;
    overflow: hidden;
}
.skel-chart-plot::after {
    content: "";
    position: absolute;
    left: 8%;
    right: 8%;
    bottom: 28%;
    height: 2px;
    border-radius: 999px;
    background: rgba(148, 163, 184, 0.45);
    box-shadow:
        18px -18px 0 0 rgba(148,163,184,.28),
        48px -8px 0 0 rgba(148,163,184,.22),
        86px -26px 0 0 rgba(148,163,184,.3),
        120px -12px 0 0 rgba(148,163,184,.2),
        150px -30px 0 0 rgba(148,163,184,.26);
}
.skel-detail-grid {
    display: grid;
    grid-template-columns: 1.2fr 0.8fr;
    gap: 16px;
}
.skel-table .skel-row {
    display: grid;
    grid-template-columns: 1.4fr 1fr 1fr 0.7fr 0.8fr;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid #eef2f1;
}
.skel-tabs {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 4px;
}
.skel-tab {
    width: 96px;
    height: 34px;
    border-radius: 999px;
}
body.is-page-loading #admin-page-content {
    min-height: 60vh;
}
@media (max-width: 1100px) {
    .skel-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .skel-charts, .skel-detail-grid { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
    .skel-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .skel-header { flex-wrap: wrap; }
}


/* ===== App density (views; skip tables / headers / row-actions) ===== */
:root {
    --font-size-base: 13px;
    --font-size-sm: 12px;
    --font-size-xs: 11px;
}

/* Base content reading size */
.main-content {
    font-size: var(--font-size-base);
    line-height: 1.45;
}

/* Meta text in content */
.main-content > .muted,
.main-content .card .muted,
.main-content .panel-header .muted,
.main-content .empty-state .muted,
.main-content .filter-meta,
.main-content .help,
.main-content .hint,
.main-content .field-hint {
    font-size: var(--font-size-sm);
}
.main-content .small {
    font-size: var(--font-size-xs);
}
.page-header .small,
table.data-table .small {
    font-size: 12px;
}

/* Forms */
.main-content label,
.main-content .filter-field label {
    font-size: var(--font-size-sm);
}
.main-content .filter-panel input,
.main-content .filter-panel select,
.main-content .form-grid input,
.main-content .form-grid select,
.main-content .form-grid textarea,
.main-content form:not(.row-actions form):not(table form) input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]),
.main-content form:not(.row-actions form):not(table form) select,
.main-content form:not(.row-actions form):not(table form) textarea {
    font-size: var(--font-size-base);
}

/* Cards / section titles */
.main-content .card {
    padding: 20px;
}
.main-content h2,
.main-content .panel-header h2 {
    font-size: 16px;
    letter-spacing: -0.02em;
}
.main-content h3,
.main-content .empty-state h3 {
    font-size: 14px;
}

/* KPI / stats */
.main-content .stat-card {
    padding: 14px 16px;
    border-radius: 12px;
}
.main-content .stat-card .label {
    font-size: var(--font-size-xs);
}
.main-content .stat-card .value {
    font-size: 24px;
    margin-top: 6px;
}

/* Badges outside tables */
.main-content .badge {
    font-size: 11px;
    line-height: 1.2;
}

/* Content buttons */
.main-content .btn:not(.row-action-btn) {
    font-size: 12.5px;
    padding: 8px 12px;
}
.main-content .btn-sm:not(.row-action-btn) {
    font-size: 12px;
    padding: 6px 10px;
}

/* Restore page-header actions */
.page-header .btn {
    font-size: 13px;
    padding: 9px 14px;
}
.page-header .btn-sm {
    font-size: 12.5px;
    padding: 7px 12px;
}

/* Sidebar denser */
.sidebar a.nav-link {
    font-size: 13px;
    padding: 9px 11px;
    gap: 8px;
}
.sidebar a.nav-link .nav-icon,
.sidebar .ui-icon.nav-icon {
    width: 16px;
    height: 16px;
}
.user-name { font-size: 13px; }
.user-role { font-size: 11px; }
.user-avatar {
    width: 32px;
    height: 32px;
    font-size: 12px;
}

/* Topbar utilities */
.topbar-search input { font-size: 13px; }
.topbar-icon-btn { width: 36px; height: 36px; }
.topbar-icon-btn svg { width: 17px; height: 17px; }

/* Content icons */
.main-content .quick-menu-icon,
.main-content .dropdown-icon,
.main-content .btn-lead-icon {
    width: 15px;
    height: 15px;
}

/* Tabs / secondary chrome */
.main-content .device-tabs a,
.main-content .device-tabs button,
.main-content .period-filter-bar,
.main-content .period-filter-options label {
    font-size: 12.5px;
}

/* Alerts / empty */
.main-content .alert {
    font-size: var(--font-size-base);
    padding: 12px 14px;
}
.main-content .empty-state p {
    font-size: var(--font-size-base);
}

/* Auth pages also slightly denser */
.auth-card {
    font-size: 13px;
}
.auth-card h2,
.auth-card .auth-title {
    font-size: 22px;
}
.auth-card label { font-size: 12px; }
.auth-card .muted { font-size: 12px; }


/* ===== Locked sizes: tables, page headers, row actions ===== */
.page-header-title h1 {
    font-size: 18px;
    font-weight: 700;
    line-height: 1.25;
}
.page-header .muted,
.page-header-title .muted,
.page-header-title > .muted {
    display: block;
    font-size: 12.5px;
    line-height: 1.4;
    margin-top: 0;
    color: #9aada6;
    font-weight: 500;
}
table.data-table {
    font-size: 13px;
}
table.data-table th {
    font-size: 11px;
}
table.data-table .muted,
table.data-table .small {
    font-size: 12px;
}
table.data-table .badge {
    font-size: 12px;
    line-height: 1.25;
    padding: 4px 9px;
}
table.data-table .btn,
table.data-table .btn-sm {
    font-size: 12px;
    padding: 5px 9px;
}
.table-toolbar-count {
    font-size: 12.5px;
}
.table-search input {
    font-size: 13px;
}
.row-action-btn {
    width: 28px;
    height: 28px;
}
.row-action-svg,
.row-action-btn .ui-icon {
    width: 14px;
    height: 14px;
}

/* Consistent gap under page headers */
.page-header + .filter-panel,
.page-header + .card,
.page-header + .stat-grid,
.page-header + .dash-hero,
.page-header + .alert,
.page-header + .form-grid,
.page-header + .device-tabs,
.page-header + section,
.page-header + .panel,
.page-header + .empty-state {
    margin-top: 0; /* gap comes from .page-header margin-bottom */
}

/* ===== Reports export dropdown ===== */
.export-menu {
    position: relative;
    display: inline-block;
}
.export-menu > summary {
    list-style: none;
    cursor: pointer;
    user-select: none;
}
.export-menu > summary::-webkit-details-marker { display: none; }
.export-menu-trigger {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}
.export-menu-caret {
    width: 14px;
    height: 14px;
    opacity: 0.85;
    transition: transform .15s ease;
}
.export-menu[open] .export-menu-caret {
    transform: rotate(180deg);
}
.export-menu-panel {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    z-index: 80;
    width: min(300px, calc(100vw - 24px));
    padding: 6px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: #fff;
    box-shadow: 0 18px 40px rgba(16, 36, 31, 0.16);
    display: grid;
    gap: 2px;
}
.export-menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 11px;
    border-radius: 9px;
    color: var(--text);
    text-decoration: none;
}
.export-menu-item:hover {
    background: #f3faf7;
    text-decoration: none;
    color: var(--primary-dark);
}
.export-menu-icon {
    width: 16px;
    height: 16px;
    flex: 0 0 auto;
    color: var(--primary);
}
.export-menu-label {
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-width: 0;
    line-height: 1.25;
}
.export-menu-label strong {
    font-size: 13px;
    font-weight: 750;
}
.export-menu-label .muted {
    font-size: 11px;
}


/* ===== Topbar profile menu (moved from sidebar) ===== */
.topbar-profile-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    max-width: 220px;
    height: 40px;
    padding: 4px 10px 4px 4px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: #fff;
    color: var(--text);
    cursor: pointer;
    transition: background .15s ease, border-color .15s ease, box-shadow .15s ease;
}
.topbar-profile-btn:hover,
.topbar-profile-btn[aria-expanded="true"] {
    background: #f3faf7;
    border-color: #9fd9cf;
    box-shadow: 0 0 0 3px rgba(15, 111, 100, 0.10);
}
.topbar-user-avatar,
.topbar-profile-btn .user-avatar {
    width: 30px;
    height: 30px;
    border-radius: 999px;
    font-size: 11px;
}
.topbar-user-meta {
    display: flex;
    flex-direction: column;
    min-width: 0;
    text-align: left;
    line-height: 1.2;
}
.topbar-user-meta .user-name {
    max-width: 120px;
    font-size: 12.5px;
    font-weight: 800;
    color: var(--text);
}
.topbar-user-meta .user-role {
    max-width: 120px;
    font-size: 10.5px;
    font-weight: 600;
    color: var(--muted);
}
.topbar-user-caret {
    display: inline-flex;
    margin-left: 2px;
    color: var(--muted);
}
.topbar-user-caret .caret-icon {
    width: 14px;
    height: 14px;
    transition: transform .15s ease;
}
.topbar-profile-btn[aria-expanded="true"] .topbar-user-caret .caret-icon {
    transform: rotate(180deg);
}
.topbar-profile-dropdown {
    width: min(280px, calc(100vw - 16px));
    padding: 8px;
    right: 0;
    left: auto;
}
.topbar-profile-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 10px 12px;
    margin-bottom: 4px;
    border-bottom: 1px solid var(--border);
}
.topbar-profile-card .user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    font-size: 13px;
}
.topbar-profile-card .user-name {
    max-width: 180px;
    font-size: 13.5px;
    font-weight: 800;
    color: var(--text);
}
.topbar-profile-card .user-role {
    max-width: 180px;
    font-size: 12px;
    color: var(--muted);
}
.topbar-profile-dropdown .dropdown-item {
    border-radius: 10px;
}
.topbar-profile-dropdown form {
    margin: 0;
}

/* Sidebar no longer has profile footer */
.sidebar-inner {
    min-height: 0;
}
.sidebar-nav {
    padding-bottom: 8px;
}
.sidebar-footer {
    flex: 0 0 auto;
    margin-top: auto;
    padding: 10px 10px 6px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.sidebar-footer-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}
.sidebar-footer-label {
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #7f9a93;
}
.sidebar-footer-version {
    font-size: 11px;
    font-weight: 700;
    color: #d7ebe5;
    font-variant-numeric: tabular-nums;
}
.sidebar-footer-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    font-weight: 700;
    color: #b7d4cb;
}
.sidebar-footer-status-dot {
    width: 7px;
    height: 7px;
    border-radius: 999px;
    background: #34d399;
    box-shadow: 0 0 0 3px rgba(52, 211, 153, 0.18);
    flex: 0 0 auto;
}
.sidebar-footer-status.is-maintenance .sidebar-footer-status-dot {
    background: #fbbf24;
    box-shadow: 0 0 0 3px rgba(251, 191, 36, 0.2);
}
.sidebar-footer-status.is-maintenance {
    color: #fde68a;
}

@media (max-width: 900px) {
    .topbar-user-meta {
        display: none;
    }
    .topbar-profile-btn {
        width: 40px;
        height: 40px;
        padding: 0;
        justify-content: center;
        border-radius: 12px;
        max-width: none;
    }
    .topbar-user-caret {
        display: none;
    }
}
@media (max-width: 720px) {
    .topbar-profile-dropdown {
        right: -4px;
        width: min(300px, calc(100vw - 16px));
    }
}
@media (max-width: 480px) {
    .topbar-profile-btn {
        width: 36px;
        height: 36px;
    }
    .topbar-user-avatar,
    .topbar-profile-btn .user-avatar {
        width: 28px;
        height: 28px;
    }
}

/* ===== Devices grid view ===== */
.device-grid-card {
    padding: 16px;
}
.device-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 14px;
}
.device-grid-item {
    display: flex;
    flex-direction: column;
    min-width: 0;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: #fff;
    overflow: hidden;
    text-decoration: none;
    color: inherit;
    transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease;
}
.device-grid-item:hover {
    border-color: #9fd9cf;
    box-shadow: 0 10px 24px rgba(16, 36, 31, 0.10);
    transform: translateY(-1px);
    text-decoration: none;
    color: inherit;
}
.device-grid-screen {
    position: relative;
    aspect-ratio: 16 / 10;
    background: #0f172a;
    overflow: hidden;
}
.device-grid-screen img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.device-grid-screen-empty {
    width: 100%;
    height: 100%;
    display: grid;
    place-content: center;
    gap: 6px;
    color: #94a3b8;
    font-size: 12px;
    font-weight: 600;
    text-align: center;
    background:
        linear-gradient(160deg, rgba(15,111,100,.18), transparent 50%),
        #111827;
}
.device-grid-empty-icon {
    width: 22px;
    height: 22px;
    margin: 0 auto;
    opacity: .7;
}
.device-grid-presence {
    position: absolute;
    top: 8px;
    left: 8px;
    margin: 0;
    box-shadow: 0 4px 12px rgba(0,0,0,.25);
}
.device-grid-body {
    display: grid;
    gap: 4px;
    padding: 10px 12px 12px;
}
.device-grid-title {
    font-size: 13px;
    font-weight: 800;
    letter-spacing: -0.02em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.device-grid-employee {
    font-size: 12px;
    color: var(--muted);
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.device-grid-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 10px;
    margin-top: 4px;
    font-size: 11px;
    color: var(--muted);
}
.device-grid-meta span {
    position: relative;
}
.device-grid-meta span + span::before {
    content: "•";
    margin-right: 10px;
    color: #c5d3ce;
}
@media (max-width: 1400px) {
    .device-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (max-width: 1100px) {
    .device-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 720px) {
    .device-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
}
@media (max-width: 420px) {
    .device-grid { grid-template-columns: 1fr; }
}

/* ===== Laptop table density ===== */
@media (max-width: 1366px) {
    table.data-table th,
    table.data-table td {
        padding: 8px 10px;
        font-size: 12.5px;
    }
    table.data-table th {
        font-size: 10.5px;
        letter-spacing: 0.02em;
    }
    .table-toolbar {
        gap: 10px;
        margin-bottom: 10px;
    }
    .table-search {
        min-width: 200px;
        width: min(100%, 280px);
    }
    .main-content .card {
        padding: 16px;
    }
}
@media (max-width: 1100px) {
    table.data-table th,
    table.data-table td {
        padding: 7px 8px;
    }
    .table-wrap > table.data-table {
        min-width: 640px;
    }
}


/* ===== Company profile ===== */
.company-show {
    display: grid;
    gap: 16px;
}
.company-show-hero {
    align-items: stretch;
}
.company-stat-grid {
    margin: 0;
}


/* ===== Capitalized badges, chips, pills, buttons ===== */
.badge,
.btn,
.btn-sm,
.btn-link,
.btn-primary,
.btn-secondary,
.btn-danger,
.page-count-badge,
.timeline-kind,
.pagination-btn,
.period-btn,
.topbar-link-btn,
.quick-menu-item,
.dropdown-item,
.chip,
.pill,
.table-toolbar .btn,
.filter-actions .btn {
    text-transform: capitalize;
}
/* Keep icon-only controls unchanged visually */
.btn-icon,
.icon-btn,
.table-icon-btn,
.topbar-icon-btn {
    text-transform: none;
}


/* ===== User profile ===== */
.user-show {
    display: grid;
    gap: 16px;
}
.user-show-hero {
    align-items: stretch;
}
.user-stat-grid {
    margin: 0;
}
.user-access-card {
    height: 100%;
}
.user-access-list li {
    display: grid;
    gap: 4px;
}
.user-access-list strong {
    font-size: 12px;
    letter-spacing: 0.02em;
    color: var(--muted);
}
.user-scope-banner {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    padding: 12px 14px;
    border-radius: 12px;
    background: #f7fbfa;
    border: 1px solid var(--border);
}
.user-danger-card {
    border-color: #fecaca;
}
.user-danger-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}
