/* ═══════════════════════════════════════════════════════
   JC CRM — Design System
   Bloomberg meets Linear. Data-dense, professional, touch-first.
   ═══════════════════════════════════════════════════════ */

/* ─── CSS Custom Properties ─── */
:root {
  --navy:        #0F2137;
  --amber:       #D4870F;
  --amber-light: #FEF3DC;
  --green:       #27613A;
  --green-light: #E6F4EB;
  --bg:          #F7F6F2;
  --surface:     #FFFFFF;
  --border:      #E2E0D8;
  --text:        #1A1A1A;
  --text-muted:  #6B6860;
  --red:         #C0392B;
  --red-light:   #FDECEA;

  --tab-bar-height: 60px;
  --header-height:  52px;
  --safe-top:    env(safe-area-inset-top);
  --safe-bottom: env(safe-area-inset-bottom);
  --safe-left:   env(safe-area-inset-left);
  --safe-right:  env(safe-area-inset-right);

  --radius-sm:   6px;
  --radius-md:   10px;
  --radius-lg:   16px;
  --radius-pill: 999px;

  --shadow-sm:   0 1px 3px rgba(0,0,0,0.08);
  --shadow-md:   0 4px 16px rgba(0,0,0,0.12);
  --shadow-lg:   0 8px 32px rgba(0,0,0,0.18);

  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
  --mono: 'SF Mono', 'Fira Code', Consolas, monospace;

  --transition: 200ms ease;
}

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

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  height: 100%;
  height: -webkit-fill-available;
}

body {
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  color: var(--text);
  background: var(--navy);
  height: 100%;
  min-height: 100vh;
  min-height: 100dvh;
  min-height: -webkit-fill-available;
  overflow: hidden;
  overscroll-behavior: none;
  -webkit-tap-highlight-color: transparent;
}

/* ─── Screens ─── */
.screen {
  position: fixed;
  inset: 0;
  display: none;
  flex-direction: column;
  background: var(--navy);
}
.screen.active { display: flex; }

/* ─── AUTH SCREEN ─── */
.screen-auth {
  background: var(--navy);
  align-items: center;
  justify-content: center;
  padding: 24px;
  padding-top: calc(24px + var(--safe-top));
  padding-bottom: calc(24px + var(--safe-bottom));
}

