/* ====================================================================
   ServisApp PWA v5 — Premium Native Mobile Design
   Inspired by Revolut, Wise, Apple Wallet, Samsung One UI
   ==================================================================== */

/* ===== DESIGN TOKENS ===== */
:root {
    /* Surfaces — Warm charcoal instead of cold black */
    --bg-primary: #101114;
    --bg-secondary: #18191e;
    --bg-card: #1e2027;
    --bg-card-hover: #26282f;
    --bg-elevated: #2a2d35;
    --bg-input: #1a1c22;
    --bg-inset: rgba(255, 255, 255, 0.03);

    /* Text */
    --text-primary: #f4f4f5;
    --text-secondary: #9ca3af;
    --text-muted: #5c6270;
    --text-inverse: #101114;

    /* Brand */
    --accent: #635bff;
    --accent-light: #a78bfa;
    --accent-surface: rgba(99, 91, 255, 0.1);
    --accent-glow: rgba(99, 91, 255, 0.25);

    /* Semantic */
    --success: #22c55e;
    --success-surface: rgba(34, 197, 94, 0.1);
    --warning: #f59e0b;
    --warning-surface: rgba(245, 158, 11, 0.1);
    --danger: #ef4444;
    --danger-surface: rgba(239, 68, 68, 0.1);
    --info: #3b82f6;
    --info-surface: rgba(59, 130, 246, 0.1);

    /* Borders */
    --border: rgba(255, 255, 255, 0.07);
    --border-strong: rgba(255, 255, 255, 0.12);
    --border-accent: rgba(99, 91, 255, 0.25);

    /* Shadows */
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
    --shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.4);
    --shadow-xl: 0 20px 60px rgba(0, 0, 0, 0.5);
    --shadow-accent: 0 4px 20px var(--accent-glow);

    /* Gradients */
    --gradient: linear-gradient(135deg, #635bff 0%, #a855f7 100%);
    --gradient-surface: linear-gradient(180deg, rgba(99, 91, 255, 0.06) 0%, transparent 60%);
    --gradient-card: linear-gradient(180deg, rgba(255, 255, 255, 0.04) 0%, rgba(255, 255, 255, 0.01) 100%);
    --gradient-nav: linear-gradient(180deg, rgba(16, 17, 20, 0) 0%, rgba(16, 17, 20, 0.95) 30%, rgba(16, 17, 20, 0.99) 100%);

    /* Radius */
    --r-xs: 8px;
    --r-sm: 12px;
    --r-md: 16px;
    --r-lg: 20px;
    --r-xl: 24px;
    --r-full: 9999px;

    /* Safe areas */
    --safe-top: env(safe-area-inset-top, 0px);
    --safe-bottom: env(safe-area-inset-bottom, 0px);

    /* Motion */
    --ease: cubic-bezier(0.25, 0.46, 0.45, 0.94);
    --ease-spring: cubic-bezier(0.175, 0.885, 0.32, 1.275);
    --duration: 0.2s;
}

/* ===== RESET ===== */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html,
body {
    height: 100%;
    overflow: hidden;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    font-size: 15px;
    line-height: 1.5;
}

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar {
    width: 0;
    background: transparent;
}

::selection {
    background: rgba(99, 91, 255, 0.3);
    color: #fff;
}

:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* ===== SPLASH ===== */
.splash-screen {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: var(--bg-primary);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: opacity .5s, visibility .5s;
}

.splash-screen.hide {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.splash-logo {
    font-size: 3.5rem;
    margin-bottom: 1rem;
    animation: pulse 2s ease-in-out infinite;
}

.splash-text {
    color: var(--accent-light);
    font-weight: 800;
    font-size: 1.1rem;
    letter-spacing: 3px;
    text-transform: uppercase;
}

.splash-bar {
    width: 140px;
    height: 3px;
    background: var(--border);
    border-radius: 3px;
    margin-top: 2rem;
    overflow: hidden;
}

.splash-bar::after {
    content: '';
    display: block;
    width: 40%;
    height: 100%;
    background: var(--gradient);
    border-radius: 3px;
    animation: loading 1.2s ease-in-out infinite;
}

@keyframes loading {
    0% {
        transform: translateX(-100%)
    }

    100% {
        transform: translateX(350%)
    }
}

@keyframes pulse {

    0%,
    100% {
        transform: scale(1)
    }

    50% {
        transform: scale(1.05)
    }
}

/* ===== APP SHELL ===== */
#app {
    height: 100%;
    display: flex;
    flex-direction: column;
    padding-top: var(--safe-top);
    padding-bottom: var(--safe-bottom);
}

#page-content {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    padding: 20px 16px 120px;
    animation: pageEnter 0.3s var(--ease);
}

