/* styles.css – GigClarity Design System */

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

/* ──────────────────────────────────────
   TOKENS
────────────────────────────────────── */
:root {
  --sidebar-bg: #0f172a;
  --sidebar-w: 240px;
  --primary: #6366f1;
  --primary-hover: #4f46e5;
  --primary-light: #eef2ff;
  --primary-muted: rgba(99,102,241,.12);
  --bg: #f8fafc;
  --card: #ffffff;
  --success: #10b981;
  --success-light: #d1fae5;
  --warning: #f59e0b;
  --warning-light: #fef3c7;
  --danger: #ef4444;
  --danger-light: #fee2e2;
  --info: #3b82f6;
  --info-light: #dbeafe;
  --text-1: #0f172a;
  --text-2: #334155;
  --text-3: #64748b;
  --text-4: #94a3b8;
  --border: #e2e8f0;
  --border-2: #cbd5e1;
  --shadow-xs: 0 1px 2px rgb(0 0 0/.06);
  --shadow-sm: 0 1px 3px rgb(0 0 0/.1), 0 1px 2px rgb(0 0 0/.06);
  --shadow:    0 4px 6px rgb(0 0 0/.07), 0 2px 4px rgb(0 0 0/.06);
  --shadow-lg: 0 10px 15px rgb(0 0 0/.08), 0 4px 6px rgb(0 0 0/.04);
  --shadow-xl: 0 20px 25px rgb(0 0 0/.1), 0 8px 10px rgb(0 0 0/.04);
  --r-sm: 6px;
  --r: 10px;
  --r-lg: 14px;
  --r-xl: 20px;
  --font: 'Inter', system-ui, sans-serif;
}

/* ──────────────────────────────────────
   RESET
────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0 }
html { scroll-behavior: smooth }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text-1);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none }
button { font-family: inherit; cursor: pointer }
input, select, textarea { font-family: inherit }
img { display: block; max-width: 100% }

/* ──────────────────────────────────────
   APP LAYOUT
────────────────────────────────────── */
.app-layout {
  display: flex;
  min-height: 100vh;
}

#sidebar-placeholder {
  position: fixed;
  top: 0; left: 0;
  z-index: 200;
}

.main-wrapper {
  flex: 1;
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ──────────────────────────────────────
   SIDEBAR
────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  height: 100vh;
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0;
  z-index: 200;
  transition: transform .28s cubic-bezier(.4,0,.2,1);
}

.sidebar-header {
  padding: 22px 20px 18px;
  border-bottom: 1px solid rgba(255,255,255,.07);
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo-mark {
  width: 34px; height: 34px;
  background: var(--primary);
  border-radius: var(--r-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 800;
  color: #fff;
  letter-spacing: -.5px;
  flex-shrink: 0;
}

.logo-text {
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  letter-spacing: -.3px;
}

.sidebar-nav {
  flex: 1;
  padding: 12px 10px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--r-sm);
  color: rgba(255,255,255,.55);
  font-size: 13.5px;
  font-weight: 500;
  transition: background .15s, color .15s;
}

.nav-item:hover {
  background: rgba(255,255,255,.07);
  color: rgba(255,255,255,.9);
}

.nav-item.active {
  background: var(--primary-muted);
  color: #a5b4fc;
}

.nav-item.active svg { color: var(--primary); opacity: 1 }

.nav-item svg { opacity: .7; flex-shrink: 0 }

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

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 6px;
  margin-bottom: 6px;
}

.user-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

.user-meta { overflow: hidden }

.user-displayname {
  font-size: 12.5px;
  font-weight: 600;
  color: rgba(255,255,255,.9);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-email-sm {
  font-size: 11px;
  color: rgba(255,255,255,.35);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.logout-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 10px;
  border: none;
  background: transparent;
  color: rgba(255,255,255,.4);
  font-size: 12.5px;
  border-radius: var(--r-sm);
  transition: background .15s, color .15s;
}

.logout-btn:hover {
  background: rgba(239,68,68,.15);
  color: #fca5a5;
}

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.55);
  z-index: 190;
}

