:root {
    /* Google Pixel / Material Design 3 Light Palette */
    --md-sys-color-primary: #0b57d0;
    --md-sys-color-on-primary: #ffffff;
    --md-sys-color-primary-container: #d3e3fd;
    --md-sys-color-on-primary-container: #041e49;
    --md-sys-color-primary-hover: #0842a0;

    --md-sys-color-secondary: #00639b;
    --md-sys-color-on-secondary: #ffffff;
    --md-sys-color-secondary-container: #c2e7ff;
    --md-sys-color-on-secondary-container: #001d32;

    --md-sys-color-tertiary: #6750a4;
    --md-sys-color-tertiary-container: #eaddff;
    --md-sys-color-on-tertiary-container: #21005d;

    --md-sys-color-surface: #f8fafd;
    --md-sys-color-surface-dim: #edeef2;
    --md-sys-color-surface-bright: #ffffff;
    --md-sys-color-surface-container-lowest: #ffffff;
    --md-sys-color-surface-container-low: #f3f4f8;
    --md-sys-color-surface-container: #eef1f6;
    --md-sys-color-surface-container-high: #e7ebf2;
    --md-sys-color-surface-container-highest: #e0e4eb;

    --md-sys-color-on-surface: #191c20;
    --md-sys-color-on-surface-variant: #44474e;
    --md-sys-color-outline: #74777f;
    --md-sys-color-outline-variant: #c4c7d0;

    --md-sys-color-error: #ba1a1a;
    --md-sys-color-on-error: #ffffff;
    --md-sys-color-error-container: #ffdad6;
    --md-sys-color-on-error-container: #410002;

    --md-sys-color-success: #146c2e;
    --md-sys-color-on-success: #ffffff;
    --md-sys-color-success-container: #c4eed0;
    --md-sys-color-on-success-container: #00210b;

    --md-sys-color-warning: #995a00;
    --md-sys-color-warning-container: #ffddb7;
    --md-sys-color-on-warning-container: #2f1500;

    /* Shapes & Radii */
    --md-shape-xs: 4px;
    --md-shape-s: 8px;
    --md-shape-m: 12px;
    --md-shape-l: 16px;
    --md-shape-xl: 20px;
    --md-shape-2xl: 24px;
    --md-shape-full: 9999px;

    /* Typography */
    --md-font-family: "Google Sans", "Product Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --md-font-mono: "Google Sans Mono", "Roboto Mono", Consolas, Monaco, monospace;

    /* Elevations & Shadows */
    --md-elevation-1: 0 1px 3px 1px rgba(0, 0, 0, 0.07), 0 1px 2px 0 rgba(0, 0, 0, 0.04);
    --md-elevation-2: 0 2px 6px 2px rgba(0, 0, 0, 0.08), 0 1px 2px 0 rgba(0, 0, 0, 0.04);
    --md-elevation-3: 0 4px 14px 3px rgba(0, 0, 0, 0.08), 0 1px 3px 0 rgba(0, 0, 0, 0.05);
    --md-elevation-4: 0 8px 24px 4px rgba(0, 0, 0, 0.10), 0 2px 6px 0 rgba(0, 0, 0, 0.06);

    /* Transitions */
    --md-motion-easing: cubic-bezier(0.2, 0, 0, 1);
    --md-motion-duration-short: 150ms;
    --md-motion-duration-medium: 250ms;
}

