/* ============================================
   DMGrid Design System
   Oman-Inspired Legal Document Management
   ============================================ */

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

/* --- CSS Custom Properties --- */
:root {
    --primary: #0A3D3D;
    --primary-light: #0D5555;
    --primary-dark: #072E2E;
    --accent: #C9A96E;
    --accent-light: #D4BA87;
    --accent-dark: #B8944D;
    --bg: #F5F2ED;
    --bg-card: #FFFFFF;
    --bg-sidebar: #0A2E2E;
    --text-primary: #1A1A1A;
    --text-secondary: #6B7280;
    --text-light: #9CA3AF;
    --text-white: #FFFFFF;
    --border: #E5E7EB;
    --border-light: #F3F4F6;
    --success: #10B981;
    --success-bg: #ECFDF5;
    --warning: #F59E0B;
    --warning-bg: #FFFBEB;
    --danger: #EF4444;
    --danger-bg: #FEF2F2;
    --info: #3B82F6;
    --info-bg: #EFF6FF;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.1);
    --shadow-lg: 0 8px 32px rgba(0,0,0,0.12);
    --shadow-xl: 0 20px 60px rgba(0,0,0,0.15);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --sidebar-width: 260px;
}

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

html { font-size: 15px; scroll-behavior: smooth; }

body {
    font-family: 'Inter', 'Noto Kufi Arabic', -apple-system, system-ui, sans-serif;
    background: var(--bg);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

a { color: var(--primary); text-decoration: none; transition: var(--transition); }
a:hover { color: var(--accent); }

img { max-width: 100%; }

/* --- Layout --- */
.app-layout { display: flex; min-height: 100vh; }

.sidebar {
    width: var(--sidebar-width);
    background: linear-gradient(180deg, var(--bg-sidebar) 0%, #061E1E 100%);
    color: var(--text-white);
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 100;
    display: flex;
    flex-direction: column;
    transition: var(--transition);
    overflow-y: auto;
}

.sidebar-brand {
    padding: 24px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}

.sidebar-brand .brand-icon {
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, var(--accent), var(--accent-dark));
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--primary-dark);
    flex-shrink: 0;
}

.sidebar-brand .brand-text {
    display: flex;
    flex-direction: column;
}

.sidebar-brand .brand-text h1 {
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: -0.5px;
    line-height: 1.2;
}

.sidebar-brand .brand-text span {
    font-size: 0.7rem;
    color: var(--accent-light);
    letter-spacing: 1.5px;
    text-transform: uppercase;
    font-weight: 500;
}

.sidebar-nav { padding: 16px 0; flex: 1; }

.nav-section {
    padding: 0 16px;
    margin-bottom: 8px;
}

.nav-section-title {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: rgba(255,255,255,0.35);
    padding: 12px 12px 6px;
    font-weight: 600;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    color: rgba(255,255,255,0.7);
    font-size: 0.88rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    position: relative;
    margin-bottom: 2px;
}

.nav-item:hover {
    background: rgba(255,255,255,0.06);
    color: #fff;
}

.nav-item.active {
    background: rgba(201,169,110,0.15);
    color: var(--accent-light);
}

.nav-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 24px;
    background: var(--accent);
    border-radius: 0 3px 3px 0;
}

.nav-item .nav-icon {
    width: 20px;
    text-align: center;
    font-size: 1.05rem;
    flex-shrink: 0;
}

.nav-item .nav-badge {
    margin-left: auto;
    background: var(--accent);
    color: var(--primary-dark);
    font-size: 0.65rem;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 10px;
    min-width: 20px;
    text-align: center;
}

.sidebar-footer {
    padding: 16px;
    border-top: 1px solid rgba(255,255,255,0.08);
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px;
    border-radius: var(--radius-sm);
}

.sidebar-user .user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), var(--primary));
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.85rem;
    color: #fff;
    flex-shrink: 0;
}

