/* 
   assets/css/style.css
   Modern, responsive, glassmorphic UI design system for Billing Software
   Uses custom properties, Flexbox/Grid, and Outfit/Inter fonts.
*/

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

:root {
    /* Color Palette */
    --bg-base: #080c14;
    --bg-surface: #0f172a;
    --bg-card: #1e293b;
    --bg-sidebar: #0b0f19;
    --border-color: #334155;
    
    --primary: #3b82f6;
    --primary-hover: #2563eb;
    --primary-glow: rgba(59, 130, 246, 0.25);
    
    --accent: #8b5cf6;
    --accent-hover: #7c3aed;
    --accent-glow: rgba(139, 92, 246, 0.25);
    
    --success: #10b981;
    --success-bg: rgba(16, 185, 129, 0.1);
    --danger: #ef4444;
    --danger-bg: rgba(239, 68, 68, 0.1);
    --warning: #f59e0b;
    --warning-bg: rgba(245, 158, 11, 0.1);
    --info: #06b6d4;
    --info-bg: rgba(6, 182, 212, 0.1);
    
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --text-dim: #64748b;
    
    --font-heading: 'Outfit', sans-serif;
    --font-body: 'Inter', sans-serif;
    
    --radius-sm: 6px;
    --radius-md: 12px;
    --radius-lg: 18px;
    --radius-full: 9999px;
    
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-premium: 0 20px 25px -5px rgba(0, 0, 0, 0.25), 0 10px 10px -5px rgba(0, 0, 0, 0.2);
    
    --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    --sidebar-width: 260px;
}

/* Light Theme Overrides (if toggled) */
[data-theme="light"] {
    --bg-base: #f8fafc;
    --bg-surface: #ffffff;
    --bg-card: #f1f5f9;
    --bg-sidebar: #0f172a; /* Keep dark sidebar for contrast */
    --border-color: #cbd5e1;
    --text-main: #0f172a;
    --text-muted: #475569;
    --text-dim: #94a3b8;
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.04);
}

/* Base Styles */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-base);
    color: var(--text-main);
    font-family: var(--font-body);
    font-size: 15px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    font-weight: 600;
    letter-spacing: -0.02em;
}

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

a:hover {
    color: var(--primary-hover);
}

input, select, textarea {
    font-family: var(--font-body);
}

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: var(--bg-base);
}
::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--text-dim);
}

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

