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

/* ── Design tokens ────────────────────────────────────────────────────────── */
:root {
  /* Surfaces */
  --bg:          #f8fafc;   /* warm app background */
  --bg-card:     #ffffff;   /* card surface */
  --bg-subtle:   #f1f5f9;   /* zebra / subtle fill */
  --border:      #e2e8f0;
  --border-strong: #cbd5e1;

  /* Text */
  --text:        #0f172a;
  --text-muted:  #475569;
  --text-faint:  #94a3b8;

  /* Sidebar (dark, slate) */
  --sidebar-bg:        #0f172a;
  --sidebar-bg-raised: #1e293b;
  --sidebar-border:    #1e293b;
  --sidebar-text:      #94a3b8;
  --sidebar-text-hover: #e2e8f0;
  --sidebar-active-bg: #1e3a8a;
  --sidebar-active-text: #eff6ff;

  /* Primary */
  --primary:      #2563eb;
  --primary-h:    #1d4ed8;
  --primary-50:   #eff6ff;
  --primary-100:  #dbeafe;
  --primary-600:  #2563eb;
  --primary-700:  #1d4ed8;

  /* Legacy alias kept for existing rules */
  --accent:      var(--primary);
  --accent-h:    var(--primary-h);

  /* Status */
  --success:      #059669;
  --success-h:    #047857;
  --success-50:   #ecfdf5;
  --success-700:  #047857;

  --warning:      #b45309;
  --warning-h:    #92400e;
  --warning-bg:   #fffbeb;
  --warning-50:   #fffbeb;
  --warning-700:  #b45309;
  --warning-bdr:  #fde68a;

  --danger:       #dc2626;
  --danger-h:     #b91c1c;
  --danger-50:    #fef2f2;
  --danger-700:   #b91c1c;

  --info-bg:     #eff6ff;
  --info-bdr:    #bfdbfe;
  --info-text:   #1e40af;
  --error:       var(--danger);
  --error-bg:    var(--danger-50);
  --error-bdr:   #fecaca;

  --neutral-50:   #f8fafc;
  --neutral-100:  #f1f5f9;
  --neutral-600:  #475569;
  --neutral-700:  #334155;

  /* Shape / motion */
  --shadow-sm:   0 1px 2px rgba(15,23,42,.06);
  --shadow:      0 1px 3px rgba(15,23,42,.08), 0 4px 16px rgba(15,23,42,.05);
  --shadow-md:   0 4px 12px rgba(15,23,42,.08), 0 12px 32px rgba(15,23,42,.06);
  --radius-sm:   6px;
  --radius:      10px;
  --radius-lg:   14px;
  --transition:  .16s ease;

  --sidebar-w:   232px;
}

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

body {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-feature-settings: "cv11", "ss01";
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

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

.sidebar {
  flex: 0 0 var(--sidebar-w);
  background: var(--sidebar-bg);
  padding: 1.25rem .9rem;
  display: flex;
  flex-direction: column;
  gap: .25rem;
  position: sticky;
  top: 0;
  align-self: flex-start;
  height: 100vh;
  overflow-y: auto;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: .55rem;
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: -.01em;
  color: #fff;
  margin-bottom: 1.25rem;
  padding: .4rem .5rem .9rem;
  border-bottom: 1px solid var(--sidebar-border);
}

.sidebar-brand-mark {
  width: 34px;
  height: 34px;
  object-fit: contain;
  flex-shrink: 0;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,.35));
}

.sidebar-close {
  display: none;
  margin-left: auto;
  background: none;
  border: none;
  color: var(--sidebar-text);
  cursor: pointer;
  padding: .25rem;
  border-radius: 6px;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: .15rem;
}

.sidebar-section-label {
  font-size: .68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: #475569;
  padding: .9rem .7rem .35rem;
}

.sidebar-link {
  position: relative;
  display: flex;
  align-items: center;
  gap: .65rem;
  padding: .55rem .7rem .55rem .8rem;
  border-radius: var(--radius-sm);
  font-size: .88rem;
  font-weight: 500;
  color: var(--sidebar-text);
  text-decoration: none;
  transition: background var(--transition), color var(--transition);
}

.sidebar-link svg { flex-shrink: 0; opacity: .85; }

.sidebar-link:hover { background: var(--sidebar-bg-raised); color: var(--sidebar-text-hover); }

.sidebar-link.active {
  background: var(--sidebar-active-bg);
  color: var(--sidebar-active-text);
  font-weight: 600;
}
.sidebar-link.active svg { opacity: 1; }

.sidebar-link.active::before {
  content: "";
  position: absolute;
  left: -.9rem;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 60%;
  background: var(--primary-600);
  border-radius: 0 3px 3px 0;
}

.sidebar-link-secondary {
  margin-top: .35rem;
  padding-top: .9rem;
  border-top: 1px solid var(--sidebar-border);
}

.sidebar-footer {
  margin-top: auto;
  padding: .9rem .7rem 0;
  border-top: 1px solid var(--sidebar-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: .5rem;
  font-size: .8rem;
  font-weight: 600;
  color: var(--sidebar-text-hover);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-user-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--sidebar-bg-raised);
  color: var(--sidebar-text-hover);
  font-size: .68rem;
  font-weight: 700;
  flex-shrink: 0;
}

.sidebar-logout {
  background: none;
  border: none;
  color: var(--sidebar-text);
  font-size: .78rem;
  font-weight: 600;
  cursor: pointer;
  padding: .3rem .4rem;
  border-radius: var(--radius-sm);
  transition: background var(--transition), color var(--transition);
}