.auth-card {
  width: 100%;
  max-width: 360px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.auth-logo { margin-bottom: 8px; }

.auth-title {
  font-size: 28px;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.5px;
}

.auth-subtitle {
  font-size: 15px;
  color: rgba(255,255,255,0.6);
  margin-bottom: 8px;
}

.auth-note {
  font-size: 13px;
  color: rgba(255,255,255,0.4);
}

/* ─── SETUP SCREEN ─── */
.screen-setup {
  background: var(--bg);
  align-items: center;
  justify-content: center;
  padding: 24px;
  padding-top: calc(24px + var(--safe-top));
  padding-bottom: calc(24px + var(--safe-bottom));
}

.setup-card {
  width: 100%;
  max-width: 480px;
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 32px;
  box-shadow: var(--shadow-md);
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.setup-card h2 { font-size: 20px; font-weight: 700; }
.setup-card p  { color: var(--text-muted); font-size: 14px; }

.setup-option {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.setup-option-label { font-size: 12px; color: var(--text-muted); }

.setup-divider {
  text-align: center;
  font-size: 13px;
  color: var(--text-muted);
  position: relative;
}
.setup-divider::before, .setup-divider::after {
  content: '';
  position: absolute;
  top: 50%;
  width: 40%;
  height: 1px;
  background: var(--border);
}
.setup-divider::before { left: 0; }
.setup-divider::after  { right: 0; }

/* ─── APP SCREEN ─── */
.screen-app {
  background: var(--bg);
  flex-direction: column;
}

/* ─── HEADER ─── */
.app-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  height: calc(var(--header-height) + var(--safe-top));
  padding-top: var(--safe-top);
  padding-left: calc(16px + var(--safe-left));
  padding-right: calc(16px + var(--safe-right));
  background: var(--navy);
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 1px 0 rgba(255,255,255,0.08);
}

.header-title {
  font-size: 17px;
  font-weight: 600;
  color: #fff;
  letter-spacing: -0.2px;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 4px;
}

/* ─── OFFLINE BANNER ─── */
.offline-banner {
  position: fixed;
  top: calc(var(--header-height) + var(--safe-top));
  left: 0;
  right: 0;
  z-index: 90;
  background: var(--amber);
  color: #fff;
  font-size: 13px;
  font-weight: 500;
  text-align: center;
  padding: 8px 16px;
}

/* ─── MAIN CONTENT ─── */
.app-main {
  position: fixed;
  top: calc(var(--header-height) + var(--safe-top));
  left: var(--safe-left);
  right: var(--safe-right);
  bottom: calc(var(--tab-bar-height) + var(--safe-bottom));
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
}

/* ─── VIEWS ─── */
.view {
  display: none;
  padding: 16px;
  min-height: 100%;
  animation: fadeIn 150ms ease;
}
.view.active { display: block; }

@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* ─── TAB BAR ─── */
.tab-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 100;
  height: calc(var(--tab-bar-height) + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  padding-left: var(--safe-left);
  padding-right: var(--safe-right);
  background: var(--surface);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: stretch;
  box-shadow: 0 -2px 12px rgba(0,0,0,0.06);
}

/* Extend tab bar background below home indicator on iPhone */
.tab-bar::after {
  content: '';
  position: absolute;
  bottom: calc(-1 * var(--safe-bottom));
  left: 0;
  right: 0;
  height: var(--safe-bottom);
  background: var(--surface);
}

.tab-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  padding: 8px 4px;
  position: relative;
  min-height: 44px;
  transition: color var(--transition);
  -webkit-tap-highlight-color: transparent;
}

.tab-item.active {
  color: var(--navy);
}

.tab-icon {
  width: 22px;
  height: 22px;
  stroke-width: 1.75;
}

.tab-label {
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.2px;
}

.tab-badge {
  position: absolute;
  top: 6px;
  right: calc(50% - 18px);
  background: var(--amber);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  min-width: 16px;
  height: 16px;
  border-radius: var(--radius-pill);
  padding: 0 4px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ─── BUTTONS ─── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-family: var(--font);
  font-size: 14px;
  font-weight: 500;
  line-height: 1;
  padding: 0 16px;
  height: 40px;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  white-space: nowrap;
  transition: opacity var(--transition), background var(--transition);
  -webkit-tap-highlight-color: transparent;
  min-height: 44px;
}

.btn:active { opacity: 0.75; }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }

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

.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
}

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

.btn-large {
  height: 52px;
  font-size: 16px;
  padding: 0 24px;
  width: 100%;
  max-width: 300px;
}

.btn-small {
  height: 32px;
  font-size: 13px;
  padding: 0 12px;
  min-height: 32px;
}

.btn-icon { width: 18px; height: 18px; }

.btn-link {
  background: none;
  border: none;
  color: var(--navy);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  padding: 8px 0;
  text-decoration: underline;
  text-underline-offset: 2px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  -webkit-tap-highlight-color: transparent;
}

.icon-btn {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  color: rgba(255,255,255,0.7);
  transition: color var(--transition), background var(--transition);
  -webkit-tap-highlight-color: transparent;
}
.icon-btn:active { background: rgba(255,255,255,0.1); }

/* ─── FORMS ─── */
.form { display: flex; flex-direction: column; gap: 12px; }

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

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

.form-group { display: flex; flex-direction: column; gap: 4px; }

.form-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.form-input,
.form-select,
.form-textarea {
  font-family: var(--font);
  font-size: 16px; /* 16px prevents iOS zoom on focus */
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  width: 100%;
  outline: none;
  transition: border-color var(--transition);
  -webkit-appearance: none;
  appearance: none;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  border-color: var(--navy);
  box-shadow: 0 0 0 3px rgba(15,33,55,0.1);
}