/* ──────────────────────────────────────
   TOPBAR
────────────────────────────────────── */
.topbar {
  height: 62px;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 28px;
  position: sticky;
  top: 0;
  z-index: 100;
}

.menu-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 36px; height: 36px;
  border: none;
  background: transparent;
  color: var(--text-2);
  border-radius: var(--r-sm);
  transition: background .15s;
}
.menu-toggle:hover { background: var(--bg) }

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

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

/* ──────────────────────────────────────
   MAIN CONTENT
────────────────────────────────────── */
.main-content {
  flex: 1;
  padding: 28px;
  max-width: 1280px;
  width: 100%;
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 12px;
}

.page-header h2 {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-1);
}

.page-header p {
  font-size: 13.5px;
  color: var(--text-3);
  margin-top: 2px;
}

/* ──────────────────────────────────────
   CARDS
────────────────────────────────────── */
.card {
  background: var(--card);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
}

.card-body { padding: 22px }
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
}
.card-header h3 {
  font-size: 14.5px;
  font-weight: 600;
  color: var(--text-1);
}
.card-footer {
  padding: 14px 22px;
  border-top: 1px solid var(--border);
  background: var(--bg);
  border-radius: 0 0 var(--r-lg) var(--r-lg);
}

/* Stats Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--card);
  border-radius: var(--r-lg);
  padding: 20px 22px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-xs);
}

.stat-label {
  font-size: 11.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-3);
  margin-bottom: 6px;
}

.stat-value {
  font-size: 26px;
  font-weight: 800;
  color: var(--text-1);
  line-height: 1.1;
  letter-spacing: -.5px;
}

.stat-value.income  { color: var(--primary) }
.stat-value.success { color: var(--success) }
.stat-value.danger  { color: var(--danger) }
.stat-value.warning { color: var(--warning) }

.stat-footer {
  margin-top: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-3);
}

.stat-icon {
  width: 36px; height: 36px;
  border-radius: var(--r-sm);
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 12px;
}
.stat-icon--indigo { background: var(--primary-light); color: var(--primary) }
.stat-icon--green  { background: var(--success-light); color: var(--success) }
.stat-icon--red    { background: var(--danger-light);  color: var(--danger) }
.stat-icon--amber  { background: var(--warning-light); color: var(--warning) }
.stat-icon--blue   { background: var(--info-light);    color: var(--info) }

/* ──────────────────────────────────────
   TREND BADGES
────────────────────────────────────── */
.trend {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 11.5px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 20px;
}
.trend--up   { background: var(--success-light); color: #059669 }
.trend--down { background: var(--danger-light);  color: #dc2626 }
.trend--flat { background: var(--bg); color: var(--text-4); border: 1px solid var(--border) }

/* ──────────────────────────────────────
   GRID LAYOUTS
────────────────────────────────────── */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px }
.grid-3 { display: grid; grid-template-columns: repeat(3,1fr); gap: 20px }
.charts-row { display: grid; grid-template-columns: 1.6fr 1fr; gap: 20px; margin-bottom: 24px }

/* ──────────────────────────────────────
   BUTTONS
────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 18px;
  border-radius: var(--r);
  font-size: 13.5px;
  font-weight: 600;
  border: none;
  transition: background .15s, opacity .15s, transform .1s, box-shadow .15s;
  white-space: nowrap;
}
.btn:hover:not(:disabled) { opacity: .92 }
.btn:active:not(:disabled) { transform: scale(.98) }
.btn:disabled { opacity: .5; cursor: not-allowed }

.btn-primary {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 1px 3px rgba(99,102,241,.35);
}
.btn-primary:hover:not(:disabled) { background: var(--primary-hover); opacity: 1 }

.btn-secondary {
  background: var(--card);
  color: var(--text-2);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-xs);
}
.btn-secondary:hover:not(:disabled) { background: var(--bg); opacity: 1 }

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

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

.btn-ghost {
  background: transparent;
  color: var(--text-3);
  border: none;
  padding: 6px 10px;
  border-radius: var(--r-sm);
}
.btn-ghost:hover:not(:disabled) { background: var(--bg); color: var(--text-1); opacity: 1 }

.btn-sm { padding: 6px 13px; font-size: 12.5px }
.btn-icon {
  padding: 7px;
  border-radius: var(--r-sm);
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text-3);
  transition: background .15s, color .15s;
}
.btn-icon:hover { background: var(--border); color: var(--text-1) }
.btn-icon.danger:hover { background: var(--danger-light); color: var(--danger); border-color: var(--danger) }
.btn-icon.success:hover { background: var(--success-light); color: var(--success); border-color: var(--success) }

/* ──────────────────────────────────────
   BADGES
────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
}
.badge--green  { background: var(--success-light); color: #059669 }
.badge--red    { background: var(--danger-light);  color: #dc2626 }
.badge--yellow { background: var(--warning-light); color: #d97706 }
.badge--blue   { background: var(--info-light);    color: #2563eb }
.badge--purple { background: var(--primary-light); color: #4f46e5 }
.badge--gray   { background: #f1f5f9; color: var(--text-3) }

/* ──────────────────────────────────────
   TABLES
────────────────────────────────────── */
.table-wrap {
  overflow-x: auto;
  border-radius: var(--r-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-xs);
}

.table {
  width: 100%;
  border-collapse: collapse;
  background: var(--card);
}

.table thead { background: #f8fafc }

.table th {
  text-align: left;
  padding: 11px 16px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--text-3);
  white-space: nowrap;
  border-bottom: 1px solid var(--border);
}

.table td {
  padding: 12px 16px;
  font-size: 13.5px;
  color: var(--text-2);
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.table tbody tr:last-child td { border-bottom: none }
.table tbody tr:hover td { background: #fafbff }

.table .actions {
  display: flex;
  gap: 4px;
  justify-content: flex-end;
}

.table .amount { font-weight: 600; color: var(--text-1) }
.table .amount-pos { font-weight: 600; color: var(--success) }
.table .amount-neg { font-weight: 600; color: var(--danger) }

/* ──────────────────────────────────────
   FORMS
────────────────────────────────────── */
.form-group {
  margin-bottom: 16px;
}
.form-group label {
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-2);
}
.form-group label .required { color: var(--danger); margin-left: 2px }

.form-control {
  width: 100%;
  padding: 9px 13px;
  border: 1.5px solid var(--border);
  border-radius: var(--r);
  font-size: 14px;
  color: var(--text-1);
  background: var(--card);
  transition: border-color .15s, box-shadow .15s;
  outline: none;
  appearance: none;
}
.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99,102,241,.1);
}
.form-control::placeholder { color: var(--text-4) }
.form-control:disabled { background: var(--bg); color: var(--text-3) }

