.badge-pill-sm {
    background: var(--bg-surface);
    color: var(--primary);
    padding: 1px 6px;
    border-radius: 4px;
    font-weight: 600;
    font-family: 'Tajawal', sans-serif;
    border: 1px solid var(--border);
}

:root {
    /* Brand Colors mapped to design-tokens.css */
    --primary: #1e40af;
    --secondary: #1e40af; /* Solid royal blue */
    --accent: #1e40af;
    --sidebar-width: 240px;
    --sidebar-collapsed-width: 64px;
    --topbar-height: 60px;
    --bottom-nav-height: 64px;
    --radius-sm: 8px;
    --radius-md: 8px;
    --radius-lg: 8px;
    --radius-pill: 999px;
    --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --bg-dark: var(--bg);
    --bg-surface: var(--bg-surface);
    --bg-surface-hover: color-mix(in srgb, var(--primary) 6%, var(--bg-surface));
    --text-main: var(--text);
    --text-muted: var(--text-muted);
    --border: var(--border);
    --border-bright: var(--border);
    --bg-sidebar: var(--bg-surface);
    --bg-topbar: var(--bg-surface);
    --bg-bottom-nav: var(--bg-surface);
    --bg-modal: var(--bg);
    --bg-table-head: var(--bg-surface);
    --bg-input: var(--bg);
    --bg-input-option: var(--bg);
    --shadow-glow: none;
    --shadow-card: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    --skeleton-bg: linear-gradient(90deg, var(--bg-surface) 25%, var(--border) 37%, var(--bg-surface) 63%);
    --text-glow: var(--text-main);
    --accent-text: var(--primary);
    --secondary-text: var(--primary);
    --success-text: #16a34a;
    --warning-text: #d97706;
    --bg-card-inner: var(--bg-surface);
    --bg-card-inner-hover: color-mix(in srgb, var(--primary) 4%, var(--bg-surface));
}

[data-theme="dark"] {
    --primary: #2547c4;
    --secondary: #2547c4;
    --accent: #2547c4;
    --bg-dark: var(--bg);
    --bg-surface: var(--bg-surface);
    --bg-surface-hover: color-mix(in srgb, var(--primary) 8%, var(--bg-surface));
    --text-main: var(--text);
    --text-muted: var(--text-muted);
    --border: var(--border);
    --border-bright: var(--border);
    --bg-sidebar: var(--bg-surface);
    --bg-topbar: var(--bg-surface);
    --bg-bottom-nav: var(--bg-surface);
    --bg-modal: var(--bg);
    --bg-table-head: var(--bg-surface);
    --bg-input: var(--bg);
    --bg-input-option: var(--bg);
    --shadow-card: 0 1px 3px 0 rgba(0, 0, 0, 0.3), 0 1px 2px 0 rgba(0, 0, 0, 0.2);
    --skeleton-bg: linear-gradient(90deg, var(--bg-surface) 25%, var(--border) 37%, var(--bg-surface) 63%);
    --text-glow: var(--text-main);
    --accent-text: var(--primary);
    --secondary-text: var(--primary);
    --success-text: #4ade80;
    --warning-text: #fbbf24;
    --bg-card-inner: var(--bg-surface);
    --bg-card-inner-hover: color-mix(in srgb, var(--primary) 6%, var(--bg-surface));
}

*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Scrollable utility class */
.scrollable {
    overflow-y: auto;
    scrollbar-width: none;
    /* Firefox */
    -ms-overflow-style: none;
    /* IE and Edge */
}

.scrollable::-webkit-scrollbar {
    display: none;
    /* Chrome/Safari */
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: 'Tajawal', sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-main);
    overflow-x: hidden;
    min-height: 100vh;
    min-height: 100dvh;
    margin: 0;
    padding: 0;
}

#bg-canvas {
    display: none !important;
}

.overlay {
    display: none !important;
}

.app-shell {
    display: flex;
    min-height: 100vh;
    min-height: 100dvh;
    position: relative;
}

.sidebar {
    position: fixed;
    top: 0;
    right: 0;
    width: var(--sidebar-width);
    height: 100%;
    background: var(--bg-sidebar);
    border-left: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    z-index: 200;
    transition: transform var(--transition), width var(--transition);
    overflow: hidden;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1.25rem 1.2rem;
    border-bottom: 1px solid var(--border);
    min-height: var(--topbar-height);
    flex-shrink: 0;
}

.sidebar-brand-icon {
    font-size: 1.4rem;
    flex-shrink: 0;
}

.sidebar-brand-text {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
}

.sidebar-nav {
    flex: 1;
    padding: 1rem 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    overflow-y: auto;
}

.sidebar-nav-btn {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    width: 100%;
    padding: 0.75rem 1rem;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-family: 'Tajawal', sans-serif;
    font-size: 0.98rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition);
    text-align: right;
    white-space: nowrap;
    overflow: hidden;
}

.sidebar-nav-btn:hover {
    background: var(--bg-surface-hover);
    color: var(--text-main);
}

.sidebar-nav-btn.active {
    background: var(--primary);
    color: #ffffff;
    border: none;
    box-shadow: none;
}

.sidebar-nav-btn.active .nav-icon,
.sidebar-nav-btn.active .nav-svg-icon {
    filter: none;
}

[data-theme="dark"] .sidebar-nav-btn.active .nav-svg-icon {
    filter: brightness(0) invert(1);
}

.nav-icon {
    font-size: 1.15rem;
    flex-shrink: 0;
    width: 1.4rem;
    text-align: center;
}

.sidebar-section-header {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    padding: 1.5rem 1.5rem 0.5rem;
    font-weight: 700;
}

.material-symbols-outlined {
    font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
    display: inline-block;
    vertical-align: middle;
    line-height: 1;
    font-size: 1.3rem;
    transition: color var(--transition), font-variation-settings var(--transition);
    color: var(--text-muted);
}

.nav-icon .material-symbols-outlined {
    font-size: 1.4rem;
}

.sidebar-nav-btn:hover .material-symbols-outlined,
.bottom-nav-btn:hover .material-symbols-outlined,
.bottom-nav-btn.active .material-symbols-outlined {
    color: var(--accent);
}

.sidebar-nav-btn.active .material-symbols-outlined {
    color: #ffffff;
}

.nav-label {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-collapse-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0.75rem;
    padding: 0.6rem;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    color: var(--text-muted);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition);
    font-size: 1rem;
    flex-shrink: 0;
}

.sidebar-collapse-btn:hover {
    background: var(--bg-surface-hover);
    color: var(--text-main);
}

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 199;
    opacity: 0;
    transition: opacity var(--transition);
}

.main-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    margin-right: var(--sidebar-width);
    transition: margin-right var(--transition);
    min-height: 100vh;
    min-height: 100dvh;
    background: transparent;
}

#app-content {
    flex: 1;
    padding: 2rem 1.5rem;
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.view-section {
    width: 100%;
    display: none;
    flex-direction: column;
    gap: 1.5rem;
    animation: fadeIn var(--transition);
}

.view-section.active {
    display: flex;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border);
    width: 100%;
    margin-bottom: 1rem;
}

