/* ═══════════════════════════════════════════════════════════════════════════
 * TvastrOps CRM — design tokens follow the TvastrOps website (globals.css and
 * service-ui.css): near-black surfaces, Boilermaker Gold, IBM Plex Sans, flat
 * neutral cards with 16px corners, gold selected controls, 44px targets.
 *
 * Gold: --gold (#CFB991) is for fills, rules and accents; gold text uses
 * --gold-text. Contrast (WCAG AA): --text on --void 14.6:1, --muted 7.2:1,
 * --dim 4.7:1. No gradients or extra palettes.
 * ═══════════════════════════════════════════════════════════════════════════ */
:root {
  --void: #09090A;
  --surface: #151517;
  --surface-2: #202124;
  --surface-alt: #18181B;

  --text: #F1EFE9;
  --muted: #B4B1A9;
  --dim: #94918A;

  --gold: #CFB991;
  --gold-deep: #8E7642;
  --gold-light: #EBD99F;
  --gold-text: #CFB991;
  --gold-wash: rgba(207, 185, 145, 0.12);
  --gold-line: rgba(207, 185, 145, 0.45);

  --live: #7fd4a8;
  --live-wash: rgba(127, 212, 168, 0.12);
  --alert: #E8927C;
  --alert-wash: rgba(232, 146, 124, 0.12);

  --line: rgba(241, 239, 233, 0.13);
  --line-soft: rgba(241, 239, 233, 0.07);
  --ink: #111111;

  --header-h: 76px;
  --header-surface: rgb(22 22 25 / 0.9);
  --gutter: clamp(18px, 3.2vw, 56px);

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-card: 16px;
  --radius-full: 9999px;
  --gap: 20px;
  --target: 44px;

  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --t-fast: 160ms var(--ease);
  --font-sans: "IBM Plex Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

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

html { background: var(--void); }

body {
  background: var(--void);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  min-height: 100vh;
  overflow-x: clip;
}

button, input, select, textarea { font: inherit; color: inherit; }

/* Component display rules must not override the hidden attribute. */
[hidden] { display: none !important; }
button { cursor: pointer; }

::selection { background: var(--gold); color: var(--ink); }

:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 3px;
}

.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.skip-link {
  position: absolute;
  left: 16px;
  top: -60px;
  z-index: 3000;
  background: var(--gold);
  color: var(--ink);
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  text-decoration: none;
}
.skip-link:focus { top: 12px; }

.num-tabular { font-variant-numeric: tabular-nums; }

/* Small uppercase labels — the website's .nav-text / SectionLabel. */
.nav-text {
  font-size: 13px;
  font-weight: 500;
  line-height: 1;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.section-label {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--gold-text);
}

/* ---------- Top bar ---------- */

.app-container { display: flex; flex-direction: column; min-height: 100vh; }

.top-navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  height: var(--header-h);
  padding: 0 var(--gutter);
  background: var(--header-surface);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line-soft);
}

.brand-section {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-shrink: 0;
}

.brand-icon { height: 34px; width: auto; display: block; }

.brand-product {
  color: var(--gold-text);
  padding-left: 14px;
  border-left: 1px solid var(--line);
  height: 22px;
  display: flex;
  align-items: center;
}

/* Tabs with the website's sliding hover pill. */
.nav-tabs-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  gap: 2px;
}

.nav-pill {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  border-radius: var(--radius-full);
  background: rgba(241, 239, 233, 0.08);
  opacity: 0;
  transition: transform 260ms var(--ease), width 260ms var(--ease), opacity 160ms ease;
  pointer-events: none;
}

.nav-tab-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: var(--target);
  padding: 0 18px;
  border: none;
  background: transparent;
  color: var(--muted);
  border-radius: var(--radius-full);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  white-space: nowrap;
  transition: color var(--t-fast);
}

.nav-tab-btn:hover { color: var(--text); }
.nav-tab-btn.active { color: var(--gold-text); }

.nav-tab-btn.active::after {
  content: "";
  position: absolute;
  left: 18px;
  right: 18px;
  bottom: 6px;
  height: 2px;
  background: var(--gold);
  border-radius: 2px;
}

