/* ═══════════════════════════════════════════════════════════
   StudioFlow — Monday.com CRM-inspired design
   Font: Plus Jakarta Sans
   Palette: Dark navy sidebar · Ice-blue surface · Bright accents
═══════════════════════════════════════════════════════════ */

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

:root {
  /* Sidebar */
  --navy:          #1f2d3d;
  --navy-2:        #253142;
  --navy-hover:    #2c3f55;
  --navy-active:   #374f66;
  --sidebar-w:     220px;

  /* Brand / Primary */
  --blue:          #0073ea;
  --blue-hover:    #0060c2;
  --blue-light:    #cce5ff;
  --blue-bg:       #e6f2ff;

  /* Surface */
  --bg:            #f6f7fb;
  --white:         #ffffff;
  --surface-2:     #f0f2f8;

  /* Borders */
  --border:        #e6e9ef;
  --border-2:      #d4d7e3;

  /* Text */
  --text-primary:  #323338;
  --text-secondary:#676879;
  --text-muted:    #9699a6;
  --text-inverse:  #ffffff;

  /* Status colors — Monday palette */
  --green:         #00c875;
  --green-bg:      #e0faf0;
  --orange:        #fdab3d;
  --orange-bg:     #fff3de;
  --red:           #e2445c;
  --red-bg:        #fde8ec;
  --purple:        #a25ddc;
  --purple-bg:     #f2e8fb;
  --teal:          #00b0d7;
  --teal-bg:       #e0f6fc;
  --yellow:        #cab641;
  --yellow-bg:     #fdf8e0;

  /* Radius */
  --r-sm:   4px;
  --r-md:   8px;
  --r-lg:   12px;
  --r-xl:   16px;
  --r-pill: 999px;

  /* Shadow */
  --shadow-sm: 0 1px 4px rgba(0,0,0,.06), 0 0 1px rgba(0,0,0,.06);
  --shadow-md: 0 4px 16px rgba(0,0,0,.09), 0 0 1px rgba(0,0,0,.06);
  --shadow-lg: 0 12px 40px rgba(0,0,0,.13), 0 0 1px rgba(0,0,0,.07);

  --transition: all .15s ease;
}

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

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

body {
  font-family: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

h1 { font-size: 1.5rem; font-weight: 700; color: var(--text-primary); }
h2 { font-size: 1.15rem; font-weight: 600; color: var(--text-primary); }
h3 { font-size: 1rem; font-weight: 600; color: var(--text-primary); }
p  { color: var(--text-secondary); }
a  { color: var(--blue); text-decoration: none; }
a:hover { color: var(--blue-hover); }

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

/* ── Sidebar ────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  background: var(--navy);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0;
  height: 100vh;
  z-index: 200;
  overflow: hidden;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 16px 18px;
}
.brand-icon {
  width: 32px; height: 32px;
  border-radius: var(--r-md);
  background: var(--blue);
  display: flex; align-items: center; justify-content: center;
  font-size: .85rem;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
  letter-spacing: -.02em;
}
.brand-name {
  font-size: .95rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: -.01em;
}

.sidebar-divider {
  height: 1px;
  background: rgba(255,255,255,.08);
  margin: 0 12px 8px;
}

.sidebar-section-label {
  font-size: .65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: rgba(255,255,255,.3);
  padding: 10px 16px 4px;
}

.sidebar-nav {
  flex: 1;
  padding: 4px 8px;
  display: flex;
  flex-direction: column;
  gap: 1px;
  overflow-y: auto;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--r-md);
  color: rgba(255,255,255,.65);
  font-size: .83rem;
  font-weight: 500;
  transition: var(--transition);
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
}
.nav-item:hover {
  background: var(--navy-hover);
  color: rgba(255,255,255,.9);
}
.nav-item.active {
  background: var(--blue);
  color: #fff;
}
.nav-item svg { flex-shrink: 0; opacity: .85; }
.nav-item.active svg { opacity: 1; }

.sidebar-footer {
  padding: 8px;
  border-top: 1px solid rgba(255,255,255,.08);
}
.et-clock {
  display: flex; align-items: center; gap: 6px;
  padding: 6px 10px;
  color: rgba(255,255,255,.35);
  font-size: .72rem;
}
.logout-btn {
  color: rgba(255,255,255,.5) !important;
  font-size: .83rem;
}
.logout-btn:hover {
  background: rgba(226,68,92,.2) !important;
  color: #ff8080 !important;
}

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

/* ── Top bar ────────────────────────────────────────────── */
.top-bar {
  background: var(--white);
  border-bottom: 1px solid var(--border);
  padding: 0 28px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
  gap: 12px;
}
.top-bar-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  flex: 1;
}
.top-bar h1 {
  font-size: 1.1rem;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.top-bar-subtitle {
  font-size: .78rem;
  color: var(--text-muted);
  white-space: nowrap;
}
.top-bar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

/* Page body */
.page-body { padding: 24px 28px; flex: 1; }

/* Legacy compat */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 20px;
  gap: 12px;
}
.page-header h1 { font-size: 1.3rem; }
.page-subtitle { font-size: .78rem; color: var(--text-muted); margin-top: 2px; }

