@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@300;400;500;600;700;800;900&display=swap');

:root {
    --primary: #8B0000;
    --primary-light: #A00000;
    --primary-dark: #5C0000;
    --primary-bg: rgba(139,0,0,0.08);
    --primary-glow: rgba(139,0,0,0.3);
    --success: #27C93F;
    --success-bg: rgba(39,201,63,0.1);
    --danger: #FF5F56;
    --danger-bg: rgba(255,95,86,0.1);
    --warning: #f59e0b;
    --warning-bg: rgba(245,158,11,0.08);
    --info: #3b82f6;
    --info-bg: rgba(59,130,246,0.08);

    --bg-body: #F5F5F5;
    --bg-card: #FFFFFF;
    --bg-card-hover: #FAFAFA;
    --bg-nav: rgba(255,255,255,0.85);
    --text-main: #1A1A1A;
    --text-secondary: #555555;
    --text-muted: #888888;
    --border: rgba(139,0,0,0.15);
    --border-light: rgba(0,0,0,0.08);
    --shadow-xs: 0 1px 2px rgba(0,0,0,0.04);
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
    --shadow: 0 4px 6px -1px rgba(0,0,0,0.07), 0 2px 4px -2px rgba(0,0,0,0.05);
    --shadow-md: 0 10px 15px -3px rgba(0,0,0,0.08), 0 4px 6px -4px rgba(0,0,0,0.04);
    --shadow-lg: 0 20px 25px -5px rgba(0,0,0,0.08), 0 8px 10px -6px rgba(0,0,0,0.04);
    --shadow-xl: 0 25px 50px -12px rgba(0,0,0,0.15);
    --radius: 16px;
    --radius-md: 12px;
    --radius-sm: 8px;
    --radius-xs: 6px;
    --transition: all 0.25s cubic-bezier(0.4,0,0.2,1);
    --grad-1: #F5F5F5;
    --grad-2: #EFEBEE;
    --grad-3: #F3ECEF;
    --grad-4: #F6F3F0;
}

[data-bs-theme="dark"] {
    --bg-body: #0A0A0A;
    --bg-card: #111111;
    --bg-card-hover: #1A1A1A;
    --bg-nav: rgba(10,10,10,0.85);
    --text-main: #FFFFFF;
    --text-secondary: #AAAAAA;
    --text-muted: #888888;
    --border: rgba(139,0,0,0.2);
    --border-light: rgba(255,255,255,0.06);
    --shadow-xs: 0 1px 2px rgba(0,0,0,0.2);
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.3);
    --shadow: 0 4px 6px rgba(0,0,0,0.3);
    --shadow-md: 0 10px 15px rgba(0,0,0,0.3);
    --shadow-lg: 0 20px 25px rgba(0,0,0,0.35);
    --primary-bg: rgba(139,0,0,0.12);
    --primary-glow: rgba(139,0,0,0.45);
    --success-bg: rgba(39,201,63,0.12);
    --danger-bg: rgba(255,95,86,0.12);
    --warning-bg: rgba(245,158,11,0.12);
    --grad-1: #0A0A0A;
    --grad-2: #150708;
    --grad-3: #0C0D12;
    --grad-4: #120A0A;
}

* { box-sizing: border-box; }

body {
    background-color: var(--bg-body);
    background: linear-gradient(-45deg, var(--grad-1), var(--grad-2), var(--grad-3), var(--grad-4), var(--grad-2));
    background-size: 400% 400%;
    background-attachment: fixed;
    animation: gradientShift 18s ease infinite;
    color: var(--text-main);
    font-family: 'Cairo', system-ui, -apple-system, sans-serif;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

@keyframes gradientShift {
    0%   { background-position: 0% 50%; }
    50%  { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* ==================== GLOBAL TYPOGRAPHY (unified + smaller) ==================== */
/* Shrinks every rem-based size (Bootstrap + custom) by ~6% sitewide */
html {
    font-size: 15px;
}

/* One consistent text scale for controls and content on all pages */
body {
    font-size: 0.9rem;
}

.form-control,
.form-select,
.form-label,
.input-group-text {
    font-size: 0.85rem;
}

.btn {
    font-size: 0.85rem;
}

.dropdown-item,
.dropdown-item-text,
.dropdown-header {
    font-size: 0.85rem;
}

.table {
    font-size: 0.85rem;
}

.pagination {
    font-size: 0.8rem;
}

.modal-title {
    font-size: 1rem;
}

.form-text,
small,
.small {
    font-size: 0.75rem;
}

h1 { font-size: 1.5rem; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.1rem; }

/* ==================== MODALS: always scrollable when taller than screen ==================== */
/* Header/footer stay visible; the body scrolls so no details are cut off */
.modal-content {
    max-height: calc(100vh - 2rem);
}

.modal-header,
.modal-footer {
    flex-shrink: 0;
}

.modal-body {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
}

@media (prefers-reduced-motion: reduce) {
    body {
        animation: none;
        background-attachment: scroll;
    }
}

/* ==================== NAVBAR ==================== */
/* Fixed header layout: logo + site name stay on the RIGHT
   and the arrangement never flips when switching UI language */
.app-navbar,
.landing-navbar {
    direction: rtl;
}

.app-navbar {
    background: var(--bg-nav) !important;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow-xs);
    padding: 0.45rem 0;
}

.navbar-brand {
    font-weight: 700;
    font-size: 0.95rem;
    letter-spacing: -0.02em;
    color: var(--primary) !important;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.navbar-brand .brand-icon {
    display: flex;
    align-items: center;
    justify-content: center;
}

.navbar-brand .brand-icon img {
    height: 28px;
    width: auto;
    object-fit: contain;
}

.navbar .nav-link {
    color: var(--text-secondary) !important;
    font-weight: 500;
    font-size: 0.78rem;
    padding: 0.4rem 0.7rem;
    border-radius: var(--radius-sm);
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.navbar .nav-link:hover,
.navbar .nav-link.active {
    color: var(--primary) !important;
    background: var(--primary-bg);
}

.navbar-toggler {
    border: 1px solid var(--border);
    padding: 0.4rem 0.6rem;
    border-radius: var(--radius-xs);
}

.navbar-toggler:focus {
    box-shadow: 0 0 0 3px var(--primary-bg);
}

.navbar-toggler-icon {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba(139,0,0,0.85)' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
}

.user-dropdown .dropdown-toggle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.3rem 0.6rem;
    border-radius: 100px;
    border: 1px solid var(--border);
    background: var(--bg-card);
    font-weight: 500;
    font-size: 0.78rem;
    color: var(--text-main);
    transition: var(--transition);
}

.user-dropdown .dropdown-toggle:hover {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-bg);
}

.user-dropdown .dropdown-toggle::after {
    margin-left: 0.4rem;
}

.user-avatar {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 0.72rem;
    font-weight: 600;
}

.user-avatar-img {
    width: 100%;
    height: 100%;
    border-radius: inherit;
    object-fit: cover;
    display: block;
}

#themeToggle {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text-secondary);
    transition: var(--transition);
}

#themeToggle:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-bg);
    transform: rotate(20deg);
}

.theme-toggle-fab {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 1100;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    border: 1px solid rgba(255,255,255,0.12);
    background: rgba(17,17,17,0.7);
    color: #FFFFFF;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.05rem;
    transition: var(--transition);
    box-shadow: var(--shadow-md);
}

.theme-toggle-fab:hover {
    border-color: var(--primary);
    background: var(--primary-bg);
    color: #fff;
    transform: rotate(20deg);
}

/* ==================== NAVBAR ICON BUTTONS ==================== */
.navbar .btn-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text-secondary);
    transition: var(--transition);
}

.navbar .btn-icon:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-bg);
}

/* ==================== NOTIFICATIONS ==================== */
.nav-notif-btn {
    position: relative;
}

.nav-badge {
    position: absolute;
    top: -8px;
    inset-inline-end: -8px;
    z-index: 9999;
    min-width: 20px;
    height: 20px;
    padding: 0 5px;
    border-radius: 10px;
    background: #e02424;
    color: #fff;
    font-size: 0.7rem;
    font-weight: 700;
    line-height: 20px;
    text-align: center;
    box-shadow: 0 0 0 2px var(--bg-nav);
    pointer-events: none;
}

.notif-panel {
    position: absolute;
    top: calc(100% + 10px);
    inset-inline-end: 0;
    width: 340px;
    max-width: calc(100vw - 1rem);
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    z-index: 1080;
    overflow: hidden;
}

.notif-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border);
    color: var(--text-main);
    font-size: 0.9rem;
}

.notif-clear-btn {
    width: 28px;
    height: 28px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    border-radius: var(--radius-xs);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
}

.notif-clear-btn:hover {
    color: var(--primary);
    background: var(--primary-bg);
}

