/* CSS Variables - Light Theme (Default) — VV Nano Design System */
:root {
    /* Primary — Voyager Cyan (LOCKED) */
    --primary-color: #30baff;
    --primary-hover: #0ea5e9;
    --primary-light: rgba(48, 186, 255, 0.10);
    --primary-on: #ffffff;

    /* Secondary */
    --secondary-color: #94a3b8;
    --secondary-hover: #64748b;

    /* Alert */
    --danger-color: #dc2626;
    --danger-hover: #b91c1c;
    --success-color: #059669;
    --warning-color: #d97706;
    --info-color: #0ea5e9;

    /* Backgrounds */
    --background-color: #e8ecf0;
    --void-color: #f0f4f8;
    --surface-color: #ffffff;

    /* Borders */
    --border-color: rgba(48, 186, 255, 0.10);
    --border-solid: rgba(0, 0, 0, 0.08);

    /* Text */
    --text-primary: #1a1a2e;
    --text-secondary: #64748b;
    --text-muted: #cbd5e1;
    --text-disabled: #cbd5e1;

    /* Layout */
    --sidebar-width: 200px;
    --header-height: 56px;

    /* Border Radius — VV Nano scale */
    --radius-none: 0px;
    --radius-sm: 4px;
    --radius-md: 6px;
    --radius-lg: 8px;
    --radius-xl: 12px;
    --radius-modal: 16px;
    --radius-full: 9999px;

    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 10px 24px rgba(0, 0, 0, 0.10);

    /* Glass */
    --glass-bg: rgba(255, 255, 255, 0.60);
    --glass-blur: 20px;
    --glass-border: rgba(48, 186, 255, 0.10);

    /* Ghost Button */
    --ghost-bg: rgba(48, 186, 255, 0.10);
    --ghost-border: rgba(48, 186, 255, 0.25);
    --ghost-text: #0284c7;

    /* Input */
    --input-bg: rgba(0, 0, 0, 0.04);
    --input-border: rgba(0, 0, 0, 0.08);
    --input-focus: rgba(48, 186, 255, 0.30);

    /* Code */
    --code-bg: #f1f5f9;

    /* Search CTA */
    --search-btn-start: #0ea5e9;
    --search-btn-end: #0284c7;

    /* Glow */
    --glow-accent: rgba(48, 186, 255, 0.15);
    --glow-text: rgba(48, 186, 255, 0.50);

    --transition: all 0.2s ease;
}

/* CSS Variables - Dark Theme — VV Nano */
[data-theme="dark"] {
    /* Primary */
    --primary-color: #30baff;
    --primary-hover: #0ea5e9;
    --primary-light: rgba(48, 186, 255, 0.15);

    /* Alert */
    --danger-color: #ef4444;
    --danger-hover: #dc2626;
    --success-color: #10b981;
    --warning-color: #f59e0b;

    /* Backgrounds */
    --background-color: #0d1117;
    --void-color: #161b22;
    --surface-color: #1a2133;

    /* Borders */
    --border-color: rgba(48, 186, 255, 0.12);
    --border-solid: rgba(255, 255, 255, 0.08);

    /* Text */
    --text-primary: #e8ecf0;
    --text-secondary: #94a3b8;
    --text-muted: #475569;
    --text-disabled: #334155;

    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.40);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.50);
    --shadow-lg: 0 10px 24px rgba(0, 0, 0, 0.60);

    /* Glass */
    --glass-bg: rgba(26, 33, 51, 0.60);

    /* Ghost Button */
    --ghost-bg: rgba(48, 186, 255, 0.10);
    --ghost-border: rgba(48, 186, 255, 0.25);
    --ghost-text: #30baff;

    /* Input */
    --input-bg: rgba(255, 255, 255, 0.04);
    --input-border: rgba(255, 255, 255, 0.08);
    --input-focus: rgba(48, 186, 255, 0.30);

    --code-bg: #0d1117;
}

/* Reset & Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background-color: var(--background-color);
    color: var(--text-primary);
    line-height: 1.5;
}

/* App Container */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background-color: var(--glass-bg);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border-right: 1px solid var(--glass-border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
    transition: width 0.2s ease;
    box-shadow: var(--shadow-md);
}

.sidebar-header {
    padding: 16px;
    border-bottom: 1px solid var(--glass-border);
    display: flex;
    align-items: center;
    gap: 12px;
    height: var(--header-height);
}

.sidebar-toggle {
    flex-shrink: 0;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 700;
    font-size: 18px;
    color: var(--primary-color);
}

.logo .material-icons {
    font-size: 28px;
}

.logo-img {
    height: 32px;
    width: auto;
    object-fit: contain;
}

/* Logo theme switching - show dark logo in light mode */
.logo-light {
    display: block;
}

.logo-dark {
    display: none;
}

/* Show light logo in dark mode */
[data-theme="dark"] .logo-light {
    display: none;
}

[data-theme="dark"] .logo-dark {
    display: block;
}

.sidebar-nav {
    padding: 16px 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
}

/* Sidebar Footer - Theme Toggle */
.sidebar-footer {
    padding: 12px 16px;
    border-top: 1px solid var(--glass-border);
}

.theme-toggle-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 10px 14px;
    background-color: var(--ghost-bg);
    border: 1px solid var(--ghost-border);
    border-radius: var(--radius-lg);
    color: var(--ghost-text);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}

.theme-toggle-btn:hover {
    background-color: rgba(48, 186, 255, 0.18);
    color: var(--primary-color);
    border-color: var(--primary-color);
}

.theme-toggle-btn .material-icons {
    font-size: 20px;
}

.theme-toggle-btn .theme-label {
    flex: 1;
    text-align: left;
}

/* Hide text in collapsed sidebar */
@media (max-width: 1024px) {
    .sidebar-footer .theme-label {
        display: none;
    }

    .theme-toggle-btn {
        justify-content: center;
        padding: 12px;
    }
}

/* Collapsed Sidebar */
.sidebar.collapsed {
    width: 72px;
}

.sidebar.collapsed .logo {
    display: none;
}

.sidebar.collapsed .nav-label {
    display: none;
}

.sidebar.collapsed .nav-item {
    justify-content: center;
    padding: 12px;
}

.sidebar.collapsed .theme-label {
    display: none;
}

.sidebar.collapsed .theme-toggle-btn {
    justify-content: center;
    padding: 12px;
}

.sidebar.collapsed .sidebar-nav {
    padding: 16px 8px;
}

.sidebar.collapsed .sidebar-footer {
    padding: 16px 8px;
}

.sidebar.collapsed .sidebar-header {
    justify-content: center;
}

.sidebar.collapsed + .main-content {
    margin-left: 72px;
}

.main-content {
    transition: margin-left 0.2s ease;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: var(--radius-lg);
    border: 1px solid transparent;
    transition: var(--transition);
}

.nav-item:hover {
    background-color: var(--ghost-bg);
    color: var(--text-primary);
    border-color: var(--ghost-border);
}

.nav-item.active {
    background-color: var(--ghost-bg);
    color: var(--primary-color);
    border-color: var(--ghost-border);
    font-weight: 600;
}

.nav-item .material-icons {
    font-size: 20px;
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: 24px 32px;
    background-color: var(--background-color);
    min-height: 100vh;
}

/* Page */
.page {
    display: none;
}

.page.active {
    display: block;
}

/* Page Header */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}

.page-title {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-actions {
    display: flex;
    gap: 12px;
}

.back-btn {
    margin-right: 4px;
}

.header-title-group {
    display: flex;
    flex-direction: column;
}

.config-version-text {
    font-size: 13px;
    font-weight: 400;
    color: var(--text-secondary);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 500;
    border: none;
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: var(--transition);
}

.btn-primary {
    background: linear-gradient(135deg, var(--search-btn-start), var(--search-btn-end));
    color: #ffffff;
    border: none;
    box-shadow: 0 2px 8px rgba(48, 186, 255, 0.25);
}

.btn-primary:hover {
    box-shadow: 0 4px 16px rgba(48, 186, 255, 0.35);
    transform: translateY(-1px);
}

.btn-secondary {
    background-color: var(--ghost-bg);
    color: var(--ghost-text);
    border: 1px solid var(--ghost-border);
}

.btn-secondary:hover {
    background-color: rgba(48, 186, 255, 0.18);
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.btn-danger {
    background-color: var(--danger-color);
    color: white;
}

.btn-danger:hover {
    background-color: var(--danger-hover);
}

.btn-icon {
    padding: 8px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--radius-lg);
    color: var(--text-secondary);
}

.btn-icon:hover {
    background-color: var(--ghost-bg);
    border-color: var(--ghost-border);
    color: var(--primary-color);
}

.btn-link {
    background: transparent;
    color: var(--primary-color);
    padding: 8px 0;
    border: none;
}

.btn-link:hover {
    text-decoration: underline;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

/* Page Tabs */
.page-tabs {
    display: flex;
    gap: 4px;
    border-bottom: 1px solid var(--border-solid);
    margin-bottom: 24px;
}

.tab {
    padding: 12px 24px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    transition: var(--transition);
}

.tab:hover {
    color: var(--text-primary);
}

.tab.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Unified Configurations Toolbar */
.configurations-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 24px;
    padding: 16px;
    background-color: var(--surface-color);
    border-radius: var(--radius-xl);
    margin-bottom: 16px;
    border: 1px solid var(--glass-border);
    box-shadow: var(--shadow-sm);
}

.toolbar-left {
    display: flex;
    gap: 24px;
    align-items: flex-start;
}

.toolbar-right {
    display: flex;
    gap: 12px;
    align-items: flex-start;
}

/* Autocomplete Component */
.autocomplete-container {
    position: relative;
    min-width: 220px;
}

.autocomplete-field {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 6px;
    min-height: 38px;
    padding: 6px 36px 6px 8px;
    border: 1px solid var(--input-border);
    border-radius: var(--radius-lg);
    background-color: var(--input-bg);
    cursor: text;
}

.autocomplete-field:focus-within {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px var(--input-focus);
}

.autocomplete-chips-wrapper {
    display: contents;
}

.autocomplete-input {
    flex: 1;
    min-width: 80px;
    padding: 2px 0;
    border: none;
    font-size: 14px;
    background-color: transparent;
    color: var(--text-primary);
    outline: none;
}

.autocomplete-input::placeholder {
    color: var(--text-muted);
}

.autocomplete-icon {
    position: absolute;
    right: 8px;
    top: 8px;
    color: var(--text-muted);
    font-size: 20px;
    pointer-events: none;
    transition: var(--transition);
}

.autocomplete-container.open .autocomplete-icon {
    transform: rotate(180deg);
}

.autocomplete-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background-color: var(--surface-color);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-md);
    z-index: 100;
    max-height: 200px;
    overflow-y: auto;
    display: none;
    margin-top: 4px;
}

.autocomplete-container.open .autocomplete-dropdown {
    display: block;
}

.autocomplete-option {
    padding: 10px 12px;
    cursor: pointer;
    font-size: 14px;
    transition: var(--transition);
}

.autocomplete-option:hover {
    background-color: var(--background-color);
}

.autocomplete-option.selected {
    background-color: var(--primary-light);
    color: var(--primary-color);
}

.autocomplete-option.hidden {
    display: none;
}

.selected-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    font-size: 12px;
    background-color: var(--ghost-bg);
    color: var(--ghost-text);
    border: 1px solid var(--ghost-border);
    border-radius: var(--radius-full);
    white-space: nowrap;
}

.selected-chip .remove-chip {
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border-radius: 50%;
    width: 16px;
    height: 16px;
    transition: var(--transition);
}

.selected-chip .remove-chip:hover {
    background-color: var(--primary-color);
    color: white;
}

.selected-chip .remove-chip .material-icons {
    font-size: 14px;
}

/* Table Filters (legacy - kept for compatibility) */
.table-filters {
    display: flex;
    gap: 24px;
    padding: 16px;
    background-color: var(--surface-color);
    border-radius: var(--radius-lg);
    margin-bottom: 16px;
    border: 1px solid var(--glass-border);
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.filter-group label {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
    text-transform: uppercase;
}

.date-range {
    display: flex;
    align-items: center;
    gap: 8px;
}

.date-range input {
    padding: 8px 12px;
    border: 1px solid var(--input-border);
    border-radius: var(--radius-lg);
    font-size: 14px;
    color: var(--text-primary);
    background-color: var(--input-bg);
}

.date-range input::-webkit-calendar-picker-indicator {
    filter: brightness(0) saturate(100%);
    opacity: 0.8;
    cursor: pointer;
}

[data-theme="dark"] .date-range input::-webkit-calendar-picker-indicator {
    filter: brightness(0) saturate(100%) invert(1);
    opacity: 0.9;
}

.filter-group select {
    padding: 8px 12px;
    border: 1px solid var(--input-border);
    border-radius: var(--radius-lg);
    font-size: 14px;
    min-width: 150px;
    background-color: var(--input-bg);
    color: var(--text-primary);
}

/* Table Actions */
.table-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.search-box {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background-color: var(--input-bg);
    border: 1px solid var(--input-border);
    border-radius: var(--radius-full);
    width: 300px;
    transition: var(--transition);
}

.search-box:focus-within {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px var(--input-focus);
    background-color: var(--surface-color);
}

.search-box input {
    border: none;
    outline: none;
    font-size: 14px;
    background: transparent;
    color: var(--text-primary);
    width: 100%;
}

.search-box .material-icons {
    color: var(--text-muted);
    font-size: 20px;
}

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

/* Data Table */
.table-container {
    background-color: var(--surface-color);
    border-radius: var(--radius-xl);
    border: 1px solid var(--glass-border);
    overflow: visible;
    box-shadow: var(--shadow-sm);
}

#displays-tab .table-container {
    max-height: calc(100vh - 280px);
    overflow-y: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th,
.data-table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border-solid);
}

.data-table th {
    background-color: var(--background-color);
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.data-table tr:last-child td {
    border-bottom: none;
}

.data-table tr:hover td {
    background-color: var(--background-color);
}

/* Configuration ID Column */
.data-table .config-id {
    font-weight: 400;
    color: var(--text-primary);
}

/* Display Type Chips */
.display-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.display-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    font-size: 12px;
    border-radius: 20px;
    background-color: var(--background-color);
    color: var(--text-secondary);
}

.display-chip.setup {
    background-color: transparent;
    color: var(--text-primary);
    border: 1px solid var(--glass-border);
}

.display-chip.not-setup {
    background-color: var(--background-color);
    color: var(--text-muted);
    border: 1px dashed var(--glass-border);
}

.display-chip .material-icons {
    font-size: 14px;
}

.display-chip-logo {
    width: 20px;
    height: 20px;
    object-fit: contain;
    flex-shrink: 0;
    margin-right: 4px;
}

.display-chip-count {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-left: 2px;
}

.display-chip.danger {
    background-color: var(--danger-color);
    color: white;
}

.display-chip.warning {
    background-color: var(--warning-color);
    color: white;
}

/* Actions Menu */
.actions-cell {
    position: relative;
}

.overflow-btn {
    padding: 4px;
    background: transparent;
    border: none;
    cursor: pointer;
    border-radius: var(--radius-sm);
    color: var(--text-primary);
}

.overflow-btn:hover {
    background-color: var(--background-color);
}

.overflow-menu {
    position: absolute;
    right: 0;
    top: 0;
    background-color: var(--surface-color);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    min-width: 150px;
    z-index: 1000;
    display: none;
    overflow: hidden;
}

.overflow-menu.active {
    display: block;
}

.overflow-menu button {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 10px 16px;
    font-size: 14px;
    text-align: left;
    background: transparent;
    border: none;
    cursor: pointer;
    transition: var(--transition);
}

.overflow-menu button:hover {
    background-color: var(--background-color);
}

.overflow-menu button.danger {
    color: var(--danger-color);
}

/* Empty State */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 80px 40px;
    text-align: center;
    background-color: var(--surface-color);
    border-radius: var(--radius-lg);
    border: 1px solid var(--glass-border);
}

.empty-state .material-icons {
    font-size: 64px;
    color: var(--text-muted);
    margin-bottom: 16px;
}

.empty-state h3 {
    font-size: 18px;
    margin-bottom: 8px;
}

.empty-state p {
    color: var(--text-secondary);
    margin-bottom: 24px;
}

/* Settings Form */
.settings-form {
    max-width: 800px;
}

.form-section {
    background-color: var(--surface-color);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-xl);
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: var(--shadow-sm);
}

.form-section h3 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-solid);
}

.form-group {
    margin-bottom: 20px;
}

.form-group:last-child {
    margin-bottom: 0;
}

.form-group label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="password"],
.form-group input[type="date"],
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 10px 14px;
    font-size: 14px;
    background-color: var(--input-bg);
    border: 1px solid var(--input-border);
    border-radius: var(--radius-lg);
    color: var(--text-primary);
    transition: var(--transition);
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px var(--input-focus);
    background-color: var(--surface-color);
}

.form-group input[readonly] {
    background-color: var(--background-color);
    color: var(--text-secondary);
}

.form-group input[type="date"]::-webkit-calendar-picker-indicator {
    filter: brightness(0) saturate(100%);
    opacity: 0.8;
    cursor: pointer;
}

[data-theme="dark"] .form-group input[type="date"]::-webkit-calendar-picker-indicator {
    filter: brightness(0) saturate(100%) invert(1);
    opacity: 0.9;
}

/* Image Upload */
.image-upload {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.image-preview {
    width: 200px;
    height: 120px;
    background-color: var(--background-color);
    border: 2px dashed var(--glass-border);
    border-radius: var(--radius-lg);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 12px;
}

.image-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: var(--radius-lg);
}

.image-preview .material-icons {
    font-size: 32px;
    margin-bottom: 4px;
}

/* Toggle Switch */
.toggle-group {
    margin-bottom: 16px;
}

.toggle-label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
}

.toggle {
    position: relative;
    width: 48px;
    height: 26px;
}

.toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--border-solid);
    border-radius: 26px;
    transition: var(--transition);
}

.toggle-slider::before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    border-radius: 50%;
    transition: var(--transition);
}

.toggle input:checked + .toggle-slider {
    background-color: var(--primary-color);
}

.toggle input:checked + .toggle-slider::before {
    transform: translateX(22px);
}

/* Checkbox Group */
.checkbox-group {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 14px;
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary-color);
}

/* Publishing Container */
.publishing-container {
    background-color: var(--surface-color);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-xl);
    padding: 24px;
    box-shadow: var(--shadow-sm);
}

