/* Westford CRM — single stylesheet, no external deps */
:root {
  /* Westford BD Brand Color Guidelines v1.0 */
  --color-brand-primary: #8D1920;
  --color-brand-hover: #B22030;
  --color-brand-active: #6A1118;
  --color-brand-tint: #F5E6E7;
  --color-white: #FFFFFF;
  --color-off-white: #F8F4F4;
  --color-text-dark: #1A1A1A;
  --color-text-muted: #5C5C5C;
  --color-border: #E8E0E0;

  /* App aliases */
  --brand: var(--color-brand-primary);
  --brand-hover: var(--color-brand-hover);
  --brand-active: var(--color-brand-active);
  --brand-tint: var(--color-brand-tint);
  --sidebar: var(--color-text-dark);
  --bg: var(--color-off-white);
  --card: var(--color-white);
  --text: var(--color-text-dark);
  --muted: var(--color-text-muted);
  --border: var(--color-border);
  --danger: var(--color-brand-primary);
  --success: #1e7e46;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(26, 26, 26, .07);
}

/* ---- Dark mode ---- */
[data-theme="dark"] {
  --sidebar: #141414;
  --bg: #1A1A1A;
  --card: #242424;
  --text: var(--color-off-white);
  --muted: #a3a3a3;
  --border: #3a3535;
  --brand-tint: #3d2426;
  --shadow: 0 1px 3px rgba(0, 0, 0, .4);
}
[data-theme="dark"] input, [data-theme="dark"] select, [data-theme="dark"] textarea {
  background: #2c2c2c; color: var(--text); border-color: var(--border);
}
[data-theme="dark"] .btn { background: #2c2c2c; color: var(--text); border-color: var(--border); }
[data-theme="dark"] .btn:hover { background: #363636; }
[data-theme="dark"] .btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
[data-theme="dark"] .btn-primary:hover { background: var(--brand-hover); }
[data-theme="dark"] .btn-danger { background: transparent; color: #e07b7b; border-color: #5a3535; }
[data-theme="dark"] .btn-danger:hover { background: var(--brand-tint); }
[data-theme="dark"] a { color: #e07b7b; }
[data-theme="dark"] .link { color: #e07b7b; }
[data-theme="dark"] .code, [data-theme="dark"] .stat-value { color: #e07b7b; }
[data-theme="dark"] tr.row-link:hover { background: #2c2c2c; }
[data-theme="dark"] .badge-red { background: var(--brand-tint); color: #eab6b9; }
[data-theme="dark"] .badge-blue { background: rgba(92, 148, 214, .16); color: #9cc0e8; }
[data-theme="dark"] .badge-amber { background: #3d3420; color: #e5c56a; }
[data-theme="dark"] .badge-green { background: #1e3427; color: #7fd6a4; }
[data-theme="dark"] .badge-gray, [data-theme="dark"] .badge-purple { background: #333; color: #bbb; }
[data-theme="dark"] .flash-error { background: var(--brand-tint); color: #eab6b9; border-color: #5a3535; }
[data-theme="dark"] .flash-success { background: #1e3427; color: #7fd6a4; border-color: #2c4a37; }
[data-theme="dark"] .remarks { background: #2c2c2c; }
[data-theme="dark"] .login-card { background: var(--card); }
[data-theme="dark"] .login-brand p { color: var(--muted); }

* { margin: 0; padding: 0; box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  font: 14px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}
a { color: var(--brand); text-decoration: none; }
h1 { font-size: 22px; font-weight: 700; }
h2 { font-size: 15px; font-weight: 600; }

/* ---- Layout ---- */
.app { display: flex; min-height: 100vh; }
/* column layout so the copyright footer can be pushed to the bottom
   (margin-top:auto) on short pages instead of floating mid-screen */
.main { flex: 1; padding: 24px 32px; min-width: 0; display: flex; flex-direction: column; }

/* Mobile top bar + hamburger — hidden on desktop, shown ≤820px */
.mobile-bar { display: none; }
.nav-toggle {
  display: none; width: 40px; height: 40px; border: 0; background: none;
  cursor: pointer; padding: 9px 8px; flex-direction: column; justify-content: space-between;
}
.nav-toggle span {
  display: block; height: 2.5px; width: 100%; background: #fff; border-radius: 2px;
  transition: transform .2s, opacity .2s;
}
.sidebar-backdrop { display: none; }

/* ---- Sidebar ---- */
.sidebar {
  width: 232px; flex-shrink: 0; display: flex; flex-direction: column;
  background: var(--sidebar); color: #fff; position: sticky; top: 0; height: 100vh;
}
.brand { padding: 22px 18px 16px; }
.brand-logo { width: 100%; max-width: 180px; height: auto; display: block; }
.nav { flex: 1; padding: 8px 10px; display: flex; flex-direction: column; gap: 2px; }
.nav a, .nav-soon {
  display: flex; align-items: center; gap: 10px; padding: 9px 12px;
  border-radius: 7px; color: rgba(255,255,255,.82); font-size: 13.5px;
}
.nav a:hover { background: rgba(255,255,255,.08); color: #fff; }
.nav a.active { background: var(--brand); color: #fff; font-weight: 600; }
.nav-soon { color: rgba(255,255,255,.35); cursor: default; }
.nav-soon em { font-size: 10px; font-style: normal; margin-left: auto; border: 1px solid rgba(255,255,255,.2); padding: 1px 6px; border-radius: 8px; }
.nav-ico { width: 18px; text-align: center; }
.sidebar-footer { padding: 14px 18px; border-top: 1px solid rgba(255,255,255,.12); }
.user-chip { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.avatar {
  width: 32px; height: 32px; border-radius: 50%; background: var(--brand);
  display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 14px;
}
.user-meta { display: flex; flex-direction: column; line-height: 1.25; }
.user-meta strong { font-size: 13px; }
.user-meta span { font-size: 11px; opacity: .6; }
.sidebar-actions { display: flex; align-items: center; justify-content: space-between; }
.logout { font-size: 12px; color: rgba(255,255,255,.55); }
.logout:hover { color: #fff; }
.theme-toggle, .notif-bell {
  position: relative; display: inline-flex; align-items: center; justify-content: center;
  background: rgba(255,255,255,.08); border: 0; border-radius: 20px; cursor: pointer;
  color: #fff; font-size: 14px; padding: 5px 14px; line-height: 1; text-decoration: none;
}
.theme-toggle:hover, .notif-bell:hover { background: rgba(255,255,255,.18); }
.sidebar-logout {
  display: block; padding: 13px 18px; text-align: center;
  background: rgba(141, 25, 32, .45); color: rgba(255,255,255,.9);
  font-size: 13px; font-weight: 600; letter-spacing: .3px;
}
.sidebar-logout:hover { background: var(--brand); color: #fff; }
.sidebar-lock {
  display: block; padding: 10px 18px; text-align: center; border-top: 1px solid rgba(255,255,255,.08);
  color: rgba(255,255,255,.82); font-size: 13px; font-weight: 600; letter-spacing: .3px;
}
.sidebar-lock:hover { background: rgba(255,255,255,.08); color: #fff; }
.theme-ico-dark { display: none; }
[data-theme="dark"] .theme-ico-dark { display: inline; }
[data-theme="dark"] .theme-ico-light { display: none; }

/* ---- Page head ---- */
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.muted { color: var(--muted); }
.btn-group { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.btn-group form { display: inline; }
/* Compact action row atop the Case Team card (Book Appt / Portal invite) */
.team-quick-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: stretch; }
/* Both children (the <a> button and the <form> holding a button) share width */
.team-quick-actions > .btn,
.team-quick-actions > form { flex: 1 1 0; min-width: 104px; }
.team-quick-actions > form { display: flex; margin: 0; }
/* icon-only action (PDF download) — never grows, keeps the row on one line */
.team-quick-actions > .qa-icon {
  flex: 0 0 auto; min-width: 0; padding-left: 13px; padding-right: 13px; font-size: 15px;
}
/* buttons fill their flex slot (the form wrapper needs this) — but the
   icon-only button must stay its natural width, or it eats the whole row */
.team-quick-actions .btn { width: 100%; justify-content: center; }
.team-quick-actions .qa-icon { width: auto; }

/* ---- Cards ---- */
.card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 18px 20px; margin-bottom: 18px;
}
.card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.empty { color: var(--muted); padding: 18px 0; text-align: center; }

/* ---- Stats ---- */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; margin-bottom: 20px; }
.stat-card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 16px 18px; display: flex; flex-direction: column; gap: 4px;
}
.stat-label { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; }
.stat-value { font-size: 21px; font-weight: 700; color: var(--brand); font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ---- Tables ---- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th {
  text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .4px;
  color: var(--muted); padding: 8px 10px; border-bottom: 2px solid var(--border);
}
td { padding: 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
tbody tr:last-child td { border-bottom: 0; }
tr.row-link { cursor: pointer; }
tr.row-link:hover { background: var(--color-off-white); }
.code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; color: var(--brand); font-weight: 600; }
.actions { white-space: nowrap; text-align: right; }
.actions .inline { display: inline; margin-left: 8px; }

/* ---- Badges ---- */
.badge {
  display: inline-block; font-size: 11.5px; font-weight: 600; padding: 2px 9px;
  border-radius: 20px; white-space: nowrap;
}
.badge-blue   { background: #E7EEF7; color: #2B5B8F; }
.badge-amber  { background: #fdf3d9; color: #96700d; }
.badge-purple { background: #efe6e6; color: #1A1A1A; }
.badge-green  { background: #e0f3e8; color: #1e7e46; }
.badge-red    { background: var(--color-brand-tint); color: var(--color-brand-active); }
.badge-gray   { background: #ececec; color: var(--color-text-muted); }

/* ---- Buttons ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px 16px; border-radius: 7px; border: 1px solid var(--border);
  background: #fff; color: var(--text); font-size: 13.5px; font-weight: 600;
  cursor: pointer; line-height: 1.2; font-family: inherit;
}
.btn:hover { background: var(--bg); }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-hover); }
.btn-primary:active { background: var(--brand-active); }
.btn-danger { background: #fff; color: var(--brand-active); border-color: var(--brand-tint); }
.btn-danger:hover { background: var(--brand-tint); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn-ghost:hover { color: var(--text); background: var(--bg); }
/* Secondary "clear filters" button — outlined, same height as the primary Filter button */
.btn-reset { background: var(--card); color: var(--text); border-color: var(--border); }
.btn-reset:hover { border-color: var(--brand); color: var(--brand); background: var(--brand-tint); }
.btn-block { width: 100%; justify-content: center; }
.link { background: none; border: 0; cursor: pointer; font-size: 13.5px; color: var(--brand); font-weight: 500; padding: 0; }
.link-danger { color: var(--danger); }

/* ---- Forms ---- */
input, select, textarea {
  width: 100%; padding: 8px 11px; border: 1px solid var(--border); border-radius: 7px;
  font: inherit; background: #fff; color: var(--text);
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(141, 25, 32, .12);
}
label { display: flex; flex-direction: column; gap: 5px; font-size: 12.5px; font-weight: 600; color: var(--muted); }

/* International phone input: country-code select joined to the number box */
.phone-group { display: flex; width: 100%; }
.phone-group select.phone-cc {
  flex: 0 0 auto; width: auto; min-width: 92px;
  border-top-right-radius: 0; border-bottom-right-radius: 0; border-right: 0;
  background: var(--bg); font-variant-numeric: tabular-nums;
}
.phone-group input { flex: 1; min-width: 0; border-top-left-radius: 0; border-bottom-left-radius: 0; }
[data-theme="dark"] .phone-group select.phone-cc { background: rgba(255, 255, 255, .04); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 18px; }
.form-grid .span-2, .form-section, .form-actions { grid-column: 1 / -1; }
.form-section {
  font-size: 13px; text-transform: uppercase; letter-spacing: .5px; color: var(--brand);
  border-bottom: 1px solid var(--border); padding-bottom: 6px; margin-top: 8px;
}
.form-actions { display: flex; gap: 10px; margin-top: 6px; }

/* ---- Filters ---- */
/* Filter bar: labeled fields, aligned control row, actions at the end */
.filters { display: flex; gap: 12px 14px; margin-bottom: 16px; flex-wrap: wrap; align-items: flex-end; }
.f-field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.f-field > span {
  font-size: 10.5px; font-weight: 700; letter-spacing: .06em;
  text-transform: uppercase; color: var(--muted);
}
.f-field select, .f-field input { width: auto; min-width: 150px; height: 38px; }
.f-field input[type="date"] { min-width: 136px; }
.f-grow { flex: 1 1 230px; }
.f-grow input { width: 100%; min-width: 0; }
.f-actions { display: flex; gap: 8px; align-items: flex-end; }
.filters .btn { flex-shrink: 0; height: 38px; }

/* ---- Detail grid ---- */
.detail-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px 20px; }
.detail-grid dt { font-size: 11.5px; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); margin-bottom: 2px; }
.detail-grid dd { font-weight: 500; }
.remarks { margin-top: 14px; padding: 12px; background: var(--bg); border-radius: 7px; color: var(--text); }

/* ---- Two column ---- */
.two-col { display: grid; grid-template-columns: 2fr 1fr; gap: 18px; align-items: start; }
/* Grid children must be allowed to shrink below their content width,
   otherwise a wide table inside .table-wrap blows the whole layout open */
.two-col > * { min-width: 0; }
@media (max-width: 1000px) { .two-col { grid-template-columns: 1fr; } }

/* ---- Notes timeline ---- */
.note-form { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.timeline { list-style: none; display: flex; flex-direction: column; gap: 0; }
.timeline li { padding: 12px 0 12px 16px; border-left: 2px solid var(--border); position: relative; }
.timeline li::before {
  content: ""; position: absolute; left: -5px; top: 18px; width: 8px; height: 8px;
  border-radius: 50%; background: var(--brand);
}
.timeline-meta { display: flex; justify-content: space-between; gap: 10px; margin-bottom: 3px; font-size: 12.5px; }

/* ---- Uploads ---- */
.upload-row { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.upload-row select, .upload-row input[type="text"] { width: auto; flex: 1; min-width: 130px; }
.upload-row input[type="file"] { width: auto; flex: 2; min-width: 180px; }

/* ---- Flash ---- */
.flash { padding: 11px 16px; border-radius: 8px; margin-bottom: 16px; font-weight: 500; }
.flash-success { background: #e0f3e8; color: var(--success); border: 1px solid #bfe5cf; }
.flash-error   { background: var(--brand-tint); color: var(--brand-active); border: 1px solid #ebd2d4; }

/* ---- Pagination ---- */
.pagination { display: flex; align-items: center; justify-content: center; gap: 18px; margin-top: 4px; }
.pagination a { font-weight: 600; }

/* ---- Login ---- */
/* column: the copyright footer must sit BELOW the card, not beside it */
.login-body { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 100vh; background: var(--color-text-dark); padding: 24px 16px; box-sizing: border-box; }
.login-body .standalone-copy { width: 100%; max-width: 400px; margin: 22px 0 0; padding: 14px 0 0;
  border-top-color: rgba(255,255,255,.12); color: #a3a3a3; }
.login-card { background: #fff; border-radius: 14px; padding: 36px 34px; width: 100%; max-width: 400px; box-shadow: 0 12px 40px rgba(0,0,0,.28); }
.login-brand { text-align: center; margin-bottom: 22px; }
.login-logo { max-width: 260px; width: 100%; height: auto; margin: 0 auto 4px; }
.login-logo-dark { display: none; }
[data-theme="dark"] .login-logo-dark { display: inline-block; }
[data-theme="dark"] .login-logo-light { display: none; }
.login-brand p { color: var(--muted); font-size: 13px; margin-top: 4px; }
.login-card form { display: flex; flex-direction: column; gap: 14px; }
.login-alt { text-align: center; margin-top: 16px; font-size: 13px; }
.login-alt a { color: var(--brand); text-decoration: none; }
.login-alt a:hover { text-decoration: underline; }
.login-help { margin-bottom: 14px; }
[data-theme="dark"] .login-alt a { color: #e07b7b; }

/* ---- Tabs ---- */
.tabs {
  display: flex; gap: 4px; margin-bottom: 18px; border-bottom: 2px solid var(--border);
  overflow-x: auto; overflow-y: hidden;
  scrollbar-width: none;           /* Firefox */
  -ms-overflow-style: none;        /* old Edge */
}
.tabs::-webkit-scrollbar { display: none; } /* Chrome/Safari */
.tabs a {
  padding: 9px 16px; font-weight: 600; font-size: 13.5px; color: var(--muted);
  border-bottom: 2px solid transparent; margin-bottom: -2px; white-space: nowrap;
}
.tabs a:hover { color: var(--text); }
.tabs a.active { color: var(--brand); border-bottom-color: var(--brand); }
[data-theme="dark"] .tabs a.active { color: #e07b7b; border-bottom-color: #e07b7b; }
.tab-count {
  background: var(--bg); border: 1px solid var(--border); border-radius: 10px;
  font-size: 11px; padding: 0 7px; margin-left: 4px;
}

/* ---- Misc ---- */
.text-danger { color: var(--danger); }
[data-theme="dark"] .text-danger { color: #e07b7b; }
.stack-form { display: flex; flex-direction: column; gap: 12px; }

/* ---- Communication chat ---- */
.comm-card { display: flex; flex-direction: column; }
.chat {
  display: flex; flex-direction: column; gap: 12px;
  max-height: 520px; overflow-y: auto; padding: 6px 4px 14px;
}
.chat-msg { display: flex; }
.chat-msg.own { justify-content: flex-end; }
.chat-bubble {
  max-width: 72%; background: var(--bg); border: 1px solid var(--border);
  border-radius: 12px 12px 12px 4px; padding: 10px 14px;
}
.chat-msg.own .chat-bubble {
  border-radius: 12px 12px 4px 12px;
  background: var(--brand-tint); border-color: transparent;
}
[data-theme="dark"] .chat-bubble { background: #2c2c2c; }
[data-theme="dark"] .chat-msg.own .chat-bubble { background: var(--brand-tint); }
.chat-meta { margin-bottom: 4px; }
.chat-type {
  font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .4px;
  color: var(--brand);
}
[data-theme="dark"] .chat-type { color: #e07b7b; }
.chat-dir {
  font-weight: 500; color: var(--muted); text-transform: none; letter-spacing: 0;
  margin-left: 8px;
}
.chat-bubble p { font-size: 13.5px; }
.chat-audio { width: 100%; margin-top: 8px; height: 36px; }
.chat-foot { margin-top: 6px; font-size: 11.5px; color: var(--muted); }
.chat-form { border-top: 1px solid var(--border); padding-top: 14px; display: flex; flex-direction: column; gap: 8px; }
.chat-form-row { display: flex; gap: 8px; }
.chat-form-row select, .chat-form-row input[type="number"] { width: auto; min-width: 130px; }
.chat-form-row textarea { flex: 1; resize: vertical; }
.chat-form-row .btn { align-self: stretch; }

/* ---- Glance panel ---- */
.glance { grid-template-columns: 1fr 1fr; }

/* ---- Intake questionnaire ---- */
.intake-details summary {
  cursor: pointer; font-weight: 700; font-size: 15px; display: flex;
  align-items: center; gap: 10px; flex-wrap: wrap;
}
.intake-details summary .muted { font-weight: 400; font-size: 12.5px; }
.intake-details[open] summary { margin-bottom: 16px; }
.emp-row {
  border: 1px dashed var(--border); border-radius: 8px;
  padding: 12px 14px; margin-bottom: 10px; margin-top: 10px;
}
.emp-row, .edu-row { position: relative; }
.row-remove {
  position: absolute; top: 8px; right: 10px; z-index: 1;
  background: none; border: 0; cursor: pointer;
  font-size: 12px; font-weight: 600; color: var(--brand-active);
  padding: 3px 8px; border-radius: 6px;
}
.row-remove:hover { background: var(--brand-tint); }
[data-theme="dark"] .row-remove { color: #e07b7b; }
.emp-row:only-child .row-remove, .edu-row:only-child .row-remove { display: none; }
.check-label {
  flex-direction: row !important; align-items: center; gap: 8px;
  align-self: end; padding-bottom: 8px;
}
.check-label input { width: auto; }
#add-employment { margin-bottom: 16px; }
/* ---- Section-wise form cards ---- */
.form-card { border-left: 3px solid var(--brand); }
.form-card-title {
  font-size: 14px; font-weight: 700; color: var(--brand);
  text-transform: uppercase; letter-spacing: .5px;
  margin-bottom: 16px; padding-bottom: 10px; border-bottom: 1px solid var(--border);
}
[data-theme="dark"] .form-card-title { color: #e07b7b; }

/* ---- Case team member cards ---- */
.team-member { padding: 12px 0; border-top: 1px solid var(--border); }
.team-member:first-of-type { border-top: 0; padding-top: 0; }
.assign-title {
  display: block; font-size: 11.5px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .4px; color: var(--muted); margin-bottom: 8px;
}
.team-member-row { display: flex; align-items: center; gap: 10px; }
.team-avatar, .team-avatar-fallback { width: 42px; height: 42px; border-radius: 10px; flex-shrink: 0; }
.team-avatar-fallback {
  display: flex; align-items: center; justify-content: center;
  background: var(--brand); color: #fff; font-weight: 700; font-size: 17px;
}
.team-avatar-empty { background: var(--bg); color: var(--muted); border: 1px dashed var(--border); }
.team-member-meta { flex: 1; display: flex; flex-direction: column; line-height: 1.35; min-width: 0; }
.team-member-meta .muted { font-size: 12.5px; }
.btn-small { padding: 6px 12px; font-size: 12.5px; }
.team-member .assign-row { margin-top: 10px; }

/* ---- Notification bell ---- */
.notif-count {
  position: absolute; top: -5px; right: -6px; background: var(--brand);
  color: #fff; font-size: 10px; font-weight: 700; border-radius: 10px;
  padding: 1px 5px; line-height: 1.3; min-width: 16px; text-align: center;
}
.notif-list { display: flex; flex-direction: column; }
.notif-item {
  display: flex; align-items: center; gap: 12px; padding: 12px 6px;
  border-bottom: 1px solid var(--border); color: var(--text);
}
.notif-item:last-child { border-bottom: 0; }
.notif-item:hover { background: var(--bg); }
.notif-dot { width: 8px; height: 8px; border-radius: 50%; background: transparent; flex-shrink: 0; }
.notif-item.unread .notif-dot { background: var(--brand); }
.notif-item.unread strong { color: var(--brand); }
.notif-side { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex-shrink: 0; }
[data-theme="dark"] .notif-item.unread strong { color: #e07b7b; }
.notif-main { flex: 1; display: flex; flex-direction: column; line-height: 1.4; min-width: 0; }
.notif-time { white-space: nowrap; }

/* ---- Document checklist ---- */
.doc-row {
  display: flex; align-items: center; gap: 14px; padding: 12px 4px;
  border-bottom: 1px solid var(--border);
}
.doc-row:last-of-type { border-bottom: 0; }
.doc-main { flex: 1; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.doc-actions { display: flex; gap: 6px; align-items: center; white-space: nowrap; }
.doc-inline-form {
  display: flex; gap: 8px; align-items: center; padding: 10px 4px 14px;
  border-bottom: 1px solid var(--border); flex-wrap: wrap;
}
.doc-inline-form select { width: auto; }
.doc-inline-form input[type="text"] { flex: 1; min-width: 200px; }
.docs-toolbar { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.doctype-list {
  max-height: 320px; overflow-y: auto; border: 1px solid var(--border);
  border-radius: 8px; padding: 4px 10px;
}
.doctype-item {
  align-items: flex-start !important; padding: 7px 0 !important;
  border-bottom: 1px dashed var(--border);
}
.doctype-item:last-child { border-bottom: 0; }
.doctype-item input { margin-top: 3px; }
.doctype-text { display: flex; flex-direction: column; gap: 1px; line-height: 1.35; font-size: 13px; }
.doctype-text .badge { align-self: flex-start; }
.doctype-done { opacity: .55; }
.doctype-all { padding: 0 0 4px !important; }
.doctype-search { margin-bottom: 2px; }
.inv-group {
  font-size: 10.5px; font-weight: 800; text-transform: uppercase; letter-spacing: .5px;
  color: var(--brand); padding: 8px 0 3px;
}
[data-theme="dark"] .inv-group { color: #e07b7b; }
.invoice-lines { border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; }
.invoice-line { display: flex; align-items: center; gap: 8px; padding: 5px 0; }
.invoice-line-name { flex: 1; font-size: 12.5px; font-weight: 600; }
.invoice-line input[name="amounts[]"],
.invoice-line input[name="custom_amounts[]"] {
  width: 110px; flex: 0 0 110px; text-align: right;
}
.invoice-line input[name="custom_names[]"] {
  flex: 1 1 auto; width: auto; min-width: 0;
}
.invoice-discount-inputs { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--border); }
#invoice-lines .btn-small { align-self: flex-start; margin-top: 8px; }
.invoice-lines { display: flex; flex-direction: column; }
#invoice-empty { padding: 4px 0; }
.invoice-total {
  display: flex; justify-content: space-between; align-items: center;
  border-top: 1px solid var(--border); margin-top: 8px; padding-top: 8px; font-size: 13px;
}
.invoice-total strong { color: var(--text); }
.invoice-total.invoice-grand { font-size: 14px; }
.invoice-total.invoice-grand strong { color: var(--brand); }

/* Refund panel: boxed live calculation, clearly separated from the fields */
.ref-calc {
  background: var(--bg); border: 1px solid var(--border); border-radius: 10px;
  padding: 2px 14px; margin: 2px 0 6px;
}
.ref-calc .invoice-total { padding: 9px 0; }
.ref-calc .invoice-total + .invoice-total { border-top: 1px dashed var(--border); }
[data-theme="dark"] .ref-calc { background: rgba(255, 255, 255, .03); }
[data-theme="dark"] .invoice-total.invoice-grand strong { color: #e07b7b; }

.custom-line input[name="custom_names[]"] { flex: 1; }
.custom-line { width: 100%; }
.doc-file-row {
  display: flex; gap: 10px; align-items: baseline; padding: 5px 4px 5px 22px;
  border-bottom: 1px dashed var(--border); font-size: 12.5px;
}
.doc-file-row:last-of-type { border-bottom: 1px solid var(--border); }
.doc-file-name { font-weight: 600; overflow-wrap: anywhere; }
.doc-file-actions { margin-left: auto; white-space: nowrap; display: flex; gap: 8px; align-items: center; }

/* ---- Confirm-before-save modal ---- */
.confirm-overlay {
  position: fixed; inset: 0; z-index: 1100;
  background: rgba(26, 26, 26, .55);
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
  animation: overlay-in .18s ease;
}
@keyframes overlay-in { from { opacity: 0; } to { opacity: 1; } }
.confirm-box {
  background: var(--card); border-radius: 14px; padding: 26px 28px;
  width: 100%; max-width: 420px; box-shadow: 0 18px 60px rgba(0, 0, 0, .35);
  border-top: 4px solid var(--brand);
}
.confirm-box { text-align: center; }
.confirm-box h3 { font-size: 16px; margin-bottom: 8px; }
.confirm-msg { color: var(--muted); font-size: 13.5px; margin-bottom: 20px; }
.confirm-actions { display: flex; gap: 10px; justify-content: center; }
.confirm-box.danger { border-top-color: var(--brand-active); }
.confirm-box.danger .confirm-title { color: var(--brand); }
[data-theme="dark"] .confirm-box.danger .confirm-title { color: #e07b7b; }
.confirm-type-row {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  margin-bottom: 18px; font-size: 12.5px; font-weight: 600;
}
.confirm-type-text { white-space: nowrap; }
.confirm-type-row b { color: var(--brand); }
.confirm-type-input {
  letter-spacing: 2px; font-weight: 700; text-transform: uppercase;
  text-align: center; max-width: 240px;
}
.btn-danger-solid { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-danger-solid:hover { background: var(--brand-hover); }
.btn-danger-solid:disabled { opacity: .45; cursor: not-allowed; }
[data-theme="dark"] .btn-danger-solid { background: var(--brand); color: #fff; border-color: var(--brand); }

/* ---- Toast notifications (float, never push content) ---- */
.flash-toast {
  position: fixed; top: 18px; left: 50%; transform: translateX(-50%);
  z-index: 1000; min-width: 300px; max-width: min(600px, 90vw);
  display: flex; align-items: center; gap: 10px;
  box-shadow: 0 10px 34px rgba(0, 0, 0, .22);
  animation: toast-in .28s ease;
  margin: 0;
}
.flash-toast-ico {
  width: 22px; height: 22px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 800; color: #fff;
}
.flash-toast.flash-success .flash-toast-ico { background: var(--success); }
.flash-toast.flash-error .flash-toast-ico { background: var(--brand-active); }
@keyframes toast-in {
  from { opacity: 0; transform: translate(-50%, -14px); }
  to   { opacity: 1; transform: translate(-50%, 0); }
}

/* ---- Application stage pipeline ---- */
:root {
  --stage-done-bg: #FBF3F4;
  --stage-done-check: #1e7e46;
}
[data-theme="dark"] {
  --stage-done-bg: #2c2123;
  --stage-done-check: #7fd6a4;
}
.stage-card { padding: 0 0 12px; overflow: hidden; }
.stage-track {
  display: flex; overflow-x: auto; overflow-y: hidden; border-bottom: 1px solid var(--border);
  scrollbar-width: none; -ms-overflow-style: none;
}
.stage-track::-webkit-scrollbar { display: none; }
.stage {
  flex: 1; min-width: 104px; text-align: center; padding: 18px 8px 16px;
  border-right: 1px solid var(--border); position: relative;
  display: flex; flex-direction: column; gap: 7px; align-items: center;
  background: var(--card);
}
.stage:last-child { border-right: 0; }
.stage-ico { font-size: 17px; line-height: 1; filter: grayscale(1); opacity: .4; }
.stage-label {
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px;
  color: var(--muted); line-height: 1.35;
}

/* completed: light blush, green check, red label */
.stage.done { background: var(--stage-done-bg); }
.stage.done .stage-ico {
  filter: none; opacity: 1; color: var(--stage-done-check); font-weight: 800; font-size: 16px;
}
.stage.done .stage-label { color: var(--brand); }
[data-theme="dark"] .stage.done .stage-label { color: #e08b91; }

/* current: strong tint + thick red underline */
.stage.active { background: var(--brand-tint); }
.stage.active::after {
  content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 4px;
  background: var(--brand);
}
.stage.active .stage-ico { filter: none; opacity: 1; }
.stage.active .stage-label { color: var(--brand); font-weight: 800; }
[data-theme="dark"] .stage.active .stage-label { color: #e07b7b; }
[data-theme="dark"] .stage.done .stage-label { color: #eab6b9; }
[data-theme="dark"] .stage.active .stage-label { color: #e07b7b; }
.stage-actions { padding: 12px 16px 0; }
.stage-note {
  display: flex; gap: 8px; align-items: baseline;
  font-size: 12.5px; color: var(--muted); line-height: 1.55;
  background: var(--bg); border: 1px solid var(--border); border-radius: 8px;
  padding: 8px 12px; margin-bottom: 10px;
}
.stage-note-ico { flex: 0 0 auto; }
.stage-btns { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.stage-btns-right { margin-left: auto; display: inline-flex; gap: 8px; align-items: center; }
.stage-advance { display: flex; gap: 8px; align-items: center; }
.stage-advance input[type="text"] { min-width: 280px; }
.stage-override select { width: auto; }

/* ---- Mini tabs (in-card tab panels) ---- */
.mini-tabs {
  display: flex; gap: 2px; border-bottom: 2px solid var(--border); margin-bottom: 16px;
  overflow-x: auto; overflow-y: hidden; scrollbar-width: none;
}
.mini-tabs::-webkit-scrollbar { display: none; }
.mini-tab {
  background: none; border: 0; cursor: pointer; padding: 8px 10px;
  font-size: 12.5px; font-weight: 700; color: var(--muted); font-family: inherit;
  border-bottom: 2px solid transparent; margin-bottom: -2px; white-space: nowrap;
}
.mini-tab:hover { color: var(--text); }
.mini-tab.active { color: var(--brand); border-bottom-color: var(--brand); }
[data-theme="dark"] .mini-tab.active { color: #e07b7b; border-bottom-color: #e07b7b; }

/* ---- Cases ---- */
.section-title { font-size: 14px; font-weight: 700; margin: 4px 0 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; }
.case-head {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 12px 16px; border-bottom: 1px solid var(--border);
}
.case-open-card { display: flex; flex-direction: column; gap: 12px; }
.case-open-head-row {
  display: flex; justify-content: space-between; align-items: center;
  gap: 14px; flex-wrap: wrap;
}
.case-open-head { display: flex; flex-direction: column; gap: 2px; }
#case-open-form-wrap { border-top: 1px solid var(--border); padding-top: 14px; }
.case-open-form { display: flex; flex-direction: column; gap: 10px; max-width: 720px; }
.case-open-row { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.case-open-row label { flex: 1; min-width: 180px; display: flex; flex-direction: column; gap: 6px; }
.case-open-row .btn { white-space: nowrap; margin-bottom: 1px; }
.case-service-list { max-height: 220px; }
.case-service-hint { padding: 8px 2px; }
.closed-case summary {
  cursor: pointer; display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  font-size: 13.5px;
}
.closed-case[open] summary { margin-bottom: 12px; padding-bottom: 12px; border-bottom: 1px solid var(--border); }
.case-timeline { padding: 4px 0 0 4px; }
.tl-item { position: relative; padding: 0 0 18px 26px; }
.tl-item:last-child { padding-bottom: 4px; }
.tl-item::before {
  content: ''; position: absolute; left: 6px; top: 16px; bottom: -2px; width: 2px;
  background: var(--border);
}
.tl-item:last-child::before { display: none; }
.tl-dot {
  position: absolute; left: 0; top: 3px; width: 14px; height: 14px; border-radius: 50%;
  background: var(--card); border: 3px solid var(--brand); box-sizing: border-box;
}
.tl-dot-result { background: var(--success); border-color: var(--success); }
.tl-dot-refused { background: var(--brand); border-color: var(--brand); }
.tl-body { display: flex; flex-direction: column; gap: 1px; line-height: 1.4; }
.tl-stage { font-size: 13px; color: var(--brand); }
[data-theme="dark"] .tl-stage { color: #e07b7b; }

/* ---- Quick status change ---- */
.status-quick { display: flex; gap: 8px; align-items: center; }
.status-quick select { width: auto; }

/* ---- Profile photos ---- */
.avatar-img { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; display: block; }
.avatar-lg, .avatar-lg-fallback { width: 72px; height: 72px; font-size: 28px; border-radius: 12px; }
.avatar-lg-fallback { display: flex; align-items: center; justify-content: center; background: var(--brand); color: #fff; font-weight: 700; }
.avatar-head, .avatar-head-fallback { width: 52px; height: 52px; border-radius: 10px; flex-shrink: 0; }
.avatar-head-fallback { display: flex; align-items: center; justify-content: center; background: var(--brand); color: #fff; font-weight: 700; font-size: 22px; }
.head-with-photo { display: flex; gap: 14px; align-items: center; }
.photo-row { display: flex; gap: 16px; align-items: center; }
.photo-input { flex: 1; }
.name-cell { display: flex; gap: 10px; align-items: center; }
.name-cell .avatar { flex-shrink: 0; }
.side-subhead { font-size: 13px; margin: 14px 0 8px; padding-top: 12px; border-top: 1px solid var(--border); }
#net-salary { font-weight: 700; color: var(--brand); background: var(--bg); }
[data-theme="dark"] #net-salary { color: #e07b7b; }

/* ---- Staff ---- */
.stat-link { cursor: pointer; }
.stat-link:hover { border-color: var(--brand); }
.stat-active { border-color: var(--brand); box-shadow: 0 0 0 1px var(--brand); }
.perm-list { border: 1px dashed var(--border); border-radius: 8px; padding: 12px 14px; }
.perm-list legend { font-size: 12.5px; font-weight: 700; padding: 0 6px; }
.perm-list .check-label { padding: 4px 0; align-self: auto; }
.assign-row { display: flex; gap: 8px; margin-top: 10px; }
.assign-row select { flex: 1; }

/* ---- Settings: notifications ---- */
.test-row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; align-items: center; }
.inline-form { display: flex; gap: 8px; align-items: center; }
.inline-form input { width: auto; min-width: 220px; }
.webhook-info {
  border: 1px dashed var(--border); border-radius: 8px; padding: 12px 14px; margin-top: 16px;
}
.webhook-info h3, .autoreply-head { font-size: 13.5px; margin-bottom: 6px; }
.autoreply-head { margin-top: 20px; }
.autoreply-form { margin-top: 10px; }

/* ---- Settings: services list drag & drop + multi-add ---- */
.drag-handle { cursor: grab; color: var(--muted); width: 26px; user-select: none; font-size: 15px; }
tr.dragging { opacity: .45; background: var(--brand-tint); }
tbody.sortable-services tr { transition: background .15s; }
.svc-name-row {
  position: relative; display: flex; margin-bottom: 10px;
  padding-bottom: 10px; border-bottom: 1px dashed var(--border);
}
/* inputs run the full width of the form (same as Service type / Country) —
   the × sits INSIDE the service-name box, so it never narrows the row */
.svc-row-fields { flex: 1; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.svc-row-fields > input[name="names[]"] { padding-right: 38px; }
.svc-money { display: flex; gap: 8px; }
.svc-money label, .svc-money input { flex: 1; min-width: 0; }
.svc-name-remove {
  position: absolute; top: 5px; right: 5px; width: 28px; height: 28px;
  background: none; border: 0; cursor: pointer; font-size: 17px; line-height: 1;
  color: var(--brand-active); padding: 0; border-radius: 6px;
}
.svc-name-remove:hover { background: var(--brand-tint); }
[data-theme="dark"] .svc-name-remove { color: #e07b7b; }
.svc-name-row:only-child .svc-name-remove { display: none; }
#add-service-name { align-self: flex-start; }

.copy-row { display: flex; gap: 8px; margin-bottom: 10px; }
.copy-row input { font-size: 12px; font-family: ui-monospace, Menlo, monospace; }
.small { font-size: 12px; }
.col-side .card form { margin-top: 4px; }
/* …but the quick-actions row aligns its buttons flush (no stacking gap) */
.col-side .team-quick-actions form { margin-top: 0; }

/* ---- Intake wizard (multi-step) ---- */
.wizard-progress { margin-bottom: 18px; }
.wizard-count { font-size: 13px; color: var(--muted); margin-bottom: 8px; text-align: center; }
.wizard-count strong { color: var(--text); }
.wizard-bar {
  height: 6px; background: var(--border); border-radius: 4px; overflow: hidden; margin-bottom: 12px;
}
.wizard-bar span {
  display: block; height: 100%; width: 11%; background: var(--brand);
  border-radius: 4px; transition: width .3s ease;
}
.wizard-pills {
  display: flex; justify-content: center; gap: 6px; list-style: none; padding: 0;
}
.wizard-pills li {
  width: 30px; height: 30px; border-radius: 50%; display: flex; align-items: center;
  justify-content: center; font-size: 12.5px; font-weight: 700; cursor: pointer;
  background: var(--card); border: 1px solid var(--border); color: var(--muted);
  user-select: none;
}
.wizard-pills li.visited { border-color: var(--brand); color: var(--brand); }
.wizard-pills li.active { background: var(--brand); border-color: var(--brand); color: #fff; }
.wizard-pills li.skipped { opacity: .35; text-decoration: line-through; cursor: not-allowed; }
[data-theme="dark"] .wizard-pills li.visited { border-color: #e07b7b; color: #e07b7b; }
.wizard-nav { display: flex; align-items: center; gap: 10px; margin-top: 4px; }
.wizard-spacer { flex: 1; }
.wizard-nav .btn { padding: 11px 28px; font-size: 14.5px; }
.step-hint { color: var(--muted); font-size: 13px; margin: 10px 0 10px; }
.edu-row {
  border: 1px dashed var(--border); border-radius: 8px;
  padding: 12px 14px; margin-bottom: 10px; margin-top: 10px;
}
#add-education { margin-bottom: 16px; }
.lang-row {
  display: grid; grid-template-columns: 2fr 1fr 1fr 1fr 1fr; gap: 14px;
}
@media (max-width: 700px) { .lang-row { grid-template-columns: 1fr 1fr; } }
.travel-picker { display: flex; gap: 8px; margin-bottom: 12px; margin-top: 12px; max-width: 460px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px;     margin-bottom: 12px;}
.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px;
  background: var(--brand-tint); color: var(--brand-active); border-radius: 16px;
  font-size: 13px; font-weight: 600;
}
[data-theme="dark"] .chip { color: #eab6b9; }
.chip-x {
  background: none; border: 0; cursor: pointer; font-size: 15px; line-height: 1;
  color: inherit; opacity: .7; padding: 0 2px;
}
.chip-x:hover { opacity: 1; }
.chips-static .chip { font-weight: 500; }
.resume-note {
  display: inline-block; margin-top: 10px !important; padding: 8px 16px; border-radius: 8px;
  background: var(--brand-tint); color: var(--brand-active); font-size: 13px !important;
}
[data-theme="dark"] .resume-note { color: #eab6b9; }
.public-done form { margin-top: 14px; }
@media (max-width: 600px) { .wizard-pills { display: none; } }

/* ---- Public intake page ---- */
/* Portal & public pages: full-height column so .book-foot sits at the bottom
   of the screen on short pages (login, thank-you, invalid link…) */
.public-body { background: var(--bg); min-height: 100vh; display: flex; flex-direction: column; }
.public-wrap { max-width: 860px; margin: 0 auto; padding: 32px 20px 60px; width: 100%;
               flex: 1; display: flex; flex-direction: column; }
.public-wrap > .book-foot { margin-top: auto; }
.public-head { text-align: center; margin-bottom: 30px; }
.public-head .login-logo { max-width: 300px; margin-bottom: 14px; }
.public-head h1 { font-size: 24px; margin-bottom: 8px; }
.public-head p { color: var(--muted); max-width: 560px; margin: 0 auto; }
.public-head p + p { margin-top: 7px; }

/* Public booking pages breathe more than the dense admin UI */
.public-body .card { padding: 26px 30px; margin-bottom: 22px; }
.public-form .form-section:first-child { margin-top: 0; }
.public-submit { text-align: center; display: flex; flex-direction: column; gap: 10px; align-items: center; }
.public-submit .btn { padding: 12px 36px; font-size: 15px; }
.public-done { text-align: center; }
.public-done h1 { font-size: 20px; margin: 14px 0 10px; }
.public-done p { margin-bottom: 8px; }
.done-check {
  width: 54px; height: 54px; border-radius: 50%; background: #e0f3e8; color: var(--success);
  font-size: 28px; font-weight: 700; display: flex; align-items: center; justify-content: center;
  margin: 16px auto 4px;
}

/* ---- Responsive ---- */
@media (max-width: 820px) {
  /* Sticky top bar with logo + hamburger */
  .mobile-bar {
    display: flex; align-items: center; justify-content: space-between;
    position: sticky; top: 0; z-index: 60; padding: 8px 14px;
    background: var(--sidebar);
  }
  .mobile-bar-logo img { height: 30px; display: block; }
  .nav-toggle { display: flex; }

  .app { flex-direction: column; }

  /* Sidebar becomes an off-canvas drawer, slid out until toggled open */
  .sidebar {
    position: fixed; top: 0; left: 0; bottom: 0; width: 268px; max-width: 82vw;
    height: 100vh; z-index: 70; transform: translateX(-100%);
    transition: transform .22s ease; box-shadow: 2px 0 24px rgba(0,0,0,.3);
    overflow-y: auto;
  }
  body.nav-open .sidebar { transform: none; }
  body.nav-open .sidebar-backdrop {
    display: block; position: fixed; inset: 0; z-index: 65;
    background: rgba(10,6,6,.5);
  }
  /* animate hamburger → X while open */
  body.nav-open .nav-toggle span:nth-child(1) { transform: translateY(6.5px) rotate(45deg); }
  body.nav-open .nav-toggle span:nth-child(2) { opacity: 0; }
  body.nav-open .nav-toggle span:nth-child(3) { transform: translateY(-6.5px) rotate(-45deg); }

  .nav { flex: 0 0 auto; }
  .nav-soon { display: none; }
  .main { padding: 16px; }
  .form-grid { grid-template-columns: 1fr; }

  /* Compact chrome */
  h1 { font-size: 22px; }
  .stat-value { font-size: 19px; }

  /* Page header: title block on top, action buttons wrap below */
  .page-head { flex-direction: column; align-items: stretch; }
  .page-head .btn-group { justify-content: flex-start; }
  .status-quick { flex: 1 1 100%; }
  .status-quick select { flex: 1; min-width: 0; }
  .head-with-photo { align-items: flex-start; }

  /* Forms & filters */
  .form-actions { flex-wrap: wrap; }
  .svc-money { flex-wrap: wrap; }
  .svc-money label { flex: 1 1 140px; }
  .filters .f-field { flex: 1 1 46%; }
  .filters .f-field select, .filters .f-field input { min-width: 0; width: 100%; }
  .filters .f-grow, .filters .f-actions { flex: 1 1 100%; }

  /* Data tables: slightly denser so more fits before scrolling */
  table { font-size: 13px; }
  th, td { padding: 8px 10px; }

  /* Case stage actions: don't force the Close/override group off-screen */
  .stage-btns-right { margin-left: 0; flex: 1 1 100%; flex-wrap: wrap; }
  .stage-override, .stage-override select { flex: 1 1 auto; min-width: 0; }
}

/* ---- Finance module ---- */
.fin-summary dd { text-align: right; }
.fin-pos { color: var(--success); }

/* CRM Setup — organization branding */
.form-grid-3 { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 820px) { .form-grid-3 { grid-template-columns: 1fr; } }
.form-section-title {
  font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  color: var(--muted); margin: 18px 0 10px; padding-bottom: 6px; border-bottom: 1px solid var(--border);
}
.org-logo-preview {
  display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--border); border-radius: 8px; padding: 10px; margin: 4px 0 6px;
  min-height: 64px;
}
.org-logo-preview img { max-height: 48px; max-width: 100%; }
.org-logo-dark { background: #1A1A1A; }
.org-logo-light { background: #fff; }
.org-favicon { max-height: 32px; }
.code-rule {
  border: 1px solid var(--border); border-radius: 10px; padding: 14px;
  display: flex; flex-direction: column; gap: 10px;
}
.code-rule-title { font-size: 13px; }

/* Invoice service picker: fee pill on the right of the service name */
.inv-item .doctype-text { flex: 1; min-width: 0; }
.inv-fee {
  margin-left: auto; flex-shrink: 0;
  font-size: 12px; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap;
  background: var(--brand-tint); color: var(--brand-active);
  border-radius: 999px; padding: 3px 10px;
}
[data-theme="dark"] .inv-fee { color: #e07b7b; }
.inv-fee-none { background: var(--bg); color: var(--muted); border: 1px dashed var(--border); font-weight: 600; }

/* Appointment list: name-mismatch flag under the reference */
.apt-mismatch {
  margin-top: 3px; font-size: 11px; font-weight: 700; white-space: nowrap;
  color: var(--brand); cursor: help;
}
[data-theme="dark"] .apt-mismatch { color: #e07b7b; }

/* Public booking pages */
.book-plan-list { display: flex; flex-direction: column; gap: 12px; }
.book-plan {
  display: flex; justify-content: space-between; align-items: center; gap: 16px;
  text-decoration: none; color: var(--text);
}
.book-plan:hover { border-color: var(--brand); }
.book-plan-main { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.book-plan-main p { margin: 0; }
.book-plan-side { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; flex-shrink: 0; }
.book-staff-photo { width: 84px; height: 84px; border-radius: 50%; object-fit: cover; margin: 0 auto 10px; display: block; }
/* Numbered booking steps */
.book-step { padding: 2px 0 18px; }
.book-step + .book-step { border-top: 1px solid var(--border); padding-top: 16px; }
.book-step-head {
  display: flex; align-items: center; gap: 10px; margin-bottom: 14px;
  font-size: 12px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--text);
}
.book-step-num {
  width: 24px; height: 24px; border-radius: 50%; flex: 0 0 24px;
  background: var(--brand); color: #fff;
  display: flex; align-items: center; justify-content: center; font-size: 12.5px;
}
.book-tz-hint { margin-left: auto; font-weight: 500; letter-spacing: 0; text-transform: none; font-size: 12px; }
.book-hint { margin: 2px 0; }

.book-months { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.book-month {
  border: 1px solid var(--border); border-radius: 999px; background: var(--card);
  padding: 7px 16px; cursor: pointer; font-family: inherit; font-weight: 600; font-size: 13px;
  transition: border-color .12s, background .12s;
}
.book-month span {
  font-size: 11px; font-weight: 700; color: var(--muted);
  background: var(--bg); border-radius: 999px; padding: 1px 7px; margin-left: 4px;
}
.book-month:hover { border-color: var(--brand); }
.book-month.active { background: var(--brand); border-color: var(--brand); color: #fff; }
.book-month.active span { background: rgba(255, 255, 255, .2); color: #fff; }

/* Day tiles stretch to fill the row — no dead space on the right */
.book-days { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 10px; }
.book-days .book-hint, .book-days > p, .book-slots > p { grid-column: 1 / -1; }
.book-day {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  border: 1px solid var(--border); border-radius: 12px; background: var(--card);
  padding: 12px 8px 11px; cursor: pointer; font-family: inherit; min-width: 0;
  transition: border-color .12s, box-shadow .12s, transform .12s;
}
.book-day:hover { border-color: var(--brand); box-shadow: 0 2px 8px rgba(141, 25, 32, .10); }
.book-day span { font-size: 10.5px; font-weight: 700; letter-spacing: .05em; color: var(--muted); text-transform: uppercase; }
.book-day strong { font-size: 19px; line-height: 1.15; }
.book-day.active { border-color: var(--brand); background: var(--brand); box-shadow: 0 4px 12px rgba(141, 25, 32, .28); }
.book-day.active strong, .book-day.active span { color: #fff; }

.book-slots { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.book-slots .book-hint { grid-column: 1 / -1; }
.book-slot {
  border: 1px solid var(--border); border-radius: 8px; background: var(--card);
  padding: 10px 0; text-align: center; cursor: pointer; font-family: inherit;
  font-weight: 600; font-size: 14px; font-variant-numeric: tabular-nums;
  transition: border-color .12s, color .12s, box-shadow .12s;
}
.book-slot:hover { border-color: var(--brand); color: var(--brand); }
.book-slot.active {
  background: var(--brand); border-color: var(--brand); color: #fff;
  box-shadow: 0 4px 12px rgba(141, 25, 32, .28);
}
.book-actions {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  border-top: 1px solid var(--border); padding-top: 16px;
}
.form-grid .book-actions { grid-column: 1 / -1; }
.book-alert { color: var(--danger); font-size: .85rem; font-weight: 600; text-align: center; flex: 1; }
.book-summary { display: flex; flex-direction: column; gap: 6px; }

/* Booking summary card — consultant profile + highlighted schedule */
.book-apt-card { display: flex; align-items: center; gap: 26px; flex-wrap: wrap; }
.book-apt-host {
  display: flex; flex-direction: column; align-items: center; text-align: center;
  gap: 3px; min-width: 160px; padding: 4px 0;
}
.book-apt-host strong { display: block; font-size: 15px; color: var(--text); }
.book-apt-host .muted { display: block; }
.book-avatar { width: 64px; height: 64px; border-radius: 50%; object-fit: cover; flex: 0 0 auto; margin-bottom: 6px; }
.book-avatar-fallback {
  display: flex; align-items: center; justify-content: center;
  background: var(--brand-tint); color: var(--brand); font-weight: 700; font-size: 22px;
}
.book-apt-main {
  flex: 1; min-width: 250px; display: flex; flex-direction: column; gap: 10px;
  border-left: 1px solid var(--border); padding-left: 26px;
}
.book-apt-plan { font-size: 15.5px; font-weight: 700; color: var(--brand); line-height: 1.3; }
.book-apt-when { font-size: 17px; color: var(--text); line-height: 1.35; }
.book-apt-meta { display: flex; gap: 8px; flex-wrap: wrap; }
.book-chip {
  border: 1px solid var(--border); border-radius: 999px; padding: 3px 11px;
  font-size: 12px; font-weight: 600; color: var(--text); background: var(--bg);
}
.book-chip-fee { background: var(--brand); border-color: var(--brand); color: #fff; }
.book-apt-topbar { display: flex; justify-content: flex-end; margin-bottom: 10px; }

/* Consultant locked via a personal booking link — profile card + top-right time zone */
.book-tz-top { flex-direction: row; align-items: center; gap: 9px; }
.book-tz-top select { width: auto; min-width: 190px; }
@media (max-width: 640px) {
  /* Stack and center the summary card on phones */
  .book-apt-card { flex-direction: column; gap: 14px; }
  .book-apt-host { width: 100%; min-width: 0; }
  .book-apt-main {
    border-left: 0; padding-left: 0; min-width: 0; width: 100%;
    align-items: center; text-align: center;
  }
  .book-apt-meta { justify-content: center; }
  .book-apt-main .pick-field { width: 100%; text-align: left; }
  .book-apt-topbar .btn { width: 100%; text-align: center; }
  .book-tz-top { width: 100%; }
  .book-tz-top .tzp { width: 100%; }
  .book-tz-top .tzp-panel { left: 0; right: 0; width: auto; min-width: 0; }
  .book-actions { flex-wrap: wrap; }
  .book-alert { flex-basis: 100%; order: 3; }
}
.book-foot { text-align: center; padding: 18px 0 30px; }

/* Rich text editor */
.rte { border: 1px solid var(--border); border-radius: 8px; overflow: hidden; background: var(--card); }
.rte-bar {
  display: flex; flex-wrap: wrap; gap: 2px; padding: 6px 8px;
  border-bottom: 1px solid var(--border); background: var(--bg);
}
.rte-btn {
  border: 1px solid transparent; background: none; color: var(--text); cursor: pointer;
  font: inherit; font-size: 12.5px; padding: 4px 9px; border-radius: 6px;
}
.rte-btn:hover { background: var(--brand-tint); border-color: var(--border); }
.rte-b { font-weight: 700; }
.rte-i { font-style: italic; }
.rte-u { text-decoration: underline; }
.rte-area {
  min-height: 380px; max-height: 640px; overflow: auto; padding: 16px 18px;
  font-size: 13.5px; line-height: 1.65; color: var(--text); outline: none;
}
.rte-area h1, .rte-area h2, .rte-area h3, .rte-area h4 { margin: 14px 0 6px; color: var(--text); }
.rte-area p, .rte-area div { margin: 0 0 8px; }
.rte-area ul, .rte-area ol { margin: 0 0 8px 22px; }

/* Shortcode palette */
.agr-codes { display: flex; flex-wrap: wrap; gap: 6px; }
.agr-code {
  border: 1px solid var(--border); background: var(--bg); color: var(--brand);
  font-family: ui-monospace, monospace; font-size: 11px; padding: 4px 8px;
  border-radius: 999px; cursor: pointer;
}
.agr-code:hover { background: var(--brand-tint); border-color: var(--brand); }

/* Generated agreement document view */
.agr-doc-card { padding: 34px 40px; }
.agr-doc { font-size: 13.5px; line-height: 1.7; color: var(--text); }
.agr-doc h1, .agr-doc h2 { color: var(--brand); margin: 18px 0 8px; }
.agr-doc h3, .agr-doc h4 { margin: 14px 0 6px; }
.agr-doc p, .agr-doc div { margin: 0 0 9px; }
.agr-doc ul, .agr-doc ol { margin: 0 0 9px 24px; }
.agr-doc hr { border: 0; border-top: 1px solid var(--border); margin: 14px 0; }
/* RCIC review docs — folder heading rows */
.review-folder-row td {
  background: var(--bg); font-weight: 700; font-size: 12px;
  text-transform: uppercase; letter-spacing: .4px; color: var(--muted);
}

/* Notification preference matrix */
.prefs-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-bottom: 18px; }
@media (max-width: 900px) { .prefs-grid { grid-template-columns: 1fr; } }
.pref-row {
  display: flex; justify-content: space-between; align-items: center; gap: 14px;
  padding: 10px 0; border-bottom: 1px dashed var(--border);
}
.pref-row:last-child { border-bottom: 0; }
.pref-label { font-size: 13px; color: var(--text); }
/* Toggle switch — two variants share one look:
   <label class="switch"><input type="checkbox"><i></i></label>  (forms)
   <button class="switch on"><i></i></button>                    (submits its form) */
.switch {
  position: relative; width: 40px; height: 22px; flex: 0 0 auto; display: inline-block;
  padding: 0; border: 0; background: none; cursor: pointer;
}
.switch input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; margin: 0; cursor: pointer; z-index: 1; }
.switch i {
  position: absolute; inset: 0; display: block; border-radius: 999px;
  background: var(--border); transition: background .15s; pointer-events: none;
}
.switch i::after {
  content: ''; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px;
  border-radius: 50%; background: #fff; transition: transform .15s;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .25);
}
.switch input:checked + i, .switch.on i { background: #1B7F4B; }
.switch input:checked + i::after, .switch.on i::after { transform: translateX(18px); }

/* Booking — online payment */
.pay-online-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.pay-online-head .form-section { margin-bottom: 0; }
.pay-instant {
  flex: 0 0 auto; font-size: 12px; font-weight: 600; color: #1B7F4B;
  background: rgba(27, 127, 75, .1); border: 1px solid rgba(27, 127, 75, .25);
  padding: 4px 10px; border-radius: 999px; white-space: nowrap;
}
.pay-gw-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 10px; margin: 14px 0 4px;
}
.pay-tile {
  display: flex; align-items: center; gap: 12px; padding: 13px 14px;
  border: 1.5px solid var(--border); border-radius: 12px; background: var(--card);
  text-decoration: none; color: var(--text);
  transition: border-color .15s, box-shadow .15s, transform .15s;
}
.pay-tile:hover { transform: translateY(-1px); box-shadow: 0 5px 16px rgba(26, 26, 26, .1); }
.pay-tile-bkash:hover { border-color: #E2136E; }
.pay-tile-paypal:hover { border-color: #003087; }
.pay-tile-stripe:hover { border-color: #635BFF; }
.pay-tile-logo {
  flex: 0 0 42px; height: 42px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
}
.pay-tile-bkash .pay-tile-logo { background: #E2136E; }
.pay-tile-paypal .pay-tile-logo { background: #003087; }
.pay-tile-stripe .pay-tile-logo { background: #635BFF; }
.pay-tile-mark { color: #fff; font-size: 20px; font-weight: 800; line-height: 1; }
.pay-tile-mark-pp { font-style: italic; font-family: Georgia, 'Times New Roman', serif; }
.pay-tile-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.pay-tile-text strong { font-size: 14px; }
.pay-tile-text small { font-size: 12px; color: var(--muted); }
.pay-tile-arrow { color: var(--muted); font-size: 16px; transition: transform .15s, color .15s; }
.pay-tile:hover .pay-tile-arrow { transform: translateX(3px); color: var(--text); }
.pay-online-note { margin: 10px 0 0; font-size: 12.5px; color: var(--muted); }

/* Public invoice page */
.inv-banner { font-size: 13.5px; line-height: 1.6; border-left: 3px solid var(--brand); }
.inv-banner .muted { display: block; margin-top: 4px; }
.inv-banner-ok { border-left-color: #1B7F4B; }
.inv-meta { display: grid; grid-template-columns: 1.5fr 1fr 1fr auto; align-items: stretch; }
.inv-meta-cell {
  display: flex; flex-direction: column; gap: 3px; justify-content: center;
  padding: 4px 20px; border-left: 1px solid var(--border);
}
.inv-meta-cell:first-child { border-left: 0; padding-left: 0; }
.inv-meta-label {
  font-size: 10.5px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .7px; color: var(--muted);
}
.inv-meta-name { font-size: 15px; }
.inv-meta-dl { padding-right: 0; }
@media (max-width: 640px) {
  .inv-meta { grid-template-columns: 1fr; gap: 12px; }
  .inv-meta-cell { border-left: 0; padding: 0; }
}
.inv-totals td { border-top: 1px solid var(--border); padding-top: 8px; font-size: 13.5px; }
.inv-balance td { font-size: 15px; color: var(--brand-active); }

/* Staff invoice view — share link + client submissions */
.inv-share-row { display: flex; gap: 8px; margin: 10px 0; }
.inv-share-row input { flex: 1; min-width: 0; font-size: 12.5px; color: var(--muted); }
.inv-share-open { width: 100%; text-align: center; }
.inv-psub { border-left: 3px solid #E8A33D; }

/* ============================== Client portal ============================== */
.portal-body { background: var(--bg); }
.portal-bar { background: #fff; border-bottom: 1px solid var(--border); }
.portal-bar-in {
  max-width: 960px; margin: 0 auto; padding: 10px 18px;
  display: flex; align-items: center; gap: 18px;
}
.portal-logo img { height: 34px; display: block; }
.portal-nav { display: flex; gap: 2px; flex: 1; flex-wrap: wrap; }
.portal-nav a {
  padding: 8px 12px; border-radius: 8px; font-size: 13.5px; font-weight: 600;
  color: var(--muted); text-decoration: none;
}
.portal-nav a:hover { color: var(--text); background: var(--brand-tint); }
.portal-nav a.active { color: var(--brand-active); background: var(--brand-tint); }
.portal-logout { font-size: 13px; color: var(--muted); text-decoration: none; white-space: nowrap; }
.portal-logout:hover { color: var(--brand-active); }
.portal-wrap { max-width: 960px; margin: 0 auto; padding: 26px 18px 40px; width: 100%;
               flex: 1; display: flex; flex-direction: column; }
.portal-wrap > .book-foot { margin-top: auto; }
.portal-h1 { font-size: 22px; margin: 0 0 4px; }
.portal-wrap > .muted { margin: 0 0 18px; }
.portal-wrap .card { margin-bottom: 16px; }

/* auth screens */
.portal-auth { max-width: 400px; margin: 7vh auto 0; display: flex; flex-direction: column; gap: 14px; }
.portal-auth-logo { text-align: center; }
.portal-auth-logo img { height: 52px; }
.portal-auth-title { font-size: 19px; text-align: center; margin: 0 0 4px; }
.portal-error {
  background: var(--brand-tint); border: 1px solid #E5C4C6; color: var(--brand-active);
  border-radius: 8px; padding: 9px 12px; font-size: 13px; margin: 8px 0 4px;
}
.portal-ok { font-size: 13.5px; line-height: 1.6; text-align: center; }

/* dashboard */
.portal-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; margin: 0 0 16px; }
.portal-tile {
  background: var(--card); border: 1px solid var(--border); border-radius: 12px;
  padding: 16px; text-decoration: none; color: var(--text);
  display: flex; flex-direction: column; gap: 4px; transition: box-shadow .15s, transform .15s;
}
.portal-tile:hover { transform: translateY(-1px); box-shadow: 0 4px 14px rgba(26,26,26,.08); }
.portal-tile-alert { border-left: 3px solid var(--brand); }
.portal-tile-num { font-size: 22px; font-weight: 800; }
.portal-tile-label { font-size: 12.5px; color: var(--muted); }
.portal-case { padding: 12px 0; border-bottom: 1px solid var(--border); }
.portal-case:last-child { border-bottom: 0; padding-bottom: 2px; }
.portal-case-link { display: block; text-decoration: none; color: var(--text); }
.portal-case-link:hover strong:first-child { color: var(--brand-active); }
.portal-case-arrow { color: var(--muted); transition: transform .15s, color .15s; }
.portal-case-link:hover .portal-case-arrow { transform: translateX(3px); color: var(--brand-active); }
.portal-case-top { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.portal-case-top .badge { margin-left: auto; }

.portal-apt-act { display: flex; gap: 6px; justify-content: flex-end; align-items: center; }
.portal-apt-act .btn { white-space: nowrap; }
.portal-team-contact { display: flex; gap: 4px 14px; flex-wrap: wrap; margin-top: 2px; }

/* documents case tabs */
.portal-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin: 0 0 14px; }
.ptab {
  border: 1px solid var(--border); background: var(--card); color: var(--muted);
  padding: 8px 14px; border-radius: 999px; font-size: 13px; font-weight: 600; cursor: pointer;
}
.ptab:hover { color: var(--text); }
.ptab.active { background: var(--brand); border-color: var(--brand); color: #fff; }
.ptab-badge {
  display: inline-block; min-width: 18px; padding: 1px 5px; margin-left: 4px;
  border-radius: 999px; background: #fff; color: var(--brand-active);
  font-size: 11px; font-weight: 700; text-align: center;
}
.ptab:not(.active) .ptab-badge { background: var(--brand); color: #fff; }
.portal-progress {
  height: 8px; border-radius: 999px; background: var(--border); margin: 10px 0 6px; overflow: hidden;
}
.portal-progress i { display: block; height: 100%; background: #1B7F4B; border-radius: 999px; }

/* documents — card grid (3-up on desktop, stacks on mobile) */
.portal-doc-list {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px; margin-top: 16px;
}
.portal-doc {
  border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px;
  display: flex; flex-direction: column; gap: 10px;
}
.portal-doc-action { border-left: 3px solid var(--brand); }
.portal-doc-review { border-left: 3px solid #C8B071; }
.portal-doc-ok { border-left: 3px solid #00A90B; }
.portal-head-row { display: flex; align-items: center; gap: 14px; justify-content: space-between; flex-wrap: wrap; }
.portal-doc-head { display: flex; align-items: flex-start; gap: 10px; }
.portal-doc-head strong { font-size: 14px; line-height: 1.4; }
.portal-doc-head .badge { margin-left: auto; flex: 0 0 auto; white-space: nowrap; }
.portal-doc-note {
  margin: 0; font-size: 12.5px; color: var(--brand-active);
  background: var(--brand-tint); border-radius: 6px; padding: 6px 10px;
}
.portal-doc-files { display: flex; flex-wrap: wrap; gap: 6px 14px; }
.portal-doc-upload {
  display: flex; flex-direction: column; align-items: flex-start; gap: 10px; margin-top: auto;
}
.portal-doc-upload input[type="file"] {
  width: 100%; font-size: 12.5px; border: 1px solid var(--border);
  border-radius: 8px; padding: 9px 10px; background: var(--card);
}

/* profile */
.portal-two { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
@media (max-width: 700px) { .portal-two { grid-template-columns: 1fr; } }
.portal-kv { display: flex; flex-direction: column; gap: 8px; }
.portal-kv > div { display: flex; justify-content: space-between; gap: 12px; font-size: 13.5px; }
.portal-kv span { color: var(--muted); }

/* PBX / Calls */
.pbx-devices { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 14px; }
.pbx-dev {
  font-size: 12.5px; padding: 6px 12px; border: 1px solid var(--border);
  border-radius: 999px; color: var(--muted); background: var(--card);
}
.pbx-dev-on { border-color: rgba(27, 127, 75, .4); color: var(--text); }
.pbx-dev em { font-style: normal; color: var(--muted); font-size: 11.5px; }
.pbx-dev-ext { font-variant-numeric: tabular-nums; }
.pbx-audio { height: 32px; max-width: 240px; vertical-align: middle; }

/* Live monitor — per-call flow diagram (caller → trunk → extensions) */
.pbx-flow {
  border: 1px solid var(--border); border-radius: 12px; padding: 14px 18px 18px;
  margin-bottom: 12px; overflow-x: auto; background: var(--card);
}
.pbx-flow-meta { display: flex; align-items: center; gap: 10px; font-size: 13px; margin-bottom: 14px; }
.pbx-flow-lane { display: flex; align-items: center; gap: 6px; min-width: 560px; }
.pbx-node {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  flex: 0 0 auto; min-width: 110px; text-align: center;
}
.pbx-node-num { font-weight: 700; font-size: 13.5px; }
.pbx-node-label {
  font-size: 10px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  color: var(--muted);
}
.pbx-node-client {
  font-size: 12.5px; font-weight: 700; color: var(--brand-active); text-decoration: none;
  background: var(--brand-tint); border-radius: 999px; padding: 3px 10px; margin-top: 2px;
}
.pbx-node-client span { font-weight: 500; color: var(--muted); }
.pbx-node-client:hover { text-decoration: underline; }
.pbx-node-add {
  display: inline-block; font-size: 12px; font-weight: 700; color: var(--brand-active);
  text-decoration: none; border: 1.5px dashed var(--brand); border-radius: 999px;
  padding: 3px 10px; margin-top: 4px; background: var(--card); white-space: nowrap;
}
.pbx-node-add:hover { background: var(--brand-tint); text-decoration: none; }
.pbx-ball {
  width: 48px; height: 48px; border-radius: 50%; display: flex; align-items: center;
  justify-content: center; color: #fff; font-weight: 800; font-size: 15px;
  box-shadow: 0 3px 10px rgba(0, 0, 0, .18); flex: 0 0 auto;
}
.pbx-ball-blue { background: linear-gradient(135deg, #29A8E0, #1273B9); font-size: 19px; }
.pbx-ball-green { background: linear-gradient(135deg, #27A25B, #12713C); font-size: 19px; }
.pbx-ball-orange { background: linear-gradient(135deg, #FFA245, #F4762C); }
.pbx-line {
  flex: 1 1 40px; height: 3px; min-width: 36px; border-radius: 2px;
  background: repeating-linear-gradient(90deg, #F08A73 0 9px, transparent 9px 16px);
  animation: pbx-dash .9s linear infinite;
}
.pbx-flow-out .pbx-line { animation-direction: reverse; }
@keyframes pbx-dash { to { background-position: 16px 0; } }
.pbx-exts { display: flex; flex-direction: column; gap: 8px; flex: 0 0 auto; }
.pbx-ext-row { display: flex; align-items: center; gap: 8px; }
/* the connector stub always points toward the centre line */
.pbx-exts-left .pbx-ext-row { flex-direction: row-reverse; }
.pbx-line-stub { flex: 0 0 26px; min-width: 26px; }
.pbx-ext-state { font-style: normal; font-size: 11.5px; color: var(--muted); }
.pbx-dir {
  display: inline-block; padding: 2px 9px; border-radius: 999px;
  font-size: 11.5px; font-weight: 700; white-space: nowrap;
}
.pbx-dir-in { background: rgba(27, 127, 75, .12); color: #1B7F4B; }
.pbx-dir-out { background: rgba(18, 115, 185, .12); color: #1273B9; }
.pbx-dur { font-size: 12px; font-weight: 700; color: #1B7F4B; font-variant-numeric: tabular-nums; }
.pbx-hist-head { cursor: pointer; user-select: none; }
.pbx-hist-head:hover h2 { color: var(--brand-active); }
.pbx-pager { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 12px; flex-wrap: wrap; }
.pbx-pager-btns { display: flex; gap: 8px; }
.filter-bar { display: flex; gap: 8px; flex-wrap: wrap; margin: 0 0 14px; }
.filter-bar input[type="text"] { flex: 1; min-width: 160px; }

/* My Profile */
.user-chip-link { text-decoration: none; color: inherit; border-radius: 10px; }
.user-chip-link:hover { background: rgba(255, 255, 255, .08); }
.profile-photo-row { display: flex; align-items: center; gap: 16px; }
.profile-photo { width: 72px; height: 72px; border-radius: 14px; font-size: 26px;
                 display: flex; align-items: center; justify-content: center; flex: 0 0 auto; }

/* ============================== Dashboard v2 ============================== */
.stat-link { text-decoration: none; color: var(--text); transition: transform .15s, box-shadow .15s; }
.stat-link:hover { transform: translateY(-1px); box-shadow: 0 4px 14px rgba(26, 26, 26, .08); }
.stat-sub { display: block; margin-top: 4px; font-size: 11.5px; color: var(--muted); }
.stat-up { color: #1B7F4B; }
.stat-down { color: var(--brand-active); }
.dash-grid { display: grid; grid-template-columns: 1fr 340px; gap: 16px; align-items: start; }
.dash-grid > * { min-width: 0; }
@media (max-width: 1080px) { .dash-grid { grid-template-columns: 1fr; } }
.dash-main .card, .dash-side .card { margin-bottom: 16px; }
.dash-two { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.dash-two > * { min-width: 0; }
@media (max-width: 860px) { .dash-two { grid-template-columns: 1fr; } }
.dash-chart { width: 100%; height: auto; display: block; margin-top: 6px; }
/* pipeline (sequential single hue: darker = further along) */
.dash-pipe { display: flex; flex-direction: column; gap: 9px; margin-top: 10px; }
.dash-pipe-row { display: flex; align-items: center; gap: 10px; }
.dash-pipe-label { flex: 0 0 118px; font-size: 12px; color: var(--muted); text-align: right; }
.dash-pipe-track { flex: 1; height: 14px; border-radius: 999px; background: var(--bg); overflow: hidden; }
.dash-pipe-track i { display: block; height: 100%; border-radius: 999px; background: var(--brand); }
.dash-pipe-n { flex: 0 0 22px; font-size: 12.5px; font-weight: 700; }
/* action center */
.dash-action {
  display: flex; align-items: center; gap: 10px; padding: 10px 4px;
  border-bottom: 1px solid var(--border); text-decoration: none; color: var(--text); font-size: 13.5px;
}
.dash-action:last-child { border-bottom: 0; padding-bottom: 2px; }
.dash-action-ico { flex: 0 0 auto; }
.dash-action-label { flex: 1; font-weight: 600; }
.dash-action-go { color: var(--muted); transition: transform .15s; }
.dash-action:hover .dash-action-go { transform: translateX(3px); color: var(--brand-active); }
/* upcoming appointments */
.dash-apt {
  display: flex; gap: 12px; align-items: center; padding: 9px 4px;
  border-bottom: 1px solid var(--border); text-decoration: none; color: var(--text);
}
.dash-apt:last-child { border-bottom: 0; padding-bottom: 2px; }
.dash-apt-when {
  flex: 0 0 58px; text-align: center; font-size: 12px; font-weight: 700;
  background: var(--brand-tint); color: var(--brand-active); border-radius: 8px; padding: 6px 4px;
}
[data-theme="dark"] .dash-apt-when { background: rgba(226, 103, 103, .14); color: #e07b7b; }
.dash-apt-when em { display: block; font-style: normal; font-weight: 600; font-size: 11px; }
.dash-apt-meta { display: flex; flex-direction: column; min-width: 0; }
.dash-apt-meta strong { font-size: 13.5px; }

/* Vendor copyright line — every page, staff + portal + public */
.app-copyright {
  margin-top: auto; padding: 20px 0 4px; border-top: 1px solid var(--border);
  font-size: 12px; color: var(--muted); flex-shrink: 0;
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 24px;
}
.standalone-copy { margin: 26px auto 18px; max-width: 900px; padding-left: 18px; padding-right: 18px; }
/* centred footers (portal, booking): the two parts sit side by side, wrapping on phones */
.foot-copy { display: flex; flex-wrap: wrap; justify-content: center; gap: 2px 18px; margin-top: 6px; }
@media (max-width: 640px) { .app-copyright { justify-content: center; text-align: center; } }

/* Dashboard update banner (admins, when new migrations shipped) */
.dash-update-banner {
  display: block; margin-bottom: 16px; padding: 12px 16px; font-size: 13.5px;
  color: var(--text); text-decoration: none; border-left: 3px solid #E8A33D;
}
.dash-update-banner:hover { background: var(--brand-tint); }
/* One-click release banner: message + Update button on one line, wraps on phones */
.dash-release-banner { display: flex; align-items: center; justify-content: space-between; gap: 12px;
  flex-wrap: wrap; border-left-color: var(--brand); }
.dash-release-banner:hover { background: var(--card); }
.upd-box { margin-top: 12px; padding: 14px 16px; border: 1px solid var(--border); border-left: 3px solid var(--brand);
  border-radius: var(--radius); background: var(--card); }
.upd-box form { margin-top: 12px; }
.upd-notes { margin-top: 8px; font-size: 13px; line-height: 1.55; }

/* Dashboard empty states — the card stays, with a friendly all-clear */
.dash-empty {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  text-align: center; padding: 18px 10px 14px;
}
.dash-empty-ico { font-size: 26px; margin-bottom: 3px; }
.dash-empty strong { font-size: 13.5px; }

/* Storage allowance alert (Settings → Document Types → File Storage) */
.sa-block { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--border); }
.sa-form { display: flex; align-items: flex-end; gap: 8px; margin: 10px 0 8px; }
.sa-form label { flex: 0 0 200px; display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; }
.pay-divider {
  display: flex; align-items: center; gap: 12px; margin: 4px 0 16px;
  color: var(--muted); font-size: 12.5px;
}
.pay-divider::before, .pay-divider::after { content: ''; flex: 1; border-top: 1px solid var(--border); }
.pay-method-note {
  background: var(--brand-tint); border: 1px solid var(--border); border-left: 3px solid var(--brand);
  border-radius: 8px; padding: 12px 14px; font-size: 13.5px; line-height: 1.65;
}
.pay-method-note strong { display: block; margin-bottom: 6px; color: var(--brand-active); }

/* Settings — payment method rows */
.pm-list { margin-top: 12px; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.pm-item { border-bottom: 1px solid var(--border); background: var(--card); }
.pm-item:last-child { border-bottom: 0; }
.pm-item.dragging { opacity: .45; }
.pm-row { display: flex; align-items: center; gap: 10px; padding: 10px 12px; }
.pm-name {
  flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px;
  font-weight: 600; font-size: 13.5px;
}
.pm-slot-del { flex: 0 0 36px; } /* keeps switches aligned on gateway rows (no delete btn) */
.pm-row .act-btn-danger { min-width: 36px; justify-content: center; }
.pm-edit { padding: 4px 12px 14px 34px; background: var(--bg); border-top: 1px dashed var(--border); }
.pm-edit .stack-form { margin-top: 10px; }
.pm-edit-actions { display: flex; gap: 8px; }

/* Tasks */
.nav-count {
  margin-left: auto; font-size: 10.5px; font-weight: 700; padding: 2px 7px;
  border-radius: 999px; background: rgba(255, 255, 255, .16); color: #fff;
}
.nav-count-alert { background: #B42318; }
.task-row {
  display: flex; align-items: flex-start; gap: 11px;
  padding: 10px 0; border-bottom: 1px dashed var(--border);
}
.task-row:last-of-type { border-bottom: 0; }
.task-tick {
  width: 22px; height: 22px; border-radius: 7px; border: 2px solid var(--border);
  background: var(--card); cursor: pointer; font-size: 13px; line-height: 1;
  color: #1B7F4B; flex: 0 0 auto; margin-top: 1px;
}
.task-tick:hover { border-color: #1B7F4B; background: rgba(27, 127, 75, .08); }
.task-done .task-tick { border-color: #1B7F4B; background: rgba(27, 127, 75, .12); }
.task-done .task-title { text-decoration: line-through; color: var(--muted); }
.task-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.task-title { font-size: 13.5px; font-weight: 600; color: var(--text); }
.task-note { line-height: 1.4; }
.task-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.task-side { display: flex; align-items: center; gap: 10px; flex: 0 0 auto; }
.task-due { font-size: 12px; font-weight: 700; color: var(--muted); white-space: nowrap; }
.overdue-date { color: #B42318; }
[data-theme="dark"] .overdue-date { color: #e07b7b; }
.task-row-mini { padding: 7px 0; }
.task-row-mini .task-title { font-weight: 500; }

/* Dashboard — file storage indicator */
.storage-flex { display: flex; gap: 26px; align-items: flex-start; flex-wrap: wrap; }
.storage-tiles { flex: 0 0 250px; grid-template-columns: 1fr 1fr; }
.storage-bars { flex: 1; min-width: 260px; }
@media (max-width: 700px) { .storage-tiles { flex-basis: 100%; } }

/* WhatsApp gateway connection panel */
.gw-connect-row { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; margin-bottom: 4px; }
.gw-qr-flex {
  display: flex; gap: 20px; align-items: flex-start; flex-wrap: wrap;
  background: var(--bg); border: 1px solid var(--border); border-radius: 11px;
  padding: 15px; margin-top: 10px;
}
.gw-qr-flex img {
  flex: 0 0 auto; background: #fff; border: 1px solid var(--border);
  border-radius: 9px; padding: 8px;
}
.gw-qr-side { flex: 1; min-width: 240px; display: flex; flex-direction: column; gap: 10px; }
.gw-pair-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.gw-pair-row input { width: auto; max-width: 210px; }
.gw-sync {
  background: rgba(27, 127, 75, .07); border: 1px solid rgba(27, 127, 75, .25);
  border-radius: 10px; padding: 10px 14px; margin-top: 10px;
}
.gw-pair-code {
  font-family: ui-monospace, monospace; font-size: 26px; font-weight: 700; letter-spacing: 6px;
  color: var(--brand); background: var(--brand-tint); border-radius: 9px;
  padding: 10px 16px; display: inline-block; margin-top: 2px; align-self: flex-start;
}

/* Staff profile — details sidebar */
.side-kv { display: flex; flex-direction: column; }
.side-kv-row {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 11px 0; border-bottom: 1px dashed var(--border);
}
.side-kv-row:first-child { padding-top: 2px; }
.side-kv-row:last-child { border-bottom: 0; padding-bottom: 4px; }
.side-kv-ico {
  flex: 0 0 auto; width: 34px; height: 34px; border-radius: 9px;
  background: var(--bg); border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center; font-size: 15px;
}
.side-kv-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.side-kv-body strong, .side-kv-body a { font-size: 13.5px; word-break: break-word; }
.side-kv-label { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); }
.side-badges { display: flex; gap: 5px; flex-wrap: wrap; margin-top: 5px; }
.side-net {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  border-radius: 9px; padding: 11px 13px; margin-top: 11px;
  background: var(--brand-tint); color: var(--brand); font-size: 13.5px;
}
.side-net strong { font-size: 15.5px; font-variant-numeric: tabular-nums; }
[data-theme="dark"] .side-net { color: #e8a9ac; }

/* Expense categories manager */
.cat-list { display: flex; flex-direction: column; gap: 7px; margin-bottom: 4px; }
.cat-row { display: flex; align-items: center; gap: 7px; }
.cat-row input[type="text"] { flex: 1; min-width: 0; }
.cat-row .act-btn-danger, .cat-row .act-btn-locked { min-width: 36px; justify-content: center; }
button.act-btn { cursor: pointer; }
.act-btn-danger { color: #B42318; }
.act-btn-danger:hover { border-color: #B42318; color: #fff; background: #B42318; }
[data-theme="dark"] .act-btn-danger { color: #e07b7b; }
[data-theme="dark"] .act-btn-danger:hover { color: #fff; background: #8a2620; border-color: #8a2620; }
.act-btn-locked { cursor: default; opacity: .65; }
.act-btn-locked:hover { border-color: var(--border); color: var(--text); background: var(--card); }

/* WhatsApp gateway QR connect */
.gw-connect { margin-top: 14px; padding-top: 12px; border-top: 1px dashed var(--border); }
.gw-connect-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin: 8px 0; }
#gw-qr { display: flex; gap: 16px; align-items: flex-start; flex-wrap: wrap; margin-top: 10px; }
#gw-qr img { border: 1px solid var(--border); border-radius: 10px; background: #fff; padding: 8px; }
#gw-qr p { max-width: 340px; }

/* Reports — expenses breakdown */
.stat-good { color: #1B7F4B; }
.stat-bad { color: #B42318; }
[data-theme="dark"] .stat-good { color: #6fce9e; }
[data-theme="dark"] .stat-bad { color: #e07b7b; }
.exp-list { display: flex; flex-direction: column; gap: 11px; }
.exp-row-top { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.exp-name { font-size: 13px; color: var(--text); }
.exp-amt { font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; }
.exp-bar { height: 5px; border-radius: 99px; background: var(--bg); margin-top: 4px; overflow: hidden; }
.exp-bar i { display: block; height: 100%; border-radius: 99px; background: var(--brand); opacity: .75; }
.exp-total-row {
  display: flex; justify-content: space-between; align-items: center;
  border-top: 1px solid var(--border); margin-top: 14px; padding-top: 11px;
  font-size: 13px; font-weight: 600;
}
.exp-net {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  border-radius: 9px; padding: 11px 13px; margin-top: 11px; font-size: 13.5px;
}
.exp-net strong { font-size: 15.5px; font-variant-numeric: tabular-nums; }
.exp-net.good { background: rgba(27, 127, 75, .09); color: #1B7F4B; }
.exp-net.bad { background: rgba(180, 35, 24, .08); color: #B42318; }
[data-theme="dark"] .exp-net.good { background: rgba(111, 206, 158, .12); color: #6fce9e; }
[data-theme="dark"] .exp-net.bad { background: rgba(224, 123, 123, .12); color: #e07b7b; }

/* Payroll run editing */
.payroll-num { width: 110px; text-align: right; }

/* Row action buttons (agreements list etc.) */
.act-group { display: inline-flex; gap: 6px; white-space: nowrap; }
.act-btn {
  display: inline-flex; align-items: center; gap: 4px;
  border: 1px solid var(--border); border-radius: 7px; padding: 4px 10px;
  font-size: 12px; font-weight: 600; color: var(--text); background: var(--card);
  text-decoration: none; transition: border-color .12s, color .12s, background .12s;
}
.act-btn:hover { border-color: var(--brand); color: var(--brand); background: var(--brand-tint); text-decoration: none; }

.agr-doc table { width: 100%; border-collapse: collapse; margin: 0 0 10px; }
.agr-doc td, .agr-doc th { border: 1px solid var(--border); padding: 6px 9px; vertical-align: top; }
.agr-doc table.no-border td, .agr-doc table.no-border th { border: none; }

/* Automated meeting reminders (settings) */
.rem-row { display: flex; align-items: center; gap: 8px; padding: 4px 0; font-size: 13px; }
.rem-row input[type="number"] { width: 74px; text-align: center; }
.rem-ord { white-space: nowrap; }
.rem-del {
  border: 0; background: none; color: var(--muted); cursor: pointer;
  font-size: 13px; padding: 4px 6px; border-radius: 6px; margin-left: auto;
}
.rem-del:hover { color: #B42318; background: var(--brand-tint); }

/* Meeting-link "send via" channel picker */
.send-via { border: 1px solid var(--border); border-radius: 9px; padding: 2px 13px 4px; margin: 8px 0 4px; background: var(--bg); }
.send-via-title {
  display: block; font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .5px; color: var(--muted); padding: 9px 0 3px;
}
.send-via-row {
  display: flex; flex-direction: row; align-items: center; gap: 10px;
  padding: 9px 0; border-bottom: 1px dashed var(--border);
  font-size: 13px; color: var(--text); cursor: pointer;
}
.send-via-row:last-child { border-bottom: 0; }
.send-via-row input { width: auto; margin: 0; flex: 0 0 auto; }
.send-via-name { font-weight: 600; white-space: nowrap; }
.send-via-dest { margin-left: auto; color: var(--muted); font-size: 12px; text-align: right; word-break: break-all; }
.send-via-row.off { opacity: .55; cursor: default; }

/* Internal reschedule slot grid */
.rs-slots { display: flex; flex-wrap: wrap; gap: 7px; margin: 4px 0 8px; max-height: 190px; overflow: auto; }
.rs-slots .book-slot { padding: 6px 10px; font-size: 12.5px; }

/* Follow-up date modal */
.fu-date-input { width: 100%; max-width: 240px; margin: 4px auto 14px; display: block; }

/* Lead card follow-up date */
.lead-follow { color: var(--text); font-weight: 600; font-size: 12px; }
.lead-follow.overdue { color: #B42318; }
.overdue-date { color: #B42318; font-weight: 600; }
[data-theme="dark"] .lead-follow.overdue, [data-theme="dark"] .overdue-date { color: #e07b7b; }

/* Client profile — consultation notes */
.consult-note {
  border: 1px solid var(--border); border-radius: 10px;
  background: var(--bg); padding: 14px 16px;
}
.consult-note + .consult-note { margin-top: 12px; }
.consult-note-head {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding-bottom: 10px; margin-bottom: 12px; border-bottom: 1px dashed var(--border);
}
.consult-note-head .badge { margin-left: auto; }
.consult-note-block { margin-top: 12px; }
.consult-note-block strong { display: block; font-size: 11.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; margin-bottom: 4px; }
.consult-note-block p { font-size: 13.5px; line-height: 1.6; }

/* Client profile — At a Glance stat tiles */
.glance-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.glance-item {
  display: flex; flex-direction: column; gap: 3px;
  border: 1px solid var(--border); border-radius: 10px; background: var(--bg); padding: 10px 13px;
}
.glance-label { font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; }
.glance-value { font-size: 15.5px; font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; }
.glance-good { color: #1B7F4B; }
.glance-bad { color: #B42318; }
[data-theme="dark"] .glance-good { color: #6fce9e; }
[data-theme="dark"] .glance-bad { color: #e07b7b; }

/* Booking error / hold-expired page */
.book-invalid {
  display: flex; flex-direction: column; align-items: center; text-align: center;
  gap: 16px; padding: 44px 30px !important; max-width: 560px; margin-left: auto; margin-right: auto;
}
.book-invalid-icon {
  width: 76px; height: 76px; border-radius: 50%; background: var(--brand-tint);
  display: flex; align-items: center; justify-content: center; font-size: 34px;
}
.book-invalid-msg { font-size: 15.5px; color: var(--text); line-height: 1.6; max-width: 440px; }
.book-invalid .btn { margin-top: 2px; }
/* Payment result (failed / cancelled): red mark, the provider's reason, reference + time */
.book-invalid-fail .book-invalid-icon, .book-invalid-cancel .book-invalid-icon {
  background: var(--brand); color: #fff; font-weight: 800; font-size: 38px; line-height: 1; }
.book-invalid-cancel .book-invalid-icon { background: #6b6b6b; font-size: 30px; }
.book-invalid-title { margin: 0; font-size: 22px; letter-spacing: .5px; text-transform: uppercase; color: var(--text); }
.book-invalid-fail .book-invalid-msg { font-weight: 600; color: var(--brand); }
.book-invalid-facts { margin: 0; width: 100%; max-width: 360px; border: 1px solid var(--border); border-radius: 10px;
  font-size: 13.5px; text-align: left; }
.book-invalid-facts div { display: flex; justify-content: space-between; gap: 16px; padding: 8px 14px; }
.book-invalid-facts div + div { border-top: 1px solid var(--border); }
.book-invalid-facts dt { color: var(--muted); }
.book-invalid-facts dd { margin: 0; font-weight: 600; text-align: right; }
.book-invalid-note { max-width: 440px; margin: 0; }

/* Plan descriptions — teaser on the list, collapsible block on the picker */
.book-plan-desc {
  display: -webkit-box; -webkit-line-clamp: 3; line-clamp: 3;
  -webkit-box-orient: vertical; overflow: hidden; line-height: 1.55;
}
.book-desc { text-align: left; margin-bottom: 16px; }
.book-desc summary {
  cursor: pointer; font-weight: 700; font-size: 13px; color: var(--brand);
  text-transform: uppercase; letter-spacing: .4px; user-select: none;
}
.book-desc summary:hover { color: var(--brand-active, var(--brand)); }
.book-desc-body { margin-top: 10px; color: var(--muted); font-size: 13.5px; line-height: 1.65; }

/* Duration / method / fee highlight chips */
.book-plan-meta { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 9px; }
.book-head-meta { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; margin: 12px 0 4px; }

/* Time zone combobox — search box lives inside the dropdown panel */
.tzp { position: relative; width: 100%; }
.tzp-native { display: none; }
.tzp-btn {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  width: 100%; padding: 8px 11px; border: 1px solid var(--border); border-radius: 7px;
  background: #fff; color: var(--text); font: inherit; cursor: pointer; text-align: left;
}
.tzp-btn:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(141, 25, 32, .12); }
.tzp-caret { color: var(--muted); font-size: 11px; }
.tzp-panel {
  position: absolute; z-index: 60; top: calc(100% + 5px); left: 0; right: 0; min-width: 290px;
  background: #fff; border: 1px solid var(--border); border-radius: 11px;
  box-shadow: 0 14px 34px rgba(26, 26, 26, .16); padding: 10px;
}
.tzp-search { width: 100%; margin-bottom: 8px; font-size: 13px; }
.tzp-list { max-height: 280px; overflow: auto; }
.tzp-group {
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px;
  color: var(--muted); padding: 9px 8px 4px;
}
.tzp-item {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  width: 100%; padding: 7px 9px; border: 0; border-radius: 7px; background: none;
  font: inherit; font-size: 13.5px; color: var(--text); cursor: pointer; text-align: left;
}
.tzp-item:hover { background: var(--brand-tint); }
.tzp-item.selected { background: var(--brand); color: #fff; }
.tzp-item .tzp-time { color: var(--muted); font-variant-numeric: tabular-nums; font-size: 12.5px; }
.tzp-item-stack { flex-direction: column; align-items: flex-start; gap: 2px; }
.tzp-item-sub { color: var(--muted); font-size: 11.5px; word-break: break-word; }
.tzp-item.selected .tzp-item-sub { color: rgba(255, 255, 255, .85); }
.tzp-item.selected .tzp-time { color: rgba(255, 255, 255, .85); }
.book-tz-top { flex-wrap: wrap; }
.book-tz-top .tzp { width: 300px; }
.book-tz-top .tzp-panel { left: auto; right: 0; width: 340px; }

/* Manage-booking page: reschedule / cancel side by side */
.manage-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin-top: 20px; }
.manage-opt { display: flex; flex-direction: column; gap: 10px; align-items: flex-start; }
.manage-opt > strong { font-size: 14.5px; color: var(--text); }
.manage-opt p { margin: 0; line-height: 1.55; }
.manage-opt .stack-form { display: flex; flex-direction: column; gap: 10px; width: 100%; align-items: flex-start; }
.manage-opt .stack-form label { width: 100%; }
.manage-opt + .manage-opt { border-left: 1px solid var(--border); padding-left: 24px; }
@media (max-width: 640px) {
  .manage-grid { grid-template-columns: 1fr; }
  .manage-opt + .manage-opt { border-left: 0; padding-left: 0; border-top: 1px solid var(--border); padding-top: 18px; }
  .manage-opt .btn { width: 100%; text-align: center; }
}

/* Appointments — weekly availability editor */
.avail-day { border-bottom: 1px dashed var(--border); padding: 10px 0; }
.avail-day:last-child { border-bottom: 0; }
.avail-day-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 6px; }
.avail-day-head strong { font-size: 13.5px; }
.avail-periods { display: flex; flex-direction: column; gap: 6px; }
.avail-period { display: flex; align-items: center; gap: 8px; }
.avail-period input[type="time"] { width: auto; flex: 0 0 130px; }
.avail-none { margin: 0; }

/* Invoice installment plan builder */
.inst-plan { border-top: 1px dashed var(--border); margin-top: 14px; padding-top: 12px; }
.inst-line input[type="date"] { flex: 0 0 150px; width: auto; }
.inst-line input[name="inst_amounts[]"] { flex: 0 0 110px; width: auto; }
#inst-mismatch { color: var(--brand); font-weight: 600; }

/* Financial Summary statement */
.fin-stmt { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 40px; }
.fin-col-title {
  font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  color: var(--muted); margin: 0 0 6px; padding-bottom: 8px; border-bottom: 2px solid var(--text);
}
.fin-row {
  display: flex; justify-content: space-between; align-items: baseline; gap: 16px;
  padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 14px;
}
.fin-row > span:first-child { color: var(--muted); }
.fin-row > :last-child { font-variant-numeric: tabular-nums; white-space: nowrap; }
.fin-row strong { font-weight: 600; color: var(--text); }
.fin-neg > :last-child { color: var(--muted); }
.fin-total {
  border-bottom: none; border-top: 2px solid var(--text); margin-top: -1px; padding-top: 10px;
}
.fin-total > span:first-child { color: var(--text); font-weight: 600; }
.fin-total strong { font-size: 15px; font-weight: 700; }
.fin-band {
  display: flex; justify-content: space-between; align-items: center; gap: 16px;
  margin-top: 12px; padding: 10px 14px; border-radius: 8px; font-size: 14px; font-weight: 600;
}
.fin-band strong { font-size: 16px; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.fin-band-due { background: var(--brand-tint); color: var(--brand-active); }
.fin-band-ok { background: #E8F3EC; color: #1C6B3C; }
.fin-band-warn { background: #FBF3E2; color: #8A6100; }
[data-theme="dark"] .fin-band-due { color: #e07b7b; }
[data-theme="dark"] .fin-band-ok { background: rgba(46,160,92,.15); color: #6FCE97; }
[data-theme="dark"] .fin-band-warn { background: rgba(214,158,32,.15); color: #E4B95B; }
.fin-profit-strip {
  display: flex; gap: 12px; margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--border);
}
.fin-chip {
  flex: 1; background: var(--bg); border: 1px solid var(--border); border-radius: 8px;
  padding: 10px 14px; display: flex; flex-direction: column; gap: 2px;
}
.fin-chip > span {
  font-size: 11px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--muted);
}
.fin-chip > strong { font-size: 16px; font-weight: 700; font-variant-numeric: tabular-nums; }
.fin-chip-accent { border-color: var(--text); }
@media (max-width: 820px) {
  .fin-stmt { grid-template-columns: 1fr; }
  .fin-profit-strip { flex-direction: column; }
}
.filter-inline { display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; }
.filter-inline input { width: auto; }
.approval-card { border-left: 3px solid var(--brand); }

/* ---- Leads board ---- */
.lead-board {
  display: flex; gap: 12px; align-items: flex-start;
  overflow-x: auto; padding-bottom: 10px; margin-bottom: 12px;
  scrollbar-width: thin;
}
.lead-col {
  flex: 0 0 240px; background: var(--bg); border: 1px solid var(--border);
  border-radius: 10px; max-height: 74vh; display: flex; flex-direction: column;
}
[data-theme="dark"] .lead-col { background: rgba(255,255,255,.03); }
.lead-col-head {
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
  padding: 10px 12px; border-bottom: 2px solid var(--border);
}
.lead-col-title {
  font-size: 11px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase;
  color: var(--muted); white-space: nowrap;
}
.lead-count {
  background: var(--brand-tint); color: var(--brand-active);
  font-size: 11.5px; font-weight: 700; border-radius: 10px; padding: 1px 8px;
}
[data-theme="dark"] .lead-count { color: #e07b7b; }
.lead-col-body { padding: 10px; display: flex; flex-direction: column; gap: 8px; overflow-y: auto; }
.lead-card {
  background: var(--card); border: 1px solid var(--border); border-radius: 8px;
  padding: 10px 12px; cursor: grab; box-shadow: 0 1px 2px rgba(0,0,0,.05);
}
.lead-card:active { cursor: grabbing; }
.lead-card.dragging { opacity: .45; }
.lead-col.drag-over { border-color: var(--brand); box-shadow: 0 0 0 2px var(--brand-tint); }
.lead-card-top { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.lead-avatar {
  width: 28px; height: 28px; border-radius: 50%; object-fit: cover; flex: 0 0 28px;
}
.lead-avatar-fallback {
  background: var(--brand-tint); color: var(--brand-active); font-weight: 700; font-size: 12px;
  display: flex; align-items: center; justify-content: center;
}
[data-theme="dark"] .lead-avatar-fallback { color: #e07b7b; }
.lead-card-name { display: flex; flex-direction: column; min-width: 0; }
.lead-card-name a { font-weight: 600; font-size: 13.5px; color: var(--text); text-decoration: none;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lead-card-name a:hover { color: var(--brand); }
.lead-card-name .code { font-size: 11px; }
.lead-card-meta { display: flex; flex-direction: column; gap: 2px; font-size: 12px; color: var(--muted); }
@media (max-width: 820px) {
  .lead-col { flex: 0 0 82vw; }
}

/* Intake wizard validation feedback */
.req-star { color: var(--brand); font-weight: 700; }
input.field-invalid, select.field-invalid, textarea.field-invalid {
  border-color: var(--brand) !important;
  background: var(--brand-tint) !important;
  box-shadow: 0 0 0 3px rgba(141, 25, 32, .12);
}
.wizard-error {
  position: fixed; top: 16px; left: 50%; transform: translateX(-50%); z-index: 1200;
  max-width: min(92vw, 560px);
  background: var(--brand); color: #fff;
  padding: 12px 20px; border-radius: 10px;
  font-size: 14px; font-weight: 600; text-align: center;
  box-shadow: 0 12px 34px rgba(0, 0, 0, .3);
  animation: overlay-in .2s ease;
}

/* Reports — aging receivables buckets with proportional bars */
.aging-row { margin-bottom: 13px; }
.aging-meta { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 5px; }
.aging-label {
  font-size: 10.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted);
}
.aging-meta strong { font-size: 13.5px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.aging-bar { height: 6px; border-radius: 4px; background: var(--bg); overflow: hidden; }
.aging-bar > span { display: block; height: 100%; border-radius: 4px; transition: width .3s; }
.age-fresh   { background: #2E8A5C; }
.age-warn    { background: #D69E20; }
.age-late    { background: #D2691E; }
.age-overdue { background: var(--brand); }
.aging-total {
  display: flex; justify-content: space-between; align-items: baseline; gap: 12px;
  border-top: 2px solid var(--text); margin-top: 2px; padding-top: 10px; font-size: 13px;
}
.aging-total > span { color: var(--muted); font-weight: 600; }
.aging-total strong { font-variant-numeric: tabular-nums; }

/* Reports — per-person rows (collections / adjustments) */
.who-row { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--border); }
.who-row:last-child { border-bottom: 0; padding-bottom: 2px; }
.who-avatar {
  flex: 0 0 32px; width: 32px; height: 32px; border-radius: 50%;
  background: var(--brand-tint); color: var(--brand-active);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700;
}
[data-theme="dark"] .who-avatar { color: #e07b7b; }
.who-photo { object-fit: cover; }
.who-info { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.who-info strong { font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who-amt { margin-left: auto; font-size: 13.5px; font-variant-numeric: tabular-nums; white-space: nowrap; }
td.row-actions { white-space: nowrap; }
td.row-actions .btn + .btn { margin-left: 6px; }


/* reCAPTCHA: version picker (Settings → Security), v3 notice, recent scores */
.captcha-versions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (max-width: 640px) { .captcha-versions { grid-template-columns: 1fr; } }
.captcha-ver { display: flex; gap: 10px; align-items: flex-start; padding: 12px; border: 1px solid var(--border);
  border-radius: var(--radius); cursor: pointer; }
.captcha-ver:has(input:checked) { border-color: var(--brand); background: var(--brand-tint); }
.captcha-ver { flex-direction: row; color: var(--text); font-size: 13.5px; }
.captcha-ver input[type="radio"] { flex: none; width: 17px; height: 17px; margin: 2px 0 0; padding: 0;
  border: 0; box-shadow: none; accent-color: var(--brand); cursor: pointer; }
.captcha-ver span { display: flex; flex-direction: column; gap: 2px; }
.captcha-ver small { color: var(--muted); font-size: 12px; font-weight: 400; }
.captcha-note { font-size: 11px; color: var(--muted); text-align: center; margin: 0; }
.captcha-note a { color: inherit; text-decoration: underline; }
.captcha-scores { width: 100%; font-size: 12.5px; }
.captcha-scores th, .captcha-scores td { padding: 5px 6px; text-align: left; }

/* ==========================================================================
   Staff sign-in pages (login / forgot / reset) — matches the public website:
   contact top bar · red skyline hero with the consultant · white card · footer
   ========================================================================== */
.auth-body { margin: 0; min-height: 100vh; display: flex; flex-direction: column; background: #111; color: #fff; }
.auth-topbar { display: flex; align-items: stretch; justify-content: space-between; min-height: 50px;
  background: #141414; font-size: 15px; }
.auth-contact { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 34px; padding: 10px 44px; }
.auth-contact a, .auth-contact .auth-hours { display: inline-flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; }
.auth-contact a:hover span { text-decoration: underline; }
.auth-contact svg { flex: none; opacity: .95; }
.auth-social { display: flex; align-items: center; gap: 9px; padding: 8px 40px 8px 30px; background: var(--brand); }
.auth-social a { display: grid; place-items: center; width: 33px; height: 33px; border-radius: 50%;
  border: 1px solid rgba(255,255,255,.55); color: #fff; transition: background .15s, border-color .15s; }
.auth-social a:hover { background: rgba(255,255,255,.16); border-color: #fff; }

.auth-stage { position: relative; flex: 1; display: grid; align-items: center; overflow: hidden;
  grid-template-columns: minmax(0, .95fr) minmax(0, 1.05fr) minmax(400px, 515px); column-gap: 3vw;
  padding: 120px 6vw 56px; min-height: 620px;
  /* dark overlay over the red skyline so the white copy reads clearly —
     deepest behind the headline, lighter where the skyline shows */
  background: linear-gradient(90deg, rgba(12,0,2,.62) 0%, rgba(12,0,2,.55) 48%, rgba(12,0,2,.38) 72%, rgba(12,0,2,.5) 100%),
              linear-gradient(0deg, rgba(0,0,0,.35), transparent 45%),
              var(--auth-bg) center bottom / cover no-repeat, #3a0609; }
.auth-stage-logo { position: absolute; top: 22px; left: 6vw; height: 78px; width: auto; z-index: 2; }
.auth-person { position: absolute; left: 3vw; bottom: 0; height: calc(100% - 118px); max-height: 780px;
  width: auto; z-index: 1; filter: drop-shadow(0 10px 28px rgba(0,0,0,.35)); pointer-events: none; }
.auth-hero { grid-column: 2; position: relative; z-index: 2; max-width: 430px; text-shadow: 0 2px 16px rgba(0,0,0,.45); }
.auth-kicker { display: inline-block; padding: 9px 16px; border-radius: 4px; background: rgba(160,18,28,.92);
  font-size: 16px; font-weight: 700; letter-spacing: 3px; text-transform: uppercase; text-shadow: none; }
.auth-hero h1 { margin: 22px 0 18px; font-size: clamp(38px, 3.6vw, 60px); line-height: 1.07; font-weight: 800;
  letter-spacing: -.5px; color: #fff; }
.auth-hero p { margin: 0; font-size: 19px; line-height: 1.45; color: rgba(255,255,255,.93); }
.auth-rule { display: block; width: 130px; height: 4px; margin-top: 22px; border-radius: 2px; background: #e3262f; }

.auth-card { grid-column: 3; position: relative; z-index: 2; background: #fff; color: #1A1A1A;
  border-radius: 20px; padding: 30px 38px 30px; box-shadow: 0 24px 60px rgba(0,0,0,.35); }
.auth-card-brand { text-align: center; margin-bottom: 20px; }
.auth-card-brand img { width: 272px; max-width: 80%; height: auto; }
.auth-card-brand h2 { margin: 14px 0 0; font-size: 26px; font-weight: 700; color: #1A1A1A; letter-spacing: -.2px; }
.auth-form { display: flex; flex-direction: column; }
.auth-label { margin: 0 0 7px; font-size: 15.5px; font-weight: 600; color: #333; }
.auth-field { position: relative; margin-bottom: 18px; }
.auth-field > svg { position: absolute; left: 18px; top: 50%; transform: translateY(-50%); color: #777; pointer-events: none; }
.auth-field input { width: 100%; box-sizing: border-box; height: 48px; padding: 0 50px 0 56px; font-size: 15.5px;
  color: #1A1A1A; background: #fff; border: 1px solid #d9d9d9; border-radius: 8px; font-family: inherit; }
.auth-field input::placeholder { color: #8a8a8a; }
.auth-field input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(141,25,32,.14); }
.auth-eye { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); display: grid; place-items: center;
  width: 36px; height: 36px; padding: 0; border: 0; border-radius: 6px; background: none; color: #555; cursor: pointer; }
.auth-eye:hover { background: #f2f2f2; }
.auth-eye .auth-eye-on, .auth-eye.is-on .auth-eye-off { display: none; }
.auth-eye.is-on .auth-eye-on { display: grid; }
.auth-eye span { display: grid; }
.auth-form .captcha-box { display: flex; justify-content: center; margin: 2px 0 4px; }
.auth-form .captcha-note { color: #777; text-align: center; }
.auth-submit { height: 48px; margin-top: 14px; font-size: 17px; font-weight: 700; border-radius: 7px; }
.auth-alt { margin: 20px 0 0; text-align: center; font-size: 16px; }
.auth-alt a { color: var(--brand); font-weight: 600; text-decoration: none; }
.auth-alt a:hover { text-decoration: underline; }
.auth-help { margin: -6px 0 18px; text-align: center; font-size: 14px; color: #666; }
.auth-card .flash { margin-bottom: 16px; }

.auth-foot { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 24px; padding: 20px 6vw 22px;
  background: #141414; border-top: 1px solid rgba(255,255,255,.08); font-size: 15px; color: rgba(255,255,255,.85); }

/* Narrower desktops: the consultant steps aside, copy + card share the row */
@media (max-width: 1200px) {
  .auth-person { display: none; }
  .auth-stage { grid-template-columns: minmax(0, 1fr) minmax(380px, 480px); column-gap: 5vw; }
  .auth-hero { grid-column: 1; }
  .auth-card { grid-column: 2; }
}
/* Tablets / phones: just the card on the skyline */
@media (max-width: 820px) {
  .auth-topbar { flex-direction: column; }
  .auth-contact { justify-content: center; padding: 10px 16px; gap: 6px 22px; font-size: 14px; }
  .auth-social { justify-content: center; padding: 8px 16px; }
  .auth-stage { display: flex; flex-direction: column; align-items: center; padding: 26px 16px 36px; min-height: 0; }
  .auth-stage-logo { position: static; height: 62px; margin-bottom: 22px; }
  .auth-hero { display: none; }
  .auth-card { width: 100%; max-width: 470px; padding: 26px 22px; box-sizing: border-box; }
  .auth-card-brand h2 { font-size: 22px; }
  .auth-foot { justify-content: center; text-align: center; padding: 16px; font-size: 13px; }
}
@media (max-width: 380px) {
  .auth-form .captcha-box { transform: scale(.9); transform-origin: center; }
}

/* Lock screen (staff /lock + portal /portal/lock) */
.lock-who { display: flex; flex-direction: column; align-items: center; gap: 3px; margin: -4px 0 18px; text-align: center; }
.lock-avatar { width: 72px; height: 72px; border-radius: 50%; object-fit: cover; margin-bottom: 6px;
  box-shadow: 0 0 0 3px #fff, 0 0 0 5px rgba(141,25,32,.35); }
.lock-avatar-initial { display: grid; place-items: center; background: var(--brand); color: #fff; font-size: 30px; font-weight: 700; }
.lock-who strong { font-size: 17px; color: #1A1A1A; }
.lock-who span:not(.lock-avatar) { font-size: 13.5px; color: #666; }

/* PBX — Sync Now in progress */
.pbx-sync-note { align-self: center; }
.btn.is-busy { opacity: .8; cursor: progress; }
.btn.is-busy .pbx-sync-ico { display: inline-block; animation: pbx-spin .8s linear infinite; }
@keyframes pbx-spin { to { transform: rotate(360deg); } }

/* PBX live monitor — status pill + idle state */
.pbx-live-pill { display: inline-flex; align-items: center; gap: 8px; padding: 5px 12px; border-radius: 999px;
  font-size: 12.5px; font-weight: 600; color: #1B7F4B; background: rgba(27,127,75,.10);
  border: 1px solid rgba(27,127,75,.30); white-space: nowrap; }
.pbx-live-pill strong { text-transform: uppercase; letter-spacing: .6px; font-size: 11.5px; }
.pbx-live-n { padding-left: 8px; border-left: 1px solid rgba(27,127,75,.30); }
.pbx-live-time { font-weight: 500; color: var(--muted); }
.pbx-live-dot { width: 8px; height: 8px; border-radius: 50%; background: #27A25B; flex: none;
  box-shadow: 0 0 0 0 rgba(39,162,91,.6); animation: pbx-pulse 1.8s ease-out infinite; }
.pbx-live-pill.is-busy { color: var(--brand); background: var(--brand-tint); border-color: rgba(141,25,32,.35); }
.pbx-live-pill.is-busy .pbx-live-n { border-color: rgba(141,25,32,.35); }
.pbx-live-pill.is-busy .pbx-live-dot { background: var(--brand); box-shadow: 0 0 0 0 rgba(141,25,32,.6); }
.pbx-live-pill.is-error { color: #96700d; background: #fdf3d9; border-color: #ecd49a; }
.pbx-live-pill.is-error .pbx-live-dot { background: #d9a21b; animation: none; }
@keyframes pbx-pulse { 70% { box-shadow: 0 0 0 7px rgba(39,162,91,0); } 100% { box-shadow: 0 0 0 0 rgba(39,162,91,0); } }
.pbx-idle { display: flex; align-items: center; gap: 14px; margin-top: 4px; padding: 14px 16px; border-radius: 10px;
  background: rgba(27,127,75,.06); border: 1px dashed rgba(27,127,75,.35); }
.pbx-idle-ico { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; flex: none;
  background: rgba(27,127,75,.14); font-size: 18px; }
.pbx-idle strong { display: block; font-size: 14.5px; color: var(--text); }
.pbx-idle div span { font-size: 12.5px; color: var(--muted); }
[data-theme="dark"] .pbx-live-pill { color: #5fd08f; background: rgba(39,162,91,.14); }
[data-theme="dark"] .pbx-live-pill.is-error { color: #e5c56a; background: #3d3420; border-color: #6b5a2a; }
[data-theme="dark"] .pbx-idle { background: rgba(39,162,91,.08); }

/* Settings → Bulk SMS: account balance strip */
.sms-balance { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin: 0 0 14px; padding: 10px 14px;
  border-radius: 10px; background: rgba(27,127,75,.07); border: 1px solid rgba(27,127,75,.28); }
.sms-balance-label { font-size: 12.5px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; }
.sms-balance strong { font-size: 17px; color: #1B7F4B; }
.sms-balance .btn { margin-left: auto; }
.sms-balance.is-low { background: #fdf3d9; border-color: #ecd49a; }
.sms-balance.is-low strong { color: #96700d; }
.sms-balance.is-error { background: rgba(141,25,32,.06); border-color: rgba(141,25,32,.3); }
.sms-balance.is-error strong { font-size: 13.5px; font-weight: 600; color: var(--brand); }
[data-theme="dark"] .sms-balance strong { color: #5fd08f; }

/* PBX call summary cards (top of Call History; follow its filters) */
.pbx-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(118px, 1fr)); gap: 10px; margin: 14px 0 6px; }
.pbx-stat { display: flex; flex-direction: column; gap: 3px; padding: 10px 12px; text-align: left; font: inherit;
  border: 1px solid var(--border); border-left: 4px solid var(--border); border-radius: 10px; background: var(--card); color: var(--text); }
button.pbx-stat { cursor: pointer; transition: box-shadow .15s, transform .15s; }
button.pbx-stat:hover { box-shadow: 0 4px 14px rgba(0,0,0,.08); transform: translateY(-1px); }
.pbx-stat-label { font-size: 11px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .3px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pbx-stat-value { font-size: 21px; font-weight: 700; line-height: 1.15; font-variant-numeric: tabular-nums; }
.pbx-stat-dirs { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; min-height: 19px; margin-top: 2px; }
.pbx-stat-dirs .pbx-dir { padding: 1px 7px; font-size: 10.5px; }
.pbx-stat-in   { border-left-color: #1B7F4B; } .pbx-stat-in .pbx-stat-value { color: #1B7F4B; }
.pbx-stat-out  { border-left-color: #1273B9; } .pbx-stat-out .pbx-stat-value { color: #1273B9; }
.pbx-stat-ok   { border-left-color: #27A25B; } .pbx-stat-ok .pbx-stat-value { color: #1B7F4B; }
.pbx-stat-warn { border-left-color: #d9a21b; } .pbx-stat-warn .pbx-stat-value { color: #96700d; }
.pbx-stat-bad  { border-left-color: var(--brand); } .pbx-stat-bad .pbx-stat-value { color: var(--brand); }
.pbx-stat-muted { border-left-color: var(--border); } .pbx-stat-muted .pbx-stat-value { color: var(--muted); }
.pbx-stat-rate { border-left-color: var(--brand); background: var(--brand-tint); }
.pbx-stat-rate .pbx-stat-value { color: var(--brand); }
.pbx-stat-bar { display: block; height: 4px; border-radius: 3px; background: rgba(141,25,32,.15); overflow: hidden; margin: 1px 0 2px; }
.pbx-stat-bar span { display: block; height: 100%; background: var(--brand); border-radius: 3px; }
.pbx-stats-note { margin: 0 0 12px; }
.pbx-stat-sub { font-size: 11.5px; font-weight: 600; color: var(--muted); white-space: nowrap; }
[data-theme="dark"] .pbx-stat-in .pbx-stat-value, [data-theme="dark"] .pbx-stat-ok .pbx-stat-value { color: #5fd08f; }
[data-theme="dark"] .pbx-stat-out .pbx-stat-value { color: #6fb7ea; }
[data-theme="dark"] .pbx-stat-warn .pbx-stat-value { color: #e5c56a; }

/* Collapsible step-by-step setup guide (Settings cards) */
.setup-guide { margin-top: 12px; padding: 12px 14px; border: 1px solid var(--border); border-radius: 10px; background: var(--bg); }
.setup-guide summary { cursor: pointer; font-size: 13.5px; font-weight: 700; color: var(--text); }
.setup-guide summary .muted { font-weight: 400; font-size: 12.5px; }
.setup-guide[open] summary { margin-bottom: 10px; }
.setup-guide ol { margin: 8px 0 12px 20px; padding: 0; display: flex; flex-direction: column; gap: 10px; font-size: 13px; line-height: 1.5; }
.setup-guide ol ul { margin: 6px 0 0 18px; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.setup-guide > ul { margin: 4px 0 0 18px; padding: 0; display: flex; flex-direction: column; gap: 4px; line-height: 1.5; }
.setup-guide .copy-row { margin: 6px 0; }
.setup-guide ol ul .copy-row { margin: 4px 0 2px; }
.setup-guide .copy-row input { background: var(--card); }

/* Public legal pages (/privacy, /terms) + footer links to them */
.legal-doc { padding: 28px 32px; font-size: 14.5px; line-height: 1.65; }
.legal-doc h2 { font-size: 16.5px; margin: 24px 0 8px; color: var(--text); }
.legal-doc p { margin: 0 0 10px; }
.legal-doc ul { margin: 0 0 10px 20px; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.foot-legal { display: block; margin-top: 6px; }
@media (max-width: 640px) { .legal-doc { padding: 20px 18px; } }

/* ---- Payment method logos (Settings → Payment Methods; public payment pages) ---- */
.pay-tile .pay-tile-logo.pay-tile-logo-img { flex-basis: 74px; height: 48px; background: #fff; border: 1px solid var(--border); padding: 4px; }
.pay-tile-logo-img img { max-width: 100%; max-height: 100%; object-fit: contain; display: block; }
.pm-logo {
  flex: 0 0 38px; height: 28px; display: flex; align-items: center; justify-content: center;
  border-radius: 6px; background: #fff; border: 1px solid var(--border); overflow: hidden; padding: 2px;
}
.pm-logo img { max-width: 100%; max-height: 100%; object-fit: contain; display: block; }
.pm-logo-none { background: transparent; border-style: dashed; }
.pm-logo-current { display: flex; align-items: center; gap: 12px; }
.pm-logo-current img {
  height: 46px; max-width: 130px; object-fit: contain;
  background: #fff; border: 1px solid var(--border); border-radius: 8px; padding: 4px;
}

/* ---- Booking confirmation page (book/done) ---- */
.done-mark {
  width: 68px; height: 68px; border-radius: 50%; margin: 6px auto 16px;
  display: flex; align-items: center; justify-content: center; color: #fff;
}
.done-mark svg { width: 34px; height: 34px; }
.done-mark-ok   { background: var(--success); box-shadow: 0 0 0 9px rgba(30, 126, 70, .12); }
.done-mark-wait { background: #b7791f; box-shadow: 0 0 0 9px rgba(183, 121, 31, .14); }
.done-mark-info { background: #6b6b6b; box-shadow: 0 0 0 9px rgba(107, 107, 107, .12); }
.public-head h1.done-title { font-size: 28px; }
.done-refs { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 22px; }
.done-refs-one { grid-template-columns: minmax(0, 440px); justify-content: center; }
.done-ref {
  position: relative; display: flex; flex-direction: column; gap: 5px;
  background: var(--card); border: 1px solid var(--border); border-top: 4px solid var(--brand);
  border-radius: 14px; padding: 18px 22px 17px;
}
.done-ref-pay { border-top-color: var(--success); }
.done-ref-label { font-size: 11px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; color: var(--muted); }
.done-ref-value {
  font: 700 27px/1.2 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  letter-spacing: .02em; color: var(--brand); overflow-wrap: anywhere; padding-right: 64px;
}
.done-ref-pay .done-ref-value { color: var(--text); }
.done-ref-sub { font-size: 12.5px; color: var(--muted); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.done-ref-sub img { height: 20px; width: auto; max-width: 60px; object-fit: contain; }
.done-copy-mini {
  position: absolute; top: 14px; right: 14px; cursor: pointer;
  border: 1px solid var(--border); background: var(--bg); color: var(--text);
  font: inherit; font-size: 12px; font-weight: 600; padding: 4px 11px; border-radius: 999px;
}
.done-copy-mini:hover { border-color: var(--brand); color: var(--brand); }
.done-details { display: flex; align-items: center; gap: 26px; flex-wrap: wrap; }
.done-facts { flex: 1; min-width: 260px; margin: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 14px 24px; }
.done-facts .done-wide { grid-column: 1 / -1; }
.done-facts dt { font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin-bottom: 2px; }
.done-facts dd { margin: 0; font-weight: 600; color: var(--text); }
.done-facts .done-when dd { font-size: 19px; }
.done-steps { margin: 4px 0 18px; padding: 0; list-style: none; counter-reset: done-step; display: flex; flex-direction: column; gap: 11px; }
.done-steps li { counter-increment: done-step; position: relative; padding-left: 40px; line-height: 1.55; min-height: 28px; }
.done-steps li::before {
  content: counter(done-step); position: absolute; left: 0; top: 0; width: 28px; height: 28px; border-radius: 50%;
  background: var(--brand-tint); color: var(--brand); font-weight: 700; font-size: 13px;
  display: flex; align-items: center; justify-content: center;
}
.done-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.done-link { overflow-wrap: anywhere; }
@media (max-width: 640px) {
  .done-refs { grid-template-columns: 1fr; }
  .done-facts { grid-template-columns: 1fr; }
  .done-ref-value { font-size: 22px; }
}
@media print { .done-copy-mini, .done-actions { display: none; } }

/* ---- Choice tiles: radio buttons shown as cards (.pick) — payment method, consultation type ---- */
.pick-field { display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.pick-legend { font-size: 12.5px; font-weight: 600; color: var(--muted); }
.pick-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px; }
.pick-grid-sm { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.pick-grid .pick {
  position: relative; display: flex; flex-direction: row; align-items: center; gap: 12px;
  padding: 12px 14px; margin: 0; cursor: pointer; font-size: 14px; font-weight: 400; color: var(--text);
  border: 1.5px solid var(--border); border-radius: 12px; background: var(--card);
  transition: border-color .15s, box-shadow .15s, background .15s;
}
.pick-grid .pick:hover { border-color: var(--brand); }
.pick-grid .pick input {
  position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; padding: 0; border: 0; pointer-events: none;
}
.pick-dot {
  flex: 0 0 20px; height: 20px; border-radius: 50%; position: relative;
  border: 2px solid #b9b3b3; background: #fff; transition: border-color .15s;
}
.pick-ico {
  flex: 0 0 44px; height: 44px; border-radius: 10px; display: flex; align-items: center; justify-content: center;
  background: var(--brand-tint); color: var(--brand);
}
.pick-ico svg { width: 23px; height: 23px; }
.pick-ico.pick-ico-img { flex-basis: 74px; height: 48px; background: #fff; border: 1px solid var(--border); padding: 4px; }
.pick-ico-img img { max-width: 100%; max-height: 100%; object-fit: contain; display: block; }
.pick-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; line-height: 1.3; }
.pick-text strong { font-size: 14px; font-weight: 600; color: var(--text); }
.pick-text small { font-size: 12px; color: var(--muted); }
.pick-grid .pick.is-on, .pick-grid .pick:has(input:checked) {
  border-color: var(--brand); background: var(--brand-tint); box-shadow: 0 0 0 3px rgba(141, 25, 32, .10);
}
.pick.is-on .pick-dot, .pick:has(input:checked) .pick-dot { border-color: var(--brand); }
.pick.is-on .pick-dot::after, .pick:has(input:checked) .pick-dot::after {
  content: ''; position: absolute; inset: 3px; border-radius: 50%; background: var(--brand);
}
.pick.is-on .pick-ico:not(.pick-ico-img), .pick:has(input:checked) .pick-ico:not(.pick-ico-img) { background: #fff; }
.pick-grid .pick:has(input:focus-visible) { outline: 2px solid var(--brand); outline-offset: 2px; }
@media (max-width: 520px) { .pick-grid, .pick-grid-sm { grid-template-columns: 1fr; } }
/* beside the consultant card the column is narrow — slightly smaller tiles */
.book-apt-main .pick-grid-sm { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.book-apt-main .pick-grid .pick { padding: 10px 12px; gap: 10px; }
.book-apt-main .pick-ico { flex-basis: 34px; height: 34px; border-radius: 8px; }
.book-apt-main .pick-ico svg { width: 18px; height: 18px; }

/* ---- File drop zone (.upload-drop) — payment proof on the public payment pages ---- */
.upload-field { display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.upload-optional { font-weight: 400; }
.upload-field .upload-drop {
  position: relative; display: flex; flex-direction: row; align-items: center; justify-content: center;
  min-height: 116px; padding: 18px 20px; margin: 0; cursor: pointer; text-align: center;
  border: 1.5px dashed #c9c2c2; border-radius: 12px; background: var(--bg);
  font-size: 14px; font-weight: 400; color: var(--text); transition: border-color .15s, background .15s;
}
.upload-field .upload-drop:hover, .upload-field .upload-drop.is-drag { border-color: var(--brand); background: var(--brand-tint); }
.upload-drop input[type=file] {
  position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; padding: 0; border: 0; pointer-events: none;
}
.upload-empty { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.upload-empty[hidden], .upload-chosen[hidden], .upload-thumb[hidden], .upload-fileico[hidden] { display: none; }
.upload-ico {
  width: 44px; height: 44px; border-radius: 50%; margin-bottom: 5px;
  display: flex; align-items: center; justify-content: center;
  background: var(--brand-tint); color: var(--brand); transition: background .15s;
}
.upload-drop:hover .upload-ico, .upload-drop.is-drag .upload-ico { background: #fff; }
.upload-ico svg { width: 22px; height: 22px; }
.upload-text strong { color: var(--brand); font-weight: 600; }
.upload-hint { font-size: 12px; color: var(--muted); }
.upload-field .upload-drop.has-file {
  justify-content: flex-start; text-align: left; min-height: 0; padding: 12px 14px;
  border-style: solid; border-color: var(--border); background: var(--card);
}
.upload-field .upload-drop.has-file:hover { border-color: var(--brand); background: var(--card); }
.upload-chosen { display: flex; align-items: center; gap: 12px; width: 100%; min-width: 0; }
.upload-thumb { flex: 0 0 56px; width: 56px; height: 56px; object-fit: cover; border-radius: 8px; border: 1px solid var(--border); }
.upload-fileico {
  flex: 0 0 56px; height: 56px; border-radius: 8px; display: flex; align-items: center; justify-content: center;
  background: var(--brand-tint); color: var(--brand); font-size: 12px; font-weight: 700; letter-spacing: .05em;
}
.upload-meta { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.upload-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.upload-size { font-size: 12px; color: var(--muted); }
.upload-remove {
  flex: 0 0 auto; cursor: pointer; border: 1px solid var(--border); background: var(--bg); color: var(--text);
  font: inherit; font-size: 12.5px; font-weight: 600; padding: 6px 13px; border-radius: 999px;
}
.upload-remove:hover { border-color: var(--brand); color: var(--brand); }
.upload-field .upload-drop:has(input:focus-visible) { outline: 2px solid var(--brand); outline-offset: 2px; }

/* ---- Payment page summary: the amount, and how each way of paying is confirmed ---- */
.pay-summary { display: grid; grid-template-columns: minmax(210px, 270px) 1fr; gap: 26px; align-items: center; }
.pay-amount {
  display: flex; flex-direction: column; gap: 4px; padding: 20px 22px; border-radius: 12px;
  background: var(--brand-tint); border-left: 4px solid var(--brand);
}
.pay-amount-label { font-size: 11px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; color: var(--muted); }
.pay-amount-value { font-size: 31px; font-weight: 800; line-height: 1.15; letter-spacing: -.01em; color: var(--brand); }
.pay-amount-parts { font-size: 12.5px; color: var(--muted); }
.pay-how { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 14px; }
.pay-how li { display: flex; gap: 12px; align-items: flex-start; }
.pay-how-ico {
  flex: 0 0 34px; height: 34px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  background: var(--bg); color: var(--muted); border: 1px solid var(--border);
}
.pay-how-instant .pay-how-ico { background: #e0f3e8; color: var(--success); border-color: #bfe5cf; }
.pay-how-ico svg { width: 17px; height: 17px; }
.pay-how strong { display: block; font-size: 14px; color: var(--text); margin-bottom: 1px; }
.pay-how-text { display: block; font-size: 13px; line-height: 1.5; color: var(--muted); }
@media (max-width: 640px) { .pay-summary { grid-template-columns: 1fr; gap: 18px; } }