.sidebar-logout:hover { background: var(--sidebar-bg-raised); color: #fff; }

/* Mobile top bar + hamburger toggle (hidden above 1024px).
   Positioned fixed (like .sidebar) so it doesn't become a flex sibling of
   .app-main inside the row-flex .app-shell, which would stretch it to the
   full page height instead of a slim top strip. */
.mobile-topbar {
  display: none;
  align-items: center;
  gap: .75rem;
  padding: .7rem 1rem;
  background: var(--sidebar-bg);
  color: #fff;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 52px;
  z-index: 35;
}

.mobile-topbar-brand {
  width: 28px;
  height: 28px;
  object-fit: contain;
  flex-shrink: 0;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,.35));
}

.mobile-topbar-brand-name {
  font-weight: 700;
  font-size: .95rem;
  letter-spacing: -.01em;
}

.sidebar-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.1rem;
  height: 2.1rem;
  background: var(--sidebar-bg-raised);
  border: none;
  border-radius: var(--radius-sm);
  color: #fff;
  cursor: pointer;
}

.sidebar-overlay {
  display: none;
}

.app-main {
  flex: 1;
  min-width: 0;
  padding: 2.25rem 2rem 4rem;
}

/* ── Layout ───────────────────────────────────────────────────────────────── */
.container       { max-width: 580px; }
.container-wide  { max-width: 1600px; }
.container-full  { max-width: none; }

.header-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.75rem;
}

h1 {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -.03em;
  color: var(--text);
}

.subtitle {
  color: var(--text-muted);
  font-size: .92rem;
  margin-top: .3rem;
}

/* Section label: used as a small heading inside a card, in place of a form <label>. */
.section-label {
  display: block;
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--text-muted);
}

/* ── Card ─────────────────────────────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition);
}

.card-flush { padding: 0; overflow: hidden; }

.hidden { display: none !important; }

/* ── Form ─────────────────────────────────────────────────────────────────── */
.form-group { margin-bottom: 1.25rem; }

/* Field group: visually separates a form into labeled sections, e.g. the
   scraper form's "Segmenteringskod" / "Omsättning" / "Max sidor" blocks. */
.field-group .form-group { margin-bottom: 0; }
.field-group + .field-group {
  border-top: 1px solid var(--border);
  margin-top: 1.5rem;
  padding-top: 1.5rem;
}

.field-label-icon {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
}
.field-label-icon svg { flex-shrink: 0; }

.field-icon-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
}
.field-icon-badge.icon-primary { background: var(--primary-50); color: var(--primary-600); }
.field-icon-badge.icon-success { background: var(--success-50); color: var(--success-700); }
.field-icon-badge.icon-warning { background: var(--warning-50); color: var(--warning-700); }
.field-icon-badge.icon-neutral { background: var(--bg-subtle);  color: var(--text-muted); }

.count-badge {
  display: inline-flex;
  align-items: center;
  font-size: .72rem;
  font-weight: 700;
  padding: .1rem .5rem;
  border-radius: 99px;
}
.count-badge.badge-success { background: var(--success-50); color: var(--success-700); }

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

label {
  display: block;
  font-size: .85rem;
  font-weight: 600;
  margin-bottom: .35rem;
}

.optional { font-weight: 400; color: var(--text-muted); }

.checkbox-label {
  display: flex;
  align-items: center;
  gap: .45rem;
  font-weight: 600;
  cursor: pointer;
  user-select: none;
}

.checkbox-label input[type="checkbox"] { cursor: pointer; accent-color: var(--accent); width: 16px; height: 16px; }

.county-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: .5rem .75rem;
  padding: .75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius, 8px);
  max-height: 220px;
  overflow-y: auto;
}

.county-checkbox { font-weight: 400; font-size: .88rem; }

input[type="text"],
input[type="password"],
input[type="number"],
input[type="file"],
input[type="datetime-local"],
textarea,
select {
  width: 100%;
  padding: .55rem .75rem;
  font-size: .95rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  color: var(--text);
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}

input:focus, select:focus, textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37,99,235,.12);
}

