/* ============ Theme Variables ============ */
:root[data-theme="light"] {
    --bg-primary: #ffffff;
    --bg-secondary: #f8f9fa;
    --bg-tertiary: #e9ecef;
    --text-primary: #212529;
    --text-secondary: #6c757d;
    --text-muted: #adb5bd;
    --border-color: #dee2e6;
    --accent-primary: #0d6efd;
    --accent-hover: #0b5ed7;
    --success: #198754;
    --success-bg: #d1e7dd;
    --danger: #dc3545;
    --danger-bg: #f8d7da;
    --warning: #ffc107;
    --warning-bg: #fff3cd;
    --info: #0dcaf0;
    --info-bg: #cff4fc;
    --sidebar-bg: #1e293b;
    --sidebar-text: #cbd5e1;
    --sidebar-active: #3b82f6;
    --sidebar-hover: #334155;
    --card-bg: #ffffff;
    --card-shadow: 0 1px 3px rgba(0,0,0,0.08);
    --table-stripe: #f8f9fa;
    --table-hover: #e9ecef;
    --input-bg: #ffffff;
    --input-border: #ced4da;
    /* Enhanced design tokens */
    --gradient-primary: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --gradient-sidebar: linear-gradient(180deg, #0f172a 0%, #1e293b 50%, #0f172a 100%);
    --gradient-accent: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 100%);
    --gradient-success: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
    --gradient-warning: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    --gradient-danger: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    --gradient-info: linear-gradient(135deg, #06b6d4 0%, #0284c7 100%);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.04);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.08), 0 8px 10px -6px rgba(0, 0, 0, 0.04);
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-normal: 250ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 350ms cubic-bezier(0.4, 0, 0.2, 1);
}

:root[data-theme="dark"] {
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-tertiary: #334155;
    --text-primary: #e2e8f0;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --border-color: #334155;
    --accent-primary: #3b82f6;
    --accent-hover: #2563eb;
    --success: #22c55e;
    --success-bg: #14532d;
    --danger: #ef4444;
    --danger-bg: #7f1d1d;
    --warning: #eab308;
    --warning-bg: #713f12;
    --info: #06b6d4;
    --info-bg: #164e63;
    --sidebar-bg: #0f172a;
    --sidebar-text: #94a3b8;
    --sidebar-active: #3b82f6;
    --sidebar-hover: #1e293b;
    --card-bg: #1e293b;
    --card-shadow: 0 1px 3px rgba(0,0,0,0.3);
    --table-stripe: #1e293b;
    --table-hover: #334155;
    --input-bg: #1e293b;
    --input-border: #475569;
    /* Enhanced design tokens - dark */
    --gradient-primary: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --gradient-sidebar: linear-gradient(180deg, #020617 0%, #0f172a 50%, #020617 100%);
    --gradient-accent: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 100%);
    --gradient-success: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
    --gradient-warning: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    --gradient-danger: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    --gradient-info: linear-gradient(135deg, #06b6d4 0%, #0284c7 100%);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -2px rgba(0, 0, 0, 0.2);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.3), 0 4px 6px -4px rgba(0, 0, 0, 0.2);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.3), 0 8px 10px -6px rgba(0, 0, 0, 0.2);
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-normal: 250ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 350ms cubic-bezier(0.4, 0, 0.2, 1);
}

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

html { scroll-behavior: smooth; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 14px;
    line-height: 1.6;
    color: var(--text-primary);
    background: var(--bg-secondary);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Smooth theme transition */
html[data-theme] body,
html[data-theme] .sidebar,
html[data-theme] .topbar,
html[data-theme] .card,
html[data-theme] .stat-card {
    transition: background-color var(--transition-normal), color var(--transition-normal), border-color var(--transition-normal);
}

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

::selection { background: rgba(59, 130, 246, 0.2); }

/* ============ Icon Sizing Utilities ============ */
.icon-xs { width: 14px; height: 14px; }
.icon-sm { width: 16px; height: 16px; }
.icon-md { width: 20px; height: 20px; }
.icon-lg { width: 24px; height: 24px; }
.icon-xl { width: 32px; height: 32px; }

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

/* ============ Sidebar ============ */
.sidebar {
    width: 260px;
    background: var(--gradient-sidebar);
    color: var(--sidebar-text);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
    overflow-y: auto;
    transition: transform var(--transition-normal);
    border-right: 1px solid rgba(255, 255, 255, 0.05);
}

.sidebar-header {
    padding: 20px 16px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.sidebar-brand-area {
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: var(--gradient-accent);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.sidebar-brand {
    font-size: 20px;
    font-weight: 700;
    color: #ffffff;
    margin-bottom: 2px;
    letter-spacing: -0.5px;
}

.tenant-name {
    font-size: 11px;
    color: var(--sidebar-text);
    opacity: 0.7;
}

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

.nav-list { list-style: none; }

.nav-section-title {
    padding: 20px 16px 6px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: rgba(255,255,255,0.3);
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    color: var(--sidebar-text);
    font-size: 13px;
    font-weight: 450;
    border-left: 3px solid transparent;
    border-radius: 0 8px 8px 0;
    margin-right: 8px;
    transition: all var(--transition-fast);
}

.nav-link:hover {
    background: var(--sidebar-hover);
    color: #ffffff;
    text-decoration: none;
}

.nav-link.active {
    background: rgba(59, 130, 246, 0.15);
    color: #ffffff;
    border-left-color: var(--sidebar-active);
}

.nav-link [data-lucide],
.nav-link .lucide {
    width: 18px;
    height: 18px;
    opacity: 0.7;
    flex-shrink: 0;
}

.nav-link.active [data-lucide],
.nav-link.active .lucide,
.nav-link:hover [data-lucide],
.nav-link:hover .lucide {
    opacity: 1;
}

/* Sidebar Submenu */
.nav-has-submenu { position: relative; }

.nav-has-submenu > .nav-link { position: relative; padding-right: 32px; }

.submenu-arrow {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%) rotate(-90deg);
    width: 14px !important;
    height: 14px !important;
    opacity: 0.4 !important;
    transition: transform var(--transition-fast);
}

.nav-has-submenu.open .submenu-arrow { transform: translateY(-50%) rotate(0deg); }

.nav-submenu {
    list-style: none;
    max-height: 0;
    overflow: hidden;
    transition: max-height var(--transition-normal);
}

.nav-has-submenu.open .nav-submenu { max-height: 300px; }

.nav-submenu .nav-link {
    padding: 7px 16px 7px 42px;
    font-size: 12px;
    gap: 8px;
}

.nav-submenu .nav-link [data-lucide],
.nav-submenu .nav-link .lucide {
    width: 14px;
    height: 14px;
}

.nav-badge {
    margin-left: auto;
    margin-right: 20px;
    background: rgba(59, 130, 246, 0.25);
    color: #93c5fd;
    font-size: 10px;
    font-weight: 600;
    padding: 1px 7px;
    border-radius: 50px;
    line-height: 1.4;
}

.nav-count {
    margin-left: auto;
    font-size: 10px;
    font-weight: 600;
    color: rgba(255,255,255,0.5);
    background: rgba(255,255,255,0.08);
    padding: 1px 6px;
    border-radius: 50px;
    line-height: 1.4;
}

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

.dot-new { background: #3b82f6; }
.dot-submitted { background: #f59e0b; }
.dot-cleared { background: #22c55e; }
.dot-rejected { background: #ef4444; }

.nav-icon {
    width: 20px;
    text-align: center;
    font-size: 14px;
    opacity: 0.7;
}

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

.user-info-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

.sidebar-user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: var(--gradient-accent);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
    flex-shrink: 0;
}

.user-info {
    margin-bottom: 0;
}

.user-name {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #ffffff;
}

.user-role {
    font-size: 11px;
    color: rgba(255,255,255,0.5);
}

.btn-logout {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 12px;
    text-align: center;
    background: rgba(255,255,255,0.08);
    color: #ffffff;
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-weight: 500;
    transition: background var(--transition-fast);
    border: none;
    cursor: pointer;
    width: 100%;
}

/* Sidebar close button (visible on mobile/tablet only) */
.sidebar-close-btn {
    display: none;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: none;
    background: rgba(255,255,255,0.1);
    color: rgba(255,255,255,0.7);
    border-radius: 8px;
    cursor: pointer;
    transition: all var(--transition-fast);
    flex-shrink: 0;
}
.sidebar-close-btn:hover {
    background: rgba(255,255,255,0.2);
    color: #ffffff;
}
.sidebar-close-btn [data-lucide],
.sidebar-close-btn .lucide {
    width: 18px;
    height: 18px;
}

.btn-logout:hover {
    background: rgba(255,255,255,0.15);
    text-decoration: none;
    color: #ffffff;
}

/* Sidebar overlay (mobile) */
.sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 99;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}
.sidebar-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* ============ Main Content ============ */
.main-content {
    margin-left: 260px;
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* ============ Topbar ============ */
.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 24px;
    background: var(--card-bg);
    border-bottom: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 50;
}

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

.page-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -0.3px;
}

.btn-menu-toggle {
    display: none;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    font-size: 20px;
    cursor: pointer;
    color: var(--text-primary);
    padding: 6px;
    width: 38px;
    height: 38px;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
    flex-shrink: 0;
}
.btn-menu-toggle:hover {
    background: var(--bg-tertiary);
}
.btn-menu-toggle [data-lucide],
.btn-menu-toggle .lucide {
    width: 20px;
    height: 20px;
}

.btn-icon {
    background: none;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 6px 10px;
    cursor: pointer;
    font-size: 16px;
    color: var(--text-secondary);
    transition: all var(--transition-fast);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-icon:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.topbar-user-pill {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 12px 4px 4px;
    border-radius: 50px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
}

.user-avatar-name {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--gradient-accent);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
}

/* ============ Content Area ============ */
.content-area { padding: 24px; flex: 1; }

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

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-secondary);
}

.card-header h3 {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.card-header h3 [data-lucide],
.card-header h3 .lucide {
    width: 18px;
    height: 18px;
    color: var(--accent-primary);
}

.card-body { padding: 20px; }

/* ============ Dashboard ============ */
.dashboard-controls { margin-bottom: 20px; }
.period-toggle { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.period-divider { color: var(--text-muted); font-size: 12px; margin: 0 4px; }
.year-select { width: auto; display: inline-block; padding: 4px 8px; }

/* Welcome Banner */
.welcome-banner {
    position: relative;
    border-radius: var(--radius-lg);
    overflow: hidden;
    margin-bottom: 24px;
    padding: 36px 32px;
    background: var(--gradient-accent);
    color: #ffffff;
}

.welcome-banner-bg {
    position: absolute;
    inset: 0;
    background: url('https://images.unsplash.com/photo-1507003211169-0a1dd7228f2d?auto=format&fit=crop&w=1600&q=60') center/cover no-repeat;
    opacity: 0.1;
    mix-blend-mode: overlay;
}

.welcome-content {
    position: relative;
    z-index: 1;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 24px;
}

.welcome-greeting {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 6px;
    letter-spacing: -0.5px;
}

.welcome-summary {
    font-size: 15px;
    opacity: 0.9;
    margin: 0;
}

.welcome-actions .btn {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.3);
    backdrop-filter: blur(4px);
    color: #fff;
}

.welcome-actions .btn:hover {
    background: rgba(255, 255, 255, 0.3);
    color: #fff;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}
.dashboard-grid--half { grid-template-columns: repeat(2, 1fr); }

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

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

.stat-icon {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: 700;
    color: #ffffff;
    flex-shrink: 0;
}

.bg-primary { background: var(--gradient-accent); }
.bg-success { background: var(--gradient-success); }
.bg-info { background: var(--gradient-info); }
.bg-warning { background: var(--gradient-warning); }

.stat-value {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 2px;
    letter-spacing: -0.5px;
    font-feature-settings: 'tnum';
}

.stat-label {
    font-size: 12px;
    color: var(--text-secondary);
}

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

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

.data-table th,
.data-table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
    font-size: 13px;
}

.data-table th {
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: var(--bg-secondary);
    white-space: nowrap;
}

.data-table td {
    vertical-align: middle;
}

.data-table tbody tr {
    transition: background-color var(--transition-fast);
}

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

.data-table tbody tr:nth-child(even) { background: var(--table-stripe); }
.data-table tbody tr:nth-child(even):hover { background: var(--table-hover); }

.text-right { text-align: right; }
.text-center { text-align: center; }

.total-row { background: var(--bg-tertiary) !important; font-weight: 600; }

.empty-state {
    padding: 40px !important;
    color: var(--text-muted);
    font-size: 14px;
}

.empty-state-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 40px 20px;
}

.empty-state-icon {
    width: 48px;
    height: 48px;
    color: var(--text-muted);
    opacity: 0.4;
}

.table-filters {
    padding: 12px 20px;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-secondary);
}

.filter-form {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.filter-group { flex: 0 0 auto; }

.table-summary {
    padding: 10px 20px;
    display: flex;
    justify-content: space-between;
    background: var(--bg-secondary);
    font-size: 13px;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-color);
}

.table-footer {
    padding: 12px 20px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: center;
}

.pagination { display: flex; gap: 4px; }

/* ============ Buttons ============ */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 500;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    cursor: pointer;
    transition: all var(--transition-fast);
    text-decoration: none;
    line-height: 1.4;
    font-family: inherit;
}

.btn:hover {
    text-decoration: none;
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

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

.btn-primary {
    background: var(--gradient-accent);
    color: #ffffff;
    border-color: transparent;
}
.btn-primary:hover {
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
    color: #ffffff;
}

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

.btn-success { background: var(--gradient-success); color: #ffffff; border-color: transparent; }
.btn-danger { background: var(--gradient-danger); color: #ffffff; border-color: transparent; }

.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-lg { padding: 12px 24px; font-size: 15px; border-radius: var(--radius-md); }
.btn-block { width: 100%; justify-content: center; }

.action-buttons { display: flex; gap: 4px; flex-wrap: wrap; }

/* Icon-only buttons */
.btn-icon-only {
    padding: 6px;
    border-radius: var(--radius-sm);
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
    cursor: pointer;
    text-decoration: none;
}

.btn-icon-only:hover {
    background: var(--accent-primary);
    color: #ffffff;
    border-color: var(--accent-primary);
    text-decoration: none;
    transform: translateY(-1px);
}

.btn-icon-only [data-lucide],
.btn-icon-only .lucide {
    width: 15px;
    height: 15px;
}

.btn-danger-subtle { color: var(--danger); }
.btn-danger-subtle:hover { background: var(--danger); color: #ffffff; border-color: var(--danger); }

.btn-success-subtle { color: var(--success); }
.btn-success-subtle:hover { background: var(--success); color: #ffffff; border-color: var(--success); }

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

.form-group label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.form-group label.required::after {
    content: ' *';
    color: var(--danger);
}

.form-control {
    width: 100%;
    padding: 10px 14px;
    font-size: 14px;
    border: 1.5px solid var(--input-border);
    border-radius: var(--radius-sm);
    background: var(--input-bg);
    color: var(--text-primary);
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
    font-family: inherit;
}

.form-control:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12);
}

.form-control:hover:not(:focus) {
    border-color: var(--text-muted);
}

.form-control-sm { padding: 5px 8px; font-size: 12px; }

select.form-control { cursor: pointer; }

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

.form-check-input { width: 16px; height: 16px; cursor: pointer; }

.form-text { font-size: 11px; color: var(--text-muted); margin-top: 3px; }

.error-message {
    font-size: 12px;
    color: var(--danger);
    margin-top: 3px;
}

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

.form-section {
    margin-bottom: 28px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
}

.section-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.section-title [data-lucide],
.section-title .lucide {
    color: var(--accent-primary);
    width: 18px;
    height: 18px;
}

.form-actions {
    display: flex;
    gap: 8px;
    padding-top: 16px;
}

/* ============ Badges ============ */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    font-size: 11px;
    font-weight: 600;
    border-radius: 50px;
    letter-spacing: 0.3px;
}

.badge-success { background: var(--success-bg); color: var(--success); }
.badge-danger { background: var(--danger-bg); color: var(--danger); }
.badge-warning { background: var(--warning-bg); color: #856404; }
.badge-primary { background: rgba(59,130,246,0.15); color: var(--accent-primary); }
.badge-secondary { background: var(--bg-tertiary); color: var(--text-secondary); }
.badge-permanent_hiring { background: rgba(59,130,246,0.15); color: #2563eb; }
.badge-payroll_management { background: rgba(168,85,247,0.15); color: #7c3aed; }

/* Invoice Status Badges */
.badge-status-new { background: rgba(59,130,246,0.15); color: #2563eb; }
.badge-status-submitted { background: rgba(245,158,11,0.15); color: #d97706; }
.badge-status-cleared { background: rgba(34,197,94,0.15); color: #16a34a; }
.badge-status-rejected { background: rgba(239,68,68,0.15); color: #dc2626; }

/* Status Icon Backgrounds */
.bg-status-new { background: var(--gradient-accent); }
.bg-status-submitted { background: var(--gradient-warning); }
.bg-status-cleared { background: var(--gradient-success); }
.bg-status-rejected { background: var(--gradient-danger); }

/* Status Action Buttons */
.status-actions {
    display: inline-flex;
    gap: 6px;
    margin-left: 12px;
    align-items: center;
}

.btn-status {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    font-size: 11px;
    font-weight: 600;
    border-radius: 50px;
    border: 1.5px solid transparent;
    cursor: pointer;
    transition: all var(--transition-fast);
    text-decoration: none;
    font-family: inherit;
}

.btn-status:hover {
    text-decoration: none;
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.btn-status [data-lucide],
.btn-status .lucide { width: 12px; height: 12px; }

.btn-status-submitted {
    background: rgba(245,158,11,0.12);
    color: #d97706;
    border-color: rgba(245,158,11,0.3);
}
.btn-status-submitted:hover { background: #f59e0b; color: #fff; border-color: #f59e0b; }

.btn-status-cleared {
    background: rgba(34,197,94,0.12);
    color: #16a34a;
    border-color: rgba(34,197,94,0.3);
}
.btn-status-cleared:hover { background: #22c55e; color: #fff; border-color: #22c55e; }

.btn-status-rejected {
    background: rgba(239,68,68,0.12);
    color: #dc2626;
    border-color: rgba(239,68,68,0.3);
}
.btn-status-rejected:hover { background: #ef4444; color: #fff; border-color: #ef4444; }

.btn-status-new {
    background: rgba(59,130,246,0.12);
    color: #2563eb;
    border-color: rgba(59,130,246,0.3);
}
.btn-status-new:hover { background: #3b82f6; color: #fff; border-color: #3b82f6; }

/* Inline status dropdown on list page */
.status-dropdown {
    position: relative;
    display: inline-block;
}

.status-dropdown-toggle {
    cursor: pointer;
    position: relative;
}

.status-dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    z-index: 20;
    min-width: 150px;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
    padding: 4px;
    margin-top: 4px;
}

.status-dropdown.open .status-dropdown-menu { display: block; }

.status-dropdown-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 12px;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-primary);
    cursor: pointer;
    border-radius: 4px;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    transition: background var(--transition-fast);
    font-family: inherit;
}

.status-dropdown-item:hover { background: var(--bg-secondary); }

.status-dropdown-item .status-dot { width: 8px; height: 8px; }

/* Status Card Accents */
.stat-card-new { border-left: 3px solid #3b82f6; }
.stat-card-submitted { border-left: 3px solid #f59e0b; }
.stat-card-cleared { border-left: 3px solid #22c55e; }
.stat-card-rejected { border-left: 3px solid #ef4444; }

/* Dashboard Sub Text */
.stat-sub {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 2px;
}

/* Client Stats Colors */
.text-cleared { color: var(--success); font-weight: 500; }
.text-pending { color: #d97706; font-weight: 500; }

/* ============ Alerts ============ */
.messages { margin-bottom: 16px; }

.alert {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    margin-bottom: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    animation: fadeInUp 0.3s ease-out;
}

.alert-success { background: var(--success-bg); color: var(--success); border: 1px solid var(--success); }
.alert-error, .alert-danger { background: var(--danger-bg); color: var(--danger); border: 1px solid var(--danger); }
.alert-warning { background: var(--warning-bg); color: #856404; border: 1px solid var(--warning); }
.alert-info { background: var(--info-bg); color: #0c63e4; border: 1px solid var(--info); }

.alert-close {
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    color: inherit;
    opacity: 0.7;
}

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

.detail-section h4 {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--accent-primary);
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.detail-section h4 [data-lucide],
.detail-section h4 .lucide {
    width: 16px;
    height: 16px;
    color: var(--accent-primary);
}

.detail-list { display: grid; grid-template-columns: 140px 1fr; gap: 8px 12px; }

.detail-list dt {
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 500;
}

.detail-list dd {
    font-size: 13px;
    color: var(--text-primary);
}

/* ============ Invoice Type Select ============ */
.invoice-type-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    max-width: 800px;
}

.type-card {
    background: var(--card-bg);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 36px 28px;
    text-align: center;
    transition: all var(--transition-normal);
    color: var(--text-primary);
    position: relative;
    overflow: hidden;
}

.type-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--gradient-accent);
    opacity: 0;
    transition: opacity var(--transition-fast);
}

.type-card:hover {
    border-color: var(--accent-primary);
    box-shadow: var(--shadow-lg);
    text-decoration: none;
    transform: translateY(-4px);
}

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

.type-icon-wrapper {
    width: 72px;
    height: 72px;
    border-radius: 20px;
    background: rgba(59, 130, 246, 0.1);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
}

.type-icon-lucide {
    width: 36px;
    height: 36px;
    color: var(--accent-primary);
}

.type-icon {
    margin-bottom: 16px;
    color: var(--accent-primary);
}

.type-card h3 { font-size: 18px; margin-bottom: 8px; }
.type-card p { font-size: 13px; color: var(--text-secondary); }

.type-card-action {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 16px;
    font-size: 14px;
    font-weight: 600;
    color: var(--accent-primary);
}

/* ============ Auth Pages - Split Layout ============ */
.auth-container {
    min-height: 100vh;
    display: flex;
    background: var(--bg-secondary);
    padding: 0;
}

.auth-split {
    display: flex;
    width: 100%;
    min-height: 100vh;
}

.auth-split-image {
    flex: 0 0 50%;
    position: relative;
    background: url('https://images.unsplash.com/photo-1497366216548-37526070297c?auto=format&fit=crop&w=1200&q=80') center/cover no-repeat;
    display: flex;
    align-items: flex-end;
    padding: 60px;
}

.auth-split-image--register {
    background-image: url('https://images.unsplash.com/photo-1560472355-536de3962603?auto=format&fit=crop&w=1200&q=80');
}

.auth-image-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(15, 23, 42, 0.85) 0%, rgba(59, 130, 246, 0.6) 100%);
}

.auth-image-content {
    position: relative;
    z-index: 1;
    color: #ffffff;
}

.auth-brand-large {
    font-size: 42px;
    font-weight: 800;
    letter-spacing: -1px;
    margin-bottom: 12px;
}

.auth-brand-tagline {
    font-size: 18px;
    opacity: 0.85;
    line-height: 1.6;
    font-weight: 300;
}

.auth-split-form {
    flex: 0 0 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    background: var(--bg-primary);
    overflow-y: auto;
}

.auth-form-wrapper {
    width: 100%;
    max-width: 420px;
}

.auth-form-wrapper--wide {
    max-width: 560px;
}

.auth-logo-area {
    text-align: center;
    margin-bottom: 32px;
}

.auth-logo-icon {
    width: 64px;
    height: 64px;
    border-radius: 16px;
    background: var(--gradient-accent);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
    box-shadow: 0 4px 14px rgba(59, 130, 246, 0.4);
}

.auth-title {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
    letter-spacing: -0.5px;
}

.auth-subtitle {
    color: var(--text-secondary);
    margin-bottom: 0;
    font-size: 15px;
}

.auth-card {
    background: var(--card-bg);
    border-radius: 12px;
    box-shadow: var(--card-shadow);
    padding: 40px;
    width: 100%;
    max-width: 420px;
    border: 1px solid var(--border-color);
}

.auth-card-wide { max-width: 640px; }

.auth-footer {
    text-align: center;
    margin-top: 24px;
    font-size: 13px;
    color: var(--text-secondary);
}
.auth-powered-by {
    text-align: center;
    margin-top: 16px;
    font-size: 11px;
    color: var(--text-muted);
}

/* ============ Info Callout ============ */
.info-callout {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: var(--info-bg);
    border: 1px solid var(--info);
    border-radius: var(--radius-sm);
    font-size: 13px;
    color: var(--text-primary);
    margin-bottom: 20px;
}

/* ============ Confirm Delete ============ */
.confirm-delete { text-align: center; padding: 32px 20px; }
.confirm-delete p { margin-bottom: 12px; }
.confirm-delete-icon { margin-bottom: 16px; }
.confirm-delete-title { font-size: 20px; font-weight: 700; margin-bottom: 12px; }

/* ============ Status Bar ============ */
.status-bar {
    padding: 10px 14px;
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
    font-size: 13px;
    border: 1px solid var(--border-color);
}

/* ============ Utilities ============ */
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 16px; }
.mt-4 { margin-top: 24px; }
.mb-3 { margin-bottom: 16px; }
.text-muted { color: var(--text-muted); }
.text-danger { color: var(--danger); }

/* ============ Animations ============ */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

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

.content-area > * {
    animation: fadeInUp 0.3s ease-out;
}

:focus-visible {
    outline: 2px solid var(--accent-primary);
    outline-offset: 2px;
}

/* ============ Responsive ============ */
/* ============ Employee Formset Table Columns ============ */
.emp-col-name { min-width: 150px; }
.emp-col-desg { min-width: 120px; }
.emp-col-num { min-width: 100px; }
.emp-col-sm { min-width: 75px; }
.emp-col-act { width: 44px; }

/* ============ Invoice Documents Section ============ */
.inv-documents-section {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 20px;
    margin-top: 16px;
}
.documents-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}
.documents-header h4 {
    margin: 0;
    font-size: 15px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}
.upload-form-area {
    background: var(--bg-secondary);
    border: 1px dashed var(--border-color);
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 16px;
}
.upload-form-area.hidden { display: none; }
.upload-form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}
.badge-doc-signed_copy { background: #dbeafe; color: #1e40af; }
.badge-doc-sealed_copy { background: #fef3c7; color: #92400e; }
.badge-doc-other { background: var(--bg-tertiary); color: var(--text-secondary); }
.doc-actions { white-space: nowrap; }
.doc-actions .btn { margin-right: 2px; }
.empty-state-compact {
    text-align: center;
    padding: 24px 16px;
    color: var(--text-muted);
}
.empty-state-compact p {
    margin: 8px 0 0;
    font-size: 13px;
}

/* ============ Tablet (768px - 991px) ============ */
@media (max-width: 991.98px) {
    /* Sidebar: off-canvas with smooth animation */
    .sidebar {
        transform: translateX(-100%);
        box-shadow: none;
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.3s ease;
    }
    .sidebar.active {
        transform: translateX(0);
        box-shadow: 4px 0 24px rgba(0, 0, 0, 0.25);
    }
    .sidebar-close-btn { display: flex; }
    .main-content { margin-left: 0; }
    .btn-menu-toggle { display: flex; }

    /* Touch-friendly nav items */
    .nav-link { padding: 12px 16px; font-size: 14px; min-height: 44px; }
    .nav-submenu .nav-link { padding: 10px 16px 10px 42px; font-size: 13px; min-height: 40px; }
    .nav-section-title { padding: 22px 16px 8px; font-size: 11px; }

    /* Dashboard */
    .dashboard-grid { grid-template-columns: repeat(2, 1fr) !important; }
    .welcome-content { flex-direction: column; text-align: center; }
    .welcome-banner { padding: 28px 24px; }
    .welcome-greeting { font-size: 20px; }
    .period-toggle { flex-wrap: wrap; }

    /* Grids */
    .detail-grid { grid-template-columns: 1fr; }
    .invoice-type-grid { grid-template-columns: 1fr; }
    .detail-list { grid-template-columns: 120px 1fr; }

    /* Auth pages — tablet */
    .auth-split { flex-direction: column; }
    .auth-split-image {
        flex: 0 0 auto;
        min-height: 180px;
        padding: 30px;
        align-items: center;
        justify-content: center;
    }
    .auth-image-content { text-align: center; }
    .auth-brand-large { font-size: 28px; }
    .auth-brand-tagline { font-size: 14px; }
    .auth-split-form { flex: 1; padding: 32px; }
    .auth-form .form-control {
        padding: 11px 14px;
        font-size: 15px;
    }

    /* Invoice detail topbar: stack title and actions */
    .invoice-topbar { flex-direction: column; align-items: flex-start; gap: 12px; padding: 14px 16px; }
    .invoice-topbar h3 { font-size: 1rem; flex-wrap: wrap; }
    .invoice-topbar .action-buttons { width: 100%; }
    .status-actions { flex-wrap: wrap; margin-left: 0; margin-top: 6px; }

    /* Invoice body: reduce padding */
    .invoice-body { padding: 20px; }

    /* Invoice header: stack letterhead */
    .inv-header { flex-direction: column; gap: 10px; }
    .inv-company-block { text-align: left; }

    /* Billed To: stack */
    .inv-billed-row { flex-direction: column; gap: 6px; }

    /* Signatures: stack */
    .inv-signatures { flex-direction: column; gap: 24px; align-items: center; }
    .inv-sig-block { min-width: unset; width: 200px; }

    /* Account box: full width */
    .inv-account-box { min-width: unset; display: block; width: 100%; }

    /* Invoice footer grid: stack */
    .inv-footer { grid-template-columns: 1fr; }
    .inv-footer > div:nth-child(odd) { border-right: none; }
    .inv-footer > div { border-bottom: 1px solid var(--border-color); }
    .inv-footer > div:last-child { border-bottom: none; }

    /* Tables: ensure horizontal scroll */
    .inv-table, .inv-summary-table { font-size: 0.8rem; }
    .inv-table thead th { padding: 8px 6px; font-size: 0.72rem; }
    .inv-table tbody td { padding: 8px 6px; }

    /* Topbar — tablet */
    .topbar { padding: 10px 16px; }
    .page-title { font-size: 16px; }
    .topbar-right { gap: 8px; }

    /* Filter form */
    .filter-form { gap: 6px; }
    .filter-group { flex: 1 1 auto; min-width: 0; }
    .filter-form select,
    .filter-form input[type="number"] { min-width: unset; width: 100%; }

    /* Upload form */
    .upload-form-grid { grid-template-columns: 1fr 1fr; }

    /* Documents section */
    .inv-documents-section { padding: 16px; }
}

/* ============ Mobile (<768px) ============ */
@media (max-width: 767.98px) {
    /* Content area */
    .content-area { padding: 12px; }

    /* Dashboard: single column */
    .dashboard-grid { grid-template-columns: 1fr !important; gap: 10px; margin-bottom: 16px; }
    .welcome-banner { padding: 20px 16px; margin-bottom: 16px; }
    .welcome-greeting { font-size: 18px; }
    .welcome-summary { font-size: 13px; }
    .stat-card { padding: 14px; gap: 12px; }
    .stat-icon { width: 44px; height: 44px; border-radius: 12px; }
    .stat-icon .icon-lg { width: 20px; height: 20px; }
    .stat-value { font-size: 20px; }
    .period-toggle .btn { font-size: 11px; padding: 4px 8px; }
    .period-toggle { gap: 6px; }
    .period-divider { display: none; }
    .year-select { width: 100%; display: block; margin-top: 4px; }

    /* Forms: single column */
    .form-row { grid-template-columns: 1fr; gap: 8px; }
    .form-group { margin-bottom: 12px; }
    .form-control { padding: 9px 12px; font-size: 14px; }

    /* Filters: stack vertically */
    .filter-form { flex-direction: column; align-items: stretch; }
    .filter-group { width: 100%; }
    .filter-form select,
    .filter-form input[type="number"] { min-width: unset; width: 100%; }
    .table-filters { padding: 10px 12px; }
    .table-summary { padding: 8px 12px; flex-direction: column; gap: 2px; }

    /* Cards */
    .card-header { flex-direction: column; gap: 8px; align-items: flex-start; padding: 12px 14px; }
    .card-body { padding: 14px; }

    /* Auth pages — professional mobile layout with branded header */
    .auth-split-image { display: none; }
    .auth-split-form {
        flex: 1 1 auto;
        padding: 0;
        align-items: stretch;
    }
    .auth-form-wrapper,
    .auth-form-wrapper--wide {
        max-width: 100%;
        padding: 0;
    }
    .auth-logo-area {
        background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 60%, #2563eb 100%);
        color: #ffffff;
        padding: 48px 24px 32px;
        margin-bottom: 0;
        border-radius: 0 0 24px 24px;
    }
    .auth-logo-area .auth-title { color: #ffffff; font-size: 22px; }
    .auth-logo-area .auth-subtitle { color: rgba(255,255,255,0.75); font-size: 13px; }
    .auth-logo-area img { filter: brightness(0) invert(1) !important; opacity: 0.95; }
    .auth-form { padding: 28px 24px 16px; }
    .auth-form .form-group { margin-bottom: 16px; }
    .auth-form .form-group label { font-size: 13px; margin-bottom: 6px; }
    .auth-form .form-control {
        padding: 12px 14px;
        font-size: 15px;
        border-radius: 10px;
    }
    .auth-form .btn-block.btn-lg {
        padding: 14px;
        font-size: 15px;
        border-radius: 12px;
        min-height: 48px;
        margin-top: 8px;
    }
    .auth-footer { padding: 0 24px 8px; }
    .auth-powered-by { padding: 0 24px 20px; }

    /* Topbar — mobile */
    .topbar {
        padding: 8px 12px;
        gap: 8px;
    }
    .topbar-user-pill .user-avatar-name { display: none; }
    .topbar-user-pill { padding: 2px; border: none; background: none; }
    .page-title { font-size: 15px; }
    .btn-menu-toggle {
        width: 40px;
        height: 40px;
        border-radius: 10px;
    }

    /* Invoice detail topbar */
    .invoice-topbar { padding: 12px; }
    .invoice-topbar h3 { font-size: 0.9rem; gap: 6px; }
    .invoice-topbar .action-buttons { flex-wrap: wrap; gap: 4px; }
    .invoice-topbar .action-buttons .btn { font-size: 11px; padding: 4px 8px; }
    .status-actions { gap: 4px; }
    .btn-status { font-size: 10px; padding: 3px 8px; }

    /* Invoice body: tight padding */
    .invoice-body { padding: 14px; }
    .inv-brand { font-size: 1.1rem; }
    .inv-company-name { font-size: 0.9rem; }
    .inv-company-detail { font-size: 0.72rem; }
    .inv-banner { font-size: 0.85rem; padding: 6px 0; letter-spacing: 1.5px; }
    .inv-meta-row { font-size: 0.78rem; flex-direction: column; gap: 2px; }
    .inv-meta-right { text-align: left; }
    .inv-billed .inv-client-name { font-size: 0.85rem; }
    .inv-billed .inv-gstn { font-size: 0.78rem; }
    .inv-service-info { font-size: 0.78rem; margin-left: 8px; }

    /* Summary table: full width on mobile */
    .inv-summary-right { max-width: 100%; margin-left: 0; }

    /* Invoice tables: scrollable with smaller text */
    .inv-table { font-size: 0.72rem; }
    .inv-table thead th { padding: 6px 4px; font-size: 0.68rem; white-space: nowrap; }
    .inv-table tbody td { padding: 6px 4px; }
    .inv-summary-table { font-size: 0.78rem; }
    .inv-summary-table td { padding: 6px; }
    .inv-summary-table .total-row td { font-size: 0.88rem; }

    /* Signatures */
    .inv-signatures { margin-top: 24px; }
    .inv-sig-block { width: 160px; min-width: unset; }
    .inv-sig-line { width: 160px; }
    .inv-sig-label { font-size: 0.75rem; }

    /* Account details */
    .inv-account-box { font-size: 0.78rem; padding: 10px 12px; }

    /* Invoice footer */
    .inv-footer { font-size: 0.75rem; }

    /* Notes / T&C / Email History */
    .inv-extra-section { padding: 12px 14px; }
    .inv-email-section .data-table th,
    .inv-email-section .data-table td { padding: 8px 6px; font-size: 12px; }

    /* Documents section */
    .inv-documents-section { padding: 12px; }
    .documents-header { flex-direction: column; gap: 8px; align-items: flex-start; }
    .upload-form-grid { grid-template-columns: 1fr; }
    .upload-form-area { padding: 12px; }

    /* Data tables: smaller cells */
    .data-table th, .data-table td { padding: 8px 8px; font-size: 12px; }
    .data-table th { font-size: 10px; }

    /* Status dropdown: position from right on mobile */
    .status-dropdown-menu { left: auto; right: 0; }

    /* Employee formset table: tighter on mobile */
    .emp-col-name { min-width: 120px; }
    .emp-col-desg { min-width: 100px; }
    .emp-col-num { min-width: 80px; }
    .emp-col-sm { min-width: 60px; }

    /* Search bar */
    .search-bar { padding: 10px 12px; }
    .search-bar input[type="text"] { min-width: unset !important; }

    /* Pagination */
    .pagination-bar { padding: 10px 12px; flex-direction: column; align-items: center; gap: 8px; }
    .pagination-pages .page-btn { min-width: 30px; height: 30px; font-size: 0.78rem; }

    /* Type select page */
    .type-card { padding: 24px 18px; }
    .type-icon-wrapper { width: 56px; height: 56px; border-radius: 14px; }
    .type-icon-lucide { width: 28px; height: 28px; }
    .type-card h3 { font-size: 16px; }

    /* Buttons */
    .btn-lg { padding: 10px 18px; font-size: 14px; }

    /* Confirm delete */
    .confirm-delete { padding: 24px 16px; }

    /* Detail list */
    .detail-list { grid-template-columns: 1fr; gap: 4px 0; }
    .detail-list dt { font-weight: 600; color: var(--text-muted); }

    /* Sidebar — mobile */
    .sidebar { width: 280px; }
    .sidebar-header { padding: 14px 16px; }
    .sidebar-brand { font-size: 18px; }
    .sidebar-close-btn { width: 36px; height: 36px; }
    .sidebar-footer { padding: 14px; }
    .btn-logout { padding: 12px; font-size: 13px; min-height: 44px; }
    .user-info-row { margin-bottom: 10px; }
}

/* ============ Small phones (<480px) ============ */
@media (max-width: 479.98px) {
    .content-area { padding: 8px; }
    .welcome-banner { padding: 16px 12px; }
    .welcome-greeting { font-size: 16px; }
    .stat-card { padding: 12px; gap: 10px; }
    .stat-value { font-size: 18px; }
    .stat-icon { width: 38px; height: 38px; }
    .stat-icon .icon-lg { width: 18px; height: 18px; }

    .invoice-body { padding: 10px; }
    .inv-brand { font-size: 0.95rem; }
    .invoice-topbar .action-buttons .btn span { display: none; }

    .btn-sm { padding: 4px 8px; font-size: 11px; }
    .badge { font-size: 10px; padding: 3px 7px; }

    /* Auth — small phones */
    .auth-logo-area { padding: 36px 16px 24px; }
    .auth-logo-area .auth-title { font-size: 20px; }
    .auth-form { padding: 24px 16px 12px; }
    .auth-footer { padding: 0 16px 6px; }
    .auth-powered-by { padding: 0 16px 16px; }
    .sidebar { width: 260px; }
}