/* Dark Mode Palette (Pixel Slate Theme) */
@media (prefers-color-scheme: dark) {
    :root {
        --md-sys-color-primary: #a8c7fa;
        --md-sys-color-on-primary: #042e6f;
        --md-sys-color-primary-container: #0842a0;
        --md-sys-color-on-primary-container: #d3e3fd;
        --md-sys-color-primary-hover: #b8d4fc;

        --md-sys-color-secondary: #7fcfff;
        --md-sys-color-on-secondary: #003453;
        --md-sys-color-secondary-container: #004b75;
        --md-sys-color-on-secondary-container: #c2e7ff;

        --md-sys-color-tertiary: #d0bcff;
        --md-sys-color-tertiary-container: #4f378b;
        --md-sys-color-on-tertiary-container: #eaddff;

        --md-sys-color-surface: #121316;
        --md-sys-color-surface-dim: #121316;
        --md-sys-color-surface-bright: #38393d;
        --md-sys-color-surface-container-lowest: #0d0e11;
        --md-sys-color-surface-container-low: #1a1b1f;
        --md-sys-color-surface-container: #1e1f23;
        --md-sys-color-surface-container-high: #282a2e;
        --md-sys-color-surface-container-highest: #333539;

        --md-sys-color-on-surface: #e2e2e6;
        --md-sys-color-on-surface-variant: #c4c7d0;
        --md-sys-color-outline: #8e919a;
        --md-sys-color-outline-variant: #44474e;

        --md-sys-color-error: #ffb4ab;
        --md-sys-color-on-error: #690005;
        --md-sys-color-error-container: #93000a;
        --md-sys-color-on-error-container: #ffdad6;

        --md-sys-color-success: #6dd58c;
        --md-sys-color-on-success: #003914;
        --md-sys-color-success-container: #085320;
        --md-sys-color-on-success-container: #c4eed0;

        --md-sys-color-warning: #ffb870;
        --md-sys-color-warning-container: #6e3d00;
        --md-sys-color-on-warning-container: #ffddb7;

        --md-elevation-1: 0 1px 3px 1px rgba(0, 0, 0, 0.25);
        --md-elevation-2: 0 2px 6px 2px rgba(0, 0, 0, 0.35);
        --md-elevation-3: 0 4px 14px 3px rgba(0, 0, 0, 0.45);
        --md-elevation-4: 0 8px 24px 4px rgba(0, 0, 0, 0.55);
    }
}

/* Global Reset & Base Styles */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

html, body {
    width: 100%;
    min-height: 100vh;
    overflow-x: hidden;
}

body {
    font-family: var(--md-font-family);
    background-color: var(--md-sys-color-surface);
    color: var(--md-sys-color-on-surface);
    line-height: 1.5;
    display: flex;
    flex-direction: column;
    padding: 0;
    margin: 0;
    -webkit-font-smoothing: antialiased;
}

/* App Header (Pixel Top Bar) - Mobile First */
.app-header {
    background-color: var(--md-sys-color-surface-container);
    border-bottom: 1px solid var(--md-sys-color-outline-variant);
    padding: 12px 14px;
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(16px);
}

.header-container {
    width: 100%;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
}

.brand-section {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
}