@keyframes pageEnter {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

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

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

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

@keyframes slideUp {
    from {
        transform: translateY(100%);
    }

    to {
        transform: translateY(0);
    }
}

/* ================================================================
   NAVIGATION — iOS-style tab bar with frosted glass
   ================================================================ */
.nav-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    justify-content: space-around;
    align-items: flex-end;
    padding: 0 4px calc(6px + var(--safe-bottom));
    z-index: 100;
    /* Frosted glass */
    background: linear-gradient(180deg,
            rgba(16, 17, 20, 0.0) 0%,
            rgba(16, 17, 20, 0.75) 25%,
            rgba(16, 17, 20, 0.97) 100%);
    backdrop-filter: blur(40px) saturate(180%);
    -webkit-backdrop-filter: blur(40px) saturate(180%);
    /* Subtle top border */
    border-top: 0.5px solid rgba(255, 255, 255, 0.08);
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    color: var(--text-muted);
    font-size: 10px;
    font-weight: 600;
    padding: 10px 14px 6px;
    cursor: pointer;
    transition: color var(--duration) var(--ease);
    position: relative;
    letter-spacing: 0.2px;
}

.nav-item i {
    font-size: 22px;
    margin-bottom: 4px;
    transition: transform var(--duration) var(--ease), color var(--duration) var(--ease);
}

.nav-item.active {
    color: var(--accent-light);
}

.nav-item.active i {
    color: var(--accent-light);
    transform: scale(1.1);
}

/* Glowing dot under active tab */
.nav-item.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    width: 5px;
    height: 5px;
    background: var(--accent);
    border-radius: 50%;
    box-shadow: 0 0 10px var(--accent-glow), 0 0 20px var(--accent-glow);
}

/* Floating Action Button */
.nav-item.fab {
    background: var(--gradient);
    color: #fff;
    width: 54px;
    height: 54px;
    border-radius: 50%;
    margin-bottom: 14px;
    justify-content: center;
    font-size: 0;
    padding: 0;
    box-shadow: 0 6px 24px var(--accent-glow), inset 0 1px 0 rgba(255, 255, 255, 0.2);
    transition: transform 0.15s var(--ease);
    border: 2px solid rgba(255, 255, 255, 0.12);
}

.nav-item.fab::after {
    display: none;
}

.nav-item.fab i {
    font-size: 24px;
    margin: 0;
    color: #fff;
    transform: none;
}

.nav-item.fab:active {
    transform: scale(0.88) !important;
}


/* ================================================================
   PAGE HEADER
   ================================================================ */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    padding-top: 4px;
}

.page-header h1 {
    font-size: 1.75rem;
    font-weight: 800;
    color: #fff;
    letter-spacing: -0.5px;
}

.page-header .subtitle {
    color: var(--text-muted);
    font-size: 0.78rem;
    margin-top: 2px;
    font-weight: 500;
}

/* ================================================================
   CARDS — Elevated surfaces with subtle gradients
   ================================================================ */
.card {
    background: var(--bg-card);
    border-radius: var(--r-lg);
    border: 1px solid var(--border);
    padding: 18px;
    margin-bottom: 12px;
    position: relative;
    overflow: hidden;
    transition: transform var(--duration) var(--ease), border-color var(--duration);
}

/* Top highlight line — gives depth */
.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 20px;
    right: 20px;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.07), transparent);
}

.card:active {
    transform: scale(0.985);
}

.card:hover {
    border-color: var(--border-strong);
}

.card-glass {
    background: var(--bg-inset);
    backdrop-filter: blur(20px);
}

/* ================================================================
   STAT CARDS — Dashboard metric boxes
   ================================================================ */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-bottom: 20px;
}

.stat-box {
    background: var(--bg-card);
    border-radius: var(--r-md);
    padding: 18px 14px;
    border: 1px solid var(--border);
    text-align: center;
    position: relative;
    overflow: hidden;
    transition: transform 0.15s var(--ease);
}

/* Colored accent bar at top */
.stat-box::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    border-radius: var(--r-md) var(--r-md) 0 0;
}

/* Inner glow effect */
.stat-box::after {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 80%;
    height: 40px;
    border-radius: 50%;
    filter: blur(20px);
    opacity: 0;
    z-index: 0;
    transition: opacity var(--duration);
}

.stat-box:active {
    transform: scale(0.96);
}

.stat-box .label {
    font-size: 0.62rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1.2px;
    font-weight: 700;
    position: relative;
    z-index: 1;
}

.stat-box .value {
    font-size: 1.5rem;
    font-weight: 800;
    margin-top: 6px;
    letter-spacing: -0.5px;
    position: relative;
    z-index: 1;
}

/* Per-color customizations with inner glow */
.stat-box.accent {
    border-color: rgba(99, 91, 255, 0.15);
}

.stat-box.accent::before {
    background: var(--gradient);
}

.stat-box.accent::after {
    background: rgba(99, 91, 255, 0.15);
    opacity: 1;
}

.stat-box.accent .value {
    color: var(--accent-light);
}

.stat-box.danger {
    border-color: rgba(239, 68, 68, 0.15);
}