input::placeholder { color: #adb5c4; }

small {
  display: block;
  margin-top: .3rem;
  font-size: .78rem;
  color: var(--text-muted);
}

/* ── Alerts ───────────────────────────────────────────────────────────────── */
.alert {
  padding: .7rem 1rem;
  border-radius: 6px;
  font-size: .85rem;
  margin-top: .75rem;
  border: 1px solid transparent;
}

.alert-error   { background: var(--error-bg);   color: var(--error);    border-color: var(--error-bdr); }
.alert-warning { background: var(--warning-bg);  color: var(--warning);  border-color: var(--warning-bdr); }
.alert-info    { background: var(--info-bg);     color: var(--info-text);border-color: var(--info-bdr); }

.confirm-row { margin-top: .5rem; }

@keyframes shake {
  0%,100% { transform: translateX(0); }
  20%,60% { transform: translateX(-5px); }
  40%,80% { transform: translateX(5px); }
}
.shake { animation: shake .4s ease; }

/* ── Buttons ──────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .4rem;
  padding: .62rem 1.25rem;
  font-size: .88rem;
  font-weight: 600;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-decoration: none;
  transition: background var(--transition), border-color var(--transition), color var(--transition), transform var(--transition), box-shadow var(--transition);
}

.btn:active:not(:disabled) { transform: scale(.98); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(37,99,235,.25);
}

.btn-sm  { padding: .4rem .85rem; font-size: .81rem; }
.btn-xs  { padding: .24rem .6rem;  font-size: .74rem; font-weight: 600; border-radius: 5px; }
.btn-lg  { padding: .9rem 1.5rem; font-size: 1rem; }

.btn-spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255,255,255,.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .7s linear infinite;
}

.btn-primary { width: 100%; margin-top: .5rem; background: var(--primary-600); color: #fff; box-shadow: 0 1px 2px rgba(37,99,235,.25); }
.btn-primary:hover:not(:disabled) { background: var(--primary-h); }

.btn-success  { background: var(--success); color: #fff; }
.btn-success:hover:not(:disabled) { background: var(--success-h); }

.btn-secondary { background: var(--bg-subtle); color: var(--text); border-color: var(--border); }
.btn-secondary:hover:not(:disabled) { background: #e2e8f0; }

.btn-outline {
  background: var(--bg-card);
  color: var(--text);
  border: 1px solid var(--border-strong);
}
.btn-outline:hover:not(:disabled) { background: var(--bg-subtle); border-color: var(--text-faint); }

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
}
.btn-ghost:hover:not(:disabled) { background: var(--bg-subtle); color: var(--text); }

.btn-icon {
  padding: .5rem;
  width: 2.15rem;
  height: 2.15rem;
}

.btn-warning-outline {
  background: transparent;
  color: var(--warning-700);
  border: 1px solid var(--warning-bdr);
}
.btn-warning-outline:hover:not(:disabled) { background: var(--warning-bg); }

.btn-danger-outline {
  background: transparent;
  color: var(--danger-700);
  border: 1px solid #fecaca;
}
.btn-danger-outline:hover:not(:disabled) { background: var(--danger-50); }

.delete-item-btn:hover:not(:disabled) { background: var(--danger-50); color: var(--danger-700); }

/* ── Progress card ───────────────────────────────────────────────────────── */
.progress-header {
  display: flex;
  align-items: center;
  gap: .65rem;
  margin-bottom: 1.25rem;
}

.progress-header h2 { font-size: 1.15rem; font-weight: 700; }

.status-icon {
  font-size: 1.3rem;
  line-height: 1;
  width: 1.6rem;
  text-align: center;
  color: var(--accent);
}

.icon-done  { color: var(--success); }
.icon-error { color: var(--error); }

@keyframes spin { to { transform: rotate(360deg); } }
.spinning { display: inline-block; animation: spin 1.2s linear infinite; }

.progress-track {
  height: 8px;
  background: var(--border);
  border-radius: 99px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 99px;
  transition: width .4s ease;
}

.progress-label {
  font-size: .8rem;
  color: var(--text-muted);
  margin-top: .4rem;
  text-align: right;
}

.stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: .75rem;
  margin: 1.5rem 0;
}

.stat {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: .65rem .5rem;
  text-align: center;
}

.stat-value {
  display: block;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: -.02em;
}

.stat-label {
  display: block;
  font-size: .7rem;
  color: var(--text-muted);
  margin-top: .1rem;
}

.action-row { display: flex; gap: .75rem; flex-wrap: wrap; margin-top: 1rem; }

#stop-row { margin-top: 1rem; text-align: right; }

/* ── History table ───────────────────────────────────────────────────────── */
.history-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .87rem;
}