.tab-badge {
  font-size: 11px;
  letter-spacing: 0;
  padding: 1px 7px;
  border-radius: var(--radius-full);
  background: var(--surface-2);
  color: var(--muted);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

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

.search-input-box { position: relative; width: 260px; }

.search-input-box svg {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--dim);
  pointer-events: none;
}

.search-input-box input {
  width: 100%;
  height: var(--target);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-full);
  padding: 0 44px 0 38px;
  font-size: 13px;
  transition: border-color var(--t-fast);
}

.search-input-box input::placeholder { color: var(--dim); }
.search-input-box input:focus { outline: none; border-color: var(--gold-line); }
.search-input-box input::-webkit-search-cancel-button { display: none; }

.search-shortcut-kbd {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 10px;
  padding: 2px 6px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--dim);
  font-family: inherit;
  font-weight: 600;
}

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: var(--target);
  padding: 0 18px;
  font-size: 13px;
  font-weight: 600;
  border-radius: var(--radius-full);
  border: 1px solid transparent;
  white-space: nowrap;
  transition: background-color var(--t-fast), border-color var(--t-fast), color var(--t-fast);
}

.btn-primary { background: var(--gold); color: var(--ink); }
.btn-primary:hover { background: var(--gold-light); }

.btn-secondary { background: transparent; border-color: var(--line); color: var(--text); }
.btn-secondary:hover { border-color: var(--gold-line); background: var(--surface); }

.btn-ghost-danger { background: transparent; color: var(--alert); padding: 0 12px; }
.btn-ghost-danger:hover { background: var(--alert-wash); }

.btn-icon { width: var(--target); padding: 0; }

/* ---------- Layout ---------- */

.main-viewport {
  flex: 1;
  width: 100%;
  max-width: 1680px;
  margin: 0 auto;
  padding: 28px var(--gutter) 64px;
}
.main-viewport:focus { outline: none; }

.tab-pane { display: none; }
.tab-pane.active { display: block; animation: fadeIn 220ms var(--ease); }

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

.section-header-bar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: var(--gap);
}

.section-title-wrap h2 {
  margin-top: 6px;
  font-size: 26px;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.2;
}

.section-subtitle { margin-top: 6px; font-size: 14px; color: var(--muted); }
.section-subtitle strong { color: var(--text); font-weight: 600; }

.count-indicator { font-size: 13px; color: var(--dim); }

/* ---------- KPI strip ---------- */

.kpi-strip-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--gap);
  margin-bottom: 36px;
}

.kpi-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-card);
  text-align: left;
}

.kpi-card-action { transition: border-color var(--t-fast); }
.kpi-card-action:hover { border-color: var(--gold-line); }
.kpi-card-action.is-alert .kpi-value { color: var(--alert); }

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

.kpi-value { font-size: 28px; font-weight: 600; line-height: 1.15; }
.kpi-sub { font-size: 12px; color: var(--dim); min-height: 1.2em; }

/* ---------- Filters ---------- */

.filter-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 16px;
}

.filter-group { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }

.toolbar-label {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--dim);
}

.select-control {
  min-height: var(--target);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-full);
  padding: 0 14px;
  font-size: 13px;
  transition: border-color var(--t-fast);
}
.select-control:hover { border-color: var(--gold-line); }
.select-control.is-set { border-color: var(--gold); color: var(--gold-text); }

.check-control {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: var(--target);
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-full);
  font-size: 13px;
  cursor: pointer;
}
.check-control:has(input:checked) { border-color: var(--gold); color: var(--gold-text); }
.check-control input { accent-color: var(--gold); width: 16px; height: 16px; }

/* ---------- Enquiries table ---------- */

.table-card-container {
  position: relative; /* keeps the visually-hidden header inside the scroller on phones */
  background: var(--surface);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-card);
  overflow-x: auto;
}

.leads-data-table { width: 100%; min-width: 980px; border-collapse: collapse; text-align: left; }

.leads-data-table th {
  padding: 14px 18px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--dim);
  border-bottom: 1px solid var(--line);
}