select.form-control {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
  cursor: pointer;
}

.form-hint {
  font-size: 12px;
  color: var(--text-4);
  margin-top: 4px;
}
.form-error-msg {
  font-size: 12px;
  color: var(--danger);
  margin-top: 4px;
  display: none;
}
.form-error-msg.visible { display: block }

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

.form-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

/* Toggle / Checkbox */
.toggle-group {
  display: flex;
  align-items: center;
  gap: 10px;
}
.toggle-switch {
  position: relative;
  width: 40px; height: 22px;
  flex-shrink: 0;
}
.toggle-switch input { opacity: 0; width: 0; height: 0 }
.toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--border-2);
  border-radius: 20px;
  cursor: pointer;
  transition: background .2s;
}
.toggle-slider::before {
  content: '';
  position: absolute;
  width: 16px; height: 16px;
  left: 3px; top: 3px;
  background: #fff;
  border-radius: 50%;
  transition: transform .2s;
  box-shadow: var(--shadow-xs);
}
.toggle-switch input:checked + .toggle-slider { background: var(--primary) }
.toggle-switch input:checked + .toggle-slider::before { transform: translateX(18px) }

/* ──────────────────────────────────────
   FILTER BAR
────────────────────────────────────── */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}
.filter-bar .form-control { width: auto }