/* ── Buttons ────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 16px;
  border-radius: var(--r-md);
  font-family: inherit;
  font-size: .82rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: var(--transition);
  white-space: nowrap;
  text-decoration: none;
}
.btn-primary {
  background: var(--blue);
  color: #fff;
}
.btn-primary:hover { background: var(--blue-hover); color: #fff; }
.btn-outline {
  background: var(--white);
  color: var(--text-primary);
  border-color: var(--border-2);
}
.btn-outline:hover { background: var(--surface-2); border-color: var(--border-2); color: var(--text-primary); }
.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border-color: transparent;
}
.btn-ghost:hover { background: var(--surface-2); color: var(--text-primary); }
.btn-danger {
  background: transparent;
  color: var(--red);
  border-color: var(--border-2);
}
.btn-danger:hover { background: var(--red-bg); border-color: var(--red); }
.btn-gold { background: var(--green); color: #fff; }
.btn-gold:hover { background: #00a864; color: #fff; }
.btn-sm { padding: 4px 10px; font-size: .78rem; border-radius: var(--r-sm); }
.btn-icon { padding: 6px; border-radius: var(--r-sm); }

/* ── Cards ──────────────────────────────────────────────── */
.card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
}
.card-pad { padding: 20px; }
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
}
.card-header h3 { font-size: .9rem; }
.card-body { padding: 20px; }

/* ── Stat cards ─────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 22px;
}
.stat-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 18px 20px;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  transition: var(--transition);
  box-shadow: var(--shadow-sm);
}
.stat-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.stat-icon {
  width: 40px; height: 40px;
  border-radius: var(--r-md);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.stat-icon.blue   { background: var(--blue-bg);   color: var(--blue); }
.stat-icon.green  { background: var(--green-bg);  color: #00a864; }
.stat-icon.orange { background: var(--orange-bg); color: #d48a20; }
.stat-icon.purple { background: var(--purple-bg); color: var(--purple); }
.stat-icon.red    { background: var(--red-bg);    color: var(--red); }
.stat-body { flex: 1; min-width: 0; }
.stat-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.1;
  margin-bottom: 3px;
}
.stat-label { font-size: .75rem; color: var(--text-muted); font-weight: 500; }
.stat-change { font-size: .72rem; color: var(--green); margin-top: 4px; font-weight: 500; }
.stat-change.down { color: var(--red); }

/* ── Tables ─────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; border-radius: 0 0 var(--r-lg) var(--r-lg); }
table { width: 100%; border-collapse: collapse; font-size: .83rem; }
th {
  text-align: left;
  padding: 9px 14px;
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--text-muted);
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--text-primary);
  vertical-align: middle;
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: #f9fafc; }
.td-muted { color: var(--text-muted); font-size: .8rem; }
.td-bold  { font-weight: 600; }
.td-mono  { font-variant-numeric: tabular-nums; }

/* ── Badges / Status pills ──────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: var(--r-pill);
  font-size: .71rem;
  font-weight: 700;
  letter-spacing: .03em;
  text-transform: uppercase;
  white-space: nowrap;
}
.badge-inquiry   { background: var(--purple-bg); color: #7a3fb0; }
.badge-proposal  { background: var(--teal-bg);   color: #007a99; }
.badge-contract  { background: var(--orange-bg); color: #b87800; }
.badge-active    { background: var(--blue-bg);   color: #0055bb; }
.badge-completed { background: var(--green-bg);  color: #007a46; }
.badge-draft     { background: var(--surface-2); color: var(--text-muted); }
.badge-sent      { background: var(--blue-bg);   color: #0055bb; }
.badge-paid      { background: var(--green-bg);  color: #007a46; }
.badge-overdue   { background: var(--red-bg);    color: #b52040; }
.badge-cancelled { background: var(--surface-2); color: var(--text-muted); }
.badge-signed    { background: var(--green-bg);  color: #007a46; }
.badge-inactive  { background: var(--surface-2); color: var(--text-muted); }
.badge-default   { background: var(--surface-2); color: var(--text-muted); }

/* ── Row actions ────────────────────────────────────────── */
.row-actions { display: flex; gap: 4px; align-items: center; opacity: 0; transition: opacity .15s; }
tr:hover .row-actions { opacity: 1; }