.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.5rem;
    width: 100%;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 100;
    height: var(--topbar-height);
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0 1.25rem;
    background: var(--bg-topbar);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.topbar-hamburger {
    display: none;
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-main);
    border-radius: var(--radius-sm);
    padding: 0.45rem 0.6rem;
    cursor: pointer;
    font-size: 1.2rem;
    transition: all var(--transition);
    flex-shrink: 0;
    line-height: 1;
}

.topbar-hamburger:hover {
    background: var(--bg-surface-hover);
    border-color: var(--border-bright);
}

.topbar-brand {
    display: none;
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-main);
    flex: 1;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-inline-start: auto;
}

#react-clock-mount {
    flex-shrink: 0;
}

/* Premium robust dot separator for desktop and mobile */
.rc-clock__sep {
    visibility: hidden !important;
    position: relative;
    display: inline-block !important;
    width: 10px !important;
}

.rc-clock__sep::after {
    content: "·" !important;
    visibility: visible !important;
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    color: var(--primary);
    font-weight: 700;
    font-size: 0.85rem;
}

[data-theme="dark"] .rc-clock__sep::after {
    text-shadow: 0 0 6px var(--primary);
}

.topbar-secondary-group {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.topbar-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.topbar-divider {
    width: 1px;
    height: 20px;
    background: var(--border);
    margin: 0 0.5rem;
}

.topbar-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: var(--radius-sm);
    background: var(--bg-surface);
    border: 1px solid var(--border);
    color: var(--text-muted);
    cursor: pointer;
    transition: all var(--transition);
}

.topbar-btn-text,
.lang-globe-icon {
    display: none;
}

.topbar-btn:hover {
    background: var(--bg-surface-hover);
    color: var(--accent);
    border-color: var(--accent);
}

.user-info-group {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding-right: 0.5rem;
    flex-shrink: 0;
}

.user-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    line-height: 1.2;
}

.user-meta .u-name {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-main);
}

.user-meta .u-role {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: capitalize;
}

@media (max-width: 768px) {

    .user-meta,
    .topbar-divider:not(.user-divider) {
        display: none;
    }

    .topbar-right {
        position: static;
        gap: 0.75rem;
    }

    .topbar-group {
        gap: 0.25rem;
    }

    #topbar-menu-toggle {
        display: flex !important;
        background: rgba(0, 0, 0, 0.05) !important;
        border: none !important;
        border-radius: 10px !important;
        color: var(--text-main) !important;
        transition: background 0.2s ease;
    }

    [data-theme="dark"] #topbar-menu-toggle {
        background: rgba(255, 255, 255, 0.08) !important;
    }

    #topbar-menu-toggle:hover,
    #topbar-menu-toggle.active {
        background: rgba(0, 0, 0, 0.1) !important;
    }

    [data-theme="dark"] #topbar-menu-toggle:hover,
    [data-theme="dark"] #topbar-menu-toggle.active {
        background: rgba(255, 255, 255, 0.15) !important;
    }

    .topbar-secondary-group {
        display: none;
        flex-direction: column;
        align-items: stretch;
        position: absolute;
        top: calc(var(--topbar-height) - 4px);
        left: 12px;
        right: auto;
        width: 240px;
        background: var(--bg-modal);
        border: 1px solid var(--border);
        border-radius: 22px;
        box-shadow: 0 10px 40px rgba(0, 0, 0, 0.12);
        backdrop-filter: blur(16px);
        -webkit-backdrop-filter: blur(16px);
        padding: 12px;
        gap: 6px;
        z-index: 500;
        animation: slideDownFade 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    }

    [dir="rtl"] .topbar-secondary-group {
        left: auto;
        right: 12px;
    }

    .topbar-secondary-group.active {
        display: flex;
    }

    /* Stack elements inside the dropdown using display: contents to ignore nesting */
    .topbar-secondary-group .topbar-group {
        display: contents;
    }

    .topbar-secondary-group .topbar-divider {
        display: none !important;
    }



    /* Style the notifications wrapper so it stays full-width */
    .topbar-secondary-group .sos-notify-wrap {
        width: 100%;
        display: block;
    }

    /* Restyle buttons as stacked list rows */
    .topbar-secondary-group .topbar-btn {
        display: flex !important;
        width: 100% !important;
        height: 46px !important;
        background: transparent !important;
        border: none !important;
        color: var(--text-main) !important;
        padding: 0 14px !important;
        border-radius: 12px !important;
        align-items: center !important;
        justify-content: flex-start !important;
        gap: 12px !important;
        transition: background 0.2s ease, transform 0.1s ease;
        box-sizing: border-box;
        cursor: pointer;
    }

    .topbar-secondary-group .topbar-btn:hover {
        background: rgba(0, 0, 0, 0.05) !important;
    }

    [data-theme="dark"] .topbar-secondary-group .topbar-btn:hover {
        background: rgba(255, 255, 255, 0.08) !important;
    }

    .topbar-secondary-group .topbar-btn:active {
        transform: scale(0.98);
    }

    /* Display hidden mobile texts and icons */
    .topbar-secondary-group .topbar-btn-text {
        display: inline-block !important;
        font-size: 0.85rem !important;
        font-weight: 500 !important;
        font-family: 'Tajawal', sans-serif !important;
        color: var(--text-main) !important;
    }

    .topbar-secondary-group .lang-globe-icon {
        display: inline-block !important;
        font-size: 1.25rem !important;
        color: var(--text-muted) !important;
    }

    /* Position the active language code as a nice pill badge on the far end */
    .topbar-secondary-group #lang-icon {
        margin-inline-start: auto !important;
        font-size: 0.75rem !important;
        font-weight: 700 !important;
        font-family: 'Inter', sans-serif !important;
        background: rgba(0, 0, 0, 0.05) !important;
        color: var(--text-muted) !important;
        padding: 2px 8px !important;
        border-radius: 8px !important;
        border: 1px solid var(--border) !important;
    }

    [data-theme="dark"] .topbar-secondary-group #lang-icon {
        background: rgba(255, 255, 255, 0.08) !important;
    }

    /* Float the notifications badge pill neatly to the far end */
    .topbar-secondary-group #sos-notify-badge {
        margin-inline-start: auto !important;
        position: static !important;
        inset-inline-end: auto !important;
        top: auto !important;
        background: var(--destructive) !important;
        color: #ffffff !important;
        font-size: 0.75rem !important;
        font-weight: 700 !important;
        padding: 2px 8px !important;
        border-radius: 8px !important;
        line-height: 1 !important;
        min-width: 20px !important;
        height: auto !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
    }
}

.user-avatar-container {
    position: relative;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    overflow: hidden;
    cursor: pointer;
    border: 2px solid var(--border-bright);
    transition: all var(--transition);
}

.user-avatar-container:hover {
    border-color: var(--accent);
    box-shadow: 0 0 10px rgba(76, 201, 240, 0.3);
}

.user-avatar {
    width: 100%;
    height: 100%;
    object-fit: cover;
    background-color: var(--bg-surface);
}

.avatar-loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.sync-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
    flex-shrink: 0;
}

#system-status {
    padding: 0 1.5rem;
    padding-top: 1rem;
}

.sync-warning,
.sync-ok {
    padding: 0.75rem 1.1rem;
    border-radius: var(--radius-md);
    font-size: 0.9rem;
}

