/* ========================================================
   مرصاد - Comprehensive Style Sheet
   Typography: Thmanyah Sans
   Layout: Structured Sidebar Sections & 4-Column Desktop Stat Grid
   ======================================================== */

/* --------------------------------------------------------
   1. Font Definitions (Thmanyah Sans)
   -------------------------------------------------------- */
@font-face {
    font-family: 'Thmanyah Sans';
    src: url('../../fonts/thmanyah typeface/thmanyahsans/woff2/thmanyahsans-Light.woff2') format('woff2');
    font-weight: 300;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Thmanyah Sans';
    src: url('../../fonts/thmanyah typeface/thmanyahsans/woff2/thmanyahsans-Regular.woff2') format('woff2');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Thmanyah Sans';
    src: url('../../fonts/thmanyah typeface/thmanyahsans/woff2/thmanyahsans-Medium.woff2') format('woff2');
    font-weight: 500;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Thmanyah Sans';
    src: url('../../fonts/thmanyah typeface/thmanyahsans/woff2/thmanyahsans-Bold.woff2') format('woff2');
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Thmanyah Sans';
    src: url('../../fonts/thmanyah typeface/thmanyahsans/woff2/thmanyahsans-Black.woff2') format('woff2');
    font-weight: 900;
    font-style: normal;
    font-display: swap;
}

/* --------------------------------------------------------
   2. Design Tokens & Variables (High-Contrast Light Theme)
   -------------------------------------------------------- */
:root {
    --font-primary: 'Thmanyah Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    
    /* Light Mode Color Palette */
    --bg-dark: #f1f5f9;       /* Slate 100 background */
    --bg-surface: #ffffff;    /* Pure White surface */
    --bg-card: #ffffff;
    --bg-card-hover: #f8fafc;
    --bg-input: #ffffff;
    
    --border-color: #e2e8f0;   /* Slate 200 */
    --border-hover: #cbd5e1;   /* Slate 300 */
    
    --primary: #4f46e5;       /* Indigo 600 */
    --primary-hover: #4338ca; /* Indigo 700 */
    --primary-glow: rgba(79, 70, 229, 0.15);
    
    --danger-red: #dc2626;    /* Red 600 */
    --danger-glow: rgba(220, 38, 38, 0.15);
    
    /* High Contrast Text Definitions */
    --text-main: #0f172a;     /* Deep Slate 900 */
    --text-body: #1e293b;     /* Slate 800 */
    --text-muted: #475569;    /* Slate 600 */
    --text-dim: #64748b;      /* Slate 500 */
    
    /* Status Colors */
    --status-valid-bg: #dcfce7;
    --status-valid-text: #15803d;
    --status-valid-border: #86efac;
    
    --status-soon-bg: #fef3c7;
    --status-soon-text: #b45309;
    --status-soon-border: #fcd34d;
    
    --status-today-bg: #ffedd5;
    --status-today-text: #c2410c;
    --status-today-border: #fdba74;
    
    --status-expired-bg: #fee2e2;
    --status-expired-text: #b91c1c;
    --status-expired-border: #fca5a5;

    /* Dimensions */
    --sidebar-width: 270px;
    --navbar-height: 70px;
    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 18px;
    --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    
    /* Shadows */
    --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(15, 23, 42, 0.06), 0 2px 4px -2px rgba(15, 23, 42, 0.04);
    --shadow-lg: 0 10px 25px -5px rgba(15, 23, 42, 0.08), 0 8px 10px -6px rgba(15, 23, 42, 0.04);
}

/* --------------------------------------------------------
   3. Global Reset & Base Styles
   -------------------------------------------------------- */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    height: 100%;
    direction: rtl;
    text-align: right;
    font-family: var(--font-primary);
    background-color: var(--bg-dark);
    color: var(--text-body);
    overflow-x: hidden;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

a {
    color: inherit;
    text-decoration: none;
}

button, input, select, textarea {
    font-family: inherit;
    font-size: inherit;
    color: inherit;
}

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: var(--bg-dark);
}
::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* --------------------------------------------------------
   4. App Layout Wrapper
   -------------------------------------------------------- */
.app-wrapper {
    display: flex;
    min-height: 100vh;
    width: 100%;
}