/* ──────────────────────────────────────
   TABS
────────────────────────────────────── */
.tabs {
  display: flex;
  gap: 2px;
  background: var(--bg);
  padding: 4px;
  border-radius: var(--r);
  border: 1px solid var(--border);
  width: fit-content;
  margin-bottom: 20px;
}
.tab-btn {
  padding: 7px 16px;
  border: none;
  background: transparent;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-3);
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: background .15s, color .15s;
  white-space: nowrap;
}
.tab-btn.active {
  background: var(--card);
  color: var(--text-1);
  box-shadow: var(--shadow-xs);
  font-weight: 600;
}
.tab-btn:hover:not(.active) { color: var(--text-1) }

/* ──────────────────────────────────────
   MODALS
────────────────────────────────────── */
.modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,.55);
  z-index: 500;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal.modal--open { display: flex }

.modal-box {
  background: var(--card);
  border-radius: var(--r-xl);
  width: 100%;
  max-width: 540px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-xl);
  animation: modal-in .2s ease-out;
}
@keyframes modal-in {
  from { transform: scale(.95) translateY(10px); opacity: 0 }
  to   { transform: scale(1)   translateY(0);    opacity: 1 }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 22px 24px 18px;
  border-bottom: 1px solid var(--border);
}
.modal-header h3 {
  font-size: 16px;
  font-weight: 700;
}
.modal-close {
  width: 30px; height: 30px;
  display: flex; align-items: center; justify-content: center;
  border: none; background: var(--bg);
  border-radius: var(--r-sm);
  font-size: 18px;
  color: var(--text-3);
  cursor: pointer;
  transition: background .15s;
}
.modal-close:hover { background: var(--border) }

.modal-body { padding: 22px 24px }
.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  background: var(--bg);
  border-radius: 0 0 var(--r-xl) var(--r-xl);
}

/* ──────────────────────────────────────
   TOAST
────────────────────────────────────── */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  background: var(--card);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border);
  min-width: 280px;
  max-width: 360px;
  pointer-events: all;
  opacity: 0;
  transform: translateX(20px);
  transition: opacity .25s, transform .25s;
}
.toast.toast--visible { opacity: 1; transform: translateX(0) }

.toast-icon {
  width: 24px; height: 24px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
}
.toast--success .toast-icon { background: var(--success-light); color: var(--success) }
.toast--error   .toast-icon { background: var(--danger-light);  color: var(--danger) }
.toast--warning .toast-icon { background: var(--warning-light); color: var(--warning) }
.toast--info    .toast-icon { background: var(--info-light);    color: var(--info) }

.toast-msg { flex: 1; font-size: 13.5px; color: var(--text-2) }

.toast-dismiss {
  background: transparent;
  border: none;
  font-size: 18px;
  color: var(--text-4);
  cursor: pointer;
  line-height: 1;
  padding: 0;
}
.toast-dismiss:hover { color: var(--text-2) }

