/* ========================================
   BIZBOOK - VYAPAR CLONE STYLES
   ======================================== */

:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --secondary: #7c3aed;
    --success: #16a34a;
    --danger: #dc2626;
    --warning: #d97706;
    --info: #0891b2;
    --dark: #1e1b4b;
    --sidebar-bg: #1e1b4b;
    --sidebar-text: #c7d2fe;
    --sidebar-active: #4f46e5;
    --sidebar-hover: rgba(255,255,255,0.08);
    --bg: #f8fafc;
    --card-bg: #ffffff;
    --border: #e2e8f0;
    --text: #1e293b;
    --text-muted: #64748b;
    --shadow: 0 1px 3px rgba(0,0,0,0.1);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.07);
    --shadow-lg: 0 10px 25px rgba(0,0,0,0.1);
    --radius: 8px;
    --radius-lg: 12px;
    --transition: 0.2s ease;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif; font-size: 14px; color: var(--text); }

/* ---- AUTH ---- */
.auth-body { background: linear-gradient(135deg, #1e1b4b 0%, #312e81 40%, #4f46e5 100%); min-height: 100vh; display: flex; align-items: center; justify-content: center; }
.auth-container { width: 100%; padding: 20px; }
.auth-card { background: #fff; border-radius: 20px; padding: 40px; width: 100%; max-width: 420px; margin: 0 auto; box-shadow: 0 25px 60px rgba(0,0,0,0.3); }
.auth-logo { text-align: center; margin-bottom: 30px; }
.logo-icon { width: 60px; height: 60px; background: linear-gradient(135deg, #4f46e5, #7c3aed); border-radius: 16px; display: flex; align-items: center; justify-content: center; margin: 0 auto 12px; }
.logo-icon i { font-size: 26px; color: white; }
.auth-logo h2 { font-size: 26px; font-weight: 700; color: var(--dark); }
.auth-logo p { color: var(--text-muted); font-size: 13px; margin-top: 4px; }
.auth-form .form-group { margin-bottom: 18px; }
.auth-form label { display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; color: var(--text); margin-bottom: 6px; }
.auth-divider { text-align: center; margin: 20px 0; position: relative; }
.auth-divider::before { content: ''; position: absolute; top: 50%; left: 0; right: 0; height: 1px; background: var(--border); }
.auth-divider span { background: #fff; padding: 0 12px; position: relative; color: var(--text-muted); font-size: 12px; }
.auth-footer { text-align: center; margin-top: 20px; color: var(--text-muted); font-size: 13px; }
.auth-footer a { color: var(--primary); text-decoration: none; font-weight: 600; }

/* ---- FORMS ---- */
.form-control { width: 100%; padding: 10px 14px; border: 1.5px solid var(--border); border-radius: var(--radius); font-size: 14px; color: var(--text); background: #fff; transition: border-color var(--transition); outline: none; }
.form-control:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,0.1); }
.form-control-sm { padding: 7px 10px; border: 1px solid var(--border); border-radius: 6px; font-size: 13px; color: var(--text); background: #fff; outline: none; }
.form-control-sm:focus { border-color: var(--primary); }
.form-control-xs { padding: 4px 6px; border: 1px solid var(--border); border-radius: 4px; font-size: 12px; color: var(--text); background: #fff; outline: none; width: 100%; }
.form-control-xs:focus { border-color: var(--primary); }
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 12px; font-weight: 600; color: var(--text-muted); margin-bottom: 5px; text-transform: uppercase; letter-spacing: 0.3px; }
.form-row { display: flex; gap: 14px; }
.form-row .form-group { flex: 1; }
.form-actions { display: flex; gap: 12px; margin-top: 24px; }
.password-wrap { position: relative; }
.password-wrap .form-control { padding-right: 40px; }
.toggle-pass { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); cursor: pointer; color: var(--text-muted); }

/* ---- BUTTONS ---- */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 9px 18px; border-radius: var(--radius); font-size: 13px; font-weight: 600; cursor: pointer; border: none; text-decoration: none; transition: all var(--transition); white-space: nowrap; }
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(37,99,235,0.4); }
.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { background: #b91c1c; }
.btn-success { background: var(--success); color: white; }
.btn-success:hover { background: #15803d; }
.btn-outline { background: transparent; color: var(--text); border: 1.5px solid var(--border); }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); background: rgba(37,99,235,0.05); }
.btn-google { background: white; color: var(--text); border: 1.5px solid var(--border); }
.btn-google:hover { background: #f8fafc; box-shadow: var(--shadow-md); }
.btn-full { width: 100%; justify-content: center; }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-icon { width: 36px; height: 36px; padding: 0; justify-content: center; border: 1.5px solid var(--border); border-radius: var(--radius); background: white; color: var(--text); cursor: pointer; }
.btn-icon:hover { border-color: var(--primary); color: var(--primary); }
.btn-icon-sm { width: 30px; height: 30px; padding: 0; justify-content: center; border: none; background: transparent; color: var(--text-muted); cursor: pointer; font-size: 14px; border-radius: 6px; display: inline-flex; align-items: center; }
.btn-icon-sm:hover { background: var(--bg); color: var(--text); }
.btn-add-row { width: 24px; height: 24px; border-radius: 50%; background: var(--primary); color: white; border: none; cursor: pointer; font-size: 12px; display: flex; align-items: center; justify-content: center; }

/* ---- ALERTS ---- */
.alert { padding: 12px 16px; border-radius: var(--radius); font-size: 13px; font-weight: 500; display: flex; align-items: center; gap: 8px; margin-bottom: 16px; transition: opacity 0.5s; }
.alert-danger { background: #fef2f2; color: var(--danger); border: 1px solid #fecaca; }
.alert-success { background: #f0fdf4; color: var(--success); border: 1px solid #bbf7d0; }
.inline-alert { margin-bottom: 0; padding: 6px 12px; font-size: 12px; }

/* ---- APP LAYOUT ---- */
.app-body { background: var(--bg); }
.app-layout { display: flex; height: 100vh; overflow: hidden; }
.main-content { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.content-area { flex: 1; overflow-y: auto; padding: 20px; }

/* ---- SIDEBAR ---- */
.sidebar { width: 240px; background: var(--sidebar-bg); color: var(--sidebar-text); display: flex; flex-direction: column; overflow: hidden; transition: width var(--transition); flex-shrink: 0; }
.sidebar.collapsed { width: 60px; }
.sidebar-header { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; border-bottom: 1px solid rgba(255,255,255,0.08); }
.sidebar-logo { display: flex; align-items: center; gap: 10px; }
.logo-icon-sm { width: 32px; height: 32px; background: linear-gradient(135deg, #4f46e5, #7c3aed); border-radius: 8px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.logo-icon-sm i { font-size: 14px; color: white; }
.logo-text { font-size: 16px; font-weight: 700; color: white; white-space: nowrap; }
.sidebar.collapsed .logo-text, .sidebar.collapsed .business-info, .sidebar.collapsed .search-bar-side, .sidebar.collapsed span, .sidebar.collapsed .trial-box, .sidebar.collapsed .premium-btn span, .sidebar.collapsed .company-btn span { display: none; }
.sidebar-toggle { background: transparent; border: none; color: rgba(255,255,255,0.6); cursor: pointer; font-size: 16px; padding: 4px; }

.business-name-wrap { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid rgba(255,255,255,0.08); cursor: pointer; }
.business-name-wrap:hover { background: var(--sidebar-hover); }
.business-avatar { width: 36px; height: 36px; background: rgba(255,255,255,0.15); border-radius: 8px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; overflow: hidden; }
.business-avatar img { width: 100%; height: 100%; object-fit: cover; }
.business-avatar i { color: rgba(255,255,255,0.7); }
.business-info strong { display: block; font-size: 12px; color: white; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 150px; }
.business-info small { font-size: 10px; color: rgba(255,255,255,0.5); }

.sidebar-nav { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 8px 0; }
.sidebar-nav::-webkit-scrollbar { width: 3px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.2); border-radius: 3px; }

.search-bar-side { display: flex; align-items: center; gap: 8px; margin: 8px 12px; background: rgba(255,255,255,0.08); border-radius: 8px; padding: 8px 12px; }
.search-bar-side i { color: rgba(255,255,255,0.5); font-size: 12px; }
.search-bar-side input { background: transparent; border: none; outline: none; color: white; font-size: 12px; width: 100%; }
.search-bar-side input::placeholder { color: rgba(255,255,255,0.4); }

.nav-list { list-style: none; }
.nav-item > a { display: flex; align-items: center; gap: 10px; padding: 9px 16px; color: var(--sidebar-text); text-decoration: none; font-size: 13px; font-weight: 500; transition: all var(--transition); white-space: nowrap; }
.nav-item > a:hover { background: var(--sidebar-hover); color: white; }
.nav-item.active > a { background: var(--sidebar-active); color: white; }
.nav-item > a i:first-child { width: 18px; font-size: 14px; flex-shrink: 0; }
.nav-item > a .arrow { margin-left: auto; font-size: 10px; transition: transform var(--transition); }
.nav-item.open > a .arrow { transform: rotate(180deg); }
.nav-item .nav-badge { background: #10b981; color: white; font-size: 10px; padding: 1px 6px; border-radius: 10px; margin-left: auto; }
.sub-menu { list-style: none; overflow: hidden; max-height: 0; transition: max-height 0.3s ease; }
.nav-item.open .sub-menu { max-height: 300px; }
.sub-menu li a { display: flex; align-items: center; gap: 8px; padding: 7px 16px 7px 44px; color: rgba(199,210,254,0.8); text-decoration: none; font-size: 12px; transition: all var(--transition); }
.sub-menu li a:hover { color: white; background: var(--sidebar-hover); }
.sub-menu li a i { font-size: 12px; }

.sidebar-footer { padding: 12px; border-top: 1px solid rgba(255,255,255,0.08); }
.trial-box { margin-bottom: 10px; }
.trial-text { font-size: 11px; color: #fbbf24; font-weight: 600; margin-bottom: 5px; }
.trial-bar { background: rgba(255,255,255,0.1); border-radius: 4px; height: 4px; }
.trial-progress { background: #fbbf24; border-radius: 4px; height: 4px; width: 30%; }
.premium-btn { display: flex; align-items: center; gap: 8px; padding: 9px 12px; background: linear-gradient(135deg, #f59e0b, #d97706); border-radius: 8px; color: white; text-decoration: none; font-size: 12px; font-weight: 600; margin-bottom: 6px; }
.premium-btn:hover { opacity: 0.9; }
.company-btn { display: flex; align-items: center; gap: 8px; padding: 8px 12px; color: var(--sidebar-text); text-decoration: none; font-size: 12px; border-radius: 8px; }
.company-btn:hover { background: var(--sidebar-hover); color: white; }

/* ---- HEADER ---- */
.main-header { background: white; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; padding: 0 20px; height: 52px; flex-shrink: 0; box-shadow: var(--shadow); }
.header-left { display: flex; align-items: center; gap: 16px; }
.mobile-menu-btn { background: transparent; border: none; font-size: 18px; cursor: pointer; color: var(--text-muted); display: none; }
.business-name-header { font-size: 16px; font-weight: 600; color: var(--text); outline: none; border-bottom: 2px solid transparent; padding: 2px 4px; min-width: 150px; cursor: text; }
.business-name-header:empty::before { content: attr(placeholder); color: var(--text-muted); }
.business-name-header:focus { border-bottom-color: var(--primary); }
.header-right { display: flex; align-items: center; gap: 10px; }
.header-user { display: flex; align-items: center; gap: 8px; cursor: pointer; padding: 6px 10px; border-radius: var(--radius); position: relative; }
.header-user:hover { background: var(--bg); }
.user-avatar { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; }
.user-avatar-text { width: 32px; height: 32px; border-radius: 50%; background: linear-gradient(135deg, var(--primary), var(--secondary)); color: white; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; }
.user-dropdown { position: absolute; top: 100%; right: 0; background: white; border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); min-width: 180px; z-index: 1000; display: none; padding: 8px; }
.user-dropdown.show { display: block; }
.user-dropdown a { display: flex; align-items: center; gap: 10px; padding: 9px 12px; color: var(--text); text-decoration: none; border-radius: var(--radius); font-size: 13px; }
.user-dropdown a:hover { background: var(--bg); color: var(--primary); }
.user-dropdown hr { border: none; border-top: 1px solid var(--border); margin: 6px 0; }

/* ---- DASHBOARD ---- */
.dashboard-grid { display: grid; grid-template-columns: 1fr 280px; gap: 20px; }
.dashboard-main { display: flex; flex-direction: column; gap: 20px; }
.dashboard-sidebar { display: flex; flex-direction: column; gap: 16px; }
.stats-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.stat-card { background: white; border-radius: var(--radius-lg); padding: 20px; box-shadow: var(--shadow); border: 1px solid var(--border); }
.stat-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.stat-top span { font-size: 13px; color: var(--text-muted); font-weight: 500; }
.stat-icon { width: 36px; height: 36px; border-radius: 50%; display: flex; align-items: center; justify-content: center; }
.stat-icon.green { background: #dcfce7; color: var(--success); }
.stat-icon.red { background: #fef2f2; color: var(--danger); }
.stat-amount { font-size: 26px; font-weight: 700; color: var(--text); }
.stat-sub { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

.chart-card { background: white; border-radius: var(--radius-lg); padding: 20px; box-shadow: var(--shadow); border: 1px solid var(--border); }
.chart-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.chart-header h3 { font-size: 15px; font-weight: 600; color: var(--text-muted); }
.chart-right { display: flex; align-items: center; gap: 12px; }
.chart-right strong { font-size: 20px; color: var(--text); }
.period-select { border: 1px solid var(--border); border-radius: var(--radius); padding: 5px 10px; font-size: 12px; cursor: pointer; outline: none; }
.chart-container { height: 200px; }

.section-card { background: white; border-radius: var(--radius-lg); padding: 20px; box-shadow: var(--shadow); border: 1px solid var(--border); }
.section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.section-header h3 { font-size: 14px; font-weight: 600; }
.view-all { color: var(--primary); text-decoration: none; font-size: 12px; font-weight: 600; }

.reports-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.report-item { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius); text-decoration: none; color: var(--text); font-size: 13px; transition: all var(--transition); }
.report-item:hover { border-color: var(--primary); color: var(--primary); background: rgba(37,99,235,0.03); }

.widget-card { background: white; border-radius: var(--radius-lg); padding: 16px; box-shadow: var(--shadow); border: 1px solid var(--border); }
.widget-header { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.widget-header strong { font-size: 13px; }
.widget-header p { font-size: 11px; color: var(--text-muted); }
.badge-logged-out { background: #fef3c7; color: #92400e; font-size: 10px; padding: 2px 6px; border-radius: 4px; font-weight: 600; }
.add-widget { display: flex; align-items: center; justify-content: space-between; border-style: dashed; }
.add-widget span { font-size: 12px; color: var(--text-muted); }

/* ---- PAGE HEADER ---- */
.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; flex-wrap: wrap; gap: 12px; }
.page-header h2 { font-size: 20px; font-weight: 700; }
.page-header-left { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.page-header-right { display: flex; align-items: center; gap: 10px; }

.filter-tabs { display: flex; gap: 4px; background: var(--bg); padding: 4px; border-radius: var(--radius); }
.tab { padding: 6px 14px; border-radius: 6px; text-decoration: none; font-size: 12px; font-weight: 600; color: var(--text-muted); display: flex; align-items: center; gap: 5px; }
.tab.active { background: white; color: var(--primary); box-shadow: var(--shadow); }
.tab:hover:not(.active) { color: var(--text); }

.search-box { position: relative; }
.search-box i { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--text-muted); font-size: 13px; }
.search-box .form-control { padding-left: 32px; width: 220px; }

/* ---- TABLES ---- */
.table-card { background: white; border-radius: var(--radius-lg); box-shadow: var(--shadow); border: 1px solid var(--border); overflow: hidden; }
.data-table { width: 100%; border-collapse: collapse; }
.data-table thead tr { background: var(--bg); border-bottom: 2px solid var(--border); }
.data-table th { padding: 11px 14px; text-align: left; font-size: 11px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; white-space: nowrap; }
.data-table td { padding: 12px 14px; font-size: 13px; border-bottom: 1px solid #f1f5f9; vertical-align: middle; }
.data-table tbody tr:hover { background: #f8fafc; }
.data-table tbody tr:last-child td { border-bottom: none; }
.invoice-link { color: var(--primary); text-decoration: none; font-weight: 600; }
.invoice-link:hover { text-decoration: underline; }
.actions { display: flex; gap: 6px; align-items: center; }
.btn-action { width: 30px; height: 30px; border-radius: 6px; border: 1px solid var(--border); background: white; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; text-decoration: none; color: var(--text-muted); font-size: 13px; transition: all var(--transition); }
.btn-action:hover { border-color: var(--primary); color: var(--primary); background: rgba(37,99,235,0.05); }
.btn-action.text-danger:hover { border-color: var(--danger); color: var(--danger); background: rgba(220,38,38,0.05); }

.empty-state { text-align: center; padding: 60px 20px !important; color: var(--text-muted); }
.empty-icon { margin-bottom: 16px; opacity: 0.3; }
.empty-state p { margin-bottom: 16px; font-size: 15px; }

/* ---- BADGES ---- */
.badge { display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 20px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; }
.badge-pending { background: #fef3c7; color: #92400e; }
.badge-partial { background: #dbeafe; color: #1e40af; }
.badge-paid { background: #dcfce7; color: #15803d; }
.badge-sale { background: #dbeafe; color: #1e40af; }
.badge-purchase { background: #ede9fe; color: #5b21b6; }
.badge-sale_return { background: #fef3c7; color: #92400e; }
.badge-purchase_return { background: #fce7f3; color: #9d174d; }
.badge-type-customer { background: #dbeafe; color: #1e40af; }
.badge-type-vendor { background: #ede9fe; color: #5b21b6; }
.badge-type-both { background: #d1fae5; color: #065f46; }
.badge-type-cash { background: #d1fae5; color: #065f46; }
.badge-type-credit { background: #dbeafe; color: #1e40af; }
.badge-type-upi { background: #ede9fe; color: #5b21b6; }
.badge-type-bank { background: #fef3c7; color: #92400e; }
.badge-lg { font-size: 13px; padding: 6px 16px; }
.badge-count { background: var(--primary); color: white; padding: 2px 8px; border-radius: 12px; font-size: 11px; font-weight: 700; }

/* ---- SUMMARY CARDS ---- */
.summary-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 20px; }
.sum-card { background: white; padding: 16px 20px; border-radius: var(--radius-lg); border: 1px solid var(--border); box-shadow: var(--shadow); border-left: 4px solid var(--primary); }
.sum-card.warning { border-left-color: var(--warning); }
.sum-card.success { border-left-color: var(--success); }
.sum-label { font-size: 12px; color: var(--text-muted); font-weight: 600; margin-bottom: 6px; }
.sum-value { font-size: 22px; font-weight: 700; color: var(--text); }

/* ---- INVOICE CREATE ---- */
.invoice-topbar { display: flex; align-items: center; justify-content: space-between; background: white; border-bottom: 1px solid var(--border); padding: 10px 16px; margin: -20px -20px 0; position: sticky; top: 0; z-index: 100; box-shadow: var(--shadow); }
.invoice-topbar-left { display: flex; align-items: center; gap: 10px; }
.invoice-topbar-right { display: flex; align-items: center; gap: 6px; }
.inv-title { font-size: 14px; font-weight: 600; }

.payment-type-bar { background: white; padding: 12px 20px; display: flex; align-items: center; gap: 16px; border-bottom: 1px solid var(--border); }
.type-label { font-size: 16px; font-weight: 700; }
.payment-toggle-group { display: flex; align-items: center; gap: 10px; }
.toggle-label { font-size: 13px; font-weight: 600; cursor: pointer; display: flex; align-items: center; gap: 6px; }
.toggle-label input { display: none; }
.toggle-switch { width: 44px; height: 24px; background: var(--primary); border-radius: 12px; cursor: pointer; position: relative; }
.toggle-ball { width: 18px; height: 18px; background: white; border-radius: 50%; position: absolute; top: 3px; left: 3px; transition: left 0.2s; }

.invoice-form-body { background: white; margin: 0 -20px; padding: 20px; }
.invoice-top-section { display: grid; grid-template-columns: 1fr 320px; gap: 30px; margin-bottom: 24px; }
.customer-section .required-label { color: var(--primary); font-size: 12px; font-weight: 600; }
.customer-select-wrap { display: flex; align-items: center; gap: 8px; }
.customer-select-wrap .form-control { flex: 1; }
.btn-add-party { width: 34px; height: 34px; background: var(--primary); color: white; border: none; border-radius: 6px; cursor: pointer; display: flex; align-items: center; justify-content: center; flex-shrink: 0; text-decoration: none; }

.invoice-details-section { }
.inv-detail-row { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.inv-detail-row label { font-size: 12px; color: var(--text-muted); font-weight: 600; width: 120px; flex-shrink: 0; }
.date-input-wrap { position: relative; display: flex; align-items: center; }
.date-input-wrap i { position: absolute; right: 8px; color: var(--primary); pointer-events: none; font-size: 13px; }

/* ---- ITEMS TABLE ---- */
.items-table-wrap { overflow-x: auto; margin: 0 -20px; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.items-table { width: 100%; border-collapse: collapse; min-width: 900px; }
.items-table thead tr:first-child { background: #f8fafc; }
.items-table th { padding: 8px 6px; text-align: center; font-size: 10px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; border-bottom: 1px solid var(--border); }
.items-table th:nth-child(2) { text-align: left; padding-left: 12px; }
.items-table th:first-child { width: 40px; }
.table-sub-header th { background: #f0f4ff; border-bottom: 2px solid var(--border); }
.items-table td { padding: 6px 4px; border-bottom: 1px solid #f1f5f9; vertical-align: middle; text-align: center; }
.items-table td:nth-child(2) { text-align: left; padding-left: 8px; }
.items-table tfoot td { padding: 10px 6px; font-size: 12px; font-weight: 600; background: #f8fafc; border-top: 2px solid var(--border); }
.item-select-wrap { position: relative; }
.item-name-input { width: 100%; min-width: 180px; }
.item-suggestions { position: absolute; top: 100%; left: 0; right: 0; background: white; border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg); z-index: 500; max-height: 220px; overflow-y: auto; }
.suggestion-item { display: flex; align-items: center; gap: 10px; padding: 8px 12px; cursor: pointer; transition: background var(--transition); }
.suggestion-item:hover { background: var(--bg); }
.sug-img { width: 32px; height: 32px; border-radius: 6px; object-fit: cover; }
.sug-icon { width: 32px; height: 32px; background: var(--bg); border-radius: 6px; display: flex; align-items: center; justify-content: center; color: var(--text-muted); flex-shrink: 0; }
.sug-info strong { display: block; font-size: 13px; }
.sug-info small { color: var(--text-muted); font-size: 11px; }
.btn-remove-row { width: 26px; height: 26px; background: transparent; border: 1px solid #fecaca; border-radius: 6px; color: var(--danger); cursor: pointer; font-size: 11px; display: flex; align-items: center; justify-content: center; transition: all var(--transition); }
.btn-remove-row:hover { background: #fef2f2; }

/* ---- INVOICE BOTTOM ---- */
.invoice-bottom { display: grid; grid-template-columns: 1fr 350px; gap: 30px; padding: 20px 0; }
.attach-btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border: 1px dashed var(--border); border-radius: var(--radius); font-size: 12px; color: var(--text-muted); cursor: pointer; margin-right: 8px; margin-bottom: 10px; transition: all var(--transition); }
.attach-btn:hover { border-color: var(--primary); color: var(--primary); background: rgba(37,99,235,0.03); }
.desc-section { margin-top: 10px; }
.image-preview-area { margin-top: 10px; }
.preview-wrap { position: relative; display: inline-block; }
.preview-wrap button { position: absolute; top: -8px; right: -8px; width: 22px; height: 22px; border-radius: 50%; background: var(--danger); color: white; border: none; cursor: pointer; font-size: 11px; display: flex; align-items: center; justify-content: center; }
.notes-section { margin-top: 12px; }
.notes-section textarea { border: 1px dashed var(--border); resize: none; }
.payment-details-section { margin-top: 16px; padding: 16px; background: #f8fafc; border-radius: var(--radius-lg); border: 1px solid var(--border); }
.payment-details-section h4 { font-size: 13px; font-weight: 700; color: var(--text); margin-bottom: 14px; display: flex; align-items: center; gap: 8px; }

.totals-section { background: #f8fafc; border-radius: var(--radius-lg); padding: 16px; border: 1px solid var(--border); }
.total-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 6px 0; font-size: 13px; }
.total-row label { color: var(--text-muted); display: flex; align-items: center; gap: 6px; }
.total-row span { font-weight: 500; }
.total-label { font-weight: 700; font-size: 15px; }
.total-input { width: 120px; font-weight: 700; font-size: 15px; }
.grand-total-row { border-top: 2px solid var(--border); border-bottom: 2px solid var(--border); padding: 10px 0; }
.grand-total-row label { font-weight: 700; font-size: 15px; color: var(--text); }
.balance-row strong { font-size: 16px; }

/* ---- INVOICE ACTIONS ---- */
.invoice-actions { display: flex; align-items: center; justify-content: flex-end; gap: 12px; padding: 16px 0; margin-top: 10px; border-top: 1px solid var(--border); background: white; position: sticky; bottom: 0; }
.invoice-actions-bar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.action-btns { display: flex; align-items: center; gap: 10px; }

/* ---- INVOICE VIEW/PRINT ---- */
.invoice-document { background: white; border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); padding: 32px; max-width: 900px; margin: 0 auto; border: 1px solid var(--border); }
.invoice-doc-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 28px; padding-bottom: 20px; border-bottom: 2px solid var(--border); }
.company-info { display: flex; gap: 16px; }
.company-logo { max-height: 70px; max-width: 140px; object-fit: contain; }
.company-logo-placeholder { width: 70px; height: 70px; background: var(--bg); border-radius: 12px; display: flex; align-items: center; justify-content: center; color: var(--text-muted); font-size: 24px; }
.company-info h2 { font-size: 20px; font-weight: 700; margin-bottom: 6px; }
.company-info p { font-size: 12px; color: var(--text-muted); margin-bottom: 3px; display: flex; align-items: center; gap: 6px; }
.invoice-title-section { text-align: right; }
.invoice-title { font-size: 28px; font-weight: 800; color: var(--primary); letter-spacing: 1px; margin-bottom: 12px; }
.inv-meta div { font-size: 13px; color: var(--text-muted); margin-bottom: 4px; }
.inv-meta strong { color: var(--text); }
.status-badge-large { margin-top: 12px; }
.bill-to-section { display: flex; justify-content: space-between; margin-bottom: 24px; }
.bill-to strong { font-size: 11px; text-transform: uppercase; color: var(--text-muted); letter-spacing: 0.5px; }
.party-info { margin-top: 8px; }
.party-info strong { font-size: 16px; color: var(--text); display: block; margin-bottom: 4px; }
.party-info div { font-size: 13px; color: var(--text-muted); margin-bottom: 2px; display: flex; align-items: center; gap: 6px; }
.payment-mode { text-align: right; }
.mode-badge { display: inline-flex; align-items: center; gap: 6px; padding: 6px 14px; background: var(--bg); border-radius: 20px; font-size: 13px; font-weight: 600; margin-bottom: 8px; }
.upi-detail, .bank-detail { font-size: 12px; color: var(--text-muted); text-align: right; }
.bank-detail div { margin-bottom: 2px; }

.invoice-items-table { width: 100%; border-collapse: collapse; margin-bottom: 24px; }
.invoice-items-table th { background: var(--sidebar-bg); color: white; padding: 10px 12px; text-align: left; font-size: 12px; font-weight: 600; }
.invoice-items-table td { padding: 10px 12px; border-bottom: 1px solid var(--border); font-size: 13px; }
.invoice-items-table tbody tr:hover { background: #f8fafc; }
.invoice-items-table td small { display: block; color: var(--text-muted); font-size: 11px; }

.invoice-totals { display: grid; grid-template-columns: 1fr 280px; gap: 24px; }
.totals-left { }
.inv-description, .inv-notes { margin-bottom: 12px; }
.inv-description strong, .inv-notes strong { font-size: 12px; text-transform: uppercase; color: var(--text-muted); letter-spacing: 0.5px; }
.inv-description p, .inv-notes p { font-size: 13px; color: var(--text); margin-top: 4px; }
.totals-right { }
.total-line { display: flex; justify-content: space-between; padding: 7px 0; font-size: 13px; border-bottom: 1px solid #f1f5f9; }
.total-line.grand { font-size: 16px; font-weight: 700; border-bottom: 2px solid var(--border); border-top: 2px solid var(--border); padding: 10px 0; }
.total-line.balance { font-size: 15px; font-weight: 700; border-bottom: none; }

.invoice-footer-doc { margin-top: 24px; padding-top: 16px; border-top: 1px solid var(--border); text-align: center; color: var(--text-muted); font-size: 13px; }
.signature-area { margin-top: 40px; text-align: right; }
.sig-line { border-top: 1px solid var(--border); display: inline-block; min-width: 180px; padding-top: 6px; font-size: 12px; color: var(--text-muted); }

/* ---- MODAL ---- */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.5); display: flex; align-items: center; justify-content: center; z-index: 9999; backdrop-filter: blur(3px); }
.modal-box { background: white; border-radius: var(--radius-lg); width: 100%; max-width: 480px; box-shadow: 0 25px 60px rgba(0,0,0,0.3); overflow: hidden; }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px; border-bottom: 1px solid var(--border); }
.modal-header h3 { font-size: 16px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.modal-header button { background: transparent; border: none; font-size: 18px; cursor: pointer; color: var(--text-muted); width: 30px; height: 30px; border-radius: 6px; display: flex; align-items: center; justify-content: center; }
.modal-header button:hover { background: var(--bg); }
.modal-body { padding: 20px; }
.modal-footer { padding: 16px 20px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 10px; }

.payment-method-grid { display: grid; grid-template-columns: repeat(4,1fr); gap: 10px; margin-top: 8px; }
.pay-method-option { cursor: pointer; }
.pay-method-option input { display: none; }
.pay-method-option span { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px 8px; border: 2px solid var(--border); border-radius: var(--radius); font-size: 12px; font-weight: 600; transition: all var(--transition); }
.pay-method-option input:checked + span { border-color: var(--primary); background: rgba(37,99,235,0.05); color: var(--primary); }
.pay-method-option span i { font-size: 20px; }

/* ---- FORM PAGES ---- */
.form-page { max-width: 800px; }
.form-page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; }
.form-page-header h2 { font-size: 20px; font-weight: 700; display: flex; align-items: center; gap: 10px; }
.form-card { background: white; border-radius: var(--radius-lg); padding: 24px; box-shadow: var(--shadow); border: 1px solid var(--border); }
.form-card h3 { font-size: 15px; font-weight: 700; margin-bottom: 20px; display: flex; align-items: center; gap: 8px; color: var(--text); }
.form-card hr { border: none; border-top: 1px solid var(--border); margin: 24px 0; }

.logo-upload-section { display: flex; align-items: center; gap: 20px; margin-bottom: 20px; }
.logo-preview { width: 100px; height: 80px; background: var(--bg); border: 2px dashed var(--border); border-radius: var(--radius); display: flex; align-items: center; justify-content: center; overflow: hidden; }
.logo-preview img { max-width: 100%; max-height: 100%; object-fit: contain; }

.image-upload-area { border: 2px dashed var(--border); border-radius: var(--radius-lg); padding: 30px; text-align: center; cursor: pointer; transition: all var(--transition); color: var(--text-muted); }
.image-upload-area:hover { border-color: var(--primary); color: var(--primary); background: rgba(37,99,235,0.02); }
.image-upload-area i { margin-bottom: 8px; }
.image-upload-area p { font-size: 13px; }

/* ---- REPORTS ---- */
.reports-nav { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 20px; }
.report-nav-btn { padding: 8px 16px; border-radius: var(--radius); text-decoration: none; font-size: 13px; font-weight: 600; color: var(--text-muted); background: white; border: 1px solid var(--border); transition: all var(--transition); }
.report-nav-btn.active, .report-nav-btn:hover { background: var(--primary); color: white; border-color: var(--primary); }
.report-filters { margin-bottom: 16px; }
.filter-form { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; }
.report-summary { display: flex; gap: 20px; margin-bottom: 16px; font-size: 13px; color: var(--text-muted); }
.report-summary strong { color: var(--text); }

/* ---- UTILITIES ---- */
.text-danger { color: var(--danger) !important; }
.text-success { color: var(--success) !important; }
.text-warning { color: var(--warning) !important; }
.text-info { color: var(--info) !important; }
.text-muted { color: var(--text-muted) !important; }
.text-primary { color: var(--primary) !important; }

/* ---- RESPONSIVE ---- */
@media (max-width: 1200px) {
    .dashboard-grid { grid-template-columns: 1fr; }
    .dashboard-sidebar { display: grid; grid-template-columns: repeat(3,1fr); }
}
@media (max-width: 900px) {
    .invoice-top-section { grid-template-columns: 1fr; }
    .invoice-bottom { grid-template-columns: 1fr; }
    .invoice-totals { grid-template-columns: 1fr; }
    .stats-row { grid-template-columns: 1fr; }
    .summary-cards { grid-template-columns: 1fr; }
    .bill-to-section { flex-direction: column; gap: 16px; }
}
@media (max-width: 768px) {
    .sidebar { position: fixed