/* ============================================================
   Leverport App – Light Professional SaaS Design System
   Dark Sidebar · White Content · Clean & Productive
   Inspired by Linear, Stripe Dashboard, Notion, Framer
   ============================================================ */

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

:root {
  /* ── App Canvas ─────────────────────────────────────── */
  --bg-app:      #f1f5f9;   /* page background            */
  --bg-card:     #ffffff;   /* cards, panels              */
  --bg-hover:    #f8fafc;   /* row hover, subtle surfaces */
  --bg-input:    #ffffff;   /* form inputs                */

  /* ── Borders ─────────────────────────────────────────── */
  --border:      #e2e8f0;   /* standard border            */
  --border-sm:   #f1f5f9;   /* very subtle separator      */
  --border-focus:#255deb;   /* input focus                */

  /* ── Text Hierarchy ──────────────────────────────────── */
  --text-1: #0f172a;   /* headings, primary text          */
  --text-2: #475569;   /* body, descriptions              */
  --text-3: #94a3b8;   /* muted, placeholders             */
  --text-4: #cbd5e1;   /* very faint                      */

  /* ── Brand ───────────────────────────────────────────── */
  --blue:    #255deb;
  --blue-l:  #3b82f6;
  --blue-ll: #60a5fa;
  --blue-bg: #eff6ff;
  --blue-border: #bfdbfe;

  /* ── Semantic ────────────────────────────────────────── */
  --green:      #10b981;
  --green-bg:   #f0fdf4;
  --green-border:#bbf7d0;

  --red:        #ef4444;
  --red-bg:     #fef2f2;
  --red-border: #fecaca;

  --amber:      #f59e0b;
  --amber-bg:   #fffbeb;
  --amber-border:#fde68a;

  --purple:     #1d4ed8;
  --purple-bg:  #eef4fe;
  --purple-border:#cfe0fc;

  /* ── Legacy aliases ──────────────────────────────────── */
  --primary:       #255deb;
  --primary-dark:  #1d4ed8;
  --primary-light: #eff6ff;
  --navy:          #0f172a;
  --navy-deep:     #020617;
  --accent:        #255deb;
  --accent-dark:   #1d4ed8;
  --accent-light:  #eff6ff;
  --success:       #10b981;
  --success-light: #f0fdf4;
  --danger:        #ef4444;
  --danger-light:  #fef2f2;
  --warning:       #f59e0b;
  --warning-light: #fffbeb;
  --info:          #255deb;
  --info-light:    #eff6ff;
  --gray-50:  #f8fafc;
  --gray-100: #f1f5f9;
  --gray-200: #e2e8f0;
  --gray-300: #cbd5e1;
  --gray-400: #94a3b8;
  --gray-500: #64748b;
  --gray-600: #475569;
  --gray-700: #334155;
  --gray-800: #1e293b;
  --gray-900: #0f172a;

  /* ── Shadows ─────────────────────────────────────────── */
  --shadow-sm: 0 1px 2px rgba(0,0,0,.05);
  --shadow:    0 1px 3px rgba(0,0,0,.07), 0 1px 2px rgba(0,0,0,.04);
  --shadow-md: 0 4px 8px rgba(0,0,0,.06), 0 2px 4px rgba(0,0,0,.04);
  --shadow-lg: 0 12px 24px rgba(0,0,0,.08), 0 4px 8px rgba(0,0,0,.04);
  --shadow-xl: 0 24px 48px rgba(0,0,0,.1), 0 8px 16px rgba(0,0,0,.05);

  /* ── Geometry ────────────────────────────────────────── */
  --font:      'Inter', system-ui, -apple-system, sans-serif;
  --radius:    8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --sidebar-w: 240px;
  --topbar-h:  56px;
  --ease:      cubic-bezier(.16,1,.3,1);
}