.publishing-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.publishing-header h3 {
    font-size: 18px;
    font-weight: 600;
}

/* Versions List */
.versions-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.version-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    background-color: var(--background-color);
    border-radius: var(--radius-xl);
    border: 1px solid var(--glass-border);
}

.version-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.version-name {
    font-weight: 600;
    font-size: 14px;
}

.version-meta {
    font-size: 12px;
    color: var(--text-secondary);
}

.version-status {
    display: flex;
    align-items: center;
    gap: 8px;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    font-size: 12px;
    font-weight: 500;
    border-radius: 20px;
}

.status-badge.published {
    background-color: rgba(5, 150, 105, 0.12);
    color: var(--success-color);
    border: 1px solid rgba(5, 150, 105, 0.25);
}

.status-badge.unpublished {
    background-color: var(--background-color);
    color: var(--text-secondary);
    border: 1px solid var(--border-solid);
}

.status-badge.draft {
    background-color: rgba(217, 119, 6, 0.12);
    color: var(--warning-color);
    border: 1px solid rgba(217, 119, 6, 0.25);
}

.status-badge.active {
    background-color: rgba(5, 150, 105, 0.12);
    color: var(--success-color);
    border: 1px solid rgba(5, 150, 105, 0.25);
}

.status-badge.inactive {
    background-color: var(--background-color);
    color: var(--text-secondary);
    border: 1px solid var(--border-solid);
}

/* Config Displays toolbar select */
.configurations-toolbar select {
    padding: 8px 12px;
    border: 1px solid var(--input-border);
    border-radius: var(--radius-lg);
    font-size: 14px;
    background-color: var(--input-bg);
    color: var(--text-primary);
    min-width: 140px;
}

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

/* Management Container (Apps/Widgets) */
.management-container {
    display: flex;
    gap: 24px;
    min-height: 600px;
}

.display-type-sidebar {
    width: 220px;
    flex-shrink: 0;
    background-color: var(--surface-color);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-xl);
    padding: 16px;
    box-shadow: var(--shadow-sm);
}

.display-type-sidebar h3 {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--text-secondary);
    text-transform: uppercase;
}

.display-type-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.display-type-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: var(--transition);
    border: 1px solid transparent;
}

.display-type-item:hover {
    background-color: var(--ghost-bg);
    border-color: var(--ghost-border);
}

.display-type-item.active {
    background-color: var(--ghost-bg);
    border-color: var(--ghost-border);
    color: var(--primary-color);
}

.display-type-item .type-name {
    font-weight: 500;
    font-size: 14px;
}

.display-type-logo {
    width: 30px;
    height: 30px;
    object-fit: contain;
    flex-shrink: 0;
}

.display-type-item .setup-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--text-muted);
}

.display-type-item .setup-indicator.setup {
    background-color: var(--success-color);
}

/* Display Type Expandable Sub-menu */
.display-type-item-wrapper {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.display-type-item .expand-icon {
    font-size: 18px;
    color: var(--text-secondary);
    transition: transform var(--transition);
    margin-left: auto;
}

.display-type-item.expanded .expand-icon {
    transform: rotate(180deg);
}

.display-type-item .type-info {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
}

.display-type-submenu {
    display: none;
    flex-direction: column;
    margin-left: 16px;
    margin-top: 4px;
    padding-left: 12px;
    border-left: 2px solid var(--ghost-border);
}

.display-type-submenu.visible {
    display: flex;
}

.submenu-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
    font-size: 13px;
    color: var(--text-secondary);
}

.submenu-item:hover {
    background-color: var(--background-color);
    color: var(--text-primary);
}

.submenu-item.active {
    background-color: var(--ghost-bg);
    color: var(--primary-color);
    border: 1px solid var(--ghost-border);
    font-weight: 500;
}

.submenu-item .submenu-icon {
    font-size: 16px;
    margin-right: 8px;
}

.submenu-item .submenu-label {
    display: flex;
    align-items: center;
}

/* Preview Area */
.preview-area {
    flex: 1;
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-xl);
    padding: 24px;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-sm);
    position: relative;
    overflow: hidden;
    /* Dot grid texture */
    background-color: var(--background-color);
    background-image:
        radial-gradient(circle, rgba(100, 116, 139, 0.30) 1px, transparent 1px);
    background-size: 20px 20px;
}

/* Vignette — fades grid out before reaching edges */
.preview-area::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: var(--radius-xl);
    background: radial-gradient(
        ellipse at center,
        transparent 40%,
        var(--surface-color) 100%
    );
    pointer-events: none;
    z-index: 0;
}

/* Keep all preview content above the vignette */
.preview-area > * {
    position: relative;
    z-index: 1;
}

.preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.preview-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

.orientation-btn.active {
    background-color: var(--primary-light);
    color: var(--primary-color);
}

.layout-selector {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: 16px;
}

.layout-selector label {
    font-size: 14px;
    color: var(--text-secondary);
}

/* Custom Layout Dropdown */
.layout-dropdown {
    position: relative;
}

.layout-dropdown-trigger {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    border: 1px solid var(--input-border);
    border-radius: var(--radius-lg);
    background-color: var(--input-bg);
    color: var(--text-primary);
    cursor: pointer;
    font-size: 14px;
    min-width: 200px;
    transition: border-color 0.2s, background-color 0.2s;
}

.layout-dropdown-trigger:hover {
    border-color: var(--input-focus-border);
}

.layout-dropdown.open .layout-dropdown-trigger {
    border-color: var(--input-focus-border);
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
}

.layout-dropdown-label {
    flex: 1;
    text-align: left;
    white-space: nowrap;
}

.layout-dropdown-arrow {
    font-size: 18px !important;
    color: var(--text-secondary);
    transition: transform 0.2s;
    flex-shrink: 0;
}

.layout-dropdown.open .layout-dropdown-arrow {
    transform: rotate(180deg);
}

.layout-dropdown-icon {
    display: flex;
    align-items: center;
    color: var(--primary-color);
    flex-shrink: 0;
}

.layout-dropdown-menu {
    display: none;
    background-color: var(--surface-color);
    border: 1px solid var(--glass-border);
    border-top: none;
    border-radius: 0 0 var(--radius-xl) var(--radius-xl);
    box-shadow: var(--shadow-md);
    overflow: hidden;
}

.layout-dropdown-floating {
    position: fixed;
    z-index: 9999;
}

.layout-dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    cursor: pointer;
    font-size: 14px;
    color: var(--text-primary);
    transition: var(--transition);
}

.layout-dropdown-item:hover {
    background-color: var(--background-color);
}

.layout-dropdown-item.active {
    background-color: var(--primary-light);
    color: var(--primary-color);
}

.layout-icon-svg {
    display: flex;
    align-items: center;
    color: var(--text-secondary);
    flex-shrink: 0;
}

.layout-dropdown-item.active .layout-icon-svg {
    color: var(--primary-color);
}

[data-theme="dark"] .layout-dropdown-menu {
    background-color: var(--surface-color);
    border-color: var(--glass-border);
}

[data-theme="dark"] .layout-dropdown-item:hover {
    background-color: var(--background-color);
}

[data-theme="dark"] .layout-dropdown-item.active {
    background-color: var(--primary-light);
    color: var(--primary-color);
}

.widget-actions,
.app-actions {
    display: flex;
    gap: 8px;
}