.brand-logo {
    width: 38px;
    height: 38px;
    background: linear-gradient(135deg, #1a73e8, #34a853, #fbbc04, #ea4335);
    border-radius: var(--md-shape-m);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    box-shadow: 0 2px 8px rgba(26, 115, 232, 0.3);
    flex-shrink: 0;
}

.brand-logo svg {
    width: 22px;
    height: 22px;
    fill: currentColor;
}

.brand-text h1 {
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: -0.3px;
    color: var(--md-sys-color-on-surface);
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.brand-badge {
    font-size: 0.68rem;
    font-weight: 600;
    background-color: var(--md-sys-color-primary-container);
    color: var(--md-sys-color-on-primary-container);
    padding: 1px 7px;
    border-radius: var(--md-shape-full);
    letter-spacing: 0.3px;
    text-transform: uppercase;
}

.brand-subtitle {
    font-size: 0.75rem;
    color: var(--md-sys-color-on-surface-variant);
}

/* Header Controls & Status Pill */
.header-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
}

.device-status-pill {
    display: inline-flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    background-color: var(--md-sys-color-surface-container-high);
    border: 1px solid var(--md-sys-color-outline-variant);
    padding: 6px 12px;
    border-radius: var(--md-shape-full);
    font-size: 0.82rem;
    color: var(--md-sys-color-on-surface);
    width: 100%;
}

.header-btn-group {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    width: 100%;
}

.header-btn-group button {
    width: 100%;
    justify-content: center;
    padding: 8px 10px;
    font-size: 0.82rem;
}

.pulse-dot {
    width: 8px;
    height: 8px;
    background-color: #34a853;
    border-radius: 50%;
    display: inline-block;
    box-shadow: 0 0 0 0 rgba(52, 168, 83, 0.7);
    animation: pulse 2s infinite;
    flex-shrink: 0;
}

.pulse-dot.offline {
    background-color: var(--md-sys-color-outline);
    box-shadow: none;
    animation: none;
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(52, 168, 83, 0.7);
    }
    70% {
        box-shadow: 0 0 0 8px rgba(52, 168, 83, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(52, 168, 83, 0);
    }
}

/* Main Layout Grid - Mobile First (Single Column Full Width) */
.main-content {
    width: 100%;
    margin: 10px auto;
    padding: 0 12px 24px 12px;
    flex: 1;
}

.dashboard-grid {
    display: flex;
    flex-direction: column;
    gap: 14px;
    width: 100%;
}

.col-left, .col-right {
    display: contents; /* Mobile: flatten columns so individual cards stack neatly in priority order */
}

/* Mobile Ordering (Send & Inbox First, then Fleet & Approvals) */
.card-send {
    order: 1;
}

.card-inbox {
    order: 2;
}

.card-devices {
    order: 3;
}

.card-pairings {
    order: 4;
}

/* Material 3 Pixel Cards */
.m3-card {
    background-color: var(--md-sys-color-surface-container-lowest);
    border-radius: var(--md-shape-xl);
    border: 1px solid var(--md-sys-color-outline-variant);
    padding: 16px;
    box-shadow: var(--md-elevation-1);
    transition: box-shadow var(--md-motion-duration-medium) var(--md-motion-easing),
                border-color var(--md-motion-duration-short) var(--md-motion-easing);
    position: relative;
    width: 100%;
}

.m3-card:hover {
    box-shadow: var(--md-elevation-2);
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
    gap: 10px;
}

.card-title-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.card-icon {
    width: 34px;
    height: 34px;
    border-radius: var(--md-shape-m);
    background-color: var(--md-sys-color-primary-container);
    color: var(--md-sys-color-on-primary-container);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.card-icon svg {
    width: 18px;
    height: 18px;
    fill: currentColor;
}

.card-title {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--md-sys-color-on-surface);
}

.card-badge {
    font-size: 0.72rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: var(--md-shape-full);
    background-color: var(--md-sys-color-surface-container-highest);
    color: var(--md-sys-color-on-surface-variant);
}

/* Buttons (Material You Pill Style) */
button, .m3-btn {
    font-family: var(--md-font-family);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 18px;
    border-radius: var(--md-shape-full);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    border: none;
    outline: none;
    transition: all var(--md-motion-duration-short) var(--md-motion-easing);
    user-select: none;
    text-decoration: none;
    white-space: nowrap;
    min-height: 40px;
}

button:active, .m3-btn:active {
    transform: scale(0.98);
}

button svg, .m3-btn svg {
    width: 18px;
    height: 18px;
    fill: currentColor;
}

/* Filled Button (Primary) */
.btn-filled, button:not([class*="btn-"]) {
    background-color: var(--md-sys-color-primary);
    color: var(--md-sys-color-on-primary);
}

.btn-filled:hover, button:not([class*="btn-"]):hover {
    background-color: var(--md-sys-color-primary-hover);
    box-shadow: var(--md-elevation-1);
}

/* Tonal Button */
.btn-tonal {
    background-color: var(--md-sys-color-secondary-container);
    color: var(--md-sys-color-on-secondary-container);
}

.btn-tonal:hover {
    background-color: #b3deff;
    box-shadow: var(--md-elevation-1);
}

/* Outlined Button */
.btn-outlined {
    background-color: transparent;
    border: 1px solid var(--md-sys-color-outline-variant);
    color: var(--md-sys-color-primary);
}

.btn-outlined:hover {
    background-color: var(--md-sys-color-primary-container);
    border-color: var(--md-sys-color-primary);
}

/* Danger / Delete Button */
.btn-danger {
    background-color: transparent;
    color: var(--md-sys-color-error);
    border: 1px solid var(--md-sys-color-error-container);
}

.btn-danger:hover {
    background-color: var(--md-sys-color-error-container);
    color: var(--md-sys-color-on-error-container);
}

/* Small Action Button */
.btn-sm {
    padding: 6px 12px;
    font-size: 0.82rem;
    min-height: 34px;
    border-radius: var(--md-shape-full);
}

/* Icon Button */
.btn-icon {
    width: 36px;
    height: 36px;
    min-height: 36px;
    padding: 0;
    border-radius: var(--md-shape-full);
    background-color: var(--md-sys-color-surface-container);
    color: var(--md-sys-color-on-surface-variant);
    border: 1px solid transparent;
}

.btn-icon:hover {
    background-color: var(--md-sys-color-surface-container-highest);
    color: var(--md-sys-color-on-surface);
}

button:disabled, .m3-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

/* Status & Banner Containers */
#pairStatus, #identity {
    transition: all var(--md-motion-duration-medium) var(--md-motion-easing);
}

