/* ==========================================================================
   Tour Billing & Lead Manager — Professional theme (mobile-first)
   Built on Bootstrap 5.3 (bundled locally, no CDN)
   ========================================================================== */

:root {
  --brand-900: #062b29;
  --brand-800: #0b3b39;
  --brand-700: #0f5551;
  --brand-600: #0f766e;
  --brand-500: #14918a;
  --brand-100: #d5f0ec;
  --brand-50:  #ecf8f6;
  --accent:    #c8962a;
  --accent-600:#b07f1a;
  --accent-50: #fbf4e4;

  --bg:        #f3f5f7;
  --surface:   #ffffff;
  --border:    #e4e8ec;
  --border-2:  #eef1f4;
  --text:      #0f1b2a;
  --muted:     #64748b;
  --faint:     #94a3b8;

  --success: #059669; --success-50: #e7f7f0;
  --danger:  #dc2626; --danger-50:  #fdecec;
  --warning: #d97706; --warning-50: #fdf3e2;
  --info:    #0284c7; --info-50:    #e6f4fb;
  --secondary:#64748b; --secondary-50:#f1f4f7;

  --radius: 14px;
  --radius-sm: 10px;
  --shadow-sm: 0 1px 2px rgba(15, 27, 42, .05);
  --shadow:    0 1px 3px rgba(15, 27, 42, .06), 0 6px 16px rgba(15, 27, 42, .05);
  --shadow-lg: 0 12px 40px rgba(15, 27, 42, .14);

  --sidebar-w: 264px;
  --topbar-h: 60px;
  --footer-h: 42px;
  --bottomnav-h: 66px;
  --safe-b: env(safe-area-inset-bottom, 0px);

  /* Bootstrap overrides */
  --bs-body-font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --bs-body-bg: var(--bg);
  --bs-body-color: var(--text);
  --bs-border-color: var(--border);
  --bs-primary: #0f766e;
  --bs-primary-rgb: 15, 118, 110;
  --bs-link-color: #0f766e;
  --bs-link-color-rgb: 15, 118, 110;
  --bs-link-hover-color: #0b3b39;
  --bs-link-hover-color-rgb: 11, 59, 57;
  --bs-border-radius: 10px;
  --bs-border-radius-sm: 8px;
  --bs-border-radius-lg: 14px;
  --bs-focus-ring-color: rgba(15, 118, 110, .25);
}