/* Device Preview */
.device-preview {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.device-frame {
    background: linear-gradient(145deg, #2c2c2e, #1c1c1e);
    border-radius: 40px;
    padding: 12px;
    box-shadow: var(--shadow-lg), inset 0 2px 4px rgba(255, 255, 255, 0.1);
    position: relative;
}

.device-frame.tablet.portrait {
    /* Aspect ratio: 884:1500 = 0.589:1 */
    width: 295px;
    height: 500px;
    background: url('Image Assets/Tablet-Portrait.png') no-repeat center center;
    background-size: 100% 100%;
    border-radius: 0;
    padding: 0;
    box-shadow: none;
}

.device-frame.tablet.landscape {
    /* Aspect ratio: 1500:884 = 1.697:1 */
    width: 500px;
    height: 295px;
    background: url('Image Assets/Tablet-Landscape.png') no-repeat center center;
    background-size: 100% 100%;
    border-radius: 0;
    padding: 0;
    box-shadow: none;
}

/* Peterbilt - portrait only (1032x1500px image) */
.device-frame.peterbilt-579.portrait {
    /* Aspect ratio: 1032:1500 = 0.688:1 */
    width: 344px;
    height: 500px;
    background: url('Image Assets/Peterbilt-579.png') no-repeat center center;
    background-size: 100% 100%;
    border-radius: 0;
    padding: 0;
    box-shadow: none;
}

/* Kenworth - landscape only (1500x640px image) */
.device-frame.kenworth-t680.landscape {
    /* Aspect ratio: 1500:640 = 2.34:1, +50% size */
    width: 760px;
    height: 324px;
    background: url('Image Assets/Kenworth-T680.png') no-repeat center center;
    background-size: 100% 100%;
    border-radius: 0;
    padding: 0;
    box-shadow: none;
}

.device-frame.phone.portrait {
    width: 280px;
    height: 560px;
}

.device-frame.phone.landscape {
    width: 560px;
    height: 280px;
}

.device-screen {
    background-color: #1c1c1e;
    border-radius: 28px;
    height: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Tablet portrait screen positioning - exact measurements from 884x1500px image */
/* Interactive area: 87px from left, 286px from top, 711px wide, 962px tall */
.device-frame.tablet.portrait .device-screen {
    position: absolute;
    top: 19.07%;      /* 286/1500 */
    left: 9.84%;      /* 87/884 */
    width: 80.43%;    /* 711/884 */
    height: 64.13%;   /* 962/1500 */
    background-color: #000000;
    border-radius: 2px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* Tablet landscape screen positioning - exact measurements from 1500x884px image */
/* Interactive area: 300px from left, 138px from top, 1048px wide, 658px tall */
.device-frame.tablet.landscape .device-screen {
    position: absolute;
    top: 15.61%;      /* 138/884 */
    left: 20%;        /* 300/1500 */
    width: 69.87%;    /* 1048/1500 */
    height: 74.43%;   /* 658/884 */
    background-color: #000000;
    border-radius: 2px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* Peterbilt screen positioning - exact measurements from 1032x1500px image */
/* Interactive area: 35px from left, 102px from top, 962px wide, 900px tall */
.device-frame.peterbilt-579.portrait .device-screen {
    position: absolute;
    top: 6.8%;        /* 102/1500 */
    left: 3.39%;      /* 35/1032 */
    width: 93.22%;    /* 962/1032 */
    height: 60%;      /* 900/1500 */
    background-color: #000000;
    border-radius: 2px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* Kenworth screen positioning - exact measurements from 1500x640px image */
/* Interactive area: 545px from left, 113px from top, 819px wide, 406px tall */
.device-frame.kenworth-t680.landscape .device-screen {
    position: absolute;
    top: 17.66%;      /* 113/640 */
    left: 36.33%;     /* 545/1500 */
    width: 54.6%;     /* 819/1500 */
    height: 63.44%;   /* 406/640 */
    background-color: #000000;
    border-radius: 2px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* Interactive area: 98px from left, 134px from top, 1212px wide, 436px tall */

/* Device preview screen content scaling */
.device-frame.tablet .device-screen .apps-grid,
.device-frame.peterbilt-579 .device-screen .apps-grid,
.device-frame.kenworth-t680 .device-screen .apps-grid {
    width: 100%;
    flex: 1;
    min-height: 0; /* Allow flex shrinking */
    box-sizing: border-box;
    overflow: hidden;
    padding: 10px;
    gap: 6px;
    align-content: space-evenly;
    justify-content: space-evenly;
    justify-items: center;
}

.device-frame.tablet .device-screen .widgets-grid,
.device-frame.peterbilt-579 .device-screen .widgets-grid,
.device-frame.kenworth-t680 .device-screen .widgets-grid {
    width: 100%;
    flex: 1;
    min-height: 0; /* Allow flex shrinking */
    box-sizing: border-box;
    overflow: hidden;
    padding: 8px;
    gap: 6px;
}

.device-frame.tablet .device-screen .pagination-dots,
.device-frame.peterbilt-579 .device-screen .pagination-dots,
.device-frame.kenworth-t680 .device-screen .pagination-dots {
    flex-shrink: 0;
    width: 100%;
    height: 28px;
    padding: 6px;
    box-sizing: border-box;
    background: rgba(0, 0, 0, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Scale app icons for device previews */
.device-frame.tablet .app-icon .icon,
.device-frame.peterbilt-579 .app-icon .icon,
.device-frame.kenworth-t680 .app-icon .icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
}

.device-frame.tablet .app-icon .icon .material-icons,
.device-frame.peterbilt-579 .app-icon .icon .material-icons,
.device-frame.kenworth-t680 .app-icon .icon .material-icons {
    font-size: 22px;
}

.device-frame.tablet .app-icon .name,
.device-frame.peterbilt-579 .app-icon .name,
.device-frame.kenworth-t680 .app-icon .name {
    font-size: 8px;
    max-width: 48px;
}

.device-frame.tablet .app-icon,
.device-frame.peterbilt-579 .app-icon,
.device-frame.kenworth-t680 .app-icon {
    gap: 3px;
}

/* Scale widgets for device previews */
.device-frame.tablet .widget-slot,
.device-frame.peterbilt-579 .widget-slot,
.device-frame.kenworth-t680 .widget-slot {
    min-height: 50px;
    border-radius: 8px;
}

.device-frame.tablet .widget-slot.filled,
.device-frame.peterbilt-579 .widget-slot.filled,
.device-frame.kenworth-t680 .widget-slot.filled {
    padding: 6px;
}

.device-frame.tablet .widget-header,
.device-frame.peterbilt-579 .widget-header,
.device-frame.kenworth-t680 .widget-header {
    font-size: 6px;
    margin-bottom: 2px;
}

.device-frame.tablet .widget-slot.filled,
.device-frame.peterbilt-579 .widget-slot.filled,
.device-frame.kenworth-t680 .widget-slot.filled {
    padding: 4px;
}

.device-frame.tablet .widget-slot.filled.custom-widget,
.device-frame.peterbilt-579 .widget-slot.filled.custom-widget,
.device-frame.kenworth-t680 .widget-slot.filled.custom-widget {
    padding: 0;
    overflow: hidden;
    border-radius: 8px;
}

.device-frame.tablet .widget-body,
.device-frame.peterbilt-579 .widget-body,
.device-frame.kenworth-t680 .widget-body {
    font-size: 7px;
}

.device-frame.tablet .widget-slot.empty .material-icons,
.device-frame.peterbilt-579 .widget-slot.empty .material-icons,
.device-frame.kenworth-t680 .widget-slot.empty .material-icons {
    font-size: 18px;
}

/* Scale pagination dots for device previews */
.device-frame.tablet .pagination-dots .dot,
.device-frame.peterbilt-579 .pagination-dots .dot,
.device-frame.kenworth-t680 .pagination-dots .dot {
    width: 5px;
    height: 5px;
}

.device-frame.tablet .pagination-dots .dot.active,
.device-frame.peterbilt-579 .pagination-dots .dot.active,
.device-frame.kenworth-t680 .pagination-dots .dot.active {
    width: 14px;
}

.device-frame.tablet .pagination-dots .add-page-btn,
.device-frame.peterbilt-579 .pagination-dots .add-page-btn,
.device-frame.kenworth-t680 .pagination-dots .add-page-btn {
    width: 16px;
    height: 16px;
}

.device-frame.tablet .pagination-dots .add-page-btn .material-icons,
.device-frame.peterbilt-579 .pagination-dots .add-page-btn .material-icons,
.device-frame.kenworth-t680 .pagination-dots .add-page-btn .material-icons {
    font-size: 12px;
}

.device-status-bar {
    display: none;
}

/* Show status bar for non-image device frames (phone, etc.) */
.device-frame.phone .device-status-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 20px;
    color: white;
    font-size: 12px;
}

.status-icons {
    display: flex;
    gap: 4px;
}

.status-icons .material-icons {
    font-size: 14px;
}

/* Apps Grid */
.apps-grid {
    flex: 1;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    padding: 16px;
    align-content: start;
}

.app-icon {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    transition: var(--transition);
}

.app-icon:hover {
    transform: scale(1.05);
}

.app-icon .icon {
    width: 56px;
    height: 56px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.app-icon .icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 14px;
}

.app-icon .icon .material-icons {
    color: white;
    font-size: 28px;
}

.app-icon .name {
    font-size: 10px;
    color: white;
    text-align: center;
    max-width: 60px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.app-icon.empty {
    opacity: 0.5;
}

.app-icon.empty .icon {
    background: rgba(255, 255, 255, 0.1);
    border: 2px dashed rgba(255, 255, 255, 0.3);
}

/* Widgets Grid */
.widgets-grid {
    flex: 1;
    display: grid;
    gap: 12px;
    padding: 16px;
    user-select: none;
    -webkit-user-select: none;
}

/* Landscape 1x2 - 2 widgets side by side */
.widgets-grid-landscape-1x2 {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr;
}

.widgets-grid-landscape-1x2 .widget-half {
    height: 100%;
}

/* Landscape 1x2x2 - 1 large left, 2 stacked right */
.widgets-grid-landscape-1x2x2 {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
}

.widgets-grid-landscape-1x2x2 .widget-large-left {
    grid-row: 1 / 3;
}

.widgets-grid-landscape-1x2x2 .widget-small-right-top {
    grid-column: 2;
    grid-row: 1;
}

.widgets-grid-landscape-1x2x2 .widget-small-right-bottom {
    grid-column: 2;
    grid-row: 2;
}

/* Landscape 2x2 - 4 equal widgets */
.widgets-grid-landscape-2x2 {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
}

/* Portrait 1x2 - 2 widgets stacked */
.widgets-grid-portrait-1x2 {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr 1fr;
}

.widgets-grid-portrait-1x2 .widget-half-vertical {
    width: 100%;
}

/* Portrait 1x2x2 - 1 large top, 2 side by side bottom */
.widgets-grid-portrait-1x2x2 {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
}

.widgets-grid-portrait-1x2x2 .widget-large-top {
    grid-column: 1 / 3;
    grid-row: 1;
}

.widgets-grid-portrait-1x2x2 .widget-small-bottom-left {
    grid-column: 1;
    grid-row: 2;
}

.widgets-grid-portrait-1x2x2 .widget-small-bottom-right {
    grid-column: 2;
    grid-row: 2;
}

/* ─────────────────────────────────────────────────────────────────────────────
   1x2x2 CUSTOM WIDGET SAFETY NET
   The "large-top" / "large-left" slot classes physically contain the word
   "large", but their actual on-screen size doesn't warrant larger font
   variants — they should stay visually identical to 1x2 and 2x2 slots.
   The JS generateWidgetContent() already avoids outputting the .large HTML
   modifier for these slots (see isLarge comment there). These CSS rules are a
   belt-and-suspenders override: any future custom widget that accidentally
   receives a .large class while sitting inside a 1x2x2 grid will be kept at
   compact sizes. Add new custom-widget large-overrides here as needed.
   ───────────────────────────────────────────────────────────────────────────── */

/* PS HOS */
.widgets-grid-portrait-1x2x2 .ps-hos-widget.large,
.widgets-grid-landscape-1x2x2 .ps-hos-widget.large {
    padding: 8px;
    gap: 6px;
}
.widgets-grid-portrait-1x2x2 .ps-hos-widget.large .ps-hos-ring-wrap,
.widgets-grid-landscape-1x2x2 .ps-hos-widget.large .ps-hos-ring-wrap { width: 60px; height: 60px; }
.widgets-grid-portrait-1x2x2 .ps-hos-widget.large .ps-hos-time,
.widgets-grid-landscape-1x2x2 .ps-hos-widget.large .ps-hos-time { font-size: 13px; }
.widgets-grid-portrait-1x2x2 .ps-hos-widget.large .ps-hos-label,
.widgets-grid-landscape-1x2x2 .ps-hos-widget.large .ps-hos-label { font-size: 5px; }
.widgets-grid-portrait-1x2x2 .ps-hos-widget.large .ps-hos-bars,
.widgets-grid-landscape-1x2x2 .ps-hos-widget.large .ps-hos-bars { gap: 5px; }
.widgets-grid-portrait-1x2x2 .ps-hos-widget.large .ps-hos-val,
.widgets-grid-landscape-1x2x2 .ps-hos-widget.large .ps-hos-val { font-size: 11px; }
.widgets-grid-portrait-1x2x2 .ps-hos-widget.large .ps-hos-lbl,
.widgets-grid-landscape-1x2x2 .ps-hos-widget.large .ps-hos-lbl { font-size: 6px; }
.widgets-grid-portrait-1x2x2 .ps-hos-widget.large .ps-hos-track,
.widgets-grid-landscape-1x2x2 .ps-hos-widget.large .ps-hos-track { height: 4px; }
.widgets-grid-portrait-1x2x2 .ps-hos-widget.large .ps-hos-dot,
.widgets-grid-landscape-1x2x2 .ps-hos-widget.large .ps-hos-dot { width: 10px; height: 10px; }

/* PS Workflow */
.widgets-grid-portrait-1x2x2 .ps-workflow-widget.large,
.widgets-grid-landscape-1x2x2 .ps-workflow-widget.large {
    padding: 8px 8px 8px 22px;
}
.widgets-grid-portrait-1x2x2 .ps-workflow-widget.large .ps-wf-track-line,
.widgets-grid-landscape-1x2x2 .ps-workflow-widget.large .ps-wf-track-line { left: 10px; width: 4px; }
.widgets-grid-portrait-1x2x2 .ps-workflow-widget.large .ps-wf-track-fill,
.widgets-grid-landscape-1x2x2 .ps-workflow-widget.large .ps-wf-track-fill { left: 10px; width: 4px; }
.widgets-grid-portrait-1x2x2 .ps-workflow-widget.large .ps-wf-task,
.widgets-grid-landscape-1x2x2 .ps-workflow-widget.large .ps-wf-task { font-size: 11px; }
.widgets-grid-portrait-1x2x2 .ps-workflow-widget.large .ps-wf-status,
.widgets-grid-landscape-1x2x2 .ps-workflow-widget.large .ps-wf-status { font-size: 7px; }

/* PS Navigation */
.widgets-grid-portrait-1x2x2 .ps-nav-widget.large .ps-nav-dir-card,
.widgets-grid-landscape-1x2x2 .ps-nav-widget.large .ps-nav-dir-card { top: 6px; left: 6px; padding: 5px 7px; border-radius: 6px; }
.widgets-grid-portrait-1x2x2 .ps-nav-widget.large .ps-nav-dist-val,
.widgets-grid-landscape-1x2x2 .ps-nav-widget.large .ps-nav-dist-val { font-size: 13px; }
.widgets-grid-portrait-1x2x2 .ps-nav-widget.large .ps-nav-road,
.widgets-grid-landscape-1x2x2 .ps-nav-widget.large .ps-nav-road { font-size: 7px; }
.widgets-grid-portrait-1x2x2 .ps-nav-widget.large .ps-nav-road-sub,
.widgets-grid-landscape-1x2x2 .ps-nav-widget.large .ps-nav-road-sub { font-size: 6px; }
.widgets-grid-portrait-1x2x2 .ps-nav-widget.large .ps-nav-eta-card,
.widgets-grid-landscape-1x2x2 .ps-nav-widget.large .ps-nav-eta-card { bottom: 6px; left: 6px; padding: 4px 7px; border-radius: 6px; }
.widgets-grid-portrait-1x2x2 .ps-nav-widget.large .ps-nav-eta-lbl,
.widgets-grid-landscape-1x2x2 .ps-nav-widget.large .ps-nav-eta-lbl { font-size: 6px; }
.widgets-grid-portrait-1x2x2 .ps-nav-widget.large .ps-nav-eta-val,
.widgets-grid-landscape-1x2x2 .ps-nav-widget.large .ps-nav-eta-val { font-size: 11px; }
.widgets-grid-portrait-1x2x2 .ps-nav-widget.large .ps-nav-arrow,
.widgets-grid-landscape-1x2x2 .ps-nav-widget.large .ps-nav-arrow { width: 24px; height: 30px; bottom: 28%; left: calc(67% - 12px); }

/* Portrait 2x2 - 4 equal widgets */
.widgets-grid-portrait-2x2 {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
}

.widget-slot {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 16px;
    min-height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.15s ease, opacity 0.15s ease, box-shadow 0.15s ease, background 0.15s ease, border-color 0.15s ease;
    border: 2px dashed rgba(255, 255, 255, 0.2);
    touch-action: none;
}

.widget-slot:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.3);
    transform: scale(1.02);
}

.widget-slot.filled:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.widget-slot.dragging {
    opacity: 0.4;
    transform: scale(0.95);
}

.widget-slot.drag-over {
    background: rgba(48, 186, 255, 0.20) !important;
    border-color: var(--primary-color) !important;
    border-style: solid !important;
    transform: scale(1.05);
    box-shadow: 0 0 20px rgba(48, 186, 255, 0.30);
}

.widget-slot.filled {
    background: #111111;
    border: 1px solid #333333;
    padding: 12px;
}

.widget-slot.filled.custom-widget {
    background: transparent;
    border-color: transparent;
    padding: 0;
    overflow: hidden;
    border-radius: 8px;
}

.widget-content.custom-widget {
    height: 100%;
}

.widget-content.custom-widget .widget-body {
    height: 100%;
    padding: 0;
}

.widget-content {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    color: white;
    overflow: hidden;
}

.widget-header {
    font-size: 9px;
    font-weight: 600;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: 4px;
    flex-shrink: 0;
}

.widget-body {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 0;
    overflow: hidden;
}

/* Rich Widget Content Base */
.widget-rich-content {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 4px;
    font-size: 10px;
}

/* Navigation Widget */
.nav-widget {
    position: relative;
    background: #111111;
    border-radius: 8px;
    overflow: hidden;
}

.nav-map-bg {
    position: absolute;
    inset: 0;
    background:
        linear-gradient(45deg, rgba(17, 17, 17, 0.9) 0%, rgba(17, 17, 17, 0.8) 100%),
        repeating-linear-gradient(0deg, transparent, transparent 8px, rgba(255,255,255,0.03) 8px, rgba(255,255,255,0.03) 9px),
        repeating-linear-gradient(90deg, transparent, transparent 8px, rgba(255,255,255,0.03) 8px, rgba(255,255,255,0.03) 9px);
}

.nav-route-line {
    position: absolute;
    top: 30%;
    left: 10%;
    right: 20%;
    height: 3px;
    background: linear-gradient(90deg, #30baff, #059669);
    border-radius: 2px;
    box-shadow: 0 0 8px rgba(48, 186, 255, 0.5);
}

.nav-route-line::before {
    content: '';
    position: absolute;
    right: -4px;
    top: -3px;
    width: 9px;
    height: 9px;
    background: #22c55e;
    border-radius: 50%;
    box-shadow: 0 0 6px rgba(34, 197, 94, 0.8);
}

.nav-overlay {
    position: relative;
    z-index: 1;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 6px;
}

.nav-turn-indicator {
    display: flex;
    align-items: center;
    gap: 4px;
    background: rgba(48, 186, 255, 0.90);
    padding: 3px 6px;
    border-radius: 4px;
    width: fit-content;
}

.nav-turn-indicator .material-icons {
    font-size: 14px;
}

.turn-distance {
    font-size: 9px;
    font-weight: 600;
}

.nav-main-info {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
}

.nav-eta, .nav-distance {
    display: flex;
    flex-direction: column;
}

.nav-eta .label, .nav-distance .label {
    font-size: 8px;
    opacity: 0.7;
    text-transform: uppercase;
}

.nav-eta .value {
    font-size: 16px;
    font-weight: 700;
    color: #22c55e;
}

.nav-distance .value {
    font-size: 14px;
    font-weight: 600;
}

.nav-next-turn {
    font-size: 8px;
    opacity: 0.8;
    text-align: center;
    padding: 2px;
}

/* Traffic Widget */
.traffic-widget {
    position: relative;
    background: #111111;
    border-radius: 8px;
    overflow: hidden;
}

.traffic-map-bg {
    position: absolute;
    inset: 0;
    background:
        linear-gradient(135deg, rgba(17, 17, 17, 0.9), rgba(17, 17, 17, 0.9)),
        repeating-linear-gradient(0deg, transparent, transparent 6px, rgba(255,255,255,0.02) 6px, rgba(255,255,255,0.02) 7px);
}

.traffic-overlay {
    position: relative;
    z-index: 1;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 6px;
    padding: 6px;
}

.traffic-status {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    border-radius: 4px;
    background: rgba(245, 158, 11, 0.2);
}

.traffic-status.light { background: rgba(34, 197, 94, 0.2); }
.traffic-status.light .material-icons, .traffic-status.light .status-text { color: #22c55e; }
.traffic-status.moderate { background: rgba(245, 158, 11, 0.2); }
.traffic-status.moderate .material-icons, .traffic-status.moderate .status-text { color: #f59e0b; }
.traffic-status.heavy { background: rgba(239, 68, 68, 0.2); }
.traffic-status.heavy .material-icons, .traffic-status.heavy .status-text { color: #ef4444; }

.traffic-status .material-icons {
    font-size: 16px;
    color: #f59e0b;
}

.status-text {
    font-weight: 600;
    color: #f59e0b;
}

.traffic-delay {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.delay-value {
    font-size: 12px;
    font-weight: 700;
    color: #f59e0b;
}

.delay-label {
    font-size: 8px;
    opacity: 0.7;
}

/* Road Conditions Widget */
.road-widget {
    background: #111111;
    border-radius: 8px;
    padding: 8px;
    gap: 8px;
}

.road-status {
    display: flex;
    align-items: center;
    gap: 4px;
}

.road-icon {
    font-size: 20px;
    color: #22c55e;
}

.road-condition {
    font-size: 14px;
    font-weight: 600;
}

.road-hazards {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.hazard-count {
    font-size: 18px;
    font-weight: 700;
}

.hazard-label {
    font-size: 8px;
    opacity: 0.7;
}

/* HOS/ELD Widget */
.hos-widget {
    background: #111111;
    border-radius: 8px;
    padding: 6px;
    gap: 4px;
    align-items: stretch;
}

.hos-status-badge {
    align-self: flex-start;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 8px;
    font-weight: 600;
    text-transform: uppercase;
}

.hos-status-badge.driving { background: #059669; color: white; }
.hos-status-badge.on-duty { background: #30baff; color: #1a1a2e; }
.hos-status-badge.sleeper { background: #8b5cf6; color: white; }
.hos-status-badge.off-duty { background: #6b7280; color: white; }

.hos-bars {
    display: flex;
    flex-direction: column;
    gap: 4px;
    width: 100%;
}

.hos-bar-row {
    display: flex;
    align-items: center;
    gap: 4px;
}

.bar-label {
    font-size: 7px;
    width: 32px;
    opacity: 0.7;
}

.bar-track {
    flex: 1;
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    overflow: hidden;
}

.bar-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.3s ease;
}

.bar-fill.drive { background: linear-gradient(90deg, #059669, #047857); }
.bar-fill.on-duty { background: linear-gradient(90deg, #30baff, #0ea5e9); }
.bar-fill.cycle { background: linear-gradient(90deg, #8b5cf6, #7c3aed); }

.bar-value {
    font-size: 8px;
    font-weight: 600;
    width: 28px;
    text-align: right;
}

/* Bypass Widget */
.bypass-widget {
    background: #111111;
    border-radius: 8px;
    padding: 8px;
    gap: 8px;
}

.bypass-status {
    display: flex;
    align-items: center;
    gap: 4px;
}

.bypass-status .material-icons {
    font-size: 18px;
    color: #22c55e;
}

.bypass-status.green .material-icons {
    color: #22c55e;
}

.bypass-status .status-text {
    font-size: 11px;
    font-weight: 600;
    color: #22c55e;
}

.bypass-stats {
    display: flex;
    gap: 12px;
}

.bypass-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.bypass-stat .stat-value {
    font-size: 14px;
    font-weight: 700;
}

.bypass-stat .stat-label {
    font-size: 7px;
    opacity: 0.7;
}

/* Drivewyze Brand Widget */
.drivewyze-brand-widget {
    position: relative;
    background: #00bc7d;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.drivewyze-brand-widget .dwz-circle {
    position: absolute;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 50%;
    pointer-events: none;
}

.drivewyze-brand-widget .dwz-circle-tl {
    width: 128px;
    height: 128px;
    top: -64px;
    left: -64px;
}

.drivewyze-brand-widget .dwz-circle-br {
    width: 160px;
    height: 160px;
    bottom: -54px;
    right: -54px;
}

.drivewyze-brand-widget .dwz-bypass-text {
    font-family: 'Inter', sans-serif;
    font-weight: 700;
    font-size: 18px;
    color: #ffffff;
    letter-spacing: 1.2px;
    text-align: center;
    position: relative;
    z-index: 1;
}

.drivewyze-brand-widget.large .dwz-bypass-text {
    font-size: 26px;
    letter-spacing: 1.6px;
}

.drivewyze-brand-widget .dwz-arrow-icon {
    width: 32px;
    height: 32px;
    position: relative;
    z-index: 1;
}

.drivewyze-brand-widget.large .dwz-arrow-icon {
    width: 44px;
    height: 44px;
}

.drivewyze-brand-widget .dwz-arrow-icon svg {
    width: 100%;
    height: 100%;
}

/* ============================================
   PS HOS Custom Widget
   Default: bars only, left-aligned, full-width tracks.
   Ring is shown only in specific device+slot contexts
   defined in the "Ring-Left Layout" section below.
   ============================================ */
.ps-hos-widget {
    background: #1c1c1e;
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 8px;
    overflow: hidden;
    border-radius: 8px;
}

/* Ring shown above bars by default — CSS below switches to row (ring-left) where needed */
.ps-hos-ring-section {
    display: flex;
    flex-shrink: 0;
    align-items: center;
    justify-content: flex-start;
}

.ps-hos-ring-wrap {
    position: relative;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.ps-hos-ring-svg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}

.ps-hos-ring-center {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1px;
}

.ps-hos-time {
    font-family: 'Roboto', 'Inter', sans-serif;
    font-size: 11px;
    font-weight: 700;
    color: #ffffff;
    line-height: 1;
    letter-spacing: -0.5px;
}

.ps-hos-label {
    font-family: 'Roboto', 'Inter', sans-serif;
    font-size: 5px;
    color: rgba(255, 255, 255, 0.6);
    text-align: center;
    letter-spacing: 0.2px;
    white-space: nowrap;
}

/* Bars section: fills remaining width, left-aligned */
.ps-hos-bars {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
    min-width: 0;
    width: 100%;
    justify-content: center;
}

.ps-hos-bar-row {
    display: flex;
    flex-direction: column;
    gap: 1px;
    width: 100%;
}

.ps-hos-bar-info {
    display: flex;
    align-items: baseline;
    gap: 3px;
    justify-content: flex-start;
}

.ps-hos-val {
    font-family: 'Roboto', 'Inter', sans-serif;
    font-size: 11px;
    font-weight: 600;
    color: #ffffff;
}

.ps-hos-lbl {
    font-family: 'Roboto', 'Inter', sans-serif;
    font-size: 6px;
    color: #bdbdbd;
    letter-spacing: 0.2px;
}

/* Track spans full width */
.ps-hos-track {
    position: relative;
    height: 4px;
    width: 100%;
    background: #333;
    border-radius: 2px;
    overflow: visible;
}

.ps-hos-fill {
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    background: linear-gradient(to left, #22c09b, rgba(34, 192, 155, 0));
    border-radius: 2px;
    pointer-events: none;
}

.ps-hos-dot {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 10px;
    height: 10px;
    background: #000;
    border: 2px solid #ffffff;
    border-radius: 50%;
    pointer-events: none;
}

/* ─────────────────────────────────────────────────────────────────────────────
   PS HOS — RING-LEFT LAYOUT
   Default: ring shown ABOVE bars (column layout), left-aligned.
   The selectors below override to ring-LEFT (row layout) for:
     • Large slot  in tablet portrait      (widget-large-top, widget-half-vertical)
     • 1x2x2/2x2 small slots in tablet landscape (widget-small-*, widget-quarter)
       — 1x2 layout (widget-half) stays ring-above for tablet landscape
     • Large slot  in Peterbilt portrait   (widget-large-top, widget-half-vertical)
     • 1x2x2/2x2 small slots in Kenworth  (widget-small-*, widget-quarter)
       — 1x2 layout (widget-half) stays ring-above for Kenworth
   ───────────────────────────────────────────────────────────────────────────── */

/* — Switch widget to row layout — */
.device-frame.tablet.portrait        .widget-large-top .ps-hos-widget,
.device-frame.tablet.portrait        .widget-half-vertical .ps-hos-widget,
.device-frame.tablet.landscape       .widget-small-right-top .ps-hos-widget,
.device-frame.tablet.landscape       .widget-small-right-bottom .ps-hos-widget,
.device-frame.tablet.landscape       .widget-quarter .ps-hos-widget,
.device-frame.peterbilt-579          .widget-large-top .ps-hos-widget,
.device-frame.peterbilt-579          .widget-half-vertical .ps-hos-widget,
.device-frame.kenworth-t680          .widget-small-right-top .ps-hos-widget,
.device-frame.kenworth-t680          .widget-small-right-bottom .ps-hos-widget,
.device-frame.kenworth-t680          .widget-quarter .ps-hos-widget {
    flex-direction: row;
    align-items: center;
    gap: 6px;
}

/* — Larger ring for wide full-width portrait slots — */
.device-frame.tablet.portrait   .widget-large-top .ps-hos-ring-wrap,
.device-frame.tablet.portrait   .widget-half-vertical .ps-hos-ring-wrap,
.device-frame.peterbilt-579     .widget-large-top .ps-hos-ring-wrap,
.device-frame.peterbilt-579     .widget-half-vertical .ps-hos-ring-wrap {
    width: 60px;
    height: 60px;
}

/* ============================================
   PS Workflow Custom Widget
   ============================================ */
.ps-workflow-widget {
    background: #1c1c1e;
    position: relative;
    display: flex;
    align-items: stretch;
    padding: 8px 8px 8px 22px;
    overflow: hidden;
    border-radius: 8px;
}

.ps-workflow-widget.large {
    padding: 12px 12px 12px 32px;
}

.ps-wf-track-line {
    position: absolute;
    left: 10px;
    top: 0;
    bottom: 0;
    width: 4px;
    background: #333;
    border-radius: 2px;
}

.ps-workflow-widget.large .ps-wf-track-line {
    left: 14px;
    width: 6px;
}

.ps-wf-track-fill {
    position: absolute;
    left: 10px;
    top: 0;
    height: 55%;
    width: 4px;
    background: linear-gradient(to bottom, #dc6bff, rgba(220, 107, 255, 0));
    border-radius: 2px;
    pointer-events: none;
}

.ps-workflow-widget.large .ps-wf-track-fill {
    left: 14px;
    width: 6px;
}

.ps-wf-items {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    flex: 1;
    gap: 0;
}

.ps-wf-item {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    position: relative;
}

.ps-wf-indicator {
    flex-shrink: 0;
    width: 14px;
    height: 14px;
    background: #000;
    border: 2px solid #ffffff;
    border-radius: 3px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 1px;
}

.ps-wf-item.next .ps-wf-indicator {
    border-radius: 50%;
    border-color: #bdbdbd;
    width: 12px;
    height: 12px;
}

.ps-wf-indicator-inner {
    width: 8px;
    height: 8px;
    background: #dc6bff;
    border-radius: 1px;
}

.ps-wf-item-info {
    display: flex;
    flex-direction: column;
    gap: 1px;
    overflow: hidden;
    flex: 1;
}

.ps-wf-task {
    font-family: 'Roboto', 'Inter', sans-serif;
    font-size: 11px;
    font-weight: 600;
    color: #ffffff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ps-workflow-widget.large .ps-wf-task {
    font-size: 18px;
}

.ps-wf-item.next .ps-wf-task {
    color: #bdbdbd;
    font-weight: 400;
}

.ps-wf-status {
    font-family: 'Roboto', 'Inter', sans-serif;
    font-size: 7px;
    color: rgba(255, 255, 255, 0.65);
    white-space: nowrap;
}

.ps-workflow-widget.large .ps-wf-status {
    font-size: 11px;
}

.ps-wf-item.next .ps-wf-status {
    color: rgba(189, 189, 189, 0.7);
}

/* ============================================
   PS Navigation Custom Widget
   ============================================ */
.ps-nav-widget {
    position: relative;
    background: #111;
    overflow: hidden;
    border-radius: 8px;
    width: 100%;
    height: 100%;
}

.ps-nav-map {
    position: absolute;
    inset: 0;
    background-image: url('Map Images/Map Dark.png');
    background-size: cover;
    background-position: center;
    border-radius: 8px;
}

.ps-nav-route-line {
    position: absolute;
    left: 67%;
    top: 0;
    bottom: 0;
    width: 3px;
    background: #0084ff;
    box-shadow: 0 0 8px rgba(0, 132, 255, 0.8);
    z-index: 2;
}

.ps-nav-arrow {
    position: absolute;
    left: calc(67% - 12px);
    bottom: 28%;
    width: 24px;
    height: 30px;
    z-index: 3;
    filter: drop-shadow(0 0 4px rgba(255, 255, 255, 0.6));
}

.ps-nav-widget.large .ps-nav-arrow {
    width: 32px;
    height: 40px;
    bottom: 26%;
    left: calc(67% - 16px);
}

.ps-nav-arrow svg {
    width: 100%;
    height: 100%;
}

.ps-nav-dir-card {
    position: absolute;
    top: 6px;
    left: 6px;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid #444;
    border-radius: 6px;
    padding: 5px 7px;
    z-index: 4;
    max-width: 55%;
}

.ps-nav-widget.large .ps-nav-dir-card {
    top: 10px;
    left: 10px;
    padding: 8px 12px;
    border-radius: 8px;
}

.ps-nav-dist-val {
    font-family: 'Roboto', 'Inter', sans-serif;
    font-size: 13px;
    font-weight: 700;
    color: #ffffff;
    line-height: 1;
    white-space: nowrap;
}

.ps-nav-widget.large .ps-nav-dist-val {
    font-size: 22px;
}

.ps-nav-road {
    font-family: 'Roboto', 'Inter', sans-serif;
    font-size: 7px;
    font-weight: 600;
    color: #ffffff;
    white-space: nowrap;
    margin-top: 2px;
}

.ps-nav-widget.large .ps-nav-road {
    font-size: 11px;
}

.ps-nav-road-sub {
    font-family: 'Roboto', 'Inter', sans-serif;
    font-size: 6px;
    color: #bdbdbd;
    white-space: nowrap;
}

.ps-nav-widget.large .ps-nav-road-sub {
    font-size: 9px;
}

.ps-nav-eta-card {
    position: absolute;
    bottom: 6px;
    left: 6px;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid #444;
    border-radius: 6px;
    padding: 4px 7px;
    z-index: 4;
}

.ps-nav-widget.large .ps-nav-eta-card {
    bottom: 10px;
    left: 10px;
    padding: 6px 12px;
    border-radius: 8px;
}

.ps-nav-eta-lbl {
    font-family: 'Roboto', 'Inter', sans-serif;
    font-size: 6px;
    color: #bdbdbd;
    line-height: 1;
}

.ps-nav-widget.large .ps-nav-eta-lbl {
    font-size: 9px;
}

.ps-nav-eta-val {
    font-family: 'Roboto', 'Inter', sans-serif;
    font-size: 11px;
    font-weight: 600;
    color: #ffffff;
    line-height: 1.1;
    white-space: nowrap;
}

.ps-nav-widget.large .ps-nav-eta-val {
    font-size: 18px;
}

/* ============================================
   Eleos Custom Widget
   ============================================ */
.eleos-widget {
    background: #1d293d;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    overflow: hidden;
    border-radius: 8px;
    width: 100%;
    height: 100%;
}

.eleos-header {
    background: #155dfc;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 8px;
    height: 28px;
    flex-shrink: 0;
    width: 100%;
}

.eleos-header-left {
    display: flex;
    align-items: center;
    gap: 4px;
}

.eleos-clock-icon {
    width: 12px;
    height: 12px;
    flex-shrink: 0;
}

.eleos-rest-text {
    font-family: 'Inter', sans-serif;
    font-size: 9px;
    font-weight: 500;
    color: #ffffff;
    white-space: nowrap;
}

.eleos-avatar {
    background: #1447e6;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Inter', sans-serif;
    font-size: 7px;
    font-weight: 600;
    color: #ffffff;
    flex-shrink: 0;
}

.eleos-map-area {
    flex: 1;
    min-height: 0;
    position: relative;
    overflow: hidden;
}

.eleos-map-bg {
    position: absolute;
    inset: 0;
    background-image: url('Map Images/Map Dark.png');
    background-size: cover;
    background-position: center;
}

.eleos-route-svg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}

.eleos-map-dot {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #ffa500;
    box-shadow: 0 0 0 5px rgba(255, 165, 0, 0.35), 0 0 0 10px rgba(255, 165, 0, 0.15);
    z-index: 2;
}

.eleos-footer {
    background: linear-gradient(to right, #312c85, #59168b);
    padding: 5px 8px 6px;
    flex-shrink: 0;
}

.eleos-trip-meta {
    display: flex;
    align-items: baseline;
    gap: 3px;
    flex-wrap: nowrap;
    overflow: hidden;
    margin-bottom: 2px;
}

.eleos-lbl {
    font-family: 'Inter', sans-serif;
    font-size: 5px;
    font-weight: 500;
    color: #dab2ff;
    white-space: nowrap;
    letter-spacing: 0.2px;
}

.eleos-val {
    font-family: 'Inter', sans-serif;
    font-size: 7px;
    font-weight: 600;
    color: #ffffff;
    white-space: nowrap;
}

.eleos-truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 80px;
}

.eleos-trip-dist {
    display: flex;
    align-items: baseline;
    gap: 4px;
}

.eleos-dist {
    font-family: 'Inter', sans-serif;
    font-size: 9px;
    font-weight: 700;
    color: #ffffff;
    white-space: nowrap;
}

.eleos-traffic {
    font-family: 'Inter', sans-serif;
    font-size: 7px;
    font-weight: 400;
    color: #fdc700;
    white-space: nowrap;
}

/* ============================================
   Geotab Custom Widget
   ============================================ */
.geotab-widget {
    background: #0f172b;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    padding: 8px 8px 6px 8px;
    overflow: hidden;
    border-radius: 8px;
    gap: 5px;
    width: 100%;
    height: 100%;
}

.geotab-title {
    font-family: 'Inter', sans-serif;
    font-size: 8px;
    font-weight: 600;
    color: #ffffff;
    padding-bottom: 4px;
    border-bottom: 1px solid #314158;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex-shrink: 0;
}

.geotab-rows {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    justify-content: space-around;
}

.geotab-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 3px;
    border-bottom: 1px solid rgba(49, 65, 88, 0.5);
    flex-shrink: 0;
}

.geotab-row-last {
    border-bottom: none;
    padding-bottom: 0;
}

.geotab-row-left {
    display: flex;
    align-items: center;
    gap: 4px;
}

.geotab-row-left svg {
    width: 10px;
    height: 10px;
    flex-shrink: 0;
}

.geotab-row-left span {
    font-family: 'Inter', sans-serif;
    font-size: 7px;
    color: #cad5e2;
    white-space: nowrap;
}

.geotab-val {
    font-family: 'Inter', sans-serif;
    font-size: 9px;
    font-weight: 600;
    color: #ffffff;
    white-space: nowrap;
}

.geotab-buttons {
    flex-shrink: 0;
}

.geotab-btn-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
    gap: 4px;
}

.geotab-btn {
    background: #1d293d;
    border: 2px solid #45556c;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Inter', sans-serif;
    font-size: 8px;
    font-weight: 700;
    color: #ffffff;
    height: 22px;
}

.geotab-btn-active {
    background: #314158;
    border-color: #00c950;
}

/* Hide status buttons in small slots — only shown in larger widget slots */
.widget-quarter .geotab-buttons,
.widget-small-right-top .geotab-buttons,
.widget-small-right-bottom .geotab-buttons,
.widget-small-bottom-left .geotab-buttons,
.widget-small-bottom-right .geotab-buttons {
    display: none;
}

/* ============================================
   HEREmaps Custom Widget
   ============================================ */
.heremaps-widget {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    overflow: hidden;
    border-radius: 8px;
    position: relative;
    width: 100%;
    height: 100%;
}

.heremaps-map-bg {
    position: absolute;
    inset: 0;
    background-image: url('Map Images/Map Dark.png');
    background-size: cover;
    background-position: center;
}

.heremaps-header {
    background: #00a63e;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding: 6px 8px;
    flex-shrink: 0;
    position: relative;
    z-index: 2;
}

.heremaps-header-left {
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.heremaps-nav-row {
    display: flex;
    align-items: center;
    gap: 4px;
}

.heremaps-street {
    font-family: 'Inter', sans-serif;
    font-size: 10px;
    font-weight: 700;
    color: #ffffff;
    white-space: nowrap;
}

.heremaps-dist {
    font-family: 'Inter', sans-serif;
    font-size: 8px;
    color: #ffffff;
    white-space: nowrap;
}

.heremaps-header-actions {
    display: flex;
    gap: 4px;
    align-items: center;
}

.heremaps-action-btn {
    width: 20px;
    height: 20px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.heremaps-time-bar {
    background: #008236;
    font-family: 'Inter', sans-serif;
    font-size: 7px;
    color: #ffffff;
    padding: 2px 8px;
    flex-shrink: 0;
    position: relative;
    z-index: 2;
}

.heremaps-map-area {
    flex: 1;
    min-height: 0;
    position: relative;
    z-index: 1;
}

.heremaps-info {
    background: #0f172b;
    border-top: 1px solid #314158;
    padding: 4px 8px;
    flex-shrink: 0;
    position: relative;
    z-index: 2;
}

.heremaps-status-row {
    font-family: 'Inter', sans-serif;
    font-size: 6px;
    color: #cad5e2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.heremaps-status-row strong {
    color: #ffffff;
    font-weight: 600;
}

.heremaps-times-row {
    font-family: 'Inter', sans-serif;
    font-size: 7px;
    font-weight: 600;
    color: #ffffff;
    white-space: nowrap;
}

.heremaps-drive-time {
    color: #05df72;
}

.heremaps-work-time {
    color: #51a2ff;
}

.heremaps-next-street {
    background: #00a63e;
    font-family: 'Inter', sans-serif;
    font-size: 8px;
    font-weight: 700;
    color: #ffffff;
    padding: 3px 8px;
    flex-shrink: 0;
    position: relative;
    z-index: 2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ================================================
   PrePass Custom Widget
   ================================================ */
.prepass-custom-widget {
    background: #1d293d;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    overflow: hidden;
    border-radius: 8px;
    width: 100%;
    height: 100%;
}

.prepass-main {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    padding: 8px 8px 4px;
    position: relative;
}

.prepass-bypass-text {
    font-family: 'Inter', sans-serif;
    font-size: 20px;
    font-weight: 900;
    color: #00d3f3;
    letter-spacing: 1px;
    line-height: 1;
    flex-shrink: 0;
}

.prepass-subtitle {
    font-family: 'Inter', sans-serif;
    font-size: 7px;
    font-weight: 600;
    color: #00d3f3;
    letter-spacing: 0.5px;
    flex-shrink: 0;
}

.prepass-circle-wrap {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 1;
    min-height: 0;
    width: 100%;
}

.prepass-ring {
    position: absolute;
    border-radius: 50%;
    border: 1.5px solid #00d3f3;
    pointer-events: none;
}

.prepass-ring-1 { width: 60px; height: 60px; opacity: 0.6; }
.prepass-ring-2 { width: 72px; height: 72px; opacity: 0.4; }
.prepass-ring-3 { width: 84px; height: 84px; opacity: 0.2; }

.prepass-green-circle {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: linear-gradient(135deg, #00c950 0%, #00a63e 100%);
    border: 3px solid #008236;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.25);
    display: flex;
    align-items: flex-start;
    justify-content: flex-start;
    padding: 4px;
    box-sizing: border-box;
    position: relative;
    z-index: 2;
}

.prepass-green-inner {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: linear-gradient(135deg, #05df72 0%, #00c950 100%);
}

/* Hide circle graphic on smaller widget slots */
.widget-half .prepass-circle-wrap,
.widget-quarter .prepass-circle-wrap,
.widget-small-right-top .prepass-circle-wrap,
.widget-small-right-bottom .prepass-circle-wrap,
.widget-small-bottom-left .prepass-circle-wrap,
.widget-small-bottom-right .prepass-circle-wrap {
    display: none;
}

.prepass-footer {
    background: #00a63e;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 5px 10px;
    flex-shrink: 0;
}

.prepass-footer-info {
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.prepass-station {
    font-family: 'Inter', sans-serif;
    font-size: 9px;
    font-weight: 600;
    color: #ffffff;
}

.prepass-distance {
    font-family: 'Inter', sans-serif;
    font-size: 7.5px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.85);
}

.prepass-footer-arrow {
    width: 18px;
    height: 18px;
    opacity: 0.5;
    flex-shrink: 0;
}

/* ================================================
   PS DVIR Custom Widget
   ================================================ */
.ps-dvir-custom-widget {
    background: #18181b;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    overflow: hidden;
    border-radius: 8px;
    width: 100%;
    height: 100%;
    padding: 8px;
    box-sizing: border-box;
    gap: 6px;
}

.dvir-cust-header {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.dvir-cust-icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.dvir-cust-title-group {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.dvir-cust-title {
    font-family: 'Inter', sans-serif;
    font-size: 11px;
    font-weight: 600;
    color: #f3f4f6;
    line-height: 1.2;
}

.dvir-cust-vehicle {
    font-family: 'Inter', sans-serif;
    font-size: 7.5px;
    color: #99a1af;
    line-height: 1.2;
}

.dvir-action-card {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    background: rgba(255, 105, 0, 0.1);
    border: 1.5px solid #ff6900;
    border-radius: 6px;
    padding: 7px 8px;
    flex-shrink: 0;
}

.dvir-action-icon {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
    margin-top: 1px;
}

.dvir-action-body {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.dvir-action-title {
    font-family: 'Inter', sans-serif;
    font-size: 9px;
    font-weight: 700;
    color: #ff6900;
}

.dvir-action-desc {
    font-family: 'Inter', sans-serif;
    font-size: 7.5px;
    color: #d1d5dc;
    line-height: 1.35;
}

.dvir-defects-section {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex-shrink: 0;
}

.dvir-defects-heading {
    display: flex;
    align-items: center;
    gap: 5px;
}

.dvir-defects-icon {
    width: 12px;
    height: 12px;
    flex-shrink: 0;
}

.dvir-defects-title {
    font-family: 'Inter', sans-serif;
    font-size: 9px;
    font-weight: 600;
    color: #d1d5dc;
}

.dvir-defect-card {
    background: #27272a;
    border-left: 3px solid #fb2c36;
    border-radius: 5px;
    padding: 6px 8px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.dvir-defect-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 4px;
}

.dvir-defect-item {
    font-family: 'Inter', sans-serif;
    font-size: 8.5px;
    font-weight: 600;
    color: #f3f4f6;
}

.dvir-pending-badge {
    font-family: 'Inter', sans-serif;
    font-size: 6.5px;
    font-weight: 600;
    color: #ff6467;
    background: rgba(251, 44, 54, 0.2);
    padding: 1px 5px;
    border-radius: 3px;
    flex-shrink: 0;
    letter-spacing: 0.3px;
}

.dvir-defect-desc {
    font-family: 'Inter', sans-serif;
    font-size: 7.5px;
    color: #d1d5dc;
}

.dvir-defect-date {
    font-family: 'Inter', sans-serif;
    font-size: 7px;
    color: #6a7282;
}

.dvir-cust-btn {
    background: #27272a;
    border-radius: 5px;
    padding: 6px;
    text-align: center;
    font-family: 'Inter', sans-serif;
    font-size: 8px;
    font-weight: 700;
    color: #00d3f2;
    flex-shrink: 0;
    margin-top: auto;
}

/* ================================================
   PS Messages Custom Widget
   ================================================ */
.ps-messages-widget {
    background: #18181b;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    overflow: hidden;
    border-radius: 8px;
    width: 100%;
    height: 100%;
}

.msg-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 7px 10px 5px;
    flex-shrink: 0;
}

.msg-title {
    font-family: 'Inter', sans-serif;
    font-size: 11px;
    font-weight: 600;
    color: #f3f4f6;
}

.msg-badge {
    background: #00b8db;
    color: #ffffff;
    font-family: 'Inter', sans-serif;
    font-size: 8px;
    font-weight: 700;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.msg-list {
    flex: 1;
    min-height: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.msg-item {
    border-left: 3px solid #00b8db;
    border-bottom: 1px solid #27272a;
    padding: 6px 10px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex-shrink: 0;
}

.msg-item-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 4px;
}

.msg-sender-row {
    display: flex;
    align-items: center;
    gap: 4px;
}

.msg-sender {
    font-family: 'Inter', sans-serif;
    font-size: 8px;
    font-weight: 600;
    color: #d1d5dc;
}

.msg-unread-dot {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: #00b8db;
    flex-shrink: 0;
}

.msg-priority-badge {
    font-family: 'Inter', sans-serif;
    font-size: 6.5px;
    font-weight: 600;
    padding: 1px 5px;
    border-radius: 3px;
    letter-spacing: 0.3px;
    flex-shrink: 0;
}

.msg-item-title {
    font-family: 'Inter', sans-serif;
    font-size: 8.5px;
    font-weight: 600;
    color: #ffffff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.msg-item-preview {
    font-family: 'Inter', sans-serif;
    font-size: 7.5px;
    color: #99a1af;
    line-height: 1.35;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.msg-item-time {
    font-family: 'Inter', sans-serif;
    font-size: 7px;
    color: #6a7282;
    display: flex;
    align-items: center;
    gap: 3px;
}

.msg-footer {
    border-top: 1px solid #27272a;
    padding: 6px 10px;
    font-family: 'Inter', sans-serif;
    font-size: 8px;
    font-weight: 600;
    color: #00d3f3;
    text-align: center;
    flex-shrink: 0;
}

/* ================================================
   CAT Scale / Weigh My Truck Custom Widget
   ================================================ */
.cat-scale-widget {
    background: #18181b;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    overflow: hidden;
    border-radius: 8px;
    width: 100%;
    height: 100%;
}

.cat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 7px 10px 4px;
    flex-shrink: 0;
}

.cat-title {
    font-family: 'Inter', sans-serif;
    font-size: 11px;
    font-weight: 600;
    color: #f3f4f6;
}

.cat-check-icon {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.cat-body {
    flex: 1;
    min-height: 0;
    padding: 4px 10px 6px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    overflow: hidden;
}

.cat-gross-section {
    display: flex;
    flex-direction: column;
    gap: 1px;
    flex-shrink: 0;
}

.cat-label {
    font-family: 'Inter', sans-serif;
    font-size: 7px;
    color: #90a1b9;
}

.cat-gross-value {
    display: flex;
    align-items: baseline;
    gap: 3px;
}

.cat-big-num {
    font-family: 'Inter', sans-serif;
    font-size: 22px;
    font-weight: 700;
    color: #fdc700;
    line-height: 1;
}

.cat-unit {
    font-family: 'Inter', sans-serif;
    font-size: 10px;
    font-weight: 600;
    color: #62748e;
}

.cat-axle-row {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.cat-axle {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.cat-axle-value {
    display: flex;
    align-items: baseline;
    gap: 2px;
}

.cat-axle-num {
    font-family: 'Inter', sans-serif;
    font-size: 13px;
    font-weight: 700;
    color: #ffffff;
    line-height: 1;
}

.cat-axle-unit {
    font-family: 'Inter', sans-serif;
    font-size: 7.5px;
    font-weight: 600;
    color: #62748e;
}

.cat-steers-section {
    display: flex;
    flex-direction: column;
    gap: 1px;
    flex-shrink: 0;
}

.cat-limit-section {
    display: flex;
    flex-direction: column;
    gap: 3px;
    flex-shrink: 0;
    margin-top: auto;
}

.cat-limit-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.cat-limit-pct,
.cat-limit-val {
    font-family: 'Inter', sans-serif;
    font-size: 7px;
    color: #99a1af;
}

.cat-limit-bar {
    height: 5px;
    background: #3f3f47;
    border-radius: 99px;
    overflow: hidden;
}

.cat-limit-fill {
    height: 100%;
    background: #00c950;
    border-radius: 99px;
}

.cat-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 5px 10px;
    border-top: 1px solid #3f3f47;
    background: rgba(39, 39, 42, 0.5);
    flex-shrink: 0;
}

.cat-footer-loc,
.cat-footer-time {
    font-family: 'Inter', sans-serif;
    font-size: 7px;
    color: #99a1af;
}

/* ================================================
   Luma Learning Custom Widget
   ================================================ */
.luma-widget {
    background: #0f172b;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    overflow: hidden;
    border-radius: 8px;
    width: 100%;
    height: 100%;
    gap: 0;
}

.luma-header {
    background: #0092b8;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 8px;
    height: 28px;
    flex-shrink: 0;
}

.luma-title {
    font-family: 'Inter', sans-serif;
    font-size: 10px;
    font-weight: 700;
    color: #0f172b;
}

.luma-header-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}

.luma-action-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 4px;
    background: rgba(0, 0, 0, 0.15);
}

.luma-progress-section {
    padding: 6px 8px 4px;
    flex-shrink: 0;
}

.luma-step-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 4px;
}

.luma-step-num {
    font-family: 'Inter', sans-serif;
    font-size: 8px;
    font-weight: 600;
    color: #00d3f3;
}

.luma-module-name {
    font-family: 'Inter', sans-serif;
    font-size: 7px;
    color: #99a1af;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 60%;
    text-align: right;
}

.luma-progress-bar {
    height: 4px;
    background: #314158;
    border-radius: 2px;
    overflow: hidden;
}

.luma-progress-fill {
    height: 100%;
    background: #00b8db;
    border-radius: 2px;
    transition: width 0.3s ease;
}

.luma-lesson-card {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    flex-shrink: 0;
}

.luma-lesson-icon {
    width: 32px;
    height: 32px;
    background: rgba(240, 177, 0, 0.2);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.luma-lesson-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.luma-lesson-title {
    font-family: 'Inter', sans-serif;
    font-size: 9px;
    font-weight: 700;
    color: #ffffff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.luma-lesson-sub {
    font-family: 'Inter', sans-serif;
    font-size: 7.5px;
    color: #00d3f3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.luma-body-text {
    font-family: 'Inter', sans-serif;
    font-size: 7.5px;
    color: #d1d5dc;
    line-height: 1.4;
    padding: 0 8px;
    flex: 1;
    overflow: hidden;
}

.luma-continue-btn {
    margin: 4px 8px 8px;
    background: #1d293d;
    color: #00d3f3;
    font-family: 'Inter', sans-serif;
    font-size: 8px;
    font-weight: 700;
    text-align: center;
    padding: 6px;
    border-radius: 5px;
    flex-shrink: 0;
    letter-spacing: 0.5px;
}

/* ================================================
   Lytx Custom Widget
   ================================================ */
.lytx-widget {
    background: #000000;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    overflow: hidden;
    border-radius: 8px;
    width: 100%;
    height: 100%;
    padding: 8px 8px 6px;
    box-sizing: border-box;
    gap: 4px;
}

.lytx-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.lytx-period {
    font-family: 'Inter', sans-serif;
    font-size: 9px;
    font-weight: 600;
    color: #ffffff;
}

.lytx-events-badge {
    display: flex;
    align-items: center;
    gap: 4px;
}

.lytx-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #00d492;
    flex-shrink: 0;
}

.lytx-events-count {
    font-family: 'Inter', sans-serif;
    font-size: 8px;
    font-weight: 700;
    color: #00d492;
    letter-spacing: 0.5px;
}

.lytx-chart {
    flex-shrink: 0;
    height: 60px;
    overflow: hidden;
}

.lytx-table {
    flex-shrink: 0;
}

.lytx-table-header {
    display: flex;
    padding-bottom: 3px;
    border-bottom: 1px solid #1f2937;
    margin-bottom: 2px;
}

.lytx-table-header span {
    font-family: 'Inter', sans-serif;
    font-size: 6.5px;
    font-weight: 700;
    color: #6b7280;
    letter-spacing: 0.5px;
}

.lytx-table-row {
    display: flex;
    align-items: center;
    padding: 1.5px 0;
}

.lytx-table-row.lytx-totals {
    border-top: 1px solid #1f2937;
    margin-top: 2px;
    padding-top: 3px;
}

.lytx-col-behavior {
    flex: 1;
    font-family: 'Inter', sans-serif;
    font-size: 7.5px;
    color: #d1d5dc;
}

.lytx-table-row.lytx-totals .lytx-col-behavior {
    font-weight: 700;
    color: #6b7280;
    font-size: 7px;
    letter-spacing: 0.5px;
}

.lytx-col-count {
    width: 28px;
    font-family: 'Inter', sans-serif;
    font-size: 7.5px;
    color: #d1d5dc;
    text-align: right;
}

.lytx-col-dur {
    width: 36px;
    font-family: 'Inter', sans-serif;
    font-size: 7.5px;
    color: #d1d5dc;
    text-align: right;
}

.lytx-total-count {
    color: #00d492;
    font-weight: 700;
}

.lytx-total-dur {
    color: #9ca3af;
    font-weight: 600;
}

/* ================================================
   Phillips Connect Custom Widget
   ================================================ */
.phillips-widget {
    background: #18181b;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    overflow: hidden;
    border-radius: 8px;
    width: 100%;
    height: 100%;
    padding: 8px;
    box-sizing: border-box;
    gap: 2px;
}

.phillips-header {
    display: flex;
    align-items: center;
    gap: 5px;
    padding-bottom: 4px;
    flex-shrink: 0;
}

.phillips-header-title {
    font-family: 'Inter', sans-serif;
    font-size: 8px;
    font-weight: 300;
    color: #d1d5dc;
    letter-spacing: 0.67px;
    text-transform: uppercase;
}

.phillips-rows {
    display: flex;
    flex-direction: column;
    gap: 1.5px;
    flex-shrink: 0;
}

.phillips-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 4px;
}

.phillips-label {
    font-family: 'Inter', sans-serif;
    font-size: 7px;
    font-weight: 300;
    color: #d1d5dc;
    flex-shrink: 0;
}

.phillips-value {
    font-family: 'Inter', sans-serif;
    font-size: 7px;
    color: #f3f4f6;
    text-align: right;
}

.phillips-truncate {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 55%;
}

.phillips-location-section {
    flex-shrink: 0;
    border-top: 1px solid #27272a;
    padding-top: 4px;
    margin-top: 2px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.phillips-loc-row {
    display: flex;
    align-items: flex-start;
    gap: 4px;
}

.phillips-loc-icon {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    margin-top: 1px;
}

.phillips-loc-label {
    font-family: 'Inter', sans-serif;
    font-size: 7px;
    font-weight: 300;
    color: #9ca3af;
    flex-shrink: 0;
}

.phillips-loc-text {
    font-family: 'Inter', sans-serif;
    font-size: 7px;
    color: #d1d5dc;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* DVIR Widget */
.dvir-widget {
    background: #111111;
    border-radius: 8px;
    padding: 8px;
    gap: 8px;
}

.dvir-status {
    display: flex;
    align-items: center;
    gap: 4px;
}

.dvir-status.ok .material-icons { color: #22c55e; }
.dvir-status.warning .material-icons { color: #f59e0b; }

.dvir-status .material-icons {
    font-size: 20px;
}

.dvir-status .status-text {
    font-size: 11px;
    font-weight: 600;
}

.dvir-info {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 8px;
    opacity: 0.7;
}

.dvir-info .material-icons {
    font-size: 12px;
}

/* Weather Widget */
.weather-widget {
    background: #111111;
    border-radius: 8px;
    padding: 8px;
    gap: 4px;
}

.weather-main {
    display: flex;
    align-items: center;
    gap: 6px;
}

.weather-icon {
    font-size: 28px;
    color: #fbbf24;
}

.weather-temp {
    font-size: 22px;
    font-weight: 700;
}

.weather-condition {
    font-size: 10px;
    opacity: 0.9;
}

.weather-forecast {
    display: flex;
    gap: 8px;
    margin-top: 4px;
    padding-top: 4px;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
}

.forecast-day {
    display: flex;
    flex-direction: column;
    align-items: center;
    font-size: 8px;
}

.forecast-day .day {
    opacity: 0.7;
}

.forecast-day .temps {
    font-weight: 600;
}

/* Fuel Widget */
.fuel-widget {
    background: #111111;
    border-radius: 8px;
    padding: 8px;
    gap: 6px;
}

.fuel-gauge {
    display: flex;
    justify-content: center;
}

.gauge-ring {
    position: relative;
    width: 50px;
    height: 50px;
}

.gauge-ring svg {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.gauge-bg {
    fill: none;
    stroke: rgba(255, 255, 255, 0.2);
    stroke-width: 3;
}

.gauge-fill {
    fill: none;
    stroke: #22c55e;
    stroke-width: 3;
    stroke-linecap: round;
    transition: stroke-dasharray 0.3s ease;
}

.gauge-value {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 11px;
    font-weight: 700;
}

.fuel-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.fuel-range {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 10px;
}

.fuel-range .material-icons {
    font-size: 12px;
}

.fuel-price {
    font-size: 8px;
    opacity: 0.8;
}

/* Messages Widget */
.messages-widget {
    background: #111111;
    border-radius: 8px;
    padding: 6px;
    gap: 4px;
    align-items: stretch;
}

.messages-header {
    display: flex;
    align-items: center;
    gap: 4px;
}

.unread-badge {
    background: #ef4444;
    color: white;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 10px;
}

.unread-label {
    font-size: 9px;
    opacity: 0.8;
}

.message-preview {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.message-item {
    display: flex;
    flex-direction: column;
    background: rgba(255, 255, 255, 0.1);
    padding: 4px 6px;
    border-radius: 4px;
}

.message-item .sender {
    font-size: 8px;
    font-weight: 600;
}

.message-item .preview {
    font-size: 8px;
    opacity: 0.8;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.message-item .time {
    font-size: 7px;
    opacity: 0.6;
}

/* Score Widget (Performance/Analytics) */
.score-widget {
    background: #111111;
    border-radius: 8px;
    padding: 8px;
    gap: 4px;
}

.score-ring {
    position: relative;
    width: 50px;
    height: 50px;
}

.score-ring svg {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.score-bg {
    fill: none;
    stroke: rgba(255, 255, 255, 0.2);
    stroke-width: 3;
}

.score-fill {
    fill: none;
    stroke-width: 3;
    stroke-linecap: round;
}

.score-value {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 14px;
    font-weight: 700;
}

.score-label {
    font-size: 9px;
    opacity: 0.9;
}

.score-detail {
    font-size: 8px;
    opacity: 0.7;
}

/* Fleet Pulse Widget */
.pulse-widget {
    background: #111111;
    border-radius: 8px;
    padding: 8px;
    gap: 6px;
}

.pulse-metric {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.metric-value {
    font-size: 20px;
    font-weight: 700;
}

.metric-label {
    font-size: 8px;
    opacity: 0.8;
}

.pulse-alerts {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 9px;
}

.pulse-alerts .material-icons {
    font-size: 14px;
    color: #22c55e;
}

.pulse-alerts.has-alerts .material-icons {
    color: #f59e0b;
}

/* Workflow Widget */
.workflow-widget {
    background: #111111;
    border-radius: 8px;
    padding: 8px;
    gap: 6px;
    align-items: stretch;
}

.workflow-current {
    display: flex;
    align-items: center;
    gap: 4px;
    background: rgba(0, 0, 0, 0.2);
    padding: 4px 6px;
    border-radius: 4px;
}

.workflow-current .material-icons {
    font-size: 14px;
}

.task-name {
    font-size: 9px;
    font-weight: 600;
}

.workflow-next {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.next-stop, .next-eta {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 8px;
}

.next-stop .material-icons, .next-eta .material-icons {
    font-size: 10px;
    opacity: 0.8;
}

/* Logistics Widget */
.logistics-widget {
    background: #111111;
    border-radius: 8px;
    padding: 8px;
    flex-direction: row;
    gap: 12px;
}

.logistics-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.logistics-stat .stat-value {
    font-size: 18px;
    font-weight: 700;
}

.logistics-stat .stat-label {
    font-size: 7px;
    opacity: 0.7;
}

/* Trailer Widget */
.trailer-widget {
    background: #111111;
    border-radius: 8px;
    padding: 8px;
    gap: 6px;
}

.trailer-temp {
    display: flex;
    align-items: center;
    gap: 4px;
}

.trailer-temp .material-icons {
    font-size: 18px;
    color: #a5f3fc;
}

.temp-value {
    font-size: 16px;
    font-weight: 700;
}

.trailer-status {
    display: flex;
    gap: 8px;
}

.status-item {
    display: flex;
    align-items: center;
    gap: 2px;
    font-size: 8px;
}

.status-item .material-icons {
    font-size: 12px;
}

/* Weight Widget */
.weight-widget {
    background: #111111;
    border-radius: 8px;
    padding: 8px;
    gap: 6px;
}

.weight-main {
    display: flex;
    align-items: baseline;
    gap: 2px;
}

.weight-value {
    font-size: 18px;
    font-weight: 700;
}

.weight-unit {
    font-size: 10px;
    opacity: 0.8;
}

.weight-status {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 9px;
}

.weight-status.legal .material-icons { color: #22c55e; }
.weight-status.over .material-icons { color: #fbbf24; }

.weight-status .material-icons {
    font-size: 14px;
}

/* Parking Widget */
.parking-widget {
    background: #111111;
    border-radius: 8px;
    padding: 8px;
    gap: 6px;
}

.parking-nearby {
    display: flex;
    align-items: center;
    gap: 4px;
}

.parking-nearby .material-icons {
    font-size: 18px;
}

.parking-nearby .distance {
    font-size: 14px;
    font-weight: 600;
}

.parking-spaces {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.spaces-value {
    font-size: 18px;
    font-weight: 700;
    color: #22c55e;
}

.spaces-label {
    font-size: 7px;
    opacity: 0.7;
}

/* Media Widget */
.media-widget {
    background: #111111;
    border-radius: 8px;
    padding: 6px;
    gap: 4px;
}

.media-art {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, #ec4899, #d946ef);
    border-radius: 4px;
}

.media-info {
    text-align: center;
}

.media-title {
    font-size: 9px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.media-artist {
    font-size: 8px;
    opacity: 0.7;
}

.media-controls {
    display: flex;
    gap: 8px;
}

.media-controls .material-icons {
    font-size: 16px;
    cursor: pointer;
    opacity: 0.8;
}

.media-controls .material-icons:hover {
    opacity: 1;
}

/* Training Widget */
.training-widget {
    background: #111111;
    border-radius: 8px;
    padding: 8px;
    gap: 6px;
    align-items: stretch;
}

.training-progress {
    display: flex;
    align-items: center;
    gap: 6px;
}

.progress-bar {
    flex: 1;
    height: 8px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #22c55e, #16a34a);
    border-radius: 4px;
    transition: width 0.3s ease;
}

.progress-value {
    font-size: 10px;
    font-weight: 700;
}

.training-next {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 9px;
}

.training-next .material-icons {
    font-size: 12px;
}

/* Documents Widget */
.docs-widget {
    background: #111111;
    border-radius: 8px;
    padding: 8px;
    gap: 6px;
}

.docs-stat {
    display: flex;
    align-items: center;
    gap: 4px;
}

.docs-stat .material-icons {
    font-size: 18px;
}

.docs-stat .stat-value {
    font-size: 16px;
    font-weight: 700;
}

.docs-stat .stat-label {
    font-size: 8px;
    opacity: 0.7;
}

.docs-sync {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 8px;
}

.docs-sync .material-icons {
    font-size: 12px;
}

.docs-sync.synced .material-icons {
    color: #22c55e;
}

/* Forms Widget */
.forms-widget {
    background: #111111;
    border-radius: 8px;
    padding: 8px;
    gap: 4px;
}

.forms-pending {
    display: flex;
    align-items: center;
    gap: 4px;
}

.forms-pending .material-icons {
    font-size: 18px;
}

.forms-pending .pending-value {
    font-size: 20px;
    font-weight: 700;
}

.forms-pending.has-pending .pending-value {
    color: #fbbf24;
}

.pending-label {
    font-size: 8px;
    opacity: 0.7;
}

.forms-completed {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 8px;
}

.forms-completed .material-icons {
    font-size: 12px;
    color: #22c55e;
}

/* Notifications Widget */
.notif-widget {
    background: #111111;
    border-radius: 8px;
    padding: 8px;
    gap: 6px;
}

.notif-count {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.count-value {
    font-size: 24px;
    font-weight: 700;
}

.count-label {
    font-size: 8px;
    opacity: 0.8;
}

.notif-urgent {
    display: flex;
    align-items: center;
    gap: 4px;
    background: rgba(239, 68, 68, 0.3);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 9px;
}

.notif-urgent .material-icons {
    font-size: 12px;
    color: #fbbf24;
}

/* Camera Widget */
.camera-widget {
    background: #111111;
    border-radius: 8px;
    padding: 8px;
    gap: 6px;
}

.camera-status {
    display: flex;
    align-items: center;
    gap: 4px;
}

.camera-status .material-icons {
    font-size: 18px;
}

.camera-status.recording .material-icons {
    color: #ef4444;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.camera-events {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.events-value {
    font-size: 18px;
    font-weight: 700;
}

.events-label {
    font-size: 7px;
    opacity: 0.7;
}

/* ERoad Widget */
.eroad-widget {
    background: #111111;
    border-radius: 8px;
    padding: 8px;
    gap: 6px;
}

.eroad-miles {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.miles-value {
    font-size: 18px;
    font-weight: 700;
}

.miles-label {
    font-size: 7px;
    opacity: 0.7;
}

.eroad-charges {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    font-weight: 600;
    color: #22c55e;
}

.eroad-charges .material-icons {
    font-size: 14px;
}

/* Inspection Widget */
.inspection-widget {
    background: #111111;
    border-radius: 8px;
    padding: 8px;
    gap: 6px;
}

.inspection-score {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.inspection-score .score-value {
    font-size: 24px;
    font-weight: 700;
}

.inspection-score .score-label {
    font-size: 8px;
    opacity: 0.8;
}

.inspection-status {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 10px;
}

.inspection-status .material-icons {
    font-size: 14px;
}

.inspection-status.ready .material-icons {
    color: #86efac;
}

/* OER Widget */
.oer-widget {
    background: #111111;
    border-radius: 8px;
    padding: 8px;
    gap: 6px;
}

.oer-status {
    display: flex;
    align-items: center;
    gap: 4px;
}

.oer-status .material-icons {
    font-size: 16px;
}

.oer-status.recording .material-icons {
    color: #ef4444;
    animation: pulse 1.5s infinite;
}

.oer-events {
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* PS Bypass Widget */
.ps-bypass-widget {
    background: #111111;
    border-radius: 8px;
    padding: 8px;
    gap: 6px;
}

.bypass-enrolled {
    display: flex;
    align-items: center;
    gap: 4px;
}

.bypass-enrolled .material-icons {
    font-size: 18px;
}

.bypass-enrolled.active .material-icons {
    color: #86efac;
}

.bypass-count {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.bypass-count .count-value {
    font-size: 18px;
    font-weight: 700;
}

.bypass-count .count-label {
    font-size: 7px;
    opacity: 0.7;
}

/* Rewards Widget */
.rewards-widget {
    background: #111111;
    border-radius: 8px;
    padding: 8px;
    gap: 6px;
}

.rewards-points {
    display: flex;
    align-items: center;
    gap: 4px;
}

.rewards-points .material-icons {
    font-size: 18px;
    color: #fef08a;
}

.points-value {
    font-size: 18px;
    font-weight: 700;
}

.points-label {
    font-size: 8px;
    opacity: 0.8;
}

.rewards-rank {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 10px;
}

.rewards-rank .material-icons {
    font-size: 14px;
    color: #fef08a;
}

/* Vector Widget */
.vector-widget {
    background: #111111;
    border-radius: 8px;
    padding: 8px;
    gap: 4px;
}

.vector-vehicles {
    display: flex;
    align-items: baseline;
    gap: 2px;
}

.vehicles-active {
    font-size: 24px;
    font-weight: 700;
    color: #22c55e;
}

.vehicles-divider {
    font-size: 16px;
    opacity: 0.5;
}

.vehicles-total {
    font-size: 16px;
    opacity: 0.7;
}

.vector-label {
    font-size: 8px;
    opacity: 0.7;
}

/* Form Messages Widget */
.form-msg-widget {
    background: #111111;
    border-radius: 8px;
    padding: 8px;
    gap: 4px;
}

.form-msg-pending {
    display: flex;
    align-items: center;
    gap: 4px;
}

.form-msg-pending .material-icons {
    font-size: 18px;
}

.form-msg-pending .pending-value {
    font-size: 20px;
    font-weight: 700;
}

.form-msg-pending.has-pending .pending-value {
    color: #fbbf24;
}

/* Default Widget */
.default-widget {
    background: #111111;
    border-radius: 8px;
    padding: 8px;
    gap: 4px;
}

.default-icon img {
    width: 28px;
    height: 28px;
    object-fit: contain;
}

.default-icon .material-icons {
    font-size: 28px;
}

.default-name {
    font-size: 9px;
    opacity: 0.8;
}

/* Device frame specific widget scaling */
.device-frame.tablet .widget-rich-content,
.device-frame.peterbilt-579 .widget-rich-content,
.device-frame.kenworth-t680 .widget-rich-content {
    font-size: 8px;
}

.device-frame.tablet .nav-eta .value,
.device-frame.peterbilt-579 .nav-eta .value,
.device-frame.kenworth-t680 .nav-eta .value {
    font-size: 12px;
}

.device-frame.tablet .weather-temp,
.device-frame.peterbilt-579 .weather-temp,
.device-frame.kenworth-t680 .weather-temp {
    font-size: 16px;
}

.device-frame.tablet .weather-icon,
.device-frame.peterbilt-579 .weather-icon,
.device-frame.kenworth-t680 .weather-icon {
    font-size: 20px;
}

.device-frame.tablet .gauge-ring,
.device-frame.tablet .score-ring,
.device-frame.peterbilt-579 .gauge-ring,
.device-frame.peterbilt-579 .score-ring,
.device-frame.kenworth-t680 .gauge-ring,
.device-frame.kenworth-t680 .score-ring {
    width: 36px;
    height: 36px;
}

.widget-slot.empty .material-icons {
    color: rgba(255, 255, 255, 0.3);
    font-size: 32px;
}

/* Pagination Dots */
.pagination-dots {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    padding: 12px;
}

.dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.3);
    cursor: pointer;
    transition: var(--transition);
}

.dot.active {
    background-color: white;
    width: 24px;
    border-radius: 4px;
}

.add-page-btn {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    border: 1px dashed rgba(255, 255, 255, 0.3);
    color: rgba(255, 255, 255, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
}

.add-page-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

.add-page-btn .material-icons {
    font-size: 16px;
}

/* Advanced Tab - JSON Editor */
.advanced-container {
    background-color: var(--surface-color);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.json-editor-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--glass-border);
}

.json-editor-header h3 {
    font-size: 16px;
    font-weight: 600;
}

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

.json-editor {
    height: 500px;
}

.json-editor textarea {
    width: 100%;
    height: 100%;
    padding: 20px;
    font-family: 'Monaco', 'Menlo', monospace;
    font-size: 13px;
    line-height: 1.6;
    border: none;
    resize: none;
    background-color: var(--void-color);
    color: var(--text-primary);
}

.json-editor textarea:focus {
    outline: none;
}

.json-status {
    padding: 12px 20px;
    font-size: 12px;
    border-top: 1px solid var(--glass-border);
}

.json-status.valid {
    color: var(--success-color);
    background-color: rgba(5, 150, 105, 0.10);
}

.json-status.invalid {
    color: var(--danger-color);
    background-color: rgba(220, 38, 38, 0.10);
}

/* Version Detail Page */
.version-detail-content {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.version-info-card {
    background-color: var(--surface-color);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-xl);
    padding: 24px;
    box-shadow: var(--shadow-sm);
}

.version-info-card h3 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 16px;
}

.publishing-history {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.history-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background-color: var(--background-color);
    border-radius: var(--radius-lg);
}

.history-item .material-icons {
    color: var(--text-muted);
}

.history-item .date {
    font-weight: 500;
}

.history-item .user {
    color: var(--text-secondary);
}

.version-sections {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
}

.version-sections-stacked {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.version-section {
    background-color: var(--surface-color);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-xl);
    padding: 24px;
    box-shadow: var(--shadow-sm);
}

.version-section h3 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-solid);
}

.version-section:last-child {
    grid-column: span 2;
}

/* Version Preview Containers */
.version-preview-container {
    display: flex;
    gap: 24px;
    min-height: 500px;
}

.version-display-type-sidebar {
    width: 200px;
    flex-shrink: 0;
    background-color: var(--surface-color);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-xl);
    padding: 16px;
}

.version-preview-area {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.version-preview-area .preview-header {
    margin-bottom: 16px;
}

.version-preview-area .device-preview {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--background-color);
    border-radius: var(--radius-lg);
    padding: 20px;
}

/* Read-only grids */
.apps-grid.readonly .app-icon,
.widgets-grid.readonly .widget-slot {
    cursor: default;
}

.apps-grid.readonly .app-icon:hover,
.widgets-grid.readonly .widget-slot:hover {
    transform: none;
    box-shadow: none;
}

.apps-grid.readonly .app-icon.empty,
.widgets-grid.readonly .widget-slot.empty {
    display: none;
}

/* Version preview specific styles */
.version-apps-preview,
.version-widgets-preview {
    margin-top: 16px;
}

.version-preview-area .layout-selector {
    margin-left: auto;
}

.version-preview-area .layout-dropdown-trigger {
    pointer-events: none;
    opacity: 0.7;
}

@media (max-width: 900px) {
    .version-preview-container {
        flex-direction: column;
    }

    .version-display-type-sidebar {
        width: 100%;
    }

    .version-display-type-sidebar .display-type-list {
        flex-direction: row;
        flex-wrap: wrap;
    }
}

.version-json pre {
    background-color: #1e1e1e;
    color: #d4d4d4;
    padding: 16px;
    border-radius: var(--radius-lg);
    overflow-x: auto;
    font-family: 'Monaco', 'Menlo', monospace;
    font-size: 12px;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background-color: var(--surface-color);
    border-radius: var(--radius-modal);
    border: 1px solid var(--glass-border);
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-lg);
}

.modal-large .modal-content {
    max-width: 900px;
}

#app-settings-modal .modal-content {
    height: 85vh;
}

.modal-mid .modal-content {
    max-width: 700px;
}

.modal-sm .modal-content {
    max-width: 420px;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-solid);
}

.modal-header h2 {
    font-size: 18px;
    font-weight: 600;
}

.modal-body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 16px 24px;
    border-top: 1px solid var(--border-solid);
}

.copy-from-display {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-right: auto;
}

.copy-from-display label {
    font-size: 14px;
    color: var(--text-secondary);
}

.copy-from-display select {
    padding: 6px 12px;
    border: 1px solid var(--input-border);
    border-radius: var(--radius-lg);
    font-size: 14px;
    background-color: var(--input-bg);
    color: var(--text-primary);
}

/* Library Filters */
.library-filters {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 24px;
}

/* Horizontal Library Filters */
.library-filters.library-filters-horizontal {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
}

.library-filters-horizontal .search-box {
    flex: 1;
    min-width: 200px;
    max-width: 300px;
}

.library-filters-horizontal select {
    padding: 8px 12px;
    border: 1px solid var(--input-border);
    border-radius: var(--radius-lg);
    font-size: 14px;
    background-color: var(--input-bg);
    color: var(--text-primary);
    min-width: 150px;
}

.library-filters-horizontal select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px var(--input-focus);
}

.filter-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.chip {
    padding: 6px 14px;
    font-size: 13px;
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-full);
    background-color: var(--surface-color);
    cursor: pointer;
    transition: var(--transition);
}

.chip:hover {
    background-color: var(--ghost-bg);
    border-color: var(--ghost-border);
    color: var(--ghost-text);
}

.chip.active {
    background-color: var(--primary-color);
    color: #ffffff;
    border-color: var(--primary-color);
    box-shadow: 0 2px 8px rgba(48, 186, 255, 0.30);
}

.chip.danger {
    background-color: var(--danger-color);
    color: white;
    border-color: var(--danger-color);
}

.chip.warning {
    background-color: var(--warning-color);
    color: white;
    border-color: var(--warning-color);
}

.dropdown-filters {
    display: flex;
    gap: 12px;
}

.dropdown-filters select {
    padding: 8px 12px;
    border: 1px solid var(--input-border);
    border-radius: var(--radius-lg);
    background-color: var(--input-bg);
    color: var(--text-primary);
    font-size: 14px;
}

/* Library Grid */
.library-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    max-height: 400px;
    overflow-y: auto;
}

.library-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 16px;
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-xl);
    cursor: pointer;
    transition: var(--transition);
}

.library-item:hover {
    border-color: var(--ghost-border);
    background-color: var(--ghost-bg);
}

.library-item.selected {
    border-color: var(--primary-color);
    background-color: var(--ghost-bg);
    box-shadow: 0 0 0 2px var(--primary-color);
}

.library-item.added {
    border-color: var(--success-color);
    background-color: rgba(5, 150, 105, 0.08);
}

.library-item.unavailable {
    opacity: 0.5;
    cursor: not-allowed;
}

.library-item .item-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 8px;
    overflow: hidden;
}

.library-item .item-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 12px;
}

.library-item .item-icon .material-icons {
    color: white;
    font-size: 24px;
}

.library-item .item-name {
    font-size: 13px;
    font-weight: 500;
    text-align: center;
    margin-bottom: 4px;
}

.library-item .item-status {
    font-size: 11px;
    color: var(--text-muted);
}

.library-item.added .item-status {
    color: var(--success-color);
}

/* Widget Library Grid - 2 columns with previews */
#widget-library-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    max-height: 500px;
}

.widget-library-item {
    padding: 0;
    overflow: hidden;
}

.widget-library-content {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
}

.widget-library-info {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: var(--surface-color);
    border-bottom: 1px solid var(--glass-border);
}

.widget-app-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    overflow: hidden;
    flex-shrink: 0;
}

.widget-app-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.widget-app-icon .material-icons {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #30baff, #0284c7);
    color: white;
    font-size: 20px;
}

.widget-app-details {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.widget-app-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.widget-library-item .widget-name {
    font-size: 12px;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.widget-library-item .item-status {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 2px;
}

.widget-library-preview {
    padding: 12px;
    background: #111827;
    min-height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.widget-preview-container {
    width: 100%;
    height: 100px;
    border-radius: 8px;
    overflow: hidden;
}

.widget-preview-container .widget-rich-content {
    width: 100%;
    height: 100%;
    font-size: 9px;
}

/* Adjust widget content sizes for library preview */
.widget-preview-container .nav-eta .value {
    font-size: 14px;
}

.widget-preview-container .nav-distance .value {
    font-size: 12px;
}

.widget-preview-container .nav-turn-indicator .material-icons {
    font-size: 12px;
}

.widget-preview-container .weather-temp {
    font-size: 18px;
}

.widget-preview-container .weather-icon {
    font-size: 24px;
}

.widget-preview-container .gauge-ring,
.widget-preview-container .score-ring {
    width: 40px;
    height: 40px;
}

.widget-preview-container .gauge-value,
.widget-preview-container .score-value {
    font-size: 10px;
}

.widget-preview-container .hos-status-badge {
    font-size: 7px;
    padding: 2px 4px;
}

.widget-preview-container .bar-label {
    font-size: 6px;
    width: 28px;
}

.widget-preview-container .bar-value {
    font-size: 7px;
    width: 24px;
}

.widget-preview-container .bar-track {
    height: 5px;
}

.widget-preview-container .unread-badge {
    font-size: 9px;
    padding: 2px 5px;
}

.widget-preview-container .message-item {
    padding: 3px 5px;
}

.widget-preview-container .message-item .sender {
    font-size: 7px;
}

.widget-preview-container .message-item .preview {
    font-size: 7px;
}

.widget-preview-container .workflow-current {
    padding: 3px 5px;
}

.widget-preview-container .workflow-current .material-icons {
    font-size: 12px;
}

.widget-preview-container .task-name {
    font-size: 8px;
}

.widget-preview-container .metric-value {
    font-size: 16px;
}

.widget-preview-container .logistics-stat .stat-value {
    font-size: 14px;
}

.widget-preview-container .count-value {
    font-size: 18px;
}

.widget-preview-container .fuel-info {
    font-size: 9px;
}

.widget-preview-container .bypass-stat .stat-value {
    font-size: 12px;
}

.widget-preview-container .bypass-status .material-icons {
    font-size: 14px;
}

.widget-preview-container .dvir-status .material-icons {
    font-size: 16px;
}

.widget-preview-container .trailer-temp .material-icons {
    font-size: 14px;
}

.widget-preview-container .temp-value {
    font-size: 14px;
}

.widget-preview-container .weight-value {
    font-size: 14px;
}

.widget-preview-container .parking-nearby .material-icons {
    font-size: 14px;
}

.widget-preview-container .spaces-value {
    font-size: 14px;
}

.widget-preview-container .media-art {
    width: 28px;
    height: 28px;
}

.widget-preview-container .media-controls .material-icons {
    font-size: 14px;
}

.widget-preview-container .progress-bar {
    height: 6px;
}

.widget-preview-container .training-next .material-icons {
    font-size: 10px;
}

.widget-preview-container .inspection-score {
    display: none;
}

.widget-preview-container .miles-value {
    font-size: 14px;
}

.widget-preview-container .vehicles-active {
    font-size: 18px;
}

.widget-preview-container .vehicles-total {
    font-size: 12px;
}

/* Widget library item hover/selected states */
.widget-library-item:hover .widget-library-info {
    background: var(--primary-light);
}

.widget-library-item.selected .widget-library-info {
    background: var(--primary-light);
}

.widget-library-item.added .widget-library-info {
    background: rgba(5, 150, 105, 0.08);
}

.widget-library-item.added .item-status {
    color: var(--success-color);
}

.widget-library-item.unavailable .widget-library-preview {
    opacity: 0.5;
}

/* App/Widget Detail Content */
.app-detail-content,
.widget-detail-content {
    display: flex;
    gap: 16px;
    margin-bottom: 24px;
}

.app-detail-icon,
.widget-preview-large {
    width: 80px;
    height: 80px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    overflow: hidden;
}

.app-detail-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 16px;
}

.widget-preview-large img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 16px;
}

.app-detail-icon .material-icons {
    color: white;
    font-size: 40px;
}

.app-detail-info,
.widget-detail-info {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.app-category,
.widget-category {
    font-size: 13px;
    color: var(--text-muted);
}

.app-developer,
.widget-developer {
    font-size: 14px;
    color: var(--text-secondary);
}

.app-description,
.widget-description {
    font-size: 14px;
    color: var(--text-primary);
}

.app-settings {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.widget-variations {
    display: flex;
    gap: 12px;
}

.variation-option {
    padding: 12px;
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-xl);
    cursor: pointer;
    transition: var(--transition);
}

.variation-option:hover {
    border-color: var(--ghost-border);
    background-color: var(--ghost-bg);
}

.variation-option.selected {
    border-color: var(--primary-color);
    background-color: var(--ghost-bg);
    box-shadow: 0 0 0 2px var(--primary-color);
}

/* ========== Apps Tab ========== */
.apps-management-container {
    display: flex;
    gap: 24px;
    min-height: 500px;
}

.apps-tab-sidebar {
    width: 200px;
    flex-shrink: 0;
    background-color: var(--surface-color);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-xl);
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    align-self: flex-start;
    box-shadow: var(--shadow-sm);
}

.apps-sidebar-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--radius-lg);
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    transition: var(--transition);
    border: 1px solid transparent;
}

.apps-sidebar-item:hover {
    background-color: var(--ghost-bg);
    border-color: var(--ghost-border);
    color: var(--text-primary);
}

.apps-sidebar-item.active {
    background-color: var(--ghost-bg);
    border-color: var(--ghost-border);
    color: var(--primary-color);
}

.apps-sidebar-item .material-icons {
    font-size: 20px;
}

.apps-sidebar-marketplace {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border-solid);
    text-align: left;
}

.apps-sidebar-marketplace p {
    font-size: 12px;
    color: var(--text-muted);
    margin: 0 0 12px 0;
    line-height: 1.4;
}

.apps-sidebar-marketplace .btn {
    width: 100%;
    font-size: 13px;
}

.coming-soon-badge {
    font-size: 10px;
    font-weight: 600;
    background-color: var(--background-color);
    color: var(--text-muted);
    padding: 2px 6px;
    border-radius: var(--radius-sm);
    margin-left: auto;
}

.apps-tab-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.apps-tab-filters {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
}

.apps-tab-filters select {
    padding: 8px 12px;
    border: 1px solid var(--input-border);
    border-radius: var(--radius-lg);
    background-color: var(--input-bg);
    color: var(--text-primary);
    font-size: 14px;
    min-width: 160px;
}

.apps-tab-filters .search-box {
    flex: 1;
    min-width: 180px;
}

.apps-tab-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}

.apps-tab-card {
    display: flex;
    flex-direction: column;
    padding: 16px;
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-xl);
    background-color: var(--surface-color);
    position: relative;
    transition: var(--transition);
    cursor: pointer;
}

.apps-tab-card:hover {
    border-color: var(--ghost-border);
    background-color: var(--ghost-bg);
    box-shadow: var(--shadow-md);
}

.apps-tab-card .app-card-body {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.apps-tab-card .app-card-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    overflow: hidden;
    flex-shrink: 0;
}

.apps-tab-card .app-card-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 12px;
}

.apps-tab-card .app-card-details {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.apps-tab-card .app-card-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.apps-tab-card .app-card-meta {
    font-size: 11px;
    color: var(--text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.apps-tab-card .app-card-overflow {
    position: absolute;
    top: 6px;
    right: 6px;
}

.apps-tab-card .app-card-overflow .overflow-btn {
    padding: 2px;
    background: transparent;
    border: none;
    cursor: pointer;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-size: 18px;
}

.apps-tab-card .app-card-overflow .overflow-btn:hover {
    background-color: var(--background-color);
    color: var(--text-primary);
}

.apps-tab-card .app-card-overflow .overflow-menu {
    right: 0;
    top: 28px;
    min-width: 220px;
    white-space: nowrap;
}

.apps-tab-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    color: var(--text-muted);
    text-align: center;
}

.apps-tab-empty .material-icons {
    font-size: 48px;
    margin-bottom: 12px;
}

.apps-tab-empty h3 {
    margin-bottom: 4px;
    color: var(--text-secondary);
}

/* Available Apps Cards */
.available-app-card {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    padding: 16px;
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-xl);
    background-color: var(--surface-color);
    position: relative;
    transition: var(--transition);
    gap: 4px;
}

.available-app-card:hover {
    border-color: var(--ghost-border);
    background-color: var(--ghost-bg);
    box-shadow: var(--shadow-md);
}

.available-app-card .available-app-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 4px;
}

.available-app-card .available-app-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.available-app-card .available-app-meta {
    font-size: 11px;
    color: var(--text-muted);
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.available-app-card .available-app-action {
    position: absolute;
    top: 12px;
    right: 12px;
}

.available-app-card .added-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 12px;
    font-size: 12px;
    font-weight: 500;
    border-radius: var(--radius-full);
    background-color: rgba(5, 150, 105, 0.10);
    color: var(--success-color);
    border: 1px solid rgba(5, 150, 105, 0.25);
}

.available-app-card .added-chip .material-icons {
    font-size: 14px;
}

.available-app-card .btn-add-app {
    padding: 4px 16px;
    font-size: 12px;
    font-weight: 500;
    border-radius: var(--radius-full);
    border: 1px solid var(--ghost-border);
    background-color: var(--ghost-bg);
    color: var(--ghost-text);
    cursor: pointer;
    transition: var(--transition);
}

.available-app-card .btn-add-app:hover {
    background-color: var(--primary-color);
    color: #ffffff;
    border-color: var(--primary-color);
}

/* Available App Detail Modal */
.avail-detail-header {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 24px;
    position: relative;
}

.avail-detail-header .avail-detail-action-right {
    position: absolute;
    right: 0;
    top: 0;
}

.avail-detail-header .avail-detail-action-right .btn-add-app {
    padding: 9px 30px;
    font-size: 16px;
    font-weight: 500;
    border-radius: var(--radius-modal);
    border: 1px solid var(--ghost-border);
    background: linear-gradient(135deg, var(--search-btn-start), var(--search-btn-end));
    color: #ffffff;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: 0 2px 8px rgba(48, 186, 255, 0.25);
}

.avail-detail-header .avail-detail-action-right .btn-add-app:hover {
    box-shadow: 0 4px 16px rgba(48, 186, 255, 0.35);
    transform: translateY(-1px);
}

.avail-detail-header .avail-detail-action-right .added-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7.5px 21px;
    font-size: 16px;
    font-weight: 500;
    border-radius: var(--radius-modal);
    background-color: rgba(5, 150, 105, 0.10);
    color: var(--success-color);
    border: 1px solid rgba(5, 150, 105, 0.25);
}

.avail-detail-header .avail-detail-action-right .added-chip .material-icons {
    font-size: 24px;
}

.avail-detail-icon {
    width: 72px;
    height: 72px;
    border-radius: 16px;
    overflow: hidden;
    flex-shrink: 0;
}

.avail-detail-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 16px;
}

.avail-detail-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.avail-detail-info h3 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.avail-detail-info .avail-detail-meta {
    font-size: 13px;
    color: var(--text-muted);
}

.avail-detail-info .avail-detail-action {
    margin-top: 8px;
    display: none;
}

.avail-detail-info .btn-add-app {
    padding: 6px 20px;
    font-size: 13px;
    font-weight: 500;
    border-radius: var(--radius-full);
    border: 1px solid var(--ghost-border);
    background-color: var(--ghost-bg);
    color: var(--ghost-text);
    cursor: pointer;
    transition: var(--transition);
}

.avail-detail-info .btn-add-app:hover {
    background-color: var(--primary-color);
    color: #ffffff;
    border-color: var(--primary-color);
}

.avail-detail-info .added-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 5px 14px;
    font-size: 13px;
    font-weight: 500;
    border-radius: var(--radius-full);
    background-color: rgba(5, 150, 105, 0.10);
    color: var(--success-color);
    border: 1px solid rgba(5, 150, 105, 0.25);
}

.avail-detail-info .added-chip .material-icons {
    font-size: 16px;
}

.avail-detail-description {
    font-size: 14px;
    line-height: 1.6;
    color: var(--text-primary);
    margin-bottom: 24px;
}

.avail-detail-screenshots {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 24px;
}

.avail-detail-screenshot {
    aspect-ratio: 9 / 4;
    border-radius: var(--radius-lg);
    background-color: var(--background-color);
    border: 1px solid var(--glass-border);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.avail-detail-screenshot .screenshot-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    color: var(--text-muted);
    text-align: center;
    padding: 12px;
}

.avail-detail-screenshot .screenshot-placeholder .material-icons {
    font-size: 28px;
    opacity: 0.5;
}

.avail-detail-screenshot .screenshot-placeholder span:last-child {
    font-size: 11px;
    line-height: 1.3;
}

.avail-detail-section-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 12px;
}

.avail-detail-features {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.avail-detail-features li {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: 14px;
    color: var(--text-primary);
    line-height: 1.4;
}

.avail-detail-features li .bullet-dot {
    width: 6px;
    height: 6px;
    min-width: 6px;
    border-radius: 50%;
    background-color: var(--text-primary);
    flex-shrink: 0;
    margin-top: 6px;
}

#app-settings-modal .app-settings-modal-header {
    border-bottom: none;
}

.app-settings-tabs-bar {
    display: flex;
    gap: 0;
    padding: 0 24px;
    border-bottom: 1px solid var(--border-solid);
}

/* App Settings Modal Tabs */

.app-settings-tab {
    padding: 8px 20px;
    font-size: 15px;
    font-weight: 500;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--text-muted);
    cursor: pointer;
    transition: var(--transition);
}

.app-settings-tab:hover {
    color: var(--text-primary);
}

.app-settings-tab.active {
    color: var(--text-primary);
    border-bottom-color: var(--primary-color);
}

.app-settings-tab-content {
    display: none;
}

.app-settings-tab-content.active {
    display: block;
    overflow-y: auto;
    flex: 1;
}

#app-settings-modal .modal-body {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* App Settings Modal */
.app-settings-header {
    display: flex;
    gap: 16px;
    align-items: center;
    margin-bottom: 24px;
}

.app-settings-icon {
    width: 80px;
    height: 80px;
    border-radius: 16px;
    overflow: hidden;
    flex-shrink: 0;
}

.app-settings-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 16px;
}

.app-settings-info h3 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 4px;
}

.app-settings-info p {
    font-size: 14px;
    color: var(--text-secondary);
}

.app-settings-layout {
    display: flex;
    gap: 24px;
    min-height: 250px;
}

.app-settings-display-sidebar {
    width: 200px;
    flex-shrink: 0;
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-xl);
    padding: 12px;
}

.app-settings-display-sidebar .display-type-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: var(--transition);
    border: 1px solid transparent;
    font-size: 13px;
    color: var(--text-secondary);
}

.app-settings-display-sidebar .display-type-item:hover {
    background-color: var(--background-color);
}

.app-settings-display-sidebar .display-type-item.active {
    background-color: var(--ghost-bg);
    border-color: var(--ghost-border);
    color: var(--primary-color);
    font-weight: 500;
}

.app-settings-panel {
    flex: 1;
    padding: 16px;
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-xl);
}

/* Developer Apps Grid */
.developer-apps-grid {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 400px;
    overflow-y: auto;
}

.developer-app-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-xl);
    transition: var(--transition);
}

.developer-app-item:hover {
    border-color: var(--ghost-border);
    background-color: var(--ghost-bg);
}

.developer-app-info {
    flex: 1;
    min-width: 0;
}

.developer-app-category {
    font-size: 0.65em;
    color: var(--text-secondary);
}

.developer-app-item .dev-app-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    overflow: hidden;
    flex-shrink: 0;
}

.developer-app-item .dev-app-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 10px;
}

.developer-app-item .dev-app-info {
    flex: 1;
    min-width: 0;
}

.developer-app-item .dev-app-name {
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.developer-app-item .dev-app-action {
    flex-shrink: 0;
}

/* Toast */
.toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background-color: var(--text-primary);
    color: white;
    padding: 12px 24px;
    border-radius: var(--radius-full);
    box-shadow: var(--shadow-lg);
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 2000;
    font-size: 14px;
    font-weight: 500;
    letter-spacing: 0.01em;
}

.toast.active {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

/* Responsive */
@media (max-width: 1024px) {
    .sidebar {
        width: 60px;
    }

    .sidebar .logo-text,
    .sidebar .nav-item span:not(.material-icons) {
        display: none;
    }

    .main-content {
        margin-left: 60px;
    }

    .management-container {
        flex-direction: column;
    }

    .display-type-sidebar {
        width: 100%;
    }

    .display-type-list {
        flex-direction: row;
        flex-wrap: wrap;
    }

    .version-sections {
        grid-template-columns: 1fr;
    }

    .version-section:last-child {
        grid-column: span 1;
    }
}

@media (max-width: 768px) {
    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }

    .table-filters {
        flex-direction: column;
    }

    .configurations-toolbar {
        flex-direction: column;
        align-items: stretch;
        gap: 16px;
    }

    .toolbar-left {
        flex-direction: column;
        gap: 16px;
    }

    .toolbar-right {
        flex-direction: column;
        gap: 12px;
    }

    .toolbar-right .search-box {
        width: 100%;
    }

    .toolbar-right .action-buttons {
        justify-content: flex-end;
    }

    .autocomplete-container {
        min-width: 100%;
    }

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

    .device-frame.tablet.portrait {
        /* Maintain 884:1500 aspect ratio */
        width: 236px;
        height: 400px;
    }

    .device-frame.tablet.landscape {
        /* Maintain 1500:884 aspect ratio */
        width: 400px;
        height: 236px;
    }

    .device-frame.peterbilt-579.portrait {
        /* Maintain 1032:1500 aspect ratio */
        width: 275px;
        height: 400px;
    }

    .device-frame.kenworth-t680.landscape {
        /* Maintain 1500:640 aspect ratio, +50% size */
        width: 608px;
        height: 261px;
    }

}

/* Drag and Drop Styles */
.dragging {
    opacity: 0.4;
    transform: scale(0.95);
}

.drag-over {
    background-color: var(--primary-light) !important;
    border-color: var(--primary-color) !important;
}

.app-icon.drag-over {
    transform: scale(1.05);
    box-shadow: 0 0 0 2px var(--primary-color);
    border-radius: 14px;
}

.app-icon.dragging {
    opacity: 0.4;
}

.drag-clone {
    width: 70px;
    pointer-events: none;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.3));
}

/* Prevent text selection during drag */
.apps-grid {
    user-select: none;
    -webkit-user-select: none;
}

.app-icon {
    transition: transform 0.15s ease, opacity 0.15s ease, box-shadow 0.15s ease;
    touch-action: none;
}

/* Dark Theme Specific Overrides */
[data-theme="dark"] .search-box {
    background-color: var(--input-bg);
}

[data-theme="dark"] .search-box input,
[data-theme="dark"] .form-group input,
[data-theme="dark"] .form-group textarea,
[data-theme="dark"] .form-group select,
[data-theme="dark"] .date-range input,
[data-theme="dark"] .filter-group select,
[data-theme="dark"] .layout-selector select,
[data-theme="dark"] .dropdown-filters select,
[data-theme="dark"] .copy-from-display select {
    background-color: var(--input-bg);
    color: var(--text-primary);
    border-color: var(--input-border);
}

[data-theme="dark"] .date-range input[type="date"],
[data-theme="dark"] .form-group input[type="date"] {
    color-scheme: dark;
}

[data-theme="dark"] .autocomplete-field {
    background-color: var(--input-bg);
    border-color: var(--input-border);
}

[data-theme="dark"] .autocomplete-input {
    background-color: transparent;
    color: var(--text-primary);
}

[data-theme="dark"] .autocomplete-dropdown {
    background-color: var(--surface-color);
    border-color: var(--glass-border);
}

[data-theme="dark"] .autocomplete-option:hover {
    background-color: var(--background-color);
}

[data-theme="dark"] .autocomplete-option.selected {
    background-color: var(--primary-light);
    color: var(--primary-color);
}

[data-theme="dark"] .selected-chip {
    background-color: var(--ghost-bg);
    color: var(--primary-color);
    border-color: var(--ghost-border);
}

[data-theme="dark"] .selected-chip .remove-chip:hover {
    background-color: var(--primary-color);
    color: white;
}

[data-theme="dark"] .search-box input::placeholder,
[data-theme="dark"] .form-group input::placeholder,
[data-theme="dark"] .form-group textarea::placeholder {
    color: var(--text-muted);
}

[data-theme="dark"] .overflow-menu button {
    color: var(--text-primary);
}

[data-theme="dark"] .overflow-menu button.danger {
    color: var(--danger-color);
}

[data-theme="dark"] .status-badge.published {
    background-color: rgba(16, 185, 129, 0.15);
    color: var(--success-color);
    border-color: rgba(16, 185, 129, 0.30);
}

[data-theme="dark"] .available-app-card .added-chip,
[data-theme="dark"] .avail-detail-info .added-chip {
    background-color: rgba(16, 185, 129, 0.15);
    color: var(--success-color);
    border-color: rgba(16, 185, 129, 0.30);
}

[data-theme="dark"] .status-badge.draft {
    background-color: rgba(245, 158, 11, 0.15);
    color: var(--warning-color);
    border-color: rgba(245, 158, 11, 0.30);
}

[data-theme="dark"] .status-badge.active {
    background-color: rgba(16, 185, 129, 0.15);
    color: var(--success-color);
    border-color: rgba(16, 185, 129, 0.30);
}

[data-theme="dark"] .status-badge.inactive {
    background-color: rgba(148, 163, 184, 0.15);
    color: var(--text-secondary);
}

[data-theme="dark"] .library-item.added {
    background-color: rgba(16, 185, 129, 0.10);
    border-color: rgba(16, 185, 129, 0.30);
}

[data-theme="dark"] .json-status.valid {
    background-color: rgba(16, 185, 129, 0.15);
    color: var(--success-color);
}

[data-theme="dark"] .json-status.invalid {
    background-color: rgba(220, 38, 38, 0.15);
    color: var(--danger-color);
}

[data-theme="dark"] .toast {
    background-color: var(--surface-color);
    border: 1px solid var(--glass-border);
}

[data-theme="dark"] code {
    background-color: var(--code-bg);
    color: var(--primary-color);
}

/* Smooth theme transition */
body,
.sidebar,
.main-content,
.modal-content,
.form-section,
.table-container,
.search-box,
.btn,
.tab,
.card,
input,
select,
textarea {
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

/* ============================================================
   BASIC SETTINGS LAYOUT
   ============================================================ */

/* Three-row vertical layout */
.basic-settings-layout {
    display: flex;
    flex-direction: column;
    gap: 32px;
}

/* Row 1: 50/50 split — General Settings left, right column cards right */
.basic-settings-top-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 32px;
    align-items: stretch;
}

/* Right column: two stacked cards */
.basic-settings-right-col {
    display: flex;
    flex-direction: column;
    gap: 32px;
}

/* ---- Completion Card ---- */
.completion-card {
    display: flex;
    flex-direction: column;
}

.completion-checklist {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px 12px;
    margin-bottom: 16px;
    flex: 1;
}

.completion-item {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 13px;
    color: var(--text-secondary);
}

.completion-item.done {
    color: var(--text-primary);
}

.completion-item .material-icons {
    font-size: 16px;
    color: var(--text-muted);
    flex-shrink: 0;
}

.completion-item.done .material-icons {
    color: var(--success-color);
}

.completion-progress {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: auto;
}

.progress-bar-wrap {
    flex: 1;
    height: 6px;
    background-color: var(--background-color);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--search-btn-start), var(--search-btn-end));
    border-radius: var(--radius-full);
    transition: width 0.4s ease;
}

.progress-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    min-width: 32px;
    text-align: right;
}

/* ---- Displays Summary Card ---- */
.displays-summary-card {
    flex: 1;
    margin-top: -32px;
}

.card-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.card-header-row h3 {
    margin-bottom: 0;
}

.btn-sm {
    padding: 5px 12px;
    font-size: 12px;
}

/* Row 2: Background Image — preview-area IS the card */
.basic-bg-preview {
    min-height: 520px;
    margin-top: -32px;
}

/* "Background Image" label above the floating panel */
.preview-area > .bg-section-label {
    position: absolute;
    top: 18px;
    left: 16px;
    z-index: 10;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: 0.01em;
    pointer-events: none;
}

/* Floating display types panel — absolutely positioned top-left inside the preview area */
.preview-area > .bg-display-types-float {
    position: absolute;
    top: 50px;
    left: 16px;
    z-index: 10;
    width: 210px;
    background: var(--glass-bg);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-xl);
    padding: 14px 12px 10px;
    box-shadow: var(--shadow-md);
}

.bg-display-types-float h3 {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-secondary);
    margin-bottom: 10px;
}