.notif-list {
    max-height: 380px;
    overflow-y: auto;
}

.notif-item {
    display: flex;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-light);
    transition: var(--transition);
    cursor: pointer;
}

.notif-item:hover {
    background: var(--bg-card-hover);
}

.notif-item.unread {
    background: var(--primary-bg);
}

.notif-item-icon {
    width: 34px;
    height: 34px;
    flex: 0 0 34px;
    border-radius: 50%;
    background: var(--primary-bg);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
}

.notif-item-body {
    min-width: 0;
    flex: 1;
}

.notif-item-title {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-main);
}

.notif-item-msg {
    font-size: 0.78rem;
    color: var(--text-secondary);
    white-space: pre-wrap;
    word-break: break-word;
    margin-top: 2px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.notif-item-time {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-top: 3px;
}

.notif-item-link {
    margin-top: 4px;
}

.notif-item-link a {
    font-size: 0.75rem;
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
}

.notif-item-link a:hover {
    text-decoration: underline;
}

.notif-empty {
    padding: 2.5rem 1rem;
    text-align: center;
    color: var(--text-muted);
}

.notif-empty i {
    font-size: 1.8rem;
    display: block;
    margin-bottom: 0.5rem;
}

.notif-empty p {
    margin: 0;
    font-size: 0.85rem;
}


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

.card-header-custom {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.card-body {
    padding: 1.5rem;
}

/* ==================== BUTTONS ==================== */
.btn {
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 0.875rem;
    padding: 0.55rem 1.15rem;
    transition: var(--transition);
    letter-spacing: -0.01em;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    border: none;
    position: relative;
    overflow: hidden;
}

.btn::after {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(255,255,255,0);
    transition: var(--transition);
}

.btn:hover::after {
    background: rgba(255,255,255,0.1);
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn:active {
    transform: translateY(0);
    box-shadow: var(--shadow-xs);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff;
}

.btn-success {
    background: linear-gradient(135deg, var(--success), #1E9E33);
    color: #fff;
}

.btn-danger {
    background: linear-gradient(135deg, var(--danger), #E0483F);
    color: #fff;
}

.btn-warning {
    background: linear-gradient(135deg, var(--warning), #d97706);
    color: #fff;
}

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

.btn-outline-primary:hover {
    background: var(--primary);
    color: #fff;
}

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

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

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

.btn-outline-warning:hover {
    background: var(--warning);
    color: #fff;
}

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

.btn-outline-secondary:hover {
    background: var(--bg-card-hover);
    color: var(--text-main);
}

.btn-lg {
    padding: 0.7rem 1.5rem;
    font-size: 0.95rem;
    border-radius: var(--radius-md);
}

.btn-sm {
    padding: 0.35rem 0.7rem;
    font-size: 0.8rem;
    border-radius: var(--radius-xs);
}

/* ==================== FORMS ==================== */
.form-control,
.form-select {
    border-radius: var(--radius-sm);
    border: 1.5px solid var(--border);
    padding: 0.6rem 0.9rem;
    font-size: 0.9rem;
    transition: var(--transition);
    background: var(--bg-card);
    color: var(--text-main);
}

.form-control:focus,
.form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-bg);
    background: var(--bg-card);
}

.form-control-lg {
    padding: 0.75rem 1rem;
    font-size: 1rem;
    border-radius: var(--radius-md);
}

.form-label {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 0.4rem;
    letter-spacing: -0.01em;
}

.input-group .btn {
    border: 1.5px solid var(--border);
    background: var(--bg-card);
    color: var(--text-secondary);
}

.input-group .btn:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.input-group .form-control {
    border-right: none;
}

.input-group .form-control:focus {
    border-color: var(--primary);
}

/* ==================== LOGIN PAGE ==================== */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    background: linear-gradient(135deg, #0A0A0A 0%, #141414 50%, #0A0A0A 100%);
    position: relative;
    overflow-x: hidden;
}

.login-page::before {
    content: '';
    position: absolute;
    width: 600px;
    height: 600px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(139,0,0,0.18) 0%, transparent 70%);
    top: -200px;
    right: -100px;
}

.login-page::after {
    content: '';
    position: absolute;
    width: 500px;
    height: 500px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(160,0,0,0.12) 0%, transparent 70%);
    bottom: -150px;
    left: -100px;
}

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

.login-card {
    border: 1px solid rgba(255,255,255,0.08);
    background: rgba(17,17,17,0.8) !important;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 24px;
    box-shadow: 0 25px 50px rgba(0,0,0,0.3);
}

.login-card .card-body {
    padding: 2.5rem;
}

.login-brand {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

.login-brand-icon {
    width: 56px;
    height: 56px;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1.5rem;
    box-shadow: 0 8px 25px rgba(139,0,0,0.4);
}

.login-brand h2 {
    font-size: 1.6rem;
    font-weight: 800;
    color: #fff;
    letter-spacing: -0.03em;
    margin: 0;
}

.login-subtitle {
    color: #888888;
    font-size: 0.9rem;
    margin-bottom: 2rem;
}

.login-card .form-label {
    color: #AAAAAA;
}

.login-card .form-control {
    background: rgba(10,10,10,0.5);
    border: 1.5px solid rgba(255,255,255,0.12);
    color: #FFFFFF;
    padding: 0.75rem 1rem;
}

.login-card .form-control::placeholder {
    color: #666666;
}

.login-card .form-control:focus {
    background: rgba(10,10,10,0.7);
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(139,0,0,0.25);
}

.login-card .input-group-text {
    background: rgba(10,10,10,0.5);
    border-color: rgba(255,255,255,0.12);
    color: #888888;
}

.login-card .input-group .btn {
    background: rgba(10,10,10,0.5);
    border-color: rgba(255,255,255,0.12);
    color: #888888;
}

.login-card .input-group .btn:hover {
    border-color: var(--primary);
    color: var(--primary-light);
}

.login-card .btn-primary {
    padding: 0.8rem;
    font-size: 1rem;
    margin-top: 0.5rem;
    border-radius: var(--radius-md);
}

.login-link {
    color: var(--primary-light);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.85rem;
    transition: var(--transition);
}

.login-link:hover {
    color: var(--primary);
    text-decoration: underline;
}

.login-alert {
    background: rgba(255,95,86,0.12);
    border: 1px solid rgba(255,95,86,0.25);
    color: #FFB3AE;
    border-radius: var(--radius-sm);
    padding: 0.75rem 1rem;
    font-size: 0.85rem;
    margin-bottom: 1.5rem;
}

.login-alert-success {
    background: rgba(39,201,63,0.12);
    border: 1px solid rgba(39,201,63,0.25);
    color: #6EE7A0;
}

/* ==================== LIGHT MODE LOGIN ==================== */
[data-bs-theme="light"] .login-page {
    background: linear-gradient(135deg, #F5F5F5 0%, #FFFFFF 50%, #F5F5F5 100%);
}

[data-bs-theme="light"] .login-page::before {
    background: radial-gradient(circle, rgba(139,0,0,0.1) 0%, transparent 70%);
}

[data-bs-theme="light"] .login-page::after {
    background: radial-gradient(circle, rgba(160,0,0,0.07) 0%, transparent 70%);
}

[data-bs-theme="light"] .login-card {
    border: 1px solid var(--border);
    background: #FFFFFF !important;
    box-shadow: 0 25px 50px rgba(0,0,0,0.12);
}

[data-bs-theme="light"] .login-brand h2 {
    color: var(--text-main);
}

[data-bs-theme="light"] .login-subtitle {
    color: var(--text-secondary);
}

[data-bs-theme="light"] .login-card .form-label {
    color: var(--text-secondary);
}

[data-bs-theme="light"] .login-card .form-control {
    background: #FFFFFF;
    border: 1.5px solid var(--border);
    color: var(--text-main);
}

[data-bs-theme="light"] .login-card .form-control::placeholder {
    color: var(--text-muted);
}

[data-bs-theme="light"] .login-card .form-control:focus {
    background: #FFFFFF;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-bg);
}

[data-bs-theme="light"] .login-card .input-group-text {
    background: #F5F5F5;
    border-color: var(--border);
    color: var(--text-secondary);
}

[data-bs-theme="light"] .login-card .input-group .btn {
    background: #F5F5F5;
    border-color: var(--border);
    color: var(--text-secondary);
}

[data-bs-theme="light"] .login-card .input-group .btn:hover {
    border-color: var(--primary);
    color: var(--primary);
}

[data-bs-theme="light"] .login-alert {
    background: var(--danger-bg);
    border: 1px solid rgba(255,95,86,0.35);
    color: #C0392B;
}

[data-bs-theme="light"] .login-alert-success {
    background: var(--success-bg);
    border: 1px solid rgba(39,201,63,0.35);
    color: #1E9E33;
}

[data-bs-theme="light"] .theme-toggle-fab {
    border-color: var(--border);
    background: #FFFFFF;
    color: var(--text-secondary);
    box-shadow: var(--shadow-md);
}

[data-bs-theme="light"] .theme-toggle-fab:hover {
    background: var(--primary-bg);
    color: var(--primary);
    border-color: var(--primary);
    transform: rotate(20deg);
}

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

.page-title {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin: 0;
}

.page-title-icon {
    width: 40px;
    height: 40px;
    background: var(--primary-bg);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
    font-size: 1.1rem;
}

/* ==================== REPLY SELECT & EDITOR ==================== */
.reply-editor-section {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow-sm);
}

.reply-editor-section .form-select {
    font-size: 1rem;
    padding: 0.8rem 1rem;
    border-radius: var(--radius-md);
}

.reply-editor-section textarea {
    font-size: 0.95rem;
    line-height: 1.7;
    resize: vertical;
    min-height: 180px;
    border-radius: var(--radius-md);
}

.reply-editor-actions {
    display: flex;
    gap: 0.75rem;
    margin-top: 1rem;
}

/* ==================== FILTER BUTTONS ==================== */
.filter-buttons {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.btn-filter {
    border: 1.5px solid var(--border);
    color: var(--text-secondary);
    background: var(--bg-card);
    font-weight: 600;
    font-size: 0.88rem;
    padding: 0.5rem 1.1rem;
    border-radius: 100px;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

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

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

.month-picker {
    width: auto;
    border: 1.5px solid var(--border);
    border-radius: 100px;
    padding: 0.45rem 0.9rem;
    background: var(--bg-card);
    color: var(--text-main);
    font-weight: 600;
    font-size: 0.88rem;
    outline: none;
}
.month-picker:hover {
    border-color: var(--primary);
}
.month-title {
    font-size: 0.9rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

/* ==================== REPLY GRID ==================== */
.replies-section {
    margin-top: 1.5rem;
}

.replies-section-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
    letter-spacing: -0.01em;
}

.replies-section-title span {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-muted);
    background: var(--primary-bg);
    padding: 0.15rem 0.6rem;
    border-radius: 100px;
}

.replies-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.75rem;
    max-height: 55vh;
    overflow-y: auto;
    padding: 0.5rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-card);
}

.replies-grid::-webkit-scrollbar { width: 6px; }
.replies-grid::-webkit-scrollbar-track { background: transparent; }
.replies-grid::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
.replies-grid::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

@media (max-width: 1199.98px) {
    .replies-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 991.98px) {
    .replies-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 575.98px) {
    .replies-grid { grid-template-columns: 1fr; }
}

.reply-btn {
    background: var(--bg-card);
    border: 1.5px solid var(--border);
    color: var(--text-main);
    text-align: left;
    padding: 0.85rem 1rem;
    border-radius: var(--radius-sm);
    font-weight: 500;
    font-size: 0.88rem;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: var(--transition);
    cursor: pointer;
    position: relative;
}

.reply-btn::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    opacity: 0;
    transition: var(--transition);
    border-radius: inherit;
}

.reply-btn:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(139,0,0,0.25);
    color: #fff;
}