.history-table th {
  background: var(--bg-subtle);
  color: var(--text-muted);
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  padding: .75rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.history-table td {
  padding: .85rem 1rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.history-table tbody tr:last-child td { border-bottom: none; }
.history-table tbody tr:nth-child(even) td { background: var(--bg-subtle); }
.history-table tbody tr:hover td { background: var(--primary-50); }

/* Keep the company name visible while scrolling a wide table horizontally. */
#items-table th:first-child,
#items-table .item-row > td:first-child {
  position: sticky;
  left: 0;
  z-index: 2;
  background: var(--bg-card);
  border-right: 1px solid var(--border);
}
#items-table th:first-child { background: var(--bg-subtle); z-index: 3; }
#items-table .item-row:hover > td:first-child { background: var(--primary-50); }

.job-code  { font-weight: 600; font-size: .9rem; display: block; }
.job-label { font-size: .75rem; color: var(--text-muted); display: block; margin-top: .1rem; }
.job-branch { font-size: .75rem; color: var(--accent); display: block; }

.text-muted  { color: var(--text-muted); }
.text-xs     { font-size: .76rem; }
.text-center { text-align: center; }

/* "Ring"-link: phone number with a small handset icon, used in item tables. */
.phone-link {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  color: var(--primary-700);
  font-weight: 600;
  text-decoration: none;
}
.phone-link svg { flex-shrink: 0; opacity: .8; }
.phone-link:hover { text-decoration: underline; }

/* Status badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  padding: .25rem .6rem;
  border-radius: 99px;
  font-size: .68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  white-space: nowrap;
}

.badge-done    { background: var(--success-50); color: var(--success-700); }
.badge-running { background: var(--primary-50); color: var(--primary-700); }
.badge-failed  { background: var(--danger-50);  color: var(--danger-700); }
.badge-paused  { background: var(--warning-50); color: var(--warning-700); }
.badge-pending { background: var(--bg-subtle);  color: var(--text-muted); }

/* Dialer status badges */
.badge-not_called     { background: var(--bg-subtle);  color: var(--text-muted); }
.badge-no_answer      { background: var(--warning-50); color: var(--warning-700); }
.badge-wrong_number   { background: var(--bg-subtle);  color: var(--neutral-600); }
.badge-not_interested { background: var(--danger-50);  color: var(--danger-700); }
.badge-interested     { background: var(--primary-50); color: var(--primary-700); }
.badge-meeting_booked { background: var(--success-50); color: var(--success-700); }
.badge-archived       { background: var(--bg-subtle);  color: var(--text-muted); margin-left: .5rem; }

/* ── Call log panel ──────────────────────────────────────────────────────── */
.call-panel-row td, .contact-edit-row td {
  background: var(--bg-card);
  padding: 1rem 1.5rem;
}

.call-panel {
  display: grid;
  grid-template-columns: minmax(280px, 1.1fr) minmax(220px, 1fr);
  gap: 1.5rem;
  align-items: start;
}

.call-form .form-row { margin-bottom: .75rem; }
.call-form textarea { resize: vertical; min-height: 2.4rem; }
.call-form-error { margin-top: .5rem; }

.call-history {
  display: flex;
  flex-direction: column;
  gap: .6rem;
  max-height: 220px;
  overflow-y: auto;
}

.call-entry {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: .6rem .75rem;
}

.call-entry-head {
  display: flex;
  align-items: center;
  gap: .5rem;
  margin-bottom: .3rem;
}

.call-note { color: var(--text); margin-top: .2rem; }

/* ── Focus mode (one company at a time) ──────────────────────────────────── */
.focus-name { font-size: 1.6rem; margin-top: .2rem; }

.container-focus { max-width: 580px; }

.focus-card { display: flex; flex-direction: column; gap: 1.5rem; }

.focus-left { display: flex; flex-direction: column; gap: 1.5rem; }

/* On wide screens, spread the focus card into two columns instead of one
   narrow left-aligned strip: contact/info on the left, the call form on
   the right. Keeps the mobile/tablet stacked layout untouched below this. */
@media (min-width: 1024px) {
  .container-focus { max-width: 1100px; }

  .focus-card {
    display: grid;
    grid-template-columns: minmax(300px, 380px) 1fr;
    gap: 2.5rem;
    padding: 2.25rem;
  }

  .focus-right { display: flex; flex-direction: column; justify-content: center; }
}

.focus-meta {
  display: flex;
  align-items: center;
  gap: .6rem;
}

.focus-contact {
  display: flex;
  justify-content: center;
  padding: 1.5rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.focus-phone {
  font-size: 1.7rem;
  font-weight: 700;
  color: var(--accent);
  text-decoration: none;
}

.focus-phone-empty {
  color: var(--text-muted);
  font-weight: 600;
  font-size: 1rem;
}

.focus-info {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.focus-info-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: .75rem;
  padding: .6rem .9rem;
  font-size: .85rem;
  border-bottom: 1px solid var(--border);
}

.focus-info-row:last-child { border-bottom: none; }

.focus-info-row a { color: var(--accent); }

.focus-info-label {
  font-size: .72rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .04em;
  flex-shrink: 0;
}

.focus-layout {
  margin-top: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.focus-main { display: flex; flex-direction: column; gap: 1.25rem; }

.focus-nav {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
}

.focus-nav .btn {
  flex: 1;
  padding: .9rem 1.5rem;
  font-size: .95rem;
  min-height: 52px;
}

.focus-history { margin-top: 0; }

/* On wide screens, the call history sits beside the main card + nav
   instead of underneath it. */
@media (min-width: 1024px) {
  .focus-layout {
    display: grid;
    grid-template-columns: 1fr minmax(320px, 400px);
    gap: 2rem;
    align-items: start;
  }
}

.btn-disabled-link {
  opacity: .4;
  pointer-events: none;
}

/* ── Opportunity pipeline ─────────────────────────────────────────────────── */
.opportunity-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  align-items: start;
}

.opportunity-card { padding: 0; overflow: hidden; }

.opportunity-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.15rem 1.5rem;
  border-bottom: 1px solid var(--border);
}

.opportunity-card-heading { display: flex; align-items: center; gap: .75rem; }

.opportunity-card-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
}

.opportunity-card-icon-primary { background: var(--primary-50); color: var(--primary-600); }
.opportunity-card-icon-success { background: var(--success-50); color: var(--success-700); }

.opportunity-col-title {
  font-size: .98rem;
  font-weight: 700;
  color: var(--text);
}

.opportunity-card-heading .text-muted { margin-top: .1rem; }

.opportunity-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.75rem;
  height: 1.75rem;
  padding: 0 .5rem;
  border-radius: 99px;
  background: var(--bg-subtle);
  color: var(--text-muted);
  font-size: .82rem;
  font-weight: 700;
  flex-shrink: 0;
}

/* Opportunity table: a <table> in markup (so it plays nicely with the shared
   call-panel-row JS), but rendered as a plain stack of mini-cards rather than
   a data table — every item-row collapses to a single full-width <td>. */
.opportunity-table { width: 100%; border-collapse: collapse; }
.opportunity-table, .opportunity-table tbody, .opportunity-table tr, .opportunity-table td { display: block; width: 100%; }
.opportunity-table tr.item-row > td { padding: 0; }

.opp-card {
  display: flex;
  flex-direction: column;
  gap: .45rem;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border);
  transition: background var(--transition);
}

/* Each item-row is followed by its call-panel-row sibling, so the last
   visible item-row is the second-to-last <tr> in the tbody, not the last. */
.opportunity-table tr.item-row:nth-last-child(2) .opp-card { border-bottom: none; }

.opp-card:hover { background: var(--bg-subtle); }

.opp-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: .75rem;
}

.opp-card-name { font-size: .92rem; }
.opp-card-name a { display: block; font-size: .74rem; color: var(--text-muted); margin-top: .1rem; }

.opp-card-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: .4rem;
  font-size: .78rem;
  color: var(--text-muted);
}

.opp-card-meta .phone-link { font-size: .78rem; }