/* ──────────────────────────────────────
   ALERT BANNER
────────────────────────────────────── */
.alert-banner {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 18px;
  border-radius: var(--r-lg);
  margin-bottom: 20px;
  font-size: 13.5px;
}
.alert-banner--warning { background: var(--warning-light); border: 1px solid #fde68a; color: #92400e }
.alert-banner--danger  { background: var(--danger-light);  border: 1px solid #fca5a5; color: #991b1b }
.alert-banner--success { background: var(--success-light); border: 1px solid #6ee7b7; color: #065f46 }
.alert-banner--info    { background: var(--info-light);    border: 1px solid #93c5fd; color: #1e40af }
.alert-banner-icon { flex-shrink: 0; margin-top: 1px }
.alert-banner strong { font-weight: 700 }

/* ──────────────────────────────────────
   EMPTY STATE
────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 56px 24px;
  color: var(--text-3);
}
.empty-icon {
  color: var(--border-2);
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.empty-state h3 {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-2);
  margin-bottom: 6px;
}
.empty-state p {
  font-size: 13.5px;
  margin-bottom: 18px;
  max-width: 320px;
  margin-left: auto;
  margin-right: auto;
}

/* ──────────────────────────────────────
   SKELETON
────────────────────────────────────── */
@keyframes shimmer {
  0%   { background-position: -400px 0 }
  100% { background-position: 400px 0 }
}
.skeleton {
  background: linear-gradient(90deg, #f0f4f8 25%, #e8edf2 50%, #f0f4f8 75%);
  background-size: 800px 100%;
  animation: shimmer 1.4s infinite;
  border-radius: 4px;
}
.skeleton-text { height: 14px; width: 80% }
.skeleton-text.w40 { width: 40% }
.skeleton-text.w60 { width: 60% }

/* ──────────────────────────────────────
   PROGRESS BAR / RUNWAY
────────────────────────────────────── */
.progress-bar-wrap {
  background: var(--bg);
  border-radius: 20px;
  height: 8px;
  overflow: hidden;
  margin: 8px 0;
}
.progress-bar-fill {
  height: 100%;
  border-radius: 20px;
  transition: width .4s ease;
}
.progress-bar-fill--green  { background: var(--success) }
.progress-bar-fill--amber  { background: var(--warning) }
.progress-bar-fill--red    { background: var(--danger) }
.progress-bar-fill--indigo { background: var(--primary) }

/* ──────────────────────────────────────
   CHART CONTAINER
────────────────────────────────────── */
.chart-wrap {
  position: relative;
  width: 100%;
}

/* ──────────────────────────────────────
   INVOICE STATUS INDICATOR
────────────────────────────────────── */
.status-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  display: inline-block;
  margin-right: 5px;
}
.status-dot--green  { background: var(--success) }
.status-dot--blue   { background: var(--info) }
.status-dot--red    { background: var(--danger) }
.status-dot--gray   { background: var(--text-4) }

/* ──────────────────────────────────────
   SECTION DIVIDER
────────────────────────────────────── */
.section-title {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--text-3);
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

/* ──────────────────────────────────────
   CALCULATED ROW (tax / income breakdown)
────────────────────────────────────── */
.calc-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13.5px;
}
.calc-row:last-child { border-bottom: none }
.calc-row.total {
  font-weight: 700;
  font-size: 15px;
  color: var(--text-1);
  padding-top: 14px;
}
.calc-row .label { color: var(--text-2) }
.calc-row .value { font-weight: 600; color: var(--text-1) }
.calc-row .value.positive { color: var(--success) }
.calc-row .value.negative { color: var(--danger) }

/* ──────────────────────────────────────
   QUARTERLY TABLE
────────────────────────────────────── */
.q-table {
  width: 100%;
  border-collapse: collapse;
}
.q-table th, .q-table td {
  padding: 10px 14px;
  text-align: right;
  font-size: 13px;
  border-bottom: 1px solid var(--border);
}
.q-table th:first-child, .q-table td:first-child { text-align: left }
.q-table thead th {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-3);
  background: var(--bg);
}
.q-table tbody td { color: var(--text-2) }
.q-table tbody tr:last-child td { border-bottom: none }
.q-table .total-row td { font-weight: 700; color: var(--text-1); background: var(--bg) }
.q-table .highlight { color: var(--primary); font-weight: 700 }

/* ──────────────────────────────────────
   RESPONSIVE
────────────────────────────────────── */
@media (max-width: 900px) {
  .charts-row { grid-template-columns: 1fr }
  .grid-2 { grid-template-columns: 1fr }
}

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.open {
    transform: translateX(0);
    box-shadow: var(--shadow-xl);
  }
  .sidebar-overlay.active { display: block }
  .main-wrapper { margin-left: 0 }
  .menu-toggle { display: flex }
  .topbar { padding: 0 16px }
  .main-content { padding: 18px 16px }
  .stats-grid { grid-template-columns: repeat(2, 1fr) }
  .form-grid-2, .form-grid-3 { grid-template-columns: 1fr }
  .modal-box { border-radius: var(--r-lg) }
  .modal-body { padding: 18px 18px }
  .modal-header { padding: 18px 18px 14px }
  .modal-footer { padding: 14px 18px }
  .page-header { flex-direction: column; align-items: flex-start }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr }
  .tabs { width: 100% }
  .tab-btn { flex: 1; text-align: center; padding: 7px 10px }
  .table th:nth-child(n+5), .table td:nth-child(n+5) { display: none }
  .toast-container { bottom: 16px; right: 16px; left: 16px }
  .toast { min-width: unset; max-width: unset; width: 100% }
}