.leads-data-table td {
  padding: 14px 18px;
  border-bottom: 1px solid var(--line-soft);
  vertical-align: middle;
}

.leads-data-table tbody tr { cursor: pointer; transition: background-color var(--t-fast); }
.leads-data-table tbody tr:hover { background: var(--surface-alt); }
.leads-data-table tbody tr:last-child td { border-bottom: none; }

.empty-state { text-align: center; padding: 56px 16px !important; color: var(--muted); cursor: default; }
.empty-state strong { display: block; color: var(--text); font-size: 16px; font-weight: 600; margin-bottom: 4px; }

.company-cell { display: flex; align-items: center; gap: 12px; }

.initials {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 12px;
  letter-spacing: 0.04em;
  color: var(--gold-text);
}
.initials-sm { width: 26px; height: 26px; border-radius: 50%; font-size: 10px; }

.cell-title { font-size: 14px; font-weight: 600; color: var(--text); line-height: 1.35; }
.cell-sub { font-size: 12px; color: var(--muted); }
.cell-muted { color: var(--dim); }

.value-cell { font-weight: 600; font-variant-numeric: tabular-nums; }

/* Stage pill: label always shown, so state is never colour alone. */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 4px 11px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  background: var(--surface-2);
  color: var(--text);
}
.stage-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--gold); flex-shrink: 0; }
.status-pill[data-stage="won"] { background: var(--live-wash); color: var(--live); }
.status-pill[data-stage="won"] .stage-dot { background: var(--live); }
.status-pill[data-stage="lost"] { color: var(--dim); }
.status-pill[data-stage="lost"] .stage-dot { background: var(--dim); }

.tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border: 1px solid var(--line);
  color: var(--muted);
  white-space: nowrap;
}
.tag-high { border-color: var(--gold-line); color: var(--gold-text); }
.tag-alert { border-color: rgba(232, 146, 124, 0.5); color: var(--alert); background: var(--alert-wash); }
.tag-ok { color: var(--dim); }

.next-step { display: flex; flex-direction: column; gap: 4px; align-items: flex-start; }

.owner-cell { display: flex; align-items: center; gap: 8px; font-size: 13px; }

.action-cell-btns { display: flex; justify-content: flex-end; gap: 4px; }

.action-btn-sm {
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--muted);
  transition: all var(--t-fast);
}
.action-btn-sm:hover { color: var(--text); border-color: var(--line); background: var(--surface-2); }
.action-btn-sm.delete-btn:hover { color: var(--alert); background: var(--alert-wash); border-color: transparent; }

/* ---------- Boards (pipeline + delivery) ---------- */

.pipeline-board-container {
  display: flex;
  gap: 16px;
  overflow-x: auto;
  padding-bottom: 20px;
  min-height: calc(100vh - 340px);
}

.kanban-column {
  flex: 1 0 240px;
  max-width: 340px;
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 300px);
  min-height: 320px;
  background: var(--surface);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-card);
  transition: border-color var(--t-fast), background-color var(--t-fast);
}
.kanban-column.drag-over { border-color: var(--gold); background: var(--gold-wash); }

.column-header { padding: 16px 16px 14px; border-bottom: 1px solid var(--line-soft); }

.column-title-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }

.stage-title {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.column-step { color: var(--gold-text); margin-right: 6px; font-variant-numeric: tabular-nums; }

.column-count-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 1px 8px;
  border-radius: var(--radius-full);
  background: var(--surface-2);
  color: var(--muted);
}

.column-metrics-row {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--dim);
  font-variant-numeric: tabular-nums;
}
.column-metrics-row strong { color: var(--text); font-weight: 600; }

.column-cards-scroll {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px;
  overflow-y: auto;
}

.column-empty {
  border: 1px dashed var(--line);
  border-radius: var(--radius-md);
  padding: 20px 12px;
  text-align: center;
  font-size: 12px;
  color: var(--dim);
}

.deal-card {
  background: var(--surface-2);
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  padding: 14px;
  cursor: grab;
  user-select: none;
  transition: border-color var(--t-fast);
}
.deal-card:hover { border-color: var(--gold-line); }
.deal-card.dragging { opacity: 0.4; }