.stat-box.danger::before {
    background: linear-gradient(135deg, #ef4444, #f97316);
}

.stat-box.danger::after {
    background: rgba(239, 68, 68, 0.12);
    opacity: 1;
}

.stat-box.danger .value {
    color: var(--danger);
}

.stat-box.success {
    border-color: rgba(34, 197, 94, 0.15);
}

.stat-box.success::before {
    background: linear-gradient(135deg, #22c55e, #10b981);
}

.stat-box.success::after {
    background: rgba(34, 197, 94, 0.12);
    opacity: 1;
}

.stat-box.success .value {
    color: var(--success);
}

.stat-box.warning {
    border-color: rgba(245, 158, 11, 0.15);
}

.stat-box.warning::before {
    background: linear-gradient(135deg, #f59e0b, #f97316);
}

.stat-box.warning::after {
    background: rgba(245, 158, 11, 0.12);
    opacity: 1;
}

.stat-box.warning .value {
    color: var(--warning);
}

.stat-box.info {
    border-color: rgba(59, 130, 246, 0.15);
}

.stat-box.info::before {
    background: linear-gradient(135deg, #3b82f6, #06b6d4);
}

.stat-box.info::after {
    background: rgba(59, 130, 246, 0.12);
    opacity: 1;
}

.stat-box.info .value {
    color: var(--info);
}

/* ================================================================
   LIST ITEMS — Service/menu rows
   ================================================================ */
.list-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    background: var(--bg-card);
    border-radius: var(--r-md);
    margin-bottom: 8px;
    border: 1px solid var(--border);
    cursor: pointer;
    transition: all var(--duration) var(--ease);
    text-decoration: none;
    color: inherit;
}

.list-item:active {
    transform: scale(0.97);
    background: var(--bg-card-hover);
}

.list-item:hover {
    background: var(--bg-card-hover);
}

.list-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--r-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}

.list-icon.purple {
    background: var(--accent-surface);
    color: var(--accent-light);
}

.list-icon.green,
.list-icon.success {
    background: var(--success-surface);
    color: var(--success);
}

.list-icon.orange,
.list-icon.warning {
    background: var(--warning-surface);
    color: var(--warning);
}

.list-icon.red {
    background: var(--danger-surface);
    color: var(--danger);
}

.list-icon.blue,
.list-icon.info {
    background: var(--info-surface);
    color: var(--info);
}

.list-body {
    flex: 1;
    min-width: 0;
}

.list-body .title {
    font-weight: 700;
    font-size: .88rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: #fff;
}

.list-body .sub {
    font-size: .72rem;
    color: var(--text-secondary);
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.list-arrow {
    color: var(--text-muted);
    font-size: 14px;
}

/* ================================================================
   BADGES
   ================================================================ */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: var(--r-full);
    font-size: 0.6rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border: 1px solid transparent;
}

.badge-waiting {
    background: var(--warning-surface);
    color: var(--warning);
    border-color: rgba(245, 158, 11, 0.15);
}

.badge-progress {
    background: var(--info-surface);
    color: var(--info);
    border-color: rgba(59, 130, 246, 0.15);
}

.badge-ready {
    background: var(--success-surface);
    color: var(--success);
    border-color: rgba(34, 197, 94, 0.15);
}

.badge-delivered {
    background: var(--accent-surface);
    color: var(--accent-light);
    border-color: rgba(99, 91, 255, 0.15);
}

.badge-cancelled {
    background: var(--danger-surface);
    color: var(--danger);
    border-color: rgba(239, 68, 68, 0.15);
}

/* ================================================================
   FORMS
   ================================================================ */
.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-size: .68rem;
    font-weight: 700;
    color: var(--text-secondary);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.form-control,
.form-select {
    width: 100%;
    padding: 14px 16px;
    background: var(--bg-input);
    border: 1.5px solid var(--border-strong);
    border-radius: var(--r-sm);
    color: var(--text-primary);
    font-size: 0.95rem;
    font-weight: 500;
    font-family: inherit;
    outline: none;
    transition: border-color var(--duration), box-shadow var(--duration);
    -webkit-appearance: none;
    appearance: none;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 4px var(--accent-surface);
}

.form-control::placeholder {
    color: var(--text-muted);
    font-weight: 400;
}

textarea.form-control {
    resize: vertical;
    min-height: 80px;
    line-height: 1.6;
}

.form-select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236b7280' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 36px;
}

/* ================================================================
   BUTTONS
   ================================================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 13px 22px;
    border-radius: var(--r-sm);
    font-size: .88rem;
    font-weight: 700;
    font-family: inherit;
    border: none;
    cursor: pointer;
    transition: transform 0.12s var(--ease), box-shadow var(--duration);
    text-decoration: none;
    white-space: nowrap;
}

.btn:active {
    transform: scale(0.95);
}

.btn-primary {
    background: var(--gradient);
    color: #fff;
    box-shadow: var(--shadow-accent);
    font-size: .95rem;
    padding: 15px 28px;
    border-radius: var(--r-md);
    font-weight: 800;
}

.btn-success {
    background: linear-gradient(135deg, #22c55e, #10b981);
    color: #fff;
    box-shadow: 0 4px 16px rgba(34, 197, 94, 0.25);
}

.btn-danger {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: #fff;
    box-shadow: 0 4px 16px rgba(239, 68, 68, 0.2);
    border: none;
    padding: 13px 22px;
    border-radius: var(--r-sm);
    font-weight: 700;
    cursor: pointer;
    transition: transform .12s;
}

.btn-danger:active,
.btn-danger:hover {
    opacity: .92;
}

.btn-info {
    background: linear-gradient(135deg, #3b82f6, #06b6d4);
    color: #fff;
}

.btn-outline {
    background: transparent;
    border: 1.5px solid var(--border-strong);
    color: var(--text-primary);
}

.btn-outline:active {
    background: var(--bg-inset);
}

.btn-outline-danger {
    background: transparent;
    border: 1.5px solid rgba(239, 68, 68, 0.2);
    color: var(--danger);
}

.btn-block {
    width: 100%;
}

.btn-sm {
    padding: 9px 14px;
    font-size: .78rem;
    border-radius: var(--r-xs);
}

.btn-link {
    background: none;
    border: none;
    cursor: pointer;
    text-decoration: none;
}

.btn-group {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.btn-icon-only {
    background: none;
    border: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* ================================================================
   SEARCH
   ================================================================ */
.search-box {
    position: relative;
    margin-bottom: 14px;
}

.search-box input {
    width: 100%;
    padding: 14px 16px 14px 46px;
    background: var(--bg-card);
    border: 1.5px solid var(--border);
    border-radius: var(--r-lg);
    color: var(--text-primary);
    font-size: .93rem;
    font-weight: 500;
    font-family: inherit;
    outline: none;
    transition: border-color var(--duration), box-shadow var(--duration), background var(--duration);
}

.search-box input:focus {
    border-color: var(--accent);
    background: var(--bg-elevated);
    box-shadow: 0 0 0 4px var(--accent-surface);
}

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

.search-box i {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 16px;
}

/* ================================================================
   FILTER CHIPS
   ================================================================ */
.filter-chips {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 8px;
    margin-bottom: 14px;
    scrollbar-width: none;
}

.filter-chips::-webkit-scrollbar {
    display: none;
}

.chip {
    padding: 9px 18px;
    border-radius: var(--r-full);
    font-size: 0.78rem;
    font-weight: 700;
    white-space: nowrap;
    cursor: pointer;
    background: var(--bg-card);
    color: var(--text-secondary);
    border: 1px solid var(--border);
    transition: all var(--duration) var(--ease);
}

.chip:active {
    transform: scale(0.94);
}

.chip.active {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
    box-shadow: var(--shadow-accent);
}

/* ================================================================
   QUICK TAGS
   ================================================================ */
.quick-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}