.reply-btn:hover::before {
    opacity: 1;
}

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

.reply-btn .reply-btn-icon {
    width: 28px;
    height: 28px;
    min-width: 28px;
    background: var(--primary-bg);
    border-radius: var(--radius-xs);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
    font-size: 0.8rem;
    transition: var(--transition);
}

.reply-btn:hover .reply-btn-icon {
    background: rgba(255,255,255,0.2);
    color: #fff;
}

.reply-btn .reply-btn-text {
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ==================== TABLE ==================== */
.table {
    margin-bottom: 0;
}

.table thead th {
    background: var(--border-light);
    border-bottom: 2px solid var(--border);
    font-weight: 700;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    padding: 0.85rem 1rem;
    white-space: nowrap;
}

.table tbody td {
    padding: 0.85rem 1rem;
    border-bottom: 1px solid var(--border-light);
    color: var(--text-secondary);
    font-size: 0.88rem;
    vertical-align: middle;
}

.table tbody tr {
    transition: var(--transition);
}

.table tbody tr:hover {
    background: var(--primary-bg);
}

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

.text-truncate-content {
    max-width: 220px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.id-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 28px;
    background: var(--primary-bg);
    color: var(--primary);
    font-weight: 700;
    font-size: 0.8rem;
    border-radius: var(--radius-xs);
    padding: 0 0.5rem;
}

.btn-toggle-task {
    border: 1px solid var(--border);
    color: var(--text-secondary);
    background: var(--bg-card);
    line-height: 1;
    padding: 0.25rem 0.35rem;
    border-radius: var(--radius-xs);
    font-size: 0.75rem;
    transition: var(--transition);
}
.btn-toggle-task:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-bg);
}

.task-detail-row td {
    background: var(--bg-card);
    border-bottom: none;
}
.task-detail-box {
    background: var(--bg-card-hover);
    border: 1px solid var(--border);
    border-left: 3px solid var(--primary);
    border-radius: var(--radius-xs);
    padding: 1rem 1.1rem;
    font-size: 0.86rem;
    color: var(--text-main);
}

.table-actions {
    display: flex;
    gap: 0.4rem;
    justify-content: center;
}

/* ==================== BADGES ==================== */
.badge {
    font-weight: 600;
    font-size: 0.75rem;
    padding: 0.35rem 0.65rem;
    border-radius: 100px;
    letter-spacing: 0.01em;
}

.badge.bg-danger { background: var(--danger-bg) !important; color: var(--danger) !important; }
.badge.bg-info { background: var(--info-bg) !important; color: var(--info) !important; }
.badge.bg-success { background: var(--success-bg) !important; color: var(--success) !important; }
.badge.bg-secondary { background: var(--border-light) !important; color: var(--text-muted) !important; }

/* ==================== MODALS ==================== */
.modal-content {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-xl);
    background: var(--bg-card);
}

.modal-header {
    border-bottom: 1px solid var(--border);
    padding: 1.25rem 1.5rem;
    border-radius: var(--radius) var(--radius) 0 0;
}

.modal-header.bg-primary,
.modal-header.bg-warning,
.modal-header.bg-danger {
    border-bottom: none;
}

.modal-header .modal-title {
    font-weight: 700;
    font-size: 1.05rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    border-top: 1px solid var(--border);
    padding: 1rem 1.5rem;
}

/* ==================== PAGINATION ==================== */
.pagination {
    gap: 0.35rem;
    margin-top: 1.25rem;
}

.page-link {
    border: 1px solid var(--border);
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.85rem;
    padding: 0.45rem 0.8rem;
    border-radius: var(--radius-xs);
    transition: var(--transition);
}

.page-link:hover {
    background: var(--primary-bg);
    border-color: var(--primary);
    color: var(--primary);
}

.page-item.active .page-link {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

.page-item.disabled .page-link {
    opacity: 0.4;
}

/* ==================== TOAST ==================== */
.toast-container {
    z-index: 9999;
}

.toast {
    border-radius: var(--radius-md) !important;
    border: none !important;
    box-shadow: var(--shadow-lg) !important;
    padding: 0.85rem 1.2rem;
    font-weight: 500;
    font-size: 0.88rem;
    backdrop-filter: blur(10px);
}

.toast .toast-body {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* ==================== ANIMATIONS ==================== */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

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

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.fade-in {
    animation: fadeIn 0.4s ease forwards;
}

.reply-btn:active {
    animation: pulse 0.3s ease;
}

/* ==================== SCROLLBAR ==================== */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--border-light); border-radius: 4px; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ==================== EMPTY STATE ==================== */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-muted);
}

.empty-state i {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.3;
}

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

/* ==================== SECTION CARD ==================== */
.section-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.section-card .section-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
}

.section-card .section-body {
    padding: 1.5rem;
}

/* ==================== RESPONSIVE ==================== */
@media (max-width: 767.98px) {
    .page-title { font-size: 1.2rem; }
    .page-title-icon { width: 36px; height: 36px; font-size: 1rem; }
    .login-card .card-body { padding: 2rem 1.5rem; }
    .reply-editor-section { padding: 1rem; }
    .reply-editor-actions { flex-direction: column; }
    .reply-editor-actions .btn { width: 100%; justify-content: center; }
}

/* ==================== FILE GALLERY ==================== */
.files-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 0.75rem;
    max-height: 40vh;
    overflow-y: auto;
    padding: 0.5rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-card);
}

.files-grid::-webkit-scrollbar { width: 6px; }
.files-grid::-webkit-scrollbar-track { background: transparent; }
.files-grid::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
.files-grid::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

