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

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

:root {
  --bg:        #080F18;
  --bg2:       #0C1520;
  --bg3:       #111E2E;
  --bg4:       #162234;
  --accent:    #E8973A;
  --accent-dim: rgba(232,151,58,0.15);
  --accent-dim2: rgba(232,151,58,0.08);
  --text:      #E8EDF3;
  --text2:     #8B9BB4;
  --text3:     #4A5A6E;
  --border:    #1A2A3A;
  --border2:   #243548;
  --danger:    #E85C5C;
  --success:   #4CAF7D;
  --warning:   #F0B429;
  --info:      #5B9CF6;
  --purple:    #A371F7;
  --sidebar-w: 224px;
}

html, body {
  font-family: 'Outfit', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  font-size: 14px;
  line-height: 1.5;
}

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

.sidebar {
  width: var(--sidebar-w);
  background: var(--bg2);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0;
  height: 100vh;
  z-index: 100;
  overflow-y: auto;
}

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

.topbar {
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 90;
  gap: 16px;
}

.content {
  padding: 24px;
  flex: 1;
}

/* ── Sidebar ─────────────────────────────── */
.sidebar-brand {
  padding: 18px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.brand-icon {
  width: 34px; height: 34px;
  background: var(--accent);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 17px;
  flex-shrink: 0;
}

.brand-label { line-height: 1.2; }
.brand-name  { font-size: 15px; font-weight: 700; display: block; }
.brand-sub   { font-size: 10px; color: var(--text2); text-transform: uppercase; letter-spacing: 0.5px; }

.sidebar-nav {
  padding: 10px 8px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 8px;
  color: var(--text2);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: background 0.12s, color 0.12s;
}
.nav-item:hover { background: var(--bg3); color: var(--text); }
.nav-item.active { background: var(--accent-dim); color: var(--accent); }
.nav-item svg { flex-shrink: 0; opacity: 0.7; }
.nav-item.active svg { opacity: 1; }

.sidebar-footer {
  padding: 10px 8px 14px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

.user-chip {
  padding: 8px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 4px;
}

.user-avatar {
  width: 30px; height: 30px;
  background: var(--accent-dim);
  border-radius: 7px;
  display: flex; align-items: center; justify-content: center;
  color: var(--accent);
  font-weight: 700;
  font-size: 12px;
  flex-shrink: 0;
}

.user-name { font-size: 13px; font-weight: 600; }
.user-role { font-size: 11px; color: var(--text2); text-transform: capitalize; }

.logout-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 8px;
  color: var(--text2);
  background: none;
  border: none;
  font-family: 'Outfit', sans-serif;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
  text-align: left;
}
.logout-btn:hover { background: rgba(232,92,92,0.1); color: var(--danger); }

/* ── Topbar ──────────────────────────────── */
.page-title { font-size: 19px; font-weight: 700; }
.topbar-right { display: flex; align-items: center; gap: 8px; }

/* ── Buttons ─────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 8px;
  font-family: 'Outfit', sans-serif;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: opacity 0.12s, background 0.12s;
  border: none;
  text-decoration: none;
  white-space: nowrap;
}
.btn:disabled { opacity: 0.45; cursor: default; }
.btn-primary  { background: var(--accent); color: #fff; }
.btn-primary:not(:disabled):hover { opacity: 0.88; }
.btn-secondary { background: var(--bg3); color: var(--text); border: 1px solid var(--border2); }
.btn-secondary:hover { background: var(--bg4); }
.btn-ghost { background: transparent; color: var(--text2); border: 1px solid var(--border); }
.btn-ghost:hover { background: var(--bg3); color: var(--text); }
.btn-danger { background: rgba(232,92,92,0.15); color: var(--danger); border: 1px solid rgba(232,92,92,0.25); }
.btn-danger:hover { background: rgba(232,92,92,0.25); }
.btn-sm { padding: 5px 10px; font-size: 13px; }
.btn-xs { padding: 3px 8px; font-size: 12px; border-radius: 5px; }
.btn-icon { padding: 7px; border-radius: 7px; }

/* ── Cards ───────────────────────────────── */
.card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
}
.card-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text2);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  margin-bottom: 6px;
}
.card-value {
  font-size: 26px;
  font-weight: 700;
  line-height: 1;
}
.card-sub { font-size: 12px; color: var(--text2); margin-top: 4px; }