.sidebar-user .user-info {
    flex: 1;
    min-width: 0;
}

.sidebar-user .user-name {
    font-size: 0.82rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-user .user-role {
    font-size: 0.68rem;
    color: rgba(255,255,255,0.5);
}

/* --- Main Content --- */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-height: 100vh;
}

/* --- Top Bar --- */
.topbar {
    background: var(--bg-card);
    padding: 16px 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 50;
    backdrop-filter: blur(20px);
    background: rgba(255,255,255,0.9);
}

.topbar-left { display: flex; align-items: center; gap: 16px; }

.topbar-left h2 {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.5px;
}

.topbar-left .breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.topbar-left .breadcrumb a { color: var(--text-secondary); }
.topbar-left .breadcrumb a:hover { color: var(--primary); }

.topbar-right { display: flex; align-items: center; gap: 16px; }

.topbar-btn {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
    position: relative;
    font-size: 1.1rem;
}

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

.topbar-btn .badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: var(--danger);
    color: #fff;
    font-size: 0.6rem;
    font-weight: 700;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--bg-card);
}

/* --- Page Content --- */
.page-content { padding: 28px 32px; }

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

.page-header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.5px;
}

.page-header p {
    color: var(--text-secondary);
    font-size: 0.88rem;
    margin-top: 4px;
}

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

.card:hover { box-shadow: var(--shadow-md); }

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

.card-header h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.card-body { padding: 24px; }

/* --- Stats Grid --- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 28px;
}

.stat-card {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    padding: 24px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
}

.stat-card.total::before { background: linear-gradient(90deg, var(--primary), var(--primary-light)); }
.stat-card.pending::before { background: linear-gradient(90deg, var(--warning), #FBBF24); }
.stat-card.approved::before { background: linear-gradient(90deg, var(--success), #34D399); }
.stat-card.rejected::before { background: linear-gradient(90deg, var(--danger), #F87171); }
.stat-card.draft::before { background: linear-gradient(90deg, var(--info), #60A5FA); }
.stat-card.returned::before { background: linear-gradient(90deg, #8B5CF6, #A78BFA); }

.stat-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.stat-card .stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    margin-bottom: 16px;
}

.stat-card.total .stat-icon { background: rgba(10,61,61,0.1); color: var(--primary); }
.stat-card.pending .stat-icon { background: var(--warning-bg); color: var(--warning); }
.stat-card.approved .stat-icon { background: var(--success-bg); color: var(--success); }
.stat-card.rejected .stat-icon { background: var(--danger-bg); color: var(--danger); }
.stat-card.draft .stat-icon { background: var(--info-bg); color: var(--info); }
.stat-card.returned .stat-icon { background: rgba(139,92,246,0.1); color: #8B5CF6; }

.stat-card .stat-value {
    font-size: 2rem;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1;
    margin-bottom: 4px;
}

.stat-card .stat-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-weight: 500;
}

/* --- Buttons --- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    font-size: 0.88rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: var(--transition);
    border: none;
    text-decoration: none;
    white-space: nowrap;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: #fff;
    box-shadow: 0 2px 8px rgba(10,61,61,0.3);
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--primary-light), var(--primary));
    box-shadow: 0 4px 16px rgba(10,61,61,0.4);
    transform: translateY(-1px);
    color: #fff;
}

.btn-accent {
    background: linear-gradient(135deg, var(--accent), var(--accent-dark));
    color: var(--primary-dark);
    box-shadow: 0 2px 8px rgba(201,169,110,0.3);
}

.btn-accent:hover {
    box-shadow: 0 4px 16px rgba(201,169,110,0.4);
    transform: translateY(-1px);
    color: var(--primary-dark);
}

.btn-success {
    background: linear-gradient(135deg, #10B981, #059669);
    color: #fff;
}

.btn-success:hover { box-shadow: 0 4px 16px rgba(16,185,129,0.4); transform: translateY(-1px); color: #fff; }

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

.btn-danger:hover { box-shadow: 0 4px 16px rgba(239,68,68,0.4); transform: translateY(-1px); color: #fff; }

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

.btn-warning:hover { box-shadow: 0 4px 16px rgba(245,158,11,0.4); transform: translateY(-1px); color: #fff; }

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

.btn-outline:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: rgba(10,61,61,0.04);
}

.btn-sm { padding: 6px 14px; font-size: 0.78rem; }
.btn-lg { padding: 14px 28px; font-size: 1rem; }
.btn-icon { padding: 8px; }

/* --- Tables --- */
.table-wrapper { overflow-x: auto; }