/* Prevent display type names from wrapping inside the float panel */
.bg-display-types-float .display-type-item .type-name {
    white-space: nowrap;
}


.bg-upload-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Empty state inside device screen */
.bg-preview-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    gap: 8px;
    color: var(--text-secondary);
    font-size: 12px;
    text-align: center;
}

.bg-preview-empty .material-icons {
    font-size: 28px;
    color: var(--text-muted);
}

/* Row 3: Event Settings + Authentication — 50/50 grid */
.basic-settings-bottom-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 32px;
}

/* Empty state for displays chips */
.no-chips-msg {
    font-size: 13px;
    color: var(--text-muted);
}

/* Displays card — chips scaled 35% larger */
.displays-summary-card .display-chip {
    padding: 5px 14px;
    font-size: 16px;
}

.displays-summary-card .display-chip-logo {
    width: 27px;
    height: 27px;
    margin-right: 5px;
}

.displays-summary-card .display-chip-count {
    font-size: 15px;
    margin-left: 4px;
}

/* Background Image card — orientation buttons centered at top of preview */
#bg-preview-area .preview-header {
    justify-content: flex-end;
}

#bg-preview-area .preview-controls {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    z-index: 2;
}

/* Responsive: collapse to single column on narrow screens */
@media (max-width: 900px) {
    .basic-settings-top-row {
        grid-template-columns: 1fr;
    }

    .basic-settings-bottom-row {
        grid-template-columns: 1fr;
    }

    .basic-bg-preview {
        min-height: 420px;
    }
}