/* ── Badges ──────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 7px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  white-space: nowrap;
}
.badge-lead       { background: rgba(91,156,246,0.15);  color: #5B9CF6; }
.badge-scheduled  { background: rgba(240,180,41,0.15);  color: #F0B429; }
.badge-in_progress{ background: rgba(232,151,58,0.18);  color: #E8973A; }
.badge-completed  { background: rgba(76,175,125,0.15);  color: #4CAF7D; }
.badge-paid       { background: rgba(163,113,247,0.15); color: #A371F7; }
.badge-low    { background: rgba(76,175,125,0.1);  color: #4CAF7D; }
.badge-normal { background: rgba(139,155,180,0.1); color: #8B9BB4; }
.badge-high   { background: rgba(232,92,92,0.15);  color: #E85C5C; }
.badge-cash   { background: rgba(76,175,125,0.12); color: #4CAF7D; }
.badge-venmo  { background: rgba(91,156,246,0.12); color: #5B9CF6; }
.badge-check  { background: rgba(240,180,41,0.12); color: #F0B429; }

/* ── Forms ───────────────────────────────── */
.form-group { margin-bottom: 16px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text2);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  margin-bottom: 6px;
}
.form-control {
  width: 100%;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 9px 12px;
  color: var(--text);
  font-family: 'Outfit', sans-serif;
  font-size: 14px;
  outline: none;
  transition: border-color 0.15s;
  appearance: none;
}
.form-control:focus { border-color: var(--accent); }
.form-control::placeholder { color: var(--text3); }
select.form-control { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%238B9BB4' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 32px; cursor: pointer; }
select.form-control option { background: var(--bg2); }
textarea.form-control { resize: vertical; min-height: 76px; }

/* ── Tables ──────────────────────────────── */
.table-wrap {
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}
table { width: 100%; border-collapse: collapse; }
thead th {
  background: var(--bg3);
  padding: 11px 16px;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  color: var(--text2);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
tbody td {
  padding: 11px 16px;
  font-size: 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: var(--bg3); }
.td-muted { color: var(--text2); font-size: 13px; }

/* ── Modals ──────────────────────────────── */
.modal-bg {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.65);
  z-index: 200;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.modal-bg.open { display: flex; }
.modal {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 14px;
  width: 100%;
  max-width: 500px;
  max-height: 92vh;
  overflow-y: auto;
  position: relative;
}
.modal-lg { max-width: 680px; }
.modal-header {
  padding: 18px 22px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  background: var(--bg2);
  z-index: 1;
}
.modal-title { font-size: 17px; font-weight: 700; }
.modal-x {
  background: none; border: none;
  color: var(--text2); font-size: 22px;
  cursor: pointer; padding: 2px 6px;
  border-radius: 5px; line-height: 1;
}
.modal-x:hover { color: var(--text); background: var(--bg3); }
.modal-body { padding: 22px; }
.modal-footer {
  padding: 14px 22px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* ── Slide Panel ─────────────────────────── */
.panel-bg {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 150;
  display: none;
}
.panel-bg.open { display: block; }

.slide-panel {
  position: fixed;
  top: 0; right: 0;
  height: 100vh;
  width: 500px;
  background: var(--bg2);
  border-left: 1px solid var(--border);
  z-index: 151;
  transform: translateX(100%);
  transition: transform 0.22s ease;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}
.slide-panel.open { transform: translateX(0); }

.panel-hdr {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  position: sticky;
  top: 0;
  background: var(--bg2);
  z-index: 1;
  gap: 12px;
}
.panel-title-group { flex: 1; min-width: 0; }
.panel-title { font-size: 17px; font-weight: 700; }
.panel-subtitle { font-size: 13px; color: var(--text2); margin-top: 2px; }
.panel-close {
  background: none; border: none;
  color: var(--text2); font-size: 22px;
  cursor: pointer; flex-shrink: 0;
  padding: 2px; border-radius: 4px;
  line-height: 1;
}
.panel-close:hover { color: var(--text); }

.panel-body { padding: 20px; flex: 1; }

.panel-section { margin-bottom: 22px; }
.panel-section-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text2);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 10px;
}

.info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.info-item { display: flex; flex-direction: column; gap: 2px; }
.info-key  { font-size: 11px; color: var(--text2); text-transform: uppercase; letter-spacing: 0.4px; }
.info-val  { font-size: 14px; font-weight: 500; }

/* Notes */
.note-thread { display: flex; flex-direction: column; gap: 8px; }
.note-item {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
}
.note-meta { font-size: 11px; color: var(--text2); margin-bottom: 4px; }
.note-text { font-size: 14px; line-height: 1.5; }

.note-compose {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}
.note-compose textarea {
  flex: 1;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  color: var(--text);
  font-family: 'Outfit', sans-serif;
  font-size: 13px;
  resize: none;
  height: 60px;
  outline: none;
}
.note-compose textarea:focus { border-color: var(--accent); }

/* Payments in panel */
.payment-row {
  background: var(--bg3);
  border-radius: 8px;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}
.payment-meta { font-size: 12px; color: var(--text2); }
.payment-amount { font-size: 16px; font-weight: 700; color: var(--success); }

/* Status buttons */
.status-actions { display: flex; flex-wrap: wrap; gap: 6px; }

/* ── Job Cards (Kanban) ───────────────────── */
.kanban {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  overflow-x: auto;
  padding-bottom: 12px;
}
.kanban-col {
  min-width: 0;
  flex: 1;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 12px;
  min-width: 190px;
}
.kanban-hdr {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.kanban-hdr-title {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text2);
}
.kanban-count {
  background: var(--bg2);
  color: var(--text2);
  border-radius: 10px;
  padding: 1px 7px;
  font-size: 12px;
}
.kanban-body {
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 80px;
}

.job-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 11px 12px;
  cursor: pointer;
  transition: border-color 0.12s, transform 0.1s;
}
.job-card:hover { border-color: var(--accent); transform: translateY(-1px); }
.job-card.dragging { opacity: 0.5; }
.job-card-client { font-size: 12px; color: var(--text2); margin-bottom: 3px; }
.job-card-title { font-size: 13px; font-weight: 600; margin-bottom: 8px; line-height: 1.35; }
.job-card-footer { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; }
.job-card-type {
  font-size: 11px;
  color: var(--text2);
  background: var(--bg3);
  padding: 2px 6px;
  border-radius: 4px;
  text-transform: capitalize;
}
.job-card-date { font-size: 11px; color: var(--text3); margin-left: auto; }