.sync-warning {
    background: color-mix(in srgb, var(--warning-text) 10%, var(--bg-surface));
    color: var(--warning-text);
    border: 1px solid color-mix(in srgb, var(--warning-text) 30%, var(--border));
}

.sync-ok {
    background: color-mix(in srgb, var(--success-text) 10%, var(--bg-surface));
    color: var(--success-text);
    border: 1px solid color-mix(in srgb, var(--success-text) 30%, var(--border));
}

.bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: var(--bottom-nav-height);
    background: var(--bg-bottom-nav);
    border-top: 1px solid var(--border);
    z-index: 150;
    padding: 0 0.5rem;
    padding-bottom: env(safe-area-inset-bottom, 0);
}

.bottom-nav-inner {
    display: flex;
    align-items: center;
    justify-content: space-around;
    height: 100%;
}

.bottom-nav-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.2rem;
    flex: 1;
    height: 100%;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-family: 'Tajawal', sans-serif;
    font-size: 0.65rem;
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: all var(--transition);
    padding: 0.4rem 0.25rem;
    min-width: 0;
}

.bottom-nav-btn .nav-icon {
    font-size: 1.3rem;
    width: auto;
    margin-bottom: 0.1rem;
}

.bottom-nav-btn:hover,
.bottom-nav-btn.active {
    color: var(--accent);
}

.bottom-nav-btn.active .nav-icon,
.bottom-nav-btn.active .nav-svg-icon {
    filter: none;
}

[data-theme="dark"] .bottom-nav-btn.active .nav-svg-icon {
    filter: brightness(0) invert(1);
}

.bottom-nav-btn.active .nav-label {
    font-weight: 700;
}

.glow-text {
    color: var(--text-main);
    background: none;
    -webkit-background-clip: initial;
    -webkit-text-fill-color: initial;
    filter: none;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

/* ── Dashboard grouped boxes ─────────────────────────────────────────── */
.dashboard-grouped-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.25rem;
    width: 100%;
}

.group-card {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding: 1.4rem 1.25rem;
}

.group-card-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-main);
    margin: 0;
    padding-bottom: 0.6rem;
    border-bottom: 1px solid var(--border);
    text-align: start;
}

.group-card-stats {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.mini-stat {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.5rem 0.75rem;
    background: var(--bg-card-inner);
    border-radius: var(--radius-sm);
    transition: background var(--transition);
}

.mini-stat:hover {
    background: var(--bg-card-inner-hover);
}

.mini-stat-label {
    font-size: 0.88rem;
    color: var(--text-muted);
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.mini-stat-value {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text-main);
    line-height: 1;
    flex-shrink: 0;
}

.clickable-card {
    cursor: pointer;
    user-select: none;
}

.clickable-card:hover {
    background: var(--bg-card-inner-hover);
    border-color: var(--primary);
}

.clickable-card:active {
    background: var(--bg-card-inner-hover);
}

@media (max-width: 480px) {
    .dashboard-grouped-grid {
        gap: 0.85rem;
    }

    .group-card {
        padding: 1rem 0.85rem;
        gap: 0.8rem;
    }

    .mini-stat {
        padding: 0.45rem 0.6rem;
    }

    .mini-stat-label {
        font-size: 0.82rem;
    }

    .mini-stat-value {
        font-size: 1.15rem;
    }

    .group-card-title {
        font-size: 0.92rem;
    }
}

.stat-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 1.5rem 1rem;
    text-align: center;
    transition: background var(--transition), border-color var(--transition);
}

.stat-card:hover {
    background: var(--bg-card-inner-hover);
    border-color: var(--primary);
}

.stat-card h3 {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.stat-card h2 {
    font-size: clamp(2rem, 4vw, 3rem);
    color: var(--primary);
    text-shadow: none;
}

.latest-tickets-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.2rem;
}

.latest-ticket-card {
    padding: 1.2rem;
    cursor: pointer;
    text-align: right;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    position: relative;
    overflow: hidden;
    border-right: 4px solid #ff3366;
}

.latest-ticket-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.5rem;
}

.latest-ticket-header h4 {
    margin: 0;
    font-size: 1.05rem;
    line-height: 1.4;
    color: var(--text-main);
    flex: 1;
}

.new-badge {
    background: var(--destructive);
    color: white;
    font-size: 0.75rem;
    font-weight: 700;
    padding: 0.2rem 0.5rem;
    border-radius: var(--radius-pill);
    flex-shrink: 0;
}

.pulse-red {
    animation: pulse-red-opacity 2s infinite;
}

@keyframes pulse-red-opacity {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.6;
    }
}

.latest-ticket-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85rem;
    color: var(--text-muted);
    border-top: 1px solid var(--border);
    padding-top: 0.6rem;
}

.latest-ticket-routing {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    font-size: 0.82rem;
    color: var(--text-muted);
}

.latest-ticket-routing .routing-row {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.latest-ticket-routing .routing-row .material-symbols-outlined {
    font-size: 0.95rem;
    color: var(--accent);
}

.latest-ticket-routing .routing-row b {
    color: var(--text-main);
    font-weight: 600;
}

.glass-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    transition: background var(--transition), border-color var(--transition);
    position: relative;
}

.glass-card:hover {
    background: var(--bg-card-inner-hover);
    border-color: var(--primary);
}

.ticket-card {
    text-align: right;
    padding: 1.5rem;
}

.ticket-card h3 {
    margin-bottom: 0.5rem;
    font-size: 1.05rem;
}

.ticket-card p {
    color: var(--text-muted);
    font-size: 0.9rem;
    line-height: 1.5;
    margin-bottom: 0.5rem;
}

.ticket-card small {
    display: block;
    color: var(--text-muted);
    font-size: 0.8rem;
    margin-bottom: 0.75rem;
}

.badge-status {
    display: inline-block;
    padding: 0.2rem 0.7rem;
    border-radius: var(--radius-pill);
    font-size: 0.82rem;
    margin-bottom: 0.75rem;
    font-weight: 600;
}

.status-open {
    background: color-mix(in srgb, var(--primary) 10%, var(--bg-surface));
    color: var(--primary);
    border: 1px solid color-mix(in srgb, var(--primary) 30%, var(--border));
}

.status-progress {
    background: color-mix(in srgb, var(--warning-text) 10%, var(--bg-surface));
    color: var(--warning-text);
    border: 1px solid color-mix(in srgb, var(--warning-text) 30%, var(--border));
}

.status-closed {
    background: color-mix(in srgb, var(--success-text) 10%, var(--bg-surface));
    color: var(--success-text);
    border: 1px solid color-mix(in srgb, var(--success-text) 30%, var(--border));
}

.ticket-actions {
    margin-top: 0.75rem;
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.glow-button {
    padding: 0.7rem 1.8rem;
    font-size: 1rem;
    font-weight: 700;
    color: #ffffff;
    background: var(--primary);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: background var(--transition);
    box-shadow: none;
    font-family: 'Tajawal', sans-serif;
    white-space: nowrap;
}

.glow-button::before {
    display: none;
}

.glow-button:hover {
    background: var(--primary-hover);
    transform: none;
    box-shadow: none;
}

.glow-button:hover::before {
    display: none;
}

.glow-button:active {
    transform: none;
}

.nav-btn {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-main);
    font-size: 0.9rem;
    cursor: pointer;
    padding: 0.4rem 0.9rem;
    border-radius: 8px;
    transition: background var(--transition), border-color var(--transition);
    font-family: 'Tajawal', sans-serif;
    white-space: nowrap;
}

