/* ============================================
   CAREFLOW CLINIC - MAIN STYLESHEET
   Design: Clean Medical / Clinical Professional
   ============================================ */

:root {
  --primary: #0a5fd6;
  --primary-dark: #0847a8;
  --primary-light: #e8f1fd;
  --accent: #00b4d8;
  --accent2: #06b86b;
  --accent3: #f59e0b;
  --danger: #ef4444;
  --warning: #f59e0b;
  --success: #10b981;
  --info: #3b82f6;

  --bg: #f0f4fa;
  --bg2: #e8edf5;
  --surface: #ffffff;
  --surface2: #f7f9fc;
  --border: #dee3ec;
  --border2: #c8d0df;

  --text: #0f172a;
  --text2: #475569;
  --text3: #94a3b8;

  --sidebar-bg: #0f1b35;
  --sidebar-text: #94a3b8;
  --sidebar-active: #0a5fd6;
  --sidebar-hover: rgba(255,255,255,0.07);
  --sidebar-width: 240px;
  --topbar-h: 60px;

  --font: 'Plus Jakarta Sans', sans-serif;
  --mono: 'JetBrains Mono', monospace;
  --radius: 10px;
  --radius-sm: 6px;
  --radius-lg: 16px;
  --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 4px 16px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 20px rgba(0,0,0,0.10);
  --shadow-lg: 0 12px 40px rgba(0,0,0,0.15);
  --transition: 0.2s ease;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

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

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  display: flex;
  min-height: 100vh;
  line-height: 1.6;
}

/* ============ SIDEBAR ============ */
.sidebar {
  width: var(--sidebar-width);
  min-height: 100vh;
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  position: fixed;
  left: 0; top: 0; bottom: 0;
  z-index: 100;
  transition: transform var(--transition);
  overflow-y: auto;
  overflow-x: hidden;
}

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

.brand-icon {
  width: 38px; height: 38px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  color: white; font-size: 18px;
  flex-shrink: 0;
}

.brand-name { display: block; font-size: 13px; font-weight: 700; color: white; line-height: 1.2; }
.brand-sub { display: block; font-size: 10px; color: var(--sidebar-text); }

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

.nav-group { margin-bottom: 8px; }

.nav-label {
  font-size: 10px; font-weight: 700; letter-spacing: 1px;
  color: rgba(148,163,184,0.5); text-transform: uppercase;
  padding: 6px 16px 3px;
}

.nav-item {
  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); position: relative;
  border-radius: 0;
}

.nav-item:hover {
  background: var(--sidebar-hover);
  color: white;
}

.nav-item.active {
  background: rgba(10,95,214,0.2);
  color: #60a5fa;
  border-right: 3px solid var(--primary);
}

.nav-item i { width: 18px; text-align: center; font-size: 14px; }

.nav-badge {
  margin-left: auto;
  background: var(--primary);
  color: white;
  font-size: 10px; font-weight: 700;
  padding: 1px 6px; border-radius: 10px;
}

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

.user-card {
  display: flex; align-items: center; gap: 10px;
  padding: 8px; border-radius: var(--radius);
  background: rgba(255,255,255,0.06);
}

.user-avatar {
  width: 32px; height: 32px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 13px; color: white; flex-shrink: 0;
}

