/* Collect by TOA — Elevated Paper & Ink App Design System */
:root {
  --bg: #FAF8F4;
  --surface: #F3EFE6;
  --surface-2: #EAE4D7;
  --card: #FFFFFF;
  --border: #E6E0D4;
  --border-strong: #CEC6B6;
  --ink: #191918;
  --ink-2: #4A4843;
  --ink-muted: #6E6C66;
  --oxblood: #7C2D12;
  --oxblood-hover: #60210B;
  --oxblood-soft: #FDF2EE;
  --forest: #1E4620;
  --forest-soft: #E6EFEA;
  --amber: #B45309;
  --amber-soft: #FEF3C7;
  --blue: #1D4ED8;
  --blue-soft: #EFF6FF;
  --red: #B91C1C;
  --red-soft: #FEF2F2;
  --radius: 16px;
  --radius-sm: 11px;
  --shadow-sm: 0 1px 2px rgba(25, 25, 24, 0.04);
  --shadow: 0 4px 18px rgba(25, 25, 24, 0.05), 0 1px 3px rgba(25, 25, 24, 0.03);
  --shadow-lg: 0 22px 50px rgba(25, 25, 24, 0.18);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color: var(--ink);
  background: var(--bg);
  font-size: 14px;
  line-height: 1.5;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

.mono { font-family: 'JetBrains Mono', monospace; font-variant-numeric: tabular-nums; }
.skip { position: absolute; left: -9999px; }
.skip:focus { position: static; display: inline-block; padding: 8px 12px; background: var(--ink); color: #fff; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--oxblood); outline-offset: 2px; border-radius: 6px; }

.wrap { max-width: 1340px; margin: 0 auto; padding: 0 22px; }

h1, h2, h3 { color: var(--ink); margin: 0; letter-spacing: -0.025em; }
h2 { font-size: 17px; font-weight: 700; line-height: 1.25; }
h3 { font-size: 15px; font-weight: 700; }
.muted { color: var(--ink-muted); margin: 2px 0 0; }
.small { font-size: 12.5px; }

/* Sticky App Header */
.app-header {
  position: sticky;
  top: 0;
  z-index: 30;
  background: rgba(250, 248, 244, 0.9);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}
.header-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  padding-top: 12px;
  padding-bottom: 12px;
  flex-wrap: wrap;
}
.brand-group { display: flex; align-items: center; gap: 12px; }
.brand-logo {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  object-fit: cover;
  border: 1px solid var(--border);
  background: var(--ink);
  box-shadow: var(--shadow-sm);
  flex: none;
}
.brand-title-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.brand-group h1 { font-size: 20px; font-weight: 800; line-height: 1.1; }
.toa-pill {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink-2);
  border: 1px solid var(--border);
}
.brand-sub { margin: 2px 0 0; font-size: 12px; color: var(--ink-muted); }