.quick-tag {
    padding: 6px 13px;
    border-radius: var(--r-full);
    font-size: .7rem;
    font-weight: 700;
    cursor: pointer;
    background: var(--accent-surface);
    color: var(--accent-light);
    border: 1px solid var(--border-accent);
    transition: var(--duration);
    user-select: none;
}

.quick-tag:active,
.quick-tag.selected {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

.quick-tag.accessory {
    background: var(--success-surface);
    color: var(--success);
    border-color: rgba(34, 197, 94, 0.2);
}

.quick-tag.accessory:active,
.quick-tag.accessory.selected {
    background: var(--success);
    color: #fff;
}

/* ================================================================
   PATTERN LOCK
   ================================================================ */
.pattern-lock-container {
    text-align: center;
    margin: 10px 0;
}

.pattern-lock-canvas {
    width: 200px;
    height: 200px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-strong);
    border-radius: var(--r-md);
    touch-action: none;
    cursor: crosshair;
}

.pattern-actions {
    display: flex;
    gap: 8px;
    justify-content: center;
    margin-top: 8px;
}

/* ================================================================
   TOGGLE SWITCH
   ================================================================ */
.toggle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 0;
}

.toggle-row .toggle-label,
.toggle-label {
    font-size: .8rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.toggle-switch {
    position: relative;
    width: 44px;
    height: 24px;
    display: inline-block;
    cursor: pointer;
}

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

.toggle-slider {
    position: absolute;
    inset: 0;
    background: var(--bg-elevated);
    border: 1px solid var(--border-strong);
    border-radius: 24px;
    cursor: pointer;
    transition: .3s;
}

.toggle-slider::before {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    left: 2px;
    bottom: 2px;
    background: var(--text-muted);
    border-radius: 50%;
    transition: .3s;
}

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

.toggle-switch input:checked+.toggle-slider::before {
    transform: translateX(20px);
    background: #fff;
}

/* ================================================================
   DEVICE CARD
   ================================================================ */
.device-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    background: var(--bg-card);
    border-radius: var(--r-md);
    border: 1px solid var(--border);
    margin-bottom: 8px;
    cursor: pointer;
    transition: all var(--duration);
}