.file-card {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    transition: var(--transition);
}

.file-card:hover {
    border-color: var(--primary);
    box-shadow: 0 2px 8px rgba(139,0,0,0.15);
}

.file-card-icon {
    width: 42px;
    height: 42px;
    min-width: 42px;
    border-radius: var(--radius-xs);
    background: var(--primary-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
    font-size: 1.15rem;
}

.file-card-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.file-card-name {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.file-card-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.file-card-actions {
    display: flex;
    gap: 0.3rem;
    flex-shrink: 0;
}

/* Upload Dropzone */
.upload-dropzone {
    border: 2px dashed var(--border);
    border-radius: var(--radius-md);
    padding: 2.5rem 1rem;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    background: var(--bg-card-hover);
}

.upload-dropzone.compact {
    padding: 0.8rem 1rem;
}

.upload-dropzone.compact i {
    font-size: 1.2rem;
    margin-bottom: 0;
    display: inline;
}

.upload-dropzone.compact p {
    display: inline;
    font-size: 0.8rem;
}

.upload-dropzone.compact small {
    display: none;
}

.upload-dropzone:hover,
.upload-dropzone.dragover {
    border-color: var(--primary);
    background: var(--primary-bg);
}

.upload-dropzone i {
    font-size: 2.5rem;
    color: var(--primary);
    opacity: 0.5;
    display: block;
    margin-bottom: 0.5rem;
}

.upload-dropzone p {
    margin: 0;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

@media (max-width: 575.98px) {
    .files-grid {
        grid-template-columns: 1fr;
    }
    .file-card {
        padding: 0.6rem 0.75rem;
    }
}

/* ==================== STUDIO MEDIA GALLERY ==================== */
.studio-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 0.75rem;
    max-height: 50vh;
    overflow-y: auto;
    padding: 0.5rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-card);
}

.studio-grid::-webkit-scrollbar { width: 6px; }
.studio-grid::-webkit-scrollbar-track { background: transparent; }
.studio-grid::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
.studio-grid::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

.studio-card {
    position: relative;
    border-radius: var(--radius-sm);
    overflow: hidden;
    border: 1.5px solid var(--border);
    background: var(--bg-card);
    cursor: pointer;
    transition: var(--transition);
    aspect-ratio: 16/10;
}

.studio-card:hover {
    border-color: var(--primary);
    box-shadow: 0 4px 16px rgba(139,0,0,0.2);
    transform: translateY(-2px);
}

.studio-card-media {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.studio-card-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(transparent, rgba(0,0,0,0.75));
    padding: 2rem 0.6rem 0.5rem;
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    opacity: 0;
    transition: var(--transition);
}

.studio-card:hover .studio-card-overlay {
    opacity: 1;
}

.studio-card-name {
    font-size: 0.78rem;
    font-weight: 600;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    min-width: 0;
}

.studio-card-meta {
    font-size: 0.7rem;
    color: rgba(255,255,255,0.7);
    white-space: nowrap;
}

.studio-card-badge {
    position: absolute;
    top: 0.4rem;
    right: 0.4rem;
    background: rgba(0,0,0,0.6);
    color: #fff;
    border-radius: 100px;
    padding: 0.15rem 0.45rem;
    font-size: 0.68rem;
    font-weight: 600;
    backdrop-filter: blur(4px);
}

.studio-card-badge i {
    margin-right: 0.2rem;
}

.studio-card-actions {
    position: absolute;
    top: 0.4rem;
    left: 0.4rem;
    display: flex;
    gap: 0.25rem;
    opacity: 0;
    transition: var(--transition);
}

.studio-card:hover .studio-card-actions {
    opacity: 1;
}

.studio-card-actions .btn {
    width: 28px;
    height: 28px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-size: 0.7rem;
    backdrop-filter: blur(4px);
}

@media (max-width: 575.98px) {
    .studio-grid {
        grid-template-columns: repeat(2, 1fr);
        max-height: 45vh;
    }
    .studio-card-overlay {
        opacity: 1;
    }
}

/* ==================== CHAT ROOM ==================== */
.chat-fab {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff;
    border: none;
    font-size: 1.3rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 1050;
    box-shadow: 0 4px 15px rgba(139,0,0,0.4);
    transition: var(--transition);
}

.online-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    font-weight: 600;
}

.online-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
}

.online-status.online .online-dot {
    background: #27C93F;
    box-shadow: 0 0 0 3px rgba(39,201,63,0.25);
    animation: dotPulse 2s infinite;
}

.online-status.offline .online-dot {
    background: #FF5F56;
}

.online-status.online {
    color: #27C93F;
}

.online-status.offline {
    color: #FF5F56;
}

@keyframes dotPulse {
    0%, 100% { box-shadow: 0 0 0 3px rgba(39,201,63,0.25); }
    50% { box-shadow: 0 0 0 6px rgba(39,201,63,0.1); }
}

.chat-online-dot {
    display: inline-block;
    width: 9px;
    height: 9px;
    border-radius: 50%;
    margin-left: 6px;
    vertical-align: middle;
    position: relative;
    top: -1px;
    flex-shrink: 0;
}

.chat-online-dot.online {
    background: #27C93F;
    box-shadow: 0 0 0 3px rgba(39,201,63,0.25);
    animation: dotPulse 2s infinite;
}

.chat-online-dot.offline {
    background: #FF5F56;
}

.chat-online-text {
    font-size: 0.65rem;
    font-weight: 600;
    margin-left: 4px;
    vertical-align: middle;
}

.chat-online-text.online {
    color: #27C93F;
}

.chat-online-text.offline {
    color: #FF5F56;
}

.chat-msg-read-receipt {
    display: inline-flex;
    align-items: center;
    margin-left: 5px;
    font-size: 0.8rem;
    vertical-align: middle;
}

.chat-msg-read-receipt .bi-check {
    color: rgba(255,255,255,0.45);
}

.chat-msg-read-receipt .bi-check-all {
    color: #53bdeb;
}

.chat-msg-own .chat-msg-read-receipt .bi-check {
    color: rgba(255,255,255,0.5);
}

.chat-msg-own .chat-msg-read-receipt .bi-check-all {
    color: #53bdeb;
}

.chat-reader-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.8rem;
    flex-shrink: 0;
}

.chat-fab:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 20px rgba(139,0,0,0.5);
}

.chat-fab-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 20px;
    height: 20px;
    border-radius: 10px;
    background: var(--danger);
    color: #fff;
    font-size: 0.65rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    border: 2px solid var(--bg-card);
    line-height: 1;
    animation: badgePop 0.3s ease;
}

@keyframes badgePop {
    0% { transform: scale(0); }
    60% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

.chat-panel {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    width: 380px;
    height: 560px;
    max-height: calc(100vh - 3rem);
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-xl);
    z-index: 1060;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: chatSlideUp 0.3s ease;
}

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

.chat-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.85rem 1rem;
    border-bottom: 1px solid var(--border);
    background: var(--bg-card);
    flex-shrink: 0;
}

.chat-panel-close {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: none;
    background: var(--border-light);
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 0.75rem;
    transition: var(--transition);
}

.chat-panel-close:hover {
    background: var(--danger-bg);
    color: var(--danger);
}

.chat-panel-clear {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: none;
    background: var(--border-light);
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 0.75rem;
    transition: var(--transition);
}

.chat-panel-clear:hover {
    background: var(--danger-bg);
    color: var(--danger);
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    background: var(--bg-body);
}

.chat-messages::-webkit-scrollbar { width: 5px; }
.chat-messages::-webkit-scrollbar-track { background: transparent; }
.chat-messages::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

.chat-loading {
    text-align: center;
    padding: 2rem;
    color: var(--text-muted);
    font-size: 0.85rem;
}

.chat-msg {
    max-width: 85%;
    animation: fadeIn 0.2s ease;
    display: flex;
    align-items: flex-end;
    gap: 0.4rem;
}

.chat-msg-own {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.chat-msg-other {
    align-self: flex-start;
    flex-direction: row;
}

.chat-msg-bubble {
    flex: 0 1 auto;
    min-width: 0;
    padding: 0.55rem 0.85rem;
    border-radius: var(--radius-md);
    font-size: 0.88rem;
    line-height: 1.45;
    word-break: break-word;
    position: relative;
}

.chat-msg-own .chat-msg-bubble {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff;
    border-bottom-right-radius: var(--radius-xs);
}

.chat-msg-other .chat-msg-bubble {
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-main);
    border-bottom-left-radius: var(--radius-xs);
}

.chat-msg-name {
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 0.15rem;
}

.chat-msg-other .chat-msg-name {
    color: var(--primary);
}

.chat-msg-own .chat-msg-name {
    color: rgba(255,255,255,0.7);
}