table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

thead th {
    background: var(--bg);
    padding: 12px 16px;
    text-align: left;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border);
}

tbody td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-light);
    font-size: 0.88rem;
    color: var(--text-primary);
    vertical-align: middle;
}

tbody tr { transition: var(--transition); }
tbody tr:hover { background: rgba(10,61,61,0.02); }

/* --- Status Badges --- */
.badge-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-status::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
}

.badge-draft { background: var(--info-bg); color: var(--info); }
.badge-draft::before { background: var(--info); }

.badge-pending { background: var(--warning-bg); color: #B45309; }
.badge-pending::before { background: var(--warning); }

.badge-review { background: rgba(139,92,246,0.1); color: #7C3AED; }
.badge-review::before { background: #8B5CF6; }

.badge-approved { background: var(--success-bg); color: #047857; }
.badge-approved::before { background: var(--success); }

.badge-rejected { background: var(--danger-bg); color: #B91C1C; }
.badge-rejected::before { background: var(--danger); }

.badge-returned { background: rgba(245,158,11,0.1); color: #92400E; }
.badge-returned::before { background: #D97706; }

/* Priority badges */
.badge-priority {
    padding: 3px 10px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-normal { background: var(--bg); color: var(--text-secondary); }
.badge-urgent { background: var(--warning-bg); color: #92400E; }
.badge-critical { background: var(--danger-bg); color: #991B1B; }

/* --- Forms --- */
.form-group {
    margin-bottom: 20px;
}

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

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

.form-control {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.88rem;
    font-family: inherit;
    color: var(--text-primary);
    background: var(--bg-card);
    transition: var(--transition);
    outline: none;
}

.form-control:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(201,169,110,0.15);
}

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

select.form-control { cursor: pointer; }

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

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

/* --- File Upload Zone --- */
.upload-zone {
    border: 2px dashed var(--border);
    border-radius: var(--radius-md);
    padding: 48px 24px;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    background: rgba(10,61,61,0.01);
}

.upload-zone:hover, .upload-zone.dragover {
    border-color: var(--accent);
    background: rgba(201,169,110,0.05);
}

.upload-zone .upload-icon {
    font-size: 3rem;
    color: var(--accent);
    margin-bottom: 12px;
    display: block;
}

.upload-zone h3 {
    font-size: 1rem;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.upload-zone p {
    color: var(--text-secondary);
    font-size: 0.82rem;
}

.upload-zone .file-info {
    margin-top: 12px;
    padding: 12px;
    background: var(--success-bg);
    border-radius: var(--radius-sm);
    font-weight: 600;
    color: var(--success);
}

/* --- Approval Timeline --- */
.approval-timeline {
    position: relative;
    padding: 20px 0;
}

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

.timeline-item:last-child { padding-bottom: 0; }

.timeline-item::before {
    content: '';
    position: absolute;
    left: 19px;
    top: 40px;
    bottom: 0;
    width: 2px;
    background: var(--border);
}

.timeline-item:last-child::before { display: none; }

.timeline-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    flex-shrink: 0;
    border: 3px solid var(--bg-card);
    box-shadow: var(--shadow-sm);
    z-index: 1;
}

.timeline-icon.pending { background: var(--warning-bg); color: var(--warning); }
.timeline-icon.approved { background: var(--success-bg); color: var(--success); }
.timeline-icon.rejected { background: var(--danger-bg); color: var(--danger); }
.timeline-icon.returned { background: rgba(245,158,11,0.1); color: #D97706; }
.timeline-icon.current { background: var(--primary); color: #fff; animation: pulse 2s ease-in-out infinite; }

@keyframes pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(10,61,61,0.3); }
    50% { box-shadow: 0 0 0 8px rgba(10,61,61,0); }
}

.timeline-content { flex: 1; }

.timeline-content h4 {
    font-size: 0.92rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.timeline-content p {
    font-size: 0.82rem;
    color: var(--text-secondary);
}

.timeline-content .timeline-meta {
    display: flex;
    gap: 16px;
    margin-top: 6px;
    font-size: 0.75rem;
    color: var(--text-light);
}

/* --- OTP Modal --- */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(4px);
    z-index: 999;
    align-items: center;
    justify-content: center;
}

.modal-overlay.active { display: flex; }

.modal {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 36px;
    max-width: 420px;
    width: 90%;
    box-shadow: var(--shadow-xl);
    animation: modalIn 0.3s ease;
    text-align: center;
}

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

.modal .modal-icon {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), var(--accent-dark));
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    font-size: 1.5rem;
    color: var(--primary-dark);
}

.modal h2 {
    font-size: 1.2rem;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.modal p {
    color: var(--text-secondary);
    font-size: 0.88rem;
    margin-bottom: 24px;
}

.otp-display {
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: #fff;
    padding: 20px;
    border-radius: var(--radius-md);
    margin-bottom: 20px;
}

.otp-display .otp-code {
    font-size: 2.5rem;
    font-weight: 800;
    letter-spacing: 12px;
    font-family: 'Inter', monospace;
}

.otp-display .otp-label {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    opacity: 0.7;
    margin-bottom: 8px;
}

.otp-input-group {
    display: flex;
    gap: 8px;
    justify-content: center;
    margin-bottom: 20px;
}

.otp-input {
    width: 48px;
    height: 56px;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    text-align: center;
    font-size: 1.5rem;
    font-weight: 700;
    font-family: inherit;
    color: var(--text-primary);
    outline: none;
    transition: var(--transition);
}

.otp-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(201,169,110,0.2);
}

/* --- Login Page --- */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #0A2E2E 0%, #0D4F4F 50%, #0A3D3D 100%);
    position: relative;
    overflow: hidden;
}

.login-page::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, rgba(201,169,110,0.1) 0%, transparent 70%);
    animation: loginGlow 6s ease-in-out infinite;
}

@keyframes loginGlow {
    0%, 100% { transform: translate(0, 0); }
    50% { transform: translate(-30px, 30px); }
}

.login-container {
    max-width: 440px;
    width: 90%;
    z-index: 1;
}

.login-card {
    background: rgba(255,255,255,0.97);
    border-radius: var(--radius-xl);
    padding: 48px 40px;
    box-shadow: var(--shadow-xl);
    backdrop-filter: blur(20px);
}

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

.login-brand .brand-icon {
    width: 64px;
    height: 64px;
    background: linear-gradient(135deg, var(--accent), var(--accent-dark));
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--primary-dark);
    margin: 0 auto 16px;
}

.login-brand h1 {
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: -1px;
}

.login-brand p {
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin-top: 4px;
}

.login-card .form-group { margin-bottom: 18px; }

.login-card .form-control {
    padding: 12px 16px;
    font-size: 0.92rem;
    border-radius: 10px;
}

.login-card .btn-primary {
    width: 100%;
    padding: 14px;
    font-size: 0.95rem;
    border-radius: 10px;
    margin-top: 8px;
}

.login-footer {
    text-align: center;
    margin-top: 24px;
    color: rgba(255,255,255,0.6);
    font-size: 0.78rem;
}

.login-footer a { color: var(--accent-light); }

/* --- Notification Panel --- */
.notification-panel {
    position: fixed;
    top: 0;
    right: -380px;
    width: 380px;
    height: 100vh;
    background: var(--bg-card);
    box-shadow: -4px 0 24px rgba(0,0,0,0.12);
    z-index: 200;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
}

.notification-panel.open { right: 0; }

.notification-panel .panel-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.notification-panel .panel-header h3 { font-size: 1.05rem; font-weight: 600; }

.notification-list {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
}

.notif-item {
    padding: 14px 16px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
    margin-bottom: 4px;
    border-left: 3px solid transparent;
}

.notif-item:hover { background: var(--bg); }
.notif-item.unread { background: rgba(201,169,110,0.05); border-left-color: var(--accent); }

.notif-item .notif-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.notif-item .notif-message {
    font-size: 0.78rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

.notif-item .notif-time {
    font-size: 0.7rem;
    color: var(--text-light);
    margin-top: 6px;
}

/* --- Document Grid --- */
.doc-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 20px;
}

.doc-card {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    padding: 24px;
    transition: var(--transition);
    cursor: pointer;
}

.doc-card:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--accent);
    transform: translateY(-2px);
}

.doc-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 12px;
}