/* ──────────────────────────────────────
   UTILITY
────────────────────────────────────── */
.hidden { display: none !important }
.text-right { text-align: right }
.text-center { text-align: center }
.text-sm { font-size: 12.5px }
.text-muted { color: var(--text-3) }
.text-danger { color: var(--danger) }
.text-success { color: var(--success) }
.font-mono { font-family: 'JetBrains Mono', 'Fira Code', monospace }
.flex { display: flex }
.flex-col { flex-direction: column }
.items-center { align-items: center }
.justify-between { justify-content: space-between }
.gap-8 { gap: 8px }
.gap-12 { gap: 12px }
.mb-0 { margin-bottom: 0 }
.mb-16 { margin-bottom: 16px }
.mb-24 { margin-bottom: 24px }
.fw-600 { font-weight: 600 }
.fw-700 { font-weight: 700 }
.fw-medium { font-weight: 500 }

/* ──────────────────────────────────────
   CARD TITLE / SUBTITLE (settings, tax)
────────────────────────────────────── */
.card-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-1);
  margin: 0 0 2px;
}
.card-subtitle {
  font-size: 12.5px;
  color: var(--text-3);
  margin: 0;
}
.card-head {
  padding: 18px 22px 16px;
  border-bottom: 1px solid var(--border);
}

/* ──────────────────────────────────────
   INPUT WITH PREFIX ($ sign)
────────────────────────────────────── */
.input-prefix-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
.input-prefix {
  position: absolute;
  left: 12px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-3);
  pointer-events: none;
  z-index: 1;
  white-space: nowrap;
}
.input-with-prefix {
  padding-left: 36px !important;
}

/* ──────────────────────────────────────
   FEE PREVIEW (income modal)
────────────────────────────────────── */
.fee-preview {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 14px 16px;
  margin-top: 4px;
  display: none;
}
.fee-preview-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 5px 0;
  font-size: 13.5px;
  color: var(--text-2);
}
.fee-preview-total {
  border-top: 1px solid var(--border);
  margin-top: 6px;
  padding-top: 10px;
  font-weight: 600;
}
.fee-preview-label { flex: 1 }
.fee-preview-value { font-weight: 500 }

