/* ══════════════════════════════════════
   RESET & BASE
══════════════════════════════════════ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --blue:    #3b82f6;
  --green:   #10b981;
  --amber:   #f59e0b;
  --red:     #ef4444;
  --purple:  #8b5cf6;
  --slate:   #64748b;
  --bg:      #f8fafc;
  --surface: #ffffff;
  --border:  #e2e8f0;
  --text:    #0f172a;
  --muted:   #94a3b8;
  --radius:  12px;
  --shadow:  0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.04);
  --shadow-md: 0 4px 16px rgba(0,0,0,.10);
}

html {
  height: 100%;
  height: -webkit-fill-available;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Inter', 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  height: 100vh;
  height: 100dvh;
  display: flex;
  overflow: hidden;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ══════════════════════════════════════
   SIDEBAR
══════════════════════════════════════ */
.sidebar {
  width: 224px;
  background: #0c1220;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  height: 100vh;
  border-right: 1px solid #1a2540;
}

.sidebar-brand {
  padding: 22px 18px 18px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid #1a2540;
}
.brand-icon { color: #3b82f6; font-size: 1.2rem; }
.brand-name {
  color: #f1f5f9;
  font-size: .78rem;
  font-weight: 800;
  letter-spacing: 2.5px;
  text-transform: uppercase;
}

.sidebar-nav {
  flex: 1;
  padding: 10px 10px;
  overflow-y: auto;
  scrollbar-width: none;
}
.sidebar-nav::-webkit-scrollbar { display: none; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 11px;
  border-radius: 8px;
  color: #64748b;
  font-size: .8rem;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  transition: background .12s, color .12s;
  margin-bottom: 1px;
  position: relative;
  user-select: none;
}
.nav-item:hover { color: #cbd5e1; background: #131e30; }
.nav-item.active { color: #f1f5f9; background: #1a2f50; font-weight: 600; }
.nav-item.active::before {
  content: '';
  position: absolute; left: 0; top: 25%; bottom: 25%;
  width: 2.5px; background: #3b82f6; border-radius: 0 2px 2px 0;
}
.nav-icon { font-size: .85rem; width: 16px; text-align: center; flex-shrink: 0; }
.nav-count {
  margin-left: auto;
  background: #1a2f50;
  color: #60a5fa;
  font-size: .6rem;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 20px;
  min-width: 18px;
  text-align: center;
}
.nav-count.urgent { background: #450a0a; color: #f87171; }

.sidebar-footer {
  padding: 12px 10px;
  border-top: 1px solid #1a2540;
}
.sidebar-user {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 10px;
  border-radius: 8px;
  margin-bottom: 6px;
}
.user-avatar {
  width: 30px; height: 30px;
  border-radius: 8px;
  background: #1a2f50;
  color: #60a5fa;
  font-size: .75rem;
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.user-info { flex: 1; min-width: 0; }
.user-name { font-size: .75rem; font-weight: 600; color: #e2e8f0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { font-size: .67rem; color: #475569; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.btn-logout {
  width: 100%; background: none; border: 1px solid #1a2540;
  color: #475569; font-size: .72rem; padding: 7px; border-radius: 7px;
  cursor: pointer; transition: all .12s;
}
.btn-logout:hover { background: #131e30; color: #94a3b8; border-color: #2a3a5e; }

/* ══════════════════════════════════════
   CONTENT
══════════════════════════════════════ */
.content-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}

.topbar {
  height: 54px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  flex-shrink: 0;
}
.topbar-left { font-size: .95rem; font-weight: 700; color: var(--text); }
.topbar-right { display: flex; align-items: center; gap: 10px; }
.btn-lang {
  background: none; border: 1px solid var(--border); color: var(--slate);
  font-size: .74rem; padding: 5px 11px; border-radius: 7px; cursor: pointer;
}
.btn-primary {
  background: var(--blue); color: #fff; border: none;
  padding: 7px 16px; border-radius: 8px; font-size: .8rem;
  font-weight: 600; cursor: pointer; transition: background .12s;
  white-space: nowrap; display: flex; align-items: center; gap: 5px;
}
.btn-primary:hover { background: #2563eb; }

.views-container {
  flex: 1;
  overflow: hidden;
  display: flex;
  position: relative;
}

.view {
  display: none;
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 24px 28px;
  flex-direction: column;
  gap: 0;
  min-height: 0;
}
.view.active { display: flex; }
.view > * { flex-shrink: 0; }

/* scrollbar */
.view::-webkit-scrollbar { width: 5px; }
.view::-webkit-scrollbar-thumb { background: #e2e8f0; border-radius: 3px; }

.page-header { margin-bottom: 20px; }
.page-header h2 { font-size: 1.25rem; font-weight: 700; color: var(--text); }
.page-sub { font-size: .78rem; color: var(--muted); margin-top: 2px; }

/* ══════════════════════════════════════
   METRICS
══════════════════════════════════════ */
.metrics-row {
  display: grid;
  grid-template-columns: repeat(4,1fr);
  gap: 14px;
  margin-bottom: 22px;
}
.metric-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  display: flex;
  align-items: center;
  gap: 14px;
  box-shadow: var(--shadow);
}
.metric-icon {
  width: 40px; height: 40px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem; flex-shrink: 0;
}
.metric-icon.blue   { background: #eff6ff; }
.metric-icon.green  { background: #ecfdf5; }
.metric-icon.orange { background: #fffbeb; }
.metric-icon.purple { background: #f5f3ff; }
.metric-body { flex: 1; min-width: 0; }
.metric-label { font-size: .7rem; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .4px; }
.metric-value { font-size: 1.6rem; font-weight: 800; color: var(--text); line-height: 1.2; }
.metric-sub   { font-size: .7rem; color: var(--muted); margin-top: 1px; }

/* ══════════════════════════════════════
   CARD
══════════════════════════════════════ */
.card {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.card-head {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.card-head h3 { font-size: .83rem; font-weight: 700; color: var(--text); }

/* ══════════════════════════════════════
   CLIENTS TABLE
══════════════════════════════════════ */
.table-card { margin-bottom: 0; }

.table-toolbar {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.search-wrap {
  display: flex; align-items: center; gap: 8px;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: 8px; padding: 0 12px;
  flex: 1; min-width: 180px; max-width: 280px;
}
.search-icon { color: var(--muted); font-size: .85rem; }
.search-input {
  background: none; border: none; outline: none;
  font-size: .82rem; color: var(--text); padding: 8px 0; width: 100%;
}
.search-input::placeholder { color: var(--muted); }
.filters { display: flex; gap: 8px; align-items: center; }
.filter-select {
  background: var(--bg); border: 1px solid var(--border);
  border-radius: 8px; font-size: .78rem; color: var(--slate);
  padding: 7px 10px; cursor: pointer; outline: none;
}
.btn-clear-filters {
  background: none; border: 1px solid var(--border); color: var(--slate);
  font-size: .74rem; padding: 6px 12px; border-radius: 7px; cursor: pointer;
  transition: background .12s;
}
.btn-clear-filters:hover { background: var(--bg); }

.clients-table { width: 100%; border-collapse: collapse; }
.clients-table thead tr { background: var(--bg); }
.clients-table th {
  padding: 10px 16px;
  font-size: .68rem; font-weight: 700; color: var(--muted);
  text-transform: uppercase; letter-spacing: .5px;
  border-bottom: 1px solid var(--border); text-align: left; white-space: nowrap;
}
.clients-table td { padding: 13px 16px; border-bottom: 1px solid #f8fafc; vertical-align: middle; }
.clients-table tbody tr:hover { background: #fafbff; cursor: pointer; }
.clients-table tbody tr:last-child td { border-bottom: none; }
.empty-td { text-align: center; padding: 32px; color: var(--muted); font-size: .82rem; }

.client-cell { display: flex; align-items: center; gap: 11px; }
.client-name { font-weight: 600; font-size: .85rem; color: var(--text); }
.client-sub  { font-size: .72rem; color: var(--muted); margin-top: 1px; }
.contact-cell  { font-size: .8rem; color: var(--slate); }
.contact-phone { font-size: .72rem; color: var(--muted); margin-top: 1px; }

.stage-badge {
  display: inline-flex; align-items: center;
  padding: 3px 9px; border-radius: 20px;
  font-size: .68rem; font-weight: 700; white-space: nowrap;
}
.score-chip { display: flex; flex-direction: column; gap: 1px; }
.score-chip-num { font-size: .9rem; font-weight: 800; line-height: 1; }
.score-chip-label { font-size: .62rem; font-weight: 600; opacity: .8; }
.score-pill {
  font-size: .75rem; font-weight: 700;
  padding: 2px 8px; border-radius: 20px;
  background: currentColor;
  color: inherit !important;
}

.actions-cell { display: flex; gap: 4px; align-items: center; }
.btn-icon-action {
  width: 28px; height: 28px; border-radius: 7px; border: 1px solid var(--border);
  background: var(--surface); color: var(--slate); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all .12s;
}
.btn-icon-action:hover { background: var(--bg); border-color: #cbd5e1; color: var(--text); }
.btn-icon-action.danger:hover { background: #fef2f2; border-color: #fecaca; color: #ef4444; }

.table-footer {
  padding: 12px 18px; font-size: .73rem; color: var(--muted);
  border-top: 1px solid var(--border); background: var(--bg);
}

/* ══════════════════════════════════════
   AVATAR
══════════════════════════════════════ */
.avatar {
  width: 36px; height: 36px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: .78rem; font-weight: 700; flex-shrink: 0;
}

/* ══════════════════════════════════════
   BADGES / WORK TYPES
══════════════════════════════════════ */
.wt-badge {
  font-size: .6rem; font-weight: 700;
  padding: 2px 7px; border-radius: 20px; white-space: nowrap;
}
.task-overdue-badge { background: #fef2f2; color: #dc2626; font-size: .67rem; font-weight: 700; padding: 2px 8px; border-radius: 20px; white-space: nowrap; }
.task-today-badge  { background: #eff6ff; color: #3b82f6; font-size: .67rem; font-weight: 700; padding: 2px 8px; border-radius: 20px; white-space: nowrap; }
.task-soon-badge   { background: #fffbeb; color: #d97706; font-size: .67rem; font-weight: 700; padding: 2px 8px; border-radius: 20px; white-space: nowrap; }
.task-wait-badge   { background: #f8fafc; color: var(--slate); font-size: .67rem; font-weight: 700; padding: 2px 8px; border-radius: 20px; white-space: nowrap; }

/* ══════════════════════════════════════
   PIPELINE
══════════════════════════════════════ */
.pipeline-tabs {
  display: flex; gap: 6px; flex-wrap: wrap;
  margin-bottom: 18px; flex-shrink: 0;
}
.pipeline-tab {
  display: flex; align-items: center; gap: 6px;
  padding: 7px 14px; border-radius: 8px;
  border: 1.5px solid var(--border); background: var(--surface);
  font-size: .77rem; font-weight: 600; color: var(--slate);
  cursor: pointer; transition: all .12s;
}
.pipeline-tab:hover { border-color: #94a3b8; color: var(--text); }
.pipeline-tab.active { background: var(--tab-color,var(--blue)); border-color: var(--tab-color,var(--blue)); color: #fff; }
.pipeline-tab .tab-count { background: rgba(255,255,255,.25); font-size: .62rem; font-weight: 700; padding: 1px 6px; border-radius: 10px; min-width: 18px; text-align: center; }
.pipeline-tab:not(.active) .tab-count { background: #f1f5f9; color: var(--slate); }

.pipeline-list { display: flex; flex-direction: column; gap: 7px; }
.pipeline-row {
  display: flex; align-items: center; gap: 13px;
  background: var(--surface); border-radius: var(--radius);
  padding: 13px 16px; border: 1px solid var(--border);
  cursor: pointer; transition: box-shadow .12s, border-color .12s;
}
.pipeline-row:hover { box-shadow: var(--shadow-md); border-color: #cbd5e1; }
.pr-info { flex: 1; min-width: 0; }
.pr-name { font-weight: 600; font-size: .85rem; color: var(--text); }
.pr-sub  { font-size: .73rem; color: var(--muted); margin-top: 1px; }
.pr-types { display: flex; flex-wrap: wrap; gap: 4px; }
.pr-score { font-size: .85rem; font-weight: 800; white-space: nowrap; }
.pl-empty { text-align: center; color: var(--muted); font-size: .8rem; padding: 40px 0; font-style: italic; }

/* ══════════════════════════════════════
   DASHBOARD
══════════════════════════════════════ */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.db-row {
  display: flex; align-items: center; gap: 11px;
  padding: 11px 16px; cursor: pointer;
  border-bottom: 1px solid #f8fafc; transition: background .1s;
}
.db-row:hover { background: #fafbff; }
.db-row:last-child { border-bottom: none; }
.db-row-info { flex: 1; min-width: 0; }
.db-row-name { font-size: .82rem; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.db-row-sub  { font-size: .71rem; color: var(--muted); margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.empty-list  { padding: 20px 16px; color: var(--muted); font-size: .8rem; text-align: center; }

/* ══════════════════════════════════════
   CLIENT DETAIL — BREADCRUMB & HERO
══════════════════════════════════════ */
.detail-breadcrumb {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 18px; flex-shrink: 0;
}
.breadcrumb-back {
  display: flex; align-items: center; gap: 4px;
  background: none; border: none; color: var(--slate);
  font-size: .8rem; font-weight: 600; cursor: pointer;
  padding: 5px 10px; border-radius: 7px; transition: background .12s;
}
.breadcrumb-back:hover { background: var(--border); color: var(--text); }
.breadcrumb-sep { color: var(--muted); font-size: .8rem; }
.breadcrumb-current { font-size: .8rem; font-weight: 600; color: var(--text); }

.detail-hero {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 22px 24px;
  display: flex; align-items: flex-start; gap: 20px;
  margin-bottom: 18px; flex-shrink: 0;
  box-shadow: var(--shadow);
}
.detail-hero-left { display: flex; gap: 18px; flex: 1; min-width: 0; }
.detail-avatar-xl {
  width: 56px; height: 56px; border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem; font-weight: 800; flex-shrink: 0;
}
.detail-hero-info { flex: 1; min-width: 0; }
.detail-name-row { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.detail-name { font-size: 1.2rem; font-weight: 800; color: var(--text); cursor: pointer; }
.detail-name:hover { text-decoration: underline; text-decoration-color: var(--muted); }
.btn-edit-inline {
  background: none; border: none; color: var(--muted); cursor: pointer;
  font-size: .85rem; padding: 2px 5px; border-radius: 5px; transition: all .1s;
}
.btn-edit-inline:hover { background: var(--bg); color: var(--blue); }
.detail-meta-row { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin-bottom: 8px; }
.detail-contact-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.contact-chip {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: .73rem; color: var(--slate); background: var(--bg);
  border: 1px solid var(--border); border-radius: 20px; padding: 3px 10px;
}
.contact-chip.editable { cursor: pointer; }
.contact-chip.editable:hover { border-color: var(--blue); color: var(--blue); background: #eff6ff; }
.contact-chip.add { color: var(--blue); border-style: dashed; cursor: pointer; }
.contact-chip.add:hover { background: #eff6ff; }

.detail-hero-right { display: flex; flex-direction: column; align-items: flex-end; gap: 12px; flex-shrink: 0; }
.hero-score-block { text-align: center; }
.hero-score-num   { font-size: 2.2rem; font-weight: 900; line-height: 1; }
.hero-score-label { font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; margin-top: 2px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 7px; justify-content: flex-end; }
.stage-select-hero {
  background: var(--bg); border: 1px solid var(--border);
  border-radius: 8px; font-size: .78rem; color: var(--slate);
  padding: 6px 10px; cursor: pointer; outline: none;
}
.followup-input {
  background: var(--bg); border: 1px solid var(--border);
  border-radius: 8px; font-size: .78rem; color: var(--slate);
  padding: 6px 10px; cursor: pointer; outline: none;
}
.followup-input-sm {
  background: var(--bg); border: 1px solid var(--border);
  border-radius: 7px; font-size: .78rem; color: var(--slate);
  padding: 5px 8px; cursor: pointer; outline: none; width: 100%;
}
.btn-hero-action {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 6px 13px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--surface); color: var(--slate); font-size: .76rem;
  font-weight: 600; cursor: pointer; transition: all .12s;
}
.btn-hero-action:hover { background: var(--bg); border-color: #cbd5e1; color: var(--text); }
.btn-hero-action.primary { background: var(--blue); border-color: var(--blue); color: #fff; }
.btn-hero-action.primary:hover { background: #2563eb; }
.btn-hero-action.danger:hover { background: #fef2f2; border-color: #fecaca; color: #dc2626; }

/* ══════════════════════════════════════
   DETAIL TABS
══════════════════════════════════════ */
.detail-tabs-bar {
  display: flex; gap: 0; border-bottom: 2px solid var(--border);
  margin-bottom: 20px; flex-shrink: 0; overflow-x: auto;
  scrollbar-width: none;
}
.detail-tabs-bar::-webkit-scrollbar { display: none; }
.detail-tab {
  padding: 10px 16px; background: none; border: none;
  font-size: .8rem; font-weight: 600; color: var(--muted);
  cursor: pointer; border-bottom: 2px solid transparent;
  margin-bottom: -2px; white-space: nowrap; transition: all .12s;
  display: flex; align-items: center; gap: 5px;
}
.detail-tab:hover { color: var(--text); }
.detail-tab.active { color: var(--blue); border-bottom-color: var(--blue); }
.tab-badge {
  background: var(--blue); color: #fff; font-size: .6rem; font-weight: 700;
  padding: 1px 5px; border-radius: 10px; min-width: 16px; text-align: center;
}
.tab-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--amber); display: none; }

/* ══════════════════════════════════════
   DETAIL CARDS
══════════════════════════════════════ */
.tab-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.tg-col { display: flex; flex-direction: column; gap: 16px; }

.detail-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.dc-head {
  padding: 13px 18px;
  font-size: .8rem; font-weight: 700; color: var(--text);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.dc-action {
  background: none; border: none; color: var(--blue);
  font-size: .73rem; font-weight: 600; cursor: pointer;
  padding: 2px 0;
}
.dc-action:hover { text-decoration: underline; }
.dc-badge {
  background: var(--blue); color: #fff;
  font-size: .62rem; font-weight: 700;
  padding: 1px 7px; border-radius: 10px; margin-left: 4px;
}
.dc-body { padding: 16px 18px; }
.dc-section-title { font-size: .95rem; font-weight: 700; color: var(--text); }
.dc-section-sub   { font-size: .75rem; color: var(--muted); margin-top: 2px; }
.dc-toolbar {
  display: flex; align-items: flex-start; justify-content: space-between;
  margin-bottom: 16px; gap: 12px;
}

/* ══════════════════════════════════════
   BUREAU SCORES
══════════════════════════════════════ */
.bureau-row { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }
.bureau-card {
  display: flex; flex-direction: column; align-items: center;
  padding: 16px 10px; background: var(--bg); border-radius: 10px;
  border: 1px solid var(--border); gap: 6px;
}
.bureau-name { font-size: .7rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; }
.bureau-label { font-size: .68rem; font-weight: 700; }
.btn-edit-score {
  background: none; border: 1px solid var(--border); color: var(--muted);
  font-size: .65rem; padding: 3px 8px; border-radius: 6px; cursor: pointer;
  margin-top: 2px; transition: all .12s;
}
.btn-edit-score:hover { border-color: var(--blue); color: var(--blue); background: #eff6ff; }

/* Score Ring */
.bureau-score-ring { position: relative; width: 62px; height: 62px; }
.ring-svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring-bg   { fill: none; stroke: #e2e8f0; stroke-width: 3.5; }
.ring-fill { fill: none; stroke-width: 3.5; stroke-linecap: round; transition: stroke-dasharray .5s ease; }
.ring-num {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: .82rem; font-weight: 800; line-height: 1;
}

/* ══════════════════════════════════════
   PROGRESS TRACK
══════════════════════════════════════ */
.progress-track {
  display: flex; align-items: center;
  gap: 0; overflow-x: auto; padding: 4px 0;
  scrollbar-width: none;
}
.progress-track::-webkit-scrollbar { display: none; }
.pt-step {
  display: flex; flex-direction: column; align-items: center;
  gap: 6px; flex: 1; min-width: 60px; position: relative;
}
.pt-step::after {
  content: ''; position: absolute;
  top: 11px; left: calc(50% + 11px); right: calc(-50% + 11px);
  height: 2px; background: #e2e8f0;
}
.pt-step:last-child::after { display: none; }
.pt-step.done::after { background: #10b981; }
.pt-dot {
  width: 22px; height: 22px; border-radius: 50%;
  background: #e2e8f0; color: #9ca3af;
  font-size: .62rem; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  z-index: 1; transition: all .2s;
}
.pt-step.done .pt-dot   { background: #10b981; color: #fff; }
.pt-step.current .pt-dot { background: var(--blue); color: #fff; box-shadow: 0 0 0 4px #eff6ff; }
.pt-label { font-size: .62rem; font-weight: 600; color: var(--muted); text-align: center; white-space: nowrap; }
.pt-step.done .pt-label    { color: #10b981; }
.pt-step.current .pt-label { color: var(--blue); font-weight: 700; }

/* ══════════════════════════════════════
   INFO GRID
══════════════════════════════════════ */
.info-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.ig-field { display: flex; flex-direction: column; gap: 4px; }
.ig-label { font-size: .68rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; }
.ig-val   { font-size: .85rem; font-weight: 600; color: var(--text); }
.ig-val.editable { cursor: pointer; text-decoration: underline; text-decoration-style: dotted; text-underline-offset: 3px; }
.ig-val.editable:hover { color: var(--blue); }
.ig-empty { color: var(--muted); font-weight: 400; font-style: italic; font-size: .8rem; }
.work-types-row { display: flex; flex-wrap: wrap; gap: 5px; }

/* ══════════════════════════════════════
   INLINE EDIT INPUT
══════════════════════════════════════ */
.inline-edit-input {
  background: var(--bg); border: 1.5px solid var(--blue);
  border-radius: 7px; font-size: inherit; font-weight: inherit;
  color: var(--text); padding: 3px 8px; outline: none;
  width: 100%; max-width: 300px;
}

/* ══════════════════════════════════════
   TASKS
══════════════════════════════════════ */
.task-row {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 0; border-bottom: 1px solid #f8fafc;
}
.task-row:last-child { border-bottom: none; }
.task-check {
  width: 20px; height: 20px; border-radius: 50%;
  border: 2px solid #e2e8f0; background: none;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  font-size: .6rem; color: #fff; flex-shrink: 0; transition: all .12s;
}
.task-check:hover   { border-color: var(--blue); }
.task-check.done    { background: var(--green); border-color: var(--green); }
.task-row-info { flex: 1; min-width: 0; }
.task-row-title { font-size: .82rem; font-weight: 500; color: var(--text); }
.task-row-title.done { text-decoration: line-through; color: var(--muted); }
.task-row-due   { font-size: .7rem; color: var(--muted); margin-top: 1px; }
.task-row-due.ov { color: #dc2626; font-weight: 600; }
.btn-del-task {
  background: none; border: none; color: #d1d5db; cursor: pointer;
  font-size: 1.1rem; line-height: 1; padding: 0 4px; flex-shrink: 0;
  transition: color .1s;
}
.btn-del-task:hover { color: #ef4444; }
.quick-add-row { display: flex; gap: 7px; margin-top: 10px; }
.quick-add-input {
  flex: 1; background: var(--bg); border: 1px solid var(--border);
  border-radius: 8px; font-size: .8rem; color: var(--text);
  padding: 7px 12px; outline: none;
}
.quick-add-input:focus { border-color: var(--blue); }
.btn-quick-add {
  background: var(--blue); color: #fff; border: none;
  border-radius: 8px; padding: 0 14px; font-size: .9rem;
  cursor: pointer; font-weight: 700;
}

/* ══════════════════════════════════════
   NOTES
══════════════════════════════════════ */
.notes-textarea {
  width: 100%; border: 1px solid var(--border);
  border-radius: 9px; font-size: .82rem; color: var(--text);
  padding: 11px 13px; resize: vertical; outline: none;
  font-family: inherit; line-height: 1.6; min-height: 100px;
  background: var(--bg); transition: border-color .12s;
}
.notes-textarea:focus { border-color: var(--blue); background: var(--surface); }
.notes-textarea.tall  { min-height: 200px; }
.btn-save-notes {
  margin-top: 10px; background: var(--blue); color: #fff; border: none;
  border-radius: 8px; padding: 8px 18px; font-size: .8rem;
  font-weight: 600; cursor: pointer; transition: background .12s;
}
.btn-save-notes:hover { background: #2563eb; }

/* ══════════════════════════════════════
   DISPUTES
══════════════════════════════════════ */
.btn-add-dispute {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--blue); color: #fff; border: none;
  border-radius: 8px; padding: 8px 16px; font-size: .78rem;
  font-weight: 600; cursor: pointer; transition: background .12s; white-space: nowrap;
}
.btn-add-dispute:hover { background: #2563eb; }

.dispute-stats-row {
  display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 16px;
}
.ds-stat {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; padding: 10px 16px; text-align: center;
  min-width: 70px;
}
.ds-stat.success { background: #ecfdf5; border-color: #a7f3d0; }
.ds-stat.active  { background: #eff6ff; border-color: #bfdbfe; }
.ds-stat.exp { background: #fef3c7; border-color: #fde68a; }
.ds-stat.eq  { background: #f5f3ff; border-color: #ddd6fe; }
.ds-stat.tu  { background: #ecfdf5; border-color: #a7f3d0; }
.ds-num   { font-size: 1.3rem; font-weight: 800; color: var(--text); line-height: 1; }
.ds-label { font-size: .62rem; color: var(--muted); font-weight: 600; text-transform: uppercase; margin-top: 2px; }

.disputes-table { border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.dt-head {
  display: grid;
  grid-template-columns: 1.8fr 1.2fr 1fr .8fr .7fr 1.2fr .9fr 36px;
  gap: 0; padding: 9px 14px;
  background: var(--bg); font-size: .65rem; font-weight: 700;
  color: var(--muted); text-transform: uppercase; letter-spacing: .4px;
  border-bottom: 1px solid var(--border);
}
.dt-row {
  display: grid;
  grid-template-columns: 1.8fr 1.2fr 1fr .8fr .7fr 1.2fr .9fr 36px;
  align-items: center; gap: 0;
  padding: 10px 14px; border-bottom: 1px solid #f8fafc;
  font-size: .79rem; transition: background .1s;
}
.dt-row:last-child { border-bottom: none; }
.dt-row:hover { background: #fafbff; }
.dt-creditor { font-weight: 600; color: var(--text); }
.dt-type     { color: var(--slate); font-size: .75rem; }
.dt-bureaus  { display: flex; gap: 3px; flex-wrap: wrap; }
.dt-amount   { font-weight: 600; color: var(--text); }
.dt-round    { color: var(--muted); font-size: .73rem; }
.dt-due      { color: var(--muted); font-size: .73rem; }
.dt-due.ov   { color: #dc2626; font-weight: 600; }
.dt-actions  { display: flex; justify-content: center; }

.bureau-tag {
  font-size: .58rem; font-weight: 800; padding: 1px 5px; border-radius: 4px;
  text-transform: uppercase; letter-spacing: .3px;
}
.bureau-tag.experian  { background: #fef3c7; color: #92400e; }
.bureau-tag.equifax   { background: #f5f3ff; color: #6d28d9; }
.bureau-tag.transunion{ background: #ecfdf5; color: #065f46; }

.status-select-inline {
  border: none; border-radius: 6px; font-size: .72rem; font-weight: 700;
  padding: 3px 7px; cursor: pointer; outline: none; appearance: none;
  -webkit-appearance: none;
}

.btn-del-inline {
  background: none; border: none; color: #d1d5db; cursor: pointer;
  font-size: 1.1rem; line-height: 1; padding: 2px 6px;
  border-radius: 5px; transition: all .1s;
}
.btn-del-inline:hover { color: #ef4444; background: #fef2f2; }

/* ══════════════════════════════════════
   INLINE FORM
══════════════════════════════════════ */
.inline-form {
  background: var(--surface); border: 1.5px solid var(--blue);
  border-radius: var(--radius); padding: 18px 20px;
  margin-top: 14px; box-shadow: 0 4px 20px rgba(59,130,246,.1);
}
.inline-form-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 14px;
}
.inline-form-head h4 { font-size: .88rem; font-weight: 700; color: var(--text); }
.inline-form-head button { background: none; border: none; color: var(--muted); font-size: 1.2rem; cursor: pointer; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; margin-bottom: 12px; }
.form-field { display: flex; flex-direction: column; gap: 4px; }
.form-field label { font-size: .7rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .3px; }
.form-field input, .form-field select {
  background: var(--bg); border: 1px solid var(--border);
  border-radius: 8px; font-size: .82rem; color: var(--text);
  padding: 7px 10px; outline: none; transition: border-color .12s;
}
.form-field input:focus, .form-field select:focus { border-color: var(--blue); }
.bureau-checks { display: flex; flex-direction: column; gap: 5px; padding: 5px 0; }
.bureau-checks label { display: flex; align-items: center; gap: 6px; font-size: .78rem; color: var(--slate); font-weight: 500; cursor: pointer; }
.form-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 4px; }
.btn-cancel-form {
  background: var(--bg); border: 1px solid var(--border); color: var(--slate);
  font-size: .78rem; font-weight: 600; padding: 7px 16px; border-radius: 8px; cursor: pointer;
}
.btn-submit-form {
  background: var(--blue); color: #fff; border: none;
  font-size: .78rem; font-weight: 600; padding: 7px 18px; border-radius: 8px; cursor: pointer;
}
.btn-submit-form:hover { background: #2563eb; }

/* ══════════════════════════════════════
   SCORE HISTORY TABLE
══════════════════════════════════════ */
.sh-table { width: 100%; border-collapse: collapse; font-size: .8rem; }
.sh-table th { padding: 7px 10px; font-size: .65rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; border-bottom: 1px solid var(--border); text-align: left; }
.sh-table td { padding: 9px 10px; border-bottom: 1px solid #f8fafc; }
.sh-table tr:last-child td { border-bottom: none; }
.sh-table tr:hover td { background: #fafbff; }

/* ══════════════════════════════════════
   PAYMENTS
══════════════════════════════════════ */
.payments-summary-row {
  display: grid; grid-template-columns: repeat(3,1fr); gap: 12px; margin-bottom: 16px;
}
/* Financial summary in Resumen tab */
.fin-row { display:grid; grid-template-columns:repeat(3,1fr); gap:8px; margin-bottom:10px; }
.fin-item { background:var(--surface); border:1px solid var(--border); border-radius:8px; padding:10px 12px; }
.fin-item.paid { background:#ecfdf5; border-color:#a7f3d0; }
.fin-item.owed { background:#fef2f2; border-color:#fecaca; }
.fin-label { font-size:.65rem; font-weight:700; color:var(--muted); text-transform:uppercase; letter-spacing:.4px; }
.fin-val   { font-size:1.1rem; font-weight:800; color:var(--text); margin-top:3px; }
.fin-progress-bar { height:6px; background:var(--border); border-radius:3px; overflow:hidden; margin-bottom:4px; }
.fin-progress-fill { height:100%; background:var(--green); border-radius:3px; transition:width .4s; }
.fin-pct { font-size:.72rem; color:var(--muted); text-align:right; }

.pay-summary-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; padding: 14px 18px; text-align: center;
}
.pay-summary-card.paid { background: #ecfdf5; border-color: #a7f3d0; }
.pay-summary-card.owed { background: #fef2f2; border-color: #fecaca; }
.ps-label { font-size: .67rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; }
.ps-val   { font-size: 1.3rem; font-weight: 800; color: var(--text); margin-top: 4px; }

.payments-table { border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.pt-head {
  display: grid; grid-template-columns: 1fr 1.2fr 1fr 1fr 1.5fr 36px;
  padding: 9px 14px; background: var(--bg);
  font-size: .65rem; font-weight: 700; color: var(--muted);
  text-transform: uppercase; letter-spacing: .4px; border-bottom: 1px solid var(--border);
}
.pt-row {
  display: grid; grid-template-columns: 1fr 1.2fr 1fr 1fr 1.5fr 36px;
  align-items: center; padding: 11px 14px; border-bottom: 1px solid #f8fafc;
  font-size: .8rem; transition: background .1s;
}
.pt-row:last-child { border-bottom: none; }
.pt-row:hover { background: #fafbff; }
.method-badge {
  display: inline-block; background: #f1f5f9; color: var(--slate);
  font-size: .67rem; font-weight: 700; padding: 2px 8px; border-radius: 20px;
}
.pay-amount { font-weight: 700; color: #059669; }

/* ══════════════════════════════════════
   PORTALS
══════════════════════════════════════ */
.portal-item {
  background: var(--bg); border: 1px solid var(--border);
  border-radius: 10px; padding: 13px 16px; margin-bottom: 10px;
}
.portal-item:last-child { margin-bottom: 0; }
.portal-name { font-size: .8rem; font-weight: 700; color: var(--text); margin-bottom: 8px; }
.portal-field { display: flex; align-items: center; gap: 8px; margin-bottom: 5px; }
.portal-field:last-child { margin-bottom: 0; }
.portal-field-label { font-size: .68rem; font-weight: 700; color: var(--muted); min-width: 72px; text-transform: uppercase; }
.portal-field-val   { font-size: .8rem; color: var(--slate); }
.portal-pw-wrap { display: flex; align-items: center; gap: 5px; flex: 1; }
.portal-pw-input {
  background: var(--bg); border: 1px solid var(--border); border-radius: 7px;
  font-size: .8rem; color: var(--text); padding: 4px 9px; outline: none; flex: 1;
}
.btn-eye {
  background: none; border: 1px solid var(--border); border-radius: 7px;
  padding: 3px 7px; cursor: pointer; font-size: .85rem;
}

/* ══════════════════════════════════════
   DOCUMENTS
══════════════════════════════════════ */
.doc-row {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 0; border-bottom: 1px solid #f8fafc;
}
.doc-icon-wrap { font-size: 1.5rem; }
.doc-info { flex: 1; }
.doc-name { font-size: .83rem; font-weight: 600; color: var(--text); }
.doc-sub  { font-size: .72rem; color: var(--muted); margin-top: 2px; }
.btn-analyze-doc {
  background: var(--blue); color: #fff; border: none;
  border-radius: 7px; padding: 5px 13px; font-size: .75rem;
  font-weight: 600; cursor: pointer;
}
.doc-analyzed { color: #10b981; font-size: .75rem; font-weight: 700; }
.btn-empty-action {
  display: inline-flex; align-items: center; gap: 5px;
  background: var(--bg); border: 1.5px dashed #cbd5e1; color: var(--slate);
  border-radius: 8px; padding: 8px 16px; font-size: .78rem;
  font-weight: 600; cursor: pointer; transition: all .12s; margin-top: 8px;
}
.btn-empty-action:hover { border-color: var(--blue); color: var(--blue); background: #eff6ff; }

/* Document upload slot (reporte) */
.doc-upload-slot {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 6px; padding: 24px; border: 2px dashed #cbd5e1; border-radius: 10px;
  cursor: pointer; transition: all .15s; text-align: center;
}
.doc-upload-slot:hover { border-color: var(--blue); background: #eff6ff; }
.dus-icon  { font-size: 1.6rem; }
.dus-label { font-size: .82rem; font-weight: 700; color: var(--text); }
.dus-sub   { font-size: .72rem; color: var(--muted); }

/* Required identity doc slots */
.doc-slots-grid { display: flex; flex-direction: column; gap: 0; }
.doc-slot {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 0; border-bottom: 1px solid var(--border);
}
.doc-slot:last-child { border-bottom: none; }
.doc-slot-icon  { font-size: 1.6rem; flex-shrink: 0; }
.doc-slot-info  { flex: 1; min-width: 0; }
.doc-slot-label { font-size: .82rem; font-weight: 700; color: var(--text); }
.doc-slot-sub   { font-size: .71rem; color: var(--muted); margin-top: 2px; }
.doc-slot-status { margin-top: 5px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.doc-pending-chip {
  font-size: .65rem; font-weight: 700; background: #fef3c7; color: #92400e;
  border-radius: 20px; padding: 2px 8px;
}
.doc-uploaded-chip {
  font-size: .65rem; font-weight: 700; background: #d1fae5; color: #065f46;
  border-radius: 20px; padding: 2px 8px;
}
.doc-file-name { font-size: .7rem; color: var(--muted); }
.btn-del-doc {
  background: none; border: none; color: #ef4444; cursor: pointer;
  font-size: .85rem; padding: 0 3px; line-height: 1;
}
.btn-doc-upload {
  display: inline-flex; align-items: center; gap: 4px;
  background: var(--blue); color: #fff; border: none; border-radius: 7px;
  padding: 6px 12px; font-size: .73rem; font-weight: 600; cursor: pointer;
  white-space: nowrap; flex-shrink: 0;
}
.btn-doc-upload:hover { background: #2563eb; }

/* Required docs badge */
.doc-req-badge {
  font-size: .68rem; font-weight: 700; color: var(--amber);
  background: #fef3c7; border-radius: 20px; padding: 2px 9px;
}
.doc-req-badge.ok { color: #065f46; background: #d1fae5; }

/* ══════════════════════════════════════
   ANALYSIS
══════════════════════════════════════ */
.analysis-summary {
  font-size: .82rem; color: var(--slate); line-height: 1.6;
  background: #f8fafc; border-radius: 8px; padding: 11px 14px;
  border-left: 3px solid var(--blue); margin-bottom: 14px;
}
.analysis-block { margin-bottom: 14px; }
.analysis-block h4 { font-size: .72rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; margin-bottom: 7px; }
.analysis-list { list-style: none; display: flex; flex-direction: column; gap: 5px; }
.analysis-list li { font-size: .8rem; color: var(--slate); display: flex; align-items: flex-start; gap: 8px; }
.analysis-list.actions li::before { content: '→'; color: var(--blue); flex-shrink: 0; }
.priority-tag {
  font-size: .62rem; font-weight: 700; padding: 1px 6px; border-radius: 4px; flex-shrink: 0;
}

/* ══════════════════════════════════════
   TODAY / TASKS VIEW
══════════════════════════════════════ */
.today-group { margin-bottom: 20px; }
.today-group-label {
  font-size: .7rem; font-weight: 800; text-transform: uppercase;
  letter-spacing: .6px; margin-bottom: 8px;
  display: flex; align-items: center; gap: 7px;
}
.tg-count { font-size: .65rem; font-weight: 700; background: currentColor; color: inherit; border-radius: 20px; }
.label-urgent  { color: #dc2626; }
.label-today   { color: var(--blue); }
.label-soon    { color: #d97706; }
.label-waiting { color: var(--slate); }
.tg-count { background: none !important; border: 1.5px solid currentColor; padding: 0px 6px; }

.today-task {
  display: flex; align-items: center; gap: 12px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; padding: 12px 14px;
  margin-bottom: 6px; cursor: pointer; transition: all .12s;
}
.today-task:hover { box-shadow: var(--shadow-md); border-color: #cbd5e1; }
.today-task.urgent { border-left: 3px solid #ef4444; }
.today-task.today  { border-left: 3px solid var(--blue); }
.today-task.soon   { border-left: 3px solid #f59e0b; }
.tt-title { font-size: .83rem; font-weight: 600; color: var(--text); }
.tt-case  { font-size: .72rem; color: var(--muted); margin-top: 2px; }
.today-empty { text-align: center; padding: 48px 20px; color: var(--muted); font-size: .88rem; }

/* ══════════════════════════════════════
   EMPTY STATES
══════════════════════════════════════ */
.empty-state {
  display: flex; flex-direction: column; align-items: center;
  padding: 36px 20px; text-align: center; gap: 6px;
}
.empty-icon { font-size: 2rem; opacity: .5; }
.empty-text { font-size: .85rem; font-weight: 600; color: var(--slate); }
.empty-sub  { font-size: .75rem; color: var(--muted); }
.empty-state-sm { color: var(--muted); font-size: .78rem; font-style: italic; text-align: center; padding: 12px 0; }
.loading-pulse { color: var(--muted); font-size: .78rem; padding: 20px 0; text-align: center; animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 0%,100%{opacity:.5} 50%{opacity:1} }

/* ══════════════════════════════════════
   MODAL
══════════════════════════════════════ */
#modal-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,.45); z-index: 1000;
  align-items: center; justify-content: center;
  backdrop-filter: blur(3px);
}
#modal-overlay.open { display: flex; }
#modal {
  background: var(--surface); border-radius: 16px;
  padding: 28px 28px 24px; width: 400px; max-width: 92vw;
  box-shadow: 0 20px 60px rgba(0,0,0,.2);
}
#modal h2 { font-size: 1.05rem; font-weight: 800; color: var(--text); margin-bottom: 20px; }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: .72rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; margin-bottom: 5px; }
.field input {
  width: 100%; background: var(--bg); border: 1.5px solid var(--border);
  border-radius: 9px; font-size: .85rem; color: var(--text);
  padding: 9px 12px; outline: none; transition: border-color .12s;
}
.field input:focus { border-color: var(--blue); }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; }
.btn-cancel {
  background: var(--bg); border: 1.5px solid var(--border); color: var(--slate);
  font-size: .82rem; font-weight: 600; padding: 8px 18px; border-radius: 9px; cursor: pointer;
}

/* ══════════════════════════════════════
   TOAST
══════════════════════════════════════ */
#toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(16px);
  background: #0f172a; color: #f1f5f9;
  padding: 10px 20px; border-radius: 10px; font-size: .82rem; font-weight: 600;
  z-index: 9999; opacity: 0; transition: all .25s; white-space: nowrap;
  box-shadow: 0 4px 20px rgba(0,0,0,.25); pointer-events: none;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ══════════════════════════════════════
   DUE DATE ALERT BADGES
══════════════════════════════════════ */
.due-badge {
  display: inline-flex; align-items: center;
  font-size: .58rem; font-weight: 800; border-radius: 20px;
  padding: 1px 6px; margin-left: 6px; vertical-align: middle;
  letter-spacing: .3px;
}
.due-badge.overdue { background: #fee2e2; color: #dc2626; }
.due-badge.urgent  { background: #fef3c7; color: #b45309; }
.due-badge.warning { background: #eff6ff; color: #2563eb; }

/* ══════════════════════════════════════
   LETTERS
══════════════════════════════════════ */
.letter-row {
  border: 1px solid var(--border); border-radius: 10px;
  padding: 14px; margin-bottom: 10px; background: var(--surface);
}
.letter-meta {
  display: flex; align-items: center; gap: 10px; margin-bottom: 6px;
}
.letter-type-badge {
  font-size: .65rem; font-weight: 800; background: #eff6ff; color: #2563eb;
  border-radius: 20px; padding: 2px 8px;
}
.letter-bureau {
  font-size: .72rem; font-weight: 600; color: var(--slate);
}
.letter-date { font-size: .7rem; color: var(--muted); margin-left: auto; }
.letter-preview {
  font-size: .75rem; color: var(--muted); line-height: 1.5; margin-bottom: 8px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.letter-actions { display: flex; gap: 6px; }
.letter-full {
  background: var(--bg); border: 1px solid var(--border); border-radius: 8px;
  padding: 14px; font-size: .76rem; line-height: 1.7; white-space: pre-wrap;
  word-break: break-word; font-family: 'Courier New', monospace; margin-top: 10px;
  max-height: 400px; overflow-y: auto;
}

/* ══════════════════════════════════════
   INQUIRIES
══════════════════════════════════════ */
.inq-summary {
  display: flex; gap: 14px; margin-bottom: 12px;
  padding-bottom: 12px; border-bottom: 1px solid var(--border);
}
.inq-stat { font-size: .75rem; color: var(--muted); }
.inq-stat strong { color: var(--text); }
.inq-stat.hard strong { color: var(--red); }
.inq-stat.removed strong { color: var(--green); }
.inq-row {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 0; border-bottom: 1px solid #f8fafc;
}
.inq-row:last-child { border-bottom: none; }
.inq-type-badge {
  font-size: .62rem; font-weight: 800; border-radius: 20px; padding: 2px 7px; flex-shrink: 0;
}
.inq-type-badge.hard { background: #fee2e2; color: #dc2626; }
.inq-type-badge.soft { background: #f0fdf4; color: #16a34a; }
.inq-info { flex: 1; min-width: 0; }
.inq-creditor { font-size: .81rem; font-weight: 600; color: var(--text); }
.inq-meta { font-size: .7rem; color: var(--muted); margin-top: 1px; }
.inq-status-sel {
  font-size: .72rem; border: 1px solid var(--border); border-radius: 7px;
  padding: 4px 7px; background: var(--bg); cursor: pointer; outline: none; flex-shrink: 0;
}

/* ══════════════════════════════════════
   ROI CARD
══════════════════════════════════════ */
.roi-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px;
}
.roi-stat {
  background: var(--bg); border-radius: 9px; border: 1px solid var(--border);
  padding: 10px 12px; text-align: center;
}
.roi-val   { font-size: 1.2rem; font-weight: 800; line-height: 1.2; }
.roi-label { font-size: .65rem; color: var(--muted); font-weight: 600; text-transform: uppercase; margin-top: 3px; }

/* ══════════════════════════════════════
   REFERRALS VIEW
══════════════════════════════════════ */
.form-label { display: block; font-size: .7rem; font-weight: 700; color: var(--muted); text-transform: uppercase; margin-bottom: 4px; }

/* ══════════════════════════════════════
   PANEL (legacy drawer, hidden)
══════════════════════════════════════ */
#panel { display: none; }

/* ══════════════════════════════════════
   PLACEHOLDER VIEWS
══════════════════════════════════════ */
.placeholder-view {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  flex: 1; gap: 10px; color: var(--muted);
}
.ph-icon { font-size: 2.5rem; opacity: .4; }
.placeholder-view h3 { font-size: 1rem; font-weight: 700; color: var(--slate); }
.placeholder-view p  { font-size: .82rem; }

/* ══════════════════════════════════════
   HAMBURGER BUTTON
══════════════════════════════════════ */
.topbar-left-group {
  display: flex; align-items: center; gap: 10px;
}
.btn-hamburger {
  display: none;
  flex-direction: column; justify-content: center; align-items: center;
  gap: 4px; width: 36px; height: 36px;
  background: none; border: 1px solid var(--border);
  border-radius: 8px; cursor: pointer; flex-shrink: 0;
  padding: 0;
}
.btn-hamburger span {
  display: block; width: 16px; height: 2px;
  background: var(--slate); border-radius: 2px; transition: all .2s;
}
#sidebar-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,.5); z-index: 99;
  backdrop-filter: blur(2px);
}
#sidebar-overlay.open { display: block; }

/* ══════════════════════════════════════
   RESPONSIVE — TABLET (≤1024px)
══════════════════════════════════════ */
@media (max-width: 1024px) {
  .tab-grid-2 { grid-template-columns: 1fr; }
  .dashboard-grid { grid-template-columns: 1fr; }
  .metrics-row { grid-template-columns: repeat(2,1fr); }
  .dt-head, .dt-row {
    grid-template-columns: 1.5fr 1fr 1fr .8fr 1.2fr 36px;
  }
  .dt-head span:nth-child(4),
  .dt-row  span:nth-child(4),
  .dt-head span:nth-child(5),
  .dt-row  span:nth-child(5) { display: none; }
}

/* ══════════════════════════════════════
   RESPONSIVE — MOBILE (≤768px)
══════════════════════════════════════ */
@media (max-width: 768px) {

  /* Sidebar: off-canvas */
  .sidebar {
    position: fixed; left: -260px; top: 0; bottom: 0;
    z-index: 100; transition: left .25s ease; width: 260px;
    box-shadow: none; height: 100vh; height: 100dvh;
  }
  .sidebar.open {
    left: 0;
    box-shadow: 4px 0 24px rgba(0,0,0,.4);
  }
  .btn-hamburger { display: flex; }

  /* Content full width — sidebar is position:fixed so body flex still works */
  .content-wrap {
    width: 100%;
    min-width: 0;
    height: 100vh;
    height: 100dvh;
  }

  /* Topbar */
  .topbar { padding: 0 14px; height: 50px; flex-shrink: 0; }
  .topbar-left { font-size: .87rem; }
  .btn-lang { display: none; }
  .btn-primary { padding: 7px 12px; font-size: .76rem; }

  /* Views container must fill remaining height */
  .views-container {
    height: calc(100vh - 50px);
    height: calc(100dvh - 50px);
    overflow: hidden;
  }

  /* View: fill container and scroll */
  .view {
    padding: 14px 14px 24px;
    -webkit-overflow-scrolling: touch;
    overflow-y: auto;
    overflow-x: hidden;
  }

  /* Page header */
  .page-header { margin-bottom: 14px; }
  .page-header h2 { font-size: 1.05rem; }

  /* Metrics 2 cols */
  .metrics-row { grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 14px; }
  .metric-card { padding: 11px 12px; gap: 9px; }
  .metric-icon { width: 32px; height: 32px; font-size: .9rem; }
  .metric-value { font-size: 1.25rem; }
  .metric-label { font-size: .65rem; }

  /* Table toolbar: stack search above filters */
  .table-toolbar {
    padding: 10px 12px;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }
  .search-wrap { max-width: 100%; min-width: 0; flex: none; width: 100%; }
  .filters { flex-wrap: wrap; gap: 6px; }
  .filter-select { flex: 1; min-width: 130px; font-size: .76rem; }
  .btn-clear-filters { font-size: .72rem; padding: 6px 10px; white-space: nowrap; }

  /* Clients table → card list */
  .clients-table thead { display: none; }
  .clients-table tbody tr {
    display: flex; flex-wrap: wrap; align-items: center;
    padding: 12px 12px; gap: 6px;
    border-bottom: 1px solid var(--border);
  }
  .clients-table tbody tr:hover { background: #fafbff; }
  .clients-table td { padding: 0; border: none; }
  .clients-table td:nth-child(1) { flex: 1; min-width: 0; }
  .clients-table td:nth-child(2) { display: none; }
  .clients-table td:nth-child(3) { order: 3; }
  .clients-table td:nth-child(4) { order: 2; margin-left: auto; }
  .clients-table td:nth-child(5) { display: none; }
  .clients-table td:nth-child(6) { order: 4; }
  .client-name { font-size: .82rem; }
  .client-sub  { font-size: .7rem; }

  /* Dashboard grid */
  .dashboard-grid { grid-template-columns: 1fr; gap: 12px; }

  /* Client detail hero — full column layout */
  .detail-hero {
    flex-direction: column; padding: 12px; gap: 10px;
    margin-bottom: 12px; border-radius: 10px;
  }
  .detail-hero-left { flex-direction: row; align-items: flex-start; width: 100%; min-width: 0; }
  .detail-hero-info { min-width: 0; flex: 1; }
  .detail-name-row { flex-wrap: wrap; gap: 4px; }
  .detail-name {
    font-size: .93rem; word-break: break-word;
    white-space: normal; max-width: 100%;
  }
  .detail-meta-row { flex-wrap: wrap; gap: 4px; }
  .detail-contact-chips { gap: 5px; }
  .contact-chip { font-size: .7rem; padding: 3px 8px; max-width: 100%; }
  .detail-avatar-xl { width: 42px; height: 42px; border-radius: 10px; font-size: .82rem; flex-shrink: 0; }

  /* Hero right: stacked column, full width */
  .detail-hero-right {
    flex-direction: column; align-items: stretch;
    width: 100%; gap: 8px; flex-shrink: 0;
  }
  .hero-score-block { display: flex; gap: 10px; align-items: baseline; }
  .hero-score-num  { font-size: 1.4rem; }
  .hero-actions {
    display: flex; flex-wrap: wrap; gap: 6px;
    justify-content: flex-start; width: 100%;
  }
  .stage-select-hero { flex: 1; min-width: 120px; max-width: 100%; font-size: .76rem; }
  .followup-input   { flex: 1; min-width: 120px; max-width: 100%; font-size: .76rem; }
  .btn-hero-action  { font-size: .73rem; padding: 5px 10px; }

  /* Tabs: scrollable, no shrink */
  .detail-tabs-bar {
    gap: 0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    flex-wrap: nowrap;
    padding-bottom: 0;
  }
  .detail-tab { padding: 8px 12px; font-size: .73rem; white-space: nowrap; }

  /* Grids */
  .tab-grid-2 { grid-template-columns: 1fr; }
  .bureau-row { grid-template-columns: 1fr 1fr 1fr; gap: 6px; }
  .bureau-card { padding: 10px 6px; }
  .bureau-score-ring { width: 50px; height: 50px; }
  .ring-num { font-size: .72rem; }
  .info-grid-2 { grid-template-columns: 1fr 1fr; }
  .form-row-3 { grid-template-columns: 1fr; }

  /* Disputes → stacked cards */
  .disputes-table { border: none; border-radius: 0; }
  .dt-head { display: none; }
  .dt-row {
    display: flex; flex-wrap: wrap; align-items: center;
    gap: 5px; padding: 11px 12px;
    border: 1px solid var(--border); border-radius: 10px;
    margin-bottom: 7px; background: var(--surface);
  }
  .dt-creditor { font-size: .84rem; font-weight: 700; width: 100%; }
  .dt-type     { font-size: .72rem; color: var(--muted); }
  .dt-bureaus  { margin-left: auto; }
  .dt-amount   { font-size: .79rem; }
  .dt-round    { display: none; }
  .dt-due      { font-size: .72rem; margin-left: auto; }
  .dt-status   { width: 100%; }
  .dt-actions  { margin-left: auto; }
  .status-select-inline { width: 100%; padding: 6px 10px; }

  /* dc-toolbar stack */
  .dc-toolbar { flex-direction: column; align-items: stretch; gap: 8px; }
  .dc-toolbar .btn-add-dispute { width: 100%; justify-content: center; }

  /* Dispute stats */
  .dispute-stats-row { gap: 6px; flex-wrap: wrap; }
  .ds-stat { padding: 8px 10px; min-width: 56px; }
  .ds-num  { font-size: 1.05rem; }

  /* Payments → stacked */
  .payments-summary-row { grid-template-columns: 1fr 1fr 1fr; gap: 6px; }
  .ps-val { font-size: .95rem; }
  .payments-table { border: none; }
  .pt-head { display: none; }
  .pt-row {
    display: flex; flex-wrap: wrap; gap: 6px;
    padding: 11px 12px; border: 1px solid var(--border);
    border-radius: 10px; margin-bottom: 7px;
  }
  .pt-row span:nth-child(1) { font-size: .71rem; color: var(--muted); width: 100%; }
  .pt-row span:nth-child(2) { font-weight: 600; flex: 1; }
  .pt-row span:nth-child(3) { margin-left: auto; }
  .pt-row span:nth-child(4) { font-size: .92rem; width: 100%; }
  .pt-row span:nth-child(5) { display: none; }

  /* Pipeline */
  .pipeline-tabs { gap: 4px; overflow-x: auto; -webkit-overflow-scrolling: touch; flex-wrap: nowrap; }
  .pipeline-tab  { padding: 6px 11px; font-size: .72rem; white-space: nowrap; }
  .pipeline-row  { padding: 10px 12px; }

  /* Progress track */
  .progress-track { padding-bottom: 4px; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .pt-label { font-size: .57rem; }

  /* Today tasks */
  .today-task { padding: 10px 12px; }

  /* Breadcrumb */
  .detail-breadcrumb { margin-bottom: 10px; }
  .breadcrumb-current { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 180px; display: inline-block; vertical-align: bottom; }

  /* Detail cards */
  .detail-card { min-width: 0; overflow: hidden; }
  .dc-body { padding: 12px; }
  .dc-head { padding: 10px 12px; flex-wrap: wrap; gap: 6px; }

  /* Textarea and inputs inside cards */
  .notes-textarea { width: 100%; box-sizing: border-box; }
  .quick-add-row { display: flex; gap: 6px; }
  .quick-add-input { flex: 1; min-width: 0; }
  .followup-input-sm { max-width: 100%; box-sizing: border-box; }

  /* Work type badges wrap */
  .work-type-badge { font-size: .65rem; padding: 2px 6px; }

  /* Scores info grid */
  .ig-val { overflow: hidden; text-overflow: ellipsis; word-break: break-word; }

  /* Payments summary */
  .payments-summary-row { grid-template-columns: 1fr 1fr; gap: 6px; }

  /* Score history table */
  .sh-table { font-size: .75rem; }
  .sh-table th, .sh-table td { padding: 7px 8px; }

  /* Modal */
  #modal { width: calc(100vw - 20px); padding: 20px 16px 16px; max-height: calc(100dvh - 40px); overflow-y: auto; }

  /* Global safety: nothing escapes the viewport */
  .view, .detail-card, .tab-grid-2, .tg-col { max-width: 100%; }
  .tg-col > *, .tab-grid-2 > * { min-width: 0; }

  /* ROI grid 2 cols on mobile */
  .roi-grid { grid-template-columns: 1fr 1fr; }

  /* Letters */
  .letter-preview { white-space: normal; -webkit-line-clamp: 2; display: -webkit-box; -webkit-box-orient: vertical; overflow: hidden; }
  .letter-meta { flex-wrap: wrap; }

  /* Inquiries */
  .inq-status-sel { font-size: .7rem; padding: 3px 5px; }
  .inq-summary { gap: 10px; flex-wrap: wrap; }

  /* Form label */
  .form-row-3 .form-label { font-size: .68rem; }
}