html { -webkit-text-size-adjust: 100%; }
body.app { font-size: .9375rem; background: var(--bg); min-height: 100vh; }
a { text-decoration: none; }
.ic { width: 1.15em; height: 1.15em; flex-shrink: 0; vertical-align: -.2em; }
.min-w-0 { min-width: 0; }
.fw-600 { font-weight: 600; }
.text-muted { color: var(--muted) !important; }
.small-muted { font-size: .8rem; color: var(--muted); }
.mono { font-variant-numeric: tabular-nums; }
.text-brand { color: var(--brand-600) !important; }
.text-accent { color: var(--accent-600) !important; }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; font-weight: 500; border-radius: 10px; }
.btn .ic { width: 1.05em; height: 1.05em; }
.btn-sm { border-radius: 8px; }
.btn-primary {
  --bs-btn-bg: var(--brand-600); --bs-btn-border-color: var(--brand-600);
  --bs-btn-hover-bg: var(--brand-700); --bs-btn-hover-border-color: var(--brand-700);
  --bs-btn-active-bg: var(--brand-800); --bs-btn-active-border-color: var(--brand-800);
  --bs-btn-disabled-bg: var(--brand-500); --bs-btn-disabled-border-color: var(--brand-500);
  box-shadow: 0 1px 2px rgba(15,118,110,.25);
}
.btn-outline-primary {
  --bs-btn-color: var(--brand-600); --bs-btn-border-color: #b9dcd8;
  --bs-btn-hover-bg: var(--brand-600); --bs-btn-hover-border-color: var(--brand-600); --bs-btn-hover-color: #fff;
  --bs-btn-active-bg: var(--brand-700); --bs-btn-active-border-color: var(--brand-700);
}
.btn-accent {
  --bs-btn-color: #fff; --bs-btn-bg: var(--accent); --bs-btn-border-color: var(--accent);
  --bs-btn-hover-color: #fff; --bs-btn-hover-bg: var(--accent-600); --bs-btn-hover-border-color: var(--accent-600);
  --bs-btn-active-bg: var(--accent-600); --bs-btn-active-color: #fff;
}
.btn-light { --bs-btn-bg: #f1f4f7; --bs-btn-border-color: #e4e8ec; --bs-btn-hover-bg: #e6eaef; --bs-btn-hover-border-color: #dbe1e7; }
.btn-soft {
  --bs-btn-color: var(--brand-700); --bs-btn-bg: var(--brand-50); --bs-btn-border-color: transparent;
  --bs-btn-hover-color: var(--brand-800); --bs-btn-hover-bg: var(--brand-100); --bs-btn-hover-border-color: transparent;
}
.btn-call { --bs-btn-color: #fff; --bs-btn-bg: #0f766e; --bs-btn-border-color: #0f766e; --bs-btn-hover-bg: #0b5f59; --bs-btn-hover-color:#fff; }
.btn-wa   { --bs-btn-color: #fff; --bs-btn-bg: #1faa53; --bs-btn-border-color: #1faa53; --bs-btn-hover-bg: #178c44; --bs-btn-hover-color:#fff; }
.btn-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; border-radius: 10px; border: 0; background: transparent; color: inherit;
  transition: background .15s;
}
.btn-icon:hover { background: rgba(15, 27, 42, .06); }
.btn-icon .ic { width: 20px; height: 20px; }
.btn-square { width: 34px; height: 34px; padding: 0; }
.btn-square.btn-sm { width: 32px; height: 32px; }

/* ---------- Sidebar ---------- */
.sidebar { width: var(--sidebar-w) !important; border: 0 !important; }
.sidebar-inner {
  height: 100%; display: flex; flex-direction: column;
  background: linear-gradient(180deg, var(--brand-800) 0%, var(--brand-900) 100%);
  color: #cfe3e0;
}
.sidebar-brand { display: flex; align-items: center; justify-content: space-between; padding: 18px 16px 14px; }
.brand-link { display: flex; align-items: center; gap: 12px; color: #fff; min-width: 0; }
.brand-mark {
  width: 40px; height: 40px; border-radius: 12px; flex-shrink: 0;
  background: linear-gradient(135deg, var(--accent), #e2b65a); color: var(--brand-900);
  display: inline-flex; align-items: center; justify-content: center;
}
.brand-mark .ic { width: 22px; height: 22px; }
.brand-logo { width: 40px; height: 40px; border-radius: 10px; object-fit: contain; background: #fff; padding: 3px; flex-shrink: 0; }
.brand-text { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.brand-text strong { font-size: .86rem; letter-spacing: .2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 170px; }
.brand-text small { color: #8fbab5; font-size: .72rem; }
.sidebar-nav { flex: 1; overflow-y: auto; padding: 4px 12px 16px; }
.nav-section { font-size: .68rem; text-transform: uppercase; letter-spacing: 1.2px; color: #6f9d98; padding: 16px 12px 6px; font-weight: 600; }
.nav-item {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; margin: 2px 0;
  border-radius: 10px; color: #cfe3e0; font-weight: 500; font-size: .9rem; transition: background .15s, color .15s;
}
.nav-item .ic { width: 19px; height: 19px; opacity: .85; }
.nav-item:hover { background: rgba(255, 255, 255, .07); color: #fff; }
.nav-item.active { background: rgba(255, 255, 255, .12); color: #fff; box-shadow: inset 3px 0 0 var(--accent); }
.nav-item.active .ic { color: var(--accent); opacity: 1; }
.nav-badge { margin-left: auto; background: var(--accent); color: var(--brand-900); font-size: .7rem; font-weight: 700; border-radius: 20px; padding: 2px 8px; }
.sidebar-user {
  display: flex; align-items: center; gap: 10px; padding: 14px 16px calc(14px + var(--safe-b));
  border-top: 1px solid rgba(255, 255, 255, .08);
}
.su-name { color: #fff; font-weight: 600; font-size: .86rem; }
.su-role { font-size: .74rem; color: #8fbab5; }

.avatar {
  width: 38px; height: 38px; border-radius: 50%; flex-shrink: 0;
  background: linear-gradient(135deg, var(--brand-500), var(--brand-700)); color: #fff;
  display: inline-flex; align-items: center; justify-content: center; font-weight: 600; font-size: .85rem;
}
.avatar-sm { width: 32px; height: 32px; font-size: .75rem; }
.avatar-lg { width: 56px; height: 56px; font-size: 1.15rem; }

/* ---------- Main + top bar ---------- */
.app-main { min-height: 100vh; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 1020; height: var(--topbar-h);
  display: flex; align-items: center; gap: 8px; padding: 0 12px;
  background: rgba(255, 255, 255, .92); backdrop-filter: saturate(180%) blur(10px);
  border-bottom: 1px solid var(--border);
}
.topbar-title { font-weight: 600; font-size: 1.02rem; flex: 1; }
.topbar-actions { display: flex; align-items: center; gap: 6px; }
.topbar-search {
  align-items: center; gap: 8px; background: var(--bg); border: 1px solid var(--border);
  border-radius: 10px; padding: 0 12px; height: 38px; width: 280px; color: var(--muted);
}
.topbar-search input { border: 0; background: transparent; outline: 0; width: 100%; font-size: .875rem; }
.dot-badge {
  position: absolute; top: 4px; right: 2px; min-width: 18px; height: 18px; padding: 0 5px;
  background: var(--danger); color: #fff; border-radius: 10px; font-size: .65rem; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center; border: 2px solid #fff;
}
.user-chip {
  display: inline-flex; align-items: center; gap: 8px; border: 0; background: transparent;
  padding: 4px 6px; border-radius: 30px; font-weight: 500; font-size: .875rem; color: var(--text);
}
.user-chip:hover { background: var(--bg); }
.dropdown-menu { border-color: var(--border); border-radius: 12px; padding: 6px; font-size: .9rem; }
.dropdown-item { border-radius: 8px; display: flex; align-items: center; gap: 10px; padding: 8px 10px; }
.dropdown-item .ic { color: var(--muted); }
.dropdown-item.text-danger .ic { color: var(--danger); }
.dropdown-menu form { margin: 0; }

.app-content {
  flex: 1; width: 100%; max-width: 1440px; margin: 0 auto;
  padding: 16px 14px calc(var(--bottomnav-h) + 24px + var(--safe-b));
}

/* ---------- Footer (fixed on desktop) ---------- */
.app-footer { display: none; }

/* ---------- Bottom nav (mobile) ---------- */
.bottom-nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 1030;
  height: calc(var(--bottomnav-h) + var(--safe-b)); padding-bottom: var(--safe-b);
  background: #fff; border-top: 1px solid var(--border);
  display: grid; grid-template-columns: repeat(5, 1fr); align-items: center;
  box-shadow: 0 -4px 20px rgba(15, 27, 42, .06);
}
.bottom-nav > a, .bottom-nav > button:not(.bn-fab) {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 3px;
  font-size: .68rem; font-weight: 500; color: var(--muted); background: none; border: 0; padding: 6px 0;
}
.bottom-nav .ic { width: 22px; height: 22px; }
.bottom-nav .active { color: var(--brand-600); }
.bottom-nav .active::before {
  content: ""; position: absolute; top: -7px; width: 28px; height: 3px; border-radius: 0 0 3px 3px; background: var(--brand-600);
}
.bn-fab {
  justify-self: center; width: 54px; height: 54px; margin-top: -26px; border-radius: 50%; border: 4px solid #fff;
  background: linear-gradient(135deg, var(--accent), #ddb054); color: #fff;
  box-shadow: 0 6px 18px rgba(200, 150, 42, .45); display: inline-flex; align-items: center; justify-content: center;
}
.bn-fab .ic { width: 26px; height: 26px; }
.bn-badge {
  position: absolute; top: 0; left: 52%; font-style: normal; background: var(--danger); color: #fff;
  font-size: .6rem; font-weight: 700; min-width: 17px; height: 17px; border-radius: 9px; padding: 0 4px;
  display: inline-flex; align-items: center; justify-content: center;
}

@media (min-width: 992px) {
  .sidebar { position: fixed !important; top: 0; bottom: 0; left: 0; z-index: 1030; }
  .sidebar .sidebar-inner { width: var(--sidebar-w); }
  .app-main { margin-left: var(--sidebar-w); }
  .topbar { padding: 0 24px; }
  .app-content { padding: 24px 28px calc(var(--footer-h) + 28px); }
  .bottom-nav { display: none; }
  .app-footer {
    display: flex; justify-content: space-between; align-items: center;
    position: fixed; bottom: 0; left: var(--sidebar-w); right: 0; height: var(--footer-h); z-index: 1010;
    padding: 0 28px; background: #fff; border-top: 1px solid var(--border); font-size: .78rem; color: var(--muted);
  }
}
@media (min-width: 576px) and (max-width: 991.98px) {
  .app-content { padding-left: 20px; padding-right: 20px; }
}

/* ---------- Page header ---------- */
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.page-head h1 { font-size: 1.35rem; font-weight: 700; margin: 0; letter-spacing: -.2px; }
.page-head .sub { color: var(--muted); font-size: .86rem; margin-top: 2px; }
.page-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.breadcrumb-lite { font-size: .8rem; color: var(--muted); margin-bottom: 4px; display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.breadcrumb-lite a { color: var(--muted); }
.breadcrumb-lite a:hover { color: var(--brand-600); }
.breadcrumb-lite .ic { width: 14px; height: 14px; }
@media (max-width: 575.98px) {
  .page-head h1 { font-size: 1.18rem; }
  .page-head .page-actions { width: 100%; }
  .page-head .page-actions > .btn, .page-head .page-actions > a.btn { flex: 1; }
}

/* ---------- Panels / cards ---------- */
.panel {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.panel-head {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 14px 18px; border-bottom: 1px solid var(--border-2);
}
.panel-head h2, .panel-head h3, .panel-head h5 { font-size: .98rem; font-weight: 600; margin: 0; display: flex; align-items: center; gap: 8px; }
.panel-head h2 .ic, .panel-head h5 .ic { color: var(--brand-600); }
.panel-body { padding: 18px; }
.panel-foot { padding: 12px 18px; border-top: 1px solid var(--border-2); background: #fbfcfd; border-radius: 0 0 var(--radius) var(--radius); }
@media (max-width: 575.98px) {
  .panel-body { padding: 14px; }
  .panel-head { padding: 12px 14px; }
}

/* ---------- Stat cards ---------- */
.stat {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px; display: flex; gap: 14px; align-items: flex-start; height: 100%; box-shadow: var(--shadow-sm);
  color: inherit; transition: transform .15s, box-shadow .15s;
}
a.stat:hover { transform: translateY(-2px); box-shadow: var(--shadow); color: inherit; }
.stat-icon {
  width: 42px; height: 42px; border-radius: 12px; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center; background: var(--brand-50); color: var(--brand-600);
}
.stat-icon .ic { width: 21px; height: 21px; }
.stat-icon.t-accent { background: var(--accent-50); color: var(--accent-600); }
.stat-icon.t-danger { background: var(--danger-50); color: var(--danger); }
.stat-icon.t-warning { background: var(--warning-50); color: var(--warning); }
.stat-icon.t-info { background: var(--info-50); color: var(--info); }
.stat-icon.t-success { background: var(--success-50); color: var(--success); }
.stat-label { font-size: .78rem; color: var(--muted); font-weight: 500; }
.stat-value { font-size: 1.4rem; font-weight: 700; letter-spacing: -.3px; line-height: 1.25; font-variant-numeric: tabular-nums; }
.stat-value.sm { font-size: 1.12rem; }
.stat-meta { font-size: .75rem; color: var(--faint); margin-top: 2px; }
@media (max-width: 575.98px) {
  .stat { padding: 12px; gap: 10px; flex-direction: column; }
  .stat-icon { width: 36px; height: 36px; }
  .stat-value { font-size: 1.15rem; }
  .stat-value.sm { font-size: 1rem; }
}

/* ---------- Badges ---------- */
.badge { font-weight: 600; font-size: .72rem; padding: .38em .7em; border-radius: 20px; letter-spacing: .1px; display: inline-flex; align-items: center; gap: 4px; }
.badge .ic { width: 12px; height: 12px; }
.badge-soft-success { background: var(--success-50); color: var(--success); }
.badge-soft-danger { background: var(--danger-50); color: var(--danger); }
.badge-soft-warning { background: var(--warning-50); color: #b45309; }
.badge-soft-info { background: var(--info-50); color: var(--info); }
.badge-soft-secondary { background: var(--secondary-50); color: var(--secondary); }
.badge-soft-primary { background: var(--brand-50); color: var(--brand-700); }
.badge-soft-accent { background: var(--accent-50); color: var(--accent-600); }
.lead-status {
  color: var(--st); background: color-mix(in srgb, var(--st) 12%, #fff);
  border: 1px solid color-mix(in srgb, var(--st) 25%, #fff);
}
.lead-status::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--st); }

/* ---------- Tables (desktop) → Cards (mobile) ---------- */
.table-modern { margin: 0; font-size: .875rem; --bs-table-bg: transparent; }
.table-modern thead th {
  font-size: .72rem; text-transform: uppercase; letter-spacing: .6px; color: var(--muted);
  font-weight: 600; background: #f8fafb; border-bottom: 1px solid var(--border); padding: 11px 14px; white-space: nowrap;
}
.table-modern tbody td { padding: 12px 14px; vertical-align: middle; border-color: var(--border-2); }
.table-modern tbody tr:hover td { background: #fafcfc; }
.table-modern tbody tr:last-child td { border-bottom: 0; }
.table-modern .t-strong { font-weight: 600; color: var(--text); }
.table-modern .t-sub { font-size: .78rem; color: var(--muted); }
.table-modern tfoot td { font-weight: 700; background: #f8fafb; padding: 12px 14px; border-top: 2px solid var(--border); }
.cell-title { display: flex; align-items: center; gap: 10px; min-width: 0; }
.cell-actions { display: flex; gap: 6px; justify-content: flex-end; align-items: center; flex-wrap: nowrap; }
.cell-actions form { margin: 0; }
.td-num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.data-panel { overflow: hidden; }
.data-panel .table-responsive { margin: 0; }

@media (max-width: 767.98px) {
  .data-panel { background: transparent; border: 0; box-shadow: none; overflow: visible; }
  .data-panel > .panel-head { padding: 0 2px 10px; border: 0; }
  .table-cards thead { display: none; }
  .table-cards, .table-cards tbody, .table-cards tr, .table-cards td { display: block; width: 100%; }
  .table-cards tfoot { display: block; }
  .table-cards tr {
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 12px 14px; margin-bottom: 12px; box-shadow: var(--shadow-sm);
  }
  .table-cards tbody tr:hover td { background: transparent; }
  .table-cards td {
    border: 0 !important; padding: 5px 0 !important; display: flex; justify-content: space-between;
    align-items: center; gap: 14px; text-align: right !important; min-height: 28px;
  }
  .table-cards td::before {
    content: attr(data-label); font-size: .74rem; font-weight: 600; color: var(--muted);
    text-transform: uppercase; letter-spacing: .4px; text-align: left; flex-shrink: 0;
  }
  .table-cards td.td-title { display: block; text-align: left !important; padding: 0 0 10px !important; margin-bottom: 6px; border-bottom: 1px dashed var(--border) !important; }
  .table-cards td.td-title::before, .table-cards td.td-actions::before, .table-cards td.td-full::before { display: none; }
  .table-cards td.td-full { display: block; text-align: left !important; }
  .table-cards td.td-actions { padding-top: 10px !important; margin-top: 6px; border-top: 1px dashed var(--border) !important; }
  .table-cards td.td-actions .cell-actions { width: 100%; justify-content: flex-end; flex-wrap: wrap; }
  .table-cards td.td-hide-sm { display: none; }
  .table-cards td:empty { display: none; }
  .table-cards tfoot tr { background: var(--brand-50); border-color: var(--brand-100); }
  .table-cards tfoot td { background: transparent; }
  .table-cards .td-num { white-space: normal; }
}

/* ---------- Toolbar / filters ---------- */
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 14px; }
.search-box { position: relative; flex: 1; min-width: 200px; }
.search-box .ic { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--faint); }
.search-box input { padding-left: 38px; }
.form-control, .form-select { border-radius: 10px; border-color: #dbe1e7; font-size: .9rem; padding: .55rem .8rem; }
.form-control-lg { font-size: 1.05rem; }
.form-control:focus, .form-select:focus { border-color: var(--brand-500); box-shadow: 0 0 0 .2rem rgba(15, 118, 110, .15); }
.form-label { font-size: .8rem; font-weight: 600; color: #334155; margin-bottom: .35rem; }
.form-text { font-size: .76rem; }
.form-section { font-size: .78rem; text-transform: uppercase; letter-spacing: .8px; color: var(--brand-600); font-weight: 700; margin: 6px 0 12px; display: flex; align-items: center; gap: 8px; }
.form-section::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.input-group-text { background: #f6f8fa; border-color: #dbe1e7; border-radius: 10px; font-size: .9rem; }
.form-sticky-actions {
  position: sticky; bottom: calc(var(--bottomnav-h) + var(--safe-b)); z-index: 5;
  background: rgba(255,255,255,.96); backdrop-filter: blur(6px);
  border-top: 1px solid var(--border); padding: 12px 14px; margin: 0 -14px -14px; display: flex; gap: 8px; justify-content: flex-end;
  border-radius: 0 0 var(--radius) var(--radius);
}
@media (min-width: 992px) { .form-sticky-actions { position: static; margin: 0 -18px -18px; padding: 14px 18px; background: #fbfcfd; } }
@media (max-width: 575.98px) { .form-sticky-actions .btn { flex: 1; } }

/* Chips (filters, quick dates) */
.chip-row { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; -webkit-overflow-scrolling: touch; }
.chip-row::-webkit-scrollbar { display: none; }
.chip {
  flex-shrink: 0; display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid var(--border); background: #fff; color: #334155; border-radius: 30px;
  padding: 6px 13px; font-size: .8rem; font-weight: 500; white-space: nowrap; transition: all .15s;
}
.chip:hover { border-color: var(--brand-500); color: var(--brand-700); }
.chip.active { background: var(--brand-600); border-color: var(--brand-600); color: #fff; }
.chip .count { background: rgba(15,27,42,.07); border-radius: 20px; padding: 0 7px; font-size: .72rem; font-weight: 700; }
.chip.active .count { background: rgba(255,255,255,.22); }
.chip.chip-danger.active { background: var(--danger); border-color: var(--danger); }
.chip.chip-warning.active { background: var(--warning); border-color: var(--warning); }
.chip .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--st, var(--faint)); }

/* Segmented control */
.seg-control { display: flex; background: #f1f4f7; border-radius: 10px; padding: 3px; gap: 3px; }
.seg-control .btn { flex: 1; border: 0; border-radius: 8px; font-size: .85rem; padding: .4rem .5rem; color: #475569; }
.seg-control .btn-check:checked + .btn { background: #fff; color: var(--brand-700); box-shadow: var(--shadow-sm); font-weight: 600; }
.seg-control #qlp-hot:checked + .btn, .seg-control .btn-check[value=hot]:checked + .btn { color: var(--danger); }

/* ---------- Key/value lists ---------- */
.kv { display: grid; grid-template-columns: 1fr; gap: 0; margin: 0; }
.kv > div { display: flex; justify-content: space-between; gap: 16px; padding: 10px 0; border-bottom: 1px dashed var(--border); }
.kv > div:last-child { border-bottom: 0; }
.kv dt { font-weight: 500; color: var(--muted); font-size: .84rem; }
.kv dd { margin: 0; font-weight: 600; text-align: right; word-break: break-word; }
@media (min-width: 768px) { .kv.kv-2 { grid-template-columns: 1fr 1fr; column-gap: 32px; } }
.amount-total { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px; border-radius: 12px; background: var(--brand-50); color: var(--brand-800); font-weight: 700; }
.amount-total .v { font-size: 1.25rem; }

/* ---------- Empty state ---------- */
.empty-state { text-align: center; padding: 48px 20px; color: var(--muted); }
.empty-state .empty-icon {
  width: 64px; height: 64px; border-radius: 20px; margin: 0 auto 14px;
  background: var(--brand-50); color: var(--brand-600); display: flex; align-items: center; justify-content: center;
}
.empty-state .empty-icon .ic { width: 30px; height: 30px; }
.empty-state h5 { color: var(--text); font-weight: 600; font-size: 1.02rem; }
.empty-state p { max-width: 420px; margin: 0 auto 16px; font-size: .88rem; }

/* ---------- Alerts / flash ---------- */
.alert { border-radius: 12px; border: 0; font-size: .9rem; }
.flash-alert { display: flex; align-items: flex-start; gap: 10px; box-shadow: var(--shadow-sm); padding-right: 3rem; }
.flash-alert > .ic { margin-top: 2px; }
.alert-success { background: var(--success-50); color: #065f46; }
.alert-danger { background: var(--danger-50); color: #991b1b; }
.alert-warning { background: var(--warning-50); color: #92400e; }
.alert-info { background: var(--info-50); color: #075985; }
.alert-soft { display: flex; gap: 12px; align-items: center; }

/* ---------- Pager ---------- */
.pager { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 16px; border-top: 1px solid var(--border-2); }
.pager-info { font-size: .8rem; color: var(--muted); }
.pagination { --bs-pagination-color: var(--brand-700); --bs-pagination-active-bg: var(--brand-600); --bs-pagination-active-border-color: var(--brand-600); --bs-pagination-border-radius: 8px; }
@media (max-width: 767.98px) { .pager { border: 0; padding: 4px 0; } }

/* ---------- Modals ---------- */
.modal-content { border: 0; border-radius: 18px; box-shadow: var(--shadow-lg); }
.modal-header { border-bottom: 1px solid var(--border-2); padding: 16px 20px; }
.modal-title { font-weight: 600; font-size: 1.05rem; display: flex; align-items: center; gap: 8px; }
.modal-title .ic { color: var(--brand-600); }
.modal-footer { border-top: 1px solid var(--border-2); }
.confirm-icon { width: 54px; height: 54px; border-radius: 50%; margin: 0 auto 12px; background: var(--danger-50); color: var(--danger); display: flex; align-items: center; justify-content: center; }
.confirm-icon .ic { width: 26px; height: 26px; }
@media (max-width: 575.98px) {
  .modal-fullscreen-sm-down .modal-content { border-radius: 0; }
  .modal-fullscreen-sm-down .modal-footer { padding-bottom: calc(.75rem + var(--safe-b)); }
}

/* ---------- Leads ---------- */
.lead-name { font-weight: 600; color: var(--text); }
.lead-name:hover { color: var(--brand-600); }
.lead-phone { font-size: .82rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.fu { display: inline-flex; align-items: center; gap: 5px; font-size: .8rem; font-weight: 500; white-space: nowrap; }
.fu .ic { width: 14px; height: 14px; }
.fu-overdue { color: var(--danger); }
.fu-today { color: #b45309; }
.fu-future { color: var(--muted); }
.status-select {
  border-radius: 20px; font-size: .78rem; font-weight: 600; padding: .25rem 1.9rem .25rem .7rem;
  color: var(--st); border-color: color-mix(in srgb, var(--st) 35%, #fff);
  background-color: color-mix(in srgb, var(--st) 9%, #fff); width: auto; max-width: 170px;
}
.quick-actions { display: flex; gap: 6px; }
.lead-hero { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.lead-hero h1 { font-size: 1.35rem; font-weight: 700; margin: 0; }
.lead-hero .phone-big { font-size: 1.05rem; font-weight: 600; color: var(--brand-700); font-variant-numeric: tabular-nums; }
.status-picker { display: flex; flex-wrap: wrap; gap: 8px; }
.status-picker button {
  border: 1px solid color-mix(in srgb, var(--st) 30%, #fff); color: var(--st); background: #fff;
  border-radius: 30px; padding: 6px 14px; font-size: .82rem; font-weight: 600; display: inline-flex; align-items: center; gap: 6px;
}
.status-picker button::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--st); }
.status-picker button.active { background: var(--st); color: #fff; border-color: var(--st); }
.status-picker button.active::before { background: #fff; }
.timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.timeline::before { content: ""; position: absolute; left: 17px; top: 6px; bottom: 6px; width: 2px; background: var(--border); }
.timeline li { position: relative; padding: 0 0 18px 50px; }
.timeline li:last-child { padding-bottom: 0; }
.tl-dot {
  position: absolute; left: 0; top: 0; width: 36px; height: 36px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; background: var(--brand-50); color: var(--brand-600); border: 3px solid #fff;
}
.tl-dot .ic { width: 16px; height: 16px; }
.tl-dot.t-whatsapp { background: #e6f7ec; color: #1faa53; }
.tl-dot.t-status { background: var(--accent-50); color: var(--accent-600); }
.tl-dot.t-meeting { background: var(--info-50); color: var(--info); }
.tl-dot.t-note { background: var(--secondary-50); color: var(--secondary); }
.tl-head { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; font-size: .8rem; color: var(--muted); }
.tl-head strong { color: var(--text); font-size: .86rem; }
.tl-body { background: #f8fafb; border: 1px solid var(--border-2); border-radius: 10px; padding: 10px 12px; margin-top: 6px; font-size: .88rem; white-space: pre-line; }
.due-list .due-item { display: flex; align-items: center; gap: 12px; padding: 12px 18px; border-bottom: 1px solid var(--border-2); }
.due-list .due-item:last-child { border-bottom: 0; }
@media (max-width: 575.98px) { .due-list .due-item { padding: 12px 14px; } }

/* ---------- Mini bar charts ---------- */
.bars { display: flex; align-items: flex-end; gap: 10px; height: 160px; padding-top: 10px; }
.bars .bar { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; }
.bars .bar-fill { width: 100%; max-width: 46px; border-radius: 8px 8px 3px 3px; background: linear-gradient(180deg, var(--brand-500), var(--brand-700)); min-height: 3px; position: relative; }
.bars .bar-val { font-size: .68rem; color: var(--muted); font-weight: 600; white-space: nowrap; }
.bars .bar-lbl { font-size: .72rem; color: var(--muted); }
.hbar { display: flex; align-items: center; gap: 10px; font-size: .84rem; padding: 6px 0; }
.hbar .hbar-name { width: 110px; flex-shrink: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbar .hbar-track { flex: 1; height: 8px; background: var(--border-2); border-radius: 6px; overflow: hidden; }
.hbar .hbar-fill { height: 100%; background: var(--st, var(--brand-600)); border-radius: 6px; }
.hbar .hbar-n { width: 32px; text-align: right; font-weight: 600; }

/* ---------- Settings hub ---------- */
.set-card { display: flex; gap: 14px; align-items: flex-start; padding: 18px; height: 100%; color: inherit; }
.set-card:hover { color: inherit; border-color: var(--brand-500); box-shadow: var(--shadow); }
.set-card h6 { margin: 0 0 3px; font-weight: 600; }
.set-card p { margin: 0; font-size: .82rem; color: var(--muted); }
.settings-tabs { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; margin-bottom: 16px; border-bottom: 1px solid var(--border); }
.settings-tabs::-webkit-scrollbar { display: none; }
.settings-tabs a { padding: 10px 14px; font-size: .86rem; font-weight: 500; color: var(--muted); border-bottom: 2px solid transparent; white-space: nowrap; display: inline-flex; gap: 6px; align-items: center; }
.settings-tabs a.active { color: var(--brand-700); border-bottom-color: var(--brand-600); }
.logo-preview { width: 96px; height: 96px; border-radius: 14px; border: 1px dashed var(--border); display: flex; align-items: center; justify-content: center; background: #fafbfc; overflow: hidden; }
.logo-preview img { max-width: 100%; max-height: 100%; object-fit: contain; }
.color-swatch { width: 38px; height: 38px; padding: 3px; border-radius: 10px; }
.pw-meter { height: 6px; border-radius: 4px; background: var(--border-2); overflow: hidden; margin-top: 6px; }
.pw-meter span { display: block; height: 100%; width: 0; transition: width .2s, background .2s; }
.pw-rules { list-style: none; padding: 0; margin: 8px 0 0; font-size: .78rem; display: grid; grid-template-columns: 1fr 1fr; gap: 2px 12px; }
.pw-rules li { color: var(--faint); display: flex; align-items: center; gap: 5px; }
.pw-rules li.ok { color: var(--success); }
.pw-rules li .ic { width: 13px; height: 13px; }

/* ---------- Checkbox picker (bulk allocate) ---------- */
.pick-list { max-height: 320px; overflow-y: auto; border: 1px solid var(--border); border-radius: 12px; }
.pick-list label { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-bottom: 1px solid var(--border-2); cursor: pointer; margin: 0; font-size: .88rem; }
.pick-list label:last-child { border-bottom: 0; }
.pick-list label:hover { background: #f8fafb; }
.pick-list .form-check-input { margin: 0; flex-shrink: 0; }
.form-check-input:checked { background-color: var(--brand-600); border-color: var(--brand-600); }
.form-switch .form-check-input:focus { box-shadow: 0 0 0 .2rem rgba(15, 118, 110, .15); }

/* ---------- Invoice paper ---------- */
.invoice-paper { background: #e9edf2; border-radius: var(--radius); padding: 18px; overflow-x: auto; }
.invoice-paper .inv-page { margin: 0 auto; box-shadow: 0 2px 12px rgba(15, 23, 42, .14); }
@media print {
  body.app { background: #fff; }
  .sidebar, .topbar, .bottom-nav, .app-footer, .no-print, .flash-alert, .toast-container { display: none !important; }
  .app-main { margin: 0 !important; }
  .app-content { padding: 0 !important; max-width: none; }
  .invoice-paper { background: #fff; box-shadow: none; padding: 0; border-radius: 0; overflow: visible; }
  .invoice-paper .inv-page { margin: 0; box-shadow: none; }
  body.app, .app-shell, .app-main, .app-content { margin: 0 !important; padding: 0 !important; }
}

/* ---------- Package customers / bulk invoices ---------- */
.pkg-toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.pax-table td, .pax-table th { white-space: nowrap; }
.pax-table .pax-name { white-space: normal; min-width: 160px; }
.pax-table .form-check-input { margin-top: 0; }
.import-preview td, .import-preview th { white-space: nowrap; font-size: .85rem; }
.import-preview td:last-child { white-space: normal; min-width: 180px; }
.gen-confirm-range { font-size: 1.05rem; line-height: 1.5; }
.gen-confirm-range .mono { white-space: nowrap; background: var(--bs-light, #f1f5f9); padding: 1px 6px; border-radius: 6px; }
.sig-preview { width: 180px; height: 70px; border: 1px dashed #cbd5e1; border-radius: 10px; display: flex; align-items: center; justify-content: center; background: #fff; overflow: hidden; }
.sig-preview img { max-width: 100%; max-height: 100%; }

/* ---------- Toasts ---------- */
.toast { border: 0; border-radius: 12px; box-shadow: var(--shadow-lg); }
.toast-container { z-index: 1090; }

/* ---------- Login page ---------- */
body.auth {
  min-height: 100vh; margin: 0; display: flex; align-items: stretch;
  background: var(--bg);
}
.auth-aside {
  display: none; flex: 1; position: relative; overflow: hidden; color: #fff; padding: 48px;
  background: radial-gradient(1200px 600px at -10% 110%, rgba(200,150,42,.35), transparent 60%),
              linear-gradient(160deg, var(--brand-700), var(--brand-900));
}
.auth-aside::after {
  content: ""; position: absolute; inset: 0; opacity: .08;
  background-image: radial-gradient(#fff 1px, transparent 1px); background-size: 22px 22px;
}
.auth-aside .inner { position: relative; z-index: 1; height: 100%; display: flex; flex-direction: column; justify-content: space-between; max-width: 520px; }
.auth-aside h2 { font-size: 2rem; font-weight: 700; line-height: 1.2; letter-spacing: -.5px; }
.auth-aside p { color: #bfe0dc; }
.auth-feature { display: flex; gap: 12px; align-items: flex-start; margin-top: 16px; color: #d7ecea; font-size: .92rem; }
.auth-feature .ic { color: var(--accent); width: 20px; height: 20px; margin-top: 2px; }
.auth-main { flex: 1; display: flex; align-items: center; justify-content: center; padding: 24px 18px; }
.auth-card { width: 100%; max-width: 410px; }
.auth-card .brand-mark { width: 52px; height: 52px; border-radius: 16px; }
.auth-card h1 { font-size: 1.45rem; font-weight: 700; margin: 18px 0 4px; }
.auth-card .form-control { padding: .7rem .9rem; }
.pw-toggle { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); width: 36px; height: 36px; color: var(--muted); }
@media (min-width: 992px) { .auth-aside { display: block; } }
@media (min-width: 768px) { .w-md-auto { width: auto !important; } }

/* ---- refinements ---- */
.table-modern td[data-label="Date"], .table-modern td[data-label="Allocated"], .table-modern td[data-label="Dates"],
.table-modern td[data-label="Follow-up"], .table-modern .inv-no { white-space: nowrap; }
.fs-5.fu-future { color: var(--brand-700); }
.lead-hero > .flex-grow-1 { flex: 1 1 0; }
@media (max-width: 575.98px) {
  .lead-hero { gap: 12px; }
  .lead-hero .avatar-lg { width: 48px; height: 48px; font-size: 1rem; }
  .lead-hero h1 { font-size: 1.15rem; }
}
@media (min-width: 992px) { .collapse.collapse-lg-open { display: block !important; height: auto !important; } }
.form-control, .form-select { background-color: #fff; }
.form-control:disabled, .form-select:disabled { background-color: #f1f4f7; }
[hidden] { display: none !important; }