/* ── Forms ──────────────────────────────────────────────── */
.form-grid { display: grid; gap: 14px; }
.form-grid-2 { grid-template-columns: 1fr 1fr; }
.form-grid-3 { grid-template-columns: 1fr 1fr 1fr; }
.form-group { display: flex; flex-direction: column; gap: 5px; }
.form-group label {
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--text-muted);
}
.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 8px 11px;
  border: 1px solid var(--border-2);
  border-radius: var(--r-md);
  background: var(--white);
  font-family: inherit;
  font-size: .85rem;
  color: var(--text-primary);
  transition: var(--transition);
  outline: none;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(0,115,234,.1);
}
.form-group textarea { resize: vertical; min-height: 80px; }
.form-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 6px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}
.form-span-2 { grid-column: span 2; }
.form-span-3 { grid-column: span 3; }

/* ── Modal ──────────────────────────────────────────────── */
.modal-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(32,40,52,.5);
  backdrop-filter: blur(2px);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-backdrop.open { display: flex; }
.modal {
  background: var(--white);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 600px;
  max-height: 90vh;
  overflow-y: auto;
  animation: modalIn .18s ease;
}
.modal-lg { max-width: 780px; }
@keyframes modalIn {
  from { opacity: 0; transform: translateY(-10px) scale(.98); }
  to   { opacity: 1; transform: none; }
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px 14px;
  border-bottom: 1px solid var(--border);
}
.modal-header h3 { font-size: 1.05rem; font-weight: 700; }
.modal-close {
  background: none; border: none; cursor: pointer;
  color: var(--text-muted); padding: 4px;
  border-radius: var(--r-sm);
  display: flex; align-items: center;
  transition: var(--transition);
}
.modal-close:hover { background: var(--surface-2); color: var(--text-primary); }
.modal-body { padding: 20px 22px 22px; }

/* ── Pipeline board ─────────────────────────────────────── */
.pipeline { display: flex; gap: 14px; overflow-x: auto; padding-bottom: 8px; }
.pipeline-col {
  min-width: 200px;
  flex: 1;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 12px;
}
.pipeline-col-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
.pipeline-col-title {
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--text-secondary);
}
.pipeline-col-count {
  font-size: .7rem;
  background: var(--border);
  color: var(--text-muted);
  padding: 1px 7px;
  border-radius: var(--r-pill);
  font-weight: 700;
}
.pipeline-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 12px;
  margin-bottom: 8px;
  cursor: pointer;
  transition: var(--transition);
}
.pipeline-card:hover { box-shadow: var(--shadow-md); border-color: var(--blue); }
.pipeline-card-title { font-weight: 600; font-size: .83rem; color: var(--text-primary); margin-bottom: 3px; }
.pipeline-card-sub   { font-size: .75rem; color: var(--text-muted); }
.pipeline-card-value { font-size: .9rem; color: var(--blue); margin-top: 8px; font-weight: 700; }

/* ── Flash messages ─────────────────────────────────────── */
.flash {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: var(--r-md);
  margin-bottom: 16px;
  font-size: .83rem;
  font-weight: 500;
}
.flash-success { background: var(--green-bg); color: #007a46; border: 1px solid #c8f0dc; }
.flash-error   { background: var(--red-bg);   color: #b52040; border: 1px solid #f5c0cc; }

/* ── Dashboard grid ─────────────────────────────────────── */
.dash-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 18px; }

/* ── Activity feed ──────────────────────────────────────── */
.activity-list { display: flex; flex-direction: column; }
.activity-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.activity-item:last-child { border-bottom: none; }
.activity-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--blue);
  margin-top: 5px;
  flex-shrink: 0;
}
.activity-dot.dot-invoice  { background: var(--green); }
.activity-dot.dot-contract { background: var(--orange); }
.activity-dot.dot-client   { background: var(--blue); }
.activity-dot.dot-project  { background: var(--purple); }
.activity-text  { font-size: .82rem; color: var(--text-primary); }
.activity-time  { font-size: .72rem; color: var(--text-muted); margin-top: 1px; }