.header-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* Help Trigger */
.help-trigger {
  background: var(--card);
  border: 1px solid var(--border-strong);
  color: var(--ink);
  padding: 6px 11px;
  border-radius: 999px;
}
.help-trigger:hover { background: var(--ink); color: #fff; border-color: var(--ink); }
.help-q {
  width: 18px;
  height: 18px;
  border-radius: 999px;
  background: var(--oxblood-soft);
  color: var(--oxblood);
  font-size: 11px;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.help-trigger:hover .help-q { background: #fff; color: var(--ink); }

/* View Mode Switcher */
.view-switch {
  display: inline-flex;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 3px;
  gap: 2px;
}
.vs-btn {
  border: 0;
  background: transparent;
  color: var(--ink-2);
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  padding: 5px 10px;
  border-radius: 7px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: all 0.15s ease;
}
.vs-btn.active {
  background: var(--card);
  color: var(--ink);
  box-shadow: 0 1px 4px rgba(25, 25, 24, 0.1);
}

.install-group { display: flex; gap: 6px; flex-wrap: wrap; }

/* Main Container */
.app-main { padding-top: 18px; padding-bottom: 40px; }

/* Sample Mode Strip (Visible on Mobile & Desktop when sample records are loaded) */
.sample-bar {
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  padding: 9px 14px;
  margin-bottom: 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 12.5px;
  color: var(--ink-2);
}
.sample-bar-left { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.sample-pill {
  background: var(--ink);
  color: #FAF8F4;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 2px 8px;
  border-radius: 999px;
}

/* Action & Nav Bar */
.action-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.action-bar-right { display: flex; align-items: center; gap: 8px; }

.seg-tabs {
  display: inline-flex;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 4px;
  gap: 4px;
}
.seg-tab {
  border: 0;
  background: transparent;
  color: var(--ink-2);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  padding: 8px 15px;
  border-radius: 9px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.16s ease;
}
.seg-tab:hover { color: var(--ink); }
.seg-tab.active {
  background: var(--ink);
  color: #fff;
  box-shadow: 0 2px 8px rgba(25, 25, 24, 0.18);
}

.cta-add {
  padding: 9px 18px;
  border-radius: 11px;
  box-shadow: 0 4px 12px rgba(124, 45, 18, 0.22);
}

/* KPI Strip */
.kpi-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}
.kpi-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.kpi-head { display: flex; justify-content: space-between; align-items: center; }
.kpi-label { font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-muted); }
.kpi-icon {
  width: 26px;
  height: 26px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.kpi-ico-ink { background: var(--surface); color: var(--ink); }
.kpi-ico-alert { background: var(--oxblood-soft); color: var(--oxblood); }
.kpi-ico-good { background: var(--forest-soft); color: var(--forest); }
.kpi-val { font-size: 24px; font-weight: 700; color: var(--ink); line-height: 1.2; letter-spacing: -0.02em; }
.kpi-sub { font-size: 12px; color: var(--ink-muted); }
.kpi-card.kpi-alert .kpi-val { color: var(--oxblood); }
.kpi-card.kpi-good .kpi-val { color: var(--forest); }

/* Contextual TOA Executive Advisory Banner */
.toa-moment-banner {
  background: linear-gradient(135deg, #FFFFFF 0%, #FDF2EE 100%);
  border: 1px solid #F0CFC3;
  border-left: 4px solid var(--oxblood);
  border-radius: 14px;
  padding: 12px 16px;
  margin-bottom: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}
.tmb-content { display: flex; align-items: center; gap: 10px; flex: 1 1 320px; flex-wrap: wrap; }
.tmb-tag {
  background: var(--oxblood);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 2px 8px;
  border-radius: 999px;
}
.tmb-content p { margin: 0; font-size: 12.8px; color: var(--ink-2); font-weight: 500; }
.tmb-actions { display: flex; align-items: center; gap: 8px; }
.tmb-dismiss {
  border: 0;
  background: transparent;
  color: var(--ink-muted);
  font-size: 18px;
  cursor: pointer;
  padding: 0 4px;
}

/* Priority Queue: Follow Up Today */
.priority-card {
  border-left: 4px solid var(--oxblood);
}
.priority-head-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.priority-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 9px;
  border-radius: 999px;
  background: var(--oxblood-soft);
  color: var(--oxblood);
}
.priority-badge.all-clear {
  background: var(--forest-soft);
  color: var(--forest);
}
.priority-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 10px;
}
.priority-item {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
.pi-left { min-width: 0; }
.pi-client-row { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.pi-client { font-weight: 700; font-size: 13.5px; color: var(--ink); }
.pi-amt { font-family: 'JetBrains Mono', monospace; font-weight: 700; font-size: 14px; color: var(--oxblood); margin-top: 2px; }
.pi-meta { font-size: 11.5px; color: var(--ink-muted); }
.pi-actions { display: flex; gap: 6px; flex: none; }
.priority-empty {
  background: var(--forest-soft);
  color: var(--forest);
  border-radius: 11px;
  padding: 11px 14px;
  font-size: 13px;
  font-weight: 600;
}

/* Cards */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 22px;
  margin-bottom: 18px;
  box-shadow: var(--shadow);
}
.sec-head-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.notice { background: var(--amber-soft); border: 1px solid #FDE68A; border-radius: 10px; padding: 10px 14px; margin-bottom: 14px; color: var(--amber); font-size: 13px; font-weight: 500; }

/* Blank Slate Welcome Card */
.blank-slate-card {
  background: linear-gradient(135deg, #FFFFFF 0%, #F6F2E9 100%);
  border: 1px solid var(--border-strong);
}
.bs-inner { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.bs-icon { width: 48px; height: 48px; border-radius: 13px; flex: none; }
.bs-copy { flex: 1 1 260px; }
.bs-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* Visual Aging Strip (Who Owes You) */
.aging-strip-card { padding: 18px 20px; }
.aging-strip-head { margin-bottom: 12px; }
.aging-bar {
  display: flex;
  height: 10px;
  border-radius: 999px;
  overflow: hidden;
  background: var(--surface);
  margin-bottom: 14px;
  gap: 2px;
}
.ab-seg { height: 100%; transition: width 0.3s ease; }
.ab-current { background: #2563EB; }
.ab-d1 { background: #D97706; }
.ab-d8 { background: #EA580C; }
.ab-d15 { background: #7C2D12; }
.ab-d31 { background: #191918; }

.aging-pills {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}
.aging-pill {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 11px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.ap-top { display: flex; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 600; color: var(--ink-2); }
.ap-dot { width: 8px; height: 8px; border-radius: 999px; flex: none; }
.ap-dot.c-current { background: #2563EB; }
.ap-dot.c-d1 { background: #D97706; }
.ap-dot.c-d8 { background: #EA580C; }
.ap-dot.c-d15 { background: #7C2D12; }
.ap-dot.c-d31 { background: #191918; }
.ap-amt { font-family: 'JetBrains Mono', monospace; font-size: 14px; font-weight: 700; color: var(--ink); }
.ap-cnt { font-size: 11px; color: var(--ink-muted); }

/* Buttons */
.btn {
  font: inherit;
  font-weight: 600;
  font-size: 13px;
  color: var(--ink);
  background: var(--card);
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  padding: 8px 14px;
  min-height: 38px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  text-decoration: none;
  transition: all 0.15s ease;
}
.btn:hover { background: var(--surface); border-color: var(--ink-2); }
.btn.small { padding: 6px 12px; min-height: 34px; font-size: 12px; border-radius: 9px; }
.btn.tiny { padding: 5px 11px; min-height: 32px; font-size: 12px; border-radius: 8px; }
.btn.primary { background: var(--oxblood); border-color: var(--oxblood); color: #fff; }
.btn.primary:hover { background: var(--oxblood-hover); border-color: var(--oxblood-hover); }
.btn.dark { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn.dark:hover { background: #323230; }
.btn.good { background: var(--forest); border-color: var(--forest); color: #fff; }
.btn.good:hover { filter: brightness(1.08); }
.btn.outline-dark { background: var(--card); border-color: var(--ink); color: var(--ink); }
.btn.outline-dark:hover { background: var(--ink); color: #fff; }
.btn.outline { background: transparent; border-color: var(--border-strong); color: var(--ink-2); }
.btn.ghost-ink { background: transparent; border-color: transparent; color: var(--ink-muted); }
.btn.ghost-ink:hover { background: var(--surface); color: var(--ink); }
.btn.danger { background: var(--red); border-color: var(--red); color: #fff; }
.btn.danger-text { color: var(--red); border-color: #F4C2BF; background: var(--red-soft); }
.btn.danger-text:hover { background: var(--red); color: #fff; border-color: var(--red); }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 12px; }
.dlg-end-actions { justify-content: flex-end; }
.form-modal-actions { justify-content: space-between; margin-top: 16px; }
.form-modal-right { display: flex; gap: 8px; margin-left: auto; }
.paid-date-field { margin-top: 10px; }

/* Form inside Modal */
.grid-form { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.two-col-form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.msg-settings-grid { margin-bottom: 12px; }
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
label { font-size: 12px; font-weight: 600; color: var(--ink-2); }
input[type="text"], input[type="number"], input[type="date"], select, textarea {
  font: inherit;
  font-size: 13.5px;
  color: var(--ink);
  background: var(--bg);
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  padding: 9px 11px;
  min-height: 40px;
  width: 100%;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}
input:focus, select:focus, textarea:focus { background: #fff; border-color: var(--oxblood); outline: none; box-shadow: 0 0 0 3px rgba(124, 45, 18, 0.12); }
.money { display: flex; align-items: stretch; }
.money span {
  display: flex; align-items: center; padding: 0 11px;
  background: var(--surface); border: 1px solid var(--border-strong); border-right: 0;
  border-radius: 10px 0 0 10px; color: var(--ink-2); font-weight: 700;
}
.money input { border-radius: 0 10px 10px 0; }
.quick { display: flex; gap: 5px; align-items: center; flex-wrap: wrap; margin-top: 3px; }
.quick-label { font-size: 11px; color: var(--ink-muted); }
.chip-btn {
  border: 1px solid var(--border-strong);
  background: var(--card);
  color: var(--ink-2);
  font: inherit;
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 999px;
  cursor: pointer;
}
.chip-btn:hover { border-color: var(--oxblood); color: var(--oxblood); background: var(--oxblood-soft); }

.terms-strip {
  margin-top: 12px;
  padding: 10px 12px;
  background: var(--surface);
  border-radius: 10px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 12px;
}
.terms-out { font-weight: 700; color: var(--oxblood); white-space: nowrap; }
.sched-inline { color: var(--ink-2); }
.error { color: var(--red); font-weight: 600; font-size: 12.5px; margin: 8px 0 0; }

/* Stage Filter Pills */
.stage-pills {
  display: none;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 10px;
  margin-bottom: 10px;
  -webkit-overflow-scrolling: touch;
}
.stage-pill {
  flex: none;
  border: 1px solid var(--border-strong);
  background: var(--card);
  color: var(--ink-2);
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  padding: 8px 13px;
  border-radius: 999px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.stage-pill.active { background: var(--ink); color: #fff; border-color: var(--ink); }
.stage-pill .sp-cnt { font-size: 10.5px; padding: 1px 6px; border-radius: 999px; background: rgba(25, 25, 24, 0.08); }
.stage-pill.active .sp-cnt { background: rgba(255, 255, 255, 0.22); }

/* Kanban Board */
.kanban-board {
  display: grid;
  grid-template-columns: repeat(6, minmax(210px, 1fr));
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 8px;
}
.kanban-col {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 11px;
  min-height: 260px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: border-color 0.15s, background 0.15s;
}
.kanban-col.drag-over {
  background: var(--oxblood-soft);
  border: 2px dashed var(--oxblood);
}
.kanban-col-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
  padding: 2px 2px 8px;
  border-bottom: 1px solid var(--border);
}
.kanban-col-title { font-size: 12px; font-weight: 700; color: var(--ink); line-height: 1.25; }
.kanban-count {
  font-size: 11px;
  font-weight: 700;
  background: var(--card);
  color: var(--ink);
  border: 1px solid var(--border);
  padding: 1px 8px;
  border-radius: 999px;
  flex: none;
}
.kanban-cards { display: grid; gap: 10px; }
.kanban-empty {
  font-size: 12px;
  color: var(--ink-muted);
  text-align: center;
  padding: 24px 8px;
  border: 1px dashed var(--border-strong);
  border-radius: 11px;
}

.kanban-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 13px;
  padding: 13px;
  cursor: grab;
  box-shadow: 0 2px 6px rgba(25, 25, 24, 0.04);
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: transform 0.14s ease, box-shadow 0.14s ease;
}
.kanban-card:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(25, 25, 24, 0.08); }
.kanban-card:active { cursor: grabbing; }
.kanban-card.is-dragging { opacity: 0.45; }
.kanban-card.is-overdue { border-color: #F4C2BF; border-top: 3px solid var(--oxblood); }
.kanban-card.is-paid { border-color: #B7D9C0; border-top: 3px solid var(--forest); }

.kc-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.kc-identity { display: flex; align-items: center; gap: 8px; min-width: 0; flex-wrap: wrap; }
.kc-avatar {
  width: 28px;
  height: 28px;
  border-radius: 9px;
  background: var(--surface);
  color: var(--ink);
  font-size: 11px;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
}
.kanban-card.is-overdue .kc-avatar { background: var(--oxblood-soft); color: var(--oxblood); }
.kanban-card.is-paid .kc-avatar { background: var(--forest-soft); color: var(--forest); }
.kc-client { font-weight: 700; font-size: 13.5px; color: var(--ink); line-height: 1.25; }
.kc-sample-tag {
  font-size: 9.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink-muted);
  border: 1px solid var(--border);
}
.kc-del {
  border: 1px solid transparent;
  background: var(--bg);
  color: var(--ink-muted);
  border-radius: 8px;
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex: none;
  transition: all 0.14s ease;
}
.kc-del:hover { background: var(--red-soft); color: var(--red); border-color: #F4C2BF; }
.kc-amt { font-family: 'JetBrains Mono', monospace; font-weight: 700; font-size: 15px; color: var(--ink); margin-top: 2px; }
.kc-meta { font-size: 11.5px; color: var(--ink-muted); }
.kc-badges { display: flex; gap: 5px; flex-wrap: wrap; }
.kc-od-badge {
  display: inline-block; font-size: 10.5px; font-weight: 700; padding: 3px 9px; border-radius: 999px;
  background: var(--oxblood-soft); color: var(--oxblood); width: fit-content;
}
.kc-escalate-badge {
  display: inline-block; font-size: 10.5px; font-weight: 700; padding: 3px 9px; border-radius: 999px;
  background: var(--ink); color: #FAF8F4; width: fit-content;
}
.kc-paid-badge {
  display: inline-block; font-size: 10.5px; font-weight: 700; padding: 3px 9px; border-radius: 999px;
  background: var(--forest-soft); color: var(--forest); width: fit-content;
}
.kc-actions {
  display: flex; gap: 5px; flex-wrap: wrap; align-items: center;
  margin-top: 4px; padding-top: 9px; border-top: 1px solid var(--surface);
}
.kc-arrows { display: inline-flex; gap: 4px; margin-left: auto; }
.kc-arrow {
  border: 1px solid var(--border-strong); background: var(--bg); color: var(--ink); border-radius: 7px;
  font-size: 14px; font-weight: 700; min-width: 32px; min-height: 32px;
  display: inline-flex; align-items: center; justify-content: center; cursor: pointer;
}
.kc-arrow:hover:not(:disabled) { background: var(--ink); color: #fff; border-color: var(--ink); }
.kc-arrow:disabled { opacity: 0.28; cursor: not-allowed; }

/* Calendar — Full Month Grid (Zero Horizontal Scroll on Laptop & Mobile) */
.cal-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.cal-tools { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.cal-nav { display: flex; gap: 5px; align-items: center; flex-wrap: wrap; }
.cal-month { font-family: 'Newsreader', Georgia, serif; font-size: 20px; font-weight: 600; color: var(--ink); min-width: 112px; text-align: center; }

.legend { list-style: none; margin: 0 0 12px; padding: 0; display: flex; gap: 10px; flex-wrap: wrap; font-size: 12px; color: var(--ink-2); }
.chip { display: inline-block; padding: 2px 8px; border-radius: 6px; font-size: 11px; font-weight: 600; }
.chip.t-predue, .cal-ev.t-predue { background: var(--blue-soft); color: var(--blue); }
.chip.t-due, .cal-ev.t-due { background: var(--amber-soft); color: var(--amber); }
.chip.t-overdue, .cal-ev.t-overdue { background: var(--oxblood-soft); color: var(--oxblood); }
.chip.t-formal, .cal-ev.t-formal { background: var(--ink); color: #FAF8F4; }
.chip.done, .cal-ev.done { text-decoration: line-through; opacity: 0.45; }

.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 5px;
  width: 100%;
}
.cal-dow { font-size: 11px; font-weight: 700; text-transform: uppercase; color: var(--ink-muted); text-align: center; padding: 4px 0; }
.cal-cell {
  border: 1px solid var(--border);
  border-radius: 10px;
  min-height: 84px;
  padding: 6px;
  background: var(--card);
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  transition: border-color 0.14s, background 0.14s;
}
.cal-cell.has-evs { cursor: pointer; }
.cal-cell.has-evs:hover { border-color: var(--ink-2); }
.cal-cell.out { background: var(--bg); color: var(--ink-muted); opacity: 0.55; }
.cal-cell.today { border-color: var(--oxblood); box-shadow: inset 0 0 0 1px var(--oxblood); }
.cal-day { font-size: 12px; font-weight: 700; color: var(--ink); display: flex; justify-content: space-between; align-items: center; }
.cal-ev { width: 100%; border: 0; border-radius: 6px; padding: 3px 5px; font-size: 11px; font-weight: 600; text-align: left; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-family: inherit; }
.cal-dots { display: none; gap: 3px; flex-wrap: wrap; margin-top: 2px; }
.cal-dot { width: 7px; height: 7px; border-radius: 999px; display: inline-block; }
.cal-dot.t-predue { background: var(--blue); }
.cal-dot.t-due { background: #D97706; }
.cal-dot.t-overdue { background: var(--oxblood); }
.cal-dot.t-formal { background: var(--ink); }
.cal-dot.done { opacity: 0.35; }

.cds-list { display: grid; gap: 8px; }
.cds-item {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.cds-item-actions { display: flex; gap: 6px; }
.cds-meta { font-size: 12px; color: var(--ink-muted); }

/* Messages Tab & Format Switcher */
.tpl-top-controls { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.format-switch {
  display: inline-flex;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 3px;
  gap: 3px;
}
.fs-btn {
  border: 0;
  background: transparent;
  color: var(--ink-2);
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  padding: 6px 11px;
  border-radius: 7px;
  cursor: pointer;
}
.fs-btn.active {
  background: var(--ink);
  color: #fff;
}
.attrib-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  color: var(--ink-2);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 12px;
  margin-bottom: 14px;
  cursor: pointer;
}
.attrib-toggle input { width: 16px; height: 16px; accent-color: var(--oxblood); }

.tpl-grid { display: grid; gap: 14px; }
.tpl-card { border: 1px solid var(--border); border-radius: 13px; padding: 16px; background: var(--bg); }
.tpl-card-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.tpl-card-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.tpl-split { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.tpl-field-label { display: block; margin-bottom: 8px; }
.tpl-preview-caption { font-size: 12px; font-weight: 600; color: var(--ink-2); display: block; margin-bottom: 5px; }
.msg-preview-box { background: var(--card); border: 1px solid var(--border); border-radius: 11px; padding: 13px; }
.msg-preview-sub { font-size: 12.5px; font-weight: 700; color: var(--ink); margin-bottom: 6px; }
.msg-preview-body { white-space: pre-wrap; overflow-wrap: anywhere; word-break: break-word; font-family: inherit; font-size: 13px; color: var(--ink-2); margin: 0; }

/* TOA Subtle Footer CTA Card */
.toa-footer-card {
  margin-top: 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}
.toa-fc-left { display: flex; align-items: center; gap: 12px; flex: 1 1 320px; }
.toa-fc-logo { width: auto; max-width: 96px; height: 36px; border-radius: 8px; object-fit: contain; background: #FFFFFF; padding: 3px 6px; border: 1px solid var(--border); flex: none; }
.toa-fc-left strong { display: block; font-size: 13.5px; color: var(--ink); }
.toa-fc-left p { margin: 2px 0 0; font-size: 12.5px; color: var(--ink-2); }

/* Modals & Toast */
dialog.dlg {
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 0;
  max-width: 540px;
  width: calc(100% - 28px);
  box-shadow: var(--shadow-lg);
  background: var(--card);
}
dialog.dlg.wide { max-width: 620px; padding: 22px; }
dialog.dlg.wide-form { max-width: 640px; }
dialog.dlg::backdrop { background: rgba(25, 25, 24, 0.52); backdrop-filter: blur(4px); }
.dlg-head { background: var(--ink); color: #FAF8F4; padding: 16px 20px; display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.dlg-head .num { font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; color: #D6CFC2; font-weight: 700; }
.dlg-head h3 { color: #fff; font-size: 19px; margin-top: 2px; }
.dlg-close { background: transparent; border: 1px solid rgba(255, 255, 255, 0.28); color: #fff; border-radius: 8px; width: 32px; height: 32px; font-size: 18px; cursor: pointer; }
.dlg-body { padding: 20px; font-size: 14px; color: var(--ink-2); }
.dlg-foot { padding: 12px 20px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; background: var(--bg); }
.dlg-title { margin-bottom: 6px; }
#confirmDlg, #paidDlg { padding: 22px; }
.panel-top-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 8px; }
.panel-badges-row { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; margin: 10px 0; }
.msg-pre { background: var(--bg); border: 1px solid var(--border); border-radius: 11px; padding: 14px; white-space: pre-wrap; overflow-wrap: anywhere; word-break: break-word; font-family: inherit; font-size: 13.5px; line-height: 1.55; margin: 10px 0; color: var(--ink); }
.badge { display: inline-block; padding: 3px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 700; }
.badge.paid { background: var(--forest-soft); color: var(--forest); }
.badge.formal { background: var(--oxblood-soft); color: var(--oxblood); }
.install-steps { margin: 10px 0 0; padding-left: 20px; display: grid; gap: 8px; }

.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--ink);
  color: #FAF8F4;
  padding: 11px 16px;
  border-radius: 11px;
  font-size: 13px;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  z-index: 60;
}
.toast.show { opacity: 1; transform: translateY(0); }

/* =========================================================
   CRYSTAL-CLEAR INTERACTIVE HELP OVERLAY (ZERO BLUR)
   ========================================================= */
.help-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: transparent;
  cursor: pointer;
  animation: helpFadeIn 0.16s ease-out;
}
@keyframes helpFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
.help-svg {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 102;
}
.help-labels {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 103;
}
.help-callout-label {
  position: fixed;
  background: #191918;
  color: #FAF8F4;
  border: 1.5px solid #7C2D12;
  border-radius: 10px;
  padding: 6px 11px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: -0.01em;
  box-shadow: 0 8px 22px rgba(25, 25, 24, 0.25);
  max-width: 270px;
  line-height: 1.3;
  transform: translateY(-50%);
}
.help-callout-sub {
  display: block;
  font-size: 11px;
  font-weight: 400;
  color: #D6CFC2;
  margin-top: 2px;
}
.help-pin {
  position: fixed;
  width: 24px;
  height: 24px;
  border-radius: 999px;
  background: var(--oxblood);
  color: #fff;
  border: 2px solid #fff;
  font-size: 12px;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.45);
  transform: translate(-50%, -50%);
}
.help-mobile-card {
  position: fixed;
  left: 50%;
  top: 42%;
  transform: translate(-50%, -50%);
  width: min(360px, calc(100vw - 28px));
  max-height: 60vh;
  overflow-y: auto;
  background: rgba(22, 23, 28, 0.96);
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 16px;
  padding: 16px;
  color: #fff;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.55);
  pointer-events: auto;
}
.hmc-title { font-size: 14px; font-weight: 700; margin: 0 0 12px; color: #fff; }
.hmc-list { display: grid; gap: 10px; }
.hmc-row { display: flex; align-items: flex-start; gap: 10px; }
.hmc-num {
  width: 22px;
  height: 22px;
  border-radius: 999px;
  background: var(--oxblood);
  color: #fff;
  font-size: 11.5px;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  margin-top: 1px;
}
.hmc-row strong { display: block; font-size: 13px; color: #fff; line-height: 1.25; }
.hmc-row span { display: block; font-size: 11.5px; color: rgba(255, 255, 255, 0.72); margin-top: 1px; }

.help-step-dock {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 106;
  width: min(440px, calc(100vw - 28px));
  background: #191918;
  border: 2px solid #7C2D12;
  border-radius: 18px;
  padding: 16px 18px;
  color: #FAF8F4;
  box-shadow: 0 18px 46px rgba(25, 25, 24, 0.34);
  pointer-events: auto;
  cursor: default;
}
.help-step-dock.dock-top {
  top: 20px;
  bottom: auto;
}
.help-badge {
  background: var(--oxblood);
  color: #fff;
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 3px 9px;
  border-radius: 999px;
}
.hsd-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 8px; }
.hsd-mode-btns { display: flex; align-items: center; gap: 8px; }
.hsd-link {
  border: 1px solid rgba(255, 255, 255, 0.24);
  background: rgba(255, 255, 255, 0.08);
  color: #E5E7EB;
  font: inherit;
  font-size: 11.5px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 999px;
  cursor: pointer;
}
.hsd-link:hover { background: rgba(255, 255, 255, 0.18); color: #fff; }
.hsd-x {
  border: 0;
  background: transparent;
  color: rgba(255, 255, 255, 0.72);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  padding: 0 4px;
}
.hsd-x:hover { color: #fff; }
.hsd-title { color: #fff; font-size: 16px; font-weight: 700; margin: 0 0 4px; }
.hsd-desc { color: rgba(255, 255, 255, 0.8); font-size: 13px; margin: 0 0 14px; line-height: 1.45; }
.hsd-foot { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.hsd-btn {
  border: 1px solid rgba(255, 255, 255, 0.24);
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  font: inherit;
  font-size: 12.5px;
  font-weight: 700;
  padding: 7px 14px;
  border-radius: 10px;
  cursor: pointer;
}
.hsd-btn:hover:not(:disabled) { background: rgba(255, 255, 255, 0.18); }
.hsd-btn:disabled { opacity: 0.35; cursor: not-allowed; }
.hsd-btn.primary { background: var(--oxblood); border-color: var(--oxblood); }
.hsd-btn.primary:hover { background: var(--oxblood-hover); }
.hsd-dots { display: flex; gap: 6px; align-items: center; }
.hsd-dot { width: 7px; height: 7px; border-radius: 999px; background: rgba(255, 255, 255, 0.28); transition: all 0.15s; }
.hsd-dot.active { width: 18px; background: #fff; }

/* Mobile Bottom Nav */
.mobile-bottom-nav { display: none; }

/* =========================================================
   MOBILE VIEW MODE (Strict 100% Frame Fit, Zero Horizontal Overflow)
   ========================================================= */
html[data-view="mobile"] {
  background: #E8E3D9;
}
html[data-view="mobile"] body {
  max-width: 430px;
  width: 100%;
  margin: 0 auto;
  min-height: 100vh;
  padding-bottom: 88px;
  background: var(--bg);
  box-shadow: 0 0 0 1px var(--border-strong), 0 16px 48px rgba(25, 25, 24, 0.14);
  overflow-x: hidden;
}
html[data-view="mobile"] .wrap {
  max-width: 100%;
  width: 100%;
  padding: 0 14px;
}
html[data-view="mobile"] .header-inner {
  padding-top: 10px;
  padding-bottom: 10px;
  gap: 8px;
}
html[data-view="mobile"] .brand-group {
  width: 100%;
  justify-content: space-between;
}
html[data-view="mobile"] .brand-sub { display: none; }
html[data-view="mobile"] .header-controls {
  width: 100%;
  justify-content: space-between;
  gap: 6px;
}
html[data-view="mobile"] .install-group {
  width: 100%;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}
html[data-view="mobile"] .install-group .btn { width: 100%; min-height: 36px; padding: 6px 8px; font-size: 11.5px; }
html[data-view="mobile"] .action-bar { display: none; }
html[data-view="mobile"] .sample-bar { flex-direction: column; align-items: stretch; }
html[data-view="mobile"] .sample-bar-actions .btn { width: 100%; }
html[data-view="mobile"] .kpi-strip { grid-template-columns: 1fr 1fr; gap: 9px; }
html[data-view="mobile"] .kpi-card { padding: 13px 14px; min-width: 0; }
html[data-view="mobile"] .kpi-card:first-child { grid-column: 1 / -1; }
html[data-view="mobile"] .kpi-val { font-size: 20px; }
html[data-view="mobile"] .card { padding: 15px 14px; border-radius: 14px; overflow: hidden; }
html[data-view="mobile"] .priority-list { grid-template-columns: 1fr; }
html[data-view="mobile"] .priority-item { flex-direction: column; align-items: stretch; }
html[data-view="mobile"] .pi-actions { width: 100%; display: grid; grid-template-columns: 1fr auto; }
html[data-view="mobile"] .aging-pills { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
html[data-view="mobile"] .aging-pill { min-width: 0; }
html[data-view="mobile"] .two-col-form,
html[data-view="mobile"] .grid-form,
html[data-view="mobile"] .tpl-split { grid-template-columns: 1fr; }
html[data-view="mobile"] .format-switch { width: 100%; display: grid; grid-template-columns: 1fr 1fr; }
html[data-view="mobile"] .fs-btn { text-align: center; padding: 7px 6px; font-size: 11.5px; }
html[data-view="mobile"] .stage-pills { display: flex; max-width: 100%; }
html[data-view="mobile"] .kanban-board { grid-template-columns: 1fr; overflow-x: hidden; }
html[data-view="mobile"] .kanban-col { min-width: 0; max-width: 100%; }
html[data-view="mobile"] .kanban-card { min-width: 0; max-width: 100%; }
html[data-view="mobile"] .kanban-col[data-mobile-hidden="true"] { display: none; }
html[data-view="mobile"] .btn.tiny { min-height: 38px; padding: 7px 11px; font-size: 12px; }
html[data-view="mobile"] .kc-arrow { min-width: 36px; min-height: 36px; }
html[data-view="mobile"] .kc-del { width: 34px; height: 34px; }
html[data-view="mobile"] .cal-grid { gap: 3px; }
html[data-view="mobile"] .cal-cell { min-height: 48px; padding: 4px 2px; border-radius: 8px; align-items: center; }
html[data-view="mobile"] .cal-ev { display: none; }
html[data-view="mobile"] .cal-dots { display: flex; justify-content: center; }
html[data-view="mobile"] .cal-tools { width: 100%; justify-content: space-between; }
html[data-view="mobile"] .toa-footer-card { flex-direction: column; align-items: stretch; padding: 14px; }
html[data-view="mobile"] .toa-fc-left { flex: 1 1 auto; }
html[data-view="mobile"] .toa-footer-card .btn { width: 100%; }
html[data-view="mobile"] .toast {
  left: 50%;
  right: auto;
  transform: translateX(-50%);
  width: min(400px, calc(100vw - 28px));
  bottom: 88px;
  text-align: center;
}

/* Bottom-Sheet Modals on Mobile */
html[data-view="mobile"] dialog.dlg {
  margin: auto auto 0 auto;
  width: min(430px, 100vw);
  max-width: min(430px, 100vw);
  border-radius: 20px 20px 0 0;
  border-bottom: 0;
  max-height: 88vh;
  overflow-y: auto;
}

html[data-view="mobile"] .mobile-bottom-nav {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: min(430px, 100vw);
  z-index: 40;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(14px);
  border-top: 1px solid var(--border);
  padding: 6px 8px calc(8px + env(safe-area-inset-bottom));
  box-shadow: 0 -4px 18px rgba(25, 25, 24, 0.06);
}
.mb-item {
  border: 0;
  background: transparent;
  color: var(--ink-muted);
  font: inherit;
  font-size: 11px;
  font-weight: 600;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 4px 0;
  cursor: pointer;
}
.mb-item.active { color: var(--oxblood); }
.mb-add-circle {
  width: 38px;
  height: 38px;
  border-radius: 999px;
  background: var(--oxblood);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: -14px;
  box-shadow: 0 5px 14px rgba(124, 45, 18, 0.34);
}
.mb-item.mb-add { color: var(--oxblood); }

@media (max-width: 980px) {
  .aging-pills { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .tpl-split { grid-template-columns: 1fr; }
}
@media (max-width: 680px) {
  .grid-form, .two-col-form { grid-template-columns: 1fr; }
  .aging-pills { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
