/* QuickBooks Online Clone - Main Stylesheet */
:root {
  --qb-green: #2ca01c;
  --qb-green-dark: #1e7a12;
  --qb-green-light: #e8f5e6;
  --qb-blue: #0077c5;
  --qb-blue-light: #e8f4fd;
  --qb-sidebar: #1a2340;
  --qb-sidebar-hover: #253057;
  --qb-sidebar-active: #2ca01c;
  --qb-text: #393a3d;
  --qb-text-light: #6b7280;
  --qb-border: #d1d5db;
  --qb-bg: #f4f5f7;
  --qb-white: #ffffff;
  --qb-red: #d93025;
  --qb-orange: #e87722;
  --qb-shadow: 0 1px 4px rgba(0,0,0,0.1);
  --qb-radius: 6px;
  --sidebar-w: 220px;
  --header-h: 56px;
}
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'AvenirNext', 'Avenir', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; background: var(--qb-bg); color: var(--qb-text); font-size: 14px; }
a { color: var(--qb-blue); text-decoration: none; }
a:hover { text-decoration: underline; }

/* === LAYOUT === */
.app-wrapper { display: flex; min-height: 100vh; }
.sidebar { width: var(--sidebar-w); background: var(--qb-sidebar); color: #fff; display: flex; flex-direction: column; position: fixed; top: 0; left: 0; height: 100vh; overflow-y: auto; z-index: 100; }
.main-content { margin-left: var(--sidebar-w); flex: 1; display: flex; flex-direction: column; min-height: 100vh; }

/* === SIDEBAR === */
.sidebar-logo { padding: 16px 20px; border-bottom: 1px solid rgba(255,255,255,0.08); }
.sidebar-logo .logo-text { font-size: 18px; font-weight: 700; color: #fff; }
.sidebar-logo .logo-sub { font-size: 11px; color: rgba(255,255,255,0.5); }
.sidebar-company { padding: 12px 20px; border-bottom: 1px solid rgba(255,255,255,0.08); font-size: 12px; color: rgba(255,255,255,0.7); }
.sidebar-nav { flex: 1; padding: 8px 0; }
.nav-section { padding: 10px 20px 4px; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.8px; color: rgba(255,255,255,0.35); }
.nav-item { display: flex; align-items: center; gap: 10px; padding: 9px 20px; color: rgba(255,255,255,0.75); font-size: 13px; cursor: pointer; transition: all 0.15s; border-left: 3px solid transparent; text-decoration: none; }
.nav-item:hover { background: var(--qb-sidebar-hover); color: #fff; text-decoration: none; }
.nav-item.active { background: var(--qb-sidebar-hover); color: #fff; border-left-color: var(--qb-green); }
.nav-item .nav-icon { font-size: 16px; width: 20px; text-align: center; }
.sidebar-footer { padding: 12px 20px; border-top: 1px solid rgba(255,255,255,0.08); }

/* === TOPBAR === */
.topbar { height: var(--header-h); background: var(--qb-white); border-bottom: 1px solid var(--qb-border); display: flex; align-items: center; justify-content: space-between; padding: 0 24px; position: sticky; top: 0; z-index: 50; box-shadow: 0 1px 3px rgba(0,0,0,0.06); }
.topbar-left { display: flex; align-items: center; gap: 12px; }
.topbar-title { font-size: 18px; font-weight: 600; color: var(--qb-text); }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.topbar-search { position: relative; }
.topbar-search input { width: 280px; padding: 7px 12px 7px 34px; border: 1px solid var(--qb-border); border-radius: 20px; font-size: 13px; background: var(--qb-bg); }
.topbar-search input:focus { outline: none; border-color: var(--qb-blue); background: #fff; }
.topbar-search .search-icon { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--qb-text-light); }
.user-avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--qb-green); color: white; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; cursor: pointer; }
.topbar-btn { padding: 7px 16px; border-radius: var(--qb-radius); font-size: 13px; font-weight: 500; cursor: pointer; border: none; transition: all 0.15s; }
.btn-primary { background: var(--qb-green); color: white; }
.btn-primary:hover { background: var(--qb-green-dark); }
.btn-outline { background: transparent; color: var(--qb-blue); border: 1px solid var(--qb-blue); }
.btn-outline:hover { background: var(--qb-blue-light); }
.btn-danger { background: var(--qb-red); color: white; }
.btn-secondary { background: #f3f4f6; color: var(--qb-text); border: 1px solid var(--qb-border); }
.btn-secondary:hover { background: #e5e7eb; }

/* === PAGE CONTENT === */
.page-content { flex: 1; padding: 24px; }
.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; }
.page-header h1 { font-size: 22px; font-weight: 600; }
.page-actions { display: flex; gap: 8px; align-items: center; }

/* === CARDS === */
.card { background: var(--qb-white); border-radius: var(--qb-radius); border: 1px solid var(--qb-border); box-shadow: var(--qb-shadow); }
.card-header { padding: 16px 20px; border-bottom: 1px solid var(--qb-border); display: flex; align-items: center; justify-content: space-between; }
.card-title { font-size: 15px; font-weight: 600; }
.card-body { padding: 20px; }

/* === DASHBOARD STATS === */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card { background: var(--qb-white); border-radius: var(--qb-radius); padding: 20px; border: 1px solid var(--qb-border); box-shadow: var(--qb-shadow); }
.stat-label { font-size: 12px; color: var(--qb-text-light); font-weight: 500; text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 8px; }
.stat-value { font-size: 26px; font-weight: 700; color: var(--qb-text); }
.stat-change { font-size: 12px; margin-top: 6px; }
.stat-change.up { color: var(--qb-green); }
.stat-change.down { color: var(--qb-red); }
.stat-icon { font-size: 28px; float: right; }

/* === TABLES === */
.table-wrapper { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
table th { background: #f9fafb; padding: 10px 14px; text-align: left; font-size: 12px; font-weight: 600; color: var(--qb-text-light); text-transform: uppercase; letter-spacing: 0.5px; border-bottom: 2px solid var(--qb-border); white-space: nowrap; }
table td { padding: 11px 14px; border-bottom: 1px solid #f3f4f6; font-size: 13px; vertical-align: middle; }
table tr:hover td { background: #fafbff; }
table tr:last-child td { border-bottom: none; }
.table-actions { display: flex; gap: 6px; }

/* === BADGES === */
.badge { display: inline-block; padding: 3px 9px; border-radius: 12px; font-size: 11px; font-weight: 600; }
.badge-success { background: #dcfce7; color: #16a34a; }
.badge-warning { background: #fef3c7; color: #d97706; }
.badge-danger { background: #fee2e2; color: #dc2626; }
.badge-info { background: #dbeafe; color: #2563eb; }
.badge-gray { background: #f3f4f6; color: #6b7280; }
.badge-orange { background: #ffedd5; color: #ea580c; }

/* === FORMS === */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
.form-group { display: flex; flex-direction: column; gap: 5px; }
.form-group.full { grid-column: 1 / -1; }
label { font-size: 12px; font-weight: 600; color: var(--qb-text-light); }
input, select, textarea { width: 100%; padding: 8px 12px; border: 1px solid var(--qb-border); border-radius: var(--qb-radius); font-size: 13px; color: var(--qb-text); background: white; transition: border-color 0.15s; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--qb-blue); box-shadow: 0 0 0 3px rgba(0,119,197,0.08); }
textarea { resize: vertical; min-height: 80px; }
.form-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 24px; padding-top: 16px; border-top: 1px solid var(--qb-border); }

/* === INVOICE LINE ITEMS === */
.line-items-table { width: 100%; border-collapse: collapse; margin-bottom: 12px; }
.line-items-table th { background: #f9fafb; padding: 8px 10px; font-size: 11px; font-weight: 600; color: var(--qb-text-light); text-align: left; border-bottom: 2px solid var(--qb-border); }
.line-items-table td { padding: 6px 4px; border-bottom: 1px solid #f3f4f6; vertical-align: middle; }
.line-items-table input, .line-items-table select { padding: 6px 8px; font-size: 12px; }
.line-items-table .remove-btn { background: none; border: none; color: #dc2626; cursor: pointer; font-size: 16px; padding: 4px; }
.totals-box { max-width: 320px; margin-left: auto; }
.totals-row { display: flex; justify-content: space-between; padding: 6px 0; font-size: 13px; border-bottom: 1px solid #f3f4f6; }
.totals-row.total { font-weight: 700; font-size: 16px; border-bottom: 2px solid var(--qb-text); padding-top: 10px; }

/* === TABS === */
.tabs { display: flex; gap: 0; border-bottom: 2px solid var(--qb-border); margin-bottom: 20px; }
.tab { padding: 10px 20px; cursor: pointer; font-size: 13px; font-weight: 500; color: var(--qb-text-light); border-bottom: 3px solid transparent; margin-bottom: -2px; }
.tab:hover { color: var(--qb-text); }
.tab.active { color: var(--qb-green); border-bottom-color: var(--qb-green); font-weight: 600; }
.tab-content { display: none; }
.tab-content.active { display: block; }

/* === MODAL === */
.modal-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.4); z-index: 1000; align-items: center; justify-content: center; }
.modal-overlay.open { display: flex; }
.modal { background: white; border-radius: 8px; width: 90%; max-width: 680px; max-height: 90vh; overflow-y: auto; box-shadow: 0 20px 60px rgba(0,0,0,0.2); }
.modal-header { padding: 20px 24px; border-bottom: 1px solid var(--qb-border); display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; background: white; z-index: 1; }
.modal-header h3 { font-size: 16px; font-weight: 600; }
.modal-close { background: none; border: none; font-size: 20px; cursor: pointer; color: var(--qb-text-light); padding: 2px 8px; border-radius: 4px; }
.modal-close:hover { background: #f3f4f6; }
.modal-body { padding: 24px; }
.modal-footer { padding: 16px 24px; border-top: 1px solid var(--qb-border); display: flex; gap: 10px; justify-content: flex-end; background: #f9fafb; border-radius: 0 0 8px 8px; }

/* === DASHBOARD CHARTS === */
.dashboard-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 20px; margin-bottom: 24px; }
.chart-container { position: relative; height: 240px; }
.quick-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.quick-action-btn { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 16px; background: var(--qb-white); border: 1px solid var(--qb-border); border-radius: var(--qb-radius); cursor: pointer; text-decoration: none; color: var(--qb-text); transition: all 0.15s; font-size: 12px; font-weight: 500; text-align: center; }
.quick-action-btn:hover { border-color: var(--qb-green); color: var(--qb-green); background: var(--qb-green-light); text-decoration: none; }
.quick-action-btn .qa-icon { font-size: 24px; }

/* === LOGIN === */
.login-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #1a2340 0%, #2ca01c 100%); }
.login-card { background: white; border-radius: 12px; padding: 40px; width: 380px; box-shadow: 0 20px 60px rgba(0,0,0,0.2); }
.login-logo { text-align: center; margin-bottom: 28px; }
.login-logo h2 { font-size: 26px; font-weight: 800; color: var(--qb-green); }
.login-logo p { font-size: 13px; color: var(--qb-text-light); }
.login-form .form-group { margin-bottom: 16px; }
.login-form label { display: block; margin-bottom: 6px; }
.login-btn { width: 100%; padding: 11px; background: var(--qb-green); color: white; border: none; border-radius: var(--qb-radius); font-size: 15px; font-weight: 600; cursor: pointer; }
.login-btn:hover { background: var(--qb-green-dark); }
.login-links { text-align: center; margin-top: 16px; font-size: 12px; color: var(--qb-text-light); }
.alert { padding: 10px 14px; border-radius: var(--qb-radius); margin-bottom: 14px; font-size: 13px; }
.alert-error { background: #fee2e2; color: #dc2626; border: 1px solid #fecaca; }
.alert-success { background: #dcfce7; color: #16a34a; border: 1px solid #bbf7d0; }

/* === FILTER BAR === */
.filter-bar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.filter-bar input, .filter-bar select { width: auto; min-width: 140px; }
.date-range { display: flex; gap: 6px; align-items: center; }
.date-range span { color: var(--qb-text-light); font-size: 12px; }

/* === REPORT STYLES === */
.report-header { text-align: center; margin-bottom: 24px; }
.report-header h2 { font-size: 20px; font-weight: 700; }
.report-header p { color: var(--qb-text-light); font-size: 13px; }
.report-section { margin-bottom: 20px; }
.report-section-title { font-weight: 700; font-size: 13px; text-transform: uppercase; background: #f9fafb; padding: 8px 12px; border-bottom: 2px solid var(--qb-border); }
.report-row { display: flex; justify-content: space-between; padding: 7px 12px; border-bottom: 1px solid #f3f4f6; font-size: 13px; }
.report-row.subtotal { font-weight: 600; background: #f9fafb; border-top: 1px solid var(--qb-border); }
.report-row.total { font-weight: 700; font-size: 14px; background: #f3f4f6; border-top: 2px solid var(--qb-text); }
.report-indent { padding-left: 30px; }

/* === UTILS === */
.text-right { text-align: right; }
.text-center { text-align: center; }
.text-muted { color: var(--qb-text-light); }
.text-green { color: var(--qb-green); }
.text-red { color: var(--qb-red); }
.text-bold { font-weight: 600; }
.mb-0 { margin-bottom: 0; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.mt-16 { margin-top: 16px; }
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.gap-8 { gap: 8px; }
.empty-state { text-align: center; padding: 60px 20px; color: var(--qb-text-light); }
.empty-state .empty-icon { font-size: 48px; margin-bottom: 12px; }
.empty-state h3 { font-size: 16px; font-weight: 600; margin-bottom: 6px; color: var(--qb-text); }
.divider { height: 1px; background: var(--qb-border); margin: 16px 0; }
.small-btn { padding: 4px 10px; font-size: 11px; border-radius: 4px; cursor: pointer; border: 1px solid var(--qb-border); background: white; color: var(--qb-text); }
.small-btn:hover { background: #f3f4f6; }
.small-btn.edit { color: var(--qb-blue); border-color: var(--qb-blue); }
.small-btn.del { color: var(--qb-red); border-color: var(--qb-red); }
.small-btn.view { color: var(--qb-green); border-color: var(--qb-green); }

@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .main-content { margin-left: 0; }
  .form-grid, .form-grid-3 { grid-template-columns: 1fr; }
  .dashboard-grid { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
}

/* ===================== PRINT STYLES ===================== */
@media print {
  .sidebar, .topbar, .no-print,
  .page-actions, .filter-bar,
  .modal-overlay, .tab-bar,
  .topbar-btn, .small-btn,
  .form-actions { display: none !important; }

  .main-content { margin-left: 0 !important; }
  .page-content { padding: 0 !important; }
  .app-wrapper { display: block !important; }
  .card { box-shadow: none !important; border: none !important; }
  body { font-size: 12px; color: #000; }
  table th, table td { border: 1px solid #ccc !important; }
  .badge { border: 1px solid #999; background: transparent !important; color: #000 !important; }
  a { color: #000 !important; text-decoration: none !important; }
  .totals-box { border: 1px solid #ccc; }
  .page-header h1 { font-size: 18px; }
}

/* ===================== EXTRA UTILITIES ===================== */
.mb-24 { margin-bottom: 24px; }
.divider { border-top: 1px solid var(--qb-border); margin: 16px 0; }
.text-muted { color: var(--qb-text-light); }
.text-right { text-align: right !important; }
.full { grid-column: 1 / -1; }

/* Forms */
.form-grid   { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
@media (max-width: 600px) { .form-grid, .form-grid-3 { grid-template-columns: 1fr; } }
.form-group { display: flex; flex-direction: column; gap: 4px; }
.form-group label { font-size: 12px; font-weight: 600; color: var(--qb-text-light); text-transform: uppercase; letter-spacing: 0.4px; }
.form-group input, .form-group select, .form-group textarea { padding: 8px 12px; border: 1px solid var(--qb-border); border-radius: var(--qb-radius); font-size: 13px; font-family: inherit; transition: border-color 0.15s; background: #fff; }
.form-group input:focus, .form-group select:focus, .form-group textarea:focus { outline: none; border-color: var(--qb-blue); box-shadow: 0 0 0 3px rgba(0,119,197,0.1); }
.form-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 24px; }

/* Totals box */
.totals-box { max-width: 320px; margin-left: auto; border: 1px solid var(--qb-border); border-radius: var(--qb-radius); overflow: hidden; }
.totals-row { display: flex; justify-content: space-between; padding: 8px 16px; font-size: 13px; border-bottom: 1px solid #f3f4f6; }
.totals-row:last-child { border-bottom: none; }
.totals-row.total { font-weight: 700; font-size: 15px; background: #f9fafb; }

/* Line items table */
.line-items-table { width: 100%; border-collapse: collapse; }
.line-items-table th { background: #f9fafb; padding: 8px 10px; font-size: 11px; font-weight: 600; color: var(--qb-text-light); text-transform: uppercase; border-bottom: 2px solid var(--qb-border); }
.line-items-table td { padding: 8px 10px; border-bottom: 1px solid #f3f4f6; vertical-align: middle; }
.line-items-table input, .line-items-table select { padding: 5px 8px; border: 1px solid var(--qb-border); border-radius: 4px; font-size: 13px; }
.remove-btn { width: 24px; height: 24px; border-radius: 50%; background: #fee2e2; color: #dc2626; border: none; cursor: pointer; font-size: 14px; font-weight: 700; line-height: 1; }
.remove-btn:hover { background: #fca5a5; }

/* Alerts */
.alert { padding: 12px 16px; border-radius: var(--qb-radius); margin-bottom: 16px; font-size: 13px; font-weight: 500; }
.alert-success { background: #dcfce7; color: #16a34a; border: 1px solid #bbf7d0; }
.alert-error   { background: #fee2e2; color: #dc2626; border: 1px solid #fecaca; }
.alert-warning { background: #fef3c7; color: #d97706; border: 1px solid #fde68a; }

/* Modals */
.modal-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.4); z-index: 200; align-items: center; justify-content: center; }
.modal-overlay.open { display: flex; }
.modal { background: #fff; border-radius: 8px; box-shadow: 0 8px 32px rgba(0,0,0,0.18); width: 90%; max-width: 600px; max-height: 90vh; overflow-y: auto; }
.modal-header { padding: 16px 20px; border-bottom: 1px solid var(--qb-border); display: flex; align-items: center; justify-content: space-between; }
.modal-header h3 { font-size: 16px; font-weight: 600; }
.modal-close { background: none; border: none; font-size: 20px; cursor: pointer; color: var(--qb-text-light); padding: 0 4px; }
.modal-body { padding: 20px; }
.modal-footer { padding: 16px 20px; border-top: 1px solid var(--qb-border); display: flex; gap: 8px; justify-content: flex-end; }

/* Small action buttons */
.small-btn { padding: 4px 10px; border-radius: 4px; font-size: 12px; font-weight: 500; cursor: pointer; border: 1px solid var(--qb-border); background: #f9fafb; color: var(--qb-text); transition: all 0.15s; text-decoration: none; display: inline-block; }
.small-btn:hover { text-decoration: none; }
.small-btn.view { background: var(--qb-blue-light); color: var(--qb-blue); border-color: #bfdbfe; }
.small-btn.edit { background: #fef3c7; color: #d97706; border-color: #fde68a; }
.small-btn.del  { background: #fee2e2; color: #dc2626; border-color: #fecaca; }

/* Filter bar */
.filter-bar { display: flex; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.filter-bar input, .filter-bar select { padding: 8px 12px; border: 1px solid var(--qb-border); border-radius: var(--qb-radius); font-size: 13px; background: #fff; }
.filter-bar input { flex: 1; min-width: 200px; }

/* Badge additions */
.badge-info { background: #dbeafe; color: #1d4ed8; }
.badge-gray { background: #f3f4f6; color: #4b5563; }