.main-content {
    flex: 1;
    margin-right: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    min-width: 0;
    transition: var(--transition);
}

.content-container {
    padding: 2rem;
    flex: 1;
}

/* --------------------------------------------------------
   5. Sidebar Navigation (Structured Section Titles)
   -------------------------------------------------------- */
.sidebar {
    width: var(--sidebar-width);
    height: 100vh;
    position: fixed;
    top: 0;
    right: 0;
    background-color: var(--bg-surface);
    border-left: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    z-index: 100;
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
}

.sidebar-header {
    height: var(--navbar-height);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 1rem;
    border-bottom: 1px solid var(--border-color);
}

.brand-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    text-align: center;
    font-size: 1.75rem;
    font-weight: 900;
    letter-spacing: -0.5px;
    color: var(--text-main);
    white-space: nowrap;
}

.sidebar-menu {
    flex: 1;
    padding: 1.25rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    overflow-y: auto;
}

/* Section Titles / Category Headers */
.sidebar-section-title {
    font-size: 0.74rem;
    font-weight: 800;
    color: #64748b;
    letter-spacing: 0.5px;
    padding: 0.5rem 0.8rem 0.2rem;
    user-select: none;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    padding: 0.85rem 1.1rem;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.95rem;
    transition: var(--transition);
    white-space: nowrap;
}

.nav-item svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    transition: var(--transition);
}

.nav-item:hover {
    background-color: #f1f5f9;
    color: var(--text-main);
}

.nav-item.active {
    background: #eef2ff;
    color: var(--primary);
    border-right: 3.5px solid var(--primary);
    font-weight: 700;
}

.nav-item.active svg {
    color: var(--primary);
}

.nav-item.logout-btn {
    margin-top: auto;
    color: #dc2626;
    border-top: 1px solid var(--border-color);
    border-radius: 0;
    padding-top: 1.2rem;
}

.nav-item.logout-btn:hover {
    background-color: #fef2f2;
    color: #b91c1c;
}

/* Mobile Sidebar Overlay */
.sidebar-overlay {
    position: fixed;
    inset: 0;
    background-color: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(4px);
    z-index: 99;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
}

/* --------------------------------------------------------
   6. Top Navbar & Square Profile Card
   -------------------------------------------------------- */
.navbar {
    height: var(--navbar-height);
    background-color: var(--bg-surface);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    position: sticky;
    top: 0;
    z-index: 90;
    box-shadow: var(--shadow-sm);
}

.navbar-right {
    display: flex;
    align-items: center;
    gap: 1rem;
    min-width: 0;
}

.menu-toggle-btn {
    display: none;
    background: none;
    border: none;
    color: var(--text-main);
    cursor: pointer;
    padding: 0.4rem;
    border-radius: var(--radius-sm);
    flex-shrink: 0;
}

.page-title-box {
    min-width: 0;
}