.chat-msg-time {
    font-size: 0.65rem;
    margin-top: 0.2rem;
    opacity: 0.6;
}

.chat-msg-own .chat-msg-time {
    color: #fff;
    text-align: right;
}

.chat-msg-other .chat-msg-time {
    color: var(--text-muted);
}

.chat-msg-img {
    max-width: 100%;
    border-radius: var(--radius-sm);
    cursor: pointer;
    margin-top: 0.3rem;
}

.chat-msg-file {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.45rem 0.7rem;
    background: rgba(255,255,255,0.1);
    border-radius: var(--radius-xs);
    margin-top: 0.3rem;
    text-decoration: none;
    color: inherit;
    font-size: 0.82rem;
}

.chat-msg-other .chat-msg-file {
    background: var(--primary-bg);
    color: var(--primary);
}

.chat-msg-file:hover {
    opacity: 0.85;
}

.chat-msg-deleted {
    font-style: italic;
    opacity: 0.6;
    font-size: 0.82rem;
    padding: 0.3rem 0;
}

.chat-msg-deleted i {
    margin-right: 0.3rem;
}

.chat-msg-deleted-wrap {
    align-self: center;
    max-width: 100%;
}

.chat-msg-deleted-wrap .chat-msg-bubble {
    background: transparent !important;
    border: none !important;
    padding: 0.35rem 0.75rem;
    text-align: center;
}

.chat-msg-deleted-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    font-size: 0.8rem;
    font-style: italic;
    opacity: 0.5;
    color: var(--text-muted);
    padding: 0.3rem 0;
}

.chat-msg-deleted-placeholder i {
    font-size: 0.75rem;
}

.chat-msg-deleted-time {
    font-size: 0.7rem;
    opacity: 0.6;
    margin-left: 0.3rem;
}

.chat-msg-actions {
    display: flex;
    gap: 0.25rem;
    margin-top: 0.3rem;
    justify-content: flex-end;
}

.chat-msg-action-btn {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 0.55rem;
    transition: var(--transition);
    background: rgba(0,0,0,0.1);
    color: inherit;
    padding: 0;
}

.chat-msg-own .chat-msg-action-btn {
    background: rgba(255,255,255,0.2);
    color: #fff;
}

.chat-msg-other .chat-msg-action-btn {
    background: var(--border-light);
    color: var(--text-muted);
}

.chat-msg-edit-btn:hover {
    background: rgba(255,255,255,0.35) !important;
}

.chat-msg-delete-btn:hover {
    background: var(--danger) !important;
    color: #fff !important;
}

.chat-msg-audio {
    width: 100%;
    margin-top: 0.3rem;
    border-radius: var(--radius-sm);
}

.chat-msg-video {
    max-width: 100%;
    max-height: 250px;
    border-radius: var(--radius-sm);
    margin-top: 0.3rem;
    background: #000;
}

.chat-audio-player {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin-top: 0.3rem;
    padding: 0.4rem 0.5rem;
    border-radius: var(--radius-sm);
    min-width: 180px;
}

.chat-msg-own .chat-audio-player {
    background: rgba(255,255,255,0.15);
}

.chat-msg-other .chat-audio-player {
    background: var(--primary-bg);
}

.chat-audio-play-btn {
    width: 28px;
    height: 28px;
    min-width: 28px;
    border-radius: 50%;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 0.85rem;
    transition: var(--transition);
}

.chat-msg-own .chat-audio-play-btn {
    background: rgba(255,255,255,0.3);
    color: #fff;
}

.chat-msg-other .chat-audio-play-btn {
    background: var(--primary);
    color: #fff;
}

.chat-audio-play-btn:hover {
    transform: scale(1.1);
}

.chat-audio-progress {
    flex: 1;
    height: 4px;
    border-radius: 2px;
    background: rgba(128,128,128,0.3);
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.chat-msg-own .chat-audio-progress {
    background: rgba(255,255,255,0.2);
}

.chat-audio-progress-fill {
    height: 100%;
    border-radius: 2px;
    width: 0%;
    transition: width 0.1s linear;
}

.chat-msg-own .chat-audio-progress-fill {
    background: #fff;
}

.chat-msg-other .chat-audio-progress-fill {
    background: var(--primary);
}

.chat-audio-time {
    font-size: 0.65rem;
    opacity: 0.7;
    min-width: 28px;
    text-align: right;
}

.chat-audio-el {
    position: absolute;
    width: 0;
    height: 0;
    opacity: 0;
    overflow: hidden;
    pointer-events: none;
}

.chat-edit-area {
    margin-top: 0.3rem;
}

.chat-edit-input {
    width: 100%;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-xs);
    padding: 0.35rem 0.5rem;
    font-size: 0.85rem;
    background: var(--bg-card);
    color: var(--text-main);
    resize: none;
    outline: none;
    font-family: inherit;
}

.chat-edit-input:focus {
    border-color: var(--primary);
}

.chat-edit-btns {
    display: flex;
    gap: 0.3rem;
    margin-top: 0.3rem;
    justify-content: flex-end;
}

.chat-edit-save,
.chat-edit-cancel {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 0.65rem;
    transition: var(--transition);
}

.chat-edit-save {
    background: var(--success);
    color: #fff;
}

.chat-edit-save:hover {
    background: #1E9E33;
}

.chat-edit-cancel {
    background: var(--border);
    color: var(--text-secondary);
}

.chat-edit-cancel:hover {
    background: var(--danger);
    color: #fff;
}

.chat-recording-bar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1rem;
    background: var(--danger-bg);
    border-top: 1px solid var(--border);
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--danger);
}

.recording-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--danger);
    animation: recordingPulse 1s infinite;
}

@keyframes recordingPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

.chat-input-area {
    border-top: 1px solid var(--border);
    padding: 0.5rem 0.75rem;
    background: var(--bg-card);
    flex-shrink: 0;
}

.chat-input-actions {
    display: flex;
    gap: 0.25rem;
    margin-bottom: 0.4rem;
}

.chat-action-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: var(--border-light);
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 0.85rem;
    transition: var(--transition);
}

.chat-action-btn:hover {
    background: var(--primary-bg);
    color: var(--primary);
}

.chat-action-btn.recording-active {
    background: var(--danger-bg);
    color: var(--danger);
    animation: recordingPulse 1s infinite;
}

.chat-input-row {
    display: flex;
    gap: 0.4rem;
    align-items: center;
}

.chat-text-input {
    flex: 1;
    border: 1.5px solid var(--border);
    border-radius: 100px;
    padding: 0.5rem 1rem;
    font-size: 0.88rem;
    background: var(--bg-card);
    color: var(--text-main);
    outline: none;
    transition: var(--transition);
}

.chat-text-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px var(--primary-bg);
}

.chat-send-btn {
    width: 36px;
    height: 36px;
    min-width: 36px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 0.85rem;
    transition: var(--transition);
}

.chat-send-btn:hover {
    transform: scale(1.05);
}

.chat-send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

@media (max-width: 767.98px) {
    .chat-panel {
        width: calc(100vw - 0.75rem);
        right: 0.375rem;
        bottom: 0.375rem;
        height: auto;
        max-height: calc(90vh - 0.75rem);
    }
    .chat-messages {
        max-height: calc(90vh - 12rem);
        min-height: 80px;
    }
}

@media (max-width: 575.98px) {
    .chat-panel {
        width: 100vw;
        right: 0;
        bottom: 0;
        left: 0;
        border-radius: 0;
        border: none;
        max-height: 90vh;
        z-index: 9999;
    }
}

/* ==================== CHAT REPLY PREVIEW BAR ==================== */
.chat-reply-preview {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 0.75rem;
    background: var(--primary-bg);
    border-top: 1px solid var(--border);
    border-left: 3px solid var(--primary);
    flex-shrink: 0;
}

.chat-reply-preview-content {
    flex: 1;
    display: flex;
    align-items: flex-start;
    gap: 0.4rem;
    min-width: 0;
    overflow: hidden;
}

.chat-reply-preview-arrow {
    color: var(--primary);
    font-size: 0.8rem;
    flex-shrink: 0;
    margin-top: 1px;
}

.chat-reply-preview-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
    overflow: hidden;
}

.chat-reply-preview-name {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--primary);
}