.device-card:hover,
.device-card:active {
    background: var(--bg-card-hover);
    transform: scale(0.98);
}

.device-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--r-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    background: var(--info-surface);
    color: var(--info);
    flex-shrink: 0;
}

.device-info {
    flex: 1;
    min-width: 0;
}

.device-info .name {
    font-weight: 700;
    font-size: .88rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.device-info .meta {
    font-size: .72rem;
    color: var(--text-secondary);
    margin-top: 2px;
    font-family: monospace;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.device-price {
    text-align: right;
    flex-shrink: 0;
}

.device-price .amount {
    font-weight: 800;
    font-size: .95rem;
    color: var(--success);
}

.device-price .days {
    font-size: .7rem;
    color: var(--text-muted);
}

.cosmetic-bar {
    height: 4px;
    background: var(--bg-inset);
    border-radius: 2px;
    margin-top: 4px;
    width: 60px;
}

.cosmetic-bar .fill {
    height: 100%;
    background: var(--gradient);
    border-radius: 2px;
}

/* ================================================================
   SECTION HEADERS
   ================================================================ */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 22px 0 12px;
}

.section-header h3 {
    font-size: 1.05rem;
    font-weight: 800;
    color: #fff;
    margin: 0;
}

.section-header a {
    font-size: .78rem;
    color: var(--accent-light);
    font-weight: 700;
    text-decoration: none;
}

.section-title {
    font-size: .7rem;
    font-weight: 800;
    color: var(--text-muted);
    letter-spacing: 1.5px;
    margin: 24px 0 12px;
    padding-left: 10px;
    border-left: 3px solid var(--accent);
    text-transform: uppercase;
}

/* ================================================================
   PREMIUM CARD
   ================================================================ */
.premium-card {
    background: var(--gradient-card);
    background-color: var(--bg-card);
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
}

.premium-card:active {
    transform: scale(0.98);
}

.stat-card {
    background: var(--bg-card);
    border-radius: var(--r-md);
    padding: 14px;
    border: 1px solid var(--border);
}

.stat-card .label {
    font-size: .6rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: .8px;
    margin-bottom: 6px;
}

.stat-card .value {
    font-size: 1.15rem;
    font-weight: 800;
}

.stat-card.premium-card {
    padding: 16px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.stat-card.premium-card .label {
    font-size: .62rem;
    margin-bottom: 6px;
    opacity: .8;
}

.stat-card.premium-card .value {
    font-size: 1.1rem;
    color: #fff;
}

/* ================================================================
   QUICK ACTIONS GRID
   ================================================================ */
.quick-actions-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}

.action-btn {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--r-sm);
    padding: 16px 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;
    transition: all 0.15s var(--ease);
    color: var(--text-primary);
    text-align: center;
    flex: 1 1 calc(50% - 8px);
    min-width: 0;
    max-width: calc(50% - 4px);
    box-sizing: border-box;
}

.action-btn:active {
    transform: scale(0.93);
    background: var(--bg-card-hover);
    border-color: var(--border-accent);
}

.action-btn i {
    font-size: 1.4rem;
}

.action-btn span {
    font-size: .65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
    color: var(--text-secondary);
}

/* ================================================================
   TOAST — Top notification
   ================================================================ */
.toast {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(-100px);
    z-index: 10000;
    padding: 14px 24px;
    border-radius: var(--r-md);
    color: #fff;
    font-weight: 700;
    font-size: .88rem;
    backdrop-filter: blur(20px);
    box-shadow: var(--shadow-lg);
    transition: transform 0.35s var(--ease-spring), opacity 0.35s;
    opacity: 0;
    max-width: calc(100% - 32px);
    text-align: center;
}

.toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.toast.success {
    background: rgba(34, 197, 94, 0.92);
}

.toast.error {
    background: rgba(239, 68, 68, 0.92);
}

.toast.info {
    background: rgba(59, 130, 246, 0.92);
}

.toast.warning {
    background: rgba(245, 158, 11, 0.92);
}

/* ================================================================
   MODAL — Bottom sheet style
   ================================================================ */
.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 999;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding: 0;
    animation: fadeIn .2s;
}

.modal-content {
    background: var(--bg-secondary);
    border-radius: var(--r-xl) var(--r-xl) 0 0;
    width: 100%;
    max-width: 480px;
    max-height: 85vh;
    overflow-y: auto;
    border: 1px solid var(--border);
    border-bottom: none;
    animation: slideUp .35s var(--ease-spring);
    box-shadow: var(--shadow-xl);
    padding: 20px;
}

.modal-header {
    padding: 0 0 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border);
    margin-bottom: 16px;
}

.modal-title {
    font-size: 1.1rem;
    font-weight: 800;
    color: #fff;
}