.page-title-box h1 {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.page-title-box p {
    font-size: 0.82rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Modern Square/Rectangular User Profile Box */
.user-profile {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: #ffffff;
    padding: 0.45rem 0.85rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    white-space: nowrap;
}

.avatar {
    width: 34px;
    height: 34px;
    border-radius: 6px;
    background: linear-gradient(135deg, #4f46e5 0%, #6366f1 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    color: white;
    font-size: 0.9rem;
    flex-shrink: 0;
    box-shadow: 0 2px 6px rgba(79, 70, 229, 0.25);
}

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

.user-name {
    font-size: 0.88rem;
    font-weight: 800;
    line-height: 1.2;
    color: var(--text-main);
    letter-spacing: -0.2px;
}

/* Digital Clock Badge inside Profile Card */
.user-clock {
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--primary);
    background-color: #eef2ff;
    padding: 0.1rem 0.5rem;
    border-radius: 4px;
    border: 1px solid #c7d2fe;
    display: inline-block;
    direction: ltr;
    letter-spacing: 0.5px;
    font-family: var(--font-primary);
}

/* --------------------------------------------------------
   7. Login Page & Multi-Stage Post-Login Animation Engine
   -------------------------------------------------------- */
.login-body {
    background: linear-gradient(135deg, #e2e8f0 0%, #cbd5e1 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 1.5rem;
}

.login-card {
    width: 100%;
    max-width: 440px;
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 2.5rem 2rem;
    box-shadow: 0 20px 40px rgba(15, 23, 42, 0.1);
    animation: fadeInUp 0.5s ease-out;
}

.login-header {
    text-align: center;
    margin-bottom: 2rem;
}

.login-header h2 {
    font-size: 1.85rem;
    font-weight: 900;
    color: var(--text-main);
    margin-bottom: 0.3rem;
    letter-spacing: -0.5px;
}

.login-header p {
    color: var(--text-muted);
    font-size: 0.95rem;
    font-weight: 500;
}

/* Multi-Stage Login Animation Containers */
.login-stage {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: all 0.35s ease-in-out;
}

.login-stage.active {
    display: flex;
    animation: fadeIn 0.4s ease-out forwards;
}

/* Stage 1: Loading Spinner Ring */
.spinner-ring {
    width: 68px;
    height: 68px;
    border: 4px solid #e0e7ff;
    border-top-color: #4f46e5;
    border-radius: 50%;
    margin-bottom: 1.2rem;
    animation: spin 0.75s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Stage 2: Green Checkmark Animation */
.checkmark-circle {
    width: 76px;
    height: 76px;
    margin: 0 auto 1.25rem;
    border-radius: 50%;
    background: #dcfce7;
    border: 2px solid #86efac;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: scaleUp 0.45s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

.checkmark-icon {
    width: 42px;
    height: 42px;
    stroke: #16a34a;
    stroke-width: 3.2;
    stroke-linecap: round;
    stroke-linejoin: round;
    fill: none;
    stroke-dasharray: 50;
    stroke-dashoffset: 50;
    animation: drawCheck 0.65s 0.15s ease-in-out forwards;
}

@keyframes scaleUp {
    0% { transform: scale(0.4); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

@keyframes drawCheck {
    to { stroke-dashoffset: 0; }
}

/* Stage 3: Welcome Card Alone */
.welcome-card-alone {
    text-align: center;
    padding: 0.5rem 0;
}

.welcome-greeting-title {
    font-size: 1.65rem;
    font-weight: 900;
    color: var(--text-main);
    margin-bottom: 0.4rem;
    letter-spacing: -0.3px;
}

.welcome-greeting-sub {
    font-size: 0.95rem;
    color: var(--text-muted);
    font-weight: 600;
}

/* Form Controls & Password Toggler */
.form-group {
    margin-bottom: 1.3rem;
}

.form-label {
    display: block;
    font-size: 0.88rem;
    font-weight: 700;
    margin-bottom: 0.4rem;
    color: var(--text-main);
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.input-icon {
    position: absolute;
    right: 1rem;
    color: var(--text-dim);
    pointer-events: none;
}

.input-icon svg {
    width: 18px;
    height: 18px;
}

.form-control {
    width: 100%;
    background-color: var(--bg-input);
    border: 1px solid #cbd5e1;
    border-radius: var(--radius-sm);
    padding: 0.8rem 2.8rem 0.8rem 1rem;
    color: var(--text-main);
    font-size: 0.95rem;
    font-weight: 500;
    transition: var(--transition);
}

.form-control::placeholder {
    color: var(--text-dim);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
    background-color: #ffffff;
}

.password-toggle-btn {
    position: absolute;
    left: 0.8rem;
    background: none;
    border: none;
    color: var(--text-dim);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.3rem;
    border-radius: 4px;
    transition: var(--transition);
}

.password-toggle-btn:hover {
    color: var(--text-main);
    background: #f1f5f9;
}

.password-toggle-btn svg {
    width: 18px;
    height: 18px;
}

.btn-primary {
    width: 100%;
    background: linear-gradient(135deg, #4f46e5 0%, #4338ca 100%);
    color: #ffffff;
    border: none;
    border-radius: var(--radius-sm);
    padding: 0.85rem;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: 0 4px 15px var(--primary-glow);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #4338ca 0%, #3730a3 100%);
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(79, 70, 229, 0.3);
}

.btn-primary:active {
    transform: translateY(0);
}

/* --------------------------------------------------------
   8. Ultra Professional Dashboard Stat Cards (4 Columns on Desktop)
   -------------------------------------------------------- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.25rem;
    margin-bottom: 2rem;
}

@media (max-width: 1200px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

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

.stat-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: var(--radius-md);
    padding: 1.5rem 1.4rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.05);
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    left: 0;
    height: 4px;
    background: var(--card-accent, var(--primary));
    border-top-right-radius: var(--radius-md);
    border-top-left-radius: var(--radius-md);
}

.stat-card:hover {
    border-color: #cbd5e1;
    transform: translateY(-4px);
    box-shadow: 0 12px 24px -6px rgba(15, 23, 42, 0.08);
}

.stat-info h3 {
    font-size: 0.85rem;
    color: #475569;
    font-weight: 700;
    margin-bottom: 0.4rem;
    white-space: nowrap;
}

.stat-number {
    font-size: 2.1rem;
    font-weight: 900;
    color: #0f172a;
    line-height: 1;
    letter-spacing: -0.5px;
}

.stat-icon-wrapper {
    width: 52px;
    height: 52px;
    border-radius: 12px;
    background: var(--card-bg-light, #f8fafc);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--card-accent, var(--primary));
    border: 1px solid var(--card-border-light, #e2e8f0);
    flex-shrink: 0;
    transition: var(--transition);
}

.stat-icon-wrapper svg {
    width: 26px;
    height: 26px;
    stroke-width: 2.2;
}

.stat-card:hover .stat-icon-wrapper {
    transform: scale(1.06);
}

/* Department Alerts Section */
.alerts-section {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow-sm);
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.section-title {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-main);
    white-space: nowrap;
}

.section-title svg {
    color: #d97706;
    flex-shrink: 0;
}

.tab-nav {
    display: flex;
    gap: 0.4rem;
    background: #f1f5f9;
    padding: 0.3rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.tab-btn {
    padding: 0.4rem 1rem;
    border: none;
    background: none;
    color: var(--text-muted);
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
}

.tab-btn.active {
    background-color: var(--bg-surface);
    color: var(--primary);
    box-shadow: var(--shadow-sm);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    animation: fadeIn 0.3s ease-in;
}

/* Alert Feed List & Side-by-Side Square Badge Layout */
.alert-feed {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.alert-feed-item {
    background: #f8fafc;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 1rem 1.2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: var(--transition);
    gap: 1rem;
    max-width: 100%;
    overflow: hidden;
}

.alert-feed-item:hover {
    border-color: var(--border-hover);
    background-color: #ffffff;
    box-shadow: var(--shadow-sm);
}

.feed-item-main {
    display: flex;
    align-items: center;
    gap: 1rem;
    min-width: 0;
    flex: 1;
    overflow: hidden;
}

.feed-item-title {
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--text-main);
    word-break: break-word;
    white-space: normal;
}

/* Text Wrapping & No Overflow for Subtitles */
.feed-item-sub {
    font-size: 0.85rem;
    color: var(--text-muted);
    word-break: break-word;
    white-space: normal;
    line-height: 1.5;
}

/* Side-by-Side Horizontal Badge & Days Text Layout */
.feed-item-date {
    display: flex;
    align-items: center;
    flex-direction: row;
    gap: 0.85rem;
    flex-shrink: 0;
}

/* Square Styled Status Badge for Alert Feed */
.feed-item-date .badge {
    border-radius: var(--radius-sm);
    padding: 0.45rem 0.85rem;
    font-size: 0.8rem;
}

/* --------------------------------------------------------
   9. Data Tables & Desktop-like Mobile Behavior
   -------------------------------------------------------- */
.table-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.table-toolbar {
    padding: 1.2rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    border-bottom: 1px solid var(--border-color);
    background-color: #ffffff;
}

.toolbar-actions {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    flex-wrap: wrap;
    width: 100%;
}

@media (min-width: 768px) {
    .toolbar-actions {
        width: auto;
    }
}

/* Perfectly Balanced Search Box Width for Desktop */
.search-box {
    position: relative;
    flex: 1;
    min-width: 250px;
}

@media (min-width: 992px) {
    .search-box {
        min-width: 310px;
    }
}

.search-box input {
    width: 100%;
    padding-right: 2.6rem;
    padding-left: 1rem;
}

.search-icon {
    position: absolute;
    right: 0.85rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-dim);
    pointer-events: none;
}

.filter-pills {
    display: flex;
    gap: 0.4rem;
    overflow-x: auto;
    padding-bottom: 2px;
    -webkit-overflow-scrolling: touch;
}

.filter-pill {
    padding: 0.45rem 0.9rem;
    border-radius: 20px;
    font-size: 0.82rem;
    font-weight: 600;
    border: 1px solid var(--border-color);
    background: #f8fafc;
    color: var(--text-muted);
    cursor: pointer;
    white-space: nowrap;
    transition: var(--transition);
}

.filter-pill:hover {
    color: var(--text-main);
    border-color: var(--border-hover);
}

.filter-pill.active {
    background-color: var(--primary);
    color: white;
    border-color: var(--primary);
}

.btn-add {
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
    color: white;
    padding: 0.6rem 1.2rem;
    border-radius: var(--radius-sm);
    border: none;
    font-weight: 700;
    font-size: 0.9rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: var(--transition);
    white-space: nowrap;
    box-shadow: 0 4px 12px rgba(5, 150, 105, 0.2);
}

.btn-add:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(5, 150, 105, 0.3);
}

/* Horizontal Scroll Container for Tables on Mobile */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.custom-table {
    width: 100%;
    border-collapse: collapse;
    text-align: right;
    min-width: 680px;
}

.custom-table th {
    background-color: #f8fafc;
    color: #334155;
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    padding: 1rem 1.2rem;
    border-bottom: 1px solid #cbd5e1;
    white-space: nowrap;
}

.custom-table td {
    padding: 1rem 1.2rem;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.92rem;
    vertical-align: middle;
    color: var(--text-main);
    white-space: nowrap;
}

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

.custom-table tbody tr:hover {
    background-color: #f8fafc;
}

/* Status Badges */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.35rem 0.75rem;
    border-radius: 20px;
    font-size: 0.78rem;
    font-weight: 700;
    border: 1px solid transparent;
    white-space: nowrap;
}

.badge-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    flex-shrink: 0;
}

.badge-success {
    background-color: var(--status-valid-bg);
    color: var(--status-valid-text);
    border-color: var(--status-valid-border);
}
.badge-success .badge-dot { background-color: var(--status-valid-text); }

.badge-warning {
    background-color: var(--status-soon-bg);
    color: var(--status-soon-text);
    border-color: var(--status-soon-border);
}
.badge-warning .badge-dot { background-color: var(--status-soon-text); }

.badge-warning-dark {
    background-color: var(--status-today-bg);
    color: var(--status-today-text);
    border-color: var(--status-today-border);
}
.badge-warning-dark .badge-dot { background-color: var(--status-today-text); }

.badge-danger {
    background-color: var(--status-expired-bg);
    color: var(--status-expired-text);
    border-color: var(--status-expired-border);
}
.badge-danger .badge-dot { background-color: var(--status-expired-text); }

/* Action Buttons */
.action-btns {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.btn-icon {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    background: #ffffff;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.btn-icon:hover {
    color: var(--text-main);
    border-color: var(--border-hover);
}

.btn-icon.edit:hover {
    background-color: #eef2ff;
    color: #4f46e5;
    border-color: #c7d2fe;
}

.btn-icon.delete:hover {
    background-color: #fef2f2;
    color: #dc2626;
    border-color: #fecaca;
}

/* Empty State */
.empty-state {
    padding: 3.5rem 1.5rem;
    text-align: center;
}

.empty-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 1rem;
    color: var(--text-dim);
    opacity: 0.6;
}

.empty-state h3 {
    font-size: 1.1rem;
    color: var(--text-main);
    margin-bottom: 0.4rem;
}

.empty-state p {
    font-size: 0.88rem;
    color: var(--text-muted);
}

/* --------------------------------------------------------
   10. Modals Engine
   -------------------------------------------------------- */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background-color: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(5px);
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
}

.modal-backdrop.active {
    opacity: 1;
    visibility: visible;
}

.modal-card {
    width: 100%;
    max-width: 520px;
    background-color: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: 0 20px 30px -10px rgba(15, 23, 42, 0.15);
    transform: scale(0.95);
    transition: var(--transition);
    overflow: hidden;
}

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

.modal-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background-color: #ffffff;
}

.modal-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-main);
}

.modal-close-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.3rem;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.modal-close-btn:hover {
    color: var(--text-main);
    background-color: #f1f5f9;
}

.modal-body {
    padding: 1.5rem;
    color: var(--text-body);
}

.modal-body p,
.modal-alert-text {
    font-size: 0.95rem;
    color: var(--text-body) !important;
    font-weight: 500;
    line-height: 1.6;
}

.modal-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border-color);
    background-color: #f8fafc;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.8rem;
}