/* ============================================================
   INSIGHTS DASHBOARD
   ============================================================ */

.insights-dashboard {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 16px 0 24px;
}

/* --- Stat Cards Row --- */
.insights-stat-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.insights-stat-card {
    background: var(--surface-color);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 20px 24px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.insights-stat-top {
    display: flex;
    align-items: baseline;
    gap: 8px;
}

.insights-stat-pct {
    font-size: 32px;
    font-weight: 700;
    line-height: 1;
}

.insights-stat-green { color: #10b981; }
.insights-stat-amber { color: #f59e0b; }

.insights-stat-label {
    font-size: 13px;
    color: var(--text-secondary);
}

.insights-stat-bar {
    height: 6px;
    background: var(--input-border);
    border-radius: 3px;
    margin-top: 4px;
}

.insights-stat-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.4s ease;
}

.insights-fill-green {
    background: linear-gradient(to right, #059669, #34d399);
    box-shadow: 3px 0 10px rgba(52, 211, 153, 0.65);
}

.insights-fill-amber {
    background: linear-gradient(to right, #b45309, #fbbf24);
    box-shadow: 3px 0 10px rgba(251, 191, 36, 0.65);
}

.insights-stat-link {
    font-size: 12px;
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
    margin-top: 2px;
    width: fit-content;
}

.insights-stat-link:hover { text-decoration: underline; }

/* --- Generic Card --- */
.insights-card {
    background: var(--surface-color);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 20px 24px;
}

.insights-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    gap: 16px;
}

.insights-card-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

/* --- Network Chart --- */
.insights-chart-stats {
    display: flex;
    gap: 24px;
    flex-shrink: 0;
}

.insights-chart-stat {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
}

.insights-chart-stat-val {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
}

.insights-chart-stat-lbl {
    font-size: 11px;
    color: var(--text-secondary);
    white-space: nowrap;
}

.insights-chart-wrap {
    width: 100%;
    overflow: hidden;
}

.insights-network-chart {
    width: 100%;
    height: 185px;
    display: block;
}

.insights-chart-legend {
    display: flex;
    gap: 20px;
    margin-top: 10px;
    justify-content: center;
}

.insights-legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--text-secondary);
}

.insights-legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.insights-legend-green { background: #10b981; }
.insights-legend-cyan  { background: #30baff; }

/* --- Two-column row --- */
.insights-two-col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

/* --- Top 5 Table --- */
.insights-top5-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.insights-top5-table thead th {
    text-align: left;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    padding: 0 8px 10px 8px;
    border-bottom: 1px solid var(--border-solid);
}

.insights-top5-table thead th:first-child { padding-left: 0; }

.insights-top5-table tbody tr {
    border-bottom: 1px solid var(--border-solid, rgba(0,0,0,0.06));
}

.insights-top5-table tbody tr:last-child { border-bottom: none; }

.insights-top5-table tbody td {
    padding: 10px 8px;
    color: var(--text-primary);
}

.insights-top5-table tbody td:first-child {
    padding-left: 0;
    color: var(--text-secondary);
    font-weight: 600;
}

.insights-device-id {
    font-family: monospace;
    font-size: 12px;
    color: var(--text-secondary) !important;
}

.insights-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
}

.insights-badge-high {
    background: rgba(239,68,68,0.12);
    color: #ef4444;
}

.insights-badge-med {
    background: rgba(245,158,11,0.12);
    color: #f59e0b;
}

/* --- Active vs Inactive Chart --- */
.insights-av-wrap {
    display: flex;
    gap: 16px;
    align-items: flex-start;
}

.insights-av-chart {
    flex: 1;
    min-width: 0;
}

.insights-av-chart svg {
    width: 100%;
    height: 140px;
    display: block;
}

.insights-av-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px 20px;
    flex-shrink: 0;
    padding-top: 8px;
}

.insights-av-stat {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.insights-av-val {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
}

.insights-av-green { color: #10b981; }

.insights-av-lbl {
    font-size: 11px;
    color: var(--text-secondary);
    white-space: nowrap;
}

/* --- Fleet Coverage --- */
.insights-fleet-wrap {
    display: flex;
    gap: 0;
}

.insights-fleet-divider {
    width: 1px;
    background: var(--border-solid);
    margin: 0 28px;
    flex-shrink: 0;
}

.insights-fleet-section {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.insights-fleet-section-title {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    padding-bottom: 4px;
    border-bottom: 1px solid var(--border-solid);
}

.insights-fleet-item {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.insights-fleet-item-meta {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
}

.insights-fleet-name {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.insights-fleet-counts {
    font-size: 11px;
    color: var(--text-secondary);
    flex-shrink: 0;
    white-space: nowrap;
}

.insights-fleet-count-active { color: #10b981; font-weight: 500; }
.insights-fleet-count-inactive { color: var(--text-secondary); }

.insights-fleet-bar-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.insights-fleet-bar-track {
    flex: 1;
    height: 8px;
    background: var(--input-border);
    border-radius: 4px;
}

.insights-fleet-bar-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.4s ease;
}

.insights-fleet-fill-blue {
    background: linear-gradient(to right, #0369a1, #38bdf8);
    box-shadow: 4px 0 12px rgba(56, 189, 248, 0.6);
}

.insights-fleet-fill-green {
    background: linear-gradient(to right, #059669, #34d399);
    box-shadow: 4px 0 12px rgba(52, 211, 153, 0.6);
}

.insights-fleet-pct {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-primary);
    width: 38px;
    text-align: right;
    flex-shrink: 0;
}

/* Dark theme overrides */
[data-theme="dark"] .insights-stat-card,
[data-theme="dark"] .insights-card {
    background: var(--surface-color);
    border-color: var(--glass-border);
}

[data-theme="dark"] .insights-top5-table thead th,
[data-theme="dark"] .insights-top5-table tbody tr {
    border-color: rgba(255,255,255,0.07);
}

[data-theme="dark"] .insights-fleet-divider,
[data-theme="dark"] .insights-fleet-section-title {
    border-color: rgba(255,255,255,0.07);
}

[data-theme="dark"] .insights-stat-bar,
[data-theme="dark"] .insights-fleet-bar-track {
    background: rgba(255,255,255,0.08);
}

/* Responsive */
@media (max-width: 900px) {
    .insights-stat-row,
    .insights-two-col {
        grid-template-columns: 1fr;
    }

    .insights-fleet-wrap {
        flex-direction: column;
    }

    .insights-fleet-divider {
        width: 100%;
        height: 1px;
        margin: 8px 0;
    }

    .insights-chart-stats {
        flex-direction: column;
        align-items: flex-start;
    }

    .insights-chart-stat { align-items: flex-start; }
}

/* ============================================================
   VEHICLE APP WIDGET — System widget, always available
   ============================================================ */

.vehicle-app-widget {
    width: 100%;
    height: 100%;
    position: relative;
    background: #262626;
    border-radius: 12px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: stretch !important;
}

/* Glass blur card border overlay */
.vaw-card-bg {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(30px);
    -webkit-backdrop-filter: blur(30px);
    border: 1px solid #333;
    border-radius: inherit;
    z-index: 0;
    pointer-events: none;
}

/* Truck image — absolute, centered with mask gradient */
.vaw-truck-bg {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 110%;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    z-index: 1;
    -webkit-mask-image: linear-gradient(
        to bottom,
        transparent 0%,
        rgba(0,0,0,0.6) 12%,
        rgba(0,0,0,1) 30%,
        rgba(0,0,0,1) 62%,
        rgba(0,0,0,0.4) 82%,
        transparent 100%
    );
    mask-image: linear-gradient(
        to bottom,
        transparent 0%,
        rgba(0,0,0,0.6) 12%,
        rgba(0,0,0,1) 30%,
        rgba(0,0,0,1) 62%,
        rgba(0,0,0,0.4) 82%,
        transparent 100%
    );
}

.vaw-truck-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    display: block;
}

/* Content sits on top */
.vaw-content {
    position: relative;
    z-index: 2;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    align-items: flex-start;
    padding: 14px;
}

/* Status icons row — always bottom-left */
.vaw-status-row {
    display: flex;
    flex-direction: row;
    gap: 4px;
    align-items: center;
}

.vaw-icon {
    width: 22px;
    height: 22px;
    object-fit: contain;
    display: block;
    flex-shrink: 0;
}

/* === Portrait variant (large-top, large-left, half-vertical) ===
   Truck centered, fills most of height */
.vehicle-app-widget.vaw-portrait .vaw-truck-bg {
    width: 105%;
    left: 50%;
    transform: translateX(-50%);
    align-items: center;
    -webkit-mask-image: linear-gradient(
        to bottom,
        transparent 0%,
        rgba(0,0,0,0.5) 8%,
        rgba(0,0,0,1) 22%,
        rgba(0,0,0,1) 68%,
        rgba(0,0,0,0.3) 86%,
        transparent 100%
    );
    mask-image: linear-gradient(
        to bottom,
        transparent 0%,
        rgba(0,0,0,0.5) 8%,
        rgba(0,0,0,1) 22%,
        rgba(0,0,0,1) 68%,
        rgba(0,0,0,0.3) 86%,
        transparent 100%
    );
}

.vehicle-app-widget.vaw-portrait .vaw-truck-img {
    object-fit: contain;
    width: 100%;
    height: auto;
    max-height: 100%;
}

.vehicle-app-widget.vaw-portrait .vaw-icon {
    width: 26px;
    height: 26px;
}

/* === Landscape variant (half, quarter, preview) ===
   Truck right-aligned, content sits left */
.vehicle-app-widget.vaw-landscape .vaw-truck-bg {
    left: auto;
    right: -5%;
    transform: none;
    width: 70%;
    -webkit-mask-image: none;
    mask-image: none;
}

.vehicle-app-widget.vaw-landscape .vaw-truck-img {
    object-fit: cover;
    object-position: left center;
    width: 100%;
    height: 100%;
}

/* === Small variant (widget-small-*) ===
   Compact — smaller buttons, truck shifted right */
.vehicle-app-widget.vaw-small .vaw-truck-bg {
    left: auto;
    right: -8%;
    transform: none;
    width: 65%;
    -webkit-mask-image: none;
    mask-image: none;
}

.vehicle-app-widget.vaw-small .vaw-content {
    padding: 10px;
}

.vehicle-app-widget.vaw-small .vaw-icon {
    width: 17px;
    height: 17px;
}

/* Preview in widget library */
.widget-preview-container .vehicle-app-widget .vaw-truck-bg {
    left: auto;
    right: -5%;
    transform: none;
    width: 65%;
}

.widget-preview-container .vehicle-app-widget .vaw-icon {
    width: 16px;
    height: 16px;
}