.opp-meta-list { color: var(--text-muted); text-decoration: none; }
.opp-meta-list:hover { color: var(--primary-700); text-decoration: underline; }

.opp-meta-sep { color: var(--border-strong); }
.follow-up-cell:empty { display: none; }
.opp-meta-sep:has(+ .follow-up-cell:empty) { display: none; }

.opp-card-actions { display: flex; gap: .4rem; margin-top: .1rem; }

.opportunity-empty {
  padding: 2.75rem 1.5rem;
  text-align: center;
  color: var(--text-muted);
  font-size: .85rem;
}

/* The opportunity columns are much narrower than a full-width table, so the
   call-log form and history stack instead of squeezing side by side. */
.opportunity-table .call-panel { grid-template-columns: 1fr; }

@media (max-width: 900px) {
  .opportunity-columns { grid-template-columns: 1fr; }
}

/* Mini progress bar in history */
.mini-bar-track {
  height: 4px;
  background: var(--border);
  border-radius: 99px;
  overflow: hidden;
  margin-bottom: .2rem;
  min-width: 60px;
}

.mini-bar-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 99px;
}

.action-cell { display: flex; align-items: center; gap: .35rem; justify-content: flex-end; flex-wrap: nowrap; }

/* ── Export bar ───────────────────────────────────────────────────────────── */
.export-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  padding: .75rem 0 .75rem;
  margin-bottom: .5rem;
}

.export-bar-left  { display: flex; align-items: center; gap: .75rem; }
.export-bar-right { display: flex; align-items: center; gap: .5rem; }

.cb-select-all {
  display: flex;
  align-items: center;
  gap: .4rem;
  font-size: .85rem;
  font-weight: 600;
  cursor: pointer;
  color: var(--text-muted);
  user-select: none;
}

.cb-select-all input[type="checkbox"] { cursor: pointer; accent-color: var(--accent); }

.selected-count {
  font-size: .8rem;
  color: var(--accent);
  font-weight: 600;
  min-width: 3ch;
}

.th-cb, .td-cb {
  width: 36px;
  padding-left: 1rem !important;
  padding-right: 0 !important;
}

.td-cb input[type="checkbox"] { cursor: pointer; accent-color: var(--accent); }

.job-row.selected { background: var(--primary-50); }

/* Empty state */
.empty-state {
  text-align: center;
  padding: 4.5rem 2rem;
  color: var(--text-muted);
  position: relative;
  overflow: hidden;
  background-image: radial-gradient(circle at 50% 0%, var(--primary-50) 0%, transparent 62%);
}

.empty-state-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 76px;
  height: 76px;
  border-radius: 50%;
  background: var(--success-50);
  box-shadow: 0 0 0 8px rgba(5,150,105,.07);
  font-size: 2.1rem;
  line-height: 1;
  margin-bottom: 1.35rem;
  position: relative;
}

.empty-state-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: .4rem;
}

.empty-state-text {
  font-size: .88rem;
  color: var(--text-muted);
  max-width: 380px;
  margin: 0 auto;
}

/* ── Dialer: filters, tabs, mapping ──────────────────────────────────────── */
.filter-input {
  padding: .5rem .75rem;
  font-size: .85rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  color: var(--text);
  transition: border-color var(--transition), box-shadow var(--transition);
}

.filter-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37,99,235,.12);
}

/* Search input with a leading icon: wrap the <input> in
   <div class="search-field"><svg class="search-field-icon">…</svg><input …></div> */
.search-field { position: relative; }

.search-field-icon {
  position: absolute;
  left: .65rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-faint);
  pointer-events: none;
}

.search-field input.filter-input { padding-left: 2.2rem; }

.select-field { position: relative; display: inline-flex; }

.select-field select.filter-input {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  padding-right: 2.2rem;
  cursor: pointer;
}

.select-field-icon {
  position: absolute;
  right: .6rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-faint);
  pointer-events: none;
}

.notes-input {
  width: 100%;
  min-width: 140px;
  padding: .3rem .5rem;
  font-size: .82rem;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--bg-card);
  color: var(--text);
}

.save-indicator {
  font-size: .78rem;
  color: var(--text-muted);
  min-width: 5rem;
  text-align: right;
}

.tabs {
  display: flex;
  gap: .5rem;
  margin-bottom: 1rem;
}

.tab-btn {
  display: inline-block;
  padding: .5rem 1rem;
  font-size: .85rem;
  font-weight: 600;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-card);
  color: var(--text-muted);
  text-decoration: none;
  cursor: pointer;
  transition: background var(--transition), color var(--transition), border-color var(--transition);
}

.tab-btn.active { background: var(--accent); color: #fff; border-color: var(--accent); }

/* Segmented control: a single pill-shaped track with a floating "chip" for
   the active segment, e.g. Aktiva/Arkiverade toggles. */
.segmented-control {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 1.25rem;
}

.segmented-control-btn {
  display: inline-flex;
  align-items: center;
  padding: .4rem .95rem;
  font-size: .83rem;
  font-weight: 600;
  color: var(--text-muted);
  background: transparent;
  border-radius: calc(var(--radius-sm) - 2px);
  text-decoration: none;
  cursor: pointer;
  transition: background var(--transition), color var(--transition), box-shadow var(--transition);
}

.segmented-control-btn:hover { color: var(--text); }

.segmented-control-btn.active {
  background: var(--bg-card);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}

.mapping-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: .75rem 1rem;
  margin: 1rem 0;
}

.mapping-grid select {
  width: 100%;
  padding: .5rem .6rem;
  font-size: .85rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-card);
  color: var(--text);
}

.table-scroll {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-top: .5rem;
}