.chat-reply-preview-text {
    font-size: 0.75rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-reply-preview-close {
    width: 22px;
    height: 22px;
    min-width: 22px;
    border-radius: 50%;
    border: none;
    background: transparent;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 0.7rem;
    transition: var(--transition);
}

.chat-reply-preview-close:hover {
    background: var(--danger-bg);
    color: var(--danger);
}

/* ==================== CHAT REPLY BLOCK IN BUBBLE ==================== */
.chat-msg-reply-block {
    margin-bottom: 0.3rem;
}

.chat-msg-reply-bar {
    padding: 0.35rem 0.5rem;
    border-radius: var(--radius-xs);
    border-left: 3px solid var(--primary);
    margin-bottom: 0.25rem;
    cursor: default;
}

.chat-msg-own .chat-msg-reply-bar {
    background: rgba(255,255,255,0.12);
    border-left-color: rgba(255,255,255,0.5);
}

.chat-msg-other .chat-msg-reply-bar {
    background: var(--primary-bg);
    border-left-color: var(--primary);
}

.chat-msg-reply-info {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    min-width: 0;
}

.chat-msg-reply-name {
    font-size: 0.68rem;
    font-weight: 700;
}

.chat-msg-own .chat-msg-reply-name {
    color: rgba(255,255,255,0.8);
}

.chat-msg-other .chat-msg-reply-name {
    color: var(--primary);
}

.chat-msg-reply-text {
    font-size: 0.72rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-msg-own .chat-msg-reply-text {
    color: rgba(255,255,255,0.65);
}

.chat-msg-other .chat-msg-reply-text {
    color: var(--text-muted);
}

/* ==================== CHAT EMOJI / STICKER PICKER ==================== */
.chat-emoji-panel {
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--bg-card);
    box-shadow: 0 8px 24px rgba(0,0,0,0.18);
    margin: 0.25rem 0.5rem;
    padding: 0.4rem;
    max-height: 240px;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

.chat-emoji-panel.d-none {
    display: none !important;
}

.chat-emoji-tabs {
    display: flex;
    gap: 0.25rem;
    border-bottom: 1px solid var(--border);
    padding-bottom: 0.35rem;
    margin-bottom: 0.35rem;
    flex-shrink: 0;
}

.chat-emoji-tab {
    flex: 1;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.3rem 0.5rem;
    border-radius: var(--radius-xs);
    cursor: pointer;
    transition: var(--transition);
}

.chat-emoji-tab:hover {
    background: var(--primary-bg);
    color: var(--primary);
}

.chat-emoji-tab.active {
    background: var(--primary-bg);
    color: var(--primary);
}

.chat-emoji-grid {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 0.2rem;
    overflow-y: auto;
    padding: 0.15rem;
}

.chat-emoji-btn {
    border: none;
    background: transparent;
    border-radius: var(--radius-xs);
    font-size: 1.3rem;
    line-height: 1;
    padding: 0.3rem 0.1rem;
    cursor: pointer;
    transition: var(--transition);
}

.chat-emoji-btn:hover {
    background: var(--primary-bg);
    transform: scale(1.15);
}

.chat-sticker-grid {
    grid-template-columns: repeat(5, 1fr);
}

.chat-emoji-btn.chat-sticker-btn {
    font-size: 2.2rem;
    padding: 0.35rem 0.1rem;
}

/* ==================== CHAT MESSAGE REACTIONS ==================== */
.chat-msg-reactions {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.25rem;
    margin: 0;
    flex: 0 0 auto;
}

.chat-msg-own .chat-msg-reactions {
    align-items: flex-end;
}

.chat-react-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text-main);
    border-radius: 100px;
    padding: 0.05rem 0.45rem;
    font-size: 0.78rem;
    cursor: pointer;
    transition: var(--transition);
}

.chat-react-chip:hover {
    border-color: var(--primary);
}

.chat-react-chip.mine {
    background: var(--primary-bg);
    border-color: var(--primary);
    color: var(--primary);
}

.chat-react-emoji {
    font-size: 0.85rem;
    line-height: 1;
}

.chat-react-count {
    font-weight: 700;
    font-size: 0.7rem;
}

.chat-msg-react-btn:hover {
    background: rgba(255,255,255,0.35) !important;
    color: inherit;
}

.chat-msg-other .chat-msg-react-btn:hover {
    background: var(--primary-bg) !important;
    color: var(--primary);
}

.chat-msg-sticker {
    font-size: 3rem;
    line-height: 1.2;
    display: inline-block;
}

/* ==================== CHAT REACTION PICKER POPUP ==================== */
.chat-react-popup {
    position: fixed;
    z-index: 2000;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: 0 8px 24px rgba(0,0,0,0.2);
    padding: 0.5rem;
    min-width: 220px;
}

.chat-react-popup.d-none {
    display: none !important;
}

.chat-react-popup-title {
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--text-muted);
    margin-bottom: 0.35rem;
    text-align: center;
}

.chat-react-quick {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.25rem;
}

.chat-react-quick-btn {
    border: none;
    background: transparent;
    border-radius: var(--radius-xs);
    font-size: 1.5rem;
    line-height: 1;
    padding: 0.25rem 0.1rem;
    cursor: pointer;
    transition: var(--transition);
}

.chat-react-quick-btn:hover {
    background: var(--primary-bg);
    transform: scale(1.15);
}

/* ==================== TASKS ==================== */
.task-status {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.3rem 0.7rem;
    border-radius: 100px;
    font-size: 0.75rem;
    font-weight: 700;
    white-space: nowrap;
    line-height: 1.2;
}
.task-status .spinner {
    display: inline-block;
    width: 12px;
    height: 12px;
    border: 2px solid rgba(59,130,246,0.35);
    border-top-color: var(--info);
    border-radius: 50%;
    animation: taskSpin 0.8s linear infinite;
}
@keyframes taskSpin {
    to { transform: rotate(360deg); }
}
.task-status.open {
    background: var(--info-bg);
    color: var(--info);
}
.task-status.pending {
    background: rgba(245,158,11,0.15);
    color: #f59e0b;
}
.task-status.missing-information {
    background: var(--warning-bg);
    color: var(--warning);
}
.task-status.finish-awaiting-review {
    background: rgba(139,92,246,0.12);
    color: #8b5cf6;
}
.task-status.done {
    background: var(--success-bg);
    color: var(--success);
}
.task-status.closed {
    background: rgba(16,185,129,0.12);
    color: #10b981;
}
.task-status.delay {
    background: var(--danger-bg);
    color: var(--danger);
}
.task-status.resigned {
    background: #f3f4f6;
    color: #6b7280;
    border: 1px dashed #9ca3af;
}
.status-reason-box {
    font-size: 0.78rem;
    color: var(--warning);
    background: var(--warning-bg);
    border-left: 3px solid var(--warning);
    border-radius: var(--radius-xs);
    padding: 0.5rem 0.6rem;
    word-break: break-word;
}
.status-notes-box {
    font-size: 0.78rem;
    color: var(--text-muted);
    background: var(--border-light);
    border-left: 3px solid var(--text-muted);
    border-radius: var(--radius-xs);
    padding: 0.5rem 0.6rem;
    word-break: break-word;
}
.status-danger-box {
    font-size: 0.78rem;
    color: var(--danger);
    background: var(--danger-bg);
    border-left: 3px solid var(--danger);
    border-radius: var(--radius-xs);
    padding: 0.5rem 0.6rem;
    word-break: break-word;
}
.status-stakeholder-line {
    font-size: 0.78rem;
    color: var(--primary-light);
    background: var(--primary-bg);
    border-left: 3px solid var(--primary);
    border-radius: var(--radius-xs);
    padding: 0.5rem 0.6rem;
    word-break: break-word;
}
.deleted-note {
    font-size: 0.72rem;
    color: var(--danger);
    background: var(--danger-bg);
    border-left: 3px solid var(--danger);
    padding: 0.4rem 0.55rem;
    border-radius: var(--radius-xs);
    word-break: break-word;
}
.employee-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 0.9rem;
}
.employee-card {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    padding: 0.8rem 1rem;
    transition: var(--transition);
}
.employee-card:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow-sm);
}
.employee-card.user-filter-active {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px var(--primary);
}
.employee-avatar {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.95rem;
}
.employee-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
    flex: 1;
}
.employee-name {
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.employee-role-badge {
    display: inline-block;
    font-size: 0.6rem;
    font-weight: 700;
    padding: 0.1rem 0.4rem;
    border-radius: 100px;
    margin-left: 0.3rem;
    vertical-align: middle;
    text-transform: uppercase;
}
.employee-role-badge.role-admin {
    background: var(--primary-bg);
    color: var(--primary-light);
    border: 1px solid var(--primary);
}
.employee-role-badge.role-user {
    background: var(--info-bg);
    color: var(--info);
    border: 1px solid var(--info);
}
.employee-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
}
.my-task-card {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    padding: 1rem 1.1rem;
    height: 100%;
    display: flex;
    flex-direction: column;
    gap: 0.7rem;
    transition: var(--transition);
}
.my-task-card:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow-md);
}
.my-task-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}
.my-task-id {
    font-size: 0.72rem;
    color: var(--text-muted);
    font-weight: 700;
}
.my-task-details {
    margin: 0;
    font-size: 0.9rem;
    color: var(--text-main);
    white-space: pre-wrap;
    word-break: break-word;
    flex: 1;
}
.my-task-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 0.3rem;
    word-break: break-word;
}
.my-task-meta {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    font-size: 0.78rem;
    color: var(--text-secondary);
}
.my-task-actions {
    display: flex;
    gap: 0.5rem;
}
.my-task-actions .btn {
    flex: 1;
    border-radius: 100px;
}
.my-task-completed {
    font-size: 0.78rem;
    color: var(--success);
    background: var(--success-bg);
    border-radius: var(--radius-xs);
    padding: 0.45rem 0.6rem;
    text-align: center;
    font-weight: 600;
}