.nav-btn:hover {
    color: var(--text-main);
    background: var(--bg-surface-hover);
    border-color: var(--primary);
}

.action-btn {
    font-size: 0.88rem;
    padding: 0.38rem 0.8rem;
}

.danger {
    background: var(--destructive);
    border: none;
    color: #ffffff;
}

.danger:hover {
    background: var(--destructive-hover);
    border: none;
    color: #ffffff;
}

/* Form Layouts */
.form-row {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    width: 100%;
}

.form-row>.form-group {
    flex: 1 1 250px;
    min-width: 0;
}

.form-row input,
.form-row select,
.form-row textarea {
    flex: 1 1 250px;
    width: 100%;
    min-width: 0;
}

.form-group {
    margin-bottom: 1.25rem;
    text-align: right;
    width: 100%;
}

.form-group label {
    display: block;
    margin-bottom: 0.4rem;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.glass-input {
    width: 100%;
    max-width: 100%;
    background: var(--bg-input);
    border: 1px solid var(--border);
    color: var(--text-main);
    padding: 0.75rem 1rem;
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    outline: none;
    transition: border-color var(--transition), box-shadow var(--transition);
    font-family: 'Tajawal', sans-serif;
}

.glass-input:focus {
    border-color: var(--primary);
    box-shadow: none;
}

.glass-input option {
    background: var(--bg-input-option);
    color: var(--text-main);
}

.password-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.password-input-wrapper input {
    padding-left: 3.5rem;
}

.password-toggle-btn {
    position: absolute;
    left: 0.75rem;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0.6rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    transition: all 0.25s ease;
    color: var(--text-muted);
    z-index: 1;
}

.password-toggle-btn:hover {
    color: var(--text-main);
    background: var(--bg-surface-hover);
    transform: scale(1.1);
}

.password-toggle-btn:active {
    transform: scale(0.95);
}

.eye-icon {
    width: 1.3rem;
    height: 1.3rem;
    transition: all 0.25s ease;
}

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    padding: 1rem;
}

.modal-overlay.hidden {
    display: none;
}

.glass-modal {
    background: var(--bg-modal);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 2rem;
    width: 100%;
    max-width: 480px;
    max-height: 90vh;
    overflow-y: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
    position: relative;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3);
    animation: fadeInUp 0.25s ease-out;
}

.glass-modal::-webkit-scrollbar {
    display: none;
}

.glass-modal h2 {
    font-size: 1.3rem;
    margin-bottom: 1.25rem;
}

.close-modal-btn {
    position: absolute;
    top: 1rem;
    left: 1rem;
    right: auto;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    transition: color var(--transition);
    z-index: 10;
}

.close-modal-btn:hover {
    color: var(--text-main);
}

#close-modal {
    position: absolute;
    top: 1rem;
    left: 1rem;
    right: auto;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    transition: color var(--transition);
    z-index: 10;
}

#close-modal:hover {
    color: var(--text-main);
}

.toast-container {
    position: fixed;
    bottom: calc(var(--bottom-nav-height) + 12px);
    left: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    z-index: 9999;
    max-width: calc(100vw - 2rem);
}

.toast {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-left: 4px solid var(--primary);
    padding: 0.75rem 1.25rem;
    border-radius: var(--radius-sm);
    color: var(--text-main);
    backdrop-filter: none;
    animation: toastSlideIn 0.3s ease-out;
    font-size: 0.9rem;
    max-width: 340px;
    box-shadow: var(--shadow-card);
    transition: opacity 0.3s;
}

.toast.toast-error {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-left: 4px solid var(--destructive);
    color: var(--text-main);
}