.form-select {
  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='%236B6860' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

/* ── Combobox (type-to-filter dropdown over a <select>) ── */
.combobox {
  position: relative;
  width: 100%;
}
/* In the filter toolbar, don't stretch full-width like a form field */
.view-toolbar .combobox {
  width: auto;
  min-width: 180px;
}
.combobox-control {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  min-height: 42px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 5px 10px;
  transition: border-color var(--transition);
}
.combobox-control:focus-within {
  border-color: var(--navy);
  box-shadow: 0 0 0 3px rgba(15,33,55,0.1);
}
.combobox-input {
  flex: 1;
  min-width: 80px;
  border: none;
  outline: none;
  background: transparent;
  font-family: var(--font);
  font-size: 16px;
  color: var(--text);
  padding: 4px 2px;
}
.combobox-list {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  z-index: 60;
  max-height: 240px;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: 0 6px 20px rgba(0,0,0,0.12);
}
.combobox-option {
  padding: 9px 12px;
  font-size: 14px;
  color: var(--text);
  cursor: pointer;
}
.combobox-option:hover,
.combobox-option.active {
  background: var(--bg);
}
.combobox-empty {
  padding: 9px 12px;
  font-size: 13px;
  color: var(--text-muted);
}
.combobox-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 2px 4px 2px 8px;
  font-size: 13px;
  color: var(--text);
  max-width: 100%;
}
.combobox-chip-x {
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 15px;
  line-height: 1;
  padding: 0 2px;
}
.combobox-chip-x:hover { color: var(--navy); }

.form-textarea { resize: vertical; min-height: 80px; }

.form-input--short { max-width: 120px; }

/* ─── TOOLBAR ─── */
.view-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.search-input {
  flex: 1;
  min-width: 160px;
  font-family: var(--font);
  font-size: 15px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  outline: none;
  -webkit-appearance: none;
}
.search-input:focus { border-color: var(--navy); }

.filter-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  flex-wrap: wrap;
  padding: 12px;
  background: var(--surface);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
}

.filter-select {
  font-family: var(--font);
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 8px 32px 8px 10px;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
  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='%236B6860' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  min-height: 44px;
}

.import-bar {
  display: flex;
  gap: 16px;
  margin-bottom: 8px;
}

/* ─── DATA TABLE ─── */
.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--surface);
}

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

.data-table th {
  background: var(--bg);
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 10px 14px;
  text-align: left;
  white-space: nowrap;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 1;
}

.data-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
  color: var(--text);
}

.data-table tbody tr:last-child td { border-bottom: none; }

.data-table th[data-sort] { user-select: none; }
.data-table th.sort-active { color: var(--navy); }
.data-table th[data-sort-dir="asc"]::after  { content: ' ↑'; }
.data-table th[data-sort-dir="desc"]::after { content: ' ↓'; }

.data-table tbody tr {
  cursor: pointer;
  transition: background var(--transition);
}
.data-table tbody tr:active { background: var(--bg); }