/* ── Revenue inputs row ───────────────────────────────────────────────────── */
.rev-row {
  display: flex;
  align-items: center;
  gap: .6rem;
  margin-bottom: .75rem;
}

.rev-row input[type="number"] {
  flex: 1;
  min-width: 0;
}

.rev-dash {
  color: var(--text-muted);
  flex-shrink: 0;
  font-size: 1.1rem;
  line-height: 1;
  margin-top: .1rem;
}

.rev-input-wrap { position: relative; flex: 1; min-width: 0; }
.rev-input-wrap input[type="number"] { width: 100%; padding-right: 3rem; }
.rev-suffix {
  position: absolute;
  right: .75rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: .78rem;
  font-weight: 600;
  color: var(--text-faint);
  pointer-events: none;
}

.preset-rows { margin-top: .85rem; display: flex; flex-direction: column; gap: .5rem; }

.preset-row { display: flex; align-items: center; gap: .5rem; }

.preset-row-label {
  flex-shrink: 0;
  width: 2.6rem;
  font-size: .8rem;
  font-weight: 600;
  color: var(--text-muted);
}

.preset-chips { display: flex; flex-wrap: wrap; gap: .4rem; }

.chip-btn {
  padding: .3rem .65rem;
  font-size: .8rem;
  font-weight: 600;
  border: 1px solid var(--border);
  border-radius: 99px;
  background: var(--bg-card);
  color: var(--text);
  cursor: pointer;
}

.chip-btn:hover { border-color: var(--warning); color: var(--warning-700); }

.chip-btn.active { background: var(--warning); border-color: var(--warning); color: #fff; }

/* ── Dual range slider ────────────────────────────────────────────────────── */
.dual-range {
  position: relative;
  height: 36px;
  display: flex;
  align-items: center;
  margin-top: .25rem;
}

.dr-track {
  position: absolute;
  left: 0;
  right: 0;
  height: 5px;
  background: var(--border);
  border-radius: 99px;
  z-index: 1;
}

.dr-fill {
  position: absolute;
  height: 5px;
  background: var(--warning);
  border-radius: 99px;
}

.dr-input {
  position: absolute;
  width: 100%;
  height: 0;
  top: 50%;
  margin: 0;
  padding: 0;
  background: none;
  border: none;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
  pointer-events: none;
  z-index: 3;
}

/* Webkit thumb */
.dr-input::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--warning);
  border: 3px solid #fff;
  box-shadow: 0 1px 5px rgba(0,0,0,.25);
  cursor: grab;
  pointer-events: all;
  transition: transform .15s, box-shadow .15s;
}

.dr-input::-webkit-slider-thumb:hover {
  transform: scale(1.15);
  box-shadow: 0 0 0 6px rgba(180,83,9,.15), 0 1px 5px rgba(0,0,0,.2);
}

.dr-input::-webkit-slider-thumb:active { cursor: grabbing; }

/* Firefox thumb */
.dr-input::-moz-range-thumb {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--warning);
  border: 3px solid #fff;
  box-shadow: 0 1px 5px rgba(0,0,0,.25);
  cursor: grab;
  pointer-events: all;
}

.dr-input::-moz-range-thumb:hover {
  box-shadow: 0 0 0 6px rgba(180,83,9,.15), 0 1px 5px rgba(0,0,0,.2);
}

/* ── Dashboard ────────────────────────────────────────────────────────────── */
.stats-row-lg { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 1rem; }

/* Metric card: icon chip + value/label, layered on top of the base .stat card. */
.stat-metric {
  display: flex;
  align-items: center;
  gap: .9rem;
  text-align: left;
  padding: 1.1rem 1.25rem;
}

.stat-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
}

.stat-icon svg { width: 20px; height: 20px; }

.stat-icon-primary { background: var(--primary-50); color: var(--primary-600); }
.stat-icon-success { background: var(--success-50); color: var(--success-700); }
.stat-icon-warning { background: var(--warning-50); color: var(--warning-700); }
.stat-icon-neutral { background: var(--bg-subtle);  color: var(--text-muted); }

.stats-row-lg .stat-value { font-size: 1.65rem; font-weight: 800; }
.stats-row-lg .stat-label { font-size: .74rem; margin-top: .15rem; }

.badge-active { background: var(--success-50); color: var(--success-700); }