.doc-card-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-sm);
    background: rgba(10,61,61,0.08);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    color: var(--primary);
}

.doc-card h4 {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 6px;
    line-height: 1.3;
}

.doc-card .doc-ref {
    font-size: 0.75rem;
    color: var(--text-light);
    font-family: 'Inter', monospace;
}

.doc-card-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border-light);
    font-size: 0.78rem;
    color: var(--text-secondary);
}

.doc-card-progress {
    margin-top: 14px;
}

.progress-bar {
    height: 4px;
    background: var(--border-light);
    border-radius: 4px;
    overflow: hidden;
    margin-top: 6px;
}

.progress-fill {
    height: 100%;
    border-radius: 4px;
    background: linear-gradient(90deg, var(--accent), var(--accent-dark));
    transition: width 0.5s ease;
}

.progress-label {
    font-size: 0.72rem;
    color: var(--text-secondary);
    display: flex;
    justify-content: space-between;
}

/* --- Detail Page --- */
.detail-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 24px;
}

.detail-info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.info-item {
    padding: 12px;
    background: var(--bg);
    border-radius: var(--radius-sm);
}

.info-item .info-label {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-light);
    font-weight: 600;
    margin-bottom: 4px;
}

.info-item .info-value {
    font-size: 0.92rem;
    font-weight: 600;
    color: var(--text-primary);
}