/* ─── STATUS BADGES ─── */
.badge {
  display: inline-flex;
  align-items: center;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  white-space: nowrap;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.badge--active   { background: var(--green-light); color: var(--green); }
.badge--warm     { background: #FFF3E0; color: #E65100; }
.badge--new      { background: #E3F2FD; color: #1565C0; }
.badge--cold     { background: var(--border); color: var(--text-muted); }

.badge--identified   { background: #F3E5F5; color: #6A1B9A; }
.badge--contacted    { background: #E3F2FD; color: #1565C0; }
.badge--intro        { background: #E8F5E9; color: #2E7D32; }
.badge--active-proc  { background: var(--green-light); color: var(--green); }
.badge--offer        { background: #FFF8E1; color: #F57F17; }
.badge--pass         { background: var(--border); color: var(--text-muted); }
.badge--placed       { background: var(--navy); color: #fff; }

.badge--headhunter    { background: #E8EAF6; color: #283593; }
.badge--broker        { background: #FFF3E0; color: #E65100; }
.badge--capital       { background: #E8F5E9; color: #1B5E20; }
.badge--repe          { background: #E0F7FA; color: #006064; }
.badge--mentor        { background: #F3E5F5; color: #6A1B9A; }
.badge--other         { background: var(--border); color: var(--text-muted); }

.badge--strong   { background: var(--green-light); color: var(--green); }
.badge--moderate { background: var(--amber-light); color: var(--amber); }
.badge--weak     { background: var(--red-light); color: var(--red); }

/* ─── METRICS GRID ─── */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 16px;
}

@media (min-width: 600px) {
  .metrics-grid { grid-template-columns: repeat(4, 1fr); }
}

.metric-card {
  background: var(--surface);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  padding: 16px;
  text-align: center;
}

.metric-card--alert { border-color: var(--amber); }

.metric-card--clickable { cursor: pointer; transition: transform 80ms ease, box-shadow 80ms ease; }
.metric-card--clickable:active { transform: scale(0.97); box-shadow: none; }

.metric-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--navy);
  line-height: 1;
  margin-bottom: 4px;
}

.metric-card--alert .metric-value { color: var(--amber); }

.metric-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
}

/* ─── DASHBOARD INSIGHT PANELS ─── */
.dash-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}
@media (min-width: 600px) {
  .dash-grid { grid-template-columns: 1fr 1fr; }
}

.dash-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 14px;
}

.dash-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin-bottom: 8px;
}
.dash-card-window {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  padding: 1px 8px;
  letter-spacing: 0.3px;
}

.dash-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-top: 1px solid var(--border);
  cursor: pointer;
  transition: background 80ms ease;
}
.dash-row:first-of-type { border-top: none; }
.dash-row:hover { background: var(--bg); }
.dash-row:active { transform: scale(0.995); }

.dash-row-main { flex: 1; min-width: 0; }
.dash-row-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.dash-row-sub {
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.dash-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  margin-right: 6px;
  flex-shrink: 0;
}

.dash-count {
  flex-shrink: 0;
  min-width: 26px;
  height: 24px;
  padding: 0 7px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  color: var(--navy);
  background: var(--green-light);
  border-radius: var(--radius-pill);
}

/* ─── ALERT STRIPS ─── */
.alert-strip {
  background: var(--amber-light);
  border: 1px solid var(--amber);
  border-radius: var(--radius-md);
  margin-bottom: 16px;
  overflow: hidden;
}

.alert-strip-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--amber);
  border-bottom: 1px solid rgba(212,135,15,0.2);
}

.alert-list { display: flex; flex-direction: column; }

/* ─── Agent run banner ───────────────────────────────────────── */
.agent-run-banner {
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: var(--radius-md);
  margin-top: 24px;
  overflow: hidden;
}
.agent-run-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.agent-run-summary {
  padding: 10px 14px;
  font-size: 13px;
  color: var(--text-secondary);
  white-space: pre-wrap;
  line-height: 1.5;
}

.alert-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-bottom: 1px solid rgba(212,135,15,0.15);
  gap: 12px;
}

.alert-item:last-child { border-bottom: none; }

.alert-item-info { flex: 1; min-width: 0; }

.alert-item-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.alert-item-detail {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.alert-item-days {
  font-size: 12px;
  font-weight: 700;
  color: var(--amber);
  white-space: nowrap;
}

/* ─── SECTION HEADERS ─── */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  margin-top: 8px;
}

.section-title {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
}

.section-title--alert { color: var(--red); }

/* ─── QUICK ADD ROW ─── */
.quick-add-row {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

/* ─── ACTIVITY FEED ─── */
.activity-feed { display: flex; flex-direction: column; gap: 8px; }

.activity-item {
  background: var(--surface);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  padding: 12px 14px;
  cursor: pointer;
  transition: border-color var(--transition);
}

.activity-item:active { border-color: var(--navy); }

.activity-item-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
  gap: 8px;
}

.activity-contact-name { font-size: 14px; font-weight: 600; }

.activity-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-muted);
  flex-shrink: 0;
}

.activity-summary {
  font-size: 13px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ─── INTERACTIONS FEED ─── */
.interactions-feed { display: flex; flex-direction: column; gap: 10px; }

.interaction-card {
  background: var(--surface);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  padding: 14px;
}

.interaction-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 8px;
  gap: 12px;
}

.interaction-card-name { font-size: 15px; font-weight: 600; }

.interaction-card-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  flex-shrink: 0;
}

.interaction-card-date { font-size: 12px; color: var(--text-muted); }

.interaction-card-summary {
  font-size: 14px;
  color: var(--text);
  line-height: 1.5;
  margin-bottom: 8px;
}

.interaction-card-footer {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.interaction-card-next {
  font-size: 12px;
  color: var(--amber);
  font-weight: 500;
}

/* ─── KANBAN BOARD ─── */
.kanban-board {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 16px;
  min-height: calc(100vh - 180px);
  align-items: flex-start;
}

.kanban-col {
  flex-shrink: 0;
  width: 240px;
  background: var(--surface);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 200px);
}

.kanban-col-header {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.kanban-col-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
}

.kanban-col-count {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--bg);
  padding: 2px 7px;
  border-radius: var(--radius-pill);
}