/* Sidebar Navigation */
.sidebar {
    width: var(--sidebar-width);
    background: linear-gradient(185deg, #0b1120 0%, #060913 100%);
    border-right: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    left: 0;
    top: 0;
    z-index: 100;
    transition: var(--transition);
    box-shadow: 10px 0 30px rgba(0, 0, 0, 0.25);
}

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

.brand-icon {
    width: 38px;
    height: 38px;
    background: linear-gradient(135deg, #3b82f6, #8b5cf6, #d946ef);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    font-size: 18px;
    box-shadow: 0 0 15px rgba(139, 92, 246, 0.5);
    flex-shrink: 0;
    transition: transform 0.3s ease;
}

.sidebar-brand:hover .brand-icon {
    transform: rotate(10deg) scale(1.05);
}

.brand-name {
    font-size: 15px;
    font-weight: 700;
    font-family: var(--font-heading);
    color: #fff;
    line-height: 1.3;
    word-break: break-word;
    flex: 1;
    min-width: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    letter-spacing: -0.01em;
}

.sidebar-menu {
    list-style: none;
    padding: 24px 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
}

.sidebar-item a {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 16px;
    border-radius: 10px;
    color: var(--text-muted);
    font-weight: 600;
    font-family: var(--font-heading);
    font-size: 14.5px;
    letter-spacing: 0.01em;
    transition: var(--transition);
}

.sidebar-item a i {
    font-size: 18px;
    transition: transform 0.25s ease, color 0.25s ease;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
}

.sidebar-item a:hover {
    background-color: rgba(255, 255, 255, 0.04);
    color: #fff;
}

.sidebar-item a:hover i {
    transform: scale(1.2) rotate(-5deg);
}

/* Individual Colorful Active States & Icon Colors */

/* 1. Dashboard - Sky Blue */
.sidebar-item:nth-child(1) a i { color: #38bdf8; }
.sidebar-item:nth-child(1).active a {
    color: #38bdf8 !important;
    background: linear-gradient(90deg, rgba(56, 189, 248, 0.12), transparent);
    border-left: 4px solid #38bdf8;
    padding-left: 12px;
    box-shadow: inset 5px 0 15px rgba(56, 189, 248, 0.04);
}
.sidebar-item:nth-child(1).active a i {
    color: #38bdf8;
    filter: drop-shadow(0 0 8px rgba(56, 189, 248, 0.6));
}

/* 2. Clients - Emerald Green */
.sidebar-item:nth-child(2) a i { color: #34d399; }
.sidebar-item:nth-child(2).active a {
    color: #34d399 !important;
    background: linear-gradient(90deg, rgba(52, 211, 153, 0.12), transparent);
    border-left: 4px solid #34d399;
    padding-left: 12px;
    box-shadow: inset 5px 0 15px rgba(52, 211, 153, 0.04);
}
.sidebar-item:nth-child(2).active a i {
    color: #34d399;
    filter: drop-shadow(0 0 8px rgba(52, 211, 153, 0.6));
}

/* 3. Estimates - Amber Gold */
.sidebar-item:nth-child(3) a i { color: #fbbf24; }
.sidebar-item:nth-child(3).active a {
    color: #fbbf24 !important;
    background: linear-gradient(90deg, rgba(251, 191, 36, 0.12), transparent);
    border-left: 4px solid #fbbf24;
    padding-left: 12px;
    box-shadow: inset 5px 0 15px rgba(251, 191, 36, 0.04);
}
.sidebar-item:nth-child(3).active a i {
    color: #fbbf24;
    filter: drop-shadow(0 0 8px rgba(251, 191, 36, 0.6));
}

/* 4. Invoices - Hot Pink */
.sidebar-item:nth-child(4) a i { color: #f472b6; }
.sidebar-item:nth-child(4).active a {
    color: #f472b6 !important;
    background: linear-gradient(90deg, rgba(244, 114, 182, 0.12), transparent);
    border-left: 4px solid #f472b6;
    padding-left: 12px;
    box-shadow: inset 5px 0 15px rgba(244, 114, 182, 0.04);
}
.sidebar-item:nth-child(4).active a i {
    color: #f472b6;
    filter: drop-shadow(0 0 8px rgba(244, 114, 182, 0.6));
}

/* 5. Settings - Purple */
.sidebar-item:nth-child(5) a i { color: #a78bfa; }
.sidebar-item:nth-child(5).active a {
    color: #a78bfa !important;
    background: linear-gradient(90deg, rgba(167, 139, 250, 0.12), transparent);
    border-left: 4px solid #a78bfa;
    padding-left: 12px;
    box-shadow: inset 5px 0 15px rgba(167, 139, 250, 0.04);
}
.sidebar-item:nth-child(5).active a i {
    color: #a78bfa;
    filter: drop-shadow(0 0 8px rgba(167, 139, 250, 0.6));
}

.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.03);
    background-color: rgba(0, 0, 0, 0.3);
}

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

.user-avatar {
    width: 38px;
    height: 38px;
    background: linear-gradient(135deg, #3b82f6, #ec4899);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    color: white;
    box-shadow: 0 0 12px rgba(236, 72, 153, 0.3);
}

.user-details {
    flex: 1;
    overflow: hidden;
}

.user-name {
    font-size: 13px;
    font-weight: 600;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-role {
    font-size: 11px;
    color: var(--text-muted);
}

.logout-btn {
    color: var(--text-dim);
    font-size: 18px;
    padding: 6px;
    border-radius: 8px;
    transition: var(--transition);
}

.logout-btn:hover {
    color: var(--danger);
    background-color: rgba(239, 68, 68, 0.15);
}

/* Main Content Panel */
.main-panel {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: var(--transition);
}

/* Navbar / Header */
.topbar {
    height: 70px;
    background-color: var(--bg-surface);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 30px;
    position: sticky;
    top: 0;
    z-index: 90;
    gap: 15px;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 15px;
    min-width: 0;
    flex: 1;
}

.page-title-area {
    min-width: 0;
    flex: 1;
}

.page-title-area h2 {
    font-size: 20px;
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

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

.theme-toggle {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 20px;
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    transition: var(--transition);
}

.theme-toggle:hover {
    background-color: rgba(255, 255, 255, 0.05);
    color: var(--text-main);
}

/* Main Inner Container */
.content-wrapper {
    padding: 30px;
    flex: 1;
}

/* Installer Page & Login Page Layout */
.auth-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at 10% 20%, rgba(90, 85, 240, 0.15) 0%, rgba(0, 0, 0, 0) 90.2%), var(--bg-base);
    padding: 20px;
}

.auth-card {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 500px;
    padding: 40px;
    box-shadow: var(--shadow-premium);
    backdrop-filter: blur(10px);
}

.auth-header {
    text-align: center;
    margin-bottom: 30px;
}

.auth-logo {
    display: inline-flex;
    margin-bottom: 15px;
}

.auth-logo .brand-icon {
    width: 48px;
    height: 48px;
    font-size: 24px;
}

.auth-header h1 {
    font-size: 24px;
    margin-bottom: 8px;
}

.auth-header p {
    color: var(--text-muted);
    font-size: 14px;
}

/* Grid & Layout Helpers */
.grid-3 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.grid-2 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.metadata-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 20px;
    margin-bottom: 30px;
}

/* Stats Cards */
.card-stat {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.card-stat:hover {
    transform: translateY(-3px);
    border-color: var(--primary);
    box-shadow: 0 8px 24px var(--primary-glow);
}

.card-stat::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: linear-gradient(90deg, var(--primary), var(--accent));
    opacity: 0;
    transition: var(--transition);
}

.card-stat:hover::after {
    opacity: 1;
}

.stat-info .stat-label {
    font-size: 13px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
    margin-bottom: 8px;
}

.stat-info .stat-value {
    font-size: 28px;
    font-weight: 700;
    color: #fff;
    font-family: var(--font-heading);
}

.stat-icon {
    width: 52px;
    height: 52px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
}

.stat-icon.primary { background-color: rgba(59, 130, 246, 0.1); color: var(--primary); }
.stat-icon.success { background-color: rgba(16, 185, 129, 0.1); color: var(--success); }
.stat-icon.warning { background-color: rgba(245, 158, 11, 0.1); color: var(--warning); }
.stat-icon.danger { background-color: rgba(239, 68, 68, 0.1); color: var(--danger); }

/* Standard Cards */
.card {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: var(--shadow-sm);
}

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

.card-header h3 {
    font-size: 18px;
    color: var(--text-main);
}

.card-header-actions {
    display: flex;
    gap: 10px;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    border: 1px solid transparent;
    transition: var(--transition);
    text-align: center;
}

.btn-primary {
    background-color: var(--primary);
    color: #fff;
}
.btn-primary:hover {
    background-color: var(--primary-hover);
    box-shadow: 0 4px 12px var(--primary-glow);
}

.btn-accent {
    background-color: var(--accent);
    color: #fff;
}
.btn-accent:hover {
    background-color: var(--accent-hover);
    box-shadow: 0 4px 12px var(--accent-glow);
}

.btn-secondary {
    background-color: transparent;
    border-color: var(--border-color);
    color: var(--text-main);
}
.btn-secondary:hover {
    background-color: rgba(255, 255, 255, 0.05);
    border-color: var(--text-muted);
}

.btn-success {
    background-color: var(--success);
    color: #fff;
}
.btn-success:hover {
    background-color: #059669;
}

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

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
    border-radius: 6px;
}

.btn-xs {
    padding: 4px 8px;
    font-size: 11px;
    border-radius: 4px;
}

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

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

.form-row .form-group {
    flex: 1;
}

label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-muted);
}

.form-control {
    width: 100%;
    padding: 10px 14px;
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-main);
    font-size: 14px;
    transition: var(--transition);
    outline: none;
}

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

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

.form-check {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 15px;
}

.form-check input {
    cursor: pointer;
}

/* Alert Notification */
.alert {
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 14px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    border: 1px solid transparent;
}

.alert-success {
    background-color: var(--success-bg);
    border-color: rgba(16, 185, 129, 0.2);
    color: #34d399;
}

.alert-danger {
    background-color: var(--danger-bg);
    border-color: rgba(239, 68, 68, 0.2);
    color: #fca5a5;
}

.alert-warning {
    background-color: var(--warning-bg);
    border-color: rgba(245, 158, 11, 0.2);
    color: #fcd34d;
}

/* Tables */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    width: 100%;
}