.btn-secondary {
    background: #ffffff;
    border: 1px solid #cbd5e1;
    color: #334155;
    padding: 0.6rem 1.2rem;
    border-radius: var(--radius-sm);
    font-weight: 700;
    font-size: 0.9rem;
    cursor: pointer;
    transition: var(--transition);
}

.btn-secondary:hover {
    color: var(--text-main);
    border-color: #94a3b8;
    background: #f1f5f9;
}

.btn-danger {
    background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
    color: white;
    padding: 0.6rem 1.2rem;
    border-radius: var(--radius-sm);
    border: none;
    font-weight: 700;
    font-size: 0.9rem;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: 0 4px 15px var(--danger-glow);
}

.btn-danger:hover {
    background: linear-gradient(135deg, #b91c1c 0%, #991b1b 100%);
}

/* --------------------------------------------------------
   11. Toast Notifications Engine
   -------------------------------------------------------- */
.toast-container {
    position: fixed;
    top: 1.5rem;
    left: 1.5rem;
    z-index: 300;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    pointer-events: none;
}

.toast {
    pointer-events: auto;
    min-width: 300px;
    max-width: 400px;
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 1rem 1.2rem;
    display: flex;
    align-items: flex-start;
    gap: 0.8rem;
    box-shadow: 0 10px 25px rgba(15, 23, 42, 0.1);
    animation: toastIn 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
    overflow: hidden;
}

.toast::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 4px;
    height: 100%;
    background-color: var(--toast-accent, var(--primary));
}