.kanban-cards {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.kanban-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px;
  cursor: pointer;
  transition: box-shadow var(--transition), border-color var(--transition);
  box-shadow: var(--shadow-sm);
}

.kanban-card:active {
  border-color: var(--navy);
  box-shadow: var(--shadow-md);
}

.kanban-card-title { font-size: 13px; font-weight: 600; margin-bottom: 4px; }
.kanban-card-company { font-size: 12px; color: var(--text-muted); margin-bottom: 8px; }

.kanban-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.kanban-card-hh { font-size: 11px; color: var(--text-muted); }

.kanban-card-days {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
}

.kanban-card-days--stale { color: var(--amber); }

/* ─── VIEW TOGGLE ─── */
.view-toggle {
  display: flex;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.toggle-btn {
  background: none;
  border: none;
  font-family: var(--font);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  padding: 8px 14px;
  cursor: pointer;
  min-height: 44px;
  transition: background var(--transition), color var(--transition);
  -webkit-tap-highlight-color: transparent;
}

.toggle-btn.active {
  background: var(--navy);
  color: #fff;
}

/* ─── INTERACTION MONTH GROUPS ─── */
.interaction-month-group { margin-bottom: 8px; }

.interaction-month-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-muted);
  padding: 12px 2px 6px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 8px;
}

/* ─── COMPANIES GRID ─── */
.companies-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}

.company-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  cursor: pointer;
  transition: border-color var(--transition);
}

.company-card:active { border-color: var(--navy); }

.company-card-name { font-size: 16px; font-weight: 700; margin-bottom: 4px; }

.company-card-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.company-card-stats {
  display: flex;
  gap: 16px;
  font-size: 12px;
}

.company-card-stat { color: var(--text-muted); }
.company-card-stat strong { color: var(--text); }

/* ─── DOCUMENTS LIST ─── */
.documents-list { display: flex; flex-direction: column; gap: 8px; }

.document-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  cursor: pointer;
}

.document-item:active { border-color: var(--navy); }

.document-item-info { flex: 1; min-width: 0; }

.document-item-name { font-size: 14px; font-weight: 600; margin-bottom: 2px; }

.document-item-meta { font-size: 12px; color: var(--text-muted); }

.document-item-link {
  font-size: 13px;
  color: var(--navy);
  text-decoration: none;
  font-weight: 500;
  white-space: nowrap;
  padding: 8px 0;
}

/* ─── ALERTS VIEW ─── */
.alerts-section { margin-bottom: 24px; }

.alert-cards { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }

.alert-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.alert-card--overdue { border-left: 3px solid var(--red); }
.alert-card--stale   { border-left: 3px solid var(--amber); }

.alert-card-info { flex: 1; min-width: 0; }
.alert-card-name { font-size: 14px; font-weight: 600; margin-bottom: 2px; }
.alert-card-action { font-size: 13px; color: var(--text-muted); }
.alert-card-days { font-size: 12px; font-weight: 700; white-space: nowrap; }
.alert-card-days--overdue { color: var(--red); }
.alert-card-days--stale   { color: var(--amber); }

/* ─── SETTINGS ─── */
.settings-group {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px;
  margin-bottom: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.settings-group-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
}

.settings-info { font-size: 14px; color: var(--text-muted); }

/* ─── MODALS ─── */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: flex-end;
  animation: backdropIn 200ms ease;
}

@keyframes backdropIn { from { opacity: 0; } to { opacity: 1; } }

.modal-sheet {
  width: 100%;
  max-height: 92vh;
  background: var(--surface);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  display: flex;
  flex-direction: column;
  padding-bottom: var(--safe-bottom);
  animation: sheetUp 250ms cubic-bezier(0.32, 0.72, 0, 1);
}

@media (min-width: 768px) {
  .modal-backdrop { align-items: center; }
  .modal-sheet {
    max-width: 640px;
    margin: auto;
    border-radius: var(--radius-lg);
    max-height: 85vh;
    padding-bottom: 0;
  }
  .modal-sheet--large { max-width: 800px; }
}