/* ── Base ───────────────────────────────────────────────── */
html { font-size: 16px; }
body {
  font-family: var(--font);
  color: var(--text-1);
  background: var(--bg-app);
  line-height: 1.55;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
a { color: var(--blue); text-decoration: none; transition: color .15s; }
a:hover { color: var(--blue-l); }

h1 { font-size: 1.5rem;   font-weight: 700; color: var(--text-1); letter-spacing: -.25px; line-height: 1.3; }
h2 { font-size: 1.1875rem;font-weight: 600; color: var(--text-1); }
h3 { font-size: 1rem;     font-weight: 600; color: var(--text-1); }
h4 { font-size: .9375rem; font-weight: 600; color: var(--text-2); }
p  { color: var(--text-2); line-height: 1.65; }
small { font-size: .8125rem; color: var(--text-3); }

/* ══════════════════════════════════════════════════════════
   BUTTONS
══════════════════════════════════════════════════════════ */
.btn {
  display: inline-flex; align-items: center; gap: .375rem;
  padding: .4375rem .875rem;
  border-radius: var(--radius);
  font-size: .875rem; font-weight: 500; line-height: 1;
  border: 1px solid transparent;
  cursor: pointer; font-family: var(--font);
  transition: background .12s, border-color .12s, box-shadow .12s, transform .1s;
  white-space: nowrap;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn:active:not(:disabled) { transform: translateY(1px); }

.btn-primary {
  background: var(--blue); color: #fff;
  border-color: var(--blue);
  box-shadow: 0 1px 2px rgba(37,93,235,.2);
}
.btn-primary:hover {
  background: var(--primary-dark);
  border-color: var(--primary-dark);
  box-shadow: 0 2px 8px rgba(37,93,235,.25);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--bg-card); color: var(--text-1);
  border-color: var(--border);
  box-shadow: var(--shadow-sm);
}
.btn-secondary:hover { background: var(--bg-hover); border-color: var(--gray-300); }

.btn-ghost { background: transparent; color: var(--text-2); border-color: transparent; }
.btn-ghost:hover { background: var(--bg-hover); color: var(--text-1); }

.btn-danger {
  background: var(--bg-card); color: var(--red);
  border-color: var(--red-border);
}
.btn-danger:hover { background: var(--red-bg); border-color: #fca5a5; }

.btn-navy  { background: var(--navy); color: #fff; border-color: var(--navy); }
.btn-navy:hover { background: #1e293b; }
.btn-accent { background: var(--blue); color: #fff; border-color: var(--blue); box-shadow: 0 1px 2px rgba(37,93,235,.2); }
.btn-accent:hover { background: var(--primary-dark); transform: translateY(-1px); }

.btn-sm  { padding: .3125rem .625rem; font-size: .8125rem; }
.btn-lg  { padding: .625rem 1.25rem; font-size: .9375rem; font-weight: 600; }
.btn-xl  { padding: .75rem 1.625rem; font-size: 1rem; font-weight: 600; }
.btn-icon { padding: .375rem; }
.w-full  { width: 100%; justify-content: center; }

/* ══════════════════════════════════════════════════════════
   FORMS
══════════════════════════════════════════════════════════ */
.form-group  { display: flex; flex-direction: column; gap: .3125rem; margin-bottom: .875rem; }
.form-label  { font-size: .8125rem; font-weight: 500; color: var(--text-2); }
.form-label .req { color: var(--red); margin-left: 2px; }

.form-control {
  width: 100%; padding: .5rem .75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: var(--font); font-size: .9375rem;
  color: var(--text-1); background: var(--bg-input);
  transition: border-color .15s, box-shadow .15s;
}
.form-control:focus {
  outline: none;
  border-color: var(--blue-l);
  box-shadow: 0 0 0 3px rgba(59,130,246,.12);
}
.form-control::placeholder { color: var(--text-3); }
textarea.form-control { resize: vertical; min-height: 80px; }
select.form-control { cursor: pointer; }
.form-check { display: flex; align-items: center; gap: .5rem; }
.form-check input[type=checkbox] { width: 1rem; height: 1rem; cursor: pointer; accent-color: var(--blue); }
.form-check label { font-size: .875rem; color: var(--text-2); cursor: pointer; }
.form-hint  { font-size: .8125rem; color: var(--text-3); }
.form-error { font-size: .8125rem; color: var(--red); }

/* ══════════════════════════════════════════════════════════
   CARDS
══════════════════════════════════════════════════════════ */
.card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.card-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: .875rem 1.25rem;
  border-bottom: 1px solid var(--border-sm);
}
.card-header h3 { font-size: .9375rem; color: var(--text-1); }
/* A card-header that holds a description paragraph is a title+subtitle (not title+action):
   stack them vertically so the subtitle sits UNDER the title (full width) instead of being
   squeezed beside it as a second flex column. Title+button headers (no direct <p>) keep the row. */
.card-header:has(> p) { flex-direction: column; align-items: flex-start; gap: .3rem; }
.card-header:has(> p) h3 { margin: 0; }
.card-header:has(> p) p  { margin: 0 !important; }
.card-body   { padding: 1.25rem; }
.card-footer {
  padding: .75rem 1.25rem;
  border-top: 1px solid var(--border-sm);
  background: var(--bg-hover);
}

/* ══════════════════════════════════════════════════════════
   LAYOUT
══════════════════════════════════════════════════════════ */
.layout { display: flex; min-height: 100vh; }

/* ── Sidebar — dark, stays premium ────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  background: #0f172a;
  border-right: 1px solid rgba(255,255,255,.06);
  position: fixed; top: 0; left: 0; bottom: 0;
  display: flex; flex-direction: column; z-index: 100;
  box-shadow: 1px 0 0 rgba(255,255,255,.04);
}

.sidebar-logo {
  display: flex; align-items: center; gap: .625rem;
  padding: 1rem 1.125rem;
  border-bottom: 1px solid rgba(255,255,255,.06);
  text-decoration: none;
}
.sidebar-logo:hover { text-decoration: none; }
.sidebar-logo-img { height: 26px; width: auto; display: block; }
.sidebar-logo-text { font-size: 1.125rem; font-weight: 800; color: #fff; letter-spacing: -.4px; }
.sidebar-logo-text span { color: #60a5fa; }
.logo-text { font-size: 1.125rem; font-weight: 800; color: #fff; letter-spacing: -.4px; }
.logo-mark {
  width: 28px; height: 28px; background: var(--blue);
  border-radius: 7px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: .8125rem; color: #fff; flex-shrink: 0;
}

.sidebar-nav { flex: 1; padding: .5rem 0; overflow-y: auto; }
.sidebar-nav::-webkit-scrollbar { width: 3px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,.1); border-radius: 2px; }

.sidebar-section-label {
  font-size: .65rem; font-weight: 600; letter-spacing: .1em;
  text-transform: uppercase; color: rgba(255,255,255,.22);
  padding: .875rem 1.125rem .3125rem;
}

.nav-item {
  display: flex; align-items: center; gap: .5rem;
  padding: .46875rem 1.125rem;
  color: rgba(255,255,255,.5);
  font-size: .8125rem; font-weight: 500;
  transition: background .12s, color .12s;
  cursor: pointer; border: none; background: none;
  width: 100%; text-decoration: none; border-radius: 0;
}
.nav-item:hover { background: rgba(255,255,255,.05); color: rgba(255,255,255,.85); text-decoration: none; }
.nav-item.active {
  color: #fff; background: rgba(59,130,246,.15);
  border-left: 2px solid var(--blue-l);
  padding-left: calc(1.125rem - 2px);
}
.nav-item .nav-icon { width: 16px; height: 16px; flex-shrink: 0; opacity: .8; }
.nav-item.active .nav-icon { opacity: 1; }
.nav-divider { height: 1px; background: rgba(255,255,255,.05); margin: .375rem 0; }

.nav-item-toggle { justify-content: flex-start; }
.nav-item-toggle .nav-chevron {
  width: 13px; height: 13px; margin-left: auto; flex-shrink: 0;
  transition: transform .2s; opacity: .35;
}
.nav-item-toggle.open { color: rgba(255,255,255,.8); }
.nav-item-toggle.open .nav-chevron { transform: rotate(90deg); opacity: .6; }
.nav-submenu { overflow: hidden; max-height: 0; transition: max-height .22s ease; }
.nav-submenu.open { max-height: 400px; } /* increased for more items */
/* Sub-items: consistent appearance */
.nav-item-sub {
  padding-left: 2.375rem;
  font-size: .8125rem;
  color: rgba(255,255,255,.45);
  font-weight: 400;
}
.nav-item-sub:hover { color: rgba(255,255,255,.8); background: rgba(255,255,255,.04); }
.nav-item-sub.active {
  color: #93c5fd;
  background: rgba(147,197,253,.06);
  font-weight: 500;
}

.btn-sidebar-logout {
  background: transparent; border: 1px solid rgba(255,255,255,.08);
  color: rgba(255,255,255,.3); font-size: .8125rem; margin-top: .25rem;
  cursor: pointer; font-family: var(--font); border-radius: 6px;
  transition: all .15s;
}
.btn-sidebar-logout:hover { background: rgba(239,68,68,.12); color: #fca5a5; border-color: rgba(239,68,68,.2); }

.sidebar-footer { padding: .875rem 1.125rem; border-top: 1px solid rgba(255,255,255,.06); }
.user-info { display: flex; align-items: center; gap: .5rem; margin-bottom: .5rem; }
.user-avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--blue); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: .8125rem; font-weight: 700; flex-shrink: 0;
}
.user-name  { font-size: .8125rem; font-weight: 500; color: rgba(255,255,255,.85); }
.user-email { font-size: .75rem; color: rgba(255,255,255,.3); }
.plan-badge {
  display: inline-flex; padding: .125rem .4rem; border-radius: 999px;
  font-size: .65rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
  background: rgba(59,130,246,.2); color: #93c5fd;
}

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

/* ── Topbar ─────────────────────────────────────────────── */
.topbar {
  height: var(--topbar-h);
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 1.5rem;
  position: sticky; top: 0; z-index: 50;
  box-shadow: var(--shadow-sm);
}
.topbar-title { font-size: .9375rem; font-weight: 600; color: var(--text-1); }
.topbar-actions { display: flex; align-items: center; gap: .5rem; }

.page-content { flex: 1; padding: 1.5rem; max-width: 1400px; }

/* ══════════════════════════════════════════════════════════
   STATS / KPI CARDS
══════════════════════════════════════════════════════════ */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: .875rem; margin-bottom: 1.5rem; }
.stat-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  padding: 1.25rem 1.375rem;
  display: flex; flex-direction: column; gap: .25rem;
  box-shadow: var(--shadow-sm);
  transition: box-shadow .15s, transform .15s;
}
.stat-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.stat-label { font-size: .7rem; font-weight: 600; color: var(--text-3); text-transform: uppercase; letter-spacing: .07em; }
.stat-value { font-size: 2rem; font-weight: 700; color: var(--text-1); line-height: 1.1; letter-spacing: -.5px; }
.stat-sub   { font-size: .8125rem; color: var(--text-3); }
.stat-icon  {
  width: 36px; height: 36px; border-radius: 9px; margin-bottom: .5rem;
  display: flex; align-items: center; justify-content: center;
  background: var(--blue-bg); color: var(--blue);
}

/* ══════════════════════════════════════════════════════════
   TABLES
══════════════════════════════════════════════════════════ */
.table-wrapper { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .875rem; }
thead th {
  text-align: left; font-size: .7rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: .06em;
  color: var(--text-3); padding: .625rem 1rem;
  border-bottom: 1px solid var(--border);
  background: var(--bg-hover); white-space: nowrap;
}
tbody td {
  padding: .75rem 1rem;
  border-bottom: 1px solid var(--border-sm);
  vertical-align: middle; color: var(--text-1);
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--blue-bg); }