.toast.toast-success { --toast-accent: #059669; }
.toast.toast-error { --toast-accent: #dc2626; }
.toast.toast-warning { --toast-accent: #d97706; }
.toast.toast-info { --toast-accent: #2563eb; }

.toast-icon {
    color: var(--toast-accent, var(--primary));
    margin-top: 2px;
}

.toast-content {
    flex: 1;
}

.toast-title {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text-main);
}

.toast-message {
    font-size: 0.82rem;
    color: var(--text-muted);
}

/* --------------------------------------------------------
   12. Keyframes & Animations
   -------------------------------------------------------- */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

/* --------------------------------------------------------
   13. Mobile Responsive
   -------------------------------------------------------- */
@media (max-width: 1024px) {
    .sidebar {
        right: -100%;
    }
    .sidebar.open {
        right: 0;
    }
    .sidebar-overlay.active {
        opacity: 1;
        visibility: visible;
    }
    .main-content {
        margin-right: 0;
    }
    .menu-toggle-btn {
        display: flex;
    }
}

@media (max-width: 640px) {
    .content-container {
        padding: 1rem 0.8rem;
    }
    .navbar {
        padding: 0 0.8rem;
    }
    .page-title-box p {
        display: none;
    }
    .user-profile {
        padding: 0.35rem 0.6rem;
    }
    .user-name {
        font-size: 0.8rem;
    }
    .user-clock {
        font-size: 0.72rem;
        padding: 0.05rem 0.35rem;
    }
    .stats-grid {
        grid-template-columns: 1fr;
    }
    .table-toolbar {
        flex-direction: column;
        align-items: stretch;
    }
    .search-box {
        min-width: 100%;
    }
    .filter-pills {
        width: 100%;
    }
    .tab-nav {
        width: 100%;
    }
    .alert-feed-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
        padding: 0.9rem;
    }
    .feed-item-main {
        width: 100%;
    }
    .feed-item-sub {
        white-space: normal;
        word-break: break-word;
    }
    .feed-item-date {
        width: 100%;
        justify-content: space-between;
        border-top: 1px dashed var(--border-color);
        padding-top: 0.6rem;
    }
}