/* ──────────────────────────────────────
   ACTION BUTTONS (table rows)
────────────────────────────────────── */
.action-btns {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.btn-icon--danger:hover {
  background: var(--danger-light) !important;
  color: var(--danger) !important;
  border-color: var(--danger) !important;
}

/* ──────────────────────────────────────
   ALERT (overdue, warnings on pages)
────────────────────────────────────── */
.alert {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 18px;
  border-radius: var(--r-md);
  font-size: 13.5px;
  line-height: 1.5;
  margin-bottom: 20px;
  position: relative;
}
.alert--danger {
  background: var(--danger-light);
  border: 1px solid #fca5a5;
  color: #991b1b;
}
.alert--warning {
  background: var(--warning-light);
  border: 1px solid #fde68a;
  color: #92400e;
}
.alert--success {
  background: var(--success-light);
  border: 1px solid #6ee7b7;
  color: #065f46;
}
.alert-dismiss {
  position: absolute;
  top: 10px; right: 12px;
  background: none; border: none;
  font-size: 18px; cursor: pointer;
  color: currentColor; opacity: .6;
  line-height: 1; padding: 0;
}
.alert-dismiss:hover { opacity: 1 }

/* ──────────────────────────────────────
   DANGER TABLE ROW
────────────────────────────────────── */
.row--danger td { background: #fff5f5 !important }
.row--danger:hover td { background: #fee2e2 !important }

/* ──────────────────────────────────────
   TOGGLE WITH LABEL (expenses deductible)
────────────────────────────────────── */
.toggle-label {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  cursor: pointer;
  padding: 14px 16px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  transition: background .15s;
}
.toggle-label:hover { background: #f1f5f9 }

/* ──────────────────────────────────────
   MODAL SMALL
────────────────────────────────────── */
.modal-box--sm { max-width: 400px }

/* ──────────────────────────────────────
   INVOICE STATUS: MARK PAID BUTTON
────────────────────────────────────── */
.action-btns .btn {
  padding: 4px 10px;
  font-size: 12px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

/* ──────────────────────────────────────
   TAX PAGE: TWO COLUMN LAYOUT
────────────────────────────────────── */
.tax-two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  align-items: start;
}
@media (max-width: 900px) {
  .tax-two-col { grid-template-columns: 1fr }
}

/* ──────────────────────────────────────
   QUARTERLY TABLE ENHANCEMENTS
────────────────────────────────────── */
.q-table { width: 100% }
.q-table th, .q-table td { padding: 11px 16px !important; font-size: 13px }
.q-table th:not(:first-child), .q-table td:not(:first-child) { text-align: right }
.q-total td {
  font-weight: 700 !important;
  color: var(--text-1) !important;
  background: var(--bg) !important;
  border-top: 2px solid var(--border) !important;
}

/* ──────────────────────────────────────
   TRUE EARNINGS CALCULATOR
────────────────────────────────────── */
.calc-body { padding: 20px 22px }
.calc-breakdown {
  margin-top: 20px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  overflow: hidden;
}
.calc-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 11px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 13.5px;
}
.calc-row:last-child { border-bottom: none }
.calc-row--deduct { background: #fff8f8 }
.calc-row--sub {
  background: #f8fafc;
  font-weight: 600;
  font-size: 13.5px;
}
.calc-row--total {
  background: var(--primary-light);
  font-weight: 700;
  font-size: 14px;
  border-bottom: none;
}
.calc-efficiency {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 16px;
  border-top: 1px solid var(--border);
  font-size: 12.5px;
  background: var(--bg);
}

/* ──────────────────────────────────────
   SETTINGS LAYOUT
────────────────────────────────────── */
.settings-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  align-items: start;
}
@media (max-width: 900px) {
  .settings-layout { grid-template-columns: 1fr }
}
.settings-section {
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.settings-section .form-group { margin: 0 }
.settings-section .form-grid-2 { margin: 0 }
.settings-footer {
  padding-top: 8px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
}

/* ──────────────────────────────────────
   PLATFORM LIST (settings)
────────────────────────────────────── */
.platform-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.platform-row:last-child { border-bottom: none }
.platform-row-info {
  display: flex;
  align-items: center;
  gap: 12px;
}
.platform-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* ──────────────────────────────────────
   TAX PAGE
────────────────────────────────────── */
.text-warning { color: var(--warning) }

.two-col-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}
@media (max-width: 900px) {
  .two-col-layout { grid-template-columns: 1fr }
}

/* Quarterly table */
.q-table tbody tr.row-muted td { opacity: .45 }
.q-table .q-total-row {
  background: #f8fafc;
  border-top: 2px solid var(--border);
}
.q-table .q-total-row td { padding-top: 12px; padding-bottom: 12px }

/* Calculator */
.calc-body { padding: 0 20px 20px }

.calc-result {
  margin-top: 20px;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
}

.calc-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 0;
  font-size: 13.5px;
}
.calc-row--deduct { color: var(--text-3); border-top: 1px dashed var(--border) }
.calc-row--subtotal {
  border-top: 1px solid var(--border);
  font-weight: 600;
  padding-top: 8px;
  margin-top: 2px;
}
.calc-row--total {
  border-top: 2px solid var(--border);
  padding-top: 10px;
  margin-top: 4px;
  font-size: 15px;
}
.calc-label { color: var(--text-2) }
.calc-val { font-weight: 500 }

.calc-pct-bar {
  height: 6px;
  background: #e2e8f0;
  border-radius: 99px;
  margin-top: 14px;
  overflow: hidden;
}
.calc-pct-fill {
  height: 100%;
  background: var(--primary);
  border-radius: 99px;
  transition: width 0.3s ease;
}
.calc-pct-label {
  font-size: 12px;
  color: var(--text-3);
  margin-top: 6px;
  text-align: center;
}

/* Tax tips */
.tips-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  padding: 0 20px 20px;
}
@media (max-width: 768px) {
  .tips-grid { grid-template-columns: 1fr }
}
.tip-item {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}
.tip-icon {
  width: 32px; height: 32px;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 700;
  flex-shrink: 0;
}
.tip-icon--green  { background: #dcfce7; color: #16a34a }
.tip-icon--blue   { background: #dbeafe; color: #1d4ed8 }
.tip-icon--yellow { background: #fef3c7; color: #b45309 }
.tip-icon--purple { background: #ede9fe; color: #7c3aed }
.tip-title { font-size: 13.5px; font-weight: 600; color: var(--text-1); margin-bottom: 3px }
.tip-desc  { font-size: 12.5px; color: var(--text-3); line-height: 1.5 }

/* ──────────────────────────────────────
   SETTINGS PAGE
────────────────────────────────────── */
.settings-section + .settings-section { margin-top: 24px }

.settings-body { padding: 0 20px 20px }

.settings-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

/* Input suffix (for % sign) */
.input-suffix {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-3);
  font-size: 13px;
  pointer-events: none;
}

/* Platform list */
.platform-list {
  padding: 0 20px 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.platform-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 10px;
  transition: border-color .15s;
}
.platform-row:hover { border-color: #cbd5e1 }

.platform-row-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

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

.platform-row-name { font-size: 14px }

/* Card header flex for settings */
.card-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.card-title   { font-size: 15px; font-weight: 600; color: var(--text-1); margin: 0 }
.card-subtitle { font-size: 12.5px; color: var(--text-3) }

/* Alert banner */
.alert-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-radius: 10px;
  font-size: 13.5px;
  margin-bottom: 20px;
}
.alert-banner--warning {
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fcd34d;
}
.alert-banner--danger {
  background: #fee2e2;
  color: #991b1b;
  border: 1px solid #fca5a5;
}

/* Toggle label row */
.toggle-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  padding: 10px 0 4px;
}
.toggle-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}
.toggle-input { display: none }
.toggle-track {
  width: 40px; height: 22px;
  background: #cbd5e1;
  border-radius: 99px;
  position: relative;
  transition: background .2s;
  cursor: pointer;
}
.toggle-input:checked + .toggle-track { background: var(--primary) }
.toggle-thumb {
  position: absolute;
  top: 3px; left: 3px;
  width: 16px; height: 16px;
  background: #fff;
  border-radius: 50%;
  transition: transform .2s;
  box-shadow: 0 1px 3px rgba(0,0,0,.2);
}
.toggle-input:checked + .toggle-track .toggle-thumb { transform: translateX(18px) }
.toggle-hint { font-size: 12px; color: var(--text-3); min-width: 24px }

.form-hint {
  font-size: 12px;
  color: var(--text-3);
  margin-top: 4px;
  line-height: 1.5;
}