.pixel-banner {
    background: linear-gradient(135deg, var(--md-sys-color-primary-container), var(--md-sys-color-secondary-container));
    border: 1px solid var(--md-sys-color-outline-variant);
    border-radius: var(--md-shape-l);
    padding: 14px 16px;
    margin: 8px 0 12px 0;
    color: var(--md-sys-color-on-primary-container);
    display: flex;
    flex-direction: column;
    gap: 10px;
    animation: fadeIn 0.3s ease;
}

.pixel-banner-header {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    font-size: 0.95rem;
}

.pairing-code-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background-color: var(--md-sys-color-surface-container-lowest);
    color: var(--md-sys-color-primary);
    font-family: var(--md-font-mono);
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: 4px;
    padding: 8px 18px;
    border-radius: var(--md-shape-l);
    border: 2px dashed var(--md-sys-color-primary);
    margin: 4px 0;
    user-select: all;
    box-shadow: var(--md-elevation-1);
}

/* Form Controls & Dropdowns */
.form-group {
    margin-bottom: 14px;
}

.form-label {
    display: block;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--md-sys-color-on-surface-variant);
    margin-bottom: 6px;
}

.m3-select-wrapper {
    position: relative;
    width: 100%;
}

select, .m3-select {
    width: 100%;
    padding: 12px 16px;
    padding-right: 40px;
    border-radius: var(--md-shape-l);
    border: 1.5px solid var(--md-sys-color-outline-variant);
    background-color: var(--md-sys-color-surface-container-low);
    color: var(--md-sys-color-on-surface);
    font-family: var(--md-font-family);
    font-size: 0.92rem;
    font-weight: 400;
    appearance: none;
    outline: none;
    cursor: pointer;
    transition: all var(--md-motion-duration-short) var(--md-motion-easing);
}

select:focus, .m3-select:focus {
    border-color: var(--md-sys-color-primary);
    background-color: var(--md-sys-color-surface-container-lowest);
    box-shadow: 0 0 0 3px var(--md-sys-color-primary-container);
}

.select-arrow {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
    color: var(--md-sys-color-on-surface-variant);
    display: flex;
    align-items: center;
}

.select-arrow svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

input[type="text"], input[type="number"], .m3-input {
    width: 100%;
    padding: 10px 14px;
    border-radius: var(--md-shape-m);
    border: 1.5px solid var(--md-sys-color-outline-variant);
    background-color: var(--md-sys-color-surface-container-low);
    color: var(--md-sys-color-on-surface);
    font-family: var(--md-font-family);
    font-size: 0.9rem;
    outline: none;
    transition: all var(--md-motion-duration-short) var(--md-motion-easing);
}

input:focus, .m3-input:focus {
    border-color: var(--md-sys-color-primary);
    background-color: var(--md-sys-color-surface-container-lowest);
    box-shadow: 0 0 0 3px var(--md-sys-color-primary-container);
}

/* Drag & Drop File Upload Zone */
.dropzone {
    border: 2px dashed var(--md-sys-color-outline-variant);
    border-radius: var(--md-shape-l);
    background-color: var(--md-sys-color-surface-container-low);
    padding: 24px 14px;
    text-align: center;
    cursor: pointer;
    transition: all var(--md-motion-duration-medium) var(--md-motion-easing);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    position: relative;
    overflow: hidden;
}

.dropzone:hover, .dropzone.dragover {
    border-color: var(--md-sys-color-primary);
    background-color: var(--md-sys-color-primary-container);
    transform: translateY(-2px);
}

.dropzone-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background-color: var(--md-sys-color-surface-container-highest);
    color: var(--md-sys-color-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform var(--md-motion-duration-short) var(--md-motion-easing);
}

.dropzone:hover .dropzone-icon {
    transform: scale(1.1);
    background-color: var(--md-sys-color-surface-container-lowest);
}

.dropzone-icon svg {
    width: 26px;
    height: 26px;
    fill: currentColor;
}