/* ── Event list ─────────────────────────────────────────── */
.event-list { display: flex; flex-direction: column; gap: 8px; }
.event-item {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 8px;
  border-radius: var(--r-md);
  transition: var(--transition);
}
.event-item:hover { background: var(--surface-2); }
.event-date-box {
  min-width: 40px;
  text-align: center;
  background: var(--blue-bg);
  border-radius: var(--r-md);
  padding: 5px;
  flex-shrink: 0;
}
.event-month { font-size: .6rem; text-transform: uppercase; letter-spacing: .08em; color: var(--blue); font-weight: 700; }
.event-day   { font-size: 1.3rem; font-weight: 700; color: var(--blue); line-height: 1.1; }
.event-info  { flex: 1; }
.event-title { font-size: .83rem; font-weight: 600; color: var(--text-primary); }
.event-sub   { font-size: .75rem; color: var(--text-muted); margin-top: 1px; }
.event-type-badge {
  font-size: .65rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .05em; padding: 2px 7px; border-radius: var(--r-pill);
  background: var(--blue-bg); color: var(--blue);
  flex-shrink: 0; align-self: flex-start;
}

/* ── Calendar ───────────────────────────────────────────── */
.cal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
}
.cal-day-name {
  text-align: center;
  padding: 7px 4px;
  font-size: .68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--text-muted);
  background: var(--surface-2);
}
.cal-cell {
  background: var(--white);
  min-height: 88px;
  padding: 5px;
  position: relative;
}
.cal-cell.other-month { background: var(--surface-2); }
.cal-cell.today { background: #f0f7ff; }
.cal-num {
  font-size: .78rem;
  font-weight: 600;
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px; height: 22px;
  border-radius: 50%;
}
.cal-cell.today .cal-num { background: var(--blue); color: #fff; }
.cal-event {
  font-size: .67rem;
  padding: 2px 5px;
  border-radius: 3px;
  margin-top: 2px;
  background: var(--blue-bg);
  color: var(--blue);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
  font-weight: 500;
}
.cal-event:hover { background: var(--blue); color: #fff; }

/* ── Invoice detail ─────────────────────────────────────── */
.invoice-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin-bottom: 20px; }
.invoice-totals { margin-left: auto; width: 260px; }
.invoice-totals-row { display: flex; justify-content: space-between; padding: 7px 0; border-bottom: 1px solid var(--border); font-size: .83rem; }
.invoice-totals-row.total-row { font-weight: 700; font-size: .95rem; border-bottom: none; padding-top: 10px; }
.invoice-total-label { color: var(--text-muted); }
.invoice-total-val { color: var(--text-primary); font-weight: 600; }

/* ── Contract editor ────────────────────────────────────── */
.contract-editor {
  width: 100%;
  min-height: 300px;
  padding: 14px;
  border: 1px solid var(--border-2);
  border-radius: var(--r-md);
  font-family: inherit;
  font-size: .85rem;
  line-height: 1.7;
  color: var(--text-primary);
  background: var(--white);
  resize: vertical;
  outline: none;
}
.contract-editor:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(0,115,234,.1); }

/* ── Empty state ────────────────────────────────────────── */
.empty-state { text-align: center; padding: 48px 24px; }
.empty-state h3 { font-size: 1rem; color: var(--text-secondary); margin-bottom: 6px; }
.empty-state p  { font-size: .83rem; }

/* ── Filter bar ─────────────────────────────────────────── */
.filter-bar { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; }
.filter-bar input,
.filter-bar select {
  padding: 7px 11px;
  border: 1px solid var(--border-2);
  border-radius: var(--r-md);
  background: var(--white);
  font-family: inherit;
  font-size: .83rem;
  color: var(--text-primary);
  outline: none;
}
.filter-bar input { flex: 1; max-width: 260px; }
.filter-bar input:focus,
.filter-bar select:focus { border-color: var(--blue); box-shadow: 0 0 0 2px rgba(0,115,234,.1); }

/* ── Login page ─────────────────────────────────────────── */
.login-body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
}
.login-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  padding: 40px;
  width: 100%;
  max-width: 400px;
  box-shadow: var(--shadow-lg);
}
.login-logo { text-align: center; margin-bottom: 28px; }
.login-logo .brand-icon {
  display: inline-flex;
  width: 48px; height: 48px;
  border-radius: var(--r-lg);
  font-size: 1.1rem;
  margin-bottom: 10px;
}
.login-logo .brand-name { display: block; font-size: 1.5rem; font-weight: 700; color: var(--text-primary); }
.login-subtitle { text-align: center; font-size: .82rem; color: var(--text-muted); margin-bottom: 24px; }
.login-card .form-group { margin-bottom: 14px; }
.btn-login { width: 100%; justify-content: center; padding: 10px; font-size: .9rem; margin-top: 6px; }
.login-error {
  background: var(--red-bg);
  color: #b52040;
  border: 1px solid #f5c0cc;
  border-radius: var(--r-md);
  padding: 9px 12px;
  font-size: .82rem;
  margin-bottom: 14px;
  display: flex; align-items: center; gap: 7px;
}
.login-footer { text-align: center; margin-top: 16px; font-size: .75rem; color: var(--text-muted); }