.deal-card-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; margin-bottom: 4px; }
.deal-company-title { font-size: 14px; font-weight: 600; line-height: 1.35; }
.deal-card-meta { font-size: 12px; color: var(--muted); margin-bottom: 10px; }
.deal-card-value { font-size: 17px; font-weight: 600; font-variant-numeric: tabular-nums; margin-bottom: 10px; }
.deal-card-value.unscoped { font-size: 13px; font-weight: 500; color: var(--dim); }

.deal-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-top: 10px;
  border-top: 1px solid var(--line-soft);
}
.deal-footer-left { display: flex; align-items: center; gap: 8px; min-width: 0; }

.quick-advance-btn {
  min-height: 32px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-full);
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  transition: all var(--t-fast);
}
.quick-advance-btn:hover { background: var(--gold); border-color: var(--gold); color: var(--ink); }

/* Delivery phase stepper on cards. */
.phase-track { display: flex; gap: 3px; margin-bottom: 10px; }
.phase-track span { flex: 1; height: 3px; border-radius: 2px; background: var(--line); }
.phase-track span.done { background: var(--gold); }

/* ---------- Analytics ---------- */

.analytics-dashboard-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: var(--gap);
}

.chart-card {
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 22px;
  background: var(--surface);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-card);
  min-width: 0;
}
.chart-card.col-6 { grid-column: span 6; }
.chart-card.col-12 { grid-column: span 12; }

.chart-title-wrap h3 { font-size: 17px; font-weight: 600; }
.chart-title-wrap p { font-size: 13px; color: var(--muted); margin-top: 2px; }

/* Single-hue magnitude bars with direct labels: text stays in text tokens. */
.bar-list { display: flex; flex-direction: column; gap: 14px; }

.bar-row { display: flex; flex-direction: column; gap: 6px; }

.bar-label-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 13px;
}
.bar-name { color: var(--text); font-weight: 500; }
.bar-meta { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; white-space: nowrap; }

.bar-track { height: 10px; background: var(--surface-2); border-radius: 4px; overflow: hidden; }
.bar-fill {
  height: 100%;
  min-width: 4px;
  background: var(--gold);
  border-radius: 0 4px 4px 0;
  transition: width 600ms var(--ease);
}
.bar-fill.is-zero { min-width: 0; }
.bar-fill.tone-won { background: var(--live); }
.bar-fill.tone-muted { background: var(--dim); }

.table-scroll { overflow-x: auto; }

.leaderboard-table { width: 100%; min-width: 620px; border-collapse: collapse; }

.leaderboard-table th {
  padding: 10px 14px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--dim);
  border-bottom: 1px solid var(--line);
  text-align: left;
}

.leaderboard-table td {
  padding: 14px;
  border-bottom: 1px solid var(--line-soft);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}
.leaderboard-table tbody tr:last-child td { border-bottom: none; }

/* ---------- Modal ---------- */

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(9, 9, 10, 0.78);
  backdrop-filter: blur(8px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 200ms ease;
}
.modal-backdrop.open { opacity: 1; pointer-events: auto; }

.modal-card {
  width: 100%;
  max-width: 640px;
  max-height: calc(100vh - 32px);
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  transform: translateY(12px);
  transition: transform 220ms var(--ease);
}
.modal-backdrop.open .modal-card { transform: none; }

.modal-card form { display: flex; flex-direction: column; min-height: 0; }

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 24px;
  border-bottom: 1px solid var(--line-soft);
}
.modal-header h3 { font-size: 18px; font-weight: 600; }

.modal-close-btn {
  width: var(--target);
  height: var(--target);
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
}
.modal-close-btn:hover { color: var(--text); background: var(--surface-2); }

.modal-body { padding: 20px 24px 8px; overflow-y: auto; }

.form-section { border: none; margin-bottom: 18px; }
.form-section legend { margin-bottom: 12px; }

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

.form-field-group { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }

.form-field-group label { font-size: 12px; font-weight: 500; color: var(--muted); }