.dropzone-text {
    font-size: 0.92rem;
    font-weight: 500;
    color: var(--md-sys-color-on-surface);
}

.dropzone-hint {
    font-size: 0.78rem;
    color: var(--md-sys-color-on-surface-variant);
}

.selected-file-card {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background-color: var(--md-sys-color-surface-container-lowest);
    border: 1px solid var(--md-sys-color-outline-variant);
    border-radius: var(--md-shape-l);
    padding: 12px 14px;
    margin-top: 8px;
    gap: 10px;
}

.file-info-group {
    display: flex;
    align-items: center;
    gap: 10px;
    overflow: hidden;
}

.file-name-text {
    font-weight: 600;
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--md-sys-color-on-surface);
}

.file-size-tag {
    font-size: 0.76rem;
    color: var(--md-sys-color-on-surface-variant);
    background-color: var(--md-sys-color-surface-container-high);
    padding: 2px 6px;
    border-radius: var(--md-shape-s);
}

/* Progress Bars (Pixel Rounded Pill) */
.m3-progress-container {
    margin-top: 12px;
    background-color: var(--md-sys-color-surface-container-low);
    border: 1px solid var(--md-sys-color-outline-variant);
    border-radius: var(--md-shape-l);
    padding: 12px 14px;
    animation: fadeIn 0.25s ease;
}

.progress-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.84rem;
    font-weight: 500;
    margin-bottom: 8px;
    color: var(--md-sys-color-on-surface);
}

.m3-progress-track {
    height: 8px;
    background-color: var(--md-sys-color-surface-container-highest);
    border-radius: var(--md-shape-full);
    overflow: hidden;
    position: relative;
}

.m3-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #1a73e8, #4285f4);
    border-radius: var(--md-shape-full);
    width: 0%;
    transition: width 0.2s linear;
}

.m3-progress-fill.indeterminate {
    width: 50%;
    animation: indeterminate 1.5s infinite linear;
}

@keyframes indeterminate {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(250%); }
}

/* Device & Inbox List Items */
.item-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 420px;
    overflow-y: auto;
    padding-right: 2px;
}

.item-list::-webkit-scrollbar {
    width: 5px;
}

.item-list::-webkit-scrollbar-thumb {
    background-color: var(--md-sys-color-outline-variant);
    border-radius: var(--md-shape-full);
}

.m3-list-item {
    background-color: var(--md-sys-color-surface-container-low);
    border: 1px solid var(--md-sys-color-outline-variant);
    border-radius: var(--md-shape-l);
    padding: 12px 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    transition: all var(--md-motion-duration-short) var(--md-motion-easing);
    flex-wrap: wrap; /* Mobile wrap protection */
}

.m3-list-item:hover {
    background-color: var(--md-sys-color-surface-container);
    border-color: var(--md-sys-color-primary-container);
    transform: translateY(-1px);
    box-shadow: var(--md-elevation-1);
}

.item-left {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    flex: 1 1 auto;
}

.item-avatar {
    width: 36px;
    height: 36px;
    border-radius: var(--md-shape-m);
    background-color: var(--md-sys-color-surface-container-highest);
    color: var(--md-sys-color-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.item-avatar svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

.item-details {
    min-width: 0;
    flex: 1;
}

.item-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--md-sys-color-on-surface);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: flex;
    align-items: center;
    gap: 6px;
}

.item-subtitle {
    font-size: 0.78rem;
    color: var(--md-sys-color-on-surface-variant);
    display: flex;
    align-items: center;
    gap: 6px;
    font-family: var(--md-font-mono);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.item-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
    justify-content: flex-end;
}

/* Status Chips */
.status-chip {
    font-size: 0.72rem;
    font-weight: 600;
    padding: 2px 7px;
    border-radius: var(--md-shape-full);
    display: inline-flex;
    align-items: center;
    gap: 4px;
    letter-spacing: 0.2px;
}

.status-chip.success {
    background-color: var(--md-sys-color-success-container);
    color: var(--md-sys-color-on-success-container);
}

.status-chip.pending {
    background-color: var(--md-sys-color-warning-container);
    color: var(--md-sys-color-on-warning-container);
}

.status-chip.error {
    background-color: var(--md-sys-color-error-container);
    color: var(--md-sys-color-on-error-container);
}