@keyframes toastSlideIn {
    from {
        transform: translateX(-100%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

[dir="rtl"] @keyframes toastSlideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.employees-view {
    display: grid;
    gap: 1rem;
}

.employees-toolbar {
    padding: 1rem;
    border-radius: var(--radius-md);
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.employees-toolbar>* {
    flex: 1 1 200px;
}

.employees-toolbar .glass-input {
    padding: 0.7rem 0.9rem;
    font-size: 0.9rem;
}

.employees-table-wrap {
    padding: 0;
    border-radius: var(--radius-md);
    overflow: hidden;
}

.employees-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
}

.employees-table thead th {
    position: sticky;
    top: 0;
    z-index: 5;
    background: var(--bg-table-head);
    color: var(--text-main);
    text-align: right;
    padding: 0.85rem 1rem;
    font-size: 0.85rem;
    border-bottom: 1px solid var(--border);
}

.employees-table tbody td {
    padding: 0.7rem 1rem;
    border-bottom: 1px solid var(--border);
    font-size: 0.93rem;
    vertical-align: middle;
}

.employee-row {
    transition: background var(--transition);
}

.employee-row:hover {
    background: var(--bg-card-inner);
}

.employee-avatar-sm {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid var(--border-bright);
}

.employee-status-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 80px;
    border-radius: var(--radius-pill);
    padding: 0.2rem 0.6rem;
    font-size: 0.78rem;
    border: 1px solid transparent;
}

.employee-status-pill.status-active {
    color: var(--success-text);
    background: rgba(31, 201, 127, 0.14);
    border-color: rgba(31, 201, 127, 0.4);
}

.employee-status-pill.status-inactive {
    color: var(--secondary-text);
    background: rgba(247, 37, 133, 0.14);
    border-color: rgba(247, 37, 133, 0.4);
}

.employee-actions {
    display: inline-flex;
    gap: 0.4rem;
    opacity: 0.35;
    transition: opacity var(--transition);
}

.employee-row:hover .employee-actions,
.employee-compact-card:hover .employee-actions {
    opacity: 1;
}

.employee-action-btn {
    padding: 0.3rem 0.65rem;
    font-size: 0.8rem;
}

.employee-action-btn[disabled] {
    cursor: not-allowed;
    opacity: 0.5;
}

.employees-empty-state {
    text-align: center;
    padding: 2rem 1rem;
}

.employees-empty-state h3 {
    font-size: 1.05rem;
    margin-bottom: 0.4rem;
}

.employees-empty-state p {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.skeleton {
    border-radius: var(--radius-sm);
    background: var(--skeleton-bg);
    background-size: 400% 100%;
    animation: skeletonShimmer 1.3s infinite;
}

@keyframes skeletonShimmer {
    0% {
        background-position: 100% 0;
    }

    100% {
        background-position: 0 0;
    }
}

.skeleton-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
}

.skeleton-line {
    width: 100%;
    height: 11px;
}

.skeleton-line.short {
    width: 55%;
}

.skeleton-pill {
    width: 80px;
    height: 22px;
    border-radius: var(--radius-pill);
}

.skeleton-actions {
    width: 100px;
    height: 24px;
}

.employees-compact-wrap {
    display: none;
    gap: 0.75rem;
}

.employee-compact-card {
    background: var(--bg-card-inner);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 0.85rem 1rem;
    display: grid;
    align-items: center;
    grid-template-columns: auto 1fr auto;
    gap: 0.75rem;
    transition: background var(--transition);
}

.employee-compact-card:hover {
    background: var(--bg-card-inner-hover);
}

.employee-compact-info h3 {
    font-size: 0.95rem;
    margin-bottom: 2px;
}

.employee-compact-info p {
    color: var(--text-muted);
    font-size: 0.82rem;
}

.employee-actions.compact {
    grid-column: 1 / -1;
    justify-content: flex-end;
    opacity: 1;
}

.muted-line {
    color: var(--text-muted);
    margin: 0.6rem 0 0.9rem;
    font-size: 0.9rem;
    line-height: 1.6;
}

.meta-pills {
    display: flex;
    gap: 0.45rem;
    flex-wrap: wrap;
    margin: 0.75rem 0;
}

.meta-pill {
    background: var(--bg-card-inner-hover);
    border: 1px solid var(--border);
    border-radius: var(--radius-pill);
    padding: 0.28rem 0.7rem;
    font-size: 0.82rem;
    color: var(--text-muted);
}

.inline-form {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.6rem;
    width: 100%;
}

.inline-form>* {
    flex: 1 1 150px;
}

.inline-form button {
    flex: 0 0 auto;
}

.task-row {
    background: var(--bg-card-inner);
    padding: 0.65rem 0.85rem;
    border-radius: var(--radius-sm);
    margin-bottom: 0.45rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.task-row>span {
    font-size: 0.9rem;
}

.comment-list {
    max-height: 320px;
    overflow-y: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.comment-list::-webkit-scrollbar {
    display: none;
}

.comment-item {
    background: var(--bg-card-inner);
    padding: 0.45rem 0.7rem;
    border-radius: var(--radius-sm);
    margin-bottom: 0.4rem;
    font-size: 0.88rem;
}

.sos-comment {
    display: flex;
    align-items: flex-start;
    gap: 0.9rem;
    background: var(--bg-surface);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.85rem 1rem;
    transition: border-color var(--transition), background var(--transition);
}

.sos-comment:hover {
    border-color: var(--primary);
    background: var(--bg-card-inner-hover);
}

.sos-comment__text {
    flex: 1;
    font-size: 0.9rem;
    line-height: 1.7;
    color: var(--md-sys-color-on-surface, var(--text, #e9ecf5));
    word-break: break-word;
}

.sos-comment__time {
    flex: none;
    font-size: 0.72rem;
    color: var(--text-muted, rgba(233, 236, 245, .5));
    opacity: .7;
    white-space: nowrap;
    margin-top: 0.15rem;
}

.divider {
    border: 0;
    border-top: 1px solid var(--border);
    margin: 0.85rem 0;
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(25px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

body.sidebar-collapsed .sidebar {
    width: var(--sidebar-collapsed-width);
}

body.sidebar-collapsed .sidebar-brand-text,
body.sidebar-collapsed .nav-label {
    display: none;
}

body.sidebar-collapsed .main-area {
    margin-right: var(--sidebar-collapsed-width);
}

body.sidebar-collapsed .sidebar-nav-btn {
    justify-content: center;
    padding: 0.75rem;
}

body.sidebar-collapsed .sidebar-brand {
    justify-content: center;
    padding: 1.25rem 0.5rem;
}

body.sidebar-open .sidebar {
    transform: translateX(0) !important;
}

body.sidebar-open .sidebar-overlay {
    display: block;
    opacity: 1;
}

/* ═══ Desktop ≥1025px ═══════════════════════════════════════════════════ */
@media (min-width: 1025px) {
    .sidebar-collapse-btn {
        display: flex;
    }

    .topbar-hamburger,
    .topbar-brand,
    .bottom-nav {
        display: none;
    }

    #app-content {
        padding: 1.5rem 2rem;
    }

    #system-status {
        padding: 1rem 2rem 0;
    }
}

/* ═══ Tablet 769–1024px ═════════════════════════════════════════════════ */
@media (max-width: 1024px) {
    .sidebar-collapse-btn {
        display: none;
    }

    .topbar-hamburger {
        display: flex;
    }

    .topbar-brand {
        display: block;
    }

    /* sidebar collapses to icon-only (64px) */
    .sidebar {
        width: var(--sidebar-collapsed-width);
    }

    .sidebar-brand-text,
    .nav-label {
        display: none;
    }

    .sidebar-nav-btn {
        justify-content: center;
        padding: 0.75rem;
    }

    .sidebar-brand {
        justify-content: center;
        padding: 1.25rem 0.5rem;
    }

    /* RTL: sidebar is 64px on right → margin-right:64px (rtl.css handles LTR) */
    .main-area {
        margin-right: var(--sidebar-collapsed-width);
        width: calc(100% - var(--sidebar-collapsed-width));
    }

    #app-content {
        padding: 1.5rem 1rem;
    }

    .employees-toolbar {
        grid-template-columns: 1fr 1fr;
    }

    .latest-tickets-grid {
        grid-template-columns: 1fr;
    }
}

/* ═══ Mobile ≤768px ═════════════════════════════════════════════════════ */
@media (max-width: 768px) {

    /* ── App shell ── */
    .app-shell {
        overflow-x: hidden;
        width: 100%;
    }

    /* ── Sidebar: slide off-screen (RTL = right edge, LTR handled in rtl.css) ── */
    .sidebar {
        transform: translateX(100%);
        width: var(--sidebar-width) !important;
    }

    /* When opened by hamburger, restore full labels */
    .sidebar-brand-text,
    .nav-label {
        display: block !important;
    }

    .sidebar-nav-btn {
        justify-content: flex-start !important;
        padding: 0.75rem 1rem !important;
    }

    .sidebar-brand {
        justify-content: flex-start !important;
        padding: 1.25rem 1.2rem !important;
    }

    .sidebar-collapse-btn {
        display: none !important;
    }

    /* ── Main area: full width, no sidebar margin ── */
    .main-area {
        margin: 0 !important;
        width: 100% !important;
        max-width: 100vw !important;
    }

    /* ── Topbar ── */
    .topbar-hamburger {
        display: none !important;
    }

    .topbar-brand {
        display: block;
        margin-inline-start: 0.5rem;
    }

    .topbar {
        padding: 0 0.75rem;
        gap: 0.5rem;
    }



    /* ── Bottom nav ── */
    .bottom-nav {
        display: flex;
    }

    .bottom-nav-btn {
        gap: 0.1rem !important;
        font-size: 0.58rem !important;
        padding: 0.35rem 0.15rem !important;
    }

    .bottom-nav-btn .nav-icon {
        font-size: 1.15rem !important;
        margin-bottom: 0px !important;
    }

    /* ── Content padding (room for bottom nav) ── */
    #app-content {
        padding: 0.75rem;
        padding-bottom: calc(var(--bottom-nav-height) + 1.5rem);
    }

    /* ── Grids ── */
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .cards-grid {
        grid-template-columns: 1fr;
    }

    .latest-tickets-grid {
        grid-template-columns: 1fr;
    }

    /* ── Section header ── */
    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }

    .section-header .glow-button {
        width: 100%;
        text-align: center;
    }

    /* ── Employees ── */
    .employees-toolbar {
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }

    .employees-table-wrap {
        display: none !important;
    }

    .employees-compact-wrap {
        display: flex !important;
        flex-direction: column;
        gap: 0.75rem;
    }

    /* ── Modal ── */
    .glass-modal {
        padding: 1.25rem 1rem;
        border-radius: var(--radius-md);
        max-height: 92vh;
    }

    .inline-form {
        grid-template-columns: 1fr;
    }

    /* ── Toast ── */
    .toast-container {
        left: 0.75rem;
        right: 0.75rem;
        max-width: 100%;
        bottom: calc(var(--bottom-nav-height) + 8px);
    }

    .toast {
        max-width: 100%;
    }

    /* ── Footer: hide app-footer, show sidebar-footer ── */
    .app-footer {
        display: none !important;
    }

    .sidebar-footer {
        display: block;
    }
}

/* ═══ Small phones ≤480px ═══════════════════════════════════════════════ */
@media (max-width: 480px) {
    .stat-card {
        padding: 0.85rem 0.6rem;
    }

    .stat-card h3 {
        font-size: 0.8rem;
    }

    .stat-card h2 {
        font-size: 1.6rem;
    }

    .glow-button {
        padding: 0.6rem 1rem;
        font-size: 0.88rem;
    }

    .ticket-card {
        padding: 1rem;
    }

    .topbar-btn {
        width: 34px;
        height: 34px;
    }

    /* ── Mobile Expanded Clock Widget ── */
    .rc-clock {
        position: relative;
        cursor: pointer;
        transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    }
    
    .rc-clock__dates {
        position: absolute;
        top: calc(100% + 8px);
        inset-inline-end: 0;
        z-index: 1000;
        min-width: max-content;
        background: var(--bg-modal) !important;
        border: 1px solid var(--border) !important;
        border-radius: 14px !important;
        padding: 10px 16px !important;
        box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15) !important;
        backdrop-filter: blur(16px) !important;
        -webkit-backdrop-filter: blur(16px) !important;
        opacity: 0 !important;
        transform: translateY(-8px) scale(0.95);
        pointer-events: none;
        transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1) !important;
        
        display: flex !important;
        flex-direction: column !important;
        flex-wrap: nowrap !important;
        justify-content: center !important;
        gap: 4px !important;
        font-size: 0.72rem !important;
        align-items: center !important;
        white-space: nowrap !important;
        overflow: visible !important;
        max-height: none !important;
        margin-top: 0 !important;
    }

    .rc-clock__sep {
        display: none !important;
    }

    .rc-clock--expanded {
        background: var(--bg-modal) !important;
        border-color: var(--primary) !important;
        box-shadow: 
            0 4px 12px rgba(0, 0, 0, 0.1),
            0 0 8px rgba(37, 71, 196, 0.1) !important;
        padding: 5px 10px !important; /* Zero layout shift! Same as collapsed */
    }

    .rc-clock--expanded .rc-clock__dates {
        opacity: 1 !important;
        transform: translateY(0) scale(1) !important;
        pointer-events: auto !important;
    }

    [data-theme="dark"] .rc-clock--expanded .rc-clock__dates {
        box-shadow: 
            0 10px 30px rgba(0, 0, 0, 0.4),
            0 0 15px rgba(37, 71, 196, 0.15) !important;
        border-color: rgba(37, 71, 196, 0.4) !important;
    }

    .footer-text {
        font-size: 0.75rem;
    }
}

/* ═══ Extra small ≤360px ════════════════════════════════════════════════ */
@media (max-width: 360px) {
    #app-content {
        padding: 0.5rem;
    }

    .topbar {
        padding: 0 0.5rem;
    }

    .footer-text {
        font-size: 0.7rem;
    }
}