.table-responsive .table {
    min-width: 850px;
}

.table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 5px;
    text-align: left;
}

.table th {
    padding: 14px 16px;
    background-color: rgba(255, 255, 255, 0.02);
    border-bottom: 2px solid var(--border-color);
    color: var(--text-muted);
    font-weight: 600;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    white-space: nowrap;
}

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

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

.table tbody tr:hover {
    background-color: rgba(255, 255, 255, 0.01);
}

/* Status Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 8px;
    border-radius: var(--radius-full);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.badge-paid, .badge-accepted {
    background-color: var(--success-bg);
    color: var(--success);
}

.badge-unpaid, .badge-sent {
    background-color: var(--warning-bg);
    color: var(--warning);
}

.badge-draft {
    background-color: rgba(148, 163, 184, 0.1);
    color: var(--text-muted);
}

.badge-cancelled, .badge-declined {
    background-color: var(--danger-bg);
    color: var(--danger);
}

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

/* Dynamic Line Items Table (Create / Edit Invoices & Estimates) */
.item-table {
    margin-top: 20px;
    margin-bottom: 30px;
}

.item-table th {
    background: none;
    border-bottom: 1px solid var(--border-color);
}

.item-table td {
    padding: 10px 5px;
    border-bottom: 1px dashed var(--border-color);
}

