/* --- Elghazawy Maintenance System - Enhanced Modern Arabic Design v4.0 --- */

/* --- 1. محسّن الخطوط والمتغيرات --- */
@import url('https://fonts.googleapis.com/css2?family=Tajawal:wght@300;400;500;700;800;900&display=swap');

:root {
    --primary-color: #a12834;
    --primary-dark: #861f2a;
    --primary-light: #c04a56;
    --secondary-color: #475569;
    --accent-color: #1e293b;
    --brand-color: #a12834;
    --brand-hover: #861f2a;
    --header-bg: #1e293b;
    --header-bg-deep: #172033;
    --footer-bg: #0f172a;
    --action-color: #334155;
    --danger-color: #dc3545;
    --success-color: #15803d;
    --warning-color: #b7791f;
    --info-color: #2563eb;
    --light-bg: #f6f8fb;
    --card-bg: #ffffff;
    --border-color: #e2e8f0;
    --text-primary: #2d3748;
    --text-secondary: #718096;
    --shadow-light: 0 4px 6px rgba(0, 0, 0, 0.05);
    --shadow-medium: 0 10px 25px rgba(0, 0, 0, 0.1);
    --shadow-strong: 0 20px 40px rgba(0, 0, 0, 0.15);
    --shadow-glow: 0 0 24px rgba(161, 40, 52, 0.18);
    
    /* خطوط محسّنة */
    --font-main: 'Tajawal', system-ui, sans-serif;
    --font-display: 'Tajawal', system-ui, sans-serif;
    
    /* ألوان الحالات الواضحة */
    --status-red: #e53e3e;
    --status-cashmere: #805ad5;
    --status-yellow: #d69e2e;
    --status-blue: #3182ce;
    --status-white: #a0aec0;
    --status-delivered: #38a169;
    --status-replaced: #319795;
    
    /* متغيرات حديثة للتصميم */
    --gradient-primary: linear-gradient(135deg, #a12834 0%, #861f2a 100%);
    --gradient-secondary: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --gradient-bg: linear-gradient(145deg, #f8fafc 0%, #eef2f7 100%);
    --glassmorphism: rgba(255, 255, 255, 0.15);
    --glassmorphism-border: rgba(255, 255, 255, 0.2);

    /* متغيرات الارتفاع للمسافات */
    --header-height: 180px;
    --nav-height: 60px;
    
    /* ألوان إضافية للتدرجات */
    --accent-gradient: linear-gradient(135deg, #2d3748 0%, #1a202c 100%);
    --success-gradient: linear-gradient(135deg, #10b981 0%, #059669 100%);
    --gradient-info: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    --gradient-success: linear-gradient(135deg, #10b981 0%, #059669 100%);
    --gradient-danger: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    --gradient-warning: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
}

/* --- 2. الإعدادات العامة المحدثة --- */
* {
    box-sizing: border-box;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

::selection {
    background: rgba(217, 35, 50, 0.2);
    color: var(--text-primary);
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-main);
    background: var(--gradient-bg);
    color: var(--text-primary);
    margin: 0;
    padding: 0;
    line-height: 1.7;
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
    position: relative;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.main-content-wrapper {
    flex: 1 0 auto; /* Pushes footer down */
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="grid" width="20" height="20" patternUnits="userSpaceOnUse"><path d="M 20 0 L 0 0 0 20" fill="none" stroke="rgba(255,255,255,0.03)" stroke-width="1"/></pattern></defs><rect width="100" height="100" fill="url(%23grid)"/></svg>');
    pointer-events: none;
    z-index: -1;
}

/* --- 3. رأس الصفحة الثوري --- */
/* --- 3. رأس الصفحة الجديد والموحد --- */
.main-header {
    background: white;
    box-shadow: var(--shadow-medium);
    margin-bottom: 30px;
    position: sticky;
    top: 0;
    z-index: 1000;
    border-bottom: 1px solid var(--border-color);
}

.header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 50px;
    background: var(--gradient-primary);
    color: white;
}

.header-logo-section {
    display: flex;
    align-items: center;
    gap: 20px;
}

.header-logo {
    height: 60px;
    filter: brightness(0) invert(1);
}

.header-titles h1 {
    font-size: 1.8rem;
    margin: 0;
    font-weight: 800;
}

.header-titles p {
    font-size: 1rem;
    margin: 0;
    opacity: 0.9;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 15px;
    background: rgba(255, 255, 255, 0.1);
    padding: 10px 20px;
    border-radius: 50px;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.user-avatar {
    width: 40px;
    height: 40px;
    background: white;
    color: var(--primary-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

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

.user-name {
    font-weight: 700;
    font-size: 14px;
}

.user-role {
    font-size: 12px;
    opacity: 0.8;
}

.user-actions-new {
    display: flex;
    align-items: center;
    gap: 15px;
}

.action-link {
    width: 36px;
    height: 36px;
    background: rgba(255, 255, 255, 0.15);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    text-decoration: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.action-link:hover {
    background: white;
    color: var(--primary-color);
}

.logout-btn {
    background: rgba(0, 0, 0, 0.2);
    color: white;
    padding: 10px 20px;
    border-radius: 10px;
    text-decoration: none;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: all 0.3s ease;
}

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

/* --- Navigation --- */
.main-nav {
    background: white;
    padding: 0 50px;
}

.nav-list {
    display: flex;
    list-style: none;
    margin: 0;
    padding: 0;
    gap: 30px;
}

.nav-list > li > a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 20px 0;
    color: var(--text-primary);
    text-decoration: none;
    font-weight: 700;
    font-size: 16px;
    border-bottom: 3px solid transparent;
    transition: all 0.3s ease;
}

.nav-list > li > a:hover,
.nav-list > li > a.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

.nav-dropdown {
    position: relative;
    padding-bottom: 20px; /* Bridge the gap */
    margin-bottom: -20px; /* Offset the padding */
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    background: white;
    min-width: 200px;
    box-shadow: var(--shadow-lg);
    border-radius: 0 0 12px 12px;
    padding: 10px 0;
    display: none;
    list-style: none;
    border: 1px solid var(--border-color);
    margin-top: -5px; /* Pull it slightly up */
}

.dropdown-menu::before {
    content: '';
    position: absolute;
    top: -20px;
    left: 0;
    right: 0;
    height: 20px;
    background: transparent;
}

.nav-dropdown:hover .dropdown-menu {
    display: block;
}

.dropdown-menu li a {
    display: block;
    padding: 12px 20px;
    color: var(--text-primary);
    text-decoration: none;
    font-weight: 600;
    transition: background 0.3s ease;
}

.dropdown-menu li a:hover {
    background: var(--light-bg);
    color: var(--primary-color);
}

/* --- Footer الجديد --- */
.main-footer-new {
    background: white;
    padding: 40px 50px;
    border-top: 1px solid var(--border-color);
    margin-top: 50px;
}

.footer-bottom-part {
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--text-secondary);
    font-weight: 600;
}

.developer-credit {
    color: var(--primary-color);
}

/* --- 4. الأزرار الثورية --- */
.btn {
    padding: 14px 28px;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    text-decoration: none;
    font-weight: 900;
    font-size: 16px;
    font-family: var(--font-main);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow-medium);
    border: 1px solid transparent;
    position: relative;
    overflow: hidden;
    text-transform: none;
}

.header-toolbar .btn {
    font-size: 20px !important;
    padding: 14px 26px !important;
    font-weight: 800 !important;
}

.btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.btn:hover::before {
    left: 100%;
}

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

.btn:active {
    transform: translateY(-1px);
}

.btn-primary { 
    background: var(--gradient-primary);
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.2);
}

.btn-primary:hover { 
    background: linear-gradient(135deg, #c41e2d 0%, #ff3742 100%);
    box-shadow: var(--shadow-glow);
}

.btn-secondary { 
    background: linear-gradient(135deg, #4a5568 0%, #2d3748 100%);
    color: white;
}

.btn-secondary:hover { 
    background: linear-gradient(135deg, #3a4553 0%, #1a202c 100%);
}

.btn-edit { 
    background: linear-gradient(135deg, #ed8936 0%, #f6ad55 100%);
    color: white;
}

.btn-edit:hover { 
    background: linear-gradient(135deg, #dd7324 0%, #ed8936 100%);
}

.btn-delete { 
    background: linear-gradient(135deg, #e53e3e 0%, #fc8181 100%);
    color: white;
}

.btn-delete:hover { 
    background: linear-gradient(135deg, #dc2626 0%, #e53e3e 100%);
}

.btn-sm { 
    padding: 8px 16px; 
    font-size: 13px;
    border-radius: 50px;
    color: white !important;
}

.btn-info {
    background: linear-gradient(135deg, #3182ce 0%, #63b3ed 100%);
    color: white !important;
}

.btn-info:hover {
    background: linear-gradient(135deg, #2b6cb0 0%, #3182ce 100%);
}

.btn-success {
    background: linear-gradient(135deg, #38a169 0%, #68d391 100%);
    color: white !important;
}

.btn-success:hover {
    background: linear-gradient(135deg, #2f855a 0%, #38a169 100%);
}

.btn-danger {
    background: linear-gradient(135deg, #e53e3e 0%, #fc8181 100%);
    color: white !important;
}

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

.action-buttons-container {
    display: flex;
    gap: 8px;
    justify-content: flex-start;
    align-items: center;
    flex-wrap: wrap;
}

.btn-action-circle {
    width: 36px;
    height: 36px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50% !important;
    font-size: 16px;
    flex-shrink: 0;
}

/* --- 5. صندوق الفلترة الحديث --- */
.filter-box {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    padding: 15px 25px;
    border-radius: 15px;
    box-shadow: var(--shadow-medium);
    margin-bottom: 30px;
    border: 1px solid rgba(255, 255, 255, 0.5);
    position: relative;
    overflow: hidden;
}

.filter-box::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--gradient-primary);
    border-radius: 20px 20px 0 0;
}

.filter-box h2 {
    margin: 0 0 30px 0;
    color: var(--primary-color);
    font-weight: 800;
    font-family: var(--font-display);
    font-size: 1.8rem;
    display: flex;
    align-items: center;
    gap: 15px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.filter-box h2 i {
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.filter-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 10px;
}

.filter-box .form-group {
    margin-bottom: 8px;
}

.filter-box .form-group label {
    margin-bottom: 4px;
    font-size: 13px;
    white-space: nowrap;
}

.filter-box .form-group input,
.filter-box .form-group select {
    padding: 10px 15px;
    font-size: 14px;
}

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

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

.filter-actions {
    margin-top: 15px;
    display: flex;
    gap: 12px;
    justify-content: center;
}

.filter-actions .btn {
    padding: 8px 20px;
    font-size: 14px;
    min-width: 120px;
}

/* --- 6. حقول النماذج الحديثة --- */
.form-group {
    position: relative;
    margin-bottom: 25px;
}

.form-group label {
    font-weight: 700;
    margin-bottom: 10px;
    display: block;
    font-size: 16px;
    color: var(--text-primary);
    font-family: var(--font-main);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.form-group input, 
.form-group select, 
.form-group textarea {
    width: 100%;
    padding: 16px 20px;
    border: 2px solid var(--border-color);
    border-radius: 12px;
    font-size: 16px;
    box-sizing: border-box;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-family: var(--font-main);
    background: rgba(255, 255, 255, 0.9);
    color: var(--text-primary);
    backdrop-filter: blur(5px);
}

.form-group input:focus, 
.form-group select:focus, 
.form-group textarea:focus {
    border-color: var(--primary-color);
    outline: none;
    box-shadow: 0 0 0 4px rgba(217, 35, 50, 0.1);
    background: white;
}

.form-group.full-width {
    grid-column: 1 / -1;
}

/* --- 7. Modern Form Layouts --- */
.form-page-container {
    max-width: 1000px;
    margin: 40px auto;
    padding: 0 20px;
}

.form-page-card {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(15px);
    border-radius: 25px;
    padding: 50px;
    box-shadow: var(--shadow-strong);
    border: 1px solid rgba(255, 255, 255, 0.3);
    position: relative;
    overflow: hidden;
}

.form-page-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 6px;
    background: var(--gradient-primary);
}

.form-page-card h2 {
    font-size: 2.5rem;
    color: var(--primary-color);
    font-weight: 900;
    margin-bottom: 40px;
    text-align: center;
    font-family: var(--font-display);
}

.form-section {
    background: #f8fafc;
    border-radius: 20px;
    padding: 30px;
    margin-bottom: 35px;
    border-right: 5px solid var(--primary-color);
    box-shadow: var(--shadow-light);
}

.section-title {
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--accent-color);
    margin-bottom: 25px;
    display: flex;
    align-items: center;
    gap: 15px;
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 12px;
}

.section-title i {
    color: var(--primary-color);
    font-size: 1.6rem;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 25px;
}

.form-actions {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 50px;
    padding-top: 30px;
    border-top: 2px solid var(--border-color);
}

.form-actions .btn {
    min-width: 200px;
    padding: 18px 35px;
    font-size: 1.1rem;
}

@media (max-width: 768px) {
    .form-page-card {
        padding: 30px 20px;
    }
    
    .form-page-card h2 {
        font-size: 1.8rem;
    }
    
    .form-section {
        padding: 20px;
    }
    
    .form-actions {
        flex-direction: column;
    }
    
    .form-actions .btn {
        width: 100%;
    }
}

.form-group input:focus, 
.form-group select:focus, 
.form-group textarea:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(217, 35, 50, 0.15), var(--shadow-medium);
    outline: none;
    transform: translateY(-2px);
    background: white;
}

.form-group input::placeholder {
    color: var(--text-secondary);
    font-weight: 400;
}

/* --- 7. بطاقات الأجهزة الثورية --- */
.devices-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(480px, 1fr));
    gap: 30px;
}

.device-card {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(15px);
    border-radius: 20px;
    box-shadow: var(--shadow-light);
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    border: 1px solid rgba(255, 255, 255, 0.3);
    position: relative;
}

.device-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: 20px;
    padding: 1px;
    background: linear-gradient(135deg, transparent, rgba(217, 35, 50, 0.1), transparent);
    mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    mask-composite: exclude;
    opacity: 0;
    transition: opacity 0.3s;
}

.device-card:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: var(--shadow-strong);
}

.device-card:hover::before {
    opacity: 1;
}

.card-header {
    padding: 25px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: white;
    font-weight: 800;
    font-family: var(--font-display);
    position: relative;
    overflow: hidden;
}

.card-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.1), transparent);
    pointer-events: none;
}

.card-header .device-id {
    font-size: 1.6rem;
    color: var(--text-primary);
    font-weight: 800;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.card-header .device-status-text {
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    padding: 8px 16px;
    border-radius: 25px;
    font-size: 14px;
    color: white;
    font-weight: 700;
    border: 1px solid rgba(255, 255, 255, 0.3);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.card-body {
    padding: 30px;
    display: grid;
    grid-template-columns: 1fr;
    gap: 25px;
    flex-grow: 1;
}

.card-section {
    padding-bottom: 20px;
    border-bottom: 1px solid rgba(226, 232, 240, 0.5);
    position: relative;
}

.card-section:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.card-section::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 1px;
    background: var(--gradient-primary);
    transition: width 0.3s ease;
}

.device-card:hover .card-section::before {
    width: 100%;
}

.card-section h4 {
    margin: 0 0 20px 0;
    font-size: 1.3rem;
    color: var(--primary-color);
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 800;
    font-family: var(--font-display);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.card-section h4 i {
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-size: 1.1rem;
}

/* Shared Records View Styles */
.search-container {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    padding: 25px;
    border-radius: 15px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    margin-bottom: 30px;
    border: 1px solid rgba(255, 255, 255, 0.5);
}

.search-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
    margin-bottom: 20px;
}

.view-toggle {
    display: flex;
    gap: 10px;
}

.toggle-btn {
    padding: 10px 15px;
    border: 2px solid var(--primary-color);
    border-radius: 8px;
    background: white;
    color: var(--primary-color);
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 600;
}

.toggle-btn.active {
    background: var(--primary-color);
    color: white;
}

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

.action-buttons-container {
    display: flex;
    gap: 8px;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: center;
    min-width: max-content;
}

.action-buttons-container .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    white-space: nowrap;
    padding: 8px 12px;
    font-size: 13px;
    font-weight: 700;
    border-radius: 8px;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-light);
    flex-shrink: 0;
}

.action-buttons-container .btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-medium);
}
.btn-info {
    background-color: #3b82f6 !important;
    background: var(--gradient-info) !important;
    color: white !important;
    border: 1px solid rgba(255, 255, 255, 0.2);
}
.btn-primary {
    background-color: #a12834 !important;
    background: var(--gradient-primary) !important;
    color: white !important;
    border: 1px solid rgba(255, 255, 255, 0.2);
}
.btn-success {
    background-color: #10b981 !important;
    background: var(--gradient-success) !important;
    color: white !important;
    border: 1px solid rgba(255, 255, 255, 0.2);
}
.btn-danger {
    background-color: #ef4444 !important;
    background: var(--gradient-danger) !important;
    color: white !important;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.table-view {
    display: none;
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    overflow-x: auto; /* Enable horizontal scrolling */
    -webkit-overflow-scrolling: touch; /* Smooth scrolling on mobile */
    max-width: 100%;
    width: 100%;
    margin-bottom: 20px;
}

.table-view.active {
    display: block;
}

.devices-table,
.records-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin-top: 20px;
    background: white;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: var(--shadow-medium);
}

.devices-table th,
.records-table th {
    background: var(--gradient-primary);
    color: white;
    padding: 16px 12px;
    text-align: right;
    font-weight: 800;
    font-size: 15px;
    border-bottom: 2px solid rgba(255, 255, 255, 0.1);
    white-space: nowrap;
    position: sticky;
    top: 0;
    z-index: 10;
    min-width: 120px; /* Prevent over-shrinking */
}

.devices-table td,
.records-table td {
    padding: 16px 12px;
    border-bottom: 1px solid #edf2f7;
    font-size: 15px;
    vertical-align: middle;
    color: var(--text-primary);
    min-width: 120px; /* Prevent over-shrinking */
}

.wrapped-cell {
    white-space: normal !important;
    word-break: break-word;
    min-width: 150px;
    max-width: 300px;
}

.wrapped-text {
    display: inline-block;
    width: 100%;
    line-height: 1.5;
    font-weight: 700 !important;
}

.devices-table tbody tr:hover,
.records-table tbody tr:hover {
    background-color: #f8fafc;
    transform: scale(1.002);
    transition: all 0.2s ease;
}


.table-actions {
    /* Removed display: flex to let action-buttons-container handle layout properly */
    min-width: 180px; 
}

.sortable {
    cursor: pointer;
    position: relative;
    user-select: none;
}

.sortable:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

.sortable i.fa-sort {
    margin-right: 5px;
    font-size: 14px;
    opacity: 0.5;
    transition: all 0.2s;
}

.sortable i.fa-sort-up,
.sortable i.fa-sort-down {
    margin-right: 5px;
    font-size: 14px;
    color: var(--primary-color);
    opacity: 1;
}

/* --- شبكة الحقول الجديدة (3 أعمدة) --- */
.card-items-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-top: 15px;
}

.card-item {
    display: flex;
    flex-direction: column;
    gap: 8px;
    font-size: 16px;
    padding: 15px;
    background: rgba(248, 250, 252, 0.5);
    border-radius: 10px;
    transition: all 0.3s ease;
    border: 1px solid rgba(226, 232, 240, 0.3);
}

.card-item:hover {
    background: rgba(247, 250, 252, 0.8);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.card-item.full-width {
    grid-column: 1 / -1;
    margin-top: 15px;
}

.card-item strong {
    color: var(--text-secondary);
    font-weight: 700;
}

.card-item span {
    color: var(--text-primary);
    word-break: break-word;
    font-weight: 600;
}

.notes-text {
    white-space: pre-wrap;
    line-height: 1.8;
    background: linear-gradient(135deg, #f8fafc, #edf2f7);
    padding: 20px;
    border-radius: 12px;
    width: 100%;
    box-sizing: border-box;
    font-size: 15px;
    border: 1px solid rgba(226, 232, 240, 0.5);
    backdrop-filter: blur(5px);
    font-weight: 500;
}

.card-footer {
    background: linear-gradient(135deg, #f8fafc, #edf2f7);
    padding: 25px 30px;
    display: flex;
    gap: 15px;
    border-top: 1px solid rgba(226, 232, 240, 0.3);
    backdrop-filter: blur(10px);
}

/* --- 8. الحاوي الرئيسي والتذييل --- */
.main-container { 
    width: 100%;
    max-width: 100%; 
    margin: 40px auto; 
    padding: 0 20px; /* Reduced side padding */
    position: relative;
    animation: slideUp 0.6s ease-out;
    box-sizing: border-box;
}

.main-footer { 
    text-align: center; 
    padding: 30px; 
    margin-top: 60px; 
    color: var(--text-secondary); 
    font-size: 16px; 
    border-top: 1px solid rgba(226, 232, 240, 0.3);
    font-family: var(--font-main);
    font-weight: 600;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(10px);
}

/* --- 9. صفحات النماذج المحسّنة --- */
.form-page-body {
    background: var(--gradient-bg);
    font-family: var(--font-main);
    min-height: 100vh;
    padding: 50px 0;
}

.form-page-container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 25px;
}

.form-page-card {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(15px);
    color: var(--text-primary);
    padding: 50px;
    border-radius: 25px;
    box-shadow: var(--shadow-strong);
    text-align: center;
    border: 1px solid rgba(255, 255, 255, 0.3);
    position: relative;
    overflow: hidden;
}

.form-page-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--gradient-primary);
    border-radius: 25px 25px 0 0;
}

.form-page-card .card-logo {
    width: 90px;
    height: 90px;
    margin: 0 auto 30px auto;
    background: var(--gradient-primary);
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-glow);
    border: 2px solid rgba(255, 255, 255, 0.3);
    position: relative;
    overflow: hidden;
}

.form-page-card .card-logo::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(45deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    animation: shine 3s infinite;
}

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

.form-page-card .card-logo img {
    width: 70px;
    height: 70px;
    position: relative;
    z-index: 2;
    filter: brightness(0) invert(1);
}

/* --- 10. التحسينات للاستجابة --- */
@media (max-width: 768px) {
    .header-content h1 {
        font-size: 2.5rem !important;
    }
    
    .header-content p {
        font-size: 1.2rem !important;
    }
    
    .devices-list {
        grid-template-columns: 1fr;
    }
    
    .main-container {
        padding: 0 25px;
    }
    
    .card-items-grid {
        grid-template-columns: 1fr !important;
        gap: 15px !important;
    }
         
    .user-menu {
        position: relative;
        top: 0;
        left: 0;
        margin-bottom: 20px;
        justify-content: center;
    }
    
    .main-header {
        padding: 25px 20px;
    }
}

@media (max-width: 1024px) {
    .card-items-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 18px !important;
    }
    .form-grid {
        grid-template-columns: 1fr 1fr !important;
    }
}

@media (max-width: 768px) {
    .form-grid {
        grid-template-columns: 1fr !important;
    }
}

/* --- 11. ألوان الحالات المحسّنة --- */
.status-red { background: linear-gradient(135deg, var(--status-red) 0%, #fc8181 100%); }
.status-cashmere { background: linear-gradient(135deg, var(--status-cashmere) 0%, #b794f6 100%); }
.status-yellow { background: linear-gradient(135deg, var(--status-yellow) 0%, #f6e05e 100%); }
.status-blue { background: linear-gradient(135deg, var(--status-blue) 0%, #63b3ed 100%); }
.status-white { background: linear-gradient(135deg, var(--status-white) 0%, #cbd5e0 100%); }
.status-delivered { background: linear-gradient(135deg, var(--status-delivered) 0%, #68d391 100%); }
.status-replaced { background: linear-gradient(135deg, var(--status-replaced) 0%, #4fd1c7 100%); }

/* تحسينات التباين للألوان */
.status-yellow .device-status-text,
.status-white .device-status-text {
    color: var(--text-primary) !important;
    text-shadow: none !important;
}

/* --- 12. تحسينات إضافية للجداول والتنبيهات --- */
.alert {
    padding: 20px 25px;
    border-radius: 12px;
    margin-bottom: 25px;
    font-weight: 600;
    font-family: var(--font-main);
    font-size: 16px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.alert-danger {
    background: linear-gradient(135deg, rgba(254, 215, 215, 0.9), rgba(254, 178, 178, 0.9));
    color: #742a2a;
}

.alert-success {
    background: linear-gradient(135deg, rgba(198, 246, 213, 0.9), rgba(154, 230, 180, 0.9));
    color: #22543d;
}

/* --- 13. الرسوم المتحركة والتأثيرات --- */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.device-card {
    animation: fadeInUp 0.6s ease-out;
}

.device-card:nth-child(even) {
    animation-delay: 0.1s;
}

.device-card:nth-child(odd) {
    animation-delay: 0.2s;
}

/* --- 14. التصنيف والترقيم (Pagination) --- */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 40px 0;
    gap: 8px;
    flex-wrap: wrap;
}

.pagination a {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    background: white;
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: 50%;
    font-weight: 700;
    font-size: 13px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.pagination a:hover {
    background: var(--gradient-primary);
    color: white;
    border-color: var(--primary-color);
    transform: translateY(-3px);
    box-shadow: var(--shadow-medium);
}

.pagination a.active {
    background: var(--gradient-primary);
    color: white;
    border-color: var(--primary-color);
    box-shadow: var(--shadow-glow);
}

.pagination a.prev-next {
    background-color: #f8fafc;
    color: var(--primary-color);
}

.pagination-dots {
    color: var(--text-secondary);
    font-weight: bold;
    padding: 0 5px;
}

.no-results-message {
    text-align: center;
    font-weight: 800;
    font-size: 24px !important;
    color: var(--text-secondary);
    margin-top: 60px;
    padding: 50px;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(15px);
    border-radius: 20px;
    box-shadow: var(--shadow-medium);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

/* --- 15. تحسينات الطباعة المحدثة --- */
.receipt-container {
    max-width: 950px;
    margin: 50px auto;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(15px);
    padding: 50px;
    border-radius: 20px;
    box-shadow: var(--shadow-strong);
    border: 1px solid rgba(255, 255, 255, 0.3);
    position: relative;
}

.receipt-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--gradient-primary);
    border-radius: 20px 20px 0 0;
}

.receipt-actions {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 40px;
}

/* تحسينات الطباعة */
@media print {
    @page {
        size: A5;
        margin: 0;
    }
    
    body {
        background: white !important;
        font-family: var(--font-main) !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
    
    .no-print, .user-menu, .main-header, .main-footer, .receipt-actions {
        display: none !important;
    }
    
    .receipt-container {
        box-shadow: none !important;
        border: none !important;
        margin: 0 !important;
        padding: 0 !important;
        max-width: 100% !important;
        width: 100%;
        height: 100%;
        background: white !important;
        backdrop-filter: none !important;
    }
    
    .receipt-container::before {
        display: none !important;
    }
    
    .printable-receipt {
        padding: 1.2cm;
        height: 100%;
        box-sizing: border-box;
        display: flex;
        flex-direction: column;
        font-family: var(--font-main) !important;
    }
    
    .receipt-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        border-bottom: 3px solid #000;
        padding-bottom: 15px;
        margin-bottom: 20px;
    }
    
    .receipt-header img {
        height: 60px;
    }
    
    .receipt-header h2 {
        font-family: var(--font-display) !important;
        font-weight: 700;
        font-size: 24px;
        margin: 0;
        color: #000;
    }
    
    .receipt-body p.intro-text {
        font-size: 15px;
        text-align: center;
        margin: 25px 0;
        font-weight: 600;
        line-height: 1.8;
        font-family: var(--font-main) !important;
    }
    
    .receipt-grid {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 18px 28px;
    }
    
    .receipt-item {
        display: flex;
        flex-direction: column;
        background-color: #f8f9fa;
        padding: 12px;
        border-radius: 6px;
        border: 1px solid #e2e8f0;
    }
    
    .receipt-item label {
        font-size: 13px;
        color: #4a5568;
        font-weight: 600;
        margin-bottom: 4px;
        font-family: var(--font-main) !important;
    }
    
    .receipt-item span {
        font-size: 16px;
        font-weight: 600;
        color: #2d3748;
        font-family: var(--font-main) !important;
    }
    
    .receipt-footer {
        margin-top: auto;
        padding-top: 30px;
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 60px;
    }
    
    .signature-area {
        text-align: center;
    }
    
    .signature-area p {
        margin: 0;
        font-size: 15px;
        font-weight: 600;
        font-family: var(--font-main) !important;
    }
    
    .signature-line {
        border-bottom: 2px dotted #333;
        height: 50px;
        margin-top: 8px;
    }
}

/* --- 16. تأثيرات حديثة إضافية --- */
.floating-elements::before {
    content: '';
    position: fixed;
    top: 10%;
    right: 10%;
    width: 200px;
    height: 200px;
    background: radial-gradient(circle, rgba(217, 35, 50, 0.1), transparent);
    border-radius: 50%;
    animation: float 6s ease-in-out infinite;
    pointer-events: none;
    z-index: -1;
}

.floating-elements::after {
    content: '';
    position: fixed;
    bottom: 20%;
    left: 15%;
    width: 150px;
    height: 150px;
    background: radial-gradient(circle, rgba(52, 152, 219, 0.08), transparent);
    border-radius: 50%;
    animation: float 8s ease-in-out infinite reverse;
    pointer-events: none;
    z-index: -1;
}

@keyframes float {
    0%, 100% { transform: translateY(0px) scale(1); }
    50% { transform: translateY(-20px) scale(1.1); }
}

/* إضافة العناصر العائمة للجسم */
body.floating-elements {
    position: relative;
}

/* --- 17. تحسينات أخيرة للأداء --- */
.device-card,
.filter-box,
.main-header {
    will-change: transform, opacity;
}

/* تحسين السلاسة للرسوم المتحركة */
* {
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}

/* Glassy Status Badges */
.status-badge-glassy {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 16px;
    border-radius: 8px;
    font-weight: 800;
    font-size: 14px;
    text-align: center;
    white-space: nowrap;
    box-shadow: inset 0 2px 4px rgba(255, 255, 255, 0.3), 0 2px 8px rgba(0, 0, 0, 0.05);
    backdrop-filter: blur(4px);
    transition: all 0.3s ease;
    border-bottom: 3px solid rgba(0,0,0,0.15);
}

.status-badge-glassy:hover {
    transform: translateY(-2px);
    box-shadow: inset 0 2px 4px rgba(255, 255, 255, 0.4), 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* تحسين الخطوط */
body, input, select, textarea, button {
    font-display: swap;
}

/* --- 18. تحسينات الألوان الداكنة للوضع الليلي (اختياري) --- */
@media (prefers-color-scheme: dark) {
    :root {
        --light-bg: #1a202c;
        --card-bg: #2d3748;
        --border-color: #4a5568;
        --text-primary: #f7fafc;
        --text-secondary: #a0aec0;
    }
}

/* --- 19. متغيرات إضافية للتخصيص --- */
:root {
    --border-radius-sm: 8px;
    --border-radius-md: 12px;
    --border-radius-lg: 20px;
    --spacing-sm: 12px;
    --spacing-md: 24px;
    --spacing-lg: 48px;
    --font-size-xs: 14px;
    --font-size-sm: 16px;
    --font-size-md: 18px;
    --font-size-lg: 24px;
    --font-size-xl: 32px;
}
.form-page-card .form-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);  /* 3 أعمدة متساوية */
    gap: 25px;
    text-align: right;
}
@media (max-width: 768px) {
    .form-page-card .form-grid {
        grid-template-columns: 1fr !important;  /* عمود واحد في الموبايل */
    }
}

@media (max-width: 1024px) and (min-width: 769px) {
    .form-page-card .form-grid {
        grid-template-columns: repeat(2, 1fr) !important;  /* عمودين في التابلت */
    }
}
/* === PWA Mobile Optimizations === */
@media (display-mode: standalone) {
    /* إخفاء أي عناصر خاصة بالمتصفح */
    .browser-only {
        display: none;
    }
}

/* iOS Status Bar */
@supports (-webkit-touch-callout: none) {
    .main-header {
        padding-top: env(safe-area-inset-top);
    }
}

/* Bottom Navigation Bar للموبايل */
.mobile-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
    z-index: 1000;
    height: 60px;
    padding-bottom: env(safe-area-inset-bottom);
}

@media (max-width: 768px) and (display-mode: standalone) {
    .mobile-nav {
        display: flex;
        justify-content: space-around;
        align-items: center;
    }
    
    .main-container {
        padding-bottom: 80px;
    }
    
    /* أزرار التنقل السفلية */
    .mobile-nav a {
        color: #718096;
        text-decoration: none;
        display: flex;
        flex-direction: column;
        align-items: center;
        font-size: 12px;
    }
    
    .mobile-nav a.active {
        color: var(--brand-color);
    }
    
    .mobile-nav i {
        font-size: 24px;
        margin-bottom: 4px;
    }
}

/* Splash Screen */
.splash-screen {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, #a12834 0%, #7f202a 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    opacity: 1;
    transition: opacity 0.3s ease;
}

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

.splash-logo {
    width: 150px;
    height: 150px;
    background: white;
    border-radius: 30px;
    padding: 30px;
    animation: pulse 1.5s infinite;
}

/* Pull to Refresh */
.pull-to-refresh {
    position: fixed;
    top: -60px;
    left: 50%;
    transform: translateX(-50%);
    transition: top 0.3s;
    z-index: 999;
}

.pull-to-refresh.show {
    top: 20px;
}

/* --- 12. تحسينات صفحة الفهرس (Landing Page) --- */
.search-container {
    margin-bottom: 30px;
}

.search-header {
    background: white;
    padding: 20px 30px;
    border-radius: 15px;
    box-shadow: var(--shadow-medium);
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-right: 5px solid var(--primary-color);
}

.search-info h3 {
    margin: 0;
    color: var(--text-primary);
    font-weight: 800;
}

/* Table View Wrapper */
.table-view {
    background: white;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: var(--shadow-medium);
    border: 1px solid var(--border-color);
    margin-bottom: 40px;
}



/* Response Table Optimization */
@media (max-width: 1200px) {
    .table-view {
        overflow-x: auto;
    }
    
    .devices-table {
        min-width: 1200px;
    }
}

/* Loading & Tooltips */
.loading {
    text-align: center;
    padding: 50px;
    font-size: 1.5rem;
    color: var(--primary-color);
    font-weight: 700;
}

.tooltip-text {
    position: relative;
    cursor: help;
    border-bottom: 1px dotted var(--text-secondary);
}

.wrapped-cell {
    max-width: 250px; /* Increased from 150px */
}

.wrapped-text {
    display: block;
    white-space: normal !important; /* Allow wrapping */
    word-break: break-word;
    font-size: 15px; 
    font-weight: 800 !important;
}

.no-results-message {
    background: white;
    padding: 60px;
    border-radius: 20px;
    text-align: center;
    box-shadow: var(--shadow-medium);
    margin-bottom: 40px;
    font-weight: 700;
}


/* --- 13. Modern Modals --- */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    padding-top: 50px;
}

.modal-content {
    background: rgba(255, 255, 255, 0.98);
    margin: 5% auto;
    padding: 40px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    width: 80%;
    max-width: 900px;
    border-radius: 25px;
    box-shadow: var(--shadow-strong);
    position: relative;
    animation: slideIn 0.4s ease-out;
}

@keyframes slideIn {
    from { opacity: 0; transform: translateY(-50px); }
    to { opacity: 1; transform: translateY(0); }
}

.modal-header {
    border-bottom: 2px solid var(--primary-color);
    padding-bottom: 20px;
    margin-bottom: 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    color: var(--primary-color);
    margin: 0;
    font-weight: 800;
    font-family: var(--font-display);
}

.close {
    color: var(--text-secondary);
    font-size: 35px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.3s;
}

.close:hover {
    color: var(--primary-color);
}

.modal-section {
    margin-bottom: 30px;
    background: #f8fafc;
    padding: 20px;
    border-radius: 15px;
    border-right: 4px solid var(--primary-color);
}

.modal-section h3 {
    margin-top: 0;
    color: var(--accent-color);
    font-size: 1.2rem;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.modal-detail {
    margin-bottom: 12px;
    font-size: 16px;
    display: flex;
    gap: 10px;
}

.modal-detail strong {
    color: var(--text-secondary);
    min-width: 140px;
}

.modal-detail span {
    font-weight: 600;
    color: var(--text-primary);
}

/* --- Dashboard Specific Styles --- */
.dashboard-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: white;
    padding: 20px 30px;
    border-radius: 15px;
    box-shadow: var(--shadow-medium);
    margin-bottom: 30px;
    flex-wrap: wrap;
    gap: 20px;
}

.dashboard-header h1 {
    margin: 0;
    display: flex;
    align-items: center;
    gap: 15px;
    font-size: 1.8rem;
    color: var(--text-primary);
}

.dashboard-header h1 img {
    height: 50px;
}

.user-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.user-actions a {
    padding: 10px 22px;
    background: #f1f5f9;
    color: var(--text-primary);
    border-radius: 50px;
    text-decoration: none;
    font-weight: 700;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
}

.user-actions a:hover {
    background: var(--primary-color);
    color: white;
    transform: translateY(-2px);
}

/* Stats Section */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: white;
    border-radius: 15px;
    padding: 25px;
    box-shadow: var(--shadow-medium);
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
}

.stat-card::after {
    content: '';
    position: absolute;
    bottom: 0;
    right: 0;
    width: 100px;
    height: 100px;
    background: var(--primary-color);
    opacity: 0.05;
    border-radius: 50%;
    transform: translate(30%, 30%);
}

.stat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.stat-title {
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 1rem;
}

.stat-icon {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    color: white;
}

.stat-icon.primary { background: var(--gradient-primary); }
.stat-icon.success { background: var(--success-gradient); }
.stat-icon.warning { background: var(--status-yellow); }
.stat-icon.info { background: var(--status-blue); }

.stat-value {
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 10px;
}

.stat-description {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* Status Breakdown Grid */
.status-overview {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 15px;
    margin-bottom: 30px;
}

.status-item {
    background: white;
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    box-shadow: var(--shadow-light);
    border-bottom: 4px solid var(--border-color);
}

.status-item .status-count {
    font-size: 1.8rem;
    font-weight: 800;
    display: block;
    margin-bottom: 5px;
}

.status-item .status-name {
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-weight: 600;
}

/* Charts and Lists Container */
.chart-container {
    background: white;
    border-radius: 15px;
    padding: 30px;
    box-shadow: var(--shadow-medium);
    margin-bottom: 30px;
}

.chart-title {
    font-size: 1.3rem;
    font-weight: 700;
    margin-bottom: 25px;
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--text-primary);
}

.chart-title i {
    color: var(--primary-color);
}

.chart-inner {
    height: 350px;
    position: relative;
}

/* Responsive Table in Dashboard */
.table-responsive {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th {
    background: #f8fafc;
    padding: 15px;
    text-align: right;
    font-weight: 700;
    color: var(--text-secondary);
    border-bottom: 2px solid var(--border-color);
}

.data-table td {
    padding: 15px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
}

/* Search Box in Dashboard */
.search-box {
    background: white;
    padding: 25px;
    border-radius: 15px;
    box-shadow: var(--shadow-medium);
    margin-bottom: 30px;
}

.search-form {
    display: flex;
    gap: 15px;
}

.search-input {
    flex: 1;
    padding: 15px 25px;
    border: 2px solid var(--border-color);
    border-radius: 12px;
    font-size: 1rem;
    font-family: inherit;
}

.search-input:focus {
    border-color: var(--primary-color);
    outline: none;
    box-shadow: 0 0 0 4px rgba(217, 35, 50, 0.1);
}

.search-button {
    padding: 0 35px;
    background: var(--gradient-primary);
    color: white;
    border: none;
    border-radius: 50px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.1rem;
}

/* --- 20. Modern Header & Footer (Phase 8 Redesign) --- */

/* Header Base */
.main-header-modern {
    background: var(--gradient-primary);
    box-shadow: 0 4px 20px rgba(217, 35, 50, 0.25);
    position: sticky;
    top: 0;
    z-index: 1000;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.header-container-modern {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 40px;
    max-width: 1600px;
    margin: 0 auto;
    color: white;
}

/* Brand Section */
.header-brand-modern {
    display: flex;
    align-items: center;
    gap: 15px;
}

.brand-logo-modern {
    height: 50px;
    filter: brightness(0) invert(1);
    transition: transform 0.3s ease;
}

.brand-logo-modern:hover {
    transform: scale(1.05);
}

.brand-text-modern h1 {
    font-size: 1.4rem;
    margin: 0;
    font-weight: 800;
    letter-spacing: 0.5px;
}

.brand-text-modern p {
    font-size: 0.85rem;
    margin: 0;
    opacity: 0.8;
    font-weight: 500;
}

/* Navigation Menu */
.header-nav-modern {
    display: flex;
    align-items: center;
}

.nav-list-modern {
    display: flex;
    list-style: none;
    margin: 0;
    padding: 0;
    gap: 10px;
}

.nav-list-modern > li > a {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    color: rgba(255,255,255,0.85);
    text-decoration: none;
    font-weight: 700;
    font-size: 15px;
    border-radius: 20px;
    transition: all 0.3s ease;
}

.nav-list-modern > li > a:hover,
.nav-list-modern > li > a.active {
    color: white;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(5px);
}

/* Dropdown styling */
.nav-dropdown-modern {
    position: relative;
    padding-bottom: 20px; /* Bridge the gap */
    margin-bottom: -20px; /* Offset to not disrupt layout */
}

.dropdown-icon {
    font-size: 0.8em;
    margin-right: 5px;
}

.dropdown-menu-modern {
    position: absolute;
    top: calc(100% + 5px); /* Reduced visual gap slightly */
    right: 0;
    background: white;
    min-width: 220px;
    box-shadow: var(--shadow-strong);
    border-radius: 12px;
    padding: 10px;
    display: none;
    list-style: none;
    border: 1px solid var(--border-color);
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.3s ease;
    z-index: 1001;
}

/* Invisible bridge for hover state */
.dropdown-menu-modern::before {
    content: '';
    position: absolute;
    top: -20px;
    left: 0;
    right: 0;
    height: 20px;
    background: transparent;
}

.nav-dropdown-modern:hover .dropdown-menu-modern {
    display: block;
    opacity: 1;
    transform: translateY(0);
}

/* --- 22. Premium Status Badges --- */
.status-badge {
    padding: 6px 14px;
    border-radius: 50px;
    font-size: 13px !important;
    font-weight: 800 !important;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
    text-shadow: 0 1px 1px rgba(255,255,255,0.7);
    transition: all 0.3s ease;
}

.status-badge:hover {
    transform: translateY(-2px);
    filter: brightness(1.05);
}

.badge-red { background: #fee2e2; color: #dc2626; border: 1px solid #fca5a5; border-bottom: 3px solid #ef4444; }
.badge-cashmere, .badge-kashmir { background: #f3e8ff; color: #7e22ce; border: 1px solid #d8b4fe; border-bottom: 3px solid #a855f7; }
.badge-yellow { background: #fef3c7; color: #d97706; border: 1px solid #fcd34d; border-bottom: 3px solid #f59e0b; }
.badge-blue { background: #eff6ff; color: #2563eb; border: 1px solid #bfdbfe; border-bottom: 3px solid #3b82f6; }
.badge-white { background: #f1f5f9; color: #475569; border: 1px solid #cbd5e1; border-bottom: 3px solid #94a3b8; }
.badge-delivered, .badge-green { background: #d1fae5; color: #059669; border: 1px solid #6ee7b7; border-bottom: 3px solid #10b981; }
.badge-replaced { background: #ccfbf1; color: #0f766e; border: 1px solid #5eead4; border-bottom: 3px solid #14b8a6; }

.dropdown-menu-modern li a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 15px;
    color: var(--text-primary);
    text-decoration: none;
    font-weight: 600;
    border-radius: 8px;
    transition: background 0.2s ease, color 0.2s ease;
}

.dropdown-menu-modern li a i {
    color: var(--primary-color);
    opacity: 0.8;
}

.dropdown-menu-modern li a:hover {
    background: var(--light-bg);
    color: var(--primary-color);
}

/* User Actions */
.header-actions-modern {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-profile-pill {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(255, 255, 255, 0.12);
    padding: 6px 15px 6px 8px;
    border-radius: 30px;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.user-pill-icon {
    font-size: 24px;
    color: white;
}

.user-pill-text {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}

.user-pill-name {
    font-weight: 700;
    font-size: 13px;
}

.user-pill-role {
    font-size: 11px;
    opacity: 0.8;
}

.icon-btn-modern {
    width: 38px;
    height: 38px;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    text-decoration: none;
    transition: all 0.3s ease;
    border: 1px solid transparent;
}

.icon-btn-modern:hover {
    background: white;
    color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}

.logout-btn-modern {
    width: 38px;
    height: 38px;
    background: rgba(0, 0, 0, 0.2);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    text-decoration: none;
    transition: all 0.3s ease;
}

.logout-btn-modern:hover {
    background: #e53e3e;
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(229, 62, 62, 0.4);
}

.mobile-menu-toggle {
    display: none;
    background: transparent;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
}

/* Header Responsiveness */
@media (max-width: 1024px) {
    .header-container-modern {
        padding: 15px 25px;
    }
    .user-pill-text {
        display: none;
    }
    .user-profile-pill {
        padding: 6px;
    }
}

@media (max-width: 850px) {
    .mobile-menu-toggle {
        display: block;
    }
    
    .header-nav-modern {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: white;
        padding: 20px;
        box-shadow: var(--shadow-medium);
        border-top: 1px solid var(--border-color);
    }
    
    .header-nav-modern.active {
        display: block;
    }
    
    .nav-list-modern {
        flex-direction: column;
        gap: 5px;
    }
    
    .nav-list-modern > li > a {
        color: var(--text-primary);
        padding: 12px 20px;
        border-radius: 8px;
    }
    
    .nav-list-modern > li > a:hover {
        background: var(--light-bg);
        color: var(--primary-color);
    }
    
    .nav-list-modern > li > a.active {
        background: rgba(217, 35, 50, 0.1);
        color: var(--primary-color);
    }
    
    .dropdown-menu-modern {
        position: static;
        box-shadow: none;
        border: none;
        background: var(--light-bg);
        margin-top: 5px;
        padding: 5px;
        display: none;
        opacity: 1;
        transform: none;
    }
    
    .nav-dropdown-modern.active .dropdown-menu-modern {
        display: block;
    }
    
    .dropdown-menu-modern li a {
        padding: 10px 15px;
        font-size: 14px;
    }
    
    .header-actions-modern {
        display: none;
    }
    
    .header-container-modern {
        flex-wrap: wrap;
    }
}

@media (max-width: 850px) {
    .header-container-modern {
        justify-content: space-between;
    }
    .header-actions-modern {
        display: flex;
        gap: 8px;
    }
    .mobile-menu-toggle {
        order: 3;
    }
    .header-actions-modern {
        order: 2;
        margin-left: -10px; /* Reduced negative margin to prevent cutting */
    }
    .icon-btn-modern, .logout-btn-modern {
        width: 32px;
        height: 32px;
        font-size: 14px;
    }
    .brand-text-modern h1 {
        font-size: 1.1rem;
    }
    .brand-logo-modern {
        height: 40px;
    }
}

@media (max-width: 500px) {
    .header-actions-modern {
        display: none; 
    }
    .mobile-menu-toggle {
        margin-right: auto;
        margin-left: 0;
    }
}

/* Footer Modern */
.main-footer-modern {
    background: #1e293b;
    color: #cbd5e1;
    margin-top: 60px;
    font-family: var(--font-main);
    border-top: 4px solid var(--primary-color);
}

.footer-container-modern {
    display: grid;
    grid-template-columns: 2fr 1fr 1.5fr;
    gap: 40px;
    padding: 60px 40px;
    max-width: 1400px;
    margin: 0 auto;
}

.footer-brand {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 20px;
}

.footer-logo-wrapper {
    background: white;
    padding: 10px;
    border-radius: 12px;
    display: inline-flex;
}

.footer-logo {
    height: 40px;
}

.footer-brand h2 {
    color: white;
    margin: 0;
    font-size: 1.5rem;
    font-weight: 800;
}

.footer-desc {
    line-height: 1.8;
    margin-bottom: 25px;
    font-size: 15px;
    max-width: 90%;
}

.social-links-modern {
    display: flex;
    gap: 15px;
}

.social-links-modern a {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: rgba(255,255,255,0.05);
    color: white;
    border-radius: 50%;
    font-size: 18px;
    text-decoration: none;
    transition: all 0.3s ease;
    border: 1px solid rgba(255,255,255,0.1);
}

.social-links-modern a:hover {
    background: var(--primary-color);
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(217, 35, 50, 0.4);
}

.footer-column h3 {
    color: white;
    font-size: 1.2rem;
    margin-top: 0;
    margin-bottom: 25px;
    font-weight: 700;
    position: relative;
    padding-bottom: 12px;
}

.footer-column h3::after {
    content: '';
    position: absolute;
    bottom: 0;
    right: 0;
    width: 40px;
    height: 3px;
    background: var(--primary-color);
    border-radius: 3px;
}

.footer-links-list,
.footer-contact-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.footer-links-list li a {
    color: #cbd5e1;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: all 0.3s ease;
    font-weight: 500;
}

.footer-links-list li a:hover {
    color: white;
    transform: translateX(-5px);
}

.footer-links-list li a i {
    color: var(--primary-color);
    font-size: 12px;
    transition: transform 0.3s ease;
}

.footer-links-list li a:hover i {
    transform: translateX(-3px);
}

.footer-contact-list li {
    display: flex;
    align-items: flex-start;
    gap: 15px;
}

.icon-contact {
    margin-top: 4px;
    color: var(--primary-color);
    font-size: 18px;
}

.footer-contact-list li div {
    display: flex;
    flex-direction: column;
}

.footer-contact-list li strong {
    color: white;
    font-weight: 600;
    font-size: 15px;
    margin-bottom: 2px;
}

.footer-contact-list li span {
    font-size: 14px;
    opacity: 0.8;
}

.footer-bottom-modern {
    background: #0f172a;
    padding: 20px 40px;
    border-top: 1px solid rgba(255,255,255,0.05);
}

.footer-bottom-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1400px;
    margin: 0 auto;
    font-size: 14px;
}

.footer-bottom-content p {
    margin: 0;
}

.developer-credit-modern strong {
    color: var(--primary-color);
}

@media (max-width: 1024px) {
    .footer-container-modern {
        grid-template-columns: 1fr 1fr;
        padding: 50px 30px;
    }
}

@media (max-width: 768px) {
    .footer-container-modern {
        grid-template-columns: 1fr;
        gap: 40px;
    }
    
    .footer-desc {
        max-width: 100%;
    }
    
    .footer-bottom-content {
        flex-direction: column;
        text-align: center;
        gap: 10px;
    }
}

/* --- 21. Log Page Container (Full Width) --- */
.log-page-container {
    max-width: 100%;
    width: 100%;
    margin: 20px auto;
    padding: 0 15px;
}

.log-page-card {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(15px);
    border-radius: 20px;
    padding: 25px 30px;
    box-shadow: var(--shadow-medium);
    border: 1px solid var(--border-color);
}

.btn-action-details {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white !important;
    font-weight: 800;
    font-family: var(--font-main);
    border: none;
    padding: 8px 16px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 13px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 10px rgba(102, 126, 234, 0.3);
}

.btn-action-details:hover {
    background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(102, 126, 234, 0.4);
}

/* --- 23. Unified Brand Shell: Header & Footer --- */
.main-header-modern {
    background: linear-gradient(115deg, var(--header-bg) 0%, var(--header-bg-deep) 100%);
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.16);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.header-container-modern {
    min-height: 74px;
    padding: 10px 36px;
    gap: 24px;
}

.header-brand-modern {
    color: white;
    text-decoration: none;
    flex: 0 0 auto;
}

.brand-logo-frame {
    width: 92px;
    height: 46px;
    padding: 7px 9px;
    background: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.72);
    border-radius: 11px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 5px 16px rgba(15, 23, 42, 0.22);
}

.brand-logo-modern {
    width: 100%;
    height: 100%;
    object-fit: contain;
    filter: none;
}

.header-brand-modern:hover .brand-logo-modern {
    transform: none;
}

.brand-text-modern h1 {
    font-size: 1.12rem;
    letter-spacing: 0;
}

.brand-text-modern p {
    color: #cbd5e1;
    font-size: 0.78rem;
    opacity: 1;
}

.nav-list-modern {
    gap: 4px;
}

.nav-list-modern > li > a {
    color: #dbe3ee;
    padding: 10px 15px;
    border-radius: 10px;
    font-size: 14px;
    position: relative;
}

.nav-list-modern > li > a:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.08);
}

.nav-list-modern > li > a.active {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.11);
    box-shadow: inset 0 -2px 0 var(--brand-color);
}

.dropdown-menu-modern {
    border-radius: 10px;
    border-top: 3px solid var(--brand-color);
    box-shadow: 0 18px 40px rgba(15, 23, 42, 0.18);
}

.user-profile-pill {
    background: rgba(255, 255, 255, 0.07);
    border-color: rgba(255, 255, 255, 0.12);
}

.icon-btn-modern,
.logout-btn-modern {
    background: rgba(255, 255, 255, 0.07);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.icon-btn-modern:hover,
.icon-btn-modern.active {
    color: #ffffff;
    background: var(--brand-color);
    border-color: var(--brand-color);
    box-shadow: 0 6px 14px rgba(161, 40, 52, 0.25);
}

.logout-btn-modern:hover {
    background: var(--danger-color);
    border-color: var(--danger-color);
    box-shadow: 0 6px 14px rgba(220, 53, 69, 0.24);
}

.mobile-menu-toggle {
    width: 40px;
    height: 40px;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.07);
}

.mobile-menu-toggle:hover {
    background: rgba(255, 255, 255, 0.13);
}

/* Compact operational footer */
.main-footer-modern {
    background: var(--footer-bg);
    color: #cbd5e1;
    margin-top: 44px;
    border-top: 3px solid var(--brand-color);
}

.footer-container-modern {
    max-width: 1480px;
    min-height: 92px;
    margin: 0 auto;
    padding: 20px 40px;
    display: grid;
    grid-template-columns: minmax(280px, 1fr) auto;
    align-items: center;
    gap: 32px;
}

.footer-identity-modern {
    display: flex;
    align-items: center;
    gap: 14px;
}

.footer-logo-wrapper {
    flex: 0 0 auto;
    width: 78px;
    height: 42px;
    padding: 7px 8px;
    border-radius: 9px;
    background: #ffffff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.footer-logo {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.footer-identity-modern > div,
.footer-utility-modern {
    display: flex;
}

.footer-identity-modern > div {
    flex-direction: column;
    gap: 2px;
}

.footer-identity-modern strong {
    color: #ffffff;
    font-size: 15px;
    font-weight: 700;
}

.footer-identity-modern span {
    color: #94a3b8;
    font-size: 12px;
}

.footer-utility-modern {
    align-items: center;
    justify-content: flex-end;
    gap: 24px;
    color: #aebbd0;
    font-size: 13px;
}

.footer-utility-modern span {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
}

.footer-utility-modern i {
    color: #d1828a;
}

.footer-bottom-modern {
    background: #0b1220;
    padding: 11px 40px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.footer-bottom-content {
    color: #8492a6;
    font-size: 12px;
}

.developer-credit-modern strong {
    color: #d5a0a5;
}

@media (max-width: 1100px) {
    .header-container-modern {
        padding-inline: 24px;
        gap: 14px;
    }

    .nav-list-modern > li > a {
        padding-inline: 11px;
    }

    .footer-utility-modern span:first-child {
        display: none;
    }
}

@media (max-width: 850px) {
    .header-container-modern {
        min-height: 66px;
        flex-wrap: nowrap;
        padding: 9px 18px;
    }

    .mobile-menu-toggle {
        display: inline-flex;
        order: 3;
    }

    .header-brand-modern {
        order: 1;
    }

    .header-actions-modern {
        order: 2;
        display: flex;
        margin-left: 0;
        margin-right: auto;
    }

    .header-nav-modern {
        top: 100%;
        padding: 12px 16px 16px;
        border-top: 3px solid var(--brand-color);
        box-shadow: 0 16px 30px rgba(15, 23, 42, 0.16);
    }

    .nav-list-modern > li > a.active {
        background: rgba(161, 40, 52, 0.09);
        box-shadow: inset -3px 0 0 var(--brand-color);
    }

    .brand-logo-frame {
        width: 78px;
        height: 42px;
    }

    .footer-container-modern {
        grid-template-columns: 1fr;
        min-height: 0;
        padding: 22px 24px;
        gap: 16px;
    }

    .footer-utility-modern {
        justify-content: flex-start;
    }
}

@media (max-width: 560px) {
    .brand-text-modern,
    .user-profile-pill,
    .header-actions-modern .icon-btn-modern {
        display: none;
    }

    .header-actions-modern {
        display: flex;
    }

    .footer-utility-modern {
        display: none;
    }

    .footer-bottom-modern {
        padding: 12px 20px;
    }

    .footer-bottom-content {
        flex-direction: column;
        gap: 5px;
        text-align: center;
    }
}

/* --- 24. Operational home page --- */
.page-home {
    background: #f4f6f9;
}

.page-home .main-container {
    width: 100%;
    max-width: none;
    margin: 28px auto 0;
    padding: 0 18px;
}

.workspace-hero {
    margin-bottom: 20px;
    padding: 24px 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 28px;
    background: #ffffff;
    border: 1px solid #e1e7ef;
    border-right: 4px solid var(--brand-color);
    border-radius: 14px;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.06);
}

.workspace-eyebrow,
.form-page-eyebrow {
    color: var(--brand-color);
    font-size: 12px;
    font-weight: 750;
}

.workspace-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 7px;
}

.workspace-hero h1 {
    margin: 5px 0 4px;
    color: #172033;
    font-family: var(--font-display);
    font-size: clamp(1.65rem, 3vw, 2.15rem);
    line-height: 1.25;
}

.workspace-hero p {
    margin: 0;
    color: #69778b;
    font-size: 14px;
}

.workspace-hero-side,
.workspace-hero-actions {
    display: flex;
    align-items: center;
}

.workspace-hero-side {
    gap: 24px;
}

.workspace-stat {
    min-width: 100px;
    padding-left: 24px;
    display: flex;
    flex-direction: column;
    border-left: 1px solid #e2e8f0;
}

.workspace-stat span {
    color: #8492a6;
    font-size: 11px;
}

.workspace-stat strong {
    color: #1e293b;
    font-size: 1.55rem;
    line-height: 1.35;
}

.workspace-hero-actions {
    gap: 9px;
}

.workspace-btn {
    min-height: 42px;
    padding: 0 15px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border-radius: 9px;
    text-decoration: none;
    font-size: 13px;
    font-weight: 700;
    transition: background-color 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

.workspace-btn-primary {
    color: #ffffff;
    background: #243247;
    border: 1px solid #243247;
}

.workspace-btn-primary:hover {
    background: #172033;
    transform: translateY(-1px);
}

.workspace-btn-ghost {
    color: #334155;
    background: #ffffff;
    border: 1px solid #d8e0ea;
}

.workspace-btn-ghost:hover {
    color: var(--brand-color);
    border-color: #c69ba1;
}

.workspace-notice {
    margin: -4px 0 20px;
    padding: 11px 14px;
    display: flex;
    align-items: center;
    gap: 9px;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 650;
}

.workspace-notice-success {
    color: #166534;
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
}

.workspace-notice-neutral {
    color: #475569;
    background: #f8fafc;
    border: 1px solid #dce3eb;
}

.page-home .filter-box {
    margin: 0 0 20px;
    padding: 0;
    overflow: hidden;
    position: relative;
    background: #ffffff;
    border: 1px solid #e1e7ef;
    border-radius: 14px;
    box-shadow: 0 6px 20px rgba(15, 23, 42, 0.045);
}

.page-home .filter-box::before {
    display: none;
}

.filter-summary {
    min-height: 72px;
    padding: 15px 20px;
    display: flex;
    align-items: center;
    gap: 13px;
    cursor: pointer;
    list-style: none;
    user-select: none;
}

.filter-summary::-webkit-details-marker {
    display: none;
}

.filter-summary-icon {
    flex: 0 0 auto;
    width: 40px;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--brand-color);
    background: rgba(161, 40, 52, 0.08);
    border-radius: 10px;
}

.filter-summary-copy {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.filter-summary-copy strong {
    color: #000000;
    font-family: var(--font-main);
    font-size: 15px;
    font-weight: 800;
}

.filter-summary-copy small {
    color: #000000;
    font-family: var(--font-main);
    font-size: 15px;
    font-weight: 800;
}

.filter-summary-toggle {
    margin-right: auto;
    color: #8492a6;
    transition: transform 0.2s ease;
}

.filter-panel[open] .filter-summary-toggle {
    transform: rotate(180deg);
}

.page-home .filter-box form {
    padding: 20px;
    border-top: 1px solid #edf1f5;
}

.page-home .filter-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px 16px;
}

.page-home .filter-box .form-group {
    margin: 0;
}

.page-home .filter-box .form-group label {
    margin-bottom: 6px;
    color: #000000;
    font-family: var(--font-main);
    font-size: 15px;
    font-weight: 800;
}

.page-home .filter-box .form-group input,
.page-home .filter-box .form-group select {
    height: 42px;
    padding: 0 12px;
    color: #000000;
    background: #f9fafc;
    border: 1px solid #dce3eb;
    border-radius: 8px;
    font-family: var(--font-main);
    font-size: 15px;
    font-weight: 800;
    box-shadow: none;
}

.page-home .filter-box .form-group input::placeholder {
    color: #000000;
    font-family: var(--font-main);
    font-size: 15px;
    font-weight: 800;
    opacity: 1;
}

.page-home .filter-box .form-group input:focus,
.page-home .filter-box .form-group select:focus {
    background: #ffffff;
    border-color: var(--brand-color);
    box-shadow: 0 0 0 3px rgba(161, 40, 52, 0.08);
}

.page-home .filter-actions {
    margin-top: 18px;
    justify-content: flex-start;
}

.page-home .filter-actions .btn,
.page-home .view-toggle .btn {
    min-width: 0;
    min-height: 40px;
    padding: 0 16px;
    border-radius: 8px;
    box-shadow: none;
    transform: none;
}

.page-home .filter-actions .btn {
    font-family: var(--font-main);
    font-size: 15px;
    font-weight: 800;
}

.page-home .view-toggle .btn {
    font-size: 12px;
}

.page-home .btn-primary {
    color: #ffffff !important;
    background: #243247 !important;
    border: 1px solid #243247 !important;
}

.page-home .btn-primary:hover {
    background: #172033 !important;
}

.page-home .btn-secondary {
    color: #475569 !important;
    background: #ffffff !important;
    border: 1px solid #d8e0ea !important;
}

.page-home .search-container {
    margin: 0 0 12px;
    padding: 15px 18px;
    background: #ffffff;
    border: 1px solid #e1e7ef;
    border-radius: 12px;
    box-shadow: 0 4px 14px rgba(15, 23, 42, 0.04);
}

.page-home .search-header {
    margin: 0;
}

.page-home .search-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.page-home .search-info h3 {
    margin: 0;
    color: #253247;
    font-size: 14px;
}

.page-home .search-info h3 i {
    margin-left: 6px;
    color: var(--brand-color);
}

.results-count {
    padding: 4px 9px;
    color: #65748a;
    background: #f1f4f8;
    border-radius: 99px;
    font-size: 11px;
    font-weight: 650;
}

.page-home .table-view {
    width: 100%;
    max-width: 100%;
    max-height: none;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    background: #ffffff;
    border: 1px solid #dfe6ee;
    border-radius: 12px;
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.05);
}

.page-home .devices-table {
    width: 100%;
    min-width: 1120px;
    max-width: 100%;
    table-layout: fixed;
    margin-top: 0;
    overflow: visible;
    border-radius: 0;
    box-shadow: none;
}

.page-home .table-view:focus-visible {
    outline: 3px solid #2563eb;
    outline-offset: 2px;
}

@media print {
    .page-home .table-view {
        max-height: none;
        overflow: visible;
        scrollbar-gutter: auto;
    }

    .page-home .devices-table thead th {
        position: static;
    }
}

.page-home .devices-table .details-only-column {
    display: none;
}

@media (min-width: 1700px) {
    .page-home .devices-table {
        min-width: 1600px;
    }

    .page-home .devices-table .details-only-column {
        display: table-cell;
    }

    .page-home .devices-table th:nth-child(11),
    .page-home .devices-table td:nth-child(11),
    .page-home .devices-table th:nth-child(12),
    .page-home .devices-table td:nth-child(12),
    .page-home .devices-table th:nth-child(13),
    .page-home .devices-table td:nth-child(13) {
        width: 150px;
    }
}

.page-home .devices-table th {
    position: sticky;
    top: 0;
    z-index: 2;
    padding: 13px 11px;
    color: #ffffff;
    background: #263449;
    border-bottom: 0;
    font-family: var(--font-main);
    font-size: 15px;
    font-weight: 800;
    min-width: 0;
    white-space: normal;
}

.page-home .devices-table td {
    padding: 12px 10px;
    color: #000000;
    background: #ffffff;
    border-bottom: 1px solid #edf1f5;
    font-family: var(--font-main);
    font-size: 15px;
    font-weight: 800;
    min-width: 0;
    overflow-wrap: anywhere;
    word-break: break-word;
}

/* Keep every regular table value identical to the detailed-text reference. */
.page-home .devices-table td > strong,
.page-home .devices-table .text-field,
.page-home .devices-table .wrapped-text {
    color: inherit;
    font-family: inherit;
    font-size: inherit;
    font-weight: inherit !important;
}

.page-home .devices-table th:nth-child(1),
.page-home .devices-table td:nth-child(1) { width: 52px; }
.page-home .devices-table th:nth-child(2),
.page-home .devices-table td:nth-child(2) { width: 78px; }
.page-home .devices-table th:nth-child(3),
.page-home .devices-table td:nth-child(3) { width: 130px; }
.page-home .devices-table th:nth-child(4),
.page-home .devices-table td:nth-child(4) { width: 105px; }
.page-home .devices-table th:nth-child(5),
.page-home .devices-table td:nth-child(5) { width: 112px; }
.page-home .devices-table th:nth-child(6),
.page-home .devices-table td:nth-child(6) { width: 135px; }
.page-home .devices-table th:nth-child(7),
.page-home .devices-table td:nth-child(7) { width: 82px; }
.page-home .devices-table th:nth-child(8),
.page-home .devices-table td:nth-child(8) { width: 82px; }
.page-home .devices-table th:nth-child(9),
.page-home .devices-table td:nth-child(9),
.page-home .devices-table th:nth-child(10),
.page-home .devices-table td:nth-child(10) { width: 98px; }
.page-home .devices-table th:nth-child(14),
.page-home .devices-table td:nth-child(14) { width: 108px; }
.page-home .devices-table th:nth-child(15),
.page-home .devices-table td:nth-child(15) { width: 150px; }

.page-home .devices-table tbody tr:hover,
.page-home .devices-table tbody tr:hover td {
    background: #f7f9fc;
    transform: none;
}

.page-home .devices-table .btn {
    width: 32px;
    height: 32px;
    padding: 0 !important;
    border-radius: 7px;
    box-shadow: none;
    transform: none;
}

.page-home .pagination a.active {
    background: var(--brand-color);
    border-color: var(--brand-color);
}

.page-home .modal {
    padding: 22px;
    background: rgba(15, 23, 42, 0.58);
    backdrop-filter: blur(3px);
}

.page-home .modal-content {
    width: min(760px, 100%);
    max-height: calc(100dvh - 44px);
    margin: auto;
    padding: 0;
    overflow: auto;
    background: #ffffff;
    border: 1px solid #dfe6ee;
    border-radius: 14px;
    box-shadow: 0 24px 70px rgba(15, 23, 42, 0.26);
}

.page-home .modal-header {
    position: sticky;
    top: 0;
    z-index: 2;
    margin: 0;
    padding: 18px 22px;
    color: #ffffff;
    background: #263449;
    border-bottom: 3px solid var(--brand-color);
}

.page-home .modal-header h2 {
    color: #ffffff;
    font-size: 18px;
}

.page-home .modal-header .close {
    color: #dce4ee;
}

.page-home #modal-body {
    padding: 20px;
}

.page-home .modal-section {
    margin-bottom: 14px;
    padding: 17px;
    background: #f8fafc;
    border: 1px solid #e4e9f0;
    border-right: 3px solid var(--brand-color);
    border-radius: 9px;
}

.page-home .modal-section:last-child {
    margin-bottom: 0;
}

.page-home .modal-section h3 {
    margin-bottom: 13px;
    color: #253247;
    font-size: 14px;
}

.page-home .modal-detail {
    margin-bottom: 8px;
    font-size: 13px;
}

/* --- 25. Device entry page --- */
.page-add-device {
    background: #f4f6f9;
}

.page-add-device .form-page-container {
    width: min(1280px, 100%);
    max-width: none;
    margin: 28px auto 0;
    padding: 0 28px;
}

.page-add-device .form-page-card {
    padding: 0;
    overflow: hidden;
    text-align: right;
    background: #ffffff;
    border: 1px solid #e0e7ef;
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.07);
}

.page-add-device .form-page-card::before {
    display: none;
}

.form-page-heading {
    padding: 24px 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 22px;
    background: linear-gradient(115deg, #ffffff 0%, #f8fafc 100%);
    border-bottom: 1px solid #e7ecf2;
}

.form-page-heading-copy {
    display: flex;
    align-items: center;
    gap: 16px;
}

.form-page-heading-icon {
    flex: 0 0 auto;
    width: 50px;
    height: 50px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    background: #243247;
    border-radius: 12px;
    font-size: 19px;
    box-shadow: 0 7px 16px rgba(30, 41, 59, 0.16);
}

.form-page-heading h1 {
    margin: 2px 0 3px;
    color: #172033;
    font-family: var(--font-display);
    font-size: clamp(1.55rem, 3vw, 2rem);
    line-height: 1.25;
}

.form-page-heading p {
    margin: 0;
    color: #718096;
    font-size: 12px;
}

.form-back-link {
    min-height: 40px;
    padding: 0 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    color: #475569;
    background: #ffffff;
    border: 1px solid #d8e0ea;
    border-radius: 8px;
    text-decoration: none;
    font-size: 12px;
    font-weight: 650;
}

.form-back-link:hover {
    color: var(--brand-color);
    border-color: #c9a0a5;
}

.page-add-device .alert {
    margin: 20px 28px 0;
}

.device-entry-form {
    padding: 26px 28px 30px;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px;
}

.device-entry-form .section-receipt,
.device-entry-form .section-maintenance,
.device-entry-form .form-actions {
    grid-column: 1 / -1;
}

.page-add-device .form-section {
    margin: 0;
    padding: 22px;
    background: #f9fafc;
    border: 1px solid #e5eaf0;
    border-radius: 12px;
    box-shadow: none;
}

.page-add-device .section-title {
    margin-bottom: 18px;
    padding-bottom: 11px;
    color: #253247;
    border-bottom: 1px solid #dde4ec;
    font-size: 15px;
    font-weight: 750;
}

.page-add-device .section-title i {
    color: var(--brand-color);
    font-size: 15px;
}

.page-add-device .form-grid {
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 14px;
}

.page-add-device .form-group {
    margin-bottom: 14px;
}

.page-add-device .form-group:last-child {
    margin-bottom: 0;
}

.page-add-device .form-group label {
    margin-bottom: 6px;
    color: #475569;
    font-size: 12px;
    font-weight: 700;
    text-shadow: none;
}

.page-add-device .form-group label i {
    margin-left: 4px;
    color: #8996a8;
}

.page-add-device .form-group input,
.page-add-device .form-group select,
.page-add-device .form-group textarea {
    padding: 11px 13px;
    color: #253247;
    background: #ffffff;
    border: 1px solid #d8e0e9;
    border-radius: 8px;
    font-size: 13px;
    box-shadow: none;
}

.page-add-device .form-group input,
.page-add-device .form-group select {
    height: 44px;
}

.page-add-device .form-group textarea {
    min-height: 94px;
    resize: vertical;
}

.page-add-device .form-group input:focus,
.page-add-device .form-group select:focus,
.page-add-device .form-group textarea:focus {
    background: #ffffff;
    border-color: var(--brand-color);
    box-shadow: 0 0 0 3px rgba(161, 40, 52, 0.08);
    transform: none;
}

.page-add-device .form-actions {
    margin-top: 2px;
    padding-top: 22px;
    justify-content: flex-start;
    border-top: 1px solid #e5eaf0;
}

.page-add-device .form-actions .btn {
    min-width: 0;
    min-height: 44px;
    padding: 0 18px;
    border-radius: 9px;
    font-size: 13px;
    box-shadow: none;
    transform: none;
}

.page-add-device .form-actions .btn-primary {
    color: #ffffff !important;
    background: #243247 !important;
    border: 1px solid #243247 !important;
}

.page-add-device .form-actions .btn-primary:hover {
    background: #172033 !important;
}

.page-add-device .form-actions .btn-secondary {
    color: #475569 !important;
    background: #ffffff !important;
    border: 1px solid #d8e0ea !important;
}

@media (max-width: 1050px) {
    .workspace-hero {
        align-items: flex-start;
    }

    .workspace-hero-side {
        align-items: flex-end;
        flex-direction: column;
        gap: 12px;
    }

    .workspace-stat {
        padding-left: 0;
        border-left: 0;
        text-align: left;
    }

    .page-home .filter-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 780px) {
    .page-home .main-container,
    .page-add-device .form-page-container {
        margin-top: 18px;
        padding-inline: 16px;
    }

    .workspace-hero {
        padding: 20px;
        flex-direction: column;
    }

    .workspace-hero-side {
        width: 100%;
        align-items: stretch;
        flex-direction: row;
        justify-content: space-between;
    }

    .page-home .filter-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .page-home .devices-table {
        min-width: 850px;
    }

    .page-home .devices-table th:nth-child(2),
    .page-home .devices-table td:nth-child(2),
    .page-home .devices-table th:nth-child(7),
    .page-home .devices-table td:nth-child(7),
    .page-home .devices-table th:nth-child(8),
    .page-home .devices-table td:nth-child(8),
    .page-home .devices-table th:nth-child(10),
    .page-home .devices-table td:nth-child(10) {
        display: none;
    }

    .device-entry-form {
        grid-template-columns: 1fr;
        padding: 20px;
    }

    .device-entry-form .section-receipt,
    .device-entry-form .section-maintenance,
    .device-entry-form .form-actions {
        grid-column: auto;
    }

    .form-page-heading {
        align-items: flex-start;
        padding: 20px;
    }
}

@media (max-width: 540px) {
    .workspace-hero-side,
    .workspace-hero-actions,
    .page-add-device .form-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .workspace-stat {
        text-align: right;
    }

    .workspace-btn,
    .page-add-device .form-actions .btn {
        width: 100%;
    }

    .page-home .filter-grid {
        grid-template-columns: 1fr;
    }

    .filter-summary-copy small,
    .form-page-heading p,
    .form-back-link {
        display: none;
    }

    .form-page-heading-copy {
        align-items: flex-start;
    }

    .page-add-device .form-section {
        padding: 18px;
    }
}

/* --- 26. Unified editors, records and administration pages --- */
.page-device-editor,
.page-device-view,
.page-record-form,
.page-records,
.page-activity-log,
.page-user-management,
.page-user-editor,
.page-dashboard {
    background: #f4f6f9;
}

/* Device editor */
.page-device-editor .form-page-container {
    width: min(1280px, 100%);
    max-width: none;
    margin: 28px auto 0;
    padding: 0 28px;
}

.page-device-editor .form-page-card,
.page-record-form .form-page-card,
.page-user-editor .form-container {
    padding: 0;
    overflow: hidden;
    text-align: right;
    background: #ffffff;
    border: 1px solid #e0e7ef;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.07);
}

.page-device-editor .form-page-card::before,
.page-record-form .form-page-card::before {
    display: none;
}

.page-device-editor .card-logo,
.page-record-form .card-logo {
    display: none;
}

.page-device-editor .form-page-card > h2,
.page-record-form .form-page-card > h2 {
    margin: 0;
    padding: 24px 28px 10px;
    color: #172033;
    font-family: var(--font-display);
    font-size: 1.8rem;
    text-align: right;
}

.page-device-editor .form-page-card > h2 i,
.page-record-form .form-page-card > h2 i {
    margin-left: 8px;
    color: var(--brand-color);
}

.page-device-editor .device-info-header {
    margin: 0 28px 22px;
    padding: 12px 15px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: #475569;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 9px;
}

.page-device-editor .device-info-header h3 {
    margin: 0;
    font-size: 13px;
}

.page-device-editor .device-status {
    padding: 5px 10px;
    border-radius: 99px;
    font-size: 11px;
    font-weight: 750;
}

.page-device-editor form {
    padding: 0 28px 30px;
}

.page-device-editor form > .form-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px 16px;
}

.page-device-editor .form-section,
.page-record-form .form-section {
    margin: 8px 0 0;
    padding: 20px;
    background: #f9fafc;
    border: 1px solid #e4e9f0;
    border-radius: 11px;
    box-shadow: none;
}

.page-device-editor .form-group,
.page-record-form .form-group,
.page-user-editor .form-group {
    margin-bottom: 14px;
}

.page-device-editor .form-group label,
.page-record-form .form-group label,
.page-user-editor .form-group label {
    margin-bottom: 6px;
    color: #475569;
    font-size: 12px;
    text-shadow: none;
}

.page-device-editor .form-group input,
.page-device-editor .form-group select,
.page-device-editor .form-group textarea,
.page-record-form .form-group input,
.page-record-form .form-group select,
.page-record-form .form-group textarea,
.page-user-editor .form-group input,
.page-user-editor .form-group select {
    padding: 11px 13px;
    color: #253247;
    background: #ffffff;
    border: 1px solid #d8e0e9;
    border-radius: 8px;
    box-shadow: none;
    font-size: 13px;
}

.page-device-editor .form-group input,
.page-device-editor .form-group select,
.page-record-form .form-group input,
.page-record-form .form-group select,
.page-user-editor .form-group input,
.page-user-editor .form-group select {
    height: 44px;
}

.page-device-editor .form-group input:focus,
.page-device-editor .form-group select:focus,
.page-device-editor .form-group textarea:focus,
.page-record-form .form-group input:focus,
.page-record-form .form-group select:focus,
.page-record-form .form-group textarea:focus,
.page-user-editor .form-group input:focus,
.page-user-editor .form-group select:focus {
    border-color: var(--brand-color);
    box-shadow: 0 0 0 3px rgba(161, 40, 52, 0.08);
    transform: none;
}

.page-device-editor .section-title,
.page-record-form .section-title {
    margin-bottom: 16px;
    padding-bottom: 10px;
    color: #253247;
    border-bottom: 1px solid #dde4ec;
    font-size: 14px;
}

.page-device-editor .form-actions,
.page-record-form .form-actions,
.page-user-editor .form-actions {
    margin-top: 22px;
    padding-top: 20px;
    justify-content: flex-start;
    border-top: 1px solid #e4e9f0;
}

.page-device-editor .form-actions .btn,
.page-record-form .form-actions .btn,
.page-user-editor .form-actions .btn {
    min-width: 0;
    min-height: 43px;
    padding: 0 17px !important;
    border-radius: 8px;
    box-shadow: none;
    font-size: 12px !important;
    transform: none;
}

.page-device-editor .btn-primary,
.page-record-form .btn-primary,
.page-user-editor .btn-primary {
    background: #243247 !important;
    border: 1px solid #243247 !important;
}

.page-device-editor .btn-secondary,
.page-record-form .btn-secondary,
.page-user-editor .btn-secondary {
    color: #475569 !important;
    background: #ffffff !important;
    border: 1px solid #d8e0ea !important;
}

/* Lost and replacement create/edit forms */
.page-record-form .form-page-container {
    width: min(1120px, 100%);
    max-width: none;
    margin: 28px auto 0;
    padding: 0 28px;
}

.page-record-form .intro-text {
    margin: 4px 28px 22px;
    padding: 13px 15px;
    display: flex;
    align-items: flex-start;
    gap: 11px;
    color: #56657a;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-right: 3px solid var(--brand-color);
    border-radius: 9px;
    font-size: 12px;
}

.page-record-form .intro-text i {
    color: var(--brand-color) !important;
    font-size: 16px;
}

.page-record-form .intro-text p {
    margin: 0;
    font-size: 12px;
    line-height: 1.8;
}

.page-record-form .error-message,
.page-record-form .success-message {
    margin: 0 28px 18px;
    padding: 11px 14px;
    border-radius: 9px;
    font-size: 12px;
}

.page-record-form form {
    padding: 0 28px 30px;
}

.page-record-form form > .form-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px 16px;
}

/* Business record lists */
.page-records .main-container {
    width: 100%;
    max-width: none;
    margin: 28px auto 0;
    padding: 0 18px;
}

.records-hero {
    margin-bottom: 18px;
    padding: 22px 26px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 22px;
    background: #ffffff;
    border: 1px solid #e1e7ef;
    border-right: 4px solid var(--brand-color);
    border-radius: 13px;
    box-shadow: 0 7px 22px rgba(15, 23, 42, 0.05);
}

.records-hero h1 {
    margin: 4px 0 3px;
    color: #172033;
    font-family: var(--font-display);
    font-size: clamp(1.55rem, 3vw, 2rem);
}

.records-hero p {
    margin: 0;
    color: #718096;
    font-size: 12px;
}

.records-hero-actions {
    display: flex;
    align-items: center;
    gap: 14px;
}

.records-total {
    display: flex;
    flex-direction: column;
    color: #8492a6;
    font-size: 10px;
    text-align: center;
}

.records-total strong {
    color: #253247;
    font-size: 1.45rem;
    line-height: 1.2;
}

.page-records .search-container {
    margin-bottom: 12px;
    padding: 14px 16px;
    background: #ffffff;
    border: 1px solid #e1e7ef;
    border-radius: 11px;
    box-shadow: 0 4px 14px rgba(15, 23, 42, 0.04);
}

.page-records .search-box {
    max-width: 620px;
}

.page-records .search-box input {
    height: 42px;
    padding: 0 42px 0 14px;
    background: #f9fafc;
    border: 1px solid #dce3eb;
    border-radius: 8px;
    font-size: 12px;
    box-shadow: none;
}

.page-records .view-toggle {
    display: none;
}

.page-records .table-view {
    width: 100%;
    max-width: 100%;
    overflow: auto;
    background: #ffffff;
    border: 1px solid #dfe6ee;
    border-radius: 11px;
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.05);
}

.page-records .records-table {
    width: 100%;
    min-width: 980px;
    border-radius: 0;
    box-shadow: none;
}

.page-replacement-records .records-table {
    min-width: 1320px;
}

.page-records .records-table th {
    padding: 12px 10px;
    color: #e8edf4;
    background: #263449;
    border-bottom: 0;
    font-size: 11px;
    font-weight: 700;
}

.page-records .records-table td {
    padding: 12px 10px;
    color: #3f4d61;
    border-bottom: 1px solid #edf1f5;
    font-size: 12px;
}

.page-records .records-table tbody tr:hover,
.page-records .records-table tbody tr:hover td {
    background: #f7f9fc;
    transform: none;
}

.page-records .device-card {
    border: 1px solid #e1e7ef;
    border-radius: 12px;
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.05);
}

.page-records .device-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.08);
}

.records-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 8px;
    margin: 22px 0 8px;
    direction: rtl;
}

.pagination-btn {
    min-width: 40px;
    height: 40px;
    padding: 0 12px;
    border: 1px solid #dbe3ed;
    border-radius: 10px;
    background: #fff;
    color: #334155;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
    transition: 0.2s ease;
}

.pagination-btn:hover:not(:disabled),
.pagination-btn.active {
    border-color: var(--brand-color);
    background: var(--brand-color);
    color: #fff;
    box-shadow: 0 7px 18px rgba(161, 40, 52, 0.18);
}

.pagination-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.pagination-gap,
.pagination-summary {
    color: #64748b;
    font-size: 0.84rem;
}

.pagination-summary {
    margin-inline-start: 8px;
    padding-inline-start: 14px;
    border-inline-start: 1px solid #dbe3ed;
}

.page-records .card-header {
    padding: 17px 20px;
    color: #ffffff;
    background: #263449;
}

.page-records .card-header .device-id {
    color: #ffffff;
    font-size: 1rem;
    text-shadow: none;
}

.page-records .card-body {
    padding: 20px;
}

.page-records .card-section h4 {
    color: #253247;
    font-size: 14px;
    text-shadow: none;
}

/* Device details */
.page-device-view .device-view-container {
    width: min(1100px, 100%);
    max-width: none !important;
    margin: 28px auto 0;
    padding: 0 28px;
}

.page-device-view .device-view-card {
    margin-top: 0 !important;
    border: 1px solid #e0e7ef;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.07);
}

.page-device-view .device-view-card::before {
    display: none;
}

.page-device-view .device-view-header {
    padding: 24px 28px !important;
    background: #263449 !important;
    border-right: 5px solid var(--device-status-color);
}

.page-device-view .device-view-icon {
    width: 52px !important;
    height: 52px !important;
    border-radius: 12px !important;
    font-size: 21px !important;
}

.page-device-view .device-view-title h1 {
    font-size: 1.7rem !important;
    text-shadow: none !important;
}

.page-device-view .device-view-title p {
    color: #cbd5e1;
    font-size: 12px !important;
}

.page-device-view .device-view-content {
    padding: 26px !important;
}

.page-device-view .device-view-section {
    margin-bottom: 22px !important;
}

.page-device-view .device-view-section h3 {
    margin-bottom: 14px !important;
    padding-bottom: 9px !important;
    color: #253247 !important;
    border-bottom: 1px solid #e4e9f0 !important;
    font-size: 14px !important;
}

.page-device-view .card-item {
    background: #f9fafc;
    border: 1px solid #e5eaf0;
    border-radius: 9px;
    box-shadow: none;
}

.page-device-view .device-view-actions {
    padding: 18px 26px !important;
    justify-content: flex-start !important;
}

.page-device-view .device-view-actions .btn {
    padding: 10px 16px !important;
    border-radius: 8px;
    box-shadow: none;
    font-size: 12px !important;
    transform: none;
}

/* Administration and dashboard shell */
.page-activity-log .log-page-container,
.page-user-management .form-page-container,
.page-dashboard .dashboard-modern {
    width: 100%;
    max-width: none !important;
    margin: 28px auto 0;
    padding: 0 18px;
}

.page-activity-log .log-page-card,
.page-user-management .form-page-card {
    padding: 24px;
    background: #ffffff;
    border: 1px solid #e0e7ef;
    border-radius: 14px;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.06);
}

.admin-page-heading {
    margin-bottom: 24px;
    padding: 22px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    background: linear-gradient(135deg, #f9fafc 0%, #ffffff 70%);
    border: 1px solid #e0e7ef;
    border-right: 4px solid var(--brand-color);
    border-radius: 12px;
}

.admin-page-heading h1 {
    margin: 8px 0 3px;
    color: #172033;
    font-size: clamp(1.45rem, 2vw, 1.8rem);
}

.admin-page-heading h1 i {
    margin-left: 7px;
    color: var(--brand-color);
    font-size: 0.82em;
}

.admin-page-heading p {
    margin: 0;
    color: #64748b;
    font-size: 13px;
}

.admin-heading-count {
    flex: 0 0 auto;
    min-width: 130px;
    padding: 12px 16px;
    color: #526176;
    background: #f1f4f8;
    border: 1px solid #e0e6ee;
    border-radius: 9px;
    text-align: center;
    font-size: 12px;
}

.admin-heading-count strong {
    margin-left: 4px;
    color: #172033;
    font-size: 1.1rem;
}

.page-activity-log .form-section,
.page-user-management .form-section,
.page-dashboard .form-page-card {
    background: #ffffff;
    border: 1px solid #e3e9f0;
    border-radius: 11px;
    box-shadow: 0 5px 16px rgba(15, 23, 42, 0.045);
}

.page-activity-log .devices-table th,
.page-user-management .devices-table th,
.page-dashboard .devices-table th {
    color: #e8edf4;
    background: #263449;
}

.page-activity-log .btn-primary,
.page-user-management .btn-primary,
.page-dashboard .btn-primary {
    background: #243247 !important;
    border-color: #243247 !important;
}

.page-dashboard .dashboard-modern > div:first-child {
    padding: 20px 22px;
    background: #ffffff;
    border: 1px solid #e1e7ef;
    border-right: 4px solid var(--brand-color);
    border-radius: 12px;
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.05);
}

.page-dashboard .dashboard-heading h2 i {
    margin-left: 7px;
    color: var(--brand-color);
    font-size: 0.82em;
}

.page-dashboard .dashboard-search {
    min-width: min(340px, 100%);
}

.page-dashboard .dashboard-modern input[name="search"] {
    border-radius: 9px !important;
    box-shadow: none !important;
}

.page-dashboard .dashboard-modern form button[type="submit"] {
    background: #243247 !important;
    box-shadow: none !important;
}

.page-dashboard .form-page-card > div:first-child[style*="gradient-primary"] {
    background: #263449 !important;
}

/* User editor */
.page-user-editor .form-container {
    width: min(820px, calc(100% - 36px));
    max-width: none !important;
    margin: 28px auto 0;
    padding: 28px;
}

.page-user-editor .form-container h1 {
    margin: 0 0 24px;
    color: #172033;
    font-size: 1.65rem;
}

.page-user-editor .form-section {
    margin-bottom: 16px;
    padding: 20px;
    background: #f9fafc;
    border: 1px solid #e4e9f0;
    border-radius: 10px;
}

.page-user-editor .form-section-title {
    margin-top: 0;
    color: #253247;
    font-size: 14px;
}

@media (max-width: 850px) {
    .page-device-editor form > .form-grid,
    .page-record-form form > .form-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .records-hero {
        align-items: flex-start;
        flex-direction: column;
    }
}

@media (max-width: 700px) {
    .page-records .table-view {
        display: none;
    }

    .page-records .cards-view {
        display: block;
    }

    .page-device-editor .form-page-container,
    .page-record-form .form-page-container,
    .page-device-view .device-view-container {
        margin-top: 18px;
        padding-inline: 16px;
    }

    .page-device-editor form > .form-grid,
    .page-record-form form > .form-grid {
        grid-template-columns: 1fr;
    }

    .page-device-view .device-view-header,
    .page-device-view .device-view-title,
    .page-device-view .device-view-actions {
        align-items: flex-start !important;
        flex-direction: column;
    }

    .page-device-view .device-view-status {
        text-align: right !important;
    }

    .admin-page-heading,
    .page-dashboard .dashboard-heading {
        align-items: stretch !important;
        flex-direction: column;
    }

    .admin-heading-count,
    .page-dashboard .dashboard-search {
        width: 100%;
        max-width: none !important;
        min-width: 0;
    }
}

@media (max-width: 520px) {
    .records-hero-actions,
    .page-device-editor .form-actions,
    .page-record-form .form-actions,
    .page-user-editor .form-actions {
        width: 100%;
        align-items: stretch !important;
        flex-direction: column;
    }

    .records-hero-actions .workspace-btn,
    .page-device-editor .form-actions .btn,
    .page-record-form .form-actions .btn,
    .page-user-editor .form-actions .btn {
        width: 100%;
    }
}

/* --- 27. Operational dashboard --- */
.page-dashboard {
    --dashboard-navy: #243247;
    --dashboard-navy-deep: #172033;
    --dashboard-red: #a12834;
    --dashboard-red-bright: #d92332;
    --dashboard-surface: #ffffff;
    --dashboard-muted: #667085;
    --dashboard-border: #e4e9f0;
    --dashboard-bg: #f3f5f8;
    background:
        radial-gradient(circle at 88% 4%, rgba(161, 40, 52, 0.06), transparent 27rem),
        var(--dashboard-bg);
}

.page-dashboard .main-content-wrapper {
    width: 100%;
}

.sr-only {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

.mobile-nav-account {
    display: none;
}

.dashboard-shell {
    width: min(1500px, 100%);
    margin: 0 auto;
    padding: 28px 26px 12px;
}

.dashboard-hero {
    position: relative;
    isolation: isolate;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(440px, 0.75fr);
    align-items: center;
    gap: 34px;
    min-height: 216px;
    padding: 34px 38px;
    overflow: hidden;
    color: #ffffff;
    background: linear-gradient(125deg, var(--dashboard-navy-deep) 0%, var(--dashboard-navy) 64%, #324157 100%);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 20px;
    box-shadow: 0 18px 44px rgba(23, 32, 51, 0.18);
}

.dashboard-hero::before {
    content: '';
    position: absolute;
    z-index: -1;
    top: -95px;
    right: -75px;
    width: 330px;
    height: 330px;
    background: rgba(217, 35, 50, 0.22);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 50%;
}

.dashboard-hero::after {
    content: '';
    position: absolute;
    z-index: -1;
    bottom: -120px;
    left: 28%;
    width: 290px;
    height: 290px;
    background: rgba(255, 255, 255, 0.035);
    border-radius: 50%;
}

.dashboard-hero .workspace-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 7px 11px;
    color: #ffe3e5;
    background: rgba(217, 35, 50, 0.18);
    border: 1px solid rgba(255, 187, 192, 0.22);
    border-radius: 999px;
    font-size: 12px;
    font-weight: 800;
}

.dashboard-hero-copy h2 {
    margin: 13px 0 4px;
    color: #ffffff;
    font-family: var(--font-display);
    font-size: clamp(1.75rem, 2.5vw, 2.45rem);
    font-weight: 900;
    letter-spacing: -0.03em;
}

.dashboard-hero-copy > p {
    margin: 0;
    color: #cbd5e1;
    font-size: 14px;
}

.dashboard-context {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 20px;
}

.dashboard-context span {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 7px 10px;
    color: #dce3ec;
    background: rgba(255, 255, 255, 0.07);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    font-size: 12px;
    font-weight: 650;
}

.dashboard-hero-actions {
    display: flex;
    align-items: stretch;
    gap: 11px;
}

.dashboard-search {
    position: relative;
    flex: 1 1 auto;
    min-width: 0;
}

.dashboard-search-icon {
    position: absolute;
    z-index: 1;
    top: 50%;
    right: 16px;
    color: #8b96a7;
    transform: translateY(-50%);
    pointer-events: none;
}

.page-dashboard .dashboard-search input[type='search'] {
    width: 100%;
    height: 54px;
    padding: 0 45px 0 78px;
    color: #172033;
    background: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.6);
    border-radius: 11px;
    box-shadow: 0 8px 20px rgba(7, 13, 23, 0.14);
    outline: none;
    font-family: var(--font-main);
    font-size: 13px;
}

.page-dashboard .dashboard-search input[type='search']:focus {
    border-color: #f6a9af;
    box-shadow: 0 0 0 4px rgba(217, 35, 50, 0.18), 0 8px 20px rgba(7, 13, 23, 0.14);
}

.page-dashboard .dashboard-search button[type='submit'] {
    position: absolute;
    top: 7px;
    bottom: 7px;
    left: 7px;
    min-width: 62px;
    padding: 0 13px;
    color: #ffffff;
    background: var(--dashboard-navy) !important;
    border: 0;
    border-radius: 8px;
    box-shadow: none !important;
    cursor: pointer;
    font-family: var(--font-main);
    font-size: 12px;
    font-weight: 800;
}

.page-dashboard .dashboard-search button[type='submit']:hover {
    background: var(--dashboard-red) !important;
}

.dashboard-primary-action {
    flex: 0 0 auto;
    min-width: 162px;
    height: 54px;
    padding: 0 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    color: #ffffff;
    background: linear-gradient(135deg, var(--dashboard-red-bright), var(--dashboard-red));
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 11px;
    box-shadow: 0 9px 22px rgba(161, 40, 52, 0.3);
    text-decoration: none;
    font-size: 13px;
    font-weight: 850;
}

.dashboard-primary-action:hover {
    color: #ffffff;
    transform: translateY(-2px);
    box-shadow: 0 12px 26px rgba(161, 40, 52, 0.36);
}

.dashboard-shell a:focus-visible,
.dashboard-shell button:focus-visible,
.dashboard-shell input:focus-visible {
    outline: 3px solid rgba(217, 35, 50, 0.34);
    outline-offset: 3px;
}

.dashboard-alert {
    margin-top: 18px;
    padding: 13px 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    color: #991b1b;
    background: #fff1f2;
    border: 1px solid #fecdd3;
    border-radius: 11px;
    font-size: 13px;
    font-weight: 700;
}

.dashboard-kpis {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    margin-top: 18px;
}

.dashboard-kpi {
    position: relative;
    min-height: 132px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    overflow: hidden;
    color: var(--dashboard-navy-deep);
    background: var(--dashboard-surface);
    border: 1px solid var(--dashboard-border);
    border-radius: 15px;
    box-shadow: 0 7px 22px rgba(15, 23, 42, 0.055);
    text-decoration: none;
}

.dashboard-kpi::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 4px;
    background: #64748b;
}

.dashboard-kpi:hover {
    color: var(--dashboard-navy-deep);
    border-color: #ccd4df;
    transform: translateY(-3px);
    box-shadow: 0 13px 28px rgba(15, 23, 42, 0.09);
}

.dashboard-kpi-icon {
    flex: 0 0 auto;
    width: 48px;
    height: 48px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #475569;
    background: #eef2f6;
    border-radius: 13px;
    font-size: 19px;
}

.dashboard-kpi-copy {
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.dashboard-kpi-copy small {
    color: #667085;
    font-size: 11px;
    font-weight: 800;
}

.dashboard-kpi-copy strong {
    margin: 1px 0;
    color: #172033;
    font-family: var(--font-display);
    font-size: 2rem;
    line-height: 1.2;
}

.dashboard-kpi-copy em {
    overflow: hidden;
    color: #98a2b3;
    font-size: 10px;
    font-style: normal;
    font-weight: 650;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dashboard-kpi-arrow {
    margin-right: auto;
    color: #c3cad4;
    font-size: 12px;
}

.kpi-active::before { background: var(--dashboard-navy); }
.kpi-active .dashboard-kpi-icon { color: #334155; background: #edf1f5; }
.kpi-overdue::before { background: var(--dashboard-red-bright); }
.kpi-overdue .dashboard-kpi-icon { color: #c81e2c; background: #fff0f1; }
.kpi-delivery::before { background: #2563eb; }
.kpi-delivery .dashboard-kpi-icon { color: #2563eb; background: #eff6ff; }
.kpi-completed::before { background: #15803d; }
.kpi-completed .dashboard-kpi-icon { color: #15803d; background: #eefbf3; }

.dashboard-work-grid,
.dashboard-insights-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) minmax(360px, 0.85fr);
    align-items: start;
    gap: 18px;
    margin-top: 18px;
}

.dashboard-insights-grid {
    grid-template-columns: minmax(0, 1.55fr) minmax(340px, 0.65fr);
}

.dashboard-panel {
    min-width: 0;
    padding: 23px;
    background: var(--dashboard-surface);
    border: 1px solid var(--dashboard-border);
    border-radius: 16px;
    box-shadow: 0 7px 22px rgba(15, 23, 42, 0.05);
    scroll-margin-top: 92px;
}

.dashboard-panel-priority {
    border-top: 3px solid var(--dashboard-red);
}

.dashboard-panel-header {
    margin-bottom: 18px;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
}

.dashboard-panel-header-inline {
    align-items: center;
}

.panel-kicker {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: #667085;
    font-size: 10px;
    font-weight: 850;
}

.panel-kicker-danger { color: #b4232e; }
.panel-kicker-blue { color: #1d4ed8; }

.dashboard-panel-header h3 {
    margin: 3px 0 0;
    color: #172033;
    font-family: var(--font-display);
    font-size: 1.18rem;
    font-weight: 900;
}

.dashboard-panel-header p {
    margin: 3px 0 0;
    color: #8490a1;
    font-size: 11px;
}

.panel-count {
    flex: 0 0 auto;
    min-width: 44px;
    height: 34px;
    padding: 0 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #475569;
    background: #f1f4f7;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 900;
}

.panel-count-danger { color: #b4232e; background: #fff0f1; }
.panel-count-blue { color: #1d4ed8; background: #eff6ff; }

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

.work-item {
    min-height: 74px;
    padding: 13px 11px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    align-items: center;
    gap: 15px;
    border-top: 1px solid #edf0f4;
}

.work-item:first-child {
    border-top: 0;
}

.work-item:hover {
    background: #fafbfc;
    border-radius: 10px;
}

.work-item-overdue {
    border-right: 3px solid transparent;
}

.work-item-overdue:hover {
    border-right-color: var(--dashboard-red);
}

.work-item-main {
    min-width: 0;
}

.work-item-title {
    display: block;
    overflow: hidden;
    color: #253247;
    text-decoration: none;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 13px;
    font-weight: 850;
}

.work-item-title:hover {
    color: var(--dashboard-red);
}

.work-item-meta {
    margin-top: 6px;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    color: #8b96a7;
    font-size: 10px;
}

.work-item-meta > span:not(.status-badge) {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.work-item-meta .status-badge {
    padding: 3px 7px;
    font-size: 9px;
}

.work-item-age {
    min-width: 58px;
    display: flex;
    flex-direction: column;
    align-items: center;
    color: #b4232e;
}

.work-item-age strong {
    font-size: 18px;
    line-height: 1.1;
}

.work-item-age span {
    font-size: 9px;
    font-weight: 750;
}

.work-item-actions,
.dashboard-row-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}

.work-item-actions a,
.dashboard-row-actions a {
    width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #526176;
    background: #f5f7fa;
    border: 1px solid #e3e8ee;
    border-radius: 8px;
    text-decoration: none;
    font-size: 11px;
}

.work-item-actions a:hover,
.dashboard-row-actions a:hover {
    color: #ffffff;
    background: var(--dashboard-navy);
    border-color: var(--dashboard-navy);
    transform: translateY(-1px);
}

.work-item-actions a:first-child:hover {
    background: #15803d;
    border-color: #15803d;
}

.panel-footer-note {
    margin: 12px -2px -2px;
    padding: 10px 12px;
    color: #7a8798;
    background: #f8fafc;
    border-radius: 8px;
    text-align: center;
    font-size: 10px;
    font-weight: 650;
}

.dashboard-empty {
    min-height: 210px;
    padding: 30px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #778397;
    background: #f8fafc;
    border: 1px dashed #d8dee7;
    border-radius: 12px;
    text-align: center;
}

.dashboard-empty i {
    margin-bottom: 12px;
    color: #9aa5b4;
    font-size: 28px;
}

.dashboard-empty strong {
    color: #344054;
    font-size: 13px;
}

.dashboard-empty span {
    margin-top: 4px;
    font-size: 11px;
}

.dashboard-empty-success i { color: #15803d; }

.dashboard-chart-panel {
    min-height: 438px;
}

.dashboard-period {
    padding: 6px 10px;
    color: #526176;
    background: #f1f4f7;
    border-radius: 8px;
    font-size: 10px;
    font-weight: 750;
}

.dashboard-chart-wrap {
    position: relative;
    height: 335px;
    width: 100%;
}

.chart-unavailable {
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #667085;
    background: #f8fafc;
    border-radius: 10px;
    font-size: 12px;
}

.chart-unavailable[hidden] {
    display: none;
}

.dashboard-side-stack {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.status-overview-total {
    color: var(--dashboard-red);
    font-size: 1.35rem;
}

.status-overview-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.status-overview-item {
    display: block;
    color: #344054;
    text-decoration: none;
}

.status-overview-label {
    margin-bottom: 7px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    font-size: 11px;
    font-weight: 750;
}

.status-overview-label strong {
    color: #172033;
}

.status-progress {
    height: 6px;
    overflow: hidden;
    background: #edf0f4;
    border-radius: 999px;
}

.status-progress span {
    display: block;
    height: 100%;
    min-width: 2px;
    background: #94a3b8;
    border-radius: inherit;
}

.status-progress .status-progress-blue { background: #3182ce; }
.status-progress .status-progress-yellow { background: #d69e2e; }
.status-progress .status-progress-cashmere { background: #805ad5; }
.status-progress .status-progress-white { background: #94a3b8; }

.quick-actions-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 9px;
}

.quick-actions-grid a {
    min-height: 74px;
    padding: 12px 9px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 7px;
    color: #475569;
    background: #f7f9fb;
    border: 1px solid #e6eaf0;
    border-radius: 10px;
    text-align: center;
    text-decoration: none;
    font-size: 10px;
    font-weight: 800;
}

.quick-actions-grid a i {
    color: var(--dashboard-red);
    font-size: 15px;
}

.quick-actions-grid a:hover {
    color: #ffffff;
    background: var(--dashboard-navy);
    border-color: var(--dashboard-navy);
    transform: translateY(-2px);
}

.quick-actions-grid a:hover i {
    color: #ffffff;
}

.recent-devices-panel,
.recent-activity-panel,
.dashboard-search-results {
    margin-top: 18px;
}

.panel-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--dashboard-red);
    text-decoration: none;
    font-size: 10px;
    font-weight: 850;
}

.panel-link:hover {
    color: var(--dashboard-navy);
}

.dashboard-table-wrap {
    width: 100%;
    overflow-x: auto;
}

.page-dashboard .dashboard-table {
    width: 100%;
    margin: 0;
    border-collapse: separate;
    border-spacing: 0;
    table-layout: auto;
}

.page-dashboard .dashboard-table thead th {
    padding: 12px 14px;
    color: #e9eef5;
    background: var(--dashboard-navy);
    border: 0;
    font-size: 10px;
    font-weight: 800;
    white-space: nowrap;
}

.page-dashboard .dashboard-table thead th:first-child {
    border-radius: 0 9px 9px 0;
}

.page-dashboard .dashboard-table thead th:last-child {
    border-radius: 9px 0 0 9px;
}

.page-dashboard .dashboard-table tbody td {
    padding: 13px 14px;
    color: #526176;
    background: #ffffff;
    border-bottom: 1px solid #edf0f4;
    font-size: 11px;
    vertical-align: middle;
}

.page-dashboard .dashboard-table tbody tr:hover td {
    background: #fafbfc;
}

.page-dashboard .dashboard-table td strong {
    display: block;
    color: #253247;
    font-size: 11px;
}

.page-dashboard .dashboard-table td small {
    display: block;
    margin-top: 2px;
    color: #98a2b3;
    font-size: 9px;
    direction: ltr;
    text-align: right;
}

.page-dashboard .dashboard-table .status-badge {
    padding: 5px 8px;
    font-size: 9px;
    white-space: nowrap;
}

.dashboard-table-empty {
    height: 120px;
    color: #8490a1 !important;
    text-align: center;
}

.activity-strip {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
}

.activity-strip article {
    min-width: 0;
    padding: 13px;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    background: #f8fafc;
    border: 1px solid #edf0f4;
    border-radius: 10px;
}

.activity-avatar {
    flex: 0 0 auto;
    width: 31px;
    height: 31px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--dashboard-red);
    background: #fff0f1;
    border-radius: 9px;
    font-size: 11px;
}

.activity-strip article > div {
    min-width: 0;
}

.activity-strip strong {
    color: #344054;
    font-size: 10px;
}

.activity-strip p {
    margin: 2px 0;
    overflow: hidden;
    color: #667085;
    font-size: 9px;
    line-height: 1.55;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.activity-strip time {
    color: #a0a9b7;
    font-size: 8px;
}

.search-results-header p {
    margin-top: 6px;
}

.search-result-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.dashboard-secondary-button {
    min-height: 38px;
    padding: 0 13px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    color: #475569;
    background: #f5f7fa;
    border: 1px solid #dfe5ec;
    border-radius: 8px;
    cursor: pointer;
    text-decoration: none;
    font-family: var(--font-main);
    font-size: 10px;
    font-weight: 800;
}

.dashboard-secondary-button:hover {
    color: #ffffff;
    background: var(--dashboard-navy);
    border-color: var(--dashboard-navy);
}

.dashboard-search-empty {
    min-height: 330px;
}

.search-limit-note {
    margin-bottom: 14px;
    padding: 10px 12px;
    color: #1e40af;
    background: #eff6ff;
    border: 1px solid #dbeafe;
    border-radius: 8px;
    font-size: 10px;
    font-weight: 700;
}

@media (max-width: 1180px) {
    .dashboard-hero {
        grid-template-columns: 1fr;
        gap: 24px;
    }

    .dashboard-hero-actions {
        max-width: 760px;
    }

    .dashboard-kpis {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .dashboard-work-grid,
    .dashboard-insights-grid {
        grid-template-columns: 1fr;
    }

    .dashboard-side-stack {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 850px) {
    .dashboard-shell {
        padding: 20px 16px 8px;
    }

    .dashboard-hero {
        padding: 28px 24px;
        border-radius: 17px;
    }

    .dashboard-work-grid,
    .dashboard-insights-grid,
    .recent-devices-panel,
    .recent-activity-panel,
    .dashboard-search-results {
        margin-top: 14px;
    }

    .activity-strip {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .mobile-nav-account {
        margin-top: 14px;
        padding-top: 14px;
        display: block;
        border-top: 1px solid #e4e9f0;
    }

    .mobile-nav-user {
        padding: 10px 12px;
        display: flex;
        align-items: center;
        gap: 10px;
        color: #344054;
        background: #f7f9fb;
        border-radius: 9px;
    }

    .mobile-nav-user > i {
        color: var(--brand-color);
        font-size: 23px;
    }

    .mobile-nav-user span {
        display: flex;
        flex-direction: column;
        line-height: 1.45;
    }

    .mobile-nav-user strong {
        font-size: 12px;
    }

    .mobile-nav-user small {
        color: #7a8798;
        font-size: 9px;
    }

    .mobile-nav-account-actions {
        margin-top: 8px;
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 7px;
    }

    .mobile-nav-account-actions a,
    .mobile-nav-account-actions button {
        width: 100%;
        min-height: 38px;
        padding: 7px 10px;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 6px;
        color: #475569;
        background: #ffffff;
        border: 1px solid #dfe5ec;
        border-radius: 8px;
        cursor: pointer;
        text-decoration: none;
        font-family: var(--font-main);
        font-size: 10px;
        font-weight: 800;
    }

    .mobile-nav-account-actions form {
        margin: 0;
    }

    .mobile-nav-account-actions button {
        color: #b4232e;
        background: #fff5f5;
        border-color: #fecdd3;
    }
}

@media (max-width: 680px) {
    .dashboard-shell {
        padding-inline: 12px;
    }

    .dashboard-hero {
        min-height: auto;
        padding: 24px 18px;
    }

    .dashboard-hero-copy h2 {
        font-size: 1.65rem;
    }

    .dashboard-hero-actions {
        flex-direction: column;
    }

    .dashboard-primary-action {
        width: 100%;
    }

    .dashboard-kpis {
        grid-template-columns: 1fr;
        gap: 10px;
        margin-top: 12px;
    }

    .dashboard-kpi {
        min-height: 105px;
        padding: 15px 17px;
    }

    .dashboard-kpi-copy strong {
        font-size: 1.75rem;
    }

    .dashboard-work-grid,
    .dashboard-insights-grid {
        gap: 12px;
        margin-top: 12px;
    }

    .dashboard-panel {
        padding: 17px;
        border-radius: 13px;
    }

    .dashboard-panel-header {
        gap: 10px;
    }

    .dashboard-panel-header p {
        line-height: 1.5;
    }

    .work-item {
        padding: 14px 4px;
        grid-template-columns: minmax(0, 1fr) auto;
        gap: 10px;
    }

    .work-item-age {
        order: 2;
    }

    .work-item-actions {
        grid-column: 1 / -1;
        justify-content: flex-end;
    }

    .work-item-actions a {
        width: 38px;
        height: 36px;
    }

    .dashboard-side-stack {
        display: flex;
    }

    .dashboard-chart-panel {
        min-height: 350px;
    }

    .dashboard-chart-wrap {
        height: 260px;
    }

    .dashboard-panel-header-inline.search-results-header {
        align-items: flex-start;
        flex-direction: column;
    }

    .search-result-actions {
        width: 100%;
    }

    .dashboard-secondary-button {
        flex: 1;
    }

    .dashboard-table-wrap {
        overflow: visible;
    }

    .page-dashboard .dashboard-table,
    .page-dashboard .dashboard-table tbody,
    .page-dashboard .dashboard-table tr,
    .page-dashboard .dashboard-table td {
        display: block;
        width: 100%;
    }

    .page-dashboard .dashboard-table thead {
        display: none;
    }

    .page-dashboard .dashboard-table tbody {
        display: grid;
        gap: 11px;
    }

    .page-dashboard .dashboard-table tbody tr {
        padding: 10px 13px;
        background: #ffffff;
        border: 1px solid #e5e9ef;
        border-radius: 11px;
        box-shadow: 0 4px 12px rgba(15, 23, 42, 0.04);
    }

    .page-dashboard .dashboard-table tbody td {
        min-height: 34px;
        padding: 7px 0;
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 14px;
        background: transparent !important;
        border-bottom: 1px solid #f0f2f5;
        text-align: left;
    }

    .page-dashboard .dashboard-table tbody td:last-child {
        border-bottom: 0;
    }

    .page-dashboard .dashboard-table tbody td::before {
        content: attr(data-label);
        color: #8a95a5;
        text-align: right;
        font-size: 9px;
        font-weight: 750;
    }

    .page-dashboard .dashboard-table td strong,
    .page-dashboard .dashboard-table td small {
        text-align: left;
    }

    .dashboard-table-empty {
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        border: 0 !important;
    }

    .dashboard-table-empty::before {
        display: none;
    }

    .activity-strip {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 430px) {
    .dashboard-context {
        gap: 7px;
    }

    .dashboard-context span {
        flex: 1 1 auto;
        justify-content: center;
    }

    .page-dashboard .dashboard-search input[type='search'] {
        height: 50px;
        padding-left: 66px;
        font-size: 11px;
    }

    .dashboard-primary-action {
        height: 50px;
    }

    .dashboard-kpi-copy em {
        max-width: 190px;
    }

    .dashboard-panel-header h3 {
        font-size: 1.05rem;
    }

    .quick-actions-grid {
        grid-template-columns: 1fr 1fr;
    }
}

@media (prefers-reduced-motion: reduce) {
    .page-dashboard *,
    .page-dashboard *::before,
    .page-dashboard *::after {
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
    }
}


/* Phase three: existing navy/red palette and Tajawal; native RTL flow. */
.phase3-link-fields { margin-block: 20px; padding: 20px; border: 1px solid #dfe6ee; border-radius: 12px; min-width: 0; }
.phase3-link-fields legend { padding-inline: 8px; font-weight: 800; }
.phase3-actions { display: flex; flex-wrap: wrap; gap: 12px; padding: 20px; }
.phase3-backup section { padding-block: 24px; border-bottom: 1px solid #dfe6ee; }
.phase3-backup form { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-block: 16px; }
.phase3-backup form .form-grid { width: 100%; }
.phase3-backup p, .phase3-history p { line-height: 1.8; }
.device-timeline { list-style: none; margin-block: 24px; padding-inline-start: 24px; border-inline-start: 2px solid #dfe6ee; }
.device-timeline > li { position: relative; padding-block: 0 24px; }
.device-timeline > li::before { content: ''; position: absolute; inset-inline-start: -30px; top: 7px; width: 10px; height: 10px; border-radius: 50%; background: #a12834; }
.device-timeline h2 { font-size: 18px; margin-block: 0 8px; color: #263449; }
.timeline-meta { color: #526278; font-size: 14px; }
.device-timeline dl { display: grid; grid-template-columns: minmax(100px, 160px) minmax(0, 1fr); gap: 12px; margin-block: 16px; }
.device-timeline dt { font-weight: 700; }
.device-timeline dd { margin: 0; overflow-wrap: anywhere; }
.device-timeline summary { cursor: pointer; padding-block: 10px; }
.replacement-link-summary { max-width: 210mm; margin: 12px auto; padding: 12px; font-family: Tajawal, sans-serif; }
@media (max-width: 600px) { .device-timeline dl { grid-template-columns: 1fr; gap: 6px; } .device-timeline dd { margin-block-end: 12px; } .phase3-actions .btn { flex: 1; } }

.phase3-history, .phase3-backup { text-align: start; padding: clamp(20px, 4vw, 40px); }
.phase3-history h1, .phase3-backup h1 { font-family: inherit; font-size: 26px; line-height: 1.5; margin: 0 0 16px; text-align: start; }
.phase3-history h2, .phase3-backup h2 { font-family: inherit; font-size: 20px; line-height: 1.5; margin: 0 0 16px; color: #263449; text-align: start; }
.phase3-history p, .phase3-backup p { text-align: start; }
.phase3-history .phase3-actions { padding: 12px 0 24px; }
.phase3-history .phase3-actions .btn { flex: 0 1 auto; min-width: 145px; }
.phase3-backup li { text-align: start; padding-block: 4px; }
@media (max-width: 600px) { .phase3-history .phase3-actions .btn { flex: 1 1 100%; } .phase3-history h1, .phase3-backup h1 { font-size: 23px; } }
