/* ===== VARIABLES ===== */
:root {
    --primary: #1B2A4A;
    --primary-light: #253760;
    --primary-dark: #0f1a2e;
    --accent: #C8A84B;
    --accent-light: #e0c06a;
    --accent-dark: #a8882b;
    --bg: #F0F4F8;
    --bg-card: #ffffff;
    --bg-sidebar: #1B2A4A;
    --text: #1e293b;
    --text-muted: #64748b;
    --text-sidebar: #cbd5e1;
    --border: #e2e8f0;
    --success: #047857;
    --warning: #b45309;
    --danger: #b91c1c;
    --surface: #f8fafc;
    --card-bg: #ffffff;
    --info: #3b82f6;
    --radius: 10px;
    --radius-sm: 6px;
    --shadow: 0 2px 12px rgba(0,0,0,0.08);
    --shadow-md: 0 4px 20px rgba(0,0,0,0.12);
    --sidebar-w: 268px;
    --topbar-h: 64px;
    --transition: all 0.25s ease;
    --font: 'Cairo', system-ui, sans-serif;
}

[data-theme="dark"] {
    --primary: #1B2A4A;
    --bg: #0f172a;
    --bg-card: #1e293b;
    --bg-sidebar: #0f172a;
    --text: #e2e8f0;
    --text-muted: #94a3b8;
    --border: #334155;
    --shadow: 0 2px 12px rgba(0,0,0,0.3);
    --success: #34d399;
    --warning: #fbbf24;
    --danger: #f87171;
    --surface: #1e293b;
    --card-bg: #1e293b;
}

/* ===== FONT AWESOME FIXES ===== */
.fa-solid, .fa-regular, .fa-brands {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

/* ===== RESET & BASE ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { direction: rtl; font-size: 15px; }

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    transition: var(--transition);
}

a { text-decoration: none; color: inherit; }
button { cursor: pointer; font-family: var(--font); border: none; background: none; }
input, select, textarea { font-family: var(--font); }
.hidden { display: none !important; }

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 99px; }

/* ===== SPLASH SCREEN ===== */
.splash-screen {
    position: fixed;
    inset: 0;
    background: linear-gradient(135deg, #0f1a2e 0%, #1B2A4A 55%, #253760 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    transition: opacity 0.35s ease, visibility 0.35s ease;
}
.splash-screen.fade-out {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}
.splash-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 18px;
    animation: splashIn 0.4s ease;
}
@keyframes splashIn {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}
.splash-logo {
    width: 76px;
    height: 76px;
    background: rgba(200,168,75,.15);
    border: 2px solid rgba(200,168,75,.3);
    border-radius: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 34px;
    color: #C8A84B;
    animation: splashPulse 2s ease infinite;
}
@keyframes splashPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(200,168,75,.35); }
    50%       { box-shadow: 0 0 0 14px rgba(200,168,75,0); }
}
.splash-name {
    color: #fff;
    font-size: 22px;
    font-weight: 700;
    font-family: 'Cairo', system-ui, sans-serif;
    letter-spacing: 0.5px;
}
.splash-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid rgba(200,168,75,.2);
    border-top-color: #C8A84B;
    border-radius: 50%;
    animation: splashSpin 0.75s linear infinite;
}
@keyframes splashSpin { to { transform: rotate(360deg); } }

/* ===== LOGIN SCREEN ===== */
.login-screen {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 50%, var(--primary-light) 100%);
}

.login-bg {
    position: absolute;
    inset: 0;
    background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.03'%3E%3Ccircle cx='30' cy='30' r='20'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}

.login-container {
    position: relative;
    background: white;
    border-radius: 20px;
    padding: 48px 40px;
    width: 420px;
    max-width: 95vw;
    box-shadow: 0 25px 60px rgba(0,0,0,0.3);
}

.login-logo {
    text-align: center;
    margin-bottom: 36px;
}

.logo-icon-big {
    font-size: 52px;
    line-height: 1;
    margin-bottom: 12px;
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-logo h1 {
    font-size: 28px;
    font-weight: 800;
    color: var(--primary);
    margin-bottom: 4px;
}

.login-logo p {
    color: var(--text-muted);
    font-size: 14px;
}

.login-hint {
    text-align: center;
    color: var(--text-muted);
    font-size: 12px;
    margin-top: 16px;
}

/* login lockout countdown */
#login-error.lockout {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(239,68,68,0.08);
    border: 1px solid rgba(239,68,68,0.25);
    border-radius: 10px;
    padding: 10px 14px;
    font-size: 13px;
    color: #b91c1c;
}
#login-error.lockout strong { font-size: 16px; font-variant-numeric: tabular-nums; }

/* ===== PASSWORD STRENGTH BAR ===== */
.pw-strength {
    display: flex;
    align-items: center;
    gap: 10px;
}
.pw-strength-track {
    flex: 1;
    height: 5px;
    background: var(--border);
    border-radius: 99px;
    overflow: hidden;
}
.pw-strength-fill {
    height: 100%;
    width: 0;
    border-radius: 99px;
    transition: width 0.3s ease, background 0.3s ease;
}
.pw-strength-label {
    font-size: 11px;
    font-weight: 700;
    min-width: 44px;
    text-align: center;
}

/* ===== APP LAYOUT ===== */
.app {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* ===== SIDEBAR ===== */
.sidebar {
    width: var(--sidebar-w);
    background: linear-gradient(180deg, #0e1a2e 0%, #1B2A4A 45%, #152238 100%);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    overflow: hidden;
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 100;
    position: relative;
    box-shadow: -4px 0 32px rgba(0,0,0,0.25);
}

/* subtle dot-grid texture */
.sidebar::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image: radial-gradient(rgba(255,255,255,0.04) 1px, transparent 1px);
    background-size: 22px 22px;
    pointer-events: none;
    z-index: 0;
}

.sidebar > * { position: relative; z-index: 1; }

/* ── Collapsed state ── */
.sidebar.collapsed { width: 72px; }
.sidebar.collapsed .nav-label,
.sidebar.collapsed .nav-group-title,
.sidebar.collapsed .nav-badge,
.sidebar.collapsed .logo-text,
.sidebar.collapsed .sidebar-version,
.sidebar.collapsed .user-details-sm { display: none; }
.sidebar.collapsed .sidebar-logo { justify-content: center; }
.sidebar.collapsed .nav-item { justify-content: center; padding: 11px 0; margin: 2px 10px; }
.sidebar.collapsed .user-info-sidebar { justify-content: center; }
.sidebar.collapsed .sidebar-header { padding: 18px 0; justify-content: center; }
.sidebar.collapsed .sidebar-collapse-btn { margin: 0; }
.sidebar.collapsed .sidebar-search { display: none; }

/* ── Header ── */
.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 22px 18px 14px;
    gap: 8px;
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 11px;
    min-width: 0;
    flex: 1;
}

.logo-emoji {
    width: 38px;
    height: 38px;
    background: linear-gradient(135deg, var(--accent) 0%, #a8882b 100%);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: #fff;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(200,168,75,0.35);
}

.logo-text {
    color: #fff;
    font-weight: 800;
    font-size: 17px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    letter-spacing: -0.01em;
}

.sidebar-version {
    font-size: 10px;
    color: rgba(255,255,255,0.3);
    font-weight: 400;
    margin-top: 1px;
    letter-spacing: 0.03em;
}

.sidebar-collapse-btn {
    color: rgba(255,255,255,0.4);
    font-size: 11px;
    width: 30px;
    height: 30px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.25s ease;
    border: 1px solid rgba(255,255,255,0.1);
    flex-shrink: 0;
}
.sidebar-collapse-btn:hover {
    background: rgba(255,255,255,0.12);
    color: #fff;
    border-color: rgba(255,255,255,0.2);
}
.sidebar.collapsed .sidebar-collapse-btn { transform: rotate(180deg); }

/* ── Search box inside sidebar ── */
.sidebar-search {
    padding: 0 14px 12px;
}
.sidebar-search-input {
    width: 100%;
    background: rgba(255,255,255,0.07);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 10px;
    padding: 8px 12px 8px 10px;
    color: rgba(255,255,255,0.8);
    font-size: 12px;
    font-family: var(--font);
    outline: none;
    transition: all 0.2s ease;
}
.sidebar-search-input::placeholder { color: rgba(255,255,255,0.3); }
.sidebar-search-input:focus {
    background: rgba(255,255,255,0.1);
    border-color: rgba(200,168,75,0.4);
}

/* ── Nav ── */
.sidebar-nav {
    flex: 1;
    padding: 4px 0 12px;
    overflow-y: auto;
    overflow-x: hidden;
}
.sidebar-nav::-webkit-scrollbar { width: 3px; }
.sidebar-nav::-webkit-scrollbar-track { background: transparent; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 99px; }

.nav-group { margin-bottom: 4px; }

.nav-group-title {
    display: flex;
    align-items: center;
    gap: 8px;
    color: rgba(255,255,255,0.3);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    padding: 14px 20px 5px;
}
.nav-group-title::after {
    content: '';
    flex: 1;
    height: 1px;
    background: rgba(255,255,255,0.07);
    border-radius: 1px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 10px 12px;
    margin: 2px 10px;
    color: rgba(255,255,255,0.55);
    border-radius: 11px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    white-space: nowrap;
    font-size: 13.5px;
}

.nav-item:hover {
    background: rgba(255,255,255,0.08);
    color: rgba(255,255,255,0.9);
}
.nav-item:hover .nav-icon {
    background: rgba(255,255,255,0.12);
    color: #fff;
    transform: scale(1.08);
}

.nav-item.active {
    background: linear-gradient(90deg, rgba(200,168,75,0.32) 0%, rgba(200,168,75,0.14) 100%);
    color: #fff;
    /* inset right border as the active indicator bar */
    box-shadow: inset -3px 0 0 0 var(--accent), 0 4px 16px rgba(200,168,75,0.18);
}
.nav-item.active .nav-icon {
    background: var(--accent);
    color: #1a1102;
    box-shadow: 0 4px 14px rgba(200,168,75,0.5);
    transform: scale(1.05);
}
.nav-item.active .nav-label { font-weight: 700; color: #fff; }
.nav-item.active::before { display: none; }

.nav-icon {
    font-size: 14.5px;
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 9px;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    background: rgba(255,255,255,0.05);
}

.nav-label { font-size: 13.5px; font-weight: 500; flex: 1; }

.nav-badge {
    background: var(--danger);
    color: white;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 99px;
    min-width: 20px;
    text-align: center;
    line-height: 1.5;
    box-shadow: 0 2px 6px rgba(239,68,68,0.4);
}
.nav-badge.warning {
    background: var(--warning);
    box-shadow: 0 2px 6px rgba(245,158,11,0.4);
}
.nav-badge.badge-success {
    background: var(--success);
    box-shadow: 0 2px 6px rgba(16,185,129,0.4);
}
.nav-badge[style*="display: none"] { display: none !important; }

/* ── Divider inside nav ── */
.sidebar-nav-divider {
    height: 1px;
    background: rgba(255,255,255,0.06);
    margin: 8px 20px;
}

/* ── Footer ── */
.sidebar-footer {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 12px 12px 16px;
    border-top: 1px solid rgba(255,255,255,0.07);
    background: rgba(0,0,0,0.18);
}

.user-info-sidebar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 10px;
    border-radius: 12px;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.09);
    transition: background 0.2s;
    cursor: default;
    min-width: 0;
}
.user-info-sidebar:hover { background: rgba(255,255,255,0.1); }

.user-avatar-sm {
    width: 34px;
    height: 34px;
    background: linear-gradient(135deg, var(--accent) 0%, #a8882b 100%);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 13px;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(200,168,75,0.35);
    border: 2px solid rgba(200,168,75,0.25);
}

.user-details-sm { min-width: 0; flex: 1; }
.user-name-sm {
    color: rgba(255,255,255,0.9);
    font-size: 12.5px;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.user-role-sm {
    color: rgba(255,255,255,0.36);
    font-size: 10.5px;
    margin-top: 1px;
}

.btn-logout {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 34px;
    border-radius: 9px;
    color: rgba(255,255,255,0.4);
    font-size: 14px;
    transition: all 0.2s ease;
    border: 1px solid rgba(255,255,255,0.08);
    background: rgba(255,255,255,0.04);
    gap: 8px;
}
.btn-logout::after {
    content: 'تسجيل الخروج';
    font-size: 12px;
    font-family: var(--font);
    font-weight: 600;
}
.btn-logout:hover {
    background: rgba(239,68,68,0.16);
    color: #f87171;
    border-color: rgba(239,68,68,0.28);
}

/* collapsed footer */
.sidebar.collapsed .sidebar-footer {
    padding: 10px 0 14px;
    align-items: center;
    gap: 6px;
}
.sidebar.collapsed .user-info-sidebar {
    background: transparent;
    border: none;
    padding: 4px 0;
    justify-content: center;
    width: 100%;
}
.sidebar.collapsed .btn-logout {
    width: 40px;
    height: 36px;
}
.sidebar.collapsed .btn-logout::after { display: none; }

/* ===== MAIN CONTENT ===== */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-width: 0;
}

/* ===== TOPBAR ===== */
.topbar {
    height: var(--topbar-h);
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    flex-shrink: 0;
    gap: 16px;
}

.topbar-start, .topbar-end { display: flex; align-items: center; gap: 12px; }

.breadcrumb-area { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.breadcrumb-home { color: var(--text-muted); }
.breadcrumb-sep { color: var(--text-muted); }
.breadcrumb-current { font-weight: 600; color: var(--text); }

.connection-indicator {
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(16,185,129,0.1);
    color: var(--success);
    padding: 4px 12px;
    border-radius: 99px;
    font-size: 12px;
    font-weight: 500;
}

.connection-indicator.offline { background: rgba(239,68,68,0.1); color: var(--danger); }

.conn-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--success);
    animation: pulse 2s infinite;
}

.connection-indicator.offline .conn-dot { background: var(--danger); animation: none; }

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

.btn-icon {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 16px;
    transition: var(--transition);
}
.btn-icon:hover { background: var(--bg); color: var(--text); }

.notif-wrap { position: relative; }
.notif-count {
    position: absolute;
    top: -4px;
    left: -4px;
    background: var(--danger);
    color: white;
    font-size: 10px;
    font-weight: 700;
    min-width: 18px;
    height: 18px;
    border-radius: 99px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
}

.topbar-user { font-size: 13px; font-weight: 600; color: var(--text-muted); }

#mobile-menu-btn { display: none; }

/* ===== CONTENT AREA ===== */
.content-wrapper {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 24px;
    background: var(--bg);
}

.module-view { display: none; }
.module-view.active { display: block; }

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

.page-title { font-size: 22px; font-weight: 800; color: var(--text); }
.page-title span { color: var(--accent); }
.page-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* ===== CARDS ===== */
.card {
    background: var(--bg-card);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    padding: 20px;
    box-shadow: var(--shadow);
}

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

.card-title { font-size: 15px; font-weight: 700; color: var(--text); }

/* ===== STAT CARDS ===== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 20px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 16px;
    transition: var(--transition);
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }

.stat-icon {
    width: 52px;
    height: 52px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
    transition: var(--transition);
}
.stat-card:hover .stat-icon { transform: scale(1.1); }

.stat-icon.blue { background: rgba(59,130,246,0.1); }
.stat-icon.green { background: rgba(16,185,129,0.1); }
.stat-icon.orange { background: rgba(245,158,11,0.1); }
.stat-icon.red { background: rgba(239,68,68,0.1); }
.stat-icon.purple { background: rgba(139,92,246,0.1); }
.stat-icon.gold { background: rgba(200,168,75,0.1); }

.stat-info { flex: 1; min-width: 0; }
.stat-label { font-size: 12px; color: var(--text-muted); font-weight: 500; margin-bottom: 4px; }
.stat-value { font-size: 26px; font-weight: 800; color: var(--text); line-height: 1; }
.stat-sub { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

/* ===== GRID LAYOUTS ===== */
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }

/* ===== BUTTONS ===== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 18px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 600;
    font-family: var(--font);
    transition: var(--transition);
    cursor: pointer;
    border: 1px solid transparent;
    white-space: nowrap;
}

.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-light); }

.btn-accent { background: var(--accent); color: white; }
.btn-accent:hover { background: var(--accent-dark); }

.btn-success { background: var(--success); color: white; }
.btn-success:hover { filter: brightness(0.9); }
[data-theme="dark"] .btn-success { background: #059669; color: white; }
[data-theme="dark"] .btn-danger  { background: #dc2626; color: white; }
[data-theme="dark"] .btn-warning { background: #d97706; color: white; }

.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { filter: brightness(0.9); }

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

.btn-outline {
    background: transparent;
    color: var(--primary);
    border-color: var(--primary);
}
.btn-outline:hover { background: var(--primary); color: white; }

.btn-outline-accent {
    background: transparent;
    color: var(--accent);
    border-color: var(--accent);
}
.btn-outline-accent:hover { background: var(--accent); color: white; }

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

.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-lg { padding: 12px 24px; font-size: 15px; }
.btn-full { width: 100%; justify-content: center; }

/* ===== FORMS ===== */
.form-group { margin-bottom: 16px; }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 0; }
.form-row .form-group { margin-bottom: 0; }

.form-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 6px;
}

.form-label .required { color: var(--danger); }

.form-control {
    width: 100%;
    padding: 9px 12px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-family: var(--font);
    color: var(--text);
    background: var(--bg-card);
    transition: var(--transition);
    outline: none;
    direction: rtl;
}

.form-control:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(27,42,74,0.1); }
.form-control::placeholder { color: var(--text-muted); }

select.form-control { cursor: pointer; }
textarea.form-control { resize: vertical; min-height: 80px; }

.form-hint { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.form-error { font-size: 12px; color: var(--danger); margin-top: 4px; }

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

.form-check input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: var(--primary);
}

.checkbox-group { display: flex; flex-wrap: wrap; gap: 12px; }

/* ===== SEARCH & FILTER BAR ===== */
.search-bar {
    display: flex;
    gap: 10px;
    margin-bottom: 16px;
    flex-wrap: wrap;
    align-items: center;
}

.search-input-wrap {
    position: relative;
    flex: 1;
    min-width: 200px;
}

.search-icon {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 14px;
}

.search-input {
    width: 100%;
    padding: 9px 36px 9px 12px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-family: var(--font);
    background: var(--bg-card);
    color: var(--text);
    outline: none;
    direction: rtl;
}
.search-input:focus { border-color: var(--primary); }

/* ===== TABLES ===== */
.table-wrap {
    overflow-x: auto;
    border-radius: var(--radius);
    border: 1px solid var(--border);
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    background: var(--bg-card);
}

thead { background: var(--bg); }

th {
    padding: 12px 14px;
    text-align: right;
    font-weight: 700;
    color: var(--text-muted);
    font-size: 12px;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
    color: var(--text);
    vertical-align: middle;
}

tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: rgba(27,42,74,0.03); }

.td-actions { display: flex; gap: 6px; align-items: center; justify-content: flex-end; }

/* ===== BADGES ===== */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 99px;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
}

