:root {
  --navy: #0B1F3A;
  --navy-2: #132A4A;
  --navy-3: #1A3A63;
  --gold: #C9A227;
  --gold-2: #E0BC4A;
  --gold-dim: #8A6E12;
  --white: #FFFFFF;
  --page: #F4F6F8;
  --card: #FFFFFF;
  --line: #D9DEE6;
  --text: #0B1F3A;
  --muted: #5C6B7A;
  --paid: #1B7A4A;
  --out: #B45309;
  --billed: #6B7280;
  --danger: #9B1C1C;
  --shadow: 0 8px 24px rgba(11, 31, 58, 0.10);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--page); color: var(--text); }
body { font-family: "Segoe UI", "Helvetica Neue", system-ui, -apple-system, sans-serif; }
button, input, select, textarea { font: inherit; color: inherit; }
html, body, #app, .shell, .main, .table-wrap, table.data { cursor: default; pointer-events: auto; }
.tab, .name-btn, .primary, .ghost, .close, button, a, label.chk, input, select, textarea { cursor: pointer; pointer-events: auto; position: relative; z-index: 2; }
button { cursor: pointer; }
a { color: var(--navy); }

.banner {
  text-wrap: balance;

  background: var(--navy);
  color: var(--gold);
  text-align: center;
  font-size: 12px;
  letter-spacing: 0.08em;
  padding: 7px 12px;
  border-bottom: 2px solid var(--gold);
  font-weight: 600;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 22px 0;
  background: var(--navy);
  color: var(--white);
  border-bottom: 2px solid var(--gold);
}
.brand { display: flex; gap: 12px; align-items: baseline; padding-bottom: 12px; }
.brand h1 { margin: 0; font-size: 20px; letter-spacing: 0.12em; font-weight: 700; color: var(--white); }
.brand h1 .w, .login-card h2 .w { color: #FFFFFF !important; }
.brand h1 .y, .login-card h2 .y { color: #C9A227 !important; }
.brand .sub { color: #C5D0DC; font-size: 12px; }
.topbar .meta { color: #C5D0DC; font-size: 12px; display: flex; gap: 16px; align-items: center; padding-bottom: 12px; }
.tabs {
  display: flex;
  gap: 6px;
  align-self: flex-end;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  max-width: 100%;
}
.tab {
  background: #132A4A;
  border: 1px solid #3A5270;
  border-bottom: 3px solid transparent;
  color: #FFFFFF;
  padding: 12px 22px 14px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-size: 13px;
  border-radius: 6px 6px 0 0;
}
.tab:hover { color: var(--gold); border-color: var(--gold); }
.tab.active { color: var(--navy); background: var(--gold); border-color: var(--gold); }
.board-box {
  border: 1px solid var(--line);
  border-top: 3px solid var(--gold);
  background: var(--white);
  box-shadow: var(--shadow);
}
th[data-col], th.th-sortable { cursor: pointer; user-select: none; position: relative; }
th[data-col].dragging { opacity: 0.45; }
.th-label { cursor: pointer; }
.col-grip {
  display: inline-block;
  margin-right: 4px;
  color: var(--gold);
  font-size: 10px;
  letter-spacing: -1px;
  cursor: grab;
  vertical-align: middle;
  opacity: 0.85;
}
.col-grip:active { cursor: grabbing; }
.col-resizer {
  position: absolute;
  top: 0;
  right: 0;
  width: 6px;
  height: 100%;
  cursor: col-resize;
  z-index: 4;
}
.col-resizer:hover { background: rgba(201, 162, 39, 0.45); }
table.data th.th-sortable { white-space: nowrap; overflow: hidden; }

.ghost {
  background: transparent;
  border: 1px solid #3A5270;
  border-radius: 6px;
  padding: 6px 10px;
  color: var(--white);
}
.ghost:hover { border-color: var(--gold); color: var(--gold); }

.login-wrap {
  min-height: calc(100vh - 34px);
  display: grid;
  place-items: center;
  background: var(--navy);
}
.login-card {
  width: 400px;
  background: var(--white);
  border: 1px solid var(--gold);
  border-radius: 4px;
  padding: 32px;
  box-shadow: var(--shadow);
}
.login-card h2 { margin: 0 0 6px; font-size: 22px; color: var(--navy); letter-spacing: 0.08em; }
.login-card p { margin: 0 0 22px; color: var(--muted); font-size: 13px; }
.login-card .login-tagline {
  margin: 0 0 18px;
  color: var(--navy);
  font-size: 14px;
  font-weight: 650;
  letter-spacing: 0.02em;
  text-align: center;
  line-height: 1.35;
  text-wrap: balance;
}
.login-card .rule { height: 2px; background: var(--gold); width: 56px; margin: 8px 0 16px; }
label { display: block; font-size: 12px; color: var(--muted); margin: 12px 0 6px; font-weight: 600; letter-spacing: 0.03em; }
input, select, textarea {
  width: 100%;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 9px 10px;
  outline: none;
  color: var(--text);
}
input:focus, select:focus, textarea:focus { border-color: var(--gold); }
.primary {
  margin-top: 18px;
  background: var(--gold);
  color: var(--navy);
  border: 0;
  border-radius: 4px;
  padding: 10px 14px;
  font-weight: 700;
  letter-spacing: 0.04em;
}
.primary:hover { background: var(--gold-2); }
.primary.block { width: 100%; }
.err { color: var(--danger); font-size: 13px; min-height: 18px; margin-top: 8px; }

.shell { min-height: calc(100vh - 118px); max-width: 100%; overflow-x: hidden; }
.main { overflow-x: hidden; overflow-y: auto; padding: 18px 22px 40px; max-width: 100%; }
.empty { color: var(--muted); padding: 48px 12px; text-align: center; }

.toolbar {
  display: flex;
  gap: 12px;
  align-items: flex-end;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.toolbar .search { min-width: 240px; flex: 1; }
.toolbar .search input { background: var(--white); }
.search-wrap { position: relative; }
.search-wrap input { width: 100%; padding-right: 32px; }
.search-clear {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  width: 24px;
  height: 24px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
}
.search-clear:hover { background: #EEF1F4; color: var(--navy); }
.search-clear[hidden] { display: none; }
.hint { color: var(--muted); font-size: 12px; margin-left: auto; }

.table-wrap {
  display: block;
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-x pan-y;
  overscroll-behavior: contain;
  background: var(--white);
  border: 1px solid var(--line);
  border-top: 2px solid var(--gold);
  border-radius: 4px;
  box-shadow: var(--shadow);
  max-height: calc(100vh - 168px);
}
table.data {
  width: max-content;
  min-width: max(100%, 960px);
  table-layout: auto;
  border-collapse: collapse;
  font-size: 11px;
}
table.data th, table.data td {
  padding: 4px 8px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  white-space: nowrap;
  vertical-align: top;
}
table.data th:not(.col-num),
table.data td:not(.col-num) {
  min-width: 96px;
}
table.data th {
  background: var(--navy);
  color: var(--white);
  font-weight: 650;
  font-size: 10px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  position: sticky;
  top: 0;
  z-index: 2;
  border-bottom: 2px solid var(--gold);
}
table.data td.wrap { white-space: normal; max-width: 220px; }
table.data tbody tr:hover { background: #F7F4EA; }
table.data th:first-child, table.data td:first-child {
  position: sticky;
  left: 0;
  z-index: 1;
  background: var(--white);
  min-width: 160px;
}
table.data th:first-child { background: var(--navy); z-index: 3; }
table.data tbody tr:hover td:first-child { background: #F7F4EA; }
.name-btn {
  background: none;
  border: 0;
  padding: 0;
  color: var(--navy);
  font-weight: 700;
  text-decoration: underline;
  text-decoration-color: var(--gold);
  text-underline-offset: 3px;
}
.name-btn:hover { color: var(--gold-dim); }

.chip {
  display: inline-block;
  font-size: 11px;
  border: 1px solid var(--line);
  background: var(--page);
  border-radius: 999px;
  padding: 2px 8px;
  color: var(--muted);
}
.chip.on { color: var(--navy); border-color: var(--gold); background: #F7F1DC; font-weight: 650; }

.patient-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 16px;
}
.patient-head h2 { margin: 0; font-size: 24px; color: var(--navy); }
.muted { color: var(--muted); font-size: 13px; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }

.grid-2 {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 16px;
  align-items: start;
}
.panel {
  background: var(--white);
  border: 1px solid var(--line);
  border-top: 2px solid var(--gold);
  border-radius: 4px;
  padding: 14px;
}
.panel h3 {
  margin: 0 0 12px;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--navy);
  font-weight: 700;
  border-bottom: 1px solid var(--gold);
  padding-bottom: 6px;
}

.params { display: flex; flex-direction: column; gap: 8px; }
.param {
  background: var(--page);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 5px 8px;
  display: grid;
  grid-template-columns: 14px 1fr;
  gap: 6px;
  align-items: start;
  cursor: pointer;
}
.param:active { cursor: grabbing; }
.param.dragging { opacity: 0.45; }
.handle { color: var(--muted); letter-spacing: -1px; padding-top: 2px; user-select: none; }
.param .k { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; font-weight: 650; }
.param .v { margin-top: 2px; font-size: 12px; }
.param .v small { color: var(--muted); display: block; margin-top: 2px; }

.map-layout {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 16px;
  align-items: start;
}
.map-box {
  height: calc(100vh - 220px);
  min-height: 420px;
  border-radius: 4px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-top: 2px solid var(--gold);
  background: #E8EEF4;
}
.offices { margin-top: 12px; display: flex; flex-direction: column; gap: 6px; }
.office {
  display: grid;
  grid-template-columns: 28px 1fr;
  gap: 8px;
  align-items: center;
  padding: 8px;
  border-radius: 4px;
  border: 1px solid var(--line);
  background: var(--white);
}
.office.fav { border-color: var(--gold); background: #FBF6E6; }
.star {
  background: transparent;
  border: 0;
  font-size: 16px;
  color: var(--muted);
  padding: 0;
}
.office.fav .star { color: var(--gold); }
.office .nm { font-size: 13px; font-weight: 650; }
.office .ad { font-size: 11px; color: var(--muted); }
.hide-row { margin-top: 10px; display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; }
.hide-row input { width: auto; }
.filters { display: flex; flex-direction: column; gap: 6px; margin: 10px 0; }
.filters label { margin: 0; display: flex; align-items: center; gap: 8px; font-weight: 500; color: var(--text); }
.filters input { width: auto; }
.poi-type { font-size: 10px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--gold-dim); font-weight: 700; }

.detail {
  position: fixed;
  inset: 0;
  background: rgba(11, 31, 58, 0.55);
  display: grid;
  place-items: center;
  z-index: 20;
  padding: 24px;
}
.detail-card {
  width: min(980px, 100%);
  max-height: calc(100vh - 48px);
  overflow: auto;
  background: var(--white);
  border: 1px solid var(--line);
  border-top: 3px solid var(--gold);
  border-radius: 4px;
  padding: 22px;
  box-shadow: var(--shadow);
}
.detail-card h2 { margin: 0 0 4px; color: var(--navy); }
.costs { width: 100%; border-collapse: collapse; margin-top: 8px; font-size: 13px; }
.costs th, .costs td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: right; }
.costs th:first-child, .costs td:first-child { text-align: left; }
.costs th {
  color: var(--navy);
  font-weight: 700;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 2px solid var(--gold);
}
.costs .billed { color: var(--billed); }
.costs .paid { color: var(--paid); font-weight: 650; }
.costs .out { color: var(--out); font-weight: 650; }
.note {
  margin-top: 12px;
  font-size: 12px;
  color: var(--muted);
  border-top: 1px solid var(--line);
  padding-top: 12px;
}
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 12px; }
.row3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; margin-top: 12px; }
.detail-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}
.detail-head h2 { margin: 0 0 4px; }
.detail-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.close {
  float: none;
  background: var(--navy);
  color: var(--white);
  border: 0;
  border-radius: 4px;
  padding: 6px 12px;
  font-weight: 650;
}
.close:hover { background: var(--navy-3); }
.detail-actions .primary { padding: 6px 12px; }

.counts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
  margin: 12px 0 16px;
}
.count-card {
  background: var(--white);
  border: 1px solid var(--line);
  border-top: 2px solid var(--gold);
  border-radius: 4px;
  padding: 12px;
}
.count-card .n { font-size: 26px; font-weight: 750; color: var(--navy); }
.count-card .l { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; font-weight: 650; }
.filter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px 12px;
  background: var(--white);
  border: 1px solid var(--line);
  border-top: 2px solid var(--gold);
  border-radius: 4px;
  padding: 14px;
  margin-bottom: 14px;
}
.filter-actions { display: flex; gap: 8px; align-items: flex-end; }
.filter-actions .primary, .filter-actions .ghost-dark { margin-top: 0; }
.ghost-dark {
  background: transparent;
  border: 1px solid var(--navy);
  color: var(--navy);
  border-radius: 4px;
  padding: 10px 14px;
  font-weight: 650;
}
.breakdown { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 16px; }
.kv { display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.kv span:last-child { font-weight: 700; color: var(--navy); }

textarea.notes {
  min-height: 90px;
  resize: vertical;
}
.section-title {
  margin: 18px 0 8px;
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--navy);
  font-weight: 700;
  border-bottom: 1px solid var(--gold);
  padding-bottom: 6px;
}
.map-status { font-size: 12px; color: var(--muted); margin: 8px 0; min-height: 16px; }
.tiny { font-size: 11px; color: var(--muted); }

@media (max-width: 960px) {
  .map-layout, .grid-2, .breakdown { grid-template-columns: 1fr; }
  .topbar { flex-wrap: wrap; }
  .tabs { width: 100%; }
}

.login-card h2 span, .brand h1 .w, .login-card h2 .w { color: #FFFFFF !important; }
.brand h1 .y, .login-card h2 .y { color: #C9A227 !important; }
.cols-panel {
  background: var(--white);
  border: 1px solid var(--line);
  border-top: 2px solid var(--gold);
  padding: 10px 12px;
  margin-bottom: 10px;
  font-size: 12px;
}
.cols-panel-head { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: baseline; margin-bottom: 8px; }
.cols-panel-head strong { color: var(--navy); letter-spacing: 0.04em; text-transform: uppercase; font-size: 11px; }
.add-col-form {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: flex-end;
  padding: 8px 10px;
  margin-bottom: 10px;
  background: #F7F4EA;
  border: 1px solid var(--gold);
  border-radius: 4px;
}
.add-col-form .primary { margin-top: 0; padding: 8px 14px; }
.add-col-main { flex: 1; min-width: 180px; }
.add-col-main input { width: 100%; }
.add-col-show { margin: 0 0 4px !important; white-space: nowrap; }
.cols-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 4px 12px;
  margin: 4px 0 0;
}
.cols-panel .grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 4px 12px;
  margin: 8px 0;
}
.cols-panel label.chk { display: flex; gap: 6px; align-items: center; font-weight: 500; margin: 0; color: var(--text); font-size: 12px; }
.cols-panel label.chk input { width: auto; }
.cols-panel .col-row {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 4px 6px;
  border-radius: 3px;
}
.cols-panel .col-row:hover { background: var(--page); }
.cols-panel label.col-row { padding: 4px 6px; border-radius: 3px; }
.cols-panel label.col-row:hover { background: var(--page); }
.cols-panel .col-row-check { margin: 0 !important; flex: 0 0 auto; white-space: nowrap; }
.cols-panel .col-row-label { flex: 1; font-weight: 650; color: var(--navy); }
.cols-panel .col-row-name {
  flex: 1;
  min-width: 0;
  margin: 0 !important;
  padding: 4px 8px !important;
  font-weight: 650;
  color: var(--navy);
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 3px;
}
.cols-panel .col-row-name:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 2px rgba(201, 162, 39, 0.2);
}
.add-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: flex-end; }
.add-row input, .add-row select { width: auto; min-width: 140px; padding: 6px 8px; font-size: 12px; }
.staff-layout {
  display: grid;
  grid-template-columns: 1.35fr 1fr;
  gap: 14px;
  align-items: start;
}
.activity-box { padding: 0; overflow: hidden; }
.activity-head {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  align-items: baseline;
  padding: 10px 12px;
  background: var(--navy);
  color: var(--white);
}
.activity-head strong { color: var(--gold); letter-spacing: 0.05em; text-transform: uppercase; font-size: 11px; }
.activity-head .muted { color: #C5D0DC; }
.activity-scroll {
  max-height: 360px;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}
.activity-table { font-size: 11px; }

.col-num { width: 48px; text-align: center; color: var(--muted); }
.activity-filter-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  flex-wrap: wrap;
}
.activity-filter-row label {
  font-size: 11px;
  color: #C5D0DC;
  margin: 0;
}
.activity-filter-row select {
  min-width: 160px;
  padding: 4px 8px;
  font-size: 12px;
  border-radius: 3px;
  border: 1px solid rgba(255,255,255,0.25);
  background: rgba(255,255,255,0.12);
  color: var(--white);
}