.form-control-input, .form-control-select, .form-control-textarea {
  width: 100%;
  min-height: var(--target);
  background: var(--void);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 14px;
  transition: border-color var(--t-fast);
}
.form-control-input:focus, .form-control-select:focus, .form-control-textarea:focus {
  outline: none;
  border-color: var(--gold);
}
.form-control-input[aria-invalid="true"] { border-color: var(--alert); }
.form-control-input::placeholder, .form-control-textarea::placeholder { color: var(--dim); }
.form-control-input[type="date"] { color-scheme: dark; }
.form-control-textarea { resize: vertical; min-height: 96px; line-height: 1.55; }

.form-error { color: var(--alert); font-size: 13px; margin: 0 0 12px; }

.modal-footer {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 24px;
  border-top: 1px solid var(--line-soft);
}
.modal-footer-spacer { flex: 1; }

/* ---------- Toasts ---------- */

.toast-shelf {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.toast-item {
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 420px;
  padding: 12px 16px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-left: 3px solid var(--gold);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  pointer-events: auto;
  animation: slideInUp 220ms var(--ease);
  transition: opacity 200ms ease, transform 200ms ease;
}
.toast-item.is-error { border-left-color: var(--alert); }
.toast-item.leaving { opacity: 0; transform: translateY(8px); }

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

/* ---------- Shared small controls ---------- */

.btn-sm { min-height: 34px; padding: 0 12px; font-size: 12px; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }

.btn-link {
  background: none;
  border: none;
  padding: 4px 0;
  color: var(--gold-text);
  font-size: 13px;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.btn-link:hover { color: var(--gold-light); }

code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  padding: 1px 5px;
  border-radius: 4px;
  background: var(--surface-2);
}

.form-hint { font-size: 12px; color: var(--dim); margin: 2px 0 12px; line-height: 1.5; }
.field-label, .form-legend { font-size: 12px; font-weight: 500; color: var(--muted); }
.form-legend { margin-bottom: 8px; }

.chip-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.chip {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0 12px;
  border-radius: var(--radius-full);
  border: 1px solid var(--line);
  background: transparent;
  font-size: 12px;
  color: var(--text);
  text-align: left;
}
button.chip:hover { border-color: var(--gold-line); background: var(--surface-2); }
.chip-static { color: var(--muted); }

.tag-status-scheduled { border-color: var(--gold-line); color: var(--gold-text); }
.tag-status-sent { border-color: rgba(127, 212, 168, 0.45); color: var(--live); background: var(--live-wash); }
.tag-status-failed { border-color: rgba(232, 146, 124, 0.5); color: var(--alert); background: var(--alert-wash); }
.tag-status-cancelled { color: var(--dim); }

.success-line { display: flex; align-items: center; gap: 8px; color: var(--live); margin-bottom: 8px; }
.success-line strong { color: var(--text); }

.plain-list { margin: 12px 0 12px 18px; display: flex; flex-direction: column; gap: 8px; color: var(--muted); }
.plain-list strong { color: var(--text); font-weight: 600; }

.inline-form { display: flex; gap: 8px; align-items: stretch; flex-wrap: wrap; }
.inline-form .form-control-input { flex: 1 1 180px; width: auto; }

.item-list { list-style: none; display: flex; flex-direction: column; gap: 6px; margin: 10px 0 16px; }
.item-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}
.item-row > div:first-child, .item-row .check-inline { flex: 1; min-width: 0; }
.item-row.is-done .cell-title { text-decoration: line-through; color: var(--dim); }
.check-inline { display: flex; align-items: flex-start; gap: 10px; cursor: pointer; }
.check-inline input { margin-top: 3px; accent-color: var(--gold); width: 16px; height: 16px; flex-shrink: 0; }

/* ---------- Sign in ---------- */