.badge-success { background: rgba(16,185,129,0.12); color: #059669; }
.badge-warning { background: rgba(245,158,11,0.12); color: #d97706; }
.badge-danger { background: rgba(239,68,68,0.12); color: #dc2626; }
.badge-info { background: rgba(59,130,246,0.12); color: #2563eb; }
.badge-primary { background: rgba(27,42,74,0.1); color: var(--primary); }
.badge-accent { background: rgba(200,168,75,0.12); color: var(--accent-dark); }
.badge-muted { background: var(--bg); color: var(--text-muted); }

/* ===== MODAL ===== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    backdrop-filter: blur(4px);
}

.modal-box {
    background: var(--bg-card);
    border-radius: 14px;
    width: 100%;
    max-width: 700px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    animation: modalIn 0.25s ease;
}

.modal-box.modal-lg { max-width: 900px; }
.modal-box.modal-sm { max-width: 480px; }

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

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

.modal-head h3 { font-size: 17px; font-weight: 700; }

.modal-close-btn {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--bg);
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    transition: var(--transition);
}
.modal-close-btn:hover { background: var(--danger); color: white; }

.modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px 24px;
}

.modal-foot {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 10px;
    padding: 16px 24px 20px;
    border-top: 1px solid var(--border);
    flex-shrink: 0;
}

/* ===== TOAST ===== */
.toast-wrap {
    position: fixed;
    top: 20px;
    left: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 360px;
}

.toast {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px 16px;
    box-shadow: var(--shadow-md);
    display: flex;
    align-items: flex-start;
    gap: 12px;
    animation: toastIn 0.3s ease;
    border-right: 4px solid var(--info);
}

.toast.success { border-right-color: var(--success); }
.toast.error { border-right-color: var(--danger); }
.toast.warning { border-right-color: var(--warning); }

@keyframes toastIn { from { opacity: 0; transform: translateX(-20px); } to { opacity: 1; transform: translateX(0); } }
@keyframes toastOut { from { opacity: 1; } to { opacity: 0; transform: translateX(-20px); } }

.toast-icon { font-size: 18px; flex-shrink: 0; line-height: 1; }
.toast-content { flex: 1; }
.toast-title { font-size: 13px; font-weight: 700; color: var(--text); }
.toast-msg { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

/* ===== ALERTS ===== */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 12px;
}
.alert-danger { background: rgba(239,68,68,0.1); color: #dc2626; border: 1px solid rgba(239,68,68,0.2); }
.alert-success { background: rgba(16,185,129,0.1); color: #059669; border: 1px solid rgba(16,185,129,0.2); }
.alert-warning { background: rgba(245,158,11,0.1); color: #d97706; border: 1px solid rgba(245,158,11,0.2); }
.alert-info { background: rgba(59,130,246,0.1); color: #2563eb; border: 1px solid rgba(59,130,246,0.2); }

/* ===== SECTION DIVIDER ===== */
.section-divider {
    border: none;
    border-top: 1px solid var(--border);
    margin: 20px 0;
}

.section-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.section-title::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}

/* ===== TABS ===== */
.tabs { display: flex; gap: 4px; border-bottom: 2px solid var(--border); margin-bottom: 20px; }

.tab-btn {
    padding: 10px 18px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
    transition: var(--transition);
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    cursor: pointer;
}
.tab-btn:hover { color: var(--primary); }
.tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); }

.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ===== EMPTY STATE ===== */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    color: var(--text-muted);
    text-align: center;
}

.empty-state .empty-icon { font-size: 56px; margin-bottom: 16px; opacity: 0.5; }
.empty-state .empty-title { font-size: 16px; font-weight: 700; margin-bottom: 8px; }
.empty-state .empty-desc { font-size: 14px; max-width: 300px; }

/* ===== STATUS TIMELINE ===== */
.status-timeline {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.timeline-item {
    display: flex;
    gap: 12px;
    position: relative;
    padding-bottom: 16px;
}

.timeline-item:last-child { padding-bottom: 0; }
.timeline-item:not(:last-child)::after {
    content: '';
    position: absolute;
    right: 11px;
    top: 24px;
    bottom: 0;
    width: 2px;
    background: var(--border);
}

.timeline-dot {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    flex-shrink: 0;
    position: relative;
    z-index: 1;
}

/* ===== RECEIPT & INVOICE PREVIEW ===== */
.doc-preview {
    background: white;
    border-radius: var(--radius);
    padding: 32px;
    border: 1px solid var(--border);
    font-size: 13px;
    color: #1a1a1a;
    direction: rtl;
}

.doc-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 24px; }
.doc-logo { font-size: 24px; font-weight: 800; color: var(--primary); }
.doc-info { text-align: left; }
.doc-title { font-size: 22px; font-weight: 800; color: var(--primary); margin-bottom: 16px; text-align: center; }
.doc-divider { border: none; border-top: 2px solid var(--primary); margin: 16px 0; }

.doc-table { width: 100%; border-collapse: collapse; margin: 16px 0; }
.doc-table th { background: var(--primary); color: white; padding: 10px 12px; text-align: right; font-size: 12px; }
.doc-table td { padding: 9px 12px; border-bottom: 1px solid #eee; }
.doc-table tr:nth-child(even) td { background: #f9f9f9; }

.doc-totals { margin-top: 16px; }
.doc-total-row { display: flex; justify-content: space-between; padding: 6px 0; font-size: 13px; }
.doc-grand-total { font-size: 16px; font-weight: 800; border-top: 2px solid var(--primary); padding-top: 8px; margin-top: 4px; }

/* ===== CHART CONTAINER ===== */
.chart-container { position: relative; height: 280px; }

/* ===== INFO GRID ===== */
.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 12px;
}

.info-item { }
.info-label { font-size: 11px; color: var(--text-muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 4px; }
.info-value { font-size: 14px; font-weight: 600; color: var(--text); }

/* ===== PRIORITY BADGE ===== */
.priority-urgent { color: #dc2626; }
.priority-high { color: #d97706; }
.priority-normal { color: #2563eb; }

/* ===== DEVICE STATUS ===== */
.status-received { color: #2563eb; }
.status-inspecting { color: #d97706; }
.status-waiting-approval { color: #7c3aed; }
.status-repairing { color: #d97706; }
.status-ready { color: #059669; }
.status-delivered { color: #64748b; }
.status-rejected { color: #dc2626; }

/* ===== WHATSAPP BUTTON ===== */
.btn-whatsapp { background: #25D366; color: white; }
.btn-whatsapp:hover { background: #1aaa50; }

/* ===== PIPELINE ===== */
.pipeline-tabs {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 4px;
}

.pipeline-tab {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    border-radius: 10px;
    border: 1.5px solid var(--border);
    background: var(--surface);
    color: var(--text-muted);
    font-family: 'Cairo', sans-serif;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.pipeline-tab:hover { border-color: var(--accent); color: var(--accent); }

.pipeline-tab.active {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

.pipeline-count {
    background: rgba(255,255,255,0.25);
    color: inherit;
    font-size: 11px;
    font-weight: 700;
    padding: 1px 7px;
    border-radius: 99px;
    min-width: 20px;
    text-align: center;
}

.pipeline-tab:not(.active) .pipeline-count {
    background: var(--danger);
    color: #fff;
}

.pipeline-card {
    background: var(--surface);
    border-radius: 14px;
    padding: 16px 20px;
    margin-bottom: 12px;
    border: 1px solid var(--border);
    border-right: 4px solid var(--accent);
    transition: box-shadow 0.2s, transform 0.2s;
}

.pipeline-card:hover { box-shadow: 0 4px 24px rgba(0,0,0,0.08); transform: translateY(-1px); }
.pipeline-card-ready            { border-right-color: #10b981; }
.pipeline-card-pending-invoice  { border-right-color: #ef4444; }
.pipeline-card-warranty         { border-right-color: #f59e0b; background: linear-gradient(135deg, var(--card-bg) 0%, #fefce8 100%); }

.pipeline-card-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 12px;
}

.pipeline-card-id {
    font-weight: 800;
    font-size: 18px;
    color: var(--text);
    margin-bottom: 4px;
}
[data-theme="dark"] .pipeline-card-id { color: var(--accent-light); }

.pipeline-badges { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 4px; }

.pipeline-age { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.pipeline-age-warning { color: var(--warning); font-weight: 600; }

.pipeline-actions { display: flex; gap: 6px; flex-wrap: wrap; }

.pipeline-info-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
}

.pipeline-info-item { flex: 1; min-width: 130px; }

.pipeline-info-main { font-weight: 600; font-size: 14px; margin-top: 2px; }
.pipeline-info-sub  { font-size: 12px; color: var(--text-muted); margin-top: 1px; }

.pipeline-parts-row {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px dashed var(--border);
    font-size: 13px;
}

.pipeline-timer {
    margin-top: 10px;
    padding: 6px 12px;
    background: rgba(245,158,11,0.08);
    border-radius: 8px;
    font-size: 13px;
    color: var(--warning);
}

/* Inspection form styles */
.insp-device-banner {
    background: var(--bg);
    border-radius: 10px;
    padding: 12px 16px;
    margin-bottom: 16px;
    font-size: 13px;
    border-right: 3px solid var(--accent);
}

.part-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: var(--bg);
    border-radius: 8px;
    margin-bottom: 6px;
}

.part-name { flex: 1; font-size: 13px; font-weight: 500; }

.part-qty-input {
    width: 64px;
    padding: 4px 8px;
    border: 1px solid var(--border);
    border-radius: 6px;
    text-align: center;
    font-family: 'Cairo', sans-serif;
    font-size: 13px;
    background: var(--surface);
    color: var(--text);
}

.part-price { font-size: 13px; color: var(--text); font-weight: 700; min-width: 70px; text-align: left; }

/* Pipeline flow (dashboard widget) */
.pipeline-flow {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 4px;
    padding: 8px 4px;
    flex-wrap: wrap;
}

.pipeline-flow-step {
    flex: 1;
    min-width: 100px;
    text-align: center;
    padding: 12px 8px;
    border-radius: 12px;
    transition: background 0.2s;
}

.pipeline-flow-step:hover { background: var(--bg); }

.pipeline-flow-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    margin-bottom: 6px;
}

.pipeline-flow-count { font-size: 22px; font-weight: 800; line-height: 1; margin-bottom: 2px; }
.pipeline-flow-label { font-size: 12px; color: var(--text-muted); margin-bottom: 8px; }

.pipeline-flow-bar { height: 4px; background: var(--border); border-radius: 99px; overflow: hidden; margin: 0 8px; }
.pipeline-flow-fill { height: 100%; border-radius: 99px; transition: width 0.5s ease; }

.pipeline-flow-arrow {
    color: var(--text-muted);
    font-size: 14px;
    padding: 0 2px;
    margin-top: -16px;
}

.badge-accent { background: rgba(139,92,246,0.12); color: #7c3aed; }
.badge-success.nav-badge { background: var(--success); }

/* ===== LOADING ===== */
.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

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

/* ===== PROGRESS BAR ===== */
.progress-bar-wrap { height: 8px; background: var(--bg); border-radius: 99px; overflow: hidden; }
.progress-bar-fill { height: 100%; border-radius: 99px; background: var(--primary); transition: width 0.4s ease; }

/* ===== PRINT STYLES ===== */
@media print {
    body { background: white; }
    .no-print { display: none !important; }
    .sidebar, .topbar, .modal-overlay { display: none !important; }
    .content-wrapper { padding: 0; }
    .main-content { overflow: visible; }
}

/* ===== RESPONSIVE ===== */
@media (max-width: 900px) {
    .sidebar {
        position: fixed;
        right: 0;
        top: 0;
        height: 100vh;
        transform: translateX(100%);
        z-index: 200;
    }
    .sidebar.mobile-open { transform: translateX(0); }
    #mobile-menu-btn { display: flex; }
    .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .content-wrapper { padding: 16px; }
}

@media (max-width: 500px) {
    .stats-grid { grid-template-columns: 1fr; }
    .topbar { padding: 0 12px; }
    .modal-box { border-radius: 10px; }
}

/* ===== TICKET TOTALS ROW ===== */
.ticket-totals-row {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}
.ticket-total-box {
    flex: 1;
    min-width: 120px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 12px 16px;
    text-align: center;
}
.ticket-total-label {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 600;
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.ticket-total-val {
    font-size: 17px;
    font-weight: 800;
    color: var(--text);
}
.ticket-total-box--main {
    background: linear-gradient(135deg, #1B2A4A 0%, #253760 100%);
    border-color: transparent;
    flex: 1.5;
}
.ticket-total-label-main {
    font-size: 11px;
    color: rgba(255,255,255,0.75);
    font-weight: 600;
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.ticket-total-val-main {
    font-size: 22px;
    font-weight: 900;
    color: #fbbf24;
}

/* ===== DARK THEME OVERRIDES ===== */
[data-theme="dark"] .form-control,
[data-theme="dark"] .search-input {
    background: var(--bg);
    border-color: var(--border);
    color: var(--text);
}

[data-theme="dark"] thead { background: rgba(255,255,255,0.04); }
[data-theme="dark"] tbody tr:hover { background: rgba(255,255,255,0.04); }
[data-theme="dark"] .doc-preview { background: #1e293b; color: #e2e8f0; }

/* Dark mode: keep button/badge text readable — --success in dark is light green so white text won't work */
[data-theme="dark"] .nav-badge.badge-success  { background: #059669; }
[data-theme="dark"] .dps-step.done .dps-dot   { background: #059669; border-color: #059669; }
[data-theme="dark"] .dps-line.done            { background: #059669; }
[data-theme="dark"] .apl-badge.apl-approved   { background: rgba(52,211,153,0.15); color: #34d399; }
[data-theme="dark"] .apl-badge.apl-rejected   { background: rgba(248,113,113,0.15); color: #f87171; }
[data-theme="dark"] .apl-badge.apl-deferred   { background: rgba(167,139,250,0.15); color: #a78bfa; }
[data-theme="dark"] .apl-badge.apl-pending    { background: rgba(251,191,36,0.15);  color: #fbbf24; }
[data-theme="dark"] .apl-count-badge.apl-approved { background: rgba(52,211,153,0.15); color: #34d399; }
[data-theme="dark"] .apl-count-badge.apl-rejected { background: rgba(248,113,113,0.15); color: #f87171; }
[data-theme="dark"] .apl-count-badge.apl-deferred { background: rgba(167,139,250,0.15); color: #a78bfa; }
[data-theme="dark"] .apl-count-badge.apl-pending  { background: rgba(251,191,36,0.15);  color: #fbbf24; }
/* Keep card backgrounds visible in dark mode */
[data-theme="dark"] .pipeline-card   { background: var(--surface); border-color: var(--border); }
[data-theme="dark"] .stat-card       { background: var(--bg-card); }
[data-theme="dark"] .approval-info-banner { background: #253760; border-right-color: var(--accent); }
[data-theme="dark"] .approval-opt-card   { background: #1e293b; border-color: var(--border); }
[data-theme="dark"] .approval-opt-card:hover { background: #253760; }

/* ===== RECEPTION FORM WIDGETS ===== */

/* Section header */
.rec-section {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 20px;
    margin-bottom: 16px;
}
.rec-section-title {
    font-size: 14px;
    font-weight: 800;
    color: var(--accent);
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border);
}
.rec-section-title i { font-size: 15px; }

/* Device type grid */
.rec-type-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 8px;
}
.rec-type-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 12px 6px;
    border: 2px solid var(--border);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.18s;
    background: var(--sidebar-bg);
    user-select: none;
}
.rec-type-card i {
    font-size: 22px;
    color: var(--text-muted);
    transition: color 0.18s;
}
.rec-type-card span {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    transition: color 0.18s;
    text-align: center;
    line-height: 1.2;
}
.rec-type-card:hover {
    border-color: var(--accent);
    background: rgba(37,99,235,0.06);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(37,99,235,0.12);
}
.rec-type-card:hover i,
.rec-type-card:hover span { color: var(--accent); }

.rec-type-card.active {
    border-color: var(--accent);
    background: rgba(37,99,235,0.1);
    box-shadow: 0 0 0 3px rgba(37,99,235,0.15);
    transform: translateY(-2px);
}
.rec-type-card.active i { color: var(--accent); font-size: 24px; }
.rec-type-card.active span { color: var(--accent); font-weight: 800; }

/* Brand search */
.rec-brand-search-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--sidebar-bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 6px 12px;
    margin-bottom: 10px;
}
.rec-brand-search-wrap i { color: var(--text-muted); flex-shrink: 0; }
.rec-brand-search-wrap input {
    border: none;
    background: transparent;
    outline: none;
    font-family: 'Cairo', sans-serif;
    font-size: 13px;
    width: 100%;
    color: var(--text);
}

/* Brand chips */
.rec-brand-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
}
.rec-brand-chip {
    padding: 5px 14px;
    border: 1.5px solid var(--border);
    border-radius: 99px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
    color: var(--text-muted);
    background: var(--sidebar-bg);
    user-select: none;
}
.rec-brand-chip:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: rgba(37,99,235,0.06);
}
.rec-brand-chip.active {
    background: var(--accent);
    border-color: var(--accent);
    color: white;
    box-shadow: 0 2px 8px rgba(37,99,235,0.35);
}

/* Condition cards */
.rec-condition-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}
.rec-condition-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 14px 8px;
    border: 2px solid var(--border);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.18s;
    background: var(--sidebar-bg);
    user-select: none;
    text-align: center;
}
.rec-condition-card:hover {
    border-color: var(--cc, var(--accent));
    background: var(--cb, rgba(37,99,235,0.06));
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}
.rec-condition-card.active {
    border-color: var(--cc, var(--accent));
    background: var(--cb, rgba(37,99,235,0.1));
    transform: translateY(-2px);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--cc, var(--accent)) 20%, transparent);
}

/* Accessories chips */
.rec-acc-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.rec-acc-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    border: 1.5px solid var(--border);
    border-radius: 99px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
    color: var(--text-muted);
    background: var(--sidebar-bg);
    user-select: none;
}
.rec-acc-chip i { font-size: 12px; }
.rec-acc-chip:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: rgba(37,99,235,0.06);
}
.rec-acc-chip.active {
    background: rgba(37,99,235,0.1);
    border-color: var(--accent);
    color: var(--accent);
    font-weight: 700;
    box-shadow: 0 2px 8px rgba(37,99,235,0.15);
}

/* Priority cards */
.rec-priority-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}
.rec-priority-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 16px 10px;
    border: 2px solid var(--border);
    border-radius: 14px;
    cursor: pointer;
    transition: all 0.18s;
    background: var(--sidebar-bg);
    user-select: none;
    text-align: center;
}
.rec-priority-card:hover {
    border-color: var(--pc, var(--accent));
    background: var(--pb, rgba(37,99,235,0.06));
    transform: translateY(-3px);
    box-shadow: 0 6px 16px rgba(0,0,0,0.1);
}
.rec-priority-card.active {
    border-color: var(--pc, var(--accent));
    background: var(--pb, rgba(37,99,235,0.1));
    transform: translateY(-3px);
    box-shadow: 0 6px 16px rgba(0,0,0,0.12), 0 0 0 3px color-mix(in srgb, var(--pc, var(--accent)) 20%, transparent);
}

/* Date wrapper */
.rec-date-wrap {
    position: relative;
}
.rec-date-wrap > i {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--accent);
    pointer-events: none;
    font-size: 16px;
}
.rec-date-input {
    padding-right: 40px !important;
    border: 2px solid var(--border) !important;
    border-radius: 10px !important;
    height: 44px;
    font-size: 14px;
    cursor: pointer;
    transition: border-color 0.2s;
}
.rec-date-input:focus {
    border-color: var(--accent) !important;
    box-shadow: 0 0 0 3px rgba(37,99,235,0.12) !important;
}

/* Responsive */
@media (max-width: 600px) {
    .rec-type-grid { grid-template-columns: repeat(5, 1fr); gap: 6px; }
    .rec-type-card { padding: 10px 4px; }
    .rec-type-card i { font-size: 18px; }
    .rec-condition-grid { grid-template-columns: repeat(3, 1fr); }
    .rec-priority-row { grid-template-columns: repeat(3, 1fr); }
}

/* ===== PASSPORT MODULE ===== */

/* Search card */
.pp-search-card {
    background: var(--card-bg);
    border-radius: 16px;
    padding: 28px 24px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    margin-bottom: 20px;
}
.pp-search-title {
    font-size: 17px;
    font-weight: 800;
    color: var(--text);
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 10px;
}
.pp-search-hints {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}
.pp-search-hints span {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    color: var(--text-muted);
    background: var(--sidebar-bg);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 4px 12px;
}
.pp-search-row {
    display: flex;
    gap: 10px;
}
.pp-search-input {
    flex: 1;
    padding: 13px 18px;
    border: 2px solid var(--border);
    border-radius: 12px;
    font-family: inherit;
    font-size: 14px;
    background: var(--sidebar-bg);
    color: var(--text);
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
    direction: rtl;
}
.pp-search-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(200,168,75,0.15);
    background: var(--card-bg);
}
.pp-search-btn {
    background: var(--accent);
    color: white;
    border: none;
    padding: 13px 24px;
    border-radius: 12px;
    font-family: inherit;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.2s, transform 0.1s;
    display: flex;
    align-items: center;
    gap: 8px;
}
.pp-search-btn:hover  { background: #b8943b; }
.pp-search-btn:active { transform: scale(0.97); }

/* Search results list */
.passport-search-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-radius: 10px;
    background: var(--sidebar-bg);
    cursor: pointer;
    transition: background 0.15s;
    font-size: 14px;
    gap: 12px;
}
.passport-search-row:hover { background: var(--border); }

/* Passport Document */
.pp-doc {
    background: var(--card-bg);
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(0,0,0,0.12);
    border: 1px solid var(--border);
}
.pp-doc-header {
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
    padding: 24px 28px;
    position: relative;
    overflow: hidden;
}
.pp-doc-watermark {
    position: absolute;
    left: -20px;
    top: -20px;
    font-size: 140px;
    color: rgba(255,255,255,0.03);
    pointer-events: none;
    line-height: 1;
}
.pp-doc-topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}
.pp-doc-stamp {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(200,168,75,0.15);
    border: 1px solid rgba(200,168,75,0.4);
    color: #c8a84b;
    padding: 5px 14px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.3px;
}
.pp-doc-issuer {
    font-size: 11px;
    color: rgba(255,255,255,0.35);
}
.pp-doc-main {
    display: flex;
    gap: 20px;
    align-items: flex-start;
}
.pp-doc-device-icon {
    width: 64px;
    height: 64px;
    background: rgba(200,168,75,0.15);
    border: 2px solid rgba(200,168,75,0.3);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    color: #c8a84b;
    flex-shrink: 0;
}
.pp-doc-receipt {
    font-size: 12px;
    font-weight: 700;
    color: rgba(200,168,75,0.8);
    letter-spacing: 1px;
    font-family: monospace;
    margin-bottom: 4px;
}
.pp-doc-name {
    font-size: 22px;
    font-weight: 900;
    color: white;
    line-height: 1.2;
    margin-bottom: 4px;
}
.pp-doc-type {
    font-size: 13px;
    color: rgba(255,255,255,0.45);
    margin-bottom: 12px;
}
.pp-doc-badges {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}
.pp-doc-qr-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}
.pp-doc-qr-box {
    width: 116px;
    height: 116px;
    background: white;
    border-radius: 12px;
    padding: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}
.pp-doc-qr-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 6px;
    display: block;
}
.pp-qr-fail {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    color: #94a3b8;
    font-size: 11px;
}
.pp-qr-fail i { font-size: 28px; }
.pp-doc-qr-label {
    font-size: 10px;
    color: rgba(255,255,255,0.4);
    font-family: monospace;
    letter-spacing: 0.5px;
    text-align: center;
}
.pp-doc-qr-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    background: rgba(200,168,75,0.15);
    border: 1px solid rgba(200,168,75,0.35);
    color: #c8a84b;
    border-radius: 8px;
    padding: 5px 10px;
    font-size: 11px;
    font-weight: 600;
    text-decoration: none;
    transition: background 0.15s;
    white-space: nowrap;
    width: 100%;
    text-align: center;
}
.pp-doc-qr-link:hover { background: rgba(200,168,75,0.25); }

/* Body */
.pp-doc-body {
    padding: 0 28px 24px;
}
.pp-section {
    padding-top: 22px;
    border-top: 1px solid var(--border);
    margin-top: 22px;
}
.pp-section:first-child {
    border-top: none;
    margin-top: 0;
    padding-top: 22px;
}
.pp-section-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 16px;
}
.pp-info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
    gap: 12px;
}
.pp-info-cell {
    background: var(--sidebar-bg);
    border-radius: 12px;
    padding: 14px 16px;
    border: 1px solid var(--border);
}
.pp-info-label {
    font-size: 11px;
    color: var(--text-muted);
    margin-bottom: 5px;
    display: flex;
    align-items: center;
    gap: 5px;
}
.pp-info-value {
    font-size: 15px;
    font-weight: 700;
    color: var(--text);
    line-height: 1.3;
}
.pp-info-sub {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 3px;
}
.pp-empty-timeline {
    padding: 20px;
    background: var(--sidebar-bg);
    border-radius: 10px;
    text-align: center;
    color: var(--text-muted);
    font-size: 13px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}
.pp-empty-timeline i { font-size: 24px; opacity: 0.35; }

/* Footer */
.pp-doc-footer {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    padding: 16px 28px;
    border-top: 1px solid var(--border);
    background: var(--sidebar-bg);
}

/* Timeline (shared) */
.passport-timeline {
    display: flex;
    flex-direction: column;
    gap: 0;
}
.passport-timeline-item {
    display: flex;
    gap: 14px;
    position: relative;
    padding-bottom: 16px;
}
.passport-timeline-item:not(:last-child)::before {
    content: '';
    position: absolute;
    right: 7px;
    top: 20px;
    bottom: 0;
    width: 2px;
    background: var(--border);
}
.passport-timeline-dot {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--border);
    flex-shrink: 0;
    margin-top: 4px;
    border: 2px solid var(--card-bg);
    box-shadow: 0 0 0 2px var(--border);
}
.passport-timeline-body {
    flex: 1;
    background: var(--sidebar-bg);
    border-radius: 10px;
    padding: 12px 14px;
    border: 1px solid var(--border);
}
.passport-timeline-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 8px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    flex-wrap: wrap;
}

/* Responsive */
@media (max-width: 600px) {
    .pp-doc-header { padding: 18px 16px; }
    .pp-doc-body   { padding: 0 16px 20px; }
    .pp-doc-footer { padding: 14px 16px; }
    .pp-doc-main   { flex-wrap: wrap; }
    .pp-doc-qr-wrap { flex-direction: row; align-items: center; width: 100%; gap: 12px; }
    .pp-doc-qr-box  { width: 80px; height: 80px; }
    .pp-doc-name   { font-size: 18px; }
    .pp-info-grid  { grid-template-columns: 1fr 1fr; }
    .pp-search-row { flex-direction: column; }
    .pp-search-btn { width: 100%; justify-content: center; }
}

/* ===== DEVICE PROGRESS BADGE (compact) ===== */
.dpb {
    display: flex;
    flex-direction: column;
    gap: 3px;
    margin-top: 6px;
    max-width: 220px;
}
.dpb-meta {
    display: flex;
    align-items: center;
    gap: 5px;
    flex-wrap: wrap;
}
.dpb-step {
    background: var(--primary);
    color: var(--accent);
    border-radius: 8px;
    padding: 1px 6px;
    font-size: 10px;
    font-weight: 800;
    flex-shrink: 0;
}
.dpb-cur {
    font-size: 11px;
    font-weight: 700;
    color: var(--text);
}
.dpb-next {
    font-size: 10px;
    color: var(--text-muted);
}
.dpb-track {
    height: 5px;
    background: var(--border);
    border-radius: 3px;
    overflow: hidden;
}
.dpb-fill {
    height: 100%;
    border-radius: 3px;
    transition: width .4s ease;
}
.dpb-remaining {
    font-size: 10px;
    color: var(--text-muted);
    line-height: 1.3;
    direction: rtl;
}
.dpb-done    { font-size: 11px; font-weight: 700; color: var(--success); margin-top: 6px; }
.dpb-rejected{ font-size: 11px; font-weight: 700; color: var(--danger);  margin-top: 6px; }
.dpb-warranty{ font-size: 11px; font-weight: 700; color: #f59e0b;        margin-top: 6px; }

/* ===== DEVICE PROGRESS STEPPER (full modal) ===== */
.dps {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    gap: 0;
    padding: 20px 12px 12px;
    background: var(--sidebar-bg);
    border-radius: 14px;
    overflow-x: auto;
    margin-bottom: 20px;
    -webkit-overflow-scrolling: touch;
}
.dps-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 7px;
    flex-shrink: 0;
    width: 64px;
}
.dps-dot {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    border: 2px solid var(--border);
    background: var(--card-bg);
    color: var(--text-muted);
    transition: all .25s;
    position: relative;
}
.dps-step.done .dps-dot {
    background: var(--success);
    border-color: var(--success);
    color: white;
}
.dps-step.active .dps-dot {
    background: var(--sc, var(--accent));
    border-color: var(--sc, var(--accent));
    color: white;
    box-shadow: 0 0 0 5px color-mix(in srgb, var(--sc, var(--accent)) 20%, transparent);
    animation: dps-pulse 2s ease-in-out infinite;
}
@keyframes dps-pulse {
    0%,100% { box-shadow: 0 0 0 5px color-mix(in srgb, var(--sc, #c8a84b) 20%, transparent); }
    50%      { box-shadow: 0 0 0 10px color-mix(in srgb, var(--sc, #c8a84b) 8%, transparent); }
}
.dps-label {
    font-size: 10px;
    font-weight: 600;
    color: var(--text-muted);
    text-align: center;
    line-height: 1.2;
    white-space: nowrap;
}
.dps-step.done   .dps-label { color: var(--success); font-weight: 700; }
.dps-step.active .dps-label { color: var(--accent);  font-weight: 800; font-size: 11px; }
.dps-line {
    flex: 1;
    height: 2px;
    background: var(--border);
    align-self: center;
    margin-bottom: 28px;
    min-width: 16px;
    transition: background .25s;
}
.dps-line.done { background: var(--success); }
.dps-alert {
    padding: 10px 14px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
}
.dps-alert-danger  { background: #fee2e2; color: #b91c1c; }
.dps-alert-warning { background: #fef3c7; color: #92400e; }

/* ===== APPROVAL STATUS BADGES ===== */
.apl-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
}
.apl-badge.apl-pending  { background: #fef3c7; color: #92400e; }
.apl-badge.apl-approved { background: #d1fae5; color: #065f46; }
.apl-badge.apl-rejected { background: #fee2e2; color: #991b1b; }
.apl-badge.apl-deferred { background: #ede9fe; color: #5b21b6; }

/* count badges in dashboard header */
.apl-count-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
}
.apl-count-badge.apl-pending  { background: #fef3c7; color: #92400e; }
.apl-count-badge.apl-approved { background: #d1fae5; color: #065f46; }
.apl-count-badge.apl-rejected { background: #fee2e2; color: #991b1b; }
.apl-count-badge.apl-deferred { background: #ede9fe; color: #5b21b6; }

/* ===== APPROVAL FORM (modal) ===== */
.approval-info-banner {
    background: var(--bg);
    border-radius: 10px;
    padding: 14px 16px;
    margin-bottom: 18px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    border-right: 4px solid var(--accent);
}
.approval-banner-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.approval-banner-label {
    font-size: 11px;
    color: var(--text-muted);
    min-width: 80px;
    font-weight: 600;
}
.approval-banner-phone { font-size: 12px; color: var(--text-muted); }
.approval-cost { font-size: 18px; font-weight: 900; color: var(--success); }

.approval-options-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 4px;
}
.approval-opt-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 16px 10px;
    border-radius: 12px;
    border: 2px solid var(--border);
    cursor: pointer;
    transition: all .2s;
    background: var(--surface);
    position: relative;
}
.approval-opt-card input[type="radio"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}
.approval-opt-card:hover { border-color: var(--accent); background: var(--bg); }
.approval-opt-card.selected { border-width: 2px; }
.approval-opt-card.apl-card-approved.selected { border-color: #10b981; background: #f0fdf4; }
.approval-opt-card.apl-card-rejected.selected { border-color: #ef4444; background: #fef2f2; }
.approval-opt-card.apl-card-deferred.selected { border-color: #8b5cf6; background: #faf5ff; }
.approval-opt-icon {
    font-size: 28px;
}
.apl-card-approved .approval-opt-icon { color: #10b981; }
.apl-card-rejected .approval-opt-icon { color: #ef4444; }
.apl-card-deferred .approval-opt-icon { color: #8b5cf6; }
.approval-opt-label {
    font-size: 12px;
    font-weight: 700;
    text-align: center;
    line-height: 1.3;
}
@media (max-width: 480px) {
    .approval-options-grid { grid-template-columns: 1fr; }
}

/* ===== PERFORMANCE MODULE ===== */
.perf-card {
    display: flex;
    flex-direction: column;
    gap: 14px;
}
.perf-card-header {
    display: flex;
    align-items: center;
    gap: 14px;
}
.perf-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), #3b82f6);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: 800;
    flex-shrink: 0;
}
.perf-name {
    font-size: 16px;
    font-weight: 700;
    color: var(--text);
}
.perf-sub {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
}
.perf-stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
}
.perf-stat {
    background: var(--sidebar-bg);
    border-radius: 10px;
    padding: 10px 8px;
    text-align: center;
}
.perf-stat-val {
    font-size: 18px;
    font-weight: 800;
    color: var(--text);
    line-height: 1;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.perf-stat-lbl {
    font-size: 10px;
    color: var(--text-muted);
    font-weight: 500;
}
.perf-nps-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    background: var(--sidebar-bg);
    border-radius: 8px;
}
.perf-nps-pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}
.perf-progress-row {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.perf-progress-label {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: var(--text-muted);
}
.perf-progress-track {
    height: 6px;
    background: var(--border);
    border-radius: 99px;
    overflow: hidden;
}
/* ===== License Warning Banner ===== */
.license-banner {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 20px;
    font-size: 13px;
    font-weight: 600;
    position: relative;
    z-index: 10;
}
.license-banner--expired {
    background: #fee2e2;
    color: #991b1b;
    border-bottom: 2px solid #fca5a5;
}
.license-banner--warning {
    background: #fef3c7;
    color: #92400e;
    border-bottom: 2px solid #fcd34d;
}
[data-theme="dark"] .license-banner--expired {
    background: rgba(239,68,68,.15);
    color: #fca5a5;
    border-bottom-color: rgba(239,68,68,.3);
}
[data-theme="dark"] .license-banner--warning {
    background: rgba(245,158,11,.12);
    color: #fcd34d;
    border-bottom-color: rgba(245,158,11,.3);
}
.license-banner a {
    color: inherit;
    text-decoration: underline;
    margin-inline-start: 6px;
}
.license-banner-dismiss {
    margin-inline-start: auto;
    background: none;
    border: none;
    cursor: pointer;
    color: inherit;
    opacity: .7;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 14px;
}
.license-banner-dismiss:hover { opacity: 1; }

.perf-progress-fill {
    height: 100%;
    border-radius: 99px;
    transition: width 0.6s ease;
}

/* ===== SETTINGS — Identity / Logo Upload ===== */
.logo-upload-zone {
    border: 2px dashed var(--border);
    border-radius: 12px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    transition: border-color .2s, background .2s;
    cursor: default;
}
.logo-upload-zone.drag-over {
    border-color: var(--accent);
    background: color-mix(in srgb, var(--accent) 6%, transparent);
}
.logo-preview-inner {
    min-height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
}
.logo-preview-img {
    max-height: 90px;
    max-width: 240px;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,.08);
}
.logo-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    color: var(--text-muted);
}
.logo-placeholder i   { font-size: 32px; }
.logo-placeholder span { font-size: 12px; }
.logo-upload-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: center;
}
.logo-upload-hint {
    font-size: 11px;
    color: var(--text-muted);
    text-align: center;
}

.color-swatches {
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
    align-items: center;
}
.color-swatch {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid transparent;
    transition: transform .15s, border-color .15s;
    flex-shrink: 0;
}
.color-swatch:hover { transform: scale(1.2); border-color: var(--border); }

.brand-doc-preview {
    border: 1px solid var(--border);
    border-radius: 10px;
    overflow: hidden;
    margin-top: 16px;
}

/* ===== SETTINGS — Workshop Tab ===== */
.card-subtitle {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
}

.work-days-list { display: flex; flex-direction: column; gap: 0; }

.work-day-row {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 4px;
    border-bottom: 1px solid var(--border);
    transition: opacity .2s;
}
.work-day-row:last-child { border-bottom: none; }
.work-day-row.day-off { opacity: .55; }

.work-day-toggle {
    position: relative;
    display: inline-block;
    width: 40px;
    height: 22px;
    flex-shrink: 0;
    cursor: pointer;
}
.work-day-toggle input { opacity: 0; width: 0; height: 0; position: absolute; }
.toggle-slider {
    position: absolute;
    inset: 0;
    background: var(--border);
    border-radius: 22px;
    transition: .25s;
}
.toggle-slider::before {
    content: '';
    position: absolute;
    width: 16px; height: 16px;
    left: 3px; top: 3px;
    background: white;
    border-radius: 50%;
    transition: .25s;
    box-shadow: 0 1px 3px rgba(0,0,0,.2);
}
.work-day-toggle input:checked + .toggle-slider { background: var(--success, #10b981); }
.work-day-toggle input:checked + .toggle-slider::before { transform: translateX(18px); }

.work-day-name { font-weight: 600; font-size: 14px; min-width: 72px; }

.work-day-times { display: flex; align-items: center; gap: 8px; flex: 1; }
.work-day-times.times-disabled { opacity: .4; pointer-events: none; }
.time-label { font-size: 12px; color: var(--text-muted); white-space: nowrap; }
.time-input {
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 5px 10px;
    font-size: 13px;
    background: var(--bg);
    color: var(--text);
    font-family: inherit;
    width: 100px;
}
.time-input:disabled { cursor: not-allowed; }

.work-day-status { flex-shrink: 0; }
.wday-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
}
.wday-badge.open   { background: #dcfce7; color: #15803d; }
.wday-badge.closed { background: var(--sidebar-bg); color: var(--text-muted); }
[data-theme="dark"] .wday-badge.open { background: rgba(16,185,129,.2); color: #6ee7b7; }

/* SLA */
.sla-list { display: flex; flex-direction: column; gap: 10px; }
.sla-row {
    display: flex;
    align-items: center;
    gap: 12px;
}
.sla-type {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 600;
    min-width: 80px;
}
.sla-input-wrap { display: flex; align-items: center; gap: 6px; }
.sla-input {
    width: 72px !important;
    text-align: center;
    padding: 6px 8px !important;
    font-size: 14px;
    font-weight: 700;
}
.sla-unit { font-size: 12px; color: var(--text-muted); }
.sla-bar-wrap {
    flex: 1;
    height: 6px;
    background: var(--border);
    border-radius: 99px;
    overflow: hidden;
}
.sla-bar {
    height: 100%;
    background: var(--accent);
    border-radius: 99px;
    transition: width .4s ease;
}

/* Input with unit */
.input-with-unit { display: flex; align-items: center; gap: 8px; }
.input-unit { font-size: 13px; color: var(--text-muted); }

/* ===== SETTINGS — Print Tab ===== */
.paper-size-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-top: 6px;
}
.paper-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 14px 10px;
    border: 2px solid var(--border);
    border-radius: 12px;
    cursor: pointer;
    transition: border-color .2s, background .2s;
    text-align: center;
    background: var(--bg);
}
.paper-option input { display: none; }
.paper-option:hover { border-color: var(--accent); background: var(--sidebar-bg); }
.paper-option.active { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 8%, transparent); }
.paper-option-icon { font-size: 22px; color: var(--text-muted); }
.paper-option.active .paper-option-icon { color: var(--accent); }
.paper-option-label { font-size: 13px; font-weight: 700; color: var(--text); }
.paper-option-desc  { font-size: 11px; color: var(--text-muted); }

.print-toggles { display: flex; flex-direction: column; gap: 8px; }
.print-toggle-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-radius: 10px;
    background: var(--bg);
    border: 1px solid var(--border);
    cursor: pointer;
    font-size: 13px;
    transition: background .15s;
}
.print-toggle-item:hover { background: var(--sidebar-bg); }
.print-toggle-item input { width: 16px; height: 16px; cursor: pointer; accent-color: var(--accent); }

/* ===== SETTINGS — WhatsApp Editor ===== */
.wa-editor-layout {
    display: grid;
    grid-template-columns: 200px 1fr 270px;
    gap: 16px;
    align-items: start;
}
@media (max-width: 1100px) {
    .wa-editor-layout { grid-template-columns: 1fr; }
    .wa-preview-col { display: none; }
}

.wa-tpl-sidebar {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    position: sticky;
    top: 16px;
}
.wa-tpl-sidebar-title {
    padding: 12px 14px 8px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .5px;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
}
.wa-tpl-group-label {
    padding: 8px 14px 4px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .5px;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
}
.wa-tpl-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 14px;
    cursor: pointer;
    border: none;
    background: none;
    width: 100%;
    text-align: right;
    border-bottom: 1px solid var(--border);
    transition: background .15s;
    font-family: inherit;
    color: var(--text);
}
.wa-tpl-item:last-of-type { border-bottom: none; }
.wa-tpl-item:hover { background: var(--sidebar-bg); }
.wa-tpl-item.active { background: color-mix(in srgb, var(--accent) 8%, transparent); }
.wa-tpl-icon {
    width: 32px; height: 32px;
    border-radius: 8px;
    display: grid; place-items: center;
    font-size: 13px;
    flex-shrink: 0;
}
.wa-tpl-label { flex: 1; font-size: 13px; font-weight: 600; }
.wa-tpl-arrow { font-size: 10px; color: var(--text-muted); }
.wa-tpl-item.active .wa-tpl-arrow { color: var(--accent); }
.wa-tpl-hint {
    padding: 10px 14px;
    font-size: 11px;
    color: var(--text-muted);
    line-height: 1.5;
    border-top: 1px solid var(--border);
    display: flex;
    gap: 6px;
}

.wa-editor-main {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.wa-editor-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}
.wa-editor-title { font-size: 16px; font-weight: 800; color: var(--text); }

.wa-var-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.wa-var-chip {
    display: inline-flex;
    align-items: center;
    padding: 4px 12px;
    background: color-mix(in srgb, var(--accent) 12%, transparent);
    color: var(--accent);
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid color-mix(in srgb, var(--accent) 25%, transparent);
    transition: background .15s;
    user-select: none;
}
.wa-var-chip:hover { background: color-mix(in srgb, var(--accent) 22%, transparent); }

.wa-tpl-textarea {
    font-family: 'Cairo', 'Segoe UI', sans-serif;
    font-size: 13px;
    line-height: 1.7;
    resize: vertical;
    min-height: 220px;
    direction: rtl;
}

/* Phone preview */
.wa-preview-col { display: flex; flex-direction: column; gap: 8px; }
.wa-preview-label {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-muted);
    text-align: center;
}
.wa-phone-frame {
    width: 100%;
    border-radius: 18px;
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(0,0,0,.15);
    border: 1px solid var(--border);
    background: #e5ddd5;
    display: flex;
    flex-direction: column;
    min-height: 480px;
}
.wa-phone-header {
    background: #075e54;
    padding: 10px 14px;
    display: flex;
    align-items: center;
    gap: 10px;
    color: white;
}
.wa-phone-back { font-size: 14px; cursor: pointer; }
.wa-phone-avatar-sm {
    width: 34px; height: 34px;
    background: #128c7e;
    border-radius: 50%;
    display: grid; place-items: center;
    font-weight: 700;
    font-size: 14px;
}
.wa-phone-contact-info { flex: 1; }
.wa-phone-actions { display: flex; gap: 14px; font-size: 14px; opacity: .9; }

.wa-phone-body {
    flex: 1;
    padding: 12px;
    background-image: url("data:image/svg+xml,%3Csvg width='80' height='80' viewBox='0 0 80 80' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='%23c8bfb0' fill-opacity='0.15'%3E%3Ccircle cx='40' cy='40' r='1'/%3E%3C/g%3E%3C/svg%3E");
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
}
.wa-bubble-wrap { display: flex; flex-direction: column; align-items: flex-end; }
.wa-bubble {
    background: #dcf8c6;
    border-radius: 12px 0 12px 12px;
    padding: 10px 14px;
    max-width: 92%;
    font-size: 12.5px;
    line-height: 1.55;
    color: #111;
    word-break: break-word;
    box-shadow: 0 1px 2px rgba(0,0,0,.12);
    direction: rtl;
    text-align: right;
}
.wa-bubble-time {
    font-size: 10px;
    color: #777;
    margin-top: 3px;
    padding-inline-end: 4px;
}
.wa-phone-input-bar {
    background: #f0f0f0;
    padding: 8px 12px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 16px;
}
.wa-phone-input-field {
    flex: 1;
    background: white;
    border-radius: 20px;
    padding: 6px 14px;
    font-size: 12px;
    color: #aaa;
}

/* WhatsApp preview formatting */
.wa-var-hl {
    background: #fef3c7;
    color: #92400e;
    border-radius: 4px;
    padding: 0 4px;
    font-family: monospace;
    font-size: 11px;
}
.wa-divider-line {
    display: block;
    text-align: center;
    color: #bbb;
    font-size: 10px;
    letter-spacing: 2px;
    margin: 2px 0;
}

[data-theme="dark"] .wa-phone-frame { background: #0d1117; }
[data-theme="dark"] .wa-phone-body  { background: #0d1117; }
[data-theme="dark"] .wa-bubble      { background: #005c4b; color: #e9edef; }
[data-theme="dark"] .wa-phone-input-bar { background: #202c33; }
[data-theme="dark"] .wa-phone-input-field { background: #2a3942; color: #aaa; }
[data-theme="dark"] .wa-var-hl { background: rgba(245,158,11,.2); color: #fcd34d; }

/* ===== SETTINGS — Payment Methods ===== */
.pay-methods-list { display: flex; flex-direction: column; gap: 0; }

.pay-method-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 4px;
    border-bottom: 1px solid var(--border);
    transition: background .15s;
}
.pay-method-row:last-child { border-bottom: none; }

.pay-method-toggle {
    position: relative;
    display: inline-block;
    width: 40px; height: 22px;
    flex-shrink: 0;
    cursor: pointer;
}
.pay-method-toggle input { opacity: 0; width: 0; height: 0; position: absolute; }

.pay-method-icon {
    width: 36px; height: 36px;
    border-radius: 10px;
    display: grid; place-items: center;
    font-size: 15px;
    flex-shrink: 0;
}
.pay-method-info { flex: 1; }
.pay-method-name { font-size: 14px; font-weight: 600; }
.pay-method-extra { margin-top: 4px; }
.pm-extra-hidden { display: none; }
.pay-method-fee {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    flex-shrink: 0;
}

/* ===== SETTINGS — Session Timeout ===== */
.timeout-options {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 6px;
}
.timeout-option {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border: 2px solid var(--border);
    border-radius: 20px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: border-color .15s, background .15s;
    white-space: nowrap;
    background: var(--bg);
}
.timeout-option input { display: none; }
.timeout-option:hover { border-color: var(--accent); }
.timeout-option.active {
    border-color: var(--accent);
    background: color-mix(in srgb, var(--accent) 10%, transparent);
    color: var(--accent);
    font-weight: 700;
}

/* Sleep timeout — purple accent */
.sleep-timeout-options .sleep-opt { border-color: var(--border); }
.sleep-timeout-options .sleep-opt:hover { border-color: #8b5cf6; }
.sleep-timeout-options .sleep-opt.active {
    border-color: #8b5cf6;
    background: rgba(139,92,246,.1);
    color: #8b5cf6;
    font-weight: 700;
}

/* Form hint text */
.form-hint {
    font-size: 11.5px;
    color: var(--text-muted);
    margin: 3px 0 8px;
    line-height: 1.5;
}

.security-policy-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}
.policy-item {}

/* ===== SECURITY TAB — Status Strip ===== */
.sec-status-strip {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 20px;
}
@media (max-width: 900px) { .sec-status-strip { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 500px) { .sec-status-strip { grid-template-columns: 1fr; } }

.sec-status-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    border-radius: 14px;
    border: 1.5px solid var(--border);
    background: var(--bg);
    transition: box-shadow 0.2s;
}
.sec-status-item i { font-size: 20px; flex-shrink: 0; }
.sec-status-item.ok  { border-color: rgba(16,185,129,.3); background: rgba(16,185,129,.04); }
.sec-status-item.ok i { color: #10b981; }
.sec-status-item.warn { border-color: rgba(245,158,11,.3); background: rgba(245,158,11,.04); }
.sec-status-item.warn i { color: #f59e0b; }

.sec-status-text { display: flex; flex-direction: column; gap: 2px; }
.sec-status-label { font-size: 11px; color: var(--text-muted); font-weight: 500; }
.sec-status-val   { font-size: 12.5px; font-weight: 700; color: var(--text); }

/* ===== SECURITY TAB — Main Grid ===== */
.sec-main-grid {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 20px;
    align-items: start;
}
@media (max-width: 900px) { .sec-main-grid { grid-template-columns: 1fr; } }

/* Settings column */
.sec-settings-col {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

/* Each settings block */
.sec-block {
    padding: 16px 18px;
}
.sec-block-lead {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 14px;
}
.sec-block-icon {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: color-mix(in srgb, var(--ic, #6366f1) 12%, transparent);
    color: var(--ic, #6366f1);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
}
.sec-block-title { font-weight: 700; font-size: 13.5px; color: var(--text); }
.sec-block-sub   { font-size: 11.5px; color: var(--text-muted); margin-top: 2px; }

.sec-save-btn { width: 100%; justify-content: center; }

/* Password policy row */
.pw-policy-row {
    display: flex;
    align-items: flex-start;
    gap: 20px;
    flex-wrap: wrap;
}
.pw-complex-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    padding: 8px 12px;
    border-radius: 10px;
    border: 1.5px solid var(--border);
    background: var(--surface);
    flex: 1;
    min-width: 160px;
    transition: border-color .2s;
}
.pw-complex-toggle:hover { border-color: var(--accent); }
.pw-complex-toggle input { display: none; }
.pw-complex-toggle input:checked ~ .pw-toggle-switch {
    background: var(--accent);
}
.pw-complex-toggle input:checked ~ .pw-toggle-switch::after {
    transform: translateX(-18px);
}
.pw-complex-body { flex: 1; }
.pw-complex-title { display: block; font-weight: 700; font-size: 13px; color: var(--text); }
.pw-complex-sub   { display: block; font-size: 11px; color: var(--text-muted); margin-top: 1px; }
.pw-toggle-switch {
    width: 36px;
    height: 20px;
    border-radius: 20px;
    background: var(--border);
    position: relative;
    flex-shrink: 0;
    transition: background .25s;
}
.pw-toggle-switch::after {
    content: '';
    position: absolute;
    width: 14px;
    height: 14px;
    background: #fff;
    border-radius: 50%;
    top: 3px;
    left: 3px;
    transition: transform .25s;
}

/* Permissions column */
.sec-perms-col { display: flex; flex-direction: column; }

/* Role legend chips */
.perm-roles-legend {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    padding: 0 20px 14px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 4px;
}
.perm-role-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    background: var(--surface);
    border: 1.5px solid var(--border);
    color: var(--text);
}
.perm-role-chip i { color: var(--accent); }
.perm-role-chip.admin {
    border-color: rgba(99,102,241,.35);
    background: rgba(99,102,241,.06);
    color: #4338ca;
}
.perm-role-chip.admin i { color: #6366f1; }
.perm-role-lock { font-size: 10px; color: #6366f1; margin-right: 2px; }

.perm-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 20px 0;
    flex-wrap: wrap;
    border-top: 1px solid var(--border);
    margin-top: 14px;
}
.perm-note {
    font-size: 12px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 5px;
    margin-right: auto;
}

/* Audit count badge */
.audit-count-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--accent);
    color: #fff;
    font-size: 10.5px;
    font-weight: 700;
    border-radius: 20px;
    padding: 1px 7px;
    margin-right: 6px;
    vertical-align: middle;
}

/* Audit search */
.audit-search-wrap {
    position: relative;
    display: flex;
    align-items: center;
}
.audit-search-icon {
    position: absolute;
    right: 10px;
    color: var(--text-muted);
    font-size: 12px;
    pointer-events: none;
}
.audit-search-input {
    padding-right: 30px !important;
    max-width: 190px;
    height: 34px;
}

/* Audit user avatar */
.audit-user-row {
    display: flex;
    align-items: center;
    gap: 8px;
}
.audit-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    color: #fff;
    flex-shrink: 0;
}

/* ===== SETTINGS — Audit Log ===== */
.audit-table-wrap {
    overflow-x: auto;
    max-height: 320px;
    overflow-y: auto;
    border: 1px solid var(--border);
    border-radius: 10px;
}
.audit-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.audit-table thead {
    position: sticky;
    top: 0;
    background: var(--sidebar-bg);
    z-index: 1;
}
.audit-table th {
    padding: 10px 12px;
    text-align: right;
    font-weight: 700;
    color: var(--text-muted);
    font-size: 12px;
    border-bottom: 2px solid var(--border);
    white-space: nowrap;
}
.audit-table td {
    padding: 9px 12px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}
.audit-table tr:last-child td { border-bottom: none; }
.audit-table tbody tr:hover { background: var(--sidebar-bg); }

/* legacy — kept for backward compat */
.audit-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 2px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
}

/* ── Audit log table cells ── */
.audit-col-time {
    color: var(--text-muted);
    font-size: 11px;
    white-space: nowrap;
}
.audit-col-user { white-space: nowrap; }
.audit-user-name { font-weight: 700; font-size: 13px; }
.audit-col-action {
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: nowrap;
    padding-top: 8px;
    padding-bottom: 8px;
}
.audit-action-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11.5px;
    font-weight: 700;
    background: color-mix(in srgb, var(--ac, #6b7280) 12%, transparent);
    color: var(--ac, #6b7280);
    border: 1px solid color-mix(in srgb, var(--ac, #6b7280) 25%, transparent);
    white-space: nowrap;
}
.audit-action-badge i { font-size: 10.5px; }
.audit-page-tag {
    display: inline-block;
    padding: 1px 7px;
    border-radius: 6px;
    font-size: 10.5px;
    font-weight: 600;
    background: var(--surface);
    color: var(--text-muted);
    border: 1px solid var(--border);
    white-space: nowrap;
}
.audit-col-detail {
    font-size: 12px;
    color: var(--text-muted);
    max-width: 220px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.audit-empty {
    text-align: center;
    color: var(--text-muted);
    padding: 28px !important;
    font-size: 13px;
}

/* ===== SETTINGS — Permissions Matrix ===== */
.perm-matrix-wrap {
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: 10px;
}
.perm-matrix {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
    min-width: 700px;
}
.perm-matrix thead { background: var(--sidebar-bg); position: sticky; top: 0; }
.perm-matrix th {
    padding: 9px 6px;
    text-align: center;
    font-weight: 700;
    color: var(--text-muted);
    font-size: 11px;
    border-bottom: 2px solid var(--border);
    white-space: nowrap;
}
.perm-role-th {
    text-align: right !important;
    padding-right: 14px !important;
    min-width: 140px;
}
.perm-mod-th { min-width: 44px; }
.perm-matrix td { padding: 8px 4px; border-bottom: 1px solid var(--border); text-align: center; }
.perm-role-td {
    text-align: right !important;
    padding-right: 14px !important;
    font-weight: 600;
    font-size: 13px;
    white-space: nowrap;
}
.perm-matrix tr:last-child td { border-bottom: none; }
.perm-matrix tbody tr:hover { background: var(--sidebar-bg); }
.perm-row--admin { background: color-mix(in srgb, var(--accent) 4%, transparent); }
.perm-locked-badge {
    display: inline-block;
    margin-right: 6px;
    padding: 1px 6px;
    background: var(--border);
    color: var(--text-muted);
    border-radius: 10px;
    font-size: 10px;
    font-weight: 600;
}
.perm-cb { width: 16px; height: 16px; cursor: pointer; accent-color: var(--accent); }
.perm-cb:disabled { opacity: .4; cursor: not-allowed; }

/* ===== SETTINGS — Integrations Tab ===== */
.intg-provider-grid {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 6px;
}
.intg-provider {
    flex: 1 1 120px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 3px;
    padding: 12px 14px;
    border: 2px solid var(--border);
    border-radius: 10px;
    cursor: pointer;
    transition: border-color .15s, background .15s;
    position: relative;
}
.intg-provider:hover { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 4%, transparent); }
.intg-provider.active {
    border-color: var(--accent);
    background: color-mix(in srgb, var(--accent) 8%, transparent);
}
.intg-prov-name { font-weight: 700; font-size: 14px; color: var(--text); }
.intg-prov-sub  { font-size: 11px; color: var(--text-muted); }
.intg-prov-badge {
    position: absolute;
    top: 6px;
    left: 8px;
    background: var(--accent);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 10px;
}
.intg-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
}
.intg-badge--ok  { background: color-mix(in srgb, var(--success) 12%, transparent); color: var(--success); }
.intg-badge--off { background: var(--sidebar-bg); color: var(--text-muted); }
.intg-test-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 14px;
    flex-wrap: wrap;
}
.intg-feature-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 14px;
    padding: 12px 14px;
    background: var(--sidebar-bg);
    border-radius: 8px;
}
.intg-feature {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text);
}
.alert-note {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 10px 14px;
    background: color-mix(in srgb, var(--accent) 8%, transparent);
    border: 1px solid color-mix(in srgb, var(--accent) 25%, transparent);
    border-radius: 8px;
    font-size: 13px;
    color: var(--text-muted);
    line-height: 1.5;
}
.alert-note i { color: var(--accent); margin-top: 1px; flex-shrink: 0; }

/* ===== SETTINGS — Backup Tab ===== */
.backup-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}
@media (max-width: 720px) { .backup-grid { grid-template-columns: 1fr; } }

.schedule-opts {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 4px;
}
.schedule-opt {
    flex: 1 1 90px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 14px 10px;
    border: 2px solid var(--border);
    border-radius: 10px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    transition: border-color .15s, color .15s, background .15s;
}
.schedule-opt i { font-size: 20px; }
.schedule-opt:hover { border-color: var(--accent); color: var(--accent); }
.schedule-opt.active {
    border-color: var(--accent);
    color: var(--accent);
    background: color-mix(in srgb, var(--accent) 8%, transparent);
}
.bk-schedule-info {
    margin-top: 12px;
    padding: 8px 12px;
    background: var(--sidebar-bg);
    border-radius: 8px;
    font-size: 12px;
    color: var(--text-muted);
}

.bk-history-list {
    display: flex;
    flex-direction: column;
    gap: 0;
    max-height: 260px;
    overflow-y: auto;
}
.bk-history-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 4px;
    border-bottom: 1px solid var(--border);
}
.bk-history-row:last-child { border-bottom: none; }
.bk-history-info { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.bk-history-date { font-size: 13px; font-weight: 600; color: var(--text); }
.bk-history-meta { font-size: 11px; color: var(--text-muted); }

.backup-action-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}
@media (max-width: 500px) { .backup-action-grid { grid-template-columns: 1fr; } }

.backup-action {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 20px 14px;
    border: 2px solid var(--border);
    border-radius: 12px;
    text-align: center;
}
.backup-action-icon {
    font-size: 32px;
    display: block;
}
.backup-action-title {
    font-weight: 700;
    font-size: 14px;
    color: var(--text);
}
.backup-action-desc {
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.4;
    flex: 1;
}

/* ═══════════════════════════════════════════════════════════════════════════
   SETTINGS — Invoice / Receipt Template System  (Enhanced UI)
   ═══════════════════════════════════════════════════════════════════════════ */

.doc-settings-layout {
    display: grid;
    grid-template-columns: 1fr 405px;
    gap: 24px;
    align-items: start;
}
@media (max-width: 1100px) {
    .doc-settings-layout { grid-template-columns: 1fr; }
    .doc-preview-pane { position: static !important; max-height: 640px; }
}
.doc-settings-pane { display: flex; flex-direction: column; gap: 18px; }

/* ── Doc-type switcher ─────────────────────────────────────────────────── */
.doc-type-switcher {
    display: flex;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 5px;
    gap: 5px;
    box-shadow: inset 0 2px 4px rgba(0,0,0,.05);
}
.doc-type-btn {
    flex: 1;
    padding: 12px 18px;
    border-radius: 10px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(.4,0,.2,1);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-family: inherit;
}
.doc-type-btn i { font-size: 16px; transition: transform 0.2s; }
.doc-type-btn:hover:not(.active) {
    background: var(--surface);
    color: var(--text);
}
.doc-type-btn:hover:not(.active) i { transform: scale(1.15); }
.doc-type-btn.active {
    background: var(--accent);
    color: #fff;
    box-shadow: 0 4px 16px rgba(0,0,0,.22);
}

/* ── Template grid ─────────────────────────────────────────────────────── */
.doc-tpl-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    padding: 4px 0 6px;
}
@media (max-width: 580px) { .doc-tpl-grid { grid-template-columns: repeat(2, 1fr); } }

/* ── Template card ─────────────────────────────────────────────────────── */
.doc-tpl-card {
    border: 2px solid var(--border);
    border-radius: 14px;
    padding: 10px 10px 12px;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(.4,0,.2,1);
    background: var(--surface);
    text-align: center;
    position: relative;
    overflow: hidden;
}
.doc-tpl-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, transparent 40%, rgba(59,130,246,.05) 100%);
    opacity: 0;
    transition: opacity 0.25s;
    pointer-events: none;
}
.doc-tpl-card:hover:not(.active) {
    border-color: var(--accent);
    transform: translateY(-3px);
    box-shadow: 0 8px 28px rgba(0,0,0,.13);
}
.doc-tpl-card:hover:not(.active)::before { opacity: 1; }
.doc-tpl-card.active {
    border-color: var(--accent);
    background: var(--surface);
    box-shadow: 0 0 0 3px var(--accent), 0 6px 20px rgba(0,0,0,.12);
}
.doc-tpl-card.active::after {
    content: '\2713';
    position: absolute;
    top: 9px;
    left: 9px;
    width: 20px;
    height: 20px;
    background: var(--accent);
    color: #fff;
    border-radius: 50%;
    font-size: 11px;
    font-weight: 900;
    display: grid;
    place-items: center;
    font-family: sans-serif;
    line-height: 1;
    z-index: 2;
    box-shadow: 0 2px 6px rgba(0,0,0,.25);
}
.doc-tpl-card.active .doc-tpl-label { color: var(--accent); }
.doc-tpl-card.active .doc-tpl-thumb { border-color: var(--accent); }

/* ── Template thumbnail ─────────────────────────────────────────────────── */
.doc-tpl-thumb {
    width: 100%;
    aspect-ratio: 3 / 4;
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 9px;
    border: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    background: #fff;
    box-shadow: 0 2px 8px rgba(0,0,0,.08);
    transition: box-shadow 0.2s, border-color 0.2s;
}
.doc-tpl-card:hover .doc-tpl-thumb,
.doc-tpl-card.active .doc-tpl-thumb {
    box-shadow: 0 4px 16px rgba(0,0,0,.14);
}

/* Header section of thumbnail — common */
.doc-tpl-thumb-header {
    flex-shrink: 0;
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 5px 7px;
    gap: 3px;
    overflow: hidden;
}
/* Simulated shop name line */
.doc-tpl-thumb-header::before {
    content: '';
    display: block;
    height: 5px;
    width: 48%;
    border-radius: 2px;
    background: rgba(255,255,255,.82);
    flex-shrink: 0;
}
/* Simulated subtitle line */
.doc-tpl-thumb-header::after {
    content: '';
    display: block;
    height: 3px;
    width: 30%;
    border-radius: 1px;
    background: rgba(255,255,255,.48);
    flex-shrink: 0;
}

/* Thumbnail body */
.doc-tpl-thumb-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 6px 6px 5px;
}
.doc-tpl-thumb-inforow {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}
.doc-tpl-thumb-inforow-cell {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
    background: #f9fafb;
    border-radius: 2px;
    padding: 3px 3px;
}
.doc-tpl-thumb-row {
    height: 5px;
    border-radius: 2px;
    background: #e5e7eb;
    flex-shrink: 0;
}
.doc-tpl-thumb-row.short { width: 60%; }
.doc-tpl-thumb-table {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin-top: 3px;
    flex: 1;
}
.doc-tpl-thumb-trow {
    height: 5px;
    border-radius: 1px;
    background: #e5e7eb;
    flex-shrink: 0;
}
.doc-tpl-thumb-trow.dark { background: #9ca3af; height: 6px; }
.doc-tpl-thumb-trow.gold { background: #C8A84B55; height: 6px; width: 60%; align-self: flex-end; margin-top: auto; }
.doc-tpl-thumb-duo {
    display: flex;
    gap: 3px;
    flex-shrink: 0;
}
.doc-tpl-thumb-box {
    flex: 1;
    height: 22px;
    border-radius: 3px;
    background: #f3f4f6;
    border: 1px solid #e5e7eb;
}
.doc-tpl-thumb-note {
    height: 7px;
    border-radius: 2px;
    background: #fef9c3;
    border: 1px solid #fde68a;
    flex-shrink: 0;
}

/* ── Header colors per template ─────────────────────────────────────────── */
.doc-tpl-thumb--modern .doc-tpl-thumb-header {
    height: 36px;
    background: linear-gradient(135deg, #1B2A4A 0%, #3b82f6 100%);
}
.doc-tpl-thumb--classic .doc-tpl-thumb-header {
    height: 36px;
    background: #1B2A4A;
}
.doc-tpl-thumb--minimal .doc-tpl-thumb-header {
    height: 22px;
    background: #f8fafc;
    border-top: 3px solid #1B2A4A;
    padding: 4px 7px;
}
.doc-tpl-thumb--minimal .doc-tpl-thumb-header::before { background: rgba(27,42,74,.55); }
.doc-tpl-thumb--minimal .doc-tpl-thumb-header::after  { background: rgba(27,42,74,.28); }
.doc-tpl-thumb--compact .doc-tpl-thumb-header {
    height: 20px;
    background: #374151;
    padding: 3px 6px;
}
.doc-tpl-thumb--standard .doc-tpl-thumb-header {
    height: 36px;
    background: #1B2A4A;
}
.doc-tpl-thumb--elegant .doc-tpl-thumb-header {
    height: 38px;
    background: linear-gradient(135deg, #1B2A4A 0%, #C8A84B 100%);
    align-items: center;
    text-align: center;
}
.doc-tpl-thumb--elegant .doc-tpl-thumb-header::before {
    background: rgba(255,255,255,.88);
    width: 52%;
    margin: 0 auto;
}
.doc-tpl-thumb--elegant .doc-tpl-thumb-header::after {
    background: rgba(255,255,255,.5);
    width: 32%;
    margin: 0 auto;
}

/* ── Template card labels ─────────────────────────────────────────────── */
.doc-tpl-label {
    font-weight: 700;
    font-size: 12px;
    color: var(--text);
    margin-bottom: 2px;
    transition: color 0.2s;
}
.doc-tpl-desc {
    font-size: 10px;
    color: var(--text-muted);
    line-height: 1.35;
}

/* ── Preview pane ──────────────────────────────────────────────────────── */
.doc-preview-pane {
    position: sticky;
    top: 76px;
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 96px);
    border-radius: 18px;
    overflow: hidden;
    box-shadow:
        0 0 0 1px rgba(0,0,0,.08),
        0 12px 40px rgba(0,0,0,.16),
        0 4px 12px rgba(0,0,0,.1);
}
.doc-preview-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    gap: 8px;
    flex-shrink: 0;
}
.doc-preview-topbar-dots {
    display: flex;
    gap: 5px;
    align-items: center;
}
.doc-preview-topbar-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}
.doc-preview-topbar-dot:nth-child(1) { background: #ef4444; }
.doc-preview-topbar-dot:nth-child(2) { background: #f59e0b; }
.doc-preview-topbar-dot:nth-child(3) { background: #22c55e; }
.doc-preview-label {
    flex: 1;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    text-align: center;
}
.doc-preview-label i { color: var(--accent); }
.doc-preview-actions { display: flex; gap: 5px; }
.doc-preview-scroll {
    flex: 1;
    overflow-y: auto;
    background:
        radial-gradient(ellipse at 50% 0%, #bcc0c8 0%, #c8ccd4 60%, #d1d5db 100%);
    padding: 20px 16px 28px;
}
.doc-preview-scroll::-webkit-scrollbar { width: 5px; }
.doc-preview-scroll::-webkit-scrollbar-track { background: transparent; }
.doc-preview-scroll::-webkit-scrollbar-thumb {
    background: rgba(0,0,0,.2);
    border-radius: 99px;
}
#doc-live-preview {
    background: #fff;
    border-radius: 6px;
    box-shadow:
        0 1px 3px rgba(0,0,0,.08),
        0 6px 24px rgba(0,0,0,.18),
        0 20px 50px rgba(0,0,0,.12);
    overflow: hidden;
    font-family: 'Cairo', sans-serif;
    direction: rtl;
    font-size: 12px;
    transform: scale(0.86);
    transform-origin: top center;
    margin-bottom: -14%;
    transition: box-shadow 0.3s;
}

/* ── ZATCA / Tax Compliance Tab ─────────────────────────────────────────── */
.zatca-status-card {
    grid-column: 1 / -1;
    border-radius: 14px;
}

.zatca-checks-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 6px;
}

.zatca-check-item {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 12px;
    padding: 5px 8px;
    border-radius: 8px;
    background: rgba(255,255,255,0.6);
}

.zatca-check-item.ok  { color: #059669; }
.zatca-check-item.fail { color: #dc2626; }
.zatca-check-item i   { font-size: 13px; flex-shrink: 0; }

.zatca-phase2-badge {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    background: linear-gradient(135deg, #1B2A4A, #3b82f6);
    color: #fff;
    padding: 7px 14px;
    border-radius: 99px;
    font-size: 12px;
    font-weight: 700;
}

.zatca-info-card { grid-column: 1 / -1; }

.zatca-requirements-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

@media (max-width: 640px) {
    .zatca-requirements-grid { grid-template-columns: 1fr; }
}

.zatca-req-item {
    background: var(--bg);
    border-radius: 10px;
    padding: 16px;
    border: 1px solid var(--border);
}

.zatca-req-phase {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 99px;
    font-size: 11px;
    font-weight: 700;
    background: #1B2A4A;
    color: #fff;
    margin-bottom: 8px;
}

.zatca-req-phase.phase2 {
    background: linear-gradient(135deg, #7c3aed, #3b82f6);
}

.zatca-req-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 8px;
}

.zatca-req-list {
    margin: 0;
    padding-right: 16px;
    list-style: disc;
    color: var(--text-muted);
    font-size: 12px;
    line-height: 1.8;
}

.required { color: #ef4444; }

.btn-outline-primary {
    border: 1.5px solid var(--accent);
    color: var(--accent);
    background: transparent;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
}
.btn-outline-primary:hover {
    background: var(--accent);
    color: #fff;
}

/* ===== NOTIFICATION BELL DROPDOWN ===== */
.notif-dropdown {
    position: absolute;
    top: calc(100% + 14px);
    left: 0;
    width: 320px;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0,0,0,.18), 0 2px 8px rgba(0,0,0,.08);
    z-index: 1500;
    overflow: hidden;
    transform-origin: top left;
    animation: notifSlideIn 0.18s cubic-bezier(.4,0,.2,1);
}

@keyframes notifSlideIn {
    from { opacity: 0; transform: translateY(-8px) scale(0.97); }
    to   { opacity: 1; transform: translateY(0)    scale(1); }
}

.notif-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px 12px;
    border-bottom: 1px solid var(--border);
    background: var(--surface);
}

.notif-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 7px;
}

.notif-title i {
    font-size: 13px;
    color: var(--accent);
}

.notif-close-btn {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    background: none;
    border: none;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    font-size: 13px;
    font-family: inherit;
}
.notif-close-btn:hover { background: var(--bg); color: var(--text); }

.notif-list {
    max-height: 340px;
    overflow-y: auto;
    padding: 6px 0;
}

.notif-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 16px;
    cursor: pointer;
    transition: background 0.15s;
}
.notif-item:hover { background: var(--bg); }

.notif-item-icon {
    width: 40px;
    height: 40px;
    border-radius: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
}

.notif-icon-success { background: rgba(4,120,87,.1);   color: #047857; }
.notif-icon-warning { background: rgba(180,83,9,.1);   color: #b45309; }
.notif-icon-danger  { background: rgba(185,28,28,.1);  color: #b91c1c; }
.notif-icon-info    { background: rgba(59,130,246,.1); color: #2563eb; }
.notif-icon-primary { background: rgba(27,42,74,.1);   color: #1B2A4A; }

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

.notif-item-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    line-height: 1.3;
}
.notif-item-count {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 2px;
}

.notif-item-arrow {
    color: var(--border);
    font-size: 11px;
    flex-shrink: 0;
    transition: color 0.15s;
}
.notif-item:hover .notif-item-arrow { color: var(--text-muted); }

.notif-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 32px 20px;
    color: var(--text-muted);
    font-size: 13px;
    text-align: center;
}
.notif-empty i { font-size: 28px; opacity: 0.35; }

/* Dark mode */
[data-theme="dark"] .notif-icon-primary { background: rgba(99,179,237,.1);  color: #93c5fd; }
[data-theme="dark"] .notif-icon-success { background: rgba(52,211,153,.1);  color: #34d399; }
[data-theme="dark"] .notif-icon-warning { background: rgba(251,191,36,.1);  color: #fbbf24; }
[data-theme="dark"] .notif-icon-danger  { background: rgba(248,113,113,.1); color: #f87171; }
[data-theme="dark"] .notif-icon-info    { background: rgba(96,165,250,.1);  color: #60a5fa; }

/* ===== USERS MODULE ===== */

/* Stats row */
.users-stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 14px;
    margin-bottom: 18px;
}
.users-stat-card {
    background: var(--bg-card);
    border-radius: 14px;
    padding: 16px 18px;
    display: flex;
    align-items: center;
    gap: 14px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    transition: transform 0.15s, box-shadow 0.15s;
}
.users-stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.users-stat-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}
.users-stat-num  { font-size: 22px; font-weight: 800; color: var(--text); line-height: 1; }
.users-stat-label { font-size: 11px; color: var(--text-muted); margin-top: 3px; }

/* Roles grid */
.users-roles-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 12px;
    margin-bottom: 18px;
}
.users-role-card {
    background: var(--bg-card);
    border-radius: 12px;
    padding: 14px 16px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
}
.users-role-icon {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
}
.users-role-name { font-weight: 700; font-size: 13px; color: var(--text); }
.users-role-desc { font-size: 11px; color: var(--text-muted); margin-top: 3px; line-height: 1.5; }

/* Filter bar */
.users-filter-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    padding: 14px 18px;
    margin-bottom: 18px;
}
.users-search-wrap {
    position: relative;
    flex: 1;
    min-width: 200px;
}
.users-search-icon {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 13px;
    pointer-events: none;
}
.users-search-input {
    width: 100%;
    padding: 9px 36px 9px 14px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--bg);
    color: var(--text);
    font-family: 'Cairo', sans-serif;
    font-size: 13px;
    transition: border-color 0.2s, box-shadow 0.2s;
    outline: none;
}
.users-search-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(200,168,75,.12); }
.users-filter-group { display: flex; gap: 10px; flex-wrap: wrap; }

/* Users Grid */
.users-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 18px;
    margin-bottom: 4px;
}

/* User Card */
.users-card {
    background: var(--bg-card);
    border-radius: 18px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: transform 0.18s, box-shadow 0.18s;
}
.users-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
.users-card--disabled { opacity: 0.7; }
.users-card--disabled .users-card-head { filter: grayscale(0.4); }

.users-card-head {
    position: relative;
    padding: 28px 20px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}
.users-card-self-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(200,168,75,.2);
    color: #C8A84B;
    font-size: 11px;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 20px;
    border: 1px solid rgba(200,168,75,.35);
}
.users-card-status-dot {
    position: absolute;
    top: 12px;
    left: 14px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    border: 2px solid var(--bg-card);
}
.dot-active   { background: #10b981; }
.dot-disabled { background: #ef4444; }

.users-avatar-lg {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 26px;
    font-weight: 800;
    letter-spacing: 1px;
    box-shadow: 0 4px 14px rgba(0,0,0,0.2);
}
.users-card-role-badge {
    font-size: 12px;
    font-weight: 600;
    padding: 4px 14px;
    border-radius: 20px;
    display: flex;
    align-items: center;
}

.users-card-body {
    padding: 16px 20px;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 5px;
}
.users-card-name     { font-size: 16px; font-weight: 800; color: var(--text); text-align: center; }
.users-card-username { font-size: 12px; color: var(--text-muted); display: flex; align-items: center; justify-content: center; }
.users-card-email    { font-size: 12px; color: var(--text-muted); display: flex; align-items: center; justify-content: center; }
.users-card-meta     { display: flex; align-items: center; justify-content: center; gap: 10px; margin-top: 8px; flex-wrap: wrap; }

.users-card-actions {
    display: flex;
    gap: 6px;
    padding: 12px 14px;
    border-top: 1px solid var(--border);
    flex-wrap: wrap;
    background: var(--bg);
}
.users-action-btn {
    flex: 1;
    min-width: 0;
    font-size: 12px;
    padding: 7px 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    white-space: nowrap;
}

/* Audit Log */
.audit-log-list  { display: flex; flex-direction: column; }
.audit-log-item  {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 14px 20px;
    border-bottom: 1px solid var(--border);
    transition: background 0.12s;
}
.audit-log-item:last-child { border-bottom: none; }
.audit-log-item:hover { background: var(--bg); }
.audit-log-icon {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    flex-shrink: 0;
    margin-top: 2px;
}
.audit-log-content { flex: 1; min-width: 0; }
.audit-log-action  { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 4px; }
.audit-action-badge {
    font-size: 11px;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 20px;
}
.audit-page-badge {
    font-size: 11px;
    font-weight: 600;
    padding: 2px 9px;
    border-radius: 20px;
    background: var(--border);
    color: var(--text-muted);
    display: inline-flex;
    align-items: center;
}
.audit-log-user    { font-size: 12px; color: var(--text-muted); }
.audit-log-details { font-size: 13px; color: var(--text); }
.audit-log-time    {
    font-size: 11px;
    color: var(--text-muted);
    white-space: nowrap;
    flex-shrink: 0;
    padding-top: 2px;
    display: flex;
    align-items: center;
}

/* Dark mode adjustments */
[data-theme="dark"] .users-search-input { background: var(--surface); }
[data-theme="dark"] .users-card-actions { background: rgba(0,0,0,0.15); }

/* Responsive */
@media (max-width: 600px) {
    .users-grid { grid-template-columns: 1fr; }
    .users-stats-row { grid-template-columns: repeat(2, 1fr); }
    .users-roles-grid { grid-template-columns: 1fr; }
    .users-action-btn { font-size: 11px; padding: 6px 5px; }
}

/* ══ ABOUT TAB ═════════════════════════════════════════════════════════════ */

/* Hero */
.about-hero {
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    gap: 24px;
    padding: 32px 28px;
    margin-bottom: 20px;
    background: linear-gradient(135deg, var(--surface) 0%, var(--bg) 100%);
}
.about-hero-glow {
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse 60% 80% at 90% 50%, color-mix(in srgb, var(--accent) 8%, transparent), transparent);
    pointer-events: none;
}
.about-hero-icon {
    width: 80px;
    height: 80px;
    border-radius: 22px;
    background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 70%, #8b5cf6));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 36px;
    color: #fff;
    flex-shrink: 0;
    box-shadow: 0 8px 24px color-mix(in srgb, var(--accent) 35%, transparent);
}
.about-hero-body { flex: 1; }
.about-sys-name {
    font-size: 26px;
    font-weight: 900;
    color: var(--text);
    line-height: 1.2;
    margin-bottom: 4px;
}
.about-sys-slogan {
    font-size: 14px;
    color: var(--text-muted);
    margin-bottom: 14px;
}
.about-version-wrap { display: flex; gap: 8px; flex-wrap: wrap; }
.about-version-badge {
    display: inline-flex;
    align-items: center;
    background: var(--accent);
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    padding: 4px 12px;
    border-radius: 20px;
}
.about-type-badge {
    display: inline-flex;
    align-items: center;
    background: color-mix(in srgb, var(--bc, #6366f1) 12%, transparent);
    color: var(--bc, #6366f1);
    border: 1px solid color-mix(in srgb, var(--bc, #6366f1) 25%, transparent);
    font-size: 12px;
    font-weight: 600;
    padding: 4px 12px;
    border-radius: 20px;
}

/* Main grid */
.about-main-grid {
    display: grid;
    grid-template-columns: 1fr 340px;
    gap: 20px;
    align-items: start;
    margin-bottom: 20px;
}
@media (max-width: 860px) {
    .about-main-grid { grid-template-columns: 1fr; }
}

/* Info card */
.about-info-card { padding: 22px 24px; }
.about-section-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13.5px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 14px;
    padding-bottom: 10px;
    border-bottom: 1.5px solid var(--border);
}
.about-info-list { display: flex; flex-direction: column; gap: 2px; }
.about-info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 9px 4px;
    border-bottom: 1px solid var(--border);
    gap: 12px;
}
.about-info-row:last-child { border-bottom: none; }
.about-info-key {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-muted);
}
.about-info-key i { width: 14px; text-align: center; color: var(--accent); }
.about-info-val {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
}

/* Tech stack chips */
.about-tech-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.about-tech-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    background: color-mix(in srgb, var(--tc, #6366f1) 10%, transparent);
    color: var(--tc, #6366f1);
    border: 1px solid color-mix(in srgb, var(--tc, #6366f1) 22%, transparent);
}
.about-tech-chip i { font-size: 13px; }

/* Developer card */
.about-dev-card { padding: 0; overflow: hidden; }
.about-dev-header {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 22px 20px 18px;
    background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 6%, transparent), transparent);
    border-bottom: 1px solid var(--border);
}
.about-dev-avatar {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), #8b5cf6);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    font-weight: 900;
    color: #fff;
    flex-shrink: 0;
    box-shadow: 0 4px 14px color-mix(in srgb, var(--accent) 30%, transparent);
}
.about-dev-hero-text { flex: 1; }
.about-dev-name {
    font-size: 16px;
    font-weight: 800;
    color: var(--text);
    margin-bottom: 2px;
}
.about-dev-title {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 500;
}
.about-dev-site-btn {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: var(--surface);
    border: 1.5px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent);
    font-size: 13px;
    text-decoration: none;
    transition: background .2s, border-color .2s;
}
.about-dev-site-btn:hover {
    background: color-mix(in srgb, var(--accent) 10%, transparent);
    border-color: var(--accent);
}

/* Contact rows */
.about-dev-contacts { display: flex; flex-direction: column; }
.about-contact-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 20px;
    border-bottom: 1px solid var(--border);
    text-decoration: none;
    transition: background .15s;
    cursor: pointer;
}
.about-contact-row:last-child { border-bottom: none; }
.about-contact-row:hover { background: var(--surface); }
.about-contact-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: color-mix(in srgb, var(--cc, #6366f1) 12%, transparent);
    color: var(--cc, #6366f1);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    flex-shrink: 0;
}
.about-contact-body { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.about-contact-label { font-size: 11px; color: var(--text-muted); font-weight: 500; }
.about-contact-val   { font-size: 13px; color: var(--text); font-weight: 700; }
.about-contact-arrow { color: var(--text-muted); font-size: 11px; }

.about-dev-footer {
    padding: 12px 20px;
    font-size: 12px;
    color: var(--text-muted);
    text-align: center;
    border-top: 1px solid var(--border);
    background: var(--surface);
}

/* Copyright */
.about-copyright {
    text-align: center;
    font-size: 12.5px;
    color: var(--text-muted);
    padding: 16px 0 4px;
}

/* Dark mode tweaks */
[data-theme="dark"] .about-hero {
    background: linear-gradient(135deg, var(--surface) 0%, var(--bg) 100%);
}

/* ===== SETTINGS IMPROVEMENTS ===== */

/* Scrollable tabs */
.tabs--scrollable {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    gap: 4px;
    padding-bottom: 2px;
}
.tabs--scrollable::-webkit-scrollbar { display: none; }
.tabs--scrollable .tab-btn {
    white-space: nowrap;
    flex-shrink: 0;
}

/* Settings health bar */
.settings-health-bar {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 14px 18px;
    margin-bottom: 18px;
    box-shadow: var(--shadow-sm);
}
.health-bar-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
}
.health-items {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}
.health-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 12px;
    border-radius: 10px;
    font-size: 12px;
    border: 1px solid transparent;
    transition: background 0.15s;
}
.health-ok   { background: rgba(16,185,129,.08); border-color: rgba(16,185,129,.2); }
.health-warn { background: rgba(245,158,11,.08);  border-color: rgba(245,158,11,.2); }
.health-dot {
    width: 7px; height: 7px;
    border-radius: 50%;
    background: #10b981;
    flex-shrink: 0;
}
.health-dot-warn { background: #f59e0b; }
.health-icon { font-size: 13px; color: var(--text-muted); }
.health-ok .health-icon { color: #10b981; }
.health-warn .health-icon { color: #f59e0b; }
.health-info { display: flex; flex-direction: column; gap: 1px; }
.health-label { font-weight: 700; color: var(--text); line-height: 1; }
.health-value { font-size: 11px; color: var(--text-muted); }
.health-ok .health-value { color: #10b981; }
.health-warn .health-value { color: #f59e0b; }

/* Inline field validation */
.field-invalid {
    border-color: #ef4444 !important;
    box-shadow: 0 0 0 3px rgba(239,68,68,.12) !important;
}
.field-error-msg {
    display: flex;
    align-items: center;
    gap: 5px;
    color: #ef4444;
    font-size: 11.5px;
    margin-top: 4px;
    font-weight: 500;
    animation: fadeInDown 0.15s ease;
}
.field-error-msg i { font-size: 11px; flex-shrink: 0; }
@keyframes fadeInDown {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* Button loading spinner */
.btn-spinner {
    display: inline-block;
    width: 13px;
    height: 13px;
    border: 2px solid rgba(255,255,255,0.35);
    border-top-color: #fff;
    border-radius: 50%;
    animation: splashSpin 0.65s linear infinite;
    vertical-align: middle;
    margin-left: 4px;
}
button:disabled { opacity: 0.7; cursor: not-allowed; }

/* Dark mode */
[data-theme="dark"] .health-ok   { background: rgba(16,185,129,.06); }
[data-theme="dark"] .health-warn { background: rgba(245,158,11,.06); }
[data-theme="dark"] .settings-health-bar { background: var(--surface); }

@media (max-width: 600px) {
    .health-items { flex-direction: column; }
    .health-item  { width: 100%; }
}

/* ══ LICENSE TAB ═══════════════════════════════════════════════════════════ */

/* Two-column layout */
.lic-layout {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 20px;
    align-items: start;
}
@media (max-width: 900px) {
    .lic-layout { grid-template-columns: 1fr; }
    .lic-col-side { order: -1; }
}

/* Plan cards grid */
.lic-plans-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
}
@media (max-width: 800px) { .lic-plans-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 480px) { .lic-plans-grid { grid-template-columns: 1fr; } }

.lic-plan-card {
    border-radius: 14px;
    border: 1.5px solid var(--border);
    padding: 16px 14px;
    background: var(--bg);
    display: flex;
    flex-direction: column;
    gap: 8px;
    position: relative;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.lic-plan-card:hover {
    border-color: var(--accent);
    box-shadow: 0 4px 20px rgba(0,0,0,.08);
}
.lic-plan-popular {
    border-color: var(--accent);
    background: linear-gradient(135deg, rgba(99,102,241,.05) 0%, var(--bg) 100%);
}
.lic-plan-badge {
    display: inline-block;
    background: var(--accent);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 20px;
    width: fit-content;
}
.lic-plan-icon { font-size: 20px; }
.lic-plan-name { font-weight: 700; font-size: 14px; color: var(--text); }
.lic-plan-sub  { font-size: 11.5px; color: var(--text-muted); margin-top: -4px; }

.lic-plan-features {
    list-style: none;
    padding: 0; margin: 4px 0 0;
    display: flex;
    flex-direction: column;
    gap: 5px;
}
.lic-plan-features li {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 12px;
    color: var(--text-muted);
}
.feat-ok i { color: #10b981; }
.feat-no   { opacity: .4; }
.feat-no i { color: #6b7280; }

/* Key input area */
.lic-key-input {
    font-family: 'Courier New', monospace;
    font-size: 13px;
    letter-spacing: .5px;
    resize: vertical;
    min-height: 70px;
}
.lic-key-actions {
    display: flex;
    gap: 6px;
    margin-top: 6px;
    flex-wrap: wrap;
}
.lic-key-hint {
    font-size: 11.5px;
    color: var(--text-muted);
    margin-top: 5px;
    min-height: 17px;
    transition: color 0.2s;
}
.lic-key-hint.hint-ok  { color: #10b981; font-weight: 600; }
.lic-key-hint.hint-err { color: #ef4444; font-weight: 600; }

/* Status banners */
.lic-banner {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 18px;
    border-radius: 14px;
    font-size: 14px;
    font-weight: 500;
    border: 1.5px solid transparent;
    flex-wrap: wrap;
}
.lic-banner i { font-size: 22px; flex-shrink: 0; }
.lic-trial   { background: rgba(99,102,241,.07); border-color: rgba(99,102,241,.25); color: #4338ca; }
.lic-expired { background: rgba(239,68,68,.07);  border-color: rgba(239,68,68,.25);  color: #b91c1c; }
.lic-warn    { background: rgba(245,158,11,.07); border-color: rgba(245,158,11,.25); color: #92400e; }
.lic-ok      { background: rgba(16,185,129,.07); border-color: rgba(16,185,129,.25); color: #065f46; }
[data-theme="dark"] .lic-trial   { color: #a5b4fc; }
[data-theme="dark"] .lic-expired { color: #fca5a5; }
[data-theme="dark"] .lic-warn    { color: #fcd34d; }
[data-theme="dark"] .lic-ok      { color: #6ee7b7; }

/* Mini banner (top of identity tab) */
.lic-mini {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 10px;
    font-size: 12.5px;
    font-weight: 600;
    border: 1px solid transparent;
}
.lic-mini.lic-trial   { background: rgba(99,102,241,.07); border-color: rgba(99,102,241,.2); color: #4338ca; }
.lic-mini.lic-expired { background: rgba(239,68,68,.07);  border-color: rgba(239,68,68,.2);  color: #b91c1c; }
.lic-mini.lic-warn    { background: rgba(245,158,11,.07); border-color: rgba(245,158,11,.2); color: #92400e; }
.lic-mini.lic-ok      { background: rgba(16,185,129,.07); border-color: rgba(16,185,129,.2); color: #065f46; }

/* License details side card */
.lic-details-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
    gap: 8px;
}
.lic-details-row:last-child { border-bottom: none; }
.lic-details-label { color: var(--text-muted); flex-shrink: 0; }
.lic-details-value { font-weight: 600; color: var(--text); text-align: left; }

/* Days remaining progress bar */
.lic-progress-wrap { padding: 10px 0 6px; }
.lic-progress-label {
    display: flex;
    justify-content: space-between;
    font-size: 11.5px;
    color: var(--text-muted);
    margin-bottom: 5px;
}
.lic-progress-bar {
    height: 7px;
    border-radius: 20px;
    background: var(--border);
    overflow: hidden;
}
.lic-progress-fill {
    height: 100%;
    border-radius: 20px;
    background: linear-gradient(90deg, #10b981, #34d399);
    transition: width 0.6s ease;
}
.lic-progress-fill.warn   { background: linear-gradient(90deg, #f59e0b, #fbbf24); }
.lic-progress-fill.danger { background: linear-gradient(90deg, #ef4444, #f87171); }

/* Generated key result */
.lic-gen-result-box {
    background: var(--surface);
    border-radius: 12px;
    border: 1.5px solid rgba(16,185,129,.3);
    padding: 14px;
}
.lic-gen-result-label {
    font-size: 12.5px;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 8px;
}
.lic-gen-key {
    display: block;
    word-break: break-all;
    font-family: 'Courier New', monospace;
    font-size: 12px;
    color: var(--text);
    background: var(--bg);
    border-radius: 8px;
    padding: 10px;
    border: 1px solid var(--border);
    line-height: 1.7;
    user-select: all;
}

/* Guide chevron transition */
.lic-guide-chevron {
    color: var(--text-muted);
    transition: transform 0.25s ease;
    flex-shrink: 0;
}

/* Guide body */
.lic-guide-body {
    padding: 0 20px 20px;
}
.lic-guide-cols {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 24px;
    margin-top: 4px;
}
.lic-guide-section {
    display: flex;
    flex-direction: column;
    gap: 14px;
}
.lic-guide-section-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
    font-size: 13px;
    color: var(--text);
    padding-bottom: 10px;
    border-bottom: 1.5px solid var(--border);
    flex-wrap: wrap;
}

/* Step rows */
.lic-step {
    display: flex;
    gap: 12px;
    align-items: flex-start;
}
.lic-step-num {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: rgba(99,102,241,.12);
    color: var(--accent);
    font-size: 12px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-top: 1px;
}
.lic-step-warn   { background: rgba(245,158,11,.12); color: #f59e0b; }
.lic-step-danger { background: rgba(239,68,68,.12);  color: #ef4444; }
.lic-step strong { font-size: 13px; display: block; margin-bottom: 3px; color: var(--text); }
.lic-step p {
    font-size: 12px;
    color: var(--text-muted);
    margin: 0;
    line-height: 1.65;
}
.lic-step code {
    font-family: 'Courier New', monospace;
    font-size: 11px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 1px 5px;
}

@media (max-width: 700px) {
    .lic-guide-cols { grid-template-columns: 1fr; }
}

/* ===== PAGINATION BAR ===== */
.pagination-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    border-top: 1px solid var(--border);
    gap: 12px;
    flex-wrap: wrap;
}
.pg-info {
    font-size: 12px;
    color: var(--text-muted);
}
.pg-btns {
    display: flex;
    align-items: center;
    gap: 4px;
}
.pg-btn {
    min-width: 32px;
    height: 32px;
    padding: 0 8px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    color: var(--text);
    font-family: var(--font);
    font-size: 13px;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.pg-btn:hover:not(:disabled) {
    border-color: var(--accent);
    color: var(--accent);
}
.pg-btn.active {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
    font-weight: 700;
}
.pg-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}
.pg-ellipsis {
    color: var(--text-muted);
    font-size: 13px;
    padding: 0 4px;
    user-select: none;
}

/* ══════════════════════════════════════════════════
   WHATSAPP MODULE
══════════════════════════════════════════════════ */

/* Variables bar */
.wa-vars-bar {
    margin-bottom: 16px;
    padding: 14px 16px;
}
.wa-vars-title {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-muted);
    margin-bottom: 10px;
}
.wa-vars-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
}
.wa-var-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 11px;
    border-radius: 99px;
    border: 1px solid var(--border);
    background: var(--bg-secondary);
    color: var(--text);
    font-size: 12px;
    cursor: pointer;
    transition: background .15s, border-color .15s, color .15s;
    white-space: nowrap;
}
.wa-var-chip:hover {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}
.wa-var-chip i { font-size: 11px; }

/* Active template hint */
.wa-active-hint {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-radius: var(--radius);
    padding: 9px 14px;
    font-size: 13px;
    color: #1d4ed8;
    margin-bottom: 12px;
}
[data-theme="dark"] .wa-active-hint {
    background: #1e3a5f22;
    border-color: #3b82f644;
    color: #93c5fd;
}

/* Template accordion card */
.wa-tpl-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    border-right: 4px solid var(--tpl-color, var(--accent));
    margin-bottom: 12px;
    overflow: hidden;
    transition: box-shadow .2s;
}
.wa-tpl-card:hover {
    box-shadow: 0 4px 16px rgba(0,0,0,.08);
}
.wa-tpl-head {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    cursor: pointer;
    user-select: none;
}
.wa-tpl-head:hover { background: var(--bg-secondary); }
.wa-tpl-head-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: color-mix(in srgb, var(--tpl-color, var(--accent)) 15%, transparent);
    color: var(--tpl-color, var(--accent));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    flex-shrink: 0;
}
.wa-tpl-head-info { flex: 1; min-width: 0; }
.wa-tpl-head-label { font-weight: 700; font-size: 14px; }
.wa-tpl-head-desc  { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.wa-tpl-head-meta  { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.wa-tpl-status {
    font-size: 11px;
    padding: 3px 9px;
    border-radius: 99px;
    background: color-mix(in srgb, var(--tpl-color, var(--accent)) 12%, transparent);
    color: var(--tpl-color, var(--accent));
    border: 1px solid color-mix(in srgb, var(--tpl-color, var(--accent)) 30%, transparent);
    white-space: nowrap;
}
.wa-tpl-chevron {
    color: var(--text-muted);
    font-size: 13px;
    transition: transform .25s;
}
.wa-tpl-chevron.rotated { transform: rotate(180deg); }

/* Template body (accordion) */
.wa-tpl-body {
    display: none;
    padding: 0 16px 16px;
    animation: fadeSlideDown .2s ease;
}
.wa-tpl-body.open { display: block; }
@keyframes fadeSlideDown {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
}
.wa-tpl-ta {
    font-size: 13px;
    line-height: 1.75;
    resize: vertical;
}
.wa-tpl-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 8px;
}
.wa-char-count { font-size: 11px; color: var(--text-muted); }
.wa-preview-btn {
    background: #25D366;
    color: #fff;
    border-color: #25D366;
}
.wa-preview-btn:hover { background: #128C7E; border-color: #128C7E; }

/* Send tab */
.wa-phone-wrap { position: relative; }
.wa-phone-prefix {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 13px;
    color: var(--text-muted);
    pointer-events: none;
}
.wa-phone-input { padding-right: 52px; }

.wa-send-btn {
    width: 100%;
    background: #25D366;
    color: #fff;
    border-color: #25D366;
    font-size: 15px;
    padding: 12px;
}
.wa-send-btn:hover { background: #128C7E; border-color: #128C7E; }

/* Customer search dropdown */
.wa-cust-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    left: 0;
    z-index: 200;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    max-height: 220px;
    overflow-y: auto;
    box-shadow: 0 8px 24px rgba(0,0,0,.15);
}
.wa-cust-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    cursor: pointer;
    border-bottom: 1px solid var(--border);
    transition: background .12s;
}
.wa-cust-item:last-child { border-bottom: none; }
.wa-cust-item.hover,
.wa-cust-item:hover { background: var(--bg-secondary); }
.wa-cust-avatar {
    width: 34px; height: 34px;
    border-radius: 50%;
    background: var(--accent);
    color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-size: 13px; font-weight: 700; flex-shrink: 0;
}
.wa-cust-name  { font-weight: 600; font-size: 13px; }
.wa-cust-phone { font-size: 11px; color: var(--text-muted); }

/* WhatsApp phone preview */
.wa-chat-topbar {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #075E54;
    color: #fff;
    padding: 12px 16px;
}
.wa-chat-avatar {
    width: 38px; height: 38px;
    border-radius: 50%;
    background: #128C7E;
    display: flex; align-items: center; justify-content: center;
    font-size: 1rem; flex-shrink: 0;
}
.wa-chat-contact { flex: 1; }
.wa-chat-name   { font-weight: 700; font-size: 13px; }
.wa-chat-status { font-size: 11px; opacity: .75; }
.wa-chat-body {
    background: #ECE5DD;
    min-height: 190px;
    padding: 16px;
    direction: ltr;
}
.wa-bubble {
    background: #DCF8C6;
    border-radius: 12px 2px 12px 12px;
    padding: 10px 14px;
    max-width: 85%;
    margin-right: auto;
    box-shadow: 0 1px 2px rgba(0,0,0,.15);
    display: inline-block;
}
.wa-bubble-text {
    margin: 0;
    font-family: inherit;
    font-size: 13px;
    white-space: pre-wrap;
    color: #111;
    direction: rtl;
    text-align: right;
    min-height: 36px;
}
.wa-bubble-time {
    font-size: 10px;
    color: #667781;
    text-align: left;
    margin-top: 5px;
}

/* Broadcast card */
.wa-broadcast-card { border-top: 3px solid #25D366; }
.wa-broadcast-body { padding: 0 16px 16px; }

/* Preview modal */
.wa-preview-modal-bg {
    background: #ECE5DD;
    border-radius: 12px;
    padding: 20px;
    direction: ltr;
    text-align: left;
}

/* Logs stats strip */
.wa-logs-stats {
    display: flex;
    gap: 12px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
}
.wa-logs-stat {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 600;
}
.wa-logs-stat.green { color: var(--success); }
.wa-logs-stat.red   { color: var(--danger);  }
.wa-logs-stat.muted { color: var(--text-muted); }