@media (max-width: 960px) {
  .staff-layout { grid-template-columns: 1fr; }
}
.params {
  display: grid !important;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 6px !important;
}
.detail-card { font-size: 12px; }
.detail-card input,
.detail-card select,
.detail-card textarea {
  width: 100%;
  box-sizing: border-box;
  background: #F7F9FC;
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: 6px 8px;
  font-size: 12px;
}
.detail-card input:focus,
.detail-card select:focus,
.detail-card textarea:focus {
  outline: none;
  border-color: var(--gold);
  background: #fff;
}
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 12px;
  margin-top: 8px;
}
.form-grid .span2 { grid-column: 1 / -1; }
.form-grid label { margin: 0 0 4px; font-size: 11px; }
.form-grid .chk-row {
  display: flex;
  align-items: flex-end;
  padding-bottom: 4px;
}
.form-grid label.chk {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  color: var(--text);
  font-weight: 600;
  cursor: pointer;
}
.form-grid label.chk input { width: auto; }

.treatment-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
}
.treatment-row {
  display: grid;
  grid-template-columns: minmax(160px, 1fr) minmax(140px, 180px);
  gap: 10px 16px;
  align-items: end;
  padding: 6px 0;
  border-bottom: 1px solid var(--line);
}
.treatment-row:last-child { border-bottom: none; }
.treatment-row label.chk {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  color: var(--text);
  font-weight: 600;
  cursor: pointer;
}
.treatment-row label.chk input { width: auto; }
.treatment-date label { margin: 0 0 4px; font-size: 11px; display: block; }
.treatment-date input { width: 100%; }
.filter-actions { flex-wrap: wrap; }
.costs .cost-inp {
  width: 100%;
  max-width: 110px;
  text-align: right;
  padding: 4px 6px !important;
  font-size: 11px;
  margin-left: auto;
  display: block;
}
.save-bar {
  position: sticky;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 16px;
  padding: 12px 0 4px;
  background: linear-gradient(to top, #fff 70%, rgba(255,255,255,0.85));
  border-top: 1px solid var(--line);
  z-index: 3;
}
.save-msg { font-size: 12px; font-weight: 650; margin-right: auto; }
.save-msg.ok { color: var(--paid, #1B7A4A); }
.save-msg.err { color: #9B1C1C; }
@media (max-width: 700px) {
  .form-grid { grid-template-columns: 1fr; }
}

.costs th, .costs td { padding: 4px 6px !important; font-size: 11px; }
.section-title { font-size: 11px !important; margin: 10px 0 6px !important; }
.notes { min-height: 56px !important; font-size: 12px; }
@media (max-width: 700px) {
  .topbar { flex-wrap: wrap; }
  .tabs { width: 100%; }
  .tab { min-height: 44px; }
  .meta span { display: none; }
  .main { padding: 10px; }
  .table-wrap { max-height: calc(100vh - 210px); }
}

.row-revoked td { color: var(--muted); opacity: 0.85; }
.danger-btn { color: #9B1C1C !important; border-color: #E5B4B4 !important; }
.danger-btn:hover { background: #FDF2F2 !important; }

.patient-search { position: relative; }
.patient-hits {
  position: absolute;
  z-index: 20;
  left: 0; right: 0;
  top: calc(100% + 2px);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 4px;
  box-shadow: var(--shadow);
  max-height: 220px;
  overflow: auto;
}
.patient-hits.hidden { display: none; }
.patient-hit {
  display: block;
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
}
.patient-hit:hover { background: #F4F6F8; }
.patient-hit strong { display: block; color: var(--navy); font-size: 12px; }
.patient-hit small { color: var(--muted); font-size: 11px; }

.chart-section { margin: 0; }
.chart-section.dragging { opacity: 0.45; }
.chart-section .section-title {
  display: flex;
  align-items: center;
  gap: 8px;
}
.section-drag {
  display: inline-block;
  color: var(--gold);
  font-size: 11px;
  letter-spacing: -1px;
  cursor: grab;
  user-select: none;
  opacity: 0.9;
  flex-shrink: 0;
  line-height: 1;
}
.section-drag:active { cursor: grabbing; }
.add-category-form {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 10px;
  align-items: flex-end;
  padding: 8px 10px;
  margin: 8px 0 12px;
  background: #F7F4EA;
  border: 1px solid var(--gold);
  border-radius: 4px;
}
.add-category-form input { min-width: 180px; flex: 1; }
.add-category-form .primary { margin-top: 0; padding: 8px 14px; }
.add-col-section { min-width: 160px; }
.add-col-section select { width: 100%; }
.chart-section-empty { font-size: 12px; color: var(--muted); padding: 4px 0 8px; }
.field-cell { position: relative; min-width: 0; }
.field-cell.field-dragging { opacity: 0.4; }
.field-move {
  display: flex;
  align-items: center;
  margin: 0 0 2px;
}
.field-drag {
  display: inline-block;
  color: var(--gold);
  font-size: 10px;
  letter-spacing: -1px;
  cursor: grab;
  user-select: none;
  line-height: 1;
  flex-shrink: 0;
}
.field-drag:active { cursor: grabbing; }
.form-grid .field-cell.chk-row {
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-end;
}
.chart-section.field-drop-target {
  outline: 2px dashed var(--gold);
  outline-offset: 3px;
  background: #F7F4EA;
}

.cols-admin-note { font-size: 12px; color: var(--muted); margin: 0 0 10px; }

.demo-sms { background: var(--page); border: 1px dashed var(--gold); padding: 8px 10px; border-radius: 4px; font-size: 13px; margin: 10px 0 0; color: var(--navy); }
.phone-cell { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.phone-cell .phone-edit { margin-top: 0; padding: 3px 8px; font-size: 11px; }

.delete-patient-row {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--border, #E5E7EB);
  display: flex;
  justify-content: flex-start;
}

.import-overlay {
  position: fixed;
  inset: 0;
  background: rgba(11, 31, 51, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 80;
  padding: 16px;
}
.import-card {
  background: var(--white, #fff);
  border-radius: 12px;
  width: min(520px, 100%);
  padding: 16px 18px 18px;
  box-shadow: 0 12px 40px rgba(0,0,0,.18);
  border: 1px solid var(--line, #E5E7EB);
}
.import-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}
.import-note { margin: 0 0 12px; font-size: 13px; line-height: 1.35; }
.import-drop {
  border: 2px dashed var(--line, #C9A227);
  border-radius: 10px;
  padding: 28px 16px;
  text-align: center;
  background: #FBF8EF;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  cursor: pointer;
}
.import-drop.dragover {
  background: #F5EED6;
  border-color: var(--navy, #0B1F33);
}
.import-drop-title { font-weight: 600; color: var(--navy, #0B1F33); }
.import-err {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 8px;
  background: #FDF2F2;
  color: #9B1C1C;
  border: 1px solid #E5B4B4;
  font-size: 13px;
}
.import-foot { margin-top: 12px; font-size: 12px; }

.staff-toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; }
.staff-toolbar .hint { flex: 1; min-width: 200px; }


.wipe-overlay {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: rgba(11, 31, 58, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.wipe-card {
  width: min(520px, 100%);
  background: var(--white);
  border: 1px solid var(--line);
  border-top: 3px solid #9B1C1C;
  border-radius: 6px;
  box-shadow: var(--shadow);
  padding: 18px 18px 16px;
}
.wipe-card h3 { margin: 0 0 8px; color: #9B1C1C; }
.wipe-card p { margin: 0 0 10px; color: var(--text); font-size: 13px; line-height: 1.4; }
.wipe-phrase {
  margin: 0 0 12px;
  padding: 10px 12px;
  background: #FDF2F2;
  border: 1px dashed #E5B4B4;
  border-radius: 4px;
  color: var(--navy);
  font-size: 13px;
  font-weight: 700;
  white-space: pre-wrap;
  word-break: break-word;
}
.wipe-card input {
  width: 100%;
  margin-bottom: 14px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
.wipe-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  flex-wrap: wrap;
}
.wipe-actions .danger-btn {
  background: #9B1C1C;
  color: #fff !important;
  border-color: #9B1C1C !important;
}
.wipe-actions .danger-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.report-active-filters {
  margin: 10px 0 8px;
  padding: 8px 10px;
  background: #F4F6F8;
  border: 1px solid var(--line);
  border-left: 3px solid var(--gold);
  border-radius: 4px;
  font-size: 12px;
  color: var(--navy);
}

.ask-box { flex: 1 1 280px; min-width: 220px; max-width: 520px; }
.ask-box label { display:block; font-size:11px; font-weight:700; color:var(--muted); margin-bottom:4px; text-transform:uppercase; letter-spacing:.03em; }
.ask-wrap { display:flex; gap:8px; align-items:center; }
.ask-wrap input { flex:1; min-width:0; }
.ask-card {
  margin: 0 0 12px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--white);
  box-shadow: 0 1px 2px rgba(0,0,0,.04);
}
.ask-card.ask-error { color: #8b1a1a; border-color: #e2b4b4; background: #fff6f6; }
.ask-msg { font-size: 13px; color: var(--muted); margin-bottom: 8px; }
.ask-chips { display:flex; flex-wrap:wrap; gap:8px; margin-bottom:8px; }
.ask-chip {
  border: 1px solid var(--line);
  background: #f7f8fb;
  border-radius: 999px;
  padding: 6px 10px;
  cursor: pointer;
  font-size: 12px;
  color: var(--navy);
}
.ask-chip small { color: var(--muted); margin-left: 4px; }
.ask-answer { display:flex; gap:12px; align-items:flex-start; justify-content:space-between; padding:8px 0; border-top:1px solid var(--line); }
.ask-answer:first-of-type { border-top:0; padding-top:0; }
.ask-summary { font-size: 13px; line-height: 1.45; color: var(--navy); flex:1; }
.ask-open { flex-shrink:0; margin-top:0 !important; }
@media (max-width: 720px) {
  .ask-answer { flex-direction: column; }
}

.ask-engine{font-size:11px;color:var(--muted);margin-bottom:6px;font-weight:600;}

.chart-layout-tools{display:flex;flex-wrap:wrap;gap:12px;align-items:flex-end;margin:12px 0 8px;}
.chart-section-accent,.chart-subsection{margin-left:14px;border-left:3px solid var(--gold);padding-left:10px;}
.section-title-text{cursor:default;}
.section-title-edit,
.section-title-edit .section-title-text{cursor:pointer;}
.section-rename-input{flex:1;min-width:120px;height:28px;padding:2px 8px;font-size:14px;font-weight:700;}

.cf-label{cursor:default;display:inline-block;}
.cf-label-text{font-weight:600;}
.field-label-edit{cursor:pointer;}
.field-label-text{font-weight:600;}

.img-portal-cell { min-width: 180px; }
.img-portal-link {
  display: inline-block;
  margin-bottom: 4px;
  font-weight: 650;
  color: var(--navy);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.img-portal-link:hover { color: var(--gold-dim); }