/* --- Toast Notifications --- */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    padding: 14px 20px;
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 12px;
    animation: toastIn 0.3s ease;
    min-width: 300px;
    border-left: 4px solid;
}

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

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

.toast .toast-message {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-primary);
}

/* --- Empty State --- */
.empty-state {
    text-align: center;
    padding: 60px 24px;
}

.empty-state .empty-icon {
    font-size: 4rem;
    margin-bottom: 16px;
    opacity: 0.3;
}

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

.empty-state p {
    color: var(--text-secondary);
    font-size: 0.88rem;
    margin-bottom: 20px;
}

/* --- Filters --- */
.filter-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.filter-bar .filter-input {
    flex: 1;
    min-width: 200px;
    padding: 10px 16px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 0.88rem;
    outline: none;
    transition: var(--transition);
}

.filter-bar .filter-input:focus {
    border-color: var(--accent);
}

.filter-bar select {
    padding: 10px 16px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 0.88rem;
    background: var(--bg-card);
    cursor: pointer;
    outline: none;
}

/* --- Loading --- */
.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

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

.page-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 300px;
    flex-direction: column;
    gap: 16px;
    color: var(--text-secondary);
}

.page-loading .loading-spinner {
    width: 40px;
    height: 40px;
    border-width: 3px;
}