.status-chip.primary {
    background-color: var(--md-sys-color-primary-container);
    color: var(--md-sys-color-on-primary-container);
}

/* Empty State */
.empty-state {
    padding: 24px 14px;
    text-align: center;
    color: var(--md-sys-color-on-surface-variant);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.empty-state svg {
    width: 36px;
    height: 36px;
    fill: var(--md-sys-color-outline-variant);
    margin-bottom: 2px;
}

.empty-title {
    font-weight: 500;
    font-size: 0.92rem;
}

.empty-subtitle {
    font-size: 0.78rem;
    color: var(--md-sys-color-outline);
}

/* Toast / Floating Snackbar (Pixel Pill) */
.toast-container {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    pointer-events: none;
    width: 90%;
    max-width: 420px;
}

.toast {
    background-color: var(--md-sys-color-on-surface);
    color: var(--md-sys-color-surface);
    padding: 10px 20px;
    border-radius: var(--md-shape-full);
    font-size: 0.88rem;
    font-weight: 500;
    box-shadow: var(--md-elevation-3);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    pointer-events: auto;
    animation: toastSlideUp 0.3s var(--md-motion-easing);
    transition: opacity 0.3s ease, transform 0.3s ease;
    width: 100%;
    text-align: center;
}

.toast.toast-success {
    background-color: #1e8e3e;
    color: #ffffff;
}

.toast.toast-error {
    background-color: #d93025;
    color: #ffffff;
}

.toast svg {
    width: 18px;
    height: 18px;
    fill: currentColor;
    flex-shrink: 0;
}

@keyframes toastSlideUp {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Copy Button Snippet */
.copy-btn {
    background: none;
    border: none;
    padding: 4px;
    color: var(--md-sys-color-outline);
    border-radius: 50%;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: color 0.15s ease, background-color 0.15s ease;
    min-height: unset;
}

.copy-btn:hover {
    color: var(--md-sys-color-primary);
    background-color: var(--md-sys-color-surface-container-highest);
}

.copy-btn svg {
    width: 16px;
    height: 16px;
}

/* ==================== Tablet & Desktop Media Queries ==================== */
@media (min-width: 480px) {
    .m3-list-item {
        flex-wrap: nowrap;
    }
    .item-left {
        flex: 1;
    }
    .item-actions {
        width: auto;
    }
}

@media (min-width: 860px) {
    .app-header {
        padding: 14px 24px;
    }

    .header-container {
        max-width: 1200px;
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        gap: 16px;
    }

    .brand-section {
        width: auto;
        gap: 12px;
    }

    .brand-logo {
        width: 44px;
        height: 44px;
        border-radius: var(--md-shape-l);
    }

    .brand-logo svg {
        width: 26px;
        height: 26px;
    }

    .brand-text h1 {
        font-size: 1.35rem;
        gap: 8px;
    }

    .brand-badge {
        font-size: 0.72rem;
        padding: 2px 8px;
    }

    .brand-subtitle {
        font-size: 0.82rem;
    }

    .header-actions {
        flex-direction: row;
        align-items: center;
        gap: 10px;
        width: auto;
    }

    .device-status-pill {
        width: auto;
        padding: 6px 14px;
        font-size: 0.85rem;
    }

    .header-btn-group {
        display: flex;
        width: auto;
        gap: 10px;
    }

    .header-btn-group button {
        width: auto;
        padding: 6px 14px;
        font-size: 0.84rem;
    }

    /* Main Content Desktop 2-Column Grid */
    .main-content {
        max-width: 1200px;
        margin: 24px auto;
        padding: 0 20px;
    }

    .dashboard-grid {
        display: grid;
        grid-template-columns: 5fr 7fr;
        gap: 20px;
    }

    .col-left {
        display: flex;
        flex-direction: column;
        gap: 20px;
        order: 1;
    }

    .col-right {
        display: flex;
        flex-direction: column;
        gap: 20px;
        order: 2;
    }

    .card-devices, .card-pairings, .card-send, .card-inbox {
        order: unset;
    }

    .m3-card {
        padding: 22px;
        border-radius: var(--md-shape-2xl);
    }

    .dropzone {
        padding: 32px 20px;
        border-radius: var(--md-shape-xl);
    }

    .toast-container {
        width: auto;
        max-width: 500px;
        bottom: 24px;
    }

    .toast {
        width: auto;
        padding: 12px 24px;
        font-size: 0.9rem;
    }
}

/* ==================== M3 Modal Dialog ==================== */
.m3-modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 16px;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--md-motion-duration-medium) var(--md-motion-easing);
}