@keyframes sheetUp {
  from { transform: translateY(100%); }
  to   { transform: translateY(0); }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.modal-title { font-size: 17px; font-weight: 700; }

.modal-close {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  border: none;
  border-radius: var(--radius-pill);
  font-size: 14px;
  color: var(--text-muted);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.modal-body {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 16px 20px;
}

.modal-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  flex-shrink: 0;
}

/* ─── DETAIL PANEL ─── */
.detail-panel {
  position: fixed;
  inset: 0;
  z-index: 150;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  animation: slideInRight 250ms cubic-bezier(0.32, 0.72, 0, 1);
}

@keyframes slideInRight {
  from { transform: translateX(100%); }
  to   { transform: translateX(0); }
}

.detail-panel-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  padding-top: calc(14px + var(--safe-top));
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.detail-panel-title {
  flex: 1;
  font-size: 17px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.detail-panel-body {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 16px;
  padding-bottom: calc(16px + var(--safe-bottom));
}

/* Detail sections */
.detail-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 12px;
}

.detail-section-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.detail-field { margin-bottom: 12px; }
.detail-field:last-child { margin-bottom: 0; }
.detail-field-label { font-size: 11px; color: var(--text-muted); font-weight: 500; margin-bottom: 2px; }
.detail-field-value { font-size: 14px; color: var(--text); }
.detail-field-value--empty { color: var(--text-muted); font-style: italic; }

.detail-fields-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

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

/* ─── IMPORT ─── */
.import-instructions { font-size: 14px; color: var(--text-muted); margin-bottom: 16px; line-height: 1.5; }

.file-upload-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 40px 20px;
  border: 2px dashed var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  color: var(--text-muted);
  font-size: 15px;
  transition: border-color var(--transition), background var(--transition);
}

.file-upload-area:active { border-color: var(--navy); background: var(--bg); }

.file-input-hidden { display: none; }

.import-bulk-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

/* ─── TOAST ─── */
.toast {
  position: fixed;
  bottom: calc(var(--tab-bar-height) + var(--safe-bottom) + 12px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 300;
  background: var(--navy);
  color: #fff;
  font-size: 14px;
  font-weight: 500;
  padding: 10px 20px;
  border-radius: var(--radius-pill);
  white-space: nowrap;
  box-shadow: var(--shadow-lg);
  animation: toastIn 200ms ease;
}

@keyframes toastIn {
  from { opacity: 0; transform: translateX(-50%) translateY(8px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* ─── EMPTY STATE ─── */
.empty-state {
  text-align: center;
  padding: 40px 20px;
  font-size: 14px;
  color: var(--text-muted);
}

/* ─── UTILITIES ─── */
.hidden { display: none !important; }

.text-muted  { color: var(--text-muted); }
.text-amber  { color: var(--amber); }
.text-green  { color: var(--green); }
.text-red    { color: var(--red); }
.text-navy   { color: var(--navy); }

.dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  vertical-align: middle;
}

/* ─── TABLET / DESKTOP LAYOUT ─── (iPad landscape, desktop) */
@media (min-width: 768px) {
  .metrics-grid { grid-template-columns: repeat(4, 1fr); }

  .kanban-col { width: 260px; }

  .app-main { padding: 0; }

  .view { padding: 20px 24px; max-width: 1200px; margin: 0 auto; }

  .tab-bar {
    width: 100%;
    max-width: 600px;
    left: 50%;
    transform: translateX(-50%);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    border-left: 1px solid var(--border);
    border-right: 1px solid var(--border);
  }

  .companies-grid { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
}

/* ─── LARGE TABLET / SPLIT VIEW ─── */
@media (min-width: 1024px) {
  .view { padding: 24px 32px; }
}

/* ─── MORE MENU ─── */
.more-menu-wrap {
  position: relative;
}

.more-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  min-width: 180px;
  z-index: 200;
  overflow: hidden;
  animation: fadeIn 150ms ease;
}

.more-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 13px 16px;
  background: none;
  border: none;
  font-family: var(--font);
  font-size: 15px;
  color: var(--text);
  cursor: pointer;
  text-align: left;
  min-height: 44px;
  transition: background var(--transition);
  -webkit-tap-highlight-color: transparent;
}

.more-menu-item:active { background: var(--bg); }

.more-menu-divider {
  height: 1px;
  background: var(--border);
  margin: 4px 0;
}

/* ─── ACCESSIBILITY / REDUCED MOTION ─── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* ─── DARK MODE PLACEHOLDER ─── (future) */
/* @media (prefers-color-scheme: dark) { } */