/* --- Responsive --- */
@media (max-width: 1024px) {
    .detail-grid { grid-template-columns: 1fr; }
    .form-row { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .main-content { margin-left: 0; }
    .page-content { padding: 20px 16px; }
    .topbar { padding: 12px 16px; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .doc-grid { grid-template-columns: 1fr; }
    .detail-info-grid { grid-template-columns: 1fr; }
}

/* --- Utility --- */
.text-center { text-align: center; }
.text-right { text-align: right; }
.mt-4 { margin-top: 16px; }
.mt-6 { margin-top: 24px; }
.mb-4 { margin-bottom: 16px; }
.flex { display: flex; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.hidden { display: none !important; }

/* --- Document Preview Modal --- */
.preview-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.7);
    backdrop-filter: blur(6px);
    z-index: 1000;
    animation: fadeIn 0.2s ease;
}

.preview-overlay.active { display: flex; flex-direction: column; }

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

.preview-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    background: rgba(10,46,46,0.95);
    color: #fff;
    border-bottom: 1px solid rgba(201,169,110,0.2);
    flex-shrink: 0;
}

.preview-header h3 {
    font-size: 1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
}

.preview-header h3 .preview-badge {
    font-size: 0.65rem;
    background: rgba(201,169,110,0.2);
    color: var(--accent-light);
    padding: 3px 10px;
    border-radius: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.preview-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.preview-header-actions .btn {
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.15);
    color: #fff;
    padding: 8px 16px;
    font-size: 0.82rem;
}

.preview-header-actions .btn:hover {
    background: rgba(255,255,255,0.2);
    color: #fff;
}

.preview-header-actions .btn-close-preview {
    background: rgba(239,68,68,0.15);
    border-color: rgba(239,68,68,0.3);
    color: #f87171;
}

.preview-header-actions .btn-close-preview:hover {
    background: rgba(239,68,68,0.3);
    color: #fff;
}

.preview-body {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    overflow: auto;
}

.preview-body iframe {
    width: 100%;
    height: 100%;
    border: none;
    border-radius: var(--radius-md);
    background: #fff;
}

.preview-body img {
    max-width: 90%;
    max-height: 90%;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-xl);
    object-fit: contain;
}

.preview-unsupported {
    text-align: center;
    color: rgba(255,255,255,0.8);
    padding: 40px;
}

.preview-unsupported .preview-icon {
    font-size: 4rem;
    margin-bottom: 16px;
    display: block;
}

.preview-unsupported h3 {
    font-size: 1.2rem;
    margin-bottom: 8px;
    color: #fff;
}

.preview-unsupported p {
    font-size: 0.88rem;
    color: rgba(255,255,255,0.6);
    margin-bottom: 20px;
}

/* Keyboard hint */
.preview-header .kbd-hint {
    font-size: 0.7rem;
    color: rgba(255,255,255,0.4);
    display: flex;
    align-items: center;
    gap: 6px;
}

.preview-header .kbd {
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.2);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.65rem;
    font-family: monospace;
}

/* --- Document Card Actions --- */
.doc-card-actions {
    display: flex;
    gap: 6px;
    align-items: center;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--border);
}

.doc-card-actions .btn {
    font-size: 0.75rem;
    padding: 4px 10px;
}

/* --- Signature Block --- */
.signature-block {
    text-align: center;
    padding: 20px;
    border: 2px dashed var(--border);
    border-radius: var(--radius-md);
    background: var(--bg);
}

.signature-label {
    font-size: 0.75rem;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 12px;
}

.signature-image {
    max-width: 200px;
    max-height: 80px;
    margin: 0 auto 12px;
    display: block;
    object-fit: contain;
}

.signature-name {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.signature-date {
    font-size: 0.78rem;
    color: var(--text-secondary);
}