/* ── Tabs ───────────────────────────────────────────────── */
.tabs { display: flex; gap: 0; border-bottom: 1px solid var(--border); margin-bottom: 18px; }
.tab-btn {
  padding: 8px 16px;
  border: none; background: none; cursor: pointer;
  font-family: inherit;
  font-size: .83rem; font-weight: 600;
  color: var(--text-muted);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: var(--transition);
}
.tab-btn:hover { color: var(--text-primary); }
.tab-btn.active { color: var(--blue); border-bottom-color: var(--blue); }
.tab-pane { display: none; }
.tab-pane.active { display: block; }

/* ── Stage progress bar ─────────────────────────────────── */
.stage-rail {
  display: flex;
  align-items: stretch;
  gap: 0;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  overflow: hidden;
  margin-bottom: 20px;
}
.stage-step {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 9px 8px;
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-muted);
  background: var(--white);
  text-decoration: none;
  transition: var(--transition);
  border-right: 1px solid var(--border);
  cursor: pointer;
}
.stage-step:last-child { border-right: none; }
.stage-step:hover { background: var(--surface-2); color: var(--text-primary); }
.stage-step.done  { background: var(--blue-bg); color: #0055bb; }
.stage-step.current {
  background: var(--blue);
  color: #fff;
}
.stage-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
  opacity: .7;
}

/* ── Info rows (client detail) ──────────────────────────── */
.info-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 9px 0;
  border-bottom: 1px solid var(--border);
  font-size: .83rem;
}
.info-row:last-child { border-bottom: none; }
.info-row svg { color: var(--text-muted); flex-shrink: 0; margin-top: 1px; }
.info-label { font-size: .72rem; color: var(--text-muted); font-weight: 600; margin-bottom: 1px; }
.info-val   { color: var(--text-primary); }

/* ── Quick stat mini-cards ──────────────────────────────── */
.mini-stat {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 16px;
  text-align: center;
  box-shadow: var(--shadow-sm);
}
.mini-stat-value { font-size: 1.6rem; font-weight: 700; color: var(--blue); line-height: 1; margin-bottom: 4px; }
.mini-stat-label { font-size: .72rem; color: var(--text-muted); font-weight: 600; text-transform: uppercase; letter-spacing: .06em; }

/* ── Progress bar ───────────────────────────────────────── */
.progress-bar {
  height: 5px;
  background: var(--surface-2);
  border-radius: var(--r-pill);
  overflow: hidden;
  margin-top: 8px;
}
.progress-fill {
  height: 100%;
  background: var(--blue);
  border-radius: var(--r-pill);
  transition: width .5s ease;
}

/* ── Utility ────────────────────────────────────────────── */
.text-blue    { color: var(--blue); }
.text-green   { color: #007a46; }
.text-red     { color: var(--red); }
.text-muted   { color: var(--text-muted); }
.text-bold    { font-weight: 700; }
.mt-14 { margin-top: 14px; }
.mt-18 { margin-top: 18px; }
.mb-14 { margin-bottom: 14px; }
.mb-18 { margin-bottom: 18px; }
.flex  { display: flex; }
.gap-8 { gap: 8px; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.w-full { width: 100%; }
.hidden { display: none !important; }
hr.divider { border: none; border-top: 1px solid var(--border); margin: 16px 0; }

/* ── Responsive ─────────────────────────────────────────── */
@media (max-width: 1100px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .dash-grid  { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
  .main-content { margin-left: 0; }
  .sidebar { transform: translateX(-100%); }
  .page-body { padding: 16px; }
  .form-grid-2, .form-grid-3 { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
}