.auth-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
}
.auth-card {
  width: 100%;
  max-width: 420px;
  padding: 32px;
  background: var(--surface);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-card);
}
.auth-brand { display: flex; align-items: center; gap: 14px; margin-bottom: 28px; }
.auth-card h1 { font-size: 24px; font-weight: 600; letter-spacing: -0.01em; }
.auth-lead { color: var(--muted); margin: 6px 0 22px; }
.auth-submit { width: 100%; margin-top: 4px; }
.auth-switch { margin-top: 18px; font-size: 13px; color: var(--muted); text-align: center; }

/* ---------- Top bar additions ---------- */

.gmail-btn.is-connected { border-color: rgba(127, 212, 168, 0.45); color: var(--live); }

.bell-btn { position: relative; }
.bell-badge {
  position: absolute;
  top: 4px;
  right: 4px;
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  border-radius: var(--radius-full);
  background: var(--alert);
  color: var(--ink);
  font-size: 10px;
  font-weight: 700;
  line-height: 17px;
  text-align: center;
}

.profile-menu-wrap { position: relative; }
.avatar-btn {
  width: var(--target);
  height: var(--target);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: transparent;
}
.avatar-btn:hover, .avatar-btn[aria-expanded="true"] { border-color: var(--gold-line); }
.avatar-btn .initials-sm { width: 32px; height: 32px; font-size: 11px; }

.profile-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  z-index: 200;
  min-width: 250px;
  padding: 6px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.45);
}
.profile-menu-head { padding: 10px 12px 12px; border-bottom: 1px solid var(--line-soft); margin-bottom: 6px; }
.profile-menu button {
  display: block;
  width: 100%;
  min-height: 40px;
  padding: 0 12px;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  text-align: left;
  font-size: 13px;
}
.profile-menu button:hover, .profile-menu button:focus-visible { background: var(--surface-2); outline: none; }
.profile-menu .menu-danger { color: var(--alert); }

/* ---------- Selection & bulk bar ---------- */

.select-cell { width: 44px; cursor: default; }
.row-check { accent-color: var(--gold); width: 16px; height: 16px; cursor: pointer; }
.leads-data-table th:first-child, .leads-data-table td:first-child { padding-right: 0; }
.leads-data-table tbody tr.is-selected { background: var(--gold-wash); }

.bulk-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  padding: 10px 14px;
  margin-bottom: 12px;
  border: 1px solid var(--gold-line);
  border-radius: var(--radius-md);
  background: var(--gold-wash);
  font-size: 13px;
  font-weight: 600;
}
.bulk-bar > span { margin-right: 6px; color: var(--gold-text); }

.card-scan {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  padding: 12px;
  margin-bottom: 18px;
  border: 1px dashed var(--gold-line);
  border-radius: var(--radius-md);
}

/* ---------- Dialogs & drawer ---------- */

.ui-dialog {
  width: min(560px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  margin: auto;
  padding: 0;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  overflow: hidden;
}
.ui-dialog[open] { display: flex; flex-direction: column; animation: fadeIn 200ms var(--ease); }
.ui-dialog::backdrop { background: rgba(9, 9, 10, 0.72); backdrop-filter: blur(6px); }
.ui-dialog-wide { width: min(760px, calc(100vw - 32px)); }

.ui-dialog-drawer {
  width: min(620px, 100vw);
  height: 100vh;
  max-height: 100vh;
  margin: 0 0 0 auto;
  border-radius: 0;
  border-width: 0 0 0 1px;
}
.ui-dialog-drawer[open] { animation: drawerIn 260ms var(--ease); }
@keyframes drawerIn { from { transform: translateX(40px); opacity: 0; } to { transform: none; opacity: 1; } }

.ui-dialog-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 20px 14px 24px;
  border-bottom: 1px solid var(--line-soft);
}
.ui-dialog-header h3 { font-size: 18px; font-weight: 600; line-height: 1.3; }
.ui-dialog-subtitle { color: var(--muted); font-size: 13px; margin-top: 2px; }
.ui-dialog-body { padding: 20px 24px; overflow-y: auto; flex: 1; }
.ui-dialog-body > p { margin-bottom: 10px; }
.ui-dialog-footer {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 24px;
  border-top: 1px solid var(--line-soft);
}

.drawer-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 18px; }
.drawer-actions:last-child { margin-bottom: 0; }