.m3-modal-backdrop.active {
    opacity: 1;
    pointer-events: auto;
}

.m3-modal-card {
    background-color: var(--md-sys-color-surface-container-high);
    color: var(--md-sys-color-on-surface);
    border-radius: var(--md-shape-2xl);
    padding: 24px;
    max-width: 440px;
    width: 100%;
    box-shadow: var(--md-elevation-4);
    transform: scale(0.92);
    transition: transform var(--md-motion-duration-medium) var(--md-motion-easing);
}

.m3-modal-backdrop.active .m3-modal-card {
    transform: scale(1);
}

.m3-modal-header {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    margin-bottom: 20px;
}

.m3-modal-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--md-shape-m);
    background-color: var(--md-sys-color-primary-container);
    color: var(--md-sys-color-on-primary-container);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.m3-modal-icon svg {
    width: 22px;
    height: 22px;
    fill: currentColor;
}

.m3-modal-title {
    font-size: 1.15rem;
    font-weight: 600;
    margin: 0 0 4px 0;
    color: var(--md-sys-color-on-surface);
}

.m3-modal-subtitle {
    font-size: 0.82rem;
    color: var(--md-sys-color-on-surface-variant);
    margin: 0;
    line-height: 1.4;
}

.m3-modal-body {
    margin-bottom: 24px;
}

.m3-input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--md-sys-color-outline-variant);
    background-color: var(--md-sys-color-surface);
    color: var(--md-sys-color-on-surface);
    border-radius: var(--md-shape-m);
    font-size: 0.95rem;
    font-family: inherit;
    box-sizing: border-box;
    transition: border-color var(--md-motion-duration-short), box-shadow var(--md-motion-duration-short);
}

.m3-input:focus {
    outline: none;
    border-color: var(--md-sys-color-primary);
    box-shadow: 0 0 0 2px var(--md-sys-color-primary-container);
}

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

/* Material 3 Switch Component */
.backup-toggle-group {
    margin: 12px 0 14px 0;
}

.m3-switch-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    background-color: var(--md-sys-color-surface-container-low);
    border: 1.5px solid var(--md-sys-color-outline-variant);
    border-radius: var(--md-shape-l);
    padding: 12px 14px;
    cursor: pointer;
    user-select: none;
    transition: all var(--md-motion-duration-short) var(--md-motion-easing);
}

.m3-switch-container:hover {
    background-color: var(--md-sys-color-surface-container);
    border-color: var(--md-sys-color-primary-container);
}

.switch-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
}

.switch-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--md-sys-color-on-surface);
}

.switch-label svg {
    width: 18px;
    height: 18px;
    fill: var(--md-sys-color-primary);
    flex-shrink: 0;
}

.switch-desc {
    font-size: 0.76rem;
    color: var(--md-sys-color-on-surface-variant);
    line-height: 1.35;
}

.m3-switch-wrapper {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 30px;
    flex-shrink: 0;
}

.m3-switch-input {
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
}

.m3-switch-track {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--md-sys-color-surface-container-highest);
    border: 2px solid var(--md-sys-color-outline);
    border-radius: var(--md-shape-full);
    transition: all 0.2s cubic-bezier(0.2, 0, 0, 1);
    box-sizing: border-box;
}

.m3-switch-thumb {
    position: absolute;
    height: 16px;
    width: 16px;
    left: 4px;
    top: 5px;
    background-color: var(--md-sys-color-outline);
    border-radius: 50%;
    transition: all 0.2s cubic-bezier(0.2, 0, 0, 1);
}

.m3-switch-input:checked + .m3-switch-track {
    background-color: var(--md-sys-color-primary);
    border-color: var(--md-sys-color-primary);
}

.m3-switch-input:checked + .m3-switch-track .m3-switch-thumb {
    transform: translateX(20px);
    background-color: var(--md-sys-color-on-primary);
    width: 22px;
    height: 22px;
    left: 2px;
    top: 2px;
}