/* Outcome / status fill colors, shared by the two bar charts and the per-user cards. */
.chart-fill-not_called     { background: var(--border-strong); }
.chart-fill-no_answer      { background: #d97706; }
.chart-fill-wrong_number   { background: #64748b; }
.chart-fill-not_interested { background: var(--danger); }
.chart-fill-interested     { background: var(--primary-600); }
.chart-fill-meeting_booked { background: var(--success); }

.dashboard-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}

.chart-bars { display: flex; flex-direction: column; gap: .65rem; }

.chart-bar-row {
  display: grid;
  grid-template-columns: 108px 1fr 34px;
  align-items: center;
  gap: .75rem;
  font-size: .85rem;
}

.chart-bar-row-sm { grid-template-columns: 96px 1fr 28px; font-size: .78rem; }

.chart-bar-label { color: var(--text-muted); font-weight: 600; }

.chart-bar-track {
  height: 10px;
  background: var(--border);
  border-radius: 99px;
  overflow: hidden;
}

.chart-bar-fill { height: 100%; border-radius: 99px; transition: width .4s ease; }

.chart-bar-value {
  text-align: right;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

/* Funnel */
.funnel-row {
  display: flex;
  align-items: stretch;
  gap: .5rem;
  flex-wrap: wrap;
}

.funnel-stage {
  position: relative;
  flex: 1;
  min-width: 110px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 1.1rem .75rem;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color var(--transition), background var(--transition);
}

.funnel-stage-final {
  border-color: #a7f3d0;
  background: var(--success-50);
  box-shadow: 0 0 0 1px #a7f3d0 inset;
}

.funnel-value { font-size: 1.7rem; font-weight: 800; letter-spacing: -.03em; color: var(--text); }
.funnel-label { font-size: .78rem; color: var(--text-muted); margin-top: .2rem; font-weight: 500; }
.funnel-pct {
  font-size: .68rem;
  font-weight: 700;
  color: var(--primary-700);
  background: var(--primary-50);
  border-radius: 99px;
  padding: .12rem .5rem;
  margin-top: .5rem;
}
.funnel-stage-final .funnel-pct { color: var(--success-700); background: #dcfce7; }
.funnel-stage-final .funnel-value { color: var(--success-700); }

.funnel-arrow {
  display: flex;
  align-items: center;
  color: var(--text-faint);
  flex-shrink: 0;
}
.funnel-arrow svg { width: 18px; height: 18px; }

/* Trend chart */
.trend-chart {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 160px;
  padding: 0 .25rem;
  border-bottom: 1px solid var(--border);
}

.trend-bar-col {
  flex: 1;
  height: 100%;
  display: flex;
  align-items: flex-end;
  min-width: 3px;
}

.trend-bar {
  width: 100%;
  min-height: 2px;
  background: #bfdbfe;
  border-radius: 2px 2px 0 0;
  display: flex;
  flex-direction: column-reverse;
  overflow: hidden;
  transition: height .3s ease;
}

.trend-bar-positive { width: 100%; background: var(--success); }

.trend-axis {
  display: flex;
  gap: 3px;
  padding: .3rem .25rem 0;
}

.trend-axis-label {
  flex: 1;
  min-width: 3px;
  font-size: .68rem;
  color: var(--text-muted);
  text-align: center;
  white-space: nowrap;
}

.trend-legend {
  display: flex;
  gap: 1.25rem;
  margin-top: .75rem;
  font-size: .78rem;
  color: var(--text-muted);
}

.trend-legend-item { display: flex; align-items: center; gap: .4rem; }

.trend-legend-swatch {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  display: inline-block;
}

.trend-legend-total { background: #bfdbfe; }
.trend-legend-positive { background: var(--success); }

/* Per-user comparison cards */
.user-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.5rem;
}

.user-stat-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  background: var(--bg-card);
}

.user-stat-card h3 { font-size: 1rem; margin-bottom: .9rem; }

.user-stat-summary {
  display: flex;
  gap: 1.5rem;
}

.user-stat-value {
  display: block;
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: -.02em;
}

.user-stat-label {
  display: block;
  font-size: .7rem;
  color: var(--text-muted);
  margin-top: .1rem;
}

/* ── Tablet / mobile: sidebar becomes an off-canvas drawer ──────────────────
   Below 1024px the sidebar is hidden off-screen and toggled via the
   hamburger button in .mobile-topbar. The narrower phone breakpoint further
   down replaces this with a fixed bottom tab bar instead. */
@media (max-width: 1023px) {
  .app-shell { position: relative; }

  .mobile-topbar { display: flex; }

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: var(--sidebar-w);
    z-index: 50;
    transform: translateX(-100%);
    transition: transform .22s ease;
    overflow-y: auto;
    box-shadow: var(--shadow-md);
  }

  .sidebar-close { display: inline-flex; align-items: center; justify-content: center; }

  .sidebar-overlay {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, .5);
    z-index: 45;
    opacity: 0;
    pointer-events: none;
    transition: opacity .22s ease;
  }

  .app-shell.sidebar-open .sidebar { transform: translateX(0); }
  .app-shell.sidebar-open .sidebar-overlay { opacity: 1; pointer-events: auto; }

  .app-main { padding: calc(52px + 1.5rem) 1.25rem 3rem; }
}