/* ── Stats Row ───────────────────────────── */
.stats-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }

/* ── Section Headers ─────────────────────── */
.section-hdr {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}
.section-title { font-size: 15px; font-weight: 700; }

/* ── Totals Bar ──────────────────────────── */
.totals-bar {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-bottom: 20px;
}

/* ── Alerts ──────────────────────────────── */
.alert { padding: 10px 14px; border-radius: 8px; font-size: 13px; margin-bottom: 14px; }
.alert-error   { background: rgba(232,92,92,0.1);  border: 1px solid rgba(232,92,92,0.25);  color: var(--danger); }
.alert-success { background: rgba(76,175,125,0.1); border: 1px solid rgba(76,175,125,0.25); color: var(--success); }
.alert-info    { background: rgba(91,156,246,0.1); border: 1px solid rgba(91,156,246,0.25); color: var(--info); }

/* ── Empty / Loading ─────────────────────── */
.empty {
  text-align: center;
  padding: 48px 24px;
  color: var(--text2);
}
.empty-icon { font-size: 36px; margin-bottom: 12px; }
.empty-title { font-size: 16px; font-weight: 600; color: var(--text); margin-bottom: 6px; }
.empty-msg { font-size: 13px; }

.loading { display: flex; align-items: center; justify-content: center; padding: 48px; color: var(--text2); gap: 10px; }
.spinner {
  width: 20px; height: 20px;
  border: 2px solid var(--border2);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Search ──────────────────────────────── */
.search-wrap { position: relative; }
.search-wrap svg { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); pointer-events: none; }
.search-input { padding-left: 34px !important; }

/* ── Client list ─────────────────────────── */
.client-row {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.1s;
  gap: 14px;
}
.client-row:last-child { border-bottom: none; }
.client-row:hover { background: var(--bg3); }
.client-avatar {
  width: 36px; height: 36px;
  background: var(--accent-dim);
  border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  color: var(--accent);
  font-weight: 700;
  font-size: 14px;
  flex-shrink: 0;
}
.client-name { font-size: 14px; font-weight: 600; }
.client-meta { font-size: 12px; color: var(--text2); }
.client-jobs { font-size: 12px; color: var(--text2); margin-left: auto; white-space: nowrap; }

/* ── Schedule List ───────────────────────── */
.schedule-item {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
  display: flex;
  align-items: flex-start;
  gap: 16px;
}
.schedule-date {
  text-align: center;
  flex-shrink: 0;
  width: 50px;
}
.schedule-date-month { font-size: 10px; font-weight: 600; color: var(--accent); text-transform: uppercase; letter-spacing: 0.5px; }
.schedule-date-day { font-size: 24px; font-weight: 700; line-height: 1; }
.schedule-date-time { font-size: 11px; color: var(--text2); margin-top: 3px; }
.schedule-info { flex: 1; }
.schedule-title { font-size: 15px; font-weight: 600; margin-bottom: 4px; }
.schedule-client { font-size: 13px; color: var(--text2); }
.schedule-address { font-size: 12px; color: var(--text3); margin-top: 3px; }
.schedule-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }

/* ── Misc helpers ────────────────────────── */
.flex     { display: flex; }
.items-center { align-items: center; }
.gap-1    { gap: 4px; }
.gap-2    { gap: 8px; }
.gap-3    { gap: 12px; }
.mt-1     { margin-top: 4px; }
.mt-2     { margin-top: 8px; }
.mt-4     { margin-top: 16px; }
.mb-2     { margin-bottom: 8px; }
.mb-4     { margin-bottom: 16px; }
.text-sm  { font-size: 13px; }
.text-xs  { font-size: 12px; }
.text-muted { color: var(--text2); }
.text-accent { color: var(--accent); }
.text-success { color: var(--success); }
.font-bold { font-weight: 700; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── Responsive ──────────────────────────── */
@media (max-width: 900px) {
  .stats-row { grid-template-columns: 1fr 1fr; }
  .totals-bar { grid-template-columns: 1fr 1fr 1fr; }
  .kanban { flex-direction: column; }
  .kanban-col { min-width: 100%; }
  .form-row { grid-template-columns: 1fr; }
  .info-grid { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .sidebar { width: 0; overflow: hidden; }
  .main { margin-left: 0; }
  .slide-panel { width: 100%; }
  .stats-row { grid-template-columns: 1fr 1fr; }
  .totals-bar { grid-template-columns: 1fr; }
  .topbar { padding: 12px 16px; }
  .content { padding: 16px; }
}