.item-table td:last-child {
    text-align: center;
}

.item-desc {
    width: 60%;
}

.item-qty {
    width: 12%;
}

.item-price {
    width: 15%;
}

.item-total {
    width: 13%;
    text-align: right;
    font-weight: 600;
}

/* Billing Totals Layout */
.invoice-totals {
    display: flex;
    justify-content: flex-end;
    margin-top: 20px;
}

.totals-table {
    width: 320px;
    font-size: 14px;
}

.totals-table tr td {
    padding: 8px 12px;
    border: none;
}

.totals-table tr td:last-child {
    text-align: right;
}

.totals-table tr.border-t td {
    border-top: 1px solid var(--border-color);
}

.totals-table tr.grand-total td {
    font-size: 18px;
    font-weight: 700;
    color: #fff;
    padding-top: 12px;
}

/* Invoice / Estimate Viewer (For Print/Client Preview) */
.document-view-container {
    max-width: 900px;
    margin: 0 auto;
    background-color: #fff;
    color: #0f172a;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    padding: 50px;
    border-top: 6px solid #4f46e5; /* Modern Indigo brand accent bar */
    position: relative;
    overflow: hidden;
}

.doc-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #e2e8f0;
    padding-bottom: 24px;
    margin-bottom: 30px;
}

.doc-logo-area {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.doc-logo-text {
    font-family: var(--font-heading);
    font-size: 26px;
    font-weight: 800;
    color: #0f172a;
}

.doc-company-details, .doc-client-details {
    font-size: 13px;
    line-height: 1.6;
    color: #475569;
}

.doc-title-area {
    text-align: right;
}

.doc-title {
    font-size: 36px;
    font-weight: 900;
    color: #4f46e5; /* Styled in Indigo */
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.doc-meta {
    font-size: 13px;
    color: #475569;
    margin-top: 10px;
}

.doc-meta span {
    display: block;
    margin-bottom: 4px;
}

.doc-details-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    margin-bottom: 40px;
}

.doc-section-title {
    font-size: 11px;
    text-transform: uppercase;
    font-weight: 700;
    letter-spacing: 0.05em;
    color: #4f46e5; /* Brand Indigo title */
    margin-bottom: 10px;
    border-bottom: 1px solid #cbd5e1;
    padding-bottom: 4px;
}

.doc-items-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 30px;
}