/* ==================== CHAT CAPTION ==================== */
.chat-msg-caption {
    font-size: 0.85rem;
    margin-top: 0.25rem;
    line-height: 1.4;
    word-break: break-word;
}

/* ==================== RTL SUPPORT ==================== */
[dir="rtl"] body {
    font-family: 'Cairo', system-ui, -apple-system, sans-serif;
}

[dir="rtl"] .theme-toggle-fab {
    right: auto;
    left: 1rem;
}

/* Chat FAB stays pinned to the RIGHT edge in both LTR and RTL */
[dir="rtl"] .chat-fab {
    right: 1.5rem;
    left: auto;
}

[dir="rtl"] .chat-panel {
    right: 1.5rem;
    left: auto;
}

@media (max-width: 767.98px) {
    [dir="rtl"] .chat-panel {
        right: 0.375rem;
        left: auto;
    }
}

@media (max-width: 575.98px) {
    [dir="rtl"] .chat-panel {
        right: 0;
        left: auto;
    }
}

[dir="rtl"] .toast-container {
    right: auto !important;
    left: 0;
}

[dir="rtl"] .dropdown-menu-end {
    right: auto;
    left: 0;
}

[dir="rtl"] .studio-card-badge {
    right: auto;
    left: 0.4rem;
}

[dir="rtl"] .studio-card-actions {
    left: auto;
    right: 0.4rem;
}

[dir="rtl"] .chat-msg-own .chat-msg-bubble {
    border-bottom-right-radius: var(--radius-xs);
    border-bottom-left-radius: 0;
}

[dir="rtl"] .chat-msg-other .chat-msg-bubble {
    border-bottom-left-radius: var(--radius-xs);
    border-bottom-right-radius: 0;
}

[dir="rtl"] .chat-msg-own .chat-msg-time {
    text-align: left;
}

[dir="rtl"] .deleted-note,
[dir="rtl"] .status-reason-box,
[dir="rtl"] .status-danger-box,
[dir="rtl"] .status-notes-box,
[dir="rtl"] .status-stakeholder-line {
    border-left: none;
    border-right: 3px solid var(--primary);
}

[dir="rtl"] .status-reason-box {
    border-right-color: var(--warning);
}

[dir="rtl"] .status-notes-box {
    border-right-color: var(--text-muted);
}

[dir="rtl"] .status-danger-box,
[dir="rtl"] .deleted-note {
    border-right-color: var(--danger);
}

[dir="rtl"] .status-stakeholder-line {
    border-right-color: var(--primary);
}

[dir="rtl"] .bi-chevron-right,
[dir="rtl"] .bi-chevron-left {
    transform: scaleX(-1);
}

[dir="rtl"] .text-start {
    text-align: right !important;
}

[dir="rtl"] .text-end {
    text-align: left !important;
}

/* ==================== SETTINGS: THEME MODE & BRANDING ==================== */
.theme-mode-option {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-weight: 600;
    color: var(--text-secondary);
    transition: var(--transition);
    user-select: none;
}

.theme-mode-option input {
    display: none;
}

.theme-mode-option:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.theme-mode-option.theme-option-active {
    background: var(--primary-bg);
    border-color: var(--primary);
    color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
}

.theme-field-active .form-label {
    color: var(--primary);
    font-weight: 700;
}

.brand-preview-swatch {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.82rem;
    font-weight: 600;
}

.brand-preview-swatch.light {
    background: #F5F5F5;
    color: #1A1A1A;
}

.brand-preview-swatch.dark {
    background: #0A0A0A;
    color: #FFFFFF;
}

.brand-preview-swatch .swatch-dot {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    margin-left: auto;
    border: 1px solid rgba(0, 0, 0, 0.15);
    flex-shrink: 0;
}

.branding-preview {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-card-hover);
    border: 1px dashed var(--border);
    border-radius: var(--radius-sm);
    padding: 0.75rem;
    min-height: 72px;
}