.modal-close {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--bg-elevated);
    border: none;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 16px;
}

.modal-body {
    padding: 0;
}

.modal-footer {
    padding: 16px 0 0;
    display: flex;
    gap: 10px;
}

/* ================================================================
   LOADING
   ================================================================ */
.loading-center {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 50vh;
    gap: 16px;
}

.spinner {
    width: 36px;
    height: 36px;
    border: 3px solid var(--border);
    border-top-color: var(--accent-light);
    border-radius: 50%;
    animation: spin .7s linear infinite;
}

.spinner-sm {
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin .6s linear infinite;
    display: inline-block;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ================================================================
   DROPDOWN / PARTS
   ================================================================ */
.dropdown-results {
    position: relative;
    max-height: 220px;
    overflow-y: auto;
    background: var(--bg-secondary);
    border: 1px solid var(--border-strong);
    border-radius: var(--r-sm);
    margin-bottom: 10px;
    display: none;
    z-index: 100;
    box-shadow: var(--shadow);
}

.dropdown-results.show {
    display: block;
}

.result-item {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: background var(--duration);
}

.result-item:last-child {
    border-bottom: none;
}

.result-item:active {
    background: var(--bg-elevated);
}

.result-item .small {
    font-size: .85rem;
    color: #fff;
}

.added-part-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    background: var(--bg-inset);
    border-radius: var(--r-sm);
    margin-bottom: 8px;
    border: 1px solid var(--border);
    border-left: 3px solid var(--accent);
}

.added-part-item.new-part {
    border-left-color: var(--success);
    background: rgba(34, 197, 94, 0.03);
}

/* ================================================================
   ANNOUNCEMENTS
   ================================================================ */
.announcement-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(12px);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    visibility: hidden;
    transition: .3s;
}

.announcement-modal.show {
    opacity: 1;
    visibility: visible;
}

.announcement-card {
    background: var(--bg-card);
    width: 100%;
    max-width: 360px;
    border-radius: var(--r-xl);
    border: 1px solid var(--border);
    overflow: hidden;
    transform: translateY(24px) scale(0.96);
    transition: .4s var(--ease-spring);
    box-shadow: var(--shadow-xl);
}

.announcement-modal.show .announcement-card {
    transform: none;
}

.announcement-header {
    background: var(--gradient);
    padding: 20px;
    text-align: center;
    position: relative;
}

.announcement-header h2 {
    color: #fff;
    font-size: 1.1rem;
    font-weight: 800;
    margin: 0;
}

.announcement-header .close-btn {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.15);
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.announcement-body {
    padding: 24px;
    text-align: center;
}

.announcement-message {
    color: var(--text-primary);
    font-size: .95rem;
    line-height: 1.6;
    margin-bottom: 8px;
}

.announcement-time {
    color: var(--text-muted);
    font-size: .7rem;
    font-weight: 600;
}

.announcement-footer {
    padding: 0 24px 24px;
}

.btn-ok {
    width: 100%;
    background: var(--gradient);
    color: #fff;
    border: none;
    padding: 14px;
    border-radius: var(--r-md);
    font-weight: 800;
    font-size: .95rem;
    cursor: pointer;
    box-shadow: var(--shadow-accent);
}

/* ================================================================
   EMPTY STATE
   ================================================================ */
.empty-state {
    text-align: center;
    padding: 48px 20px;
    color: var(--text-muted);
}

.empty-state i {
    font-size: 2.5rem;
    margin-bottom: 12px;
    opacity: .3;
    display: block;
}

.empty-state p {
    font-size: .88rem;
}

/* ================================================================
   LOGIN
   ================================================================ */
/* ================================================================
   LOGIN — Premium "Masterpiece" Aesthetic
   ================================================================ */
.login-page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 30px 24px;
    background: radial-gradient(circle at top right, var(--accent-surface), transparent 40%),
        radial-gradient(circle at bottom left, rgba(168, 85, 247, 0.05), transparent 40%);
    position: relative;
    overflow: hidden;
}

/* Backglow effect */
.login-page::before {
    content: '';
    position: absolute;
    top: 20%;
    left: 50%;
    transform: translateX(-50%);
    width: 250px;
    height: 250px;
    background: var(--accent);
    filter: blur(120px);
    opacity: 0.12;
    z-index: 0;
}

.login-logo-img {
    width: 140px;
    height: 140px;
    object-fit: contain;
    margin-bottom: 32px;
    filter: drop-shadow(0 20px 40px rgba(0, 0, 0, 0.6));
    border-radius: 35px;
    position: relative;
    z-index: 1;
}