.doc-items-table th {
    padding: 12px 15px;
    background-color: #f8fafc; /* Beautiful soft header background */
    color: #475569;
    font-size: 12px;
    text-transform: uppercase;
    font-weight: 700;
    text-align: left;
    border-bottom: 2px solid #e2e8f0;
}

.doc-items-table td {
    padding: 14px 15px;
    border-bottom: 1px solid #e2e8f0;
    font-size: 14px;
    color: #0f172a;
}

.doc-items-table td.text-right,
.doc-items-table th.text-right {
    text-align: right;
}

.doc-totals {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 40px;
}

.doc-totals-table {
    width: 300px;
}

.doc-totals-table td {
    padding: 8px 15px;
    font-size: 14px;
    color: #475569;
}

.doc-totals-table tr.border-t td {
    border-top: 1px solid #e2e8f0;
}

.doc-totals-table tr.grand-total td {
    font-size: 22px;
    font-weight: 900;
    color: #4f46e5; /* Brand Indigo total */
    padding-top: 15px;
    border-top: 2px solid #4f46e5;
}

.doc-footer {
    border-top: 1px solid #e2e8f0;
    padding-top: 24px;
    font-size: 12px;
    color: #64748b;
    text-align: center;
}

/* Page action bar (Fixed at bottom for preview actions) */
.doc-actions-bar {
    max-width: 900px;
    margin: 20px auto 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Mobile Sidebar Toggle Button */
.menu-toggle {
    display: none;
    font-size: 20px;
    background: none;
    border: none;
    color: var(--text-main);
    cursor: pointer;
}

/* Responsive CSS */
body, html {
    max-width: 100%;
    overflow-x: hidden;
}

.app-container {
    max-width: 100%;
    overflow-x: hidden;
}

@media (max-width: 991px) {
    .sidebar {
        transform: translateX(-100%);
    }
    
    .sidebar.open {
        transform: translateX(0);
    }
    
    .main-panel {
        margin-left: 0;
        min-width: 0;
    }
    
    .menu-toggle {
        display: block;
    }
    
    .content-wrapper {
        padding: 20px;
    }
    
    .topbar {
        padding: 0 20px;
    }
}

@media (max-width: 768px) {
    .grid-3, .grid-2, .metadata-grid {
        grid-template-columns: 1fr;
    }
    
    .form-row {
        flex-direction: column;
        gap: 0;
    }
    
    .topbar-actions .btn-text {
        display: none;
    }
    
    .topbar-actions .btn {
        padding: 8px 12px;
    }
    
    .page-title-area h2 {
        font-size: 17px;
    }
    
    .doc-details-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .document-view-container {
        padding: 30px 20px;
    }
}

@media (max-width: 480px) {
    .content-wrapper {
        padding: 15px;
    }
    
    .topbar {
        padding: 0 15px;
    }
    
    .page-title-area h2 {
        font-size: 15px;
    }
    
    .doc-header {
        flex-direction: column;
        gap: 20px;
    }
    
    .doc-title-area {
        text-align: left;
    }
    
    .doc-logo-text {
        font-size: 22px;
    }
    
    .doc-title {
        font-size: 24px;
    }
    
    .totals-table, .doc-totals-table {
        width: 100%;
    }
}

/* Print Styles */
@media print {
    body {
        background: #fff !important;
        color: #000 !important;
    }
    
    .sidebar, .topbar, .doc-actions-bar, .no-print {
        display: none !important;
    }
    
    .main-panel {
        margin-left: 0 !important;
        min-height: auto !important;
    }
    
    .content-wrapper {
        padding: 0 !important;
    }
    
    .document-view-container {
        border: none !important;
        box-shadow: none !important;
        padding: 0 !important;
        max-width: 100% !important;
        margin: 0 !important;
    }
    
    .doc-items-table th {
        border-bottom-color: #000 !important;
    }
    
    .doc-items-table td {
        border-bottom-color: #ccc !important;
    }
    
    .doc-totals-table tr.border-t td {
        border-top-color: #000 !important;
    }
}