/* ---------- Task Logs timeline ---------- */
.logs-task-header {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.75rem 1rem;
    background: var(--card-bg);
}
.logs-timeline {
    position: relative;
    padding-left: 1.25rem;
}
.logs-timeline::before {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0.4rem;
    width: 2px;
    background: var(--border);
}
.logs-item {
    position: relative;
    padding: 0 0 1rem 0.5rem;
}
.logs-item:last-child {
    padding-bottom: 0;
}
.logs-dot {
    position: absolute;
    left: -1.15rem;
    top: 0.15rem;
    width: 1.5rem;
    height: 1.5rem;
    border-radius: 50%;
    background: var(--primary-bg);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    border: 1px solid var(--primary);
    z-index: 1;
}
.logs-body {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.6rem 0.8rem;
    background: var(--card-bg);
}
.logs-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    flex-wrap: wrap;
}
.logs-action {
    font-weight: 700;
    font-size: 0.82rem;
    color: var(--text-main);
}
.logs-time {
    font-size: 0.72rem;
    color: var(--text-muted);
}
.logs-user {
    font-size: 0.78rem;
    color: var(--text-secondary);
    margin-top: 0.2rem;
}
.logs-status {
    margin-top: 0.4rem;
    display: flex;
    align-items: center;
}
.logs-badge {
    font-size: 0.72rem;
    font-weight: 600;
    padding: 0.2rem 0.5rem;
    border-radius: var(--radius-xs);
    background: var(--danger-bg);
    color: var(--text-secondary);
    border: 1px solid var(--border);
}
.logs-badge-new {
    background: var(--success-bg, rgba(34,197,94,0.12));
    color: var(--success, #22c55e);
    border-color: var(--success, #22c55e);
}
.logs-content {
    margin-top: 0.4rem;
    font-size: 0.85rem;
    color: var(--text-main);
    background: var(--bg);
    border: 1px dashed var(--border);
    border-radius: var(--radius-xs);
    padding: 0.45rem 0.6rem;
}

/* ---------- Sticky Notes ---------- */
.sticky-launcher {
    position: fixed;
    bottom: 18px;
    left: 18px;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: none;
    background: var(--primary);
    color: #fff;
    font-size: 1.15rem;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-md);
    z-index: 2080;
    cursor: pointer;
    transition: var(--transition);
}
.sticky-launcher:hover {
    background: var(--primary-light);
    transform: translateY(-2px);
}
.sticky-launcher-count {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 18px;
    height: 18px;
    padding: 0 4px;
    border-radius: 9px;
    background: var(--danger);
    color: #fff;
    font-size: 0.65rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1;
}
.sticky-panel {
    position: fixed;
    bottom: 76px;
    left: 18px;
    width: 300px;
    max-width: calc(100vw - 32px);
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    z-index: 2079;
    overflow: hidden;
    animation: stickyPanelIn 0.18s ease-out;
}
@keyframes stickyPanelIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}
.sticky-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.65rem 0.85rem;
    background: var(--primary-bg);
    border-bottom: 1px solid var(--border);
}
.sticky-panel-title {
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--text-main);
}
.sticky-panel-btn {
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text-secondary);
    border-radius: var(--radius-xs);
    padding: 0.2rem 0.6rem;
    font-size: 0.72rem;
    cursor: pointer;
    transition: var(--transition);
}
.sticky-panel-btn:hover {
    background: var(--danger-bg);
    color: var(--danger);
    border-color: var(--danger);
}
.sticky-panel-body {
    max-height: 320px;
    overflow-y: auto;
}
.sticky-panel-footer {
    padding: 0.6rem;
    border-top: 1px solid var(--border);
}
.sticky-list-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.55rem 0.7rem;
    border-bottom: 1px solid var(--border-light);
}
.sticky-list-item:last-child {
    border-bottom: none;
}
.sticky-dot {
    width: 10px;
    height: 10px;
    border-radius: 3px;
    flex: 0 0 auto;
    box-shadow: inset 0 0 0 1px rgba(0,0,0,0.15);
}
.sticky-dot.sticky-yellow { background: #FDD835; }
.sticky-dot.sticky-pink { background: #F06292; }
.sticky-dot.sticky-green { background: #66BB6A; }
.sticky-dot.sticky-blue { background: #64B5F6; }
.sticky-list-preview {
    flex: 1 1 auto;
    font-size: 0.78rem;
    color: var(--text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.sticky-list-actions {
    display: flex;
    gap: 0.15rem;
    flex: 0 0 auto;
}
.sticky-note {
    position: fixed;
    width: 260px;
    max-width: calc(100vw - 32px);
    min-height: 190px;
    border-radius: 8px;
    border: 1px solid;
    box-shadow: 0 12px 24px -8px rgba(0,0,0,0.35);
    display: flex;
    flex-direction: column;
    z-index: 2000;
    transform: rotate(-1deg);
    transition: box-shadow 0.2s;
}
.sticky-note.sticky-yellow { background: #FDF3B8; border-color: #E9D87C; }
.sticky-note.sticky-yellow .sticky-note-head { background: rgba(180,150,20,0.16); color: #6B5B00; }
.sticky-note.sticky-pink { background: #FFDCE9; border-color: #F5B6CC; }
.sticky-note.sticky-pink .sticky-note-head { background: rgba(200,60,120,0.14); color: #8B2A55; }
.sticky-note.sticky-green { background: #D9F2DE; border-color: #B2DDBB; }
.sticky-note.sticky-green .sticky-note-head { background: rgba(40,140,60,0.14); color: #1F6B33; }
.sticky-note.sticky-blue { background: #DBE8FF; border-color: #B6CDF5; }
.sticky-note.sticky-blue .sticky-note-head { background: rgba(40,90,200,0.14); color: #284B9B; }
.sticky-note-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.4rem 0.6rem;
    border-radius: 8px 8px 0 0;
    cursor: grab;
    user-select: none;
    font-size: 0.75rem;
    font-weight: 700;
}
.sticky-note-head:active { cursor: grabbing; }
.sticky-note-btns { display: flex; gap: 0.15rem; }
.sticky-note-btn {
    border: none;
    background: transparent;
    width: 24px;
    height: 24px;
    border-radius: 6px;
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
    color: inherit;
    opacity: 0.75;
}
.sticky-note-btn:hover {
    opacity: 1;
    background: rgba(0,0,0,0.12);
}
.sticky-note-text {
    flex: 1 1 auto;
    border: none;
    resize: none;
    background: transparent;
    padding: 0.6rem 0.7rem;
    font-size: 0.85rem;
    line-height: 1.5;
    outline: none;
    font-family: inherit;
    min-height: 130px;
    color: #2B2B2B;
}
.sticky-note-text::placeholder { color: rgba(43,43,43,0.5); }
.sticky-note.sticky-dragging {
    box-shadow: 0 24px 40px -8px rgba(0,0,0,0.45);
    cursor: grabbing;
    transform: none;
}
.sticky-open { animation: stickyDrop 0.25s ease-out; }
.sticky-closing { animation: stickyPop 0.18s ease-in forwards; }
@keyframes stickyDrop {
    0% { opacity: 0; transform: scale(0.6) rotate(-4deg) translateY(-20px); }
    60% { transform: scale(1.06) rotate(1deg); }
    100% { opacity: 1; transform: scale(1) rotate(-1deg); }
}
@keyframes stickyPop {
    to { opacity: 0; transform: scale(0.5) rotate(6deg); }
}
[data-bs-theme="dark"] .sticky-note.sticky-yellow { background: #3B3420; border-color: #5C542F; }
[data-bs-theme="dark"] .sticky-note.sticky-yellow .sticky-note-head { background: rgba(255,220,120,0.12); color: #E8D48A; }
[data-bs-theme="dark"] .sticky-note.sticky-pink { background: #3A2330; border-color: #5C3550; }
[data-bs-theme="dark"] .sticky-note.sticky-pink .sticky-note-head { background: rgba(240,98,146,0.14); color: #F2A9C4; }
[data-bs-theme="dark"] .sticky-note.sticky-green { background: #1F3323; border-color: #335C3D; }
[data-bs-theme="dark"] .sticky-note.sticky-green .sticky-note-head { background: rgba(102,187,106,0.14); color: #9EDBA6; }
[data-bs-theme="dark"] .sticky-note.sticky-blue { background: #1F2B3A; border-color: #33475C; }
[data-bs-theme="dark"] .sticky-note.sticky-blue .sticky-note-head { background: rgba(100,181,246,0.14); color: #A6CCF2; }
[data-bs-theme="dark"] .sticky-note .sticky-note-text { color: #E9E9E9; }
[data-bs-theme="dark"] .sticky-note .sticky-note-text::placeholder { color: rgba(233,233,233,0.45); }

/* ============================================================
   Work Team / KPI / Visits components
   ============================================================ */

.min-width-0 { min-width: 0; }

/* Flash messages */
.flash-messages {
    position: fixed;
    top: 76px;
    inset-inline-end: 18px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 360px;
}
.flash-messages .alert {
    box-shadow: var(--shadow-md);
    border-radius: var(--radius-md);
}

/* Team stat cards */
.team-stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    padding: 16px 18px;
    box-shadow: var(--shadow-xs);
    display: flex;
    align-items: center;
    gap: 14px;
}
.team-stat-card i {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-sm);
    background: var(--primary-bg);
    color: var(--primary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    flex-shrink: 0;
}
.team-stat-card .stat-value {
    font-size: 1.3rem;
    font-weight: 800;
    line-height: 1.1;
    color: var(--text-main);
}
.team-stat-card .stat-label {
    font-size: 0.82rem;
    color: var(--text-muted);
    font-weight: 600;
}

/* KPI ring */
.kpi-ring {
    --pct: 0;
    --ring-color: var(--primary);
    width: 92px;
    height: 92px;
    border-radius: 50%;
    background:
        radial-gradient(closest-side, var(--bg-card) 79%, transparent 80% 100%),
        conic-gradient(var(--ring-color) calc(var(--pct) * 1%), rgba(128,128,128,0.15) 0);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    color: var(--text-main);
    flex-shrink: 0;
}
.kpi-ring span { font-size: 1.05rem; }
.kpi-ring-lg {
    width: 150px;
    height: 150px;
}
.kpi-ring-lg span { font-size: 1.7rem; }

.kpi-current-row {
    background: var(--primary-bg) !important;
}

/* Employee profile hero */
.profile-hero-card {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

/* CV / certificate file items */
.empfile-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    background: var(--bg-card-hover);
    transition: var(--transition);
}
.empfile-item:hover {
    border-color: var(--border);
    box-shadow: var(--shadow-xs);
}
.empfile-item > i {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-xs);
    background: var(--primary-bg);
    color: var(--primary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.15rem;
    flex-shrink: 0;
}
.empfile-name {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-main);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* KPI hero cards (my_kpi.php) */
.kpi-hero-card {
    border-top: 4px solid var(--primary);
}
.target-hero-card {
    border-top: 4px solid var(--success);
}
.target-big-number {
    font-size: clamp(2.2rem, 5vw, 3.4rem);
    font-weight: 800;
    line-height: 1;
    color: var(--text-main);
}
.target-big-number small {
    font-size: 0.45em;
    color: var(--text-muted);
    font-weight: 600;
}

.tier-mini {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 700;
    border: 1px solid var(--border-light);
    background: var(--bg-card-hover);
    color: var(--text-secondary);
}
.tier-mini::before {
    content: "";
    width: 9px;
    height: 9px;
    border-radius: 50%;
}
.tier-mini.tier-primary::before   { background: var(--info); }
.tier-mini.tier-success::before   { background: var(--success); }
.tier-mini.tier-warning::before   { background: var(--warning); }
.tier-mini.tier-info::before      { background: #a855f7; }
.tier-mini.is-active {
    border-color: currentColor;
}

/* Visits page */
.visit-mini-stat {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    padding: 12px 14px;
    text-align: center;
    box-shadow: var(--shadow-xs);
}
.visit-mini-stat .vms-value {
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--text-main);
    line-height: 1.2;
}
.visit-mini-stat .vms-label {
    font-size: 0.78rem;
    color: var(--text-muted);
    font-weight: 600;
}
.visit-info-list {
    margin: 0;
    padding: 0;
}
.visit-info-list li {
    list-style: none;
    padding: 7px 0;
    border-bottom: 1px dashed var(--border-light);
    font-size: 0.9rem;
    display: flex;
    align-items: baseline;
    gap: 8px;
}
.visit-info-list li:last-child { border-bottom: 0; }
.visit-info-list i {
    color: var(--primary);
    flex-shrink: 0;
    transform: translateY(2px);
}
.upload-inline-form {
    display: flex;
    gap: 8px;
}
.upload-inline-form input[type="file"] {
    font-size: 0.85rem;
}