.login-title {
    font-size: 2.2rem;
    font-weight: 900;
    color: #fff;
    margin-bottom: 4px;
    letter-spacing: -1px;
    text-align: center;
    position: relative;
    z-index: 1;
    text-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.login-sub {
    font-size: 0.88rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 2.5px;
    font-weight: 700;
    margin-bottom: 40px;
    text-align: center;
    opacity: 0.8;
    position: relative;
    z-index: 1;
}

.login-form {
    width: 100%;
    max-width: 380px;
    position: relative;
    z-index: 1;
}

/* Premium Form Inputs Overlay */
.login-page .form-control {
    background: rgba(255, 255, 255, 0.035);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 18px;
    height: 62px;
    padding: 0 24px;
    font-size: 1rem;
    margin-bottom: 15px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.login-page .form-control:focus {
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--accent);
    box-shadow: 0 0 0 4px var(--accent-surface), inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.login-page .form-control::placeholder {
    color: rgba(255, 255, 255, 0.35);
}

/* Custom Forgot Password Link */
.login-page a {
    color: var(--accent-light);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.85rem;
    transition: opacity 0.2s;
}

.login-page a:active {
    opacity: 0.6;
}

/* Masterpiece Login Button */
.login-page .btn-primary {
    height: 62px;
    border-radius: 18px;
    font-size: 1.05rem;
    letter-spacing: 0.3px;
    margin-top: 10px;
    box-shadow: 0 12px 30px rgba(99, 91, 255, 0.35);
}

/* Masterpiece Outline Button */
.login-page .btn-outline {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #fff;
    height: 58px;
    border-radius: 18px;
    font-size: 0.95rem;
    backdrop-filter: blur(10px);
}

.login-logo {
    width: 100px;
    height: 100px;
    background: var(--gradient);
    border-radius: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    color: #fff;
    margin-bottom: 24px;
    box-shadow: 0 20px 40px rgba(99, 91, 255, 0.3);
    position: relative;
    z-index: 1;
}

.login-form .flex-end {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 15px;
}

/* ================================================================
   SETTINGS TABS
   ================================================================ */
.settings-tabs {
    display: flex;
    background: var(--bg-secondary);
    border-radius: var(--r-sm);
    padding: 3px;
    gap: 3px;
    border: 1px solid var(--border);
}

.s-tab {
    flex: 1;
    padding: 10px 12px;
    background: none;
    border: none;
    border-radius: var(--r-xs);
    color: var(--text-secondary);
    font-size: .78rem;
    font-weight: 700;
    cursor: pointer;
    transition: var(--duration);
    font-family: inherit;
}

.s-tab.active {
    background: var(--accent);
    color: #fff;
    box-shadow: var(--shadow-accent);
}

/* ================================================================
   UTILITIES
   ================================================================ */
.d-flex {
    display: flex
}

.d-none {
    display: none
}

.flex-wrap {
    flex-wrap: wrap
}

.align-items-center {
    align-items: center
}

.justify-content-between {
    justify-content: space-between
}

.text-center {
    text-align: center
}

.text-end,
.text-right {
    text-align: right
}

.gap-1 {
    gap: 4px
}

.gap-2 {
    gap: 8px
}

.gap-3 {
    gap: 12px
}

.mb-1 {
    margin-bottom: 4px
}

.mb-2 {
    margin-bottom: 12px
}

.mb-3 {
    margin-bottom: 1rem
}

.mt-1 {
    margin-top: 6px
}

.mt-2 {
    margin-top: 12px
}

.mt-3 {
    margin-top: 1rem
}

.mt-4 {
    margin-top: 1.5rem
}

.ms-1 {
    margin-left: 4px
}

.ms-2 {
    margin-left: 8px
}

.ms-auto {
    margin-left: auto
}

.me-1 {
    margin-right: 4px
}

.me-2 {
    margin-right: 8px
}

.py-2 {
    padding-top: .5rem;
    padding-bottom: .5rem
}

.px-2 {
    padding-left: .5rem;
    padding-right: .5rem
}

.px-3 {
    padding-left: 1rem;
    padding-right: 1rem
}

.p-2 {
    padding: 8px
}

.p-3 {
    padding: 16px
}

.w-100 {
    width: 100%
}

.h-100 {
    height: 100%
}

.border-bottom {
    border-bottom: 1px solid var(--border)
}

.text-primary {
    color: var(--accent)
}

.text-success {
    color: var(--success)
}

.text-danger {
    color: var(--danger)
}

.text-warning {
    color: var(--warning)
}

.text-info {
    color: var(--info)
}

.text-muted {
    color: var(--text-muted)
}

.text-secondary {
    color: var(--text-secondary)
}

.text-accent {
    color: var(--accent-light)
}

.text-dark,
.text-navy {
    color: var(--text-primary)
}

.text-white {
    color: #fff
}

.fw-bold {
    font-weight: 700
}

.fw-800 {
    font-weight: 800
}

.fw-900 {
    font-weight: 900
}

.fs-4 {
    font-size: 1.2rem
}

.fs-5 {
    font-size: 1rem
}

.small {
    font-size: .8rem
}

.italic {
    font-style: italic
}

.bg-primary-light {
    background-color: var(--accent-surface) !important
}

.bg-success-subtle {
    background-color: var(--success-surface) !important
}

.bg-danger-subtle {
    background-color: var(--danger-surface) !important
}

.bg-warning-subtle {
    background-color: var(--warning-surface) !important
}

.badge.bg-primary,
.badge.bg-primary-subtle {
    background: var(--accent-surface);
    color: var(--accent-light)
}

.badge.bg-success,
.badge.bg-success-subtle {
    background: var(--success-surface);
    color: var(--success)
}

.badge.bg-danger {
    background: var(--danger-surface);
    color: var(--danger)
}

.badge.bg-warning {
    background: var(--warning-surface);
    color: var(--warning)
}

.badge.bg-info {
    background: var(--info-surface);
    color: var(--info)
}

.divider {
    height: 1px;
    background: var(--border);
    margin: 12px 0
}

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

.form-row {
    display: flex;
    gap: 10px;
    margin-bottom: 0
}

.form-row .form-group {
    flex: 1
}

.simple-bar-chart {
    display: flex;
    align-items: flex-end;
    gap: 6px;
    height: 120px;
    padding: 8px 0
}

.row {
    display: flex;
    flex-wrap: wrap;
    margin: 0 -6px
}

.col-6 {
    width: 50%;
    padding: 0 6px;
    box-sizing: border-box
}

.col-12 {
    width: 100%;
    padding: 0 6px;
    box-sizing: border-box
}

/* ================================================================
   RESPONSIVE
   ================================================================ */
@media (max-width:360px) {
    .page-header h1 {
        font-size: 1.5rem
    }

    .stat-box .value {
        font-size: 1.3rem
    }

    .stat-box {
        padding: 14px 10px
    }

    .action-btn {
        padding: 12px 8px
    }

    .action-btn i {
        font-size: 1.2rem
    }

    .action-btn span {
        font-size: .6rem
    }
}

@media print {

    .nav-bar,
    .no-print {
        display: none !important
    }

    body {
        background: #fff;
        color: #000
    }

    .card,
    .premium-card {
        background: #fff;
        border: 1px solid #ddd
    }
}

/* ================================================================
   SEARCHABLE SELECT COMPONENT
   ================================================================ */
.searchable-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 14px 16px;
    background: var(--bg-input);
    border: 1.5px solid var(--border-strong);
    border-radius: var(--r-sm);
    color: var(--text-muted);
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: border-color var(--duration), box-shadow var(--duration);
    -webkit-tap-highlight-color: transparent;
}

.searchable-trigger.has-value {
    color: var(--text-primary);
}

.searchable-trigger.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.searchable-trigger:not(.disabled):active {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-surface);
}