.user-info { flex: 1; overflow: hidden; }
.user-name { display: block; font-size: 12px; font-weight: 600; color: white; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { display: block; font-size: 11px; color: var(--sidebar-text); }

.logout-btn {
  color: var(--sidebar-text); padding: 4px;
  transition: color var(--transition);
  text-decoration: none;
}
.logout-btn:hover { color: var(--danger); }

/* ============ MAIN WRAPPER ============ */
.main-wrapper {
  margin-left: var(--sidebar-width);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  transition: margin-left var(--transition);
}

/* ============ TOPBAR ============ */
.topbar {
  height: var(--topbar-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 24px;
  position: sticky; top: 0; z-index: 50;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.sidebar-toggle {
  background: none; border: none; cursor: pointer;
  color: var(--text2); font-size: 18px; padding: 4px;
  display: none;
}

.topbar-title { flex: 1; }
.topbar-title h1 { font-size: 18px; font-weight: 700; color: var(--text); }

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

.topbar-date {
  font-size: 12px; color: var(--text3);
  display: flex; align-items: center; gap: 5px;
}

.quick-add-btn {
  background: var(--primary); color: white;
  border: none; padding: 7px 14px; border-radius: var(--radius-sm);
  font-size: 12px; font-weight: 600; cursor: pointer;
  text-decoration: none;
  display: flex; align-items: center; gap: 5px;
  transition: background var(--transition);
}
.quick-add-btn:hover { background: var(--primary-dark); }

/* ============ PAGE CONTENT ============ */
.page-content { padding: 24px; flex: 1; }

/* ============ ALERTS ============ */
.alert {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 20px; margin: 0 24px 0;
  border-radius: var(--radius-sm);
  font-size: 14px; font-weight: 500;
}
.alert button { margin-left: auto; background: none; border: none; cursor: pointer; opacity: 0.7; }
.alert button:hover { opacity: 1; }
.alert-success { background: #d1fae5; color: #065f46; border-left: 4px solid var(--success); }
.alert-error, .alert-danger { background: #fee2e2; color: #991b1b; border-left: 4px solid var(--danger); }
.alert-warning { background: #fef3c7; color: #92400e; border-left: 4px solid var(--warning); }
.alert-info { background: #dbeafe; color: #1e40af; border-left: 4px solid var(--info); }

/* ============ CARDS ============ */
.card {
  background: var(--surface); border-radius: var(--radius-lg);
  box-shadow: var(--shadow); overflow: hidden;
}

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

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

.card-body { padding: 20px; }
.card-footer { padding: 12px 20px; background: var(--surface2); border-top: 1px solid var(--border); }

/* ============ STAT CARDS ============ */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow);
  display: flex; align-items: flex-start; gap: 14px;
  position: relative; overflow: hidden;
  transition: transform var(--transition), box-shadow var(--transition);
}

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

.stat-icon {
  width: 48px; height: 48px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; flex-shrink: 0;
}

.stat-icon.blue { background: #dbeafe; color: var(--primary); }
.stat-icon.green { background: #d1fae5; color: var(--success); }
.stat-icon.amber { background: #fef3c7; color: var(--warning); }
.stat-icon.red { background: #fee2e2; color: var(--danger); }
.stat-icon.cyan { background: #cffafe; color: var(--accent); }
.stat-icon.purple { background: #ede9fe; color: #7c3aed; }

.stat-content { flex: 1; }
.stat-value { font-size: 24px; font-weight: 800; color: var(--text); line-height: 1.1; }
.stat-label { font-size: 12px; color: var(--text3); font-weight: 500; margin-top: 3px; }
.stat-change { font-size: 11px; margin-top: 6px; font-weight: 600; }
.stat-change.up { color: var(--success); }
.stat-change.down { color: var(--danger); }

/* ============ GRID LAYOUTS ============ */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 20px; }
.grid-70-30 { display: grid; grid-template-columns: 7fr 3fr; gap: 20px; }
.grid-60-40 { display: grid; grid-template-columns: 6fr 4fr; gap: 20px; }

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

table { width: 100%; border-collapse: collapse; font-size: 14px; }

thead th {
  background: var(--surface2); color: var(--text2);
  font-size: 11px; font-weight: 700; letter-spacing: 0.5px;
  text-transform: uppercase; padding: 10px 14px;
  text-align: left; border-bottom: 2px solid var(--border);
  white-space: nowrap;
}

tbody td {
  padding: 11px 14px; border-bottom: 1px solid var(--border);
  color: var(--text); vertical-align: middle;
}

tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--surface2); }

.table-actions { display: flex; gap: 6px; }

/* ============ FORMS ============ */
.form-row { display: grid; gap: 16px; margin-bottom: 16px; }
.form-row.cols-2 { grid-template-columns: 1fr 1fr; }
.form-row.cols-3 { grid-template-columns: 1fr 1fr 1fr; }
.form-row.cols-4 { grid-template-columns: 1fr 1fr 1fr 1fr; }

.form-group { display: flex; flex-direction: column; gap: 5px; }
.form-group label { font-size: 12px; font-weight: 600; color: var(--text2); }
.form-group label .req { color: var(--danger); margin-left: 2px; }

.form-control {
  width: 100%; padding: 9px 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font); font-size: 14px; color: var(--text);
  background: var(--surface); transition: border-color var(--transition);
  outline: none;
}

.form-control:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(10,95,214,0.08); }
.form-control:disabled { background: var(--surface2); color: var(--text3); cursor: not-allowed; }

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

.form-hint { font-size: 11px; color: var(--text3); margin-top: 3px; }
.form-error { font-size: 11px; color: var(--danger); margin-top: 3px; }

/* ============ BUTTONS ============ */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 16px; border-radius: var(--radius-sm);
  font-family: var(--font); font-size: 13px; font-weight: 600;
  border: none; cursor: pointer; text-decoration: none;
  transition: all var(--transition); white-space: nowrap;
}

.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-success { background: var(--success); color: white; }
.btn-success:hover { background: #059669; }
.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { background: #dc2626; }
.btn-warning { background: var(--warning); color: white; }
.btn-secondary { background: var(--bg2); color: var(--text2); }
.btn-secondary:hover { background: var(--border); }
.btn-outline { background: transparent; border: 1.5px solid var(--border); color: var(--text2); }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-light); }

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

/* ============ BADGES ============ */
.badge {
  display: inline-flex; align-items: center;
  padding: 2px 8px; border-radius: 20px;
  font-size: 11px; font-weight: 700; white-space: nowrap;
}
.badge-primary { background: #dbeafe; color: var(--primary); }
.badge-success { background: #d1fae5; color: #065f46; }
.badge-danger { background: #fee2e2; color: #991b1b; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-secondary { background: var(--bg2); color: var(--text2); }
.badge-info { background: #cffafe; color: #164e63; }

/* ============ MODAL ============ */
.modal-overlay {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(0,0,0,0.4); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  animation: fadeIn 0.15s ease;
}

.modal-box {
  background: var(--surface); border-radius: var(--radius-lg);
  width: 100%; max-width: 600px;
  max-height: 90vh; overflow-y: auto;
  box-shadow: var(--shadow-lg);
  animation: slideUp 0.2s ease;
}

.modal-box.modal-lg { max-width: 900px; }
.modal-box.modal-sm { max-width: 420px; }

.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 22px; border-bottom: 1px solid var(--border);
  position: sticky; top: 0; background: var(--surface); z-index: 1;
}

.modal-header h3 { font-size: 16px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.modal-header button { background: none; border: none; cursor: pointer; color: var(--text3); font-size: 18px; padding: 4px; }
.modal-header button:hover { color: var(--danger); }
.modal-body { padding: 22px; }
.modal-footer { padding: 14px 22px; border-top: 1px solid var(--border); display: flex; gap: 10px; justify-content: flex-end; }

/* ============ SEARCH RESULTS ============ */
.search-results { margin-top: 10px; }
.search-result-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); margin-bottom: 6px;
  cursor: pointer; transition: all var(--transition);
  text-decoration: none; color: var(--text);
}
.search-result-item:hover { border-color: var(--primary); background: var(--primary-light); }
.search-result-avatar {
  width: 36px; height: 36px; background: linear-gradient(135deg, var(--primary), var(--accent));
  border-radius: 50%; display: flex; align-items: center; justify-content: center;
  color: white; font-weight: 700; font-size: 14px; flex-shrink: 0;
}
.search-result-info { flex: 1; }
.search-result-name { font-weight: 600; font-size: 14px; }
.search-result-meta { font-size: 12px; color: var(--text3); }

/* ============ PAGE HEADER ============ */
.page-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 20px; flex-wrap: wrap; gap: 10px;
}
.page-header-left h2 { font-size: 20px; font-weight: 800; }
.page-header-left p { font-size: 13px; color: var(--text3); margin-top: 2px; }
.page-header-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ============ FILTER BAR ============ */
.filter-bar {
  display: flex; gap: 10px; align-items: center;
  margin-bottom: 16px; flex-wrap: wrap;
}
.filter-bar .form-control { max-width: 220px; }
.search-input-wrap { position: relative; }
.search-input-wrap i { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--text3); }
.search-input-wrap input { padding-left: 32px; }

/* ============ PATIENT CARD ============ */
.patient-card {
  display: flex; gap: 16px; padding: 16px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); margin-bottom: 10px;
  transition: all var(--transition); text-decoration: none; color: inherit;
}
.patient-card:hover { border-color: var(--primary); box-shadow: var(--shadow); }

.patient-avatar {
  width: 50px; height: 50px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; font-weight: 800; color: white; flex-shrink: 0;
}

.patient-info { flex: 1; }
.patient-name { font-weight: 700; font-size: 15px; }
.patient-meta { font-size: 12px; color: var(--text3); margin-top: 3px; }
.patient-id { font-family: var(--mono); font-size: 11px; color: var(--primary); font-weight: 600; }

/* ============ APPOINTMENT ITEM ============ */
.appt-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 0; border-bottom: 1px solid var(--border);
}
.appt-item:last-child { border-bottom: none; }

.appt-time {
  font-family: var(--mono); font-size: 13px; font-weight: 600;
  color: var(--primary); min-width: 70px; text-align: center;
  background: var(--primary-light); padding: 6px 8px;
  border-radius: var(--radius-sm);
}

.appt-info { flex: 1; }
.appt-patient { font-weight: 600; font-size: 14px; }
.appt-meta { font-size: 12px; color: var(--text3); }

.appt-actions { display: flex; gap: 5px; }

/* ============ PAIN SCALE ============ */
.pain-scale { display: flex; gap: 4px; align-items: center; }
.pain-dot {
  width: 28px; height: 28px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; cursor: pointer;
  border: 2px solid transparent; transition: all var(--transition);
}
.pain-dot:nth-child(1), .pain-dot:nth-child(2), .pain-dot:nth-child(3) { background: #d1fae5; color: #065f46; }
.pain-dot:nth-child(4), .pain-dot:nth-child(5), .pain-dot:nth-child(6) { background: #fef3c7; color: #92400e; }
.pain-dot:nth-child(7), .pain-dot:nth-child(8) { background: #fed7aa; color: #9a3412; }
.pain-dot:nth-child(9), .pain-dot:nth-child(10) { background: #fee2e2; color: #991b1b; }
.pain-dot.selected { border-color: var(--text); transform: scale(1.2); }
.pain-dot:hover { transform: scale(1.1); }

/* ============ INVOICE ============ */
.invoice-preview {
  background: white; border: 1px solid var(--border);
  border-radius: var(--radius); padding: 28px; max-width: 700px;
}

.invoice-header { display: flex; justify-content: space-between; margin-bottom: 28px; }
.invoice-logo { font-size: 22px; font-weight: 800; color: var(--primary); }
.invoice-clinic-info { font-size: 12px; color: var(--text2); }
.invoice-number { font-family: var(--mono); font-size: 14px; font-weight: 600; color: var(--text3); }
.invoice-title { font-size: 28px; font-weight: 800; color: var(--bg2); text-align: right; }

.invoice-parties { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 24px; }
.invoice-party h4 { font-size: 11px; text-transform: uppercase; letter-spacing: 1px; color: var(--text3); margin-bottom: 6px; }
.invoice-party p { font-size: 13px; line-height: 1.6; }

.invoice-table { margin-bottom: 20px; }
.invoice-table th { background: var(--bg); }

.invoice-totals { display: flex; justify-content: flex-end; margin-bottom: 20px; }
.invoice-totals table { width: 280px; }
.invoice-totals td { padding: 5px 10px; font-size: 13px; }
.invoice-totals .total-row td { font-weight: 800; font-size: 16px; background: var(--primary-light); color: var(--primary); }

.invoice-footer { font-size: 12px; color: var(--text3); text-align: center; padding-top: 16px; border-top: 1px solid var(--border); }

/* ============ CALENDAR ============ */
.calendar-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.cal-header { text-align: center; font-size: 11px; font-weight: 700; color: var(--text3); padding: 6px; text-transform: uppercase; }
.cal-day {
  min-height: 80px; padding: 5px; border: 1px solid var(--border);
  border-radius: var(--radius-sm); font-size: 12px;
  cursor: pointer; transition: background var(--transition);
  background: var(--surface);
}
.cal-day:hover { background: var(--primary-light); }
.cal-day.today { border-color: var(--primary); background: var(--primary-light); }
.cal-day.other-month { background: var(--surface2); color: var(--text3); }
.cal-day-num { font-weight: 700; font-size: 13px; margin-bottom: 3px; }
.cal-event { background: var(--primary); color: white; border-radius: 3px; padding: 1px 4px; font-size: 10px; margin-bottom: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ============ TABS ============ */
.tabs { display: flex; gap: 0; border-bottom: 2px solid var(--border); margin-bottom: 20px; }
.tab-btn {
  padding: 10px 18px; font-size: 13px; font-weight: 600;
  color: var(--text3); background: none; border: none;
  cursor: pointer; border-bottom: 2px solid transparent;
  margin-bottom: -2px; transition: all var(--transition);
}
.tab-btn:hover { color: var(--text); }
.tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); }
.tab-pane { display: none; }
.tab-pane.active { display: block; }

/* ============ PROGRESS / SESSION TRACKER ============ */
.session-tracker { display: flex; gap: 4px; flex-wrap: wrap; }
.session-dot {
  width: 24px; height: 24px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 700;
}
.session-dot.used { background: var(--primary); color: white; }
.session-dot.remaining { background: var(--border); color: var(--text3); }

.progress-bar-wrap { background: var(--border); border-radius: 10px; height: 8px; overflow: hidden; }
.progress-bar { height: 100%; border-radius: 10px; background: linear-gradient(90deg, var(--primary), var(--accent)); transition: width 0.4s ease; }

/* ============ LOGIN PAGE ============ */
body.login-page {
  background: linear-gradient(135deg, #0f1b35 0%, #1a2f5c 50%, #0a5fd6 100%);
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh;
}

.login-card {
  background: white; border-radius: 20px;
  padding: 40px; width: 100%; max-width: 420px;
  box-shadow: var(--shadow-lg);
}

.login-logo {
  text-align: center; margin-bottom: 28px;
}
.login-logo .icon {
  width: 64px; height: 64px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  border-radius: 16px; margin: 0 auto 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 28px; color: white;
}
.login-logo h1 { font-size: 22px; font-weight: 800; color: var(--text); }
.login-logo p { font-size: 13px; color: var(--text3); }

/* ============ TIMELINE ============ */
.timeline { position: relative; padding-left: 24px; }
.timeline::before { content: ''; position: absolute; left: 8px; top: 0; bottom: 0; width: 2px; background: var(--border); }
.timeline-item { position: relative; margin-bottom: 20px; }
.timeline-item::before {
  content: ''; position: absolute; left: -20px; top: 4px;
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--primary); border: 2px solid white; box-shadow: 0 0 0 2px var(--primary);
}
.timeline-date { font-size: 11px; color: var(--text3); font-weight: 600; margin-bottom: 4px; }
.timeline-content { background: var(--surface2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px 14px; }
.timeline-content h4 { font-size: 13px; font-weight: 700; }
.timeline-content p { font-size: 12px; color: var(--text2); margin-top: 4px; }

/* ============ RESPONSIVE ============ */
@media (max-width: 1024px) {
  .grid-2, .grid-3, .grid-70-30, .grid-60-40 { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  :root { --sidebar-width: 0px; }
  .sidebar { transform: translateX(-240px); width: 240px; }
  .sidebar.open { transform: translateX(0); }
  .main-wrapper { margin-left: 0; }
  .sidebar-toggle { display: block; }
  .page-content { padding: 16px; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .form-row.cols-2, .form-row.cols-3, .form-row.cols-4 { grid-template-columns: 1fr; }
  .topbar { padding: 0 14px; }
  .topbar-date { display: none; }
  .invoice-parties { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
}

/* ============ PRINT ============ */
@media print {
  .sidebar, .topbar, .page-header-actions, .no-print { display: none !important; }
  .main-wrapper { margin-left: 0; }
  .page-content { padding: 0; }
  body { background: white; }
  .invoice-preview { border: none; padding: 0; }
}

/* ============ ANIMATIONS ============ */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
@keyframes spin { to { transform: rotate(360deg); } }

.spin { animation: spin 1s linear infinite; }

/* ============ UTILS ============ */
.text-muted { color: var(--text3); }
.text-primary { color: var(--primary); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
.text-right { text-align: right; }
.text-center { text-align: center; }
.font-mono { font-family: var(--mono); }
.font-bold { font-weight: 700; }
.mt-1 { margin-top: 8px; } .mt-2 { margin-top: 16px; } .mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; } .mb-2 { margin-bottom: 16px; } .mb-3 { margin-bottom: 24px; }
.d-flex { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: 8px; } .gap-2 { gap: 16px; }
.w-full { width: 100%; }
.hidden { display: none; }
.empty-state { text-align: center; padding: 40px 20px; color: var(--text3); }
.empty-state i { font-size: 48px; margin-bottom: 12px; opacity: 0.3; }
.empty-state p { font-size: 14px; }

/* ============ CHART CONTAINER ============ */
.chart-container { position: relative; height: 250px; }
.chart-container canvas { max-height: 100% !important; }