.theme-toggle-btn {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-main);
    border-radius: var(--radius-sm);
    padding: 0.45rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition);
    margin-right: 0.5rem;
    width: 36px;
    height: 36px;
}

.theme-toggle-btn:hover {
    background: var(--bg-surface-hover);
    border-color: var(--border-bright);
}

.theme-toggle-btn .material-symbols-outlined {
    font-size: 1.25rem;
    color: var(--text-main);
}

.profile-modal-content {
    text-align: center;
    padding: 1rem 0.5rem;
}

.profile-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.25rem;
    margin: 1.5rem 0;
}

.profile-avatar-wrapper {
    position: relative;
    width: 120px;
    height: 120px;
}

.profile-avatar-large {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--accent);
    box-shadow: 0 0 20px rgba(76, 201, 240, 0.3);
}

.avatar-edit-btn {
    position: absolute;
    bottom: 5px;
    right: 5px;
    background: var(--primary);
    color: white;
    border: none;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
    transition: transform var(--transition);
}

.avatar-edit-btn:hover {
    transform: scale(1.1);
}

.avatar-edit-btn .material-symbols-outlined {
    font-size: 1.1rem;
    color: white;
}

.reveal-new-pass {
    animation: slideDown 0.5s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
        max-height: 0;
    }

    to {
        opacity: 1;
        transform: translateY(0);
        max-height: 600px;
    }
}

.success-check span {
    animation: pulseCheck 1s ease-in-out;
}

@keyframes pulseCheck {
    0% {
        transform: scale(0.5);
        opacity: 0;
    }

    50% {
        transform: scale(1.2);
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* sidebar-footer is shown on mobile via the 768px block above */
.sidebar-footer {
    display: none;
    padding: 1.25rem 1rem;
    border-top: 1px solid var(--border);
    font-size: 0.75rem;
    color: var(--text-muted);
    text-align: center;
    line-height: 1.5;
    margin-top: auto;
}

.sidebar-footer .developer-name {
    color: var(--accent);
    font-weight: 700;
}

.app-footer {
    background: var(--bg-surface);
    border-top: 1px solid var(--border);
    padding: 1rem;
    text-align: center;
    margin-top: auto;
    flex-shrink: 0;
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
}

.footer-text {
    font-size: 0.85rem;
    color: var(--text-muted);
    line-height: 1.6;
    margin: 0;
}

.footer-text .developer-name {
    color: var(--accent);
    font-weight: 600;
    transition: color var(--transition);
}

.footer-text .developer-name:hover {
    color: var(--secondary);
}

.login-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: transparent;
    padding: 1rem;
    text-align: center;
    z-index: 5;
}

.login-footer .footer-text {
    font-size: 0.8rem;
    color: var(--text-muted);
    opacity: 0.8;
}

/* ═══ IT Tasks Form — Responsive ════════════════════════════════════════ */
.it-form-container {
    max-width: 800px;
    width: 100%;
    margin: 0 auto;
    padding: 1.5rem;
    overflow: hidden;
}

.it-image-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 0.5rem;
    width: 100%;
}

.it-task-images {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 0.5rem;
    width: 100%;
}

.it-task-images img {
    width: 100%;
    height: 80px;
    object-fit: cover;
    border-radius: 8px;
    cursor: pointer;
    border: 1px solid var(--border);
}

/* ═══ Activity Log Responsive ═══════════════════════════════════════════ */
.activity-log-mobile-list {
    display: none;
}

.activity-log-card {
    padding: 0.8rem;
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}

.activity-log-card-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.86rem;
}