.searchable-trigger i {
    color: var(--text-muted);
    font-size: 14px;
    transition: transform var(--duration);
}

/* Overlay */
.searchable-overlay {
    position: fixed;
    inset: 0;
    z-index: 10000;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: flex-end;
    justify-content: center;
    animation: fadeIn 0.15s ease;
}

/* Bottom sheet */
.searchable-sheet {
    background: var(--bg-secondary);
    border-radius: var(--r-xl) var(--r-xl) 0 0;
    width: 100%;
    max-width: 480px;
    max-height: 75vh;
    display: flex;
    flex-direction: column;
    animation: slideUp 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    border: 1px solid var(--border);
    border-bottom: none;
    box-shadow: var(--shadow-xl);
    overflow: hidden;
}

.searchable-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 20px 12px;
    border-bottom: 1px solid var(--border);
}

.searchable-title {
    font-size: 1.1rem;
    font-weight: 800;
    color: #fff;
}

.searchable-close {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--bg-elevated);
    border: none;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 14px;
}

.searchable-search-wrap {
    position: relative;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
}

.searchable-search-wrap i {
    position: absolute;
    left: 30px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 15px;
}

.searchable-search-wrap input {
    width: 100%;
    padding: 12px 14px 12px 40px;
    background: var(--bg-card);
    border: 1.5px solid var(--border);
    border-radius: var(--r-sm);
    color: var(--text-primary);
    font-size: 0.95rem;
    font-family: inherit;
    outline: none;
    transition: border-color var(--duration);
}

.searchable-search-wrap input:focus {
    border-color: var(--accent);
}

.searchable-search-wrap input::placeholder {
    color: var(--text-muted);
}

/* Options list */
.searchable-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px 0;
    -webkit-overflow-scrolling: touch;
}

.searchable-option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    cursor: pointer;
    transition: background 0.1s;
    font-size: 0.95rem;
    color: var(--text-primary);
}

.searchable-option:active {
    background: var(--bg-elevated);
}

.searchable-option.placeholder-opt {
    color: var(--text-muted);
    font-style: italic;
}

.searchable-option.selected {
    color: var(--accent-light);
    font-weight: 700;
}

.searchable-option.selected i {
    color: var(--accent);
    font-size: 16px;
}

.searchable-option+.searchable-option {
    border-top: 1px solid var(--border);
}