.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px 20px;
  margin-bottom: 16px;
}
.detail-grid dt {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--dim);
  margin-bottom: 3px;
}
.detail-grid dd { font-size: 14px; }
.detail-grid a { color: var(--gold-text); }

.drawer-notes {
  padding: 12px 14px;
  border-left: 2px solid var(--gold-line);
  background: var(--surface-alt);
  color: var(--muted);
  font-size: 13px;
  white-space: pre-wrap;
  margin-bottom: 18px;
}

.drawer-card {
  padding: 18px;
  margin-bottom: 16px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-md);
  background: var(--surface-alt);
}
.drawer-card-head { display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: 6px 12px; margin-bottom: 14px; }
.drawer-card-head h4 { font-size: 15px; font-weight: 600; }

.send-row { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; }
.send-row .form-field-group { flex: 1 1 260px; margin-bottom: 0; }

.email-preview {
  white-space: pre-wrap;
  padding: 14px;
  margin: 8px 0 12px;
  border-radius: var(--radius-sm);
  background: var(--void);
  border: 1px solid var(--line-soft);
  font-size: 13px;
  color: var(--muted);
  max-height: 260px;
  overflow-y: auto;
}
.email-preview strong { color: var(--text); }

.timeline { list-style: none; display: flex; flex-direction: column; gap: 12px; }
.timeline li { display: flex; gap: 10px; align-items: flex-start; font-size: 13px; }
.timeline .tag { flex-shrink: 0; margin-top: 1px; }

.pick-list {
  max-height: 210px;
  overflow-y: auto;
  margin-top: 8px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm);
}
.pick-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 40px;
  padding: 6px 12px;
  cursor: pointer;
  border-bottom: 1px solid var(--line-soft);
}
.pick-row:last-child { border-bottom: none; }
.pick-row:hover { background: var(--surface-2); }
.pick-row input { accent-color: var(--gold); width: 16px; height: 16px; }

/* ---------- Settings ---------- */

.settings-tabs { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 20px; border-bottom: 1px solid var(--line-soft); }
.settings-tab {
  min-height: 40px;
  padding: 0 14px;
  border: none;
  border-bottom: 2px solid transparent;
  background: none;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  margin-bottom: -1px;
}
.settings-tab:hover { color: var(--text); }
.settings-tab[aria-selected="true"] { color: var(--gold-text); border-bottom-color: var(--gold); }
.settings-form { margin-bottom: 24px; }
.settings-form .section-label { margin-bottom: 12px; }
.profile-head { display: flex; align-items: center; gap: 14px; margin-bottom: 20px; }
.initials-lg { width: 48px; height: 48px; border-radius: 50%; font-size: 15px; }
.smtp-row { flex-wrap: wrap; }

/* ---------- Meetings ---------- */

.meeting-day { margin-bottom: 28px; }
.meeting-day > .section-label { margin-bottom: 12px; }
.meeting-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(340px, 100%), 1fr)); gap: var(--gap); }
.meeting-grid.is-past { margin-top: 14px; opacity: 0.75; }

.meeting-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-card);
}
.meeting-card-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.meeting-card h3 { font-size: 16px; font-weight: 600; }
.meeting-when { color: var(--gold-text); font-size: 13px; font-weight: 500; margin-top: 2px; }
.meeting-purpose { color: var(--muted); font-size: 13px; }
.meeting-people { display: flex; flex-wrap: wrap; gap: 6px; }
.meeting-link { display: flex; align-items: center; gap: 8px; font-size: 13px; min-width: 0; color: var(--muted); }
.meeting-link a { color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.meeting-card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  padding-top: 12px;
  margin-top: auto;
  border-top: 1px solid var(--line-soft);
}
.meeting-actions { display: flex; gap: 6px; flex-wrap: wrap; }

.empty-panel {
  padding: 48px 16px;
  text-align: center;
  color: var(--muted);
  background: var(--surface);
  border: 1px dashed var(--line);
  border-radius: var(--radius-card);
  margin-bottom: 20px;
}
.empty-panel strong { display: block; color: var(--text); font-size: 16px; margin-bottom: 4px; }