/* ── Mobile: stack all form-row children vertically ── */
@media (max-width: 768px) {
    .activity-log-table-wrap {
        display: none !important;
    }

    .activity-log-mobile-list {
        display: flex;
        flex-direction: column;
        gap: 0.6rem;
    }

    .form-row {
        flex-direction: column;
    }

    .form-row>.form-group {
        flex: 1 1 100%;
        width: 100%;
    }

    .form-row input,
    .form-row select,
    .form-row textarea {
        flex: 1 1 100%;
        width: 100%;
    }

    .it-form-container {
        max-width: 100%;
        padding: 1rem;
    }

    .it-image-grid {
        grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    }

    .it-task-images {
        grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
    }

    .it-task-images img {
        height: 60px;
    }
}

/* Custom premium responsive routing details style */
.routing-details.glass-card {
    margin: 1rem 0 0 0 !important;
    padding: 0.5rem 0.75rem !important;
    background: rgba(255, 255, 255, 0.02) !important;
    border: 1px solid rgba(255, 255, 255, 0.05) !important;
    border-radius: var(--radius-sm, 6px) !important;
}

.routing-details__row {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    align-items: center;
    justify-content: flex-start;
}

.routing-details__item {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex: 0 1 auto;
    min-width: 140px;
}

.routing-icon {
    font-size: 1.15rem !important; /* Smaller icon size */
    opacity: 0.85;
}

.routing-text {
    display: flex;
    flex-direction: column;
}

.routing-label {
    font-size: 0.7rem !important; /* Smaller label font */
    color: var(--text-muted) !important;
    line-height: 1.1;
    display: block;
}

.routing-val {
    font-size: 0.8rem !important; /* Smaller value font */
    font-weight: 600 !important;
    color: var(--text-main, #ffffff) !important;
    line-height: 1.2;
}

/* Fallback/responsive stacking on very narrow screens */
@media (max-width: 480px) {
    .routing-details__row {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    .routing-details__item {
        width: 100%;
    }
}

/* --- Lightbox Styles --- */
.sos-lightbox-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.85);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.25s ease;
}
.sos-lightbox-overlay.show {
    opacity: 1;
}
.sos-lightbox-content {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
    display: flex;
    align-items: center;
    justify-content: center;
}
.sos-lightbox-img {
    max-width: 90vw;
    max-height: 80vh;
    object-fit: contain;
    border-radius: var(--radius-sm, 8px);
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}
.sos-lightbox-close, .sos-lightbox-nav {
    position: absolute;
    background: var(--bg-surface);
    color: var(--text-main);
    border: 1px solid var(--border);
    border-radius: 50%;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 100000;
    transition: all 0.2s;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}
.sos-lightbox-close:hover, .sos-lightbox-nav:hover {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}
.sos-lightbox-nav:disabled {
    opacity: 0.3;
    cursor: not-allowed;
    background: var(--bg-surface);
    color: var(--text-muted);
}
.sos-lightbox-close {
    top: 24px;
    right: 24px;
}
[dir="rtl"] .sos-lightbox-close {
    right: auto;
    left: 24px;
}
.sos-lightbox-nav {
    top: 50%;
    transform: translateY(-50%);
}
.sos-lightbox-prev {
    left: 24px;
}
.sos-lightbox-next {
    right: 24px;
}
[dir="rtl"] .sos-lightbox-prev {
    left: auto;
    right: 24px;
}
[dir="rtl"] .sos-lightbox-next {
    right: auto;
    left: 24px;
}
.sos-lightbox-counter {
    position: absolute;
    bottom: -40px;
    left: 50%;
    transform: translateX(-50%);
    color: #fff;
    font-size: 0.9rem;
    font-weight: 500;
    font-family: 'Inter', sans-serif;
    letter-spacing: 2px;
}

/* --- Share Feature --- */

/* Desktop Dropdown Container */
.share-dropdown-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 0;
    overflow: visible;
    z-index: 1010;
}

.share-dropdown {
    position: absolute;
    background: var(--bg-modal);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    padding: 6px;
    min-width: 180px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    animation: fadeInShare 0.15s ease-out;
}

@keyframes fadeInShare {
    from { opacity: 0; transform: translateY(-5px); }
    to { opacity: 1; transform: translateY(0); }
}

.share-dropdown-option-btn {
    background: transparent;
    border: none;
    border-radius: 6px;
    color: var(--text-main);
    padding: 10px 12px;
    font-size: 0.9rem;
    font-family: inherit;
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    text-align: inherit;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease;
}

.share-dropdown-option-btn:hover {
    background: var(--bg-surface-hover);
    color: var(--primary);
}

.share-dropdown-option-btn .material-symbols-outlined {
    font-size: 1.2rem;
}

/* Mobile Bottom Sheet Overlay */
.share-bottom-sheet-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1020;
    display: flex;
    align-items: flex-end;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.share-bottom-sheet-overlay.show {
    opacity: 1;
    visibility: visible;
}

.share-bottom-sheet {
    background: var(--bg-modal);
    border-top: 1px solid var(--border);
    border-top-left-radius: 16px;
    border-top-right-radius: 16px;
    width: 100%;
    max-width: 640px;
    margin: 0 auto;
    padding: 16px 20px 24px 20px;
    box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.15);
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    box-sizing: border-box;
}

.share-bottom-sheet.show {
    transform: translateY(0);
}

.share-sheet-drag-handle {
    width: 40px;
    height: 4px;
    background: var(--border);
    border-radius: 2px;
    margin: 0 auto 16px auto;
}

.share-sheet-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.share-sheet-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-main);
}

.share-sheet-close-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 4px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.share-sheet-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.share-sheet-option-btn {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    color: var(--text-main);
    padding: 0 16px;
    min-height: 56px;
    font-size: 1rem;
    font-family: inherit;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    text-align: inherit;
    cursor: pointer;
    box-sizing: border-box;
    transition: background 0.2s ease, border-color 0.2s ease;
}

.share-sheet-option-btn:active, .share-sheet-option-btn:hover {
    background: var(--bg-surface-hover);
    border-color: var(--primary);
    color: var(--primary);
}

.share-sheet-option-btn .material-symbols-outlined {
    font-size: 1.4rem;
}
/* ================================================
   Export Mode � freezes CSS during html-to-image capture
   Applied via JS: document.documentElement.classList.add('export-mode')
   ================================================ */
.export-mode *,
.export-mode *::before,
.export-mode *::after {
    animation: none !important;
    transition: none !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    filter: none !important;
}

/* ==========================================================================
   FEEDBACK SYSTEM PREMIUM STYLES
   ========================================================================== */

/* Emoji Rating Scales */
.emoji-rating-scale {
    display: flex;
    gap: var(--sos-space-3, 0.75rem);
    margin-top: 0.5rem;
}

.emoji-btn {
    font-size: 1.6rem;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border);
    border-radius: 50%;
    width: 46px;
    height: 46px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

.emoji-btn:hover {
    background: rgba(0, 255, 136, 0.08);
    border-color: var(--accent);
    transform: scale(1.15) rotate(5deg);
}

.emoji-btn.selected {
    background: rgba(0, 255, 136, 0.16) !important;
    border-color: var(--accent) !important;
    box-shadow: 0 0 12px rgba(0, 255, 136, 0.4) !important;
    transform: scale(1.2);
}