/* ══════════════════════════════════════════════════════════
   BADGES
══════════════════════════════════════════════════════════ */
.badge {
  display: inline-flex; align-items: center;
  padding: .2rem .6rem; border-radius: 999px;
  font-size: .72rem; font-weight: 600; line-height: 1; white-space: nowrap;
  border: 1px solid transparent;
}
.badge-success  { background: var(--green-bg);  color: #059669; border-color: var(--green-border); }
.badge-warning  { background: var(--amber-bg);  color: #d97706; border-color: var(--amber-border); }
.badge-danger   { background: var(--red-bg);    color: #dc2626; border-color: var(--red-border); }
.badge-gray     { background: var(--gray-100);  color: var(--text-2); border-color: var(--border); }
.badge-primary  { background: var(--blue-bg);   color: var(--blue); border-color: var(--blue-border); }
.badge-navy     { background: #f1f5f9; color: #334155; border-color: var(--border); }
.badge-accent   { background: var(--blue-bg);   color: var(--blue); border-color: var(--blue-border); }
.badge-draft    { background: var(--gray-100);  color: var(--text-3); }
.badge-active   { background: var(--green-bg);  color: #059669; border-color: var(--green-border); }
.badge-inactive { background: var(--red-bg);    color: #dc2626; border-color: var(--red-border); }
.badge-new        { background: var(--blue-bg);    color: var(--blue);  border-color: var(--blue-border); }
.badge-contacted  { background: var(--amber-bg);   color: #d97706; border-color: var(--amber-border); }
.badge-offer_sent { background: var(--purple-bg);  color: var(--purple); border-color: var(--purple-border); }
.badge-won        { background: var(--green-bg);   color: #059669; border-color: var(--green-border); }
.badge-lost       { background: var(--red-bg);     color: #dc2626; border-color: var(--red-border); }

.tab-list { display: flex; gap: .125rem; }
.tab-item {
  padding: .4375rem .875rem; font-size: .8375rem; font-weight: 500;
  color: var(--text-3); background: none; border: none;
  cursor: pointer; font-family: var(--font);
  border-bottom: 2px solid transparent; transition: all .15s;
}
.tab-item:hover { color: var(--text-1); }
.tab-item.active { color: var(--blue); border-bottom-color: var(--blue); }

/* ══════════════════════════════════════════════════════════
   ALERTS
══════════════════════════════════════════════════════════ */
.alert {
  padding: .75rem 1rem; border-radius: var(--radius);
  font-size: .875rem; font-weight: 500; margin-bottom: 1rem;
  display: flex; align-items: flex-start; gap: .5rem;
  border: 1px solid transparent;
}
.alert-error   { background: var(--red-bg);   color: #991b1b; border-color: var(--red-border); }
.alert-success { background: var(--green-bg); color: #166534; border-color: var(--green-border); }
.alert-info    { background: var(--blue-bg);  color: #1e40af; border-color: var(--blue-border); }
.alert-warning { background: var(--amber-bg); color: #92400e; border-color: var(--amber-border); }

/* ══════════════════════════════════════════════════════════
   MODAL
══════════════════════════════════════════════════════════ */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(15,23,42,.4);
  backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  z-index: 200; padding: 1rem;
}
.modal-overlay.hidden { display: none; }
.modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  width: 100%; max-width: 540px;
  box-shadow: var(--shadow-xl);
  overflow: hidden; max-height: 90vh;
  display: flex; flex-direction: column;
}
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1.125rem 1.375rem;
  border-bottom: 1px solid var(--border-sm);
}
.modal-header h3 { color: var(--text-1); margin: 0; }
.modal-body   { padding: 1.375rem; overflow-y: auto; flex: 1; }
.modal-footer {
  display: flex; justify-content: flex-end; gap: .5rem;
  padding: .875rem 1.375rem;
  border-top: 1px solid var(--border-sm);
  background: var(--bg-hover);
}

/* ── Unified close button (× / SVG) for all modals & popups ──── */
.modal-close {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; padding: 0; flex-shrink: 0;
  border: none; background: transparent;
  border-radius: var(--radius);
  color: var(--text-2); cursor: pointer;
  font-size: 1.5rem; line-height: 1; font-weight: 400; font-family: var(--font);
  -webkit-appearance: none; appearance: none;
  transition: background .12s ease, color .12s ease, transform .1s ease;
}
.modal-close:hover  { background: var(--bg-hover); color: var(--text-1); }
.modal-close:active { transform: scale(.92); }
.modal-close:focus-visible { outline: 2px solid var(--blue); outline-offset: 1px; }
.modal-close svg { width: 18px; height: 18px; display: block; }

/* ══════════════════════════════════════════════════════════
   AUTH PAGES
══════════════════════════════════════════════════════════ */
.auth-wrapper {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 100%);
  padding: 2rem;
}
.auth-card {
  background: var(--bg-card);
  border-radius: var(--radius-xl);
  width: 100%; max-width: 400px;
  padding: 2.25rem 2rem;
  box-shadow: var(--shadow-xl);
}
.auth-logo { display: flex; align-items: center; gap: .5rem; margin-bottom: 1.75rem; }
.auth-logo img { height: 28px; object-fit: contain; }
.auth-logo span { font-size: 1.25rem; font-weight: 800; color: var(--text-1); }
.auth-title { font-size: 1.375rem; font-weight: 700; color: var(--text-1); margin-bottom: .25rem; }
.auth-sub   { font-size: .9rem; color: var(--text-3); margin-bottom: 1.625rem; }
.auth-footer { text-align: center; margin-top: 1.25rem; font-size: .875rem; color: var(--text-3); }
.auth-footer a { color: var(--blue); }

/* ══════════════════════════════════════════════════════════
   TABS
══════════════════════════════════════════════════════════ */
.tabs {
  display: flex; gap: 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1.5rem;
}
.tab-btn {
  padding: .5rem .875rem; font-size: .875rem; font-weight: 500;
  color: var(--text-3); background: none; border: none;
  cursor: pointer; border-bottom: 2px solid transparent;
  margin-bottom: -1px; transition: color .15s, border-color .15s;
  font-family: var(--font);
}
.tab-btn:hover { color: var(--text-1); }
.tab-btn.active { color: var(--blue); border-bottom-color: var(--blue); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ══════════════════════════════════════════════════════════
   PIPELINE
══════════════════════════════════════════════════════════ */
.pipeline-columns { display: grid; grid-template-columns: repeat(5,1fr); gap: .875rem; align-items: start; }
.pipeline-col {
  background: var(--bg-hover); border-radius: var(--radius-lg);
  border: 1px solid var(--border); padding: .75rem; min-height: 120px;
}
.pipeline-col-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: .625rem; padding-bottom: .5rem; border-bottom: 1px solid var(--border-sm);
}
.pipeline-col-title { font-size: .7rem; font-weight: 600; color: var(--text-3); text-transform: uppercase; letter-spacing: .07em; }
.pipeline-col-count {
  font-size: .72rem; font-weight: 600; color: var(--blue);
  background: var(--blue-bg); padding: .1rem .375rem; border-radius: 999px;
}
.pipeline-card {
  background: var(--bg-card); border-radius: var(--radius);
  border: 1px solid var(--border); padding: .625rem .75rem;
  margin-bottom: .375rem; cursor: pointer; transition: box-shadow .15s, border-color .15s;
}
.pipeline-card:hover { box-shadow: var(--shadow); border-color: var(--blue-l); }
.pipeline-card .card-name  { font-weight: 600; font-size: .875rem; color: var(--text-1); }
.pipeline-card .card-email { font-size: .78rem; color: var(--text-3); }
.pipeline-card .card-meta  { font-size: .75rem; color: var(--text-3); margin-top: .2rem; }

/* ══════════════════════════════════════════════════════════
   MISC
══════════════════════════════════════════════════════════ */
.empty-state {
  text-align: center; padding: 3.5rem 2rem;
  display: flex; flex-direction: column; align-items: center; gap: .75rem;
}
.empty-state svg { color: var(--text-4); }
.empty-state h3  { color: var(--text-2); }
.empty-state p   { color: var(--text-3); max-width: 360px; }

.spinner {
  width: 18px; height: 18px;
  border: 2px solid var(--gray-200);
  border-top-color: var(--blue);
  border-radius: 50%; animation: spin .7s linear infinite;
  display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-overlay { display: flex; align-items: center; justify-content: center; padding: 3rem; gap: 1rem; color: var(--text-3); }

.divider { height: 1px; background: var(--border-sm); margin: 1.25rem 0; }

.url-box {
  display: flex; align-items: center; gap: .5rem;
  background: var(--bg-hover); border: 1px solid var(--border);
  border-radius: var(--radius); padding: .5rem .75rem;
  font-size: .8125rem; font-family: monospace; color: var(--text-2);
}
.url-box a { color: var(--blue); font-weight: 600; }

.color-input-wrapper { display: flex; align-items: center; gap: .5rem; }
.color-input-wrapper input[type=color] { width: 40px; height: 36px; border-radius: var(--radius); border: 1px solid var(--border); padding: 2px; cursor: pointer; }
.color-input-wrapper input[type=text] { flex: 1; }

/* Utilities */
.text-right { text-align: right; }
.text-muted { color: var(--text-3); }
.text-accent { color: var(--blue); }
.fw-600 { font-weight: 600; } .fw-700 { font-weight: 700; }
.flex { display: flex; } .flex-col { flex-direction: column; }
.items-center { align-items: center; } .justify-between { justify-content: space-between; }
.gap-1{gap:.25rem;}.gap-2{gap:.5rem;}.gap-3{gap:.75rem;}
.mt-1{margin-top:.25rem;}.mt-2{margin-top:.5rem;}.mt-3{margin-top:.75rem;}.mt-4{margin-top:1rem;}
.mb-1{margin-bottom:.25rem;}.mb-2{margin-bottom:.5rem;}.mb-3{margin-bottom:.75rem;}.mb-4{margin-bottom:1rem;}.mb-6{margin-bottom:1.5rem;}
.w-full { width: 100%; }
.hidden { display: none !important; }
.req { color: var(--red); margin-left: 2px; }

/* ══════════════════════════════════════════════════════════
   TOAST
══════════════════════════════════════════════════════════ */
#toast-container { position: fixed; bottom: 1.25rem; right: 1.25rem; z-index: 9999; display: flex; flex-direction: column; gap: .375rem; }
.toast {
  background: var(--gray-900); color: #fff;
  padding: .75rem 1.125rem; border-radius: var(--radius);
  font-size: .875rem; font-weight: 500;
  box-shadow: var(--shadow-xl);
  animation: slideUp .18s ease; min-width: 240px;
}
.toast.success { background: #166534; }
.toast.error   { background: #991b1b; }
@keyframes slideUp { from{opacity:0;transform:translateY(6px);}to{opacity:1;transform:translateY(0);} }

/* ══════════════════════════════════════════════════════════
   BUILDER
══════════════════════════════════════════════════════════ */
.step-item {
  background: var(--bg-card); border-radius: var(--radius-lg);
  border: 1px solid var(--border); overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: box-shadow .15s;
}
.step-item:hover { box-shadow: var(--shadow); }
.step-header {
  display: flex; align-items: center; gap: .75rem;
  padding: .875rem 1rem; cursor: pointer; user-select: none;
  transition: background .12s;
}
.step-header:hover { background: var(--bg-hover); }
.step-drag-handle { color: var(--text-3); cursor: grab; }
.step-number {
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--blue-bg); border: 1px solid var(--blue-border);
  color: var(--blue);
  display: flex; align-items: center; justify-content: center;
  font-size: .8rem; font-weight: 700; flex-shrink: 0;
}
.step-title-text { flex: 1; font-weight: 600; color: var(--text-1); font-size: .9375rem; }
.step-toggle { color: var(--text-3); transition: transform .2s; }
.step-toggle.open { transform: rotate(180deg); }
.step-body { padding: 1rem; border-top: 1px solid var(--border-sm); }
.step-list { display: flex; flex-direction: column; gap: .625rem; }

.field-list { display: flex; flex-direction: column; gap: .375rem; }
.field-item {
  display: flex; align-items: center; gap: .625rem;
  padding: .5rem .75rem; background: var(--bg-hover);
  border-radius: var(--radius); border: 1px solid var(--border-sm);
  transition: border-color .12s;
}
.field-item:hover { border-color: var(--border); }
.field-type-badge {
  font-size: .7rem; font-weight: 600; padding: .15rem .45rem;
  background: var(--blue-bg); color: var(--blue); border-radius: 4px;
  white-space: nowrap; flex-shrink: 0;
}
.field-label-text { flex: 1; font-size: .875rem; color: var(--text-2); }
.field-actions { display: flex; gap: .25rem; flex-shrink: 0; }

.rule-list { display: flex; flex-direction: column; gap: .375rem; }
.rule-item {
  display: flex; align-items: center; gap: .625rem;
  padding: .5rem .75rem; background: var(--amber-bg);
  border-radius: var(--radius); border: 1px solid var(--amber-border);
}
.rule-type-badge { font-size: .7rem; font-weight: 600; padding: .15rem .45rem; background: var(--amber-bg); color: #92400e; border-radius: 4px; white-space: nowrap; flex-shrink: 0; }
.rule-desc   { flex: 1; font-size: .875rem; color: var(--text-2); }
.rule-amount { font-weight: 600; color: var(--text-1); font-size: .875rem; white-space: nowrap; }
.sidebar-panel { position: sticky; top: calc(var(--topbar-h) + 1.5rem); }
.builder-layout { display: grid; grid-template-columns: 1fr 360px; gap: 1.5rem; align-items: start; }

.lead-answers { display: flex; flex-direction: column; gap: .375rem; }
.lead-answer-item {
  display: flex; gap: .75rem; padding: .625rem .875rem;
  background: var(--bg-hover); border-radius: var(--radius);
  border: 1px solid var(--border-sm);
}
.answer-label { font-size: .8125rem; font-weight: 500; color: var(--text-3); min-width: 160px; }
.answer-value { font-size: .875rem; color: var(--text-1); word-break: break-word; }

/* ══════════════════════════════════════════════════════════
   RESPONSIVE   (desktop ≥1025px stays exactly as designed;
                 tablet ≤1024px; mobile ≤768px)
══════════════════════════════════════════════════════════ */

/* ── Mobile-nav primitives (hidden on desktop, activated below) ── */
.lp-burger {
  display: none;                       /* desktop: never shown */
  align-items: center; justify-content: center;
  width: 38px; height: 38px; margin-right: .125rem; flex-shrink: 0;
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--bg-card); color: var(--text-1); cursor: pointer;
  -webkit-appearance: none; appearance: none;
  transition: background .12s, transform .1s;
}
.lp-burger:hover  { background: var(--bg-hover); }
.lp-burger:active { transform: scale(.94); }
.lp-burger svg    { width: 20px; height: 20px; display: block; }
.lp-burger--float { position: fixed; top: 10px; left: 10px; z-index: 60; box-shadow: var(--shadow); }
.lp-sidebar-overlay {
  position: fixed; inset: 0; z-index: 99;
  background: rgba(15,23,42,.45);
  -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px);
  opacity: 0; visibility: hidden;
  transition: opacity .2s ease, visibility .2s ease;
}
.lp-sidebar-overlay.open { opacity: 1; visibility: visible; }

@media (max-width: 1200px) { .pipeline-columns { grid-template-columns: repeat(3,1fr); } }

/* ── Tablet ───────────────────────────────────────────── */
@media (max-width: 1024px) {
  .page-content { padding: 1.25rem; }
}

/* ── Mobile ───────────────────────────────────────────── */
@media (max-width: 768px) {
  /* Sidebar becomes an off-canvas drawer */
  .sidebar {
    width: min(82vw, 290px);
    transform: translateX(-100%);
    transition: transform .26s var(--ease);
    box-shadow: 4px 0 28px rgba(15,23,42,.22);
  }
  .sidebar.open { transform: translateX(0); }
  .lp-burger { display: inline-flex; }
  body.lp-drawer-open { overflow: hidden; }

  /* Hard stop on horizontal panning: clip any accidental overflow at the body. Using
     overflow-x:hidden (not clip) keeps vertical scrolling intact (overflow-y computes to
     auto), and min-width:0 lets the flex content column shrink to the viewport so a single
     too-wide child can't stretch the whole page. The sticky topbar + fixed drawer keep working. */
  body { overflow-x: hidden; }
  .main-content { margin-left: 0; min-width: 0; }
  .page-content { padding: 1rem; max-width: 100%; }
  .card-header { flex-wrap: wrap; gap: .5rem; }

  /* Safety net: inline multi-column grids (very common in this codebase via
     style="grid-template-columns:1fr 1fr") collapse to a single column on phones so
     form fields / option cards never get squished. !important is required to beat the
     inline style; the whole block is ≤768 so desktop is unaffected. */
  [style*="grid-template-columns:1fr 1fr"],
  [style*="grid-template-columns: 1fr 1fr"] { grid-template-columns: 1fr !important; }

  /* Topbar: burger + title + actions wrap instead of overflowing */
  .topbar {
    height: auto; min-height: var(--topbar-h);
    padding: .5rem .875rem; gap: .5rem; flex-wrap: wrap;
  }
  .topbar-actions { gap: .375rem; flex-wrap: wrap; width: 100%; }
  .topbar-actions .btn { padding: .375rem .625rem; }
  /* Search/filter inputs in the topbar go full-width and stack instead of overflowing */
  .topbar-actions .form-control { flex: 1 1 100%; width: 100%; min-width: 0; }

  /* Tab bars (status filters etc.) scroll horizontally instead of wrapping/overflowing */
  .tab-list { overflow-x: auto; -webkit-overflow-scrolling: touch; flex-wrap: nowrap; }
  .tab-list::-webkit-scrollbar { display: none; }
  .tab-item { white-space: nowrap; flex-shrink: 0; }

  /* Kanban → swipeable horizontal scroll */
  .pipeline-columns {
    grid-template-columns: none;
    grid-auto-flow: column; grid-auto-columns: 80%;
    overflow-x: auto; -webkit-overflow-scrolling: touch;
    scroll-snap-type: x mandatory; padding-bottom: .5rem;
  }
  .pipeline-col { scroll-snap-align: start; }

  /* Shared modals: near-full-width, comfortable */
  .modal-overlay { padding: .75rem; }
  .modal { max-width: 100%; max-height: 92vh; }

  /* Tables stay readable via touch scroll (fallback for non-.rtable tables) */
  .table-wrapper { overflow-x: auto; -webkit-overflow-scrolling: touch; }

  /* ── Responsive data tables → stacked cards ──────────────────────
     Opt-in via <table class="rtable"> + data-label on each <td>. Each row
     becomes a card; the first cell (.rt-title) is the prominent header, the
     rest render as "LABEL  value" lines. No horizontal scrolling, nothing clipped. */
  table.rtable { display: block; width: 100%; }
  table.rtable thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; } /* hidden, a11y-safe */
  table.rtable tbody { display: block; width: 100%; }
  table.rtable tr {
    display: block;
    border: 1px solid var(--border); border-radius: var(--radius-lg);
    background: var(--bg-card); box-shadow: var(--shadow-sm);
    padding: .25rem .25rem .45rem; margin-bottom: .625rem;
  }
  table.rtable tbody tr:hover { background: var(--bg-card); }
  table.rtable td {
    display: flex; align-items: center; justify-content: space-between; gap: 1rem;
    border: none; padding: .4rem .85rem; text-align: right; min-width: 0;
  }
  table.rtable td::before {
    content: attr(data-label);
    font-size: .68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
    color: var(--text-3); text-align: left; flex-shrink: 0; white-space: nowrap;
  }
  table.rtable td > * { min-width: 0; }
  table.rtable td:empty { display: none; }
  /* Title cell: full-width, left-aligned, no label */
  table.rtable td.rt-title {
    display: block; text-align: left; padding: .55rem .85rem .2rem;
  }
  table.rtable td.rt-title::before { content: none; }

  /* Toasts span the width on small screens */
  #toast-container { left: 1rem; right: 1rem; bottom: 1rem; }
  .toast { min-width: 0; }

  /* The two-column builder preview/props grid stacks */
  .builder-layout { grid-template-columns: 1fr; }
  .sidebar-panel { position: static; }
}

/* ══════════════════════════════════════════════════════════════
   Shared mail composer (edit + live preview) — used by the lead
   detail AND the Termine agenda (mail-composer.js).
   ══════════════════════════════════════════════════════════════ */
.ld-modal-overlay { display:none; position:fixed; inset:0; z-index:1000; background:rgba(15,23,42,.55); align-items:center; justify-content:center; padding:2rem; }
.ld-modal { background:#fff; border-radius:14px; width:min(720px,100%); max-height:88vh; display:flex; flex-direction:column; overflow:hidden; box-shadow:0 20px 60px rgba(0,0,0,.3); }
.ld-modal-head { display:flex; align-items:center; justify-content:space-between; gap:1rem; padding:.9rem 1.2rem; border-bottom:1px solid #e9edf3; }
.ld-modal-head strong { font-size:.92rem; color:#0f172a; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.ld-modal-x { border:none; background:transparent; font-size:1.1rem; color:#94a3b8; cursor:pointer; line-height:1; padding:.2rem .4rem; border-radius:6px; }
.ld-modal-x:hover { background:#f1f5f9; color:#0f172a; }
.ld-modal-body { overflow:auto; background:#f8fafc; }
.ld-modal--wide { width:min(960px,100%); }
.cmp-grid { display:grid; grid-template-columns:1fr 1fr; }
.cmp-form { padding:1.1rem 1.25rem; display:flex; flex-direction:column; gap:.35rem; }
.cmp-to { font-size:.85rem; color:#475569; background:#f8fafc; border:1px solid #e9edf3; border-radius:8px; padding:.5rem .7rem; margin-bottom:.4rem; }
.cmp-label { font-size:.7rem; text-transform:uppercase; letter-spacing:.04em; color:#94a3b8; font-weight:700; margin-top:.55rem; }
.cmp-form .form-control { font-size:.875rem; }
.cmp-form textarea.form-control { resize:vertical; line-height:1.5; }
.cmp-hint { font-size:.76rem; color:#475569; background:#eef4ff; border:1px solid #dbe6ff; border-radius:8px; padding:.55rem .7rem; margin-top:.55rem; line-height:1.45; }
.cmp-preview { border-left:1px solid #e9edf3; background:#f8fafc; display:flex; flex-direction:column; min-height:380px; }
.cmp-preview-label { font-size:.7rem; text-transform:uppercase; letter-spacing:.04em; color:#94a3b8; font-weight:700; padding:.75rem 1rem .45rem; }
#cmpFrame { flex:1; width:100%; min-height:340px; border:none; background:#fff; }
.cmp-actions { display:flex; justify-content:flex-end; gap:.6rem; padding:.85rem 1.25rem; border-top:1px solid #e9edf3; background:#fff; }
@media(max-width:720px){ .cmp-grid { grid-template-columns:1fr; } .cmp-preview { border-left:none; border-top:1px solid #e9edf3; min-height:300px; } }