/* ---------- AI workspace ---------- */

.workspace-form { display: flex; gap: 10px; max-width: 880px; }
.workspace-form .form-control-input { flex: 1; min-height: 52px; font-size: 15px; padding: 12px 16px; border-radius: var(--radius-md); background: var(--surface); }
.workspace-form .btn { min-height: 52px; padding: 0 26px; }
#workspaceExamples { max-width: 880px; margin: 12px 0 28px; }

.workspace-log { display: flex; flex-direction: column; gap: 14px; max-width: 880px; }
.ws-result {
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-card);
}
.ws-request { font-size: 15px; font-weight: 500; margin-bottom: 6px; }
.ws-reply { color: var(--muted); font-size: 13px; margin-bottom: 14px; }
.ws-result .detail-grid { margin-top: 12px; }
.ws-source { font-size: 11px; color: var(--dim); margin-top: 12px; letter-spacing: 0.06em; text-transform: uppercase; }

/* ---------- Responsive ---------- */

/* Six tabs plus the account controls need ~1960px on one line; below that the tabs get their own row. */
@media (max-width: 1960px) {
  .top-navbar { height: auto; flex-wrap: wrap; row-gap: 6px; padding-top: 12px; padding-bottom: 8px; }
  .nav-tabs-wrapper { order: 3; width: 100%; overflow-x: auto; }
}

@media (max-width: 1100px) {
  .chart-card.col-6 { grid-column: span 12; }
  .search-input-box { width: 200px; }
  #btnImport, .gmail-btn { width: var(--target); padding: 0; font-size: 0; gap: 0; }
}

@media (max-width: 720px) {
  :root { --gutter: 16px; }
  .navbar-actions { flex: 1; justify-content: flex-end; }
  .search-input-box { width: auto; flex: 1; min-width: 0; }
  .search-shortcut-kbd { display: none; }
  #btnNewLead { width: var(--target); padding: 0; font-size: 0; gap: 0; }
  .nav-tab-btn { padding: 0 12px; }
  .nav-tab-btn.active::after { left: 12px; right: 12px; }
  .brand-section { width: 100%; }
  .form-grid-2 { grid-template-columns: 1fr; }
  .section-title-wrap h2 { font-size: 22px; }
  .toast-shelf { left: 16px; right: 16px; }
  .kpi-strip-grid { grid-template-columns: 1fr 1fr; gap: 12px; }
  .kpi-value { font-size: 22px; }
  #btnExportCSV, #btnSmtp { display: none; }
  .detail-grid { grid-template-columns: 1fr; }
  .meeting-grid { grid-template-columns: 1fr; }
  .workspace-form { flex-direction: column; }
  .ui-dialog-body, .ui-dialog-header, .ui-dialog-footer { padding-left: 16px; padding-right: 16px; }
  .auth-card { padding: 24px 20px; }
}

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

/* 2-step login setup */
.qr-box { width: 184px; height: 184px; padding: 8px; background: #fff; border-radius: 8px; margin: 4px 0 12px; }
.qr-box svg { display: block; width: 100%; height: 100%; }
.secret-key { font-size: 13px; letter-spacing: 0.06em; color: var(--text); word-break: break-all; }
.recovery-codes { list-style: none; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 16px; margin: 12px 0 16px; padding: 0; }
.recovery-codes code { font-size: 14px; letter-spacing: 0.04em; color: var(--text); }

/* Sign-up consent, bot check and policy links */
.auth-consent { align-items: flex-start; gap: 10px; font-size: 13px; color: var(--muted); line-height: 1.5; margin: 4px 0 14px; }
.auth-consent input { margin-top: 3px; flex-shrink: 0; }
.auth-consent a, .ui-dialog-body p a { color: var(--gold-text); }
.turnstile-box { min-height: 65px; margin: 0 0 12px; }
.legal-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 18px; margin-top: 22px; font-size: 12px; }
.legal-links a { color: var(--dim); text-decoration: none; }
.legal-links a:hover { color: var(--gold-light); text-decoration: underline; }