/* ── Mobile / responsive ──────────────────────────────────────────────────── */
@media (max-width: 700px) {
  /* Forms: single column, and stacked page headers so long titles + action
     buttons don't overflow a narrow screen. */
  .form-row { grid-template-columns: 1fr; }

  .header-row {
    flex-direction: column;
    align-items: stretch;
    gap: .75rem;
  }
  .header-row .action-cell { flex-wrap: wrap; }

  /* Call-log widget: form and history stack instead of sitting side by side. */
  .call-panel { grid-template-columns: 1fr; }

  /* Bigger tap targets everywhere a call/queue/list-detail page has a button,
     without shrinking the compact scraper tables (those keep .btn-xs/.btn-sm). */
  .btn:not(.btn-xs):not(.btn-sm) { min-height: 44px; }
  .call-toggle, .move-select, #status-filter, #search-input {
    min-height: 44px;
  }

  /* App shell: vertical sidebar becomes a fixed bottom tab bar, with the
     signed-in user + logout pinned to a slim bar at the top instead. Below
     700px we don't use the tablet drawer/hamburger — everything important
     is reachable without it, so hide those and restore normal flow. */
  .app-shell { flex-direction: column; }

  .mobile-topbar, .sidebar-overlay { display: none !important; }

  .sidebar {
    position: static;
    transform: none;
    box-shadow: none;
    flex: none;
    width: 100%;
    height: auto;
    padding: 0;
    border-right: none;
  }

  .sidebar-brand { display: none; }

  .sidebar-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    flex-direction: row;
    gap: 0;
    background: var(--bg-card);
    border-top: 1px solid var(--border);
    z-index: 40;
    padding-bottom: env(safe-area-inset-bottom, 0);
  }

  .sidebar-nav .sidebar-link {
    flex: 1;
    flex-direction: column;
    gap: .2rem;
    text-align: center;
    padding: .5rem .25rem;
    border-radius: 0;
    font-size: .64rem;
    min-height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
  }

  .sidebar-nav .sidebar-link:hover { background: var(--bg-subtle); color: var(--text); }

  .sidebar-nav .sidebar-link.active {
    background: var(--primary-50);
    color: var(--primary-700);
  }
  .sidebar-nav .sidebar-link.active::before { display: none; }

  .sidebar-nav .sidebar-link-secondary { display: none; }

  /* The dark, sidebar-tuned user/logout styles need to flip to a light
     palette here since .sidebar-footer becomes a white top bar on phones. */
  .sidebar-user { color: var(--text); }
  .sidebar-user-avatar { background: var(--bg-subtle); color: var(--text-muted); }
  .sidebar-logout { color: var(--text-muted); }
  .sidebar-logout:hover { background: var(--bg-subtle); color: var(--text); }

  .sidebar-footer {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    margin-top: 0;
    padding: .6rem 1rem;
    border-top: none;
    border-bottom: 1px solid var(--border);
    background: var(--bg-card);
    z-index: 40;
  }

  .app-main { padding: 3.5rem 1rem 5rem; }

  /* Data tables: each row becomes a labeled card instead of a horizontally
     scrolling table. Requires a data-label attribute per <td>. */
  .responsive-table thead { display: none; }
  .responsive-table, .responsive-table tbody { display: block; width: 100%; }

  .responsive-table tr.item-row {
    display: block;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: .75rem;
    overflow: hidden;
  }

  .responsive-table td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: .75rem;
    padding: .55rem .9rem;
    border-bottom: 1px solid var(--border);
    text-align: right;
  }
  .responsive-table tr.item-row td:last-child { border-bottom: none; }

  .responsive-table td::before {
    content: attr(data-label);
    font-size: .7rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: .04em;
    flex-shrink: 0;
    text-align: left;
  }
  .responsive-table td[data-label=""]::before { content: none; }

  .responsive-table td:first-child {
    position: static;
    border-right: none;
    background: transparent;
    flex-direction: column;
    align-items: flex-start;
    text-align: left;
  }
  .responsive-table td:first-child::before { display: none; }

  .responsive-table tr.call-panel-row,
  .responsive-table tr.contact-edit-row {
    display: block;
    margin: -.75rem 0 .75rem;
  }
  .responsive-table tr.call-panel-row td,
  .responsive-table tr.contact-edit-row td {
    display: block;
    text-align: left;
    border-bottom: none;
  }
  .responsive-table .call-panel-row td::before,
  .responsive-table .contact-edit-row td::before { content: none; }

  /* Dashboard: columns stack, funnel wraps to a 2x2 grid, bar labels shrink. */
  .dashboard-columns { grid-template-columns: 1fr; }

  .funnel-row { justify-content: center; }
  .funnel-stage { min-width: calc(50% - .5rem); }
  .funnel-arrow { display: none; }

  .chart-bar-row { grid-template-columns: 78px 1fr 30px; gap: .5rem; }
  .chart-bar-row-sm { grid-template-columns: 78px 1fr 26px; }

  .user-stat-summary { flex-wrap: wrap; gap: 1rem 1.5rem; }
}

/* ── Meeting-booked celebration ──────────────────────────────────────────── */
.celebration-toast {
  position: fixed;
  top: 1.5rem;
  left: 50%;
  transform: translate(-50%, -30px) scale(.9);
  opacity: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  gap: .75rem;
  max-width: min(420px, calc(100vw - 2rem));
  padding: 1rem 1.4rem;
  background: linear-gradient(135deg, #4338ca, #2563eb);
  color: #fff;
  border-radius: var(--radius-lg);
  box-shadow: 0 12px 32px rgba(37,99,235,.35), 0 2px 10px rgba(0,0,0,.18);
  transition: transform .35s cubic-bezier(.34,1.56,.64,1), opacity .35s ease;
  pointer-events: none;
}

.celebration-toast.show { transform: translate(-50%, 0) scale(1); opacity: 1; }
.celebration-toast.hide { transform: translate(-50%, -12px) scale(.96); opacity: 0; }

.celebration-emoji {
  font-size: 1.8rem;
  flex-shrink: 0;
  animation: celebration-bounce .9s ease infinite;
}

.celebration-text {
  font-weight: 700;
  font-size: .95rem;
  line-height: 1.35;
}

@keyframes celebration-bounce {
  0%, 100% { transform: translateY(0) rotate(-8deg); }
  50% { transform: translateY(-6px) rotate(8deg); }
}

.celebration-confetti {
  position: fixed;
  inset: 0;
  z-index: 199;
  pointer-events: none;
  overflow: hidden;
}

.confetti-piece {
  position: absolute;
  top: -12px;
  width: 8px;
  height: 14px;
  border-radius: 2px;
  opacity: .9;
  animation-name: confetti-fall;
  animation-timing-function: cubic-bezier(.4, 0, .6, 1);
  animation-fill-mode: forwards;
}

@keyframes confetti-fall {
  0%   { transform: translateY(0) rotate(0deg); opacity: 1; }
  100% { transform: translateY(105vh) rotate(720deg); opacity: 0; }
}

@media (max-width: 1023px) {
  .celebration-toast { top: 4.5rem; }
}

@media (max-width: 700px) {
  .celebration-toast { top: 6.5rem; font-size: .92rem; }
}