/* Floating Feedback Widget */
.sos-floating-widget {
    position: fixed;
    bottom: 24px;
    left: 24px;
    z-index: 9999;
    max-width: 380px;
    width: calc(100vw - 48px);
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    animation: widgetSlideIn 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

[dir="rtl"] .sos-floating-widget {
    left: 24px;
    right: auto;
}

.sos-floating-widget.hidden {
    opacity: 0;
    transform: translateY(40px) scale(0.95);
    pointer-events: none;
}

.sos-floating-widget.fade-out {
    opacity: 0;
    transform: translateY(20px) scale(0.95);
    pointer-events: none;
}

.feedback-widget-card {
    position: relative;
    padding: 1.5rem !important;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3) !important;
    border: 1px solid rgba(255, 255, 255, 0.08) !important;
    backdrop-filter: blur(20px) !important;
    -webkit-backdrop-filter: blur(20px) !important;
}

.close-widget-btn {
    position: absolute;
    top: 12px;
    right: 12px;
    background: transparent;
    border: none;
    font-size: 1.5rem;
    color: var(--text-muted);
    cursor: pointer;
    line-height: 1;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

[dir="rtl"] .close-widget-btn {
    right: auto;
    left: 12px;
}

.close-widget-btn:hover {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-main);
}

.widget-header {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
    padding-inline-end: 20px;
}

.widget-title-icon {
    font-size: 1.8rem;
    color: var(--accent);
    margin-top: 2px;
}

.widget-titles {
    display: flex;
    flex-direction: column;
}

.widget-title {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-main);
}

.widget-subtitle {
    margin: 4px 0 0 0;
    font-size: 0.8rem;
    color: var(--text-muted);
    line-height: 1.35;
}

.widget-form-group {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.widget-label {
    font-size: 0.84rem;
    font-weight: 600;
    color: var(--text-main);
}

.widget-emoji-scale {
    margin-top: 0.25rem;
}

.widget-textarea {
    width: 100%;
    border-radius: 8px;
    box-sizing: border-box;
    font-size: 0.86rem;
    line-height: 1.4;
    resize: none;
}

.widget-submit-btn {
    margin-top: 1rem;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.7rem 1.25rem;
}

/* Animations */
@keyframes widgetSlideIn {
    from {
        opacity: 0;
        transform: translateY(50px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Media Queries for Floating Widget */
@media (max-width: 768px) {
    .sos-floating-widget {
        bottom: calc(var(--bottom-nav-height) + 16px);
        left: 16px;
        max-width: calc(100vw - 32px);
        width: calc(100vw - 32px);
    }
    
    [dir="rtl"] .sos-floating-widget {
        left: 16px;
    }
    
    .feedback-widget-card {
        padding: 1.1rem !important;
    }
    
    .emoji-btn {
        width: 40px;
        height: 40px;
        font-size: 1.4rem;
    }
}

/* Lucide Icon Integration for Feedback Emojis */
.emoji-btn svg {
    width: 22px;
    height: 22px;
    stroke: var(--text-muted);
    stroke-width: 2px;
    fill: none;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.emoji-btn:hover svg {
    stroke: var(--accent) !important;
    transform: scale(1.15) rotate(5deg);
}

.emoji-btn.selected svg {
    stroke: #00ff88 !important;
    transform: scale(1.2);
}

[data-theme="dark"] .emoji-btn.selected svg {
    filter: drop-shadow(0 0 4px rgba(0, 255, 136, 0.4));
}

/* Premium Responsive Feedback Table Styles for Mobile & Small Screens */
@media (max-width: 768px) {
    /* Hide the default table header */
    .feedbacks-dash table thead,
    #admin-feedbacks-container table thead {
        display: none !important;
    }
    
    /* Force table elements to display as block elements */
    .feedbacks-dash table, 
    .feedbacks-dash table tbody, 
    .feedbacks-dash table tr,
    #admin-feedbacks-container table,
    #admin-feedbacks-container table tbody,
    #admin-feedbacks-container table tr {
        display: block !important;
        width: 100% !important;
    }
    
    /* Convert each table row to an elegant modern card */
    .feedbacks-dash table tr,
    #admin-feedbacks-container table tr {
        margin-bottom: 1.25rem !important;
        background: rgba(255, 255, 255, 0.02) !important;
        border: 1px solid var(--border) !important;
        border-radius: 12px !important;
        padding: 1.25rem !important;
        position: relative !important;
        box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.2) !important;
        backdrop-filter: blur(8px) !important;
        -webkit-backdrop-filter: blur(8px) !important;
        transition: transform 0.2s, background-color 0.2s;
    }
    
    .feedbacks-dash table tr:hover,
    #admin-feedbacks-container table tr:hover {
        background: rgba(255, 255, 255, 0.04) !important;
        transform: translateY(-2px);
    }
    
    /* Display each cell as a responsive grid row */
    .feedbacks-dash table td,
    #admin-feedbacks-container table td {
        display: flex !important;
        align-items: center !important;
        justify-content: flex-start !important;
        padding: 0.5rem 0 !important;
        border-bottom: none !important;
        width: 100% !important;
        max-width: 100% !important;
    }
    
    /* Inject dynamic labels using data-label attribute */
    .feedbacks-dash table td[data-label]::before,
    #admin-feedbacks-container table td[data-label]::before {
        content: attr(data-label) ":";
        font-weight: 700;
        font-size: 0.82rem;
        color: var(--text-muted);
        min-width: 90px;
        display: inline-block;
    }
    
    /* Language direction handling for labels */
    [dir="rtl"] .feedbacks-dash table td[data-label]::before,
    [dir="rtl"] #admin-feedbacks-container table td[data-label]::before {
        text-align: right;
        margin-left: 0.75rem;
    }
    
    [dir="ltr"] .feedbacks-dash table td[data-label]::before,
    [dir="ltr"] #admin-feedbacks-container table td[data-label]::before {
        text-align: left;
        margin-right: 0.75rem;
    }
    
    /* Adjust text wrap and alignments */
    .feedbacks-dash table td:not(.td-checkbox):not(.td-delete) > *,
    #admin-feedbacks-container table td > * {
        flex: 1;
        word-break: break-word;
    }
    
    /* Reposition select checkbox and delete actions to top-corners */
    .feedbacks-dash table td.td-checkbox {
        position: absolute !important;
        top: 0.75rem !important;
        width: auto !important;
        padding: 0 !important;
        z-index: 2 !important;
    }
    
    [dir="rtl"] .feedbacks-dash table td.td-checkbox {
        right: 0.75rem !important;
        left: auto !important;
    }
    
    [dir="ltr"] .feedbacks-dash table td.td-checkbox {
        left: 0.75rem !important;
        right: auto !important;
    }
    
    .feedbacks-dash table td.td-checkbox::before {
        display: none !important;
    }
    
    .feedbacks-dash table td.td-delete {
        position: absolute !important;
        top: 0.75rem !important;
        width: auto !important;
        padding: 0 !important;
        z-index: 2 !important;
    }
    
    [dir="rtl"] .feedbacks-dash table td.td-delete {
        left: 0.75rem !important;
        right: auto !important;
    }
    
    [dir="ltr"] .feedbacks-dash table td.td-delete {
        right: 0.75rem !important;
        left: auto !important;
    }
    
    .feedbacks-dash table td.td-delete::before {
        display: none !important;
    }
    
    /* Adjust padding of cards containing top buttons */
    .feedbacks-dash table tr {
        padding-top: 2.5rem !important; /* Make room for absolute checkbox & delete buttons */
    }
}



