/* Customer Workspace — directory + detail shell (TTBP tokens) */
.ttbp-cw-overlay {
  position: fixed;
  inset: 0;
  z-index: 100050;
  background: rgba(15, 23, 42, 0.55);
  display: flex;
  align-items: stretch;
  justify-content: center;
  padding: 12px;
  box-sizing: border-box;
}
.ttbp-cw-shell {
  width: min(1280px, 100%);
  max-height: 100%;
  background: var(--ttbp-app-bg, #0b1220);
  border: 1px solid var(--ttbp-navy-light, #1e293b);
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 20px 50px rgba(0,0,0,.45);
  /* Text colors (2026-10-02 contrast pass): every text rule below reads these, so the light
     shell only has to swap the variables. JS inline styles use them too (var(--cw-fg,...)). */
  --cw-fg: #e5e7eb;
  --cw-fg-strong: #f1f5f9;
  --cw-fg-dim: #cbd5e1;
  --cw-good: #6ee7b7;
  --cw-bad: #fca5a5;
  --cw-warn: #fde68a;
}
.ttbp-cw-hdr {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: var(--ttbp-navy, #0f1c2e);
  border-bottom: 1px solid var(--ttbp-navy-light, #1e293b);
  flex-shrink: 0;
}
.ttbp-cw-hdr h3 {
  margin: 0;
  color: var(--cw-fg);
  font-size: 16px;
  font-weight: 700;
  flex: 1;
}
.ttbp-cw-hdr .bk-close {
  background: transparent;
  border: none;
  color: var(--cw-fg-dim);
  font-size: 20px;
  cursor: pointer;
  line-height: 1;
}
.ttbp-cw-body {
  flex: 1;
  min-height: 0;
  display: flex;
  overflow: hidden;
}
.ttbp-cw-dir {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 12px;
  gap: 10px;
}
.ttbp-cw-toolbar {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-shrink: 0;
}
.ttbp-cw-toolbar input[type="search"] {
  flex: 1;
  background: var(--ttbp-navy, #0f1c2e);
  border: 1px solid var(--ttbp-navy-light, #1e293b);
  color: var(--cw-fg);
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 14px;
}
.ttbp-cw-btn {
  background: var(--ttbp-navy-light, #1e3a5f);
  color: #fff;
  border: none;
  padding: 8px 14px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}
.ttbp-cw-btn.primary { background: #166534; } /* was --ttbp-primary #4f8c6d: white text only 3.96:1 */
.ttbp-cw-btn.ghost { background: transparent; border: 1px solid var(--ttbp-navy-light, #1e293b); color: var(--cw-fg-dim); }
.ttbp-cw-table-wrap {
  flex: 1;
  overflow: auto;
  border: 1px solid var(--ttbp-navy-light, #1e293b);
  border-radius: 8px;
}
.ttbp-cw-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.ttbp-cw-table th {
  position: sticky;
  top: 0;
  background: #111827;
  color: var(--cw-fg-dim);
  text-align: left;
  padding: 8px 10px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .04em;
  border-bottom: 1px solid var(--ttbp-navy-light, #1e293b);
}
.ttbp-cw-table td {
  padding: 9px 10px;
  color: var(--cw-fg);
  border-bottom: 1px solid #152033;
  vertical-align: middle;
}
.ttbp-cw-table tr:hover td { background: rgba(58,124,165,.12); cursor: pointer; }
.ttbp-cw-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 999px;
}
.ttbp-cw-status.green { background: rgba(34,197,94,.15); color: var(--cw-good); }
.ttbp-cw-status.yellow { background: rgba(234,179,8,.18); color: var(--cw-warn); }
.ttbp-cw-status.red { background: rgba(239,68,68,.18); color: var(--cw-bad); }
.ttbp-cw-class-pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
}
.ttbp-cw-empty { color: var(--cw-fg-dim); text-align: center; padding: 28px; }

/* Workspace detail */
.ttbp-cw-workspace {
  display: flex;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}
.ttbp-cw-nav {
  width: 180px;
  flex-shrink: 0;
  background: #0d1524;
  border-right: 1px solid var(--ttbp-navy-light, #1e293b);
  padding: 10px 0;
  overflow-y: auto;
}
.ttbp-cw-nav button {
  display: block;
  width: 100%;
  text-align: left;
  background: transparent;
  border: none;
  color: var(--cw-fg-dim);
  padding: 9px 14px;
  font-size: 13px;
  cursor: pointer;
}
.ttbp-cw-nav button:hover { color: var(--cw-fg); background: rgba(255,255,255,.04); }
.ttbp-cw-nav button.active {
  color: #fff;
  background: rgba(58,124,165,.2);
  border-left: 3px solid var(--ttbp-primary, #3a7ca5);
}
.ttbp-cw-main {
  flex: 1;
  min-width: 0;
  overflow-y: auto;
  padding: 14px 16px;
}
.ttbp-cw-overview {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 14px;
}
.ttbp-cw-card {
  background: #111827;
  border: 1px solid var(--ttbp-navy-light, #1e293b);
  border-radius: 8px;
  padding: 12px;
}
.ttbp-cw-card h4 {
  margin: 0 0 8px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--cw-fg-dim);
}
.ttbp-cw-name { font-size: 18px; font-weight: 700; color: var(--cw-fg-strong); margin: 0 0 4px; }
.ttbp-cw-meta { font-size: 13px; color: var(--cw-fg-dim); }
.ttbp-cw-field {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin-bottom: 8px;
}
.ttbp-cw-field label {
  font-size: 11px;
  text-transform: uppercase;
  color: var(--cw-fg-dim);
  letter-spacing: .04em;
}
.ttbp-cw-field input,
.ttbp-cw-field select,
.ttbp-cw-field textarea {
  background: var(--ttbp-navy, #0f1c2e);
  border: 1px solid var(--ttbp-navy-light, #1e293b);
  color: var(--cw-fg);
  padding: 7px 9px;
  border-radius: 5px;
  font-size: 13px;
}
.ttbp-cw-grid2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.ttbp-cw-timeline { list-style: none; margin: 0; padding: 0; }
.ttbp-cw-timeline li {
  border-left: 2px solid var(--ttbp-navy-light, #1e293b);
  padding: 0 0 14px 12px;
  position: relative;
}
.ttbp-cw-timeline li::before {
  content: "";
  position: absolute;
  left: -5px;
  top: 4px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--ttbp-primary, #3a7ca5);
}
.ttbp-cw-timeline .ts { font-size: 11px; color: var(--cw-fg-dim); }
.ttbp-cw-timeline .title { font-size: 13px; font-weight: 700; color: var(--cw-fg); }
.ttbp-cw-timeline .detail { font-size: 12px; color: var(--cw-fg-dim); }
.ttbp-cw-shell-note {
  color: var(--cw-fg-dim);
  font-size: 13px;
  padding: 16px;
  border: 1px dashed var(--ttbp-navy-light, #1e293b);
  border-radius: 8px;
}
.ttbp-cw-reasons { margin-top: 6px; font-size: 12px; color: var(--cw-fg-dim); }
.ttbp-cw-note-row,
.ttbp-cw-doc-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  border-bottom: 1px solid #1e293b;
  padding: 8px 0;
}
.ttbp-cw-note-row > div:first-child,
.ttbp-cw-doc-row > div:first-child { flex: 1; min-width: 0; }
.ttbp-cw-note-actions { display: flex; gap: 6px; flex-shrink: 0; }
.ttbp-light .ttbp-cw-shell,
.ttbp-cw-shell.light {
  background: #f3f4f6;
  border-color: #d1d5db;
}
.ttbp-light .ttbp-cw-hdr,
.ttbp-cw-shell.light .ttbp-cw-hdr { background: #e5e7eb; }
.ttbp-light .ttbp-cw-hdr h3,
.ttbp-cw-shell.light .ttbp-cw-hdr h3 { color: #111827; }
.ttbp-light .ttbp-cw-table th,
.ttbp-cw-shell.light .ttbp-cw-table th { background: #e5e7eb; color: #4b5563; }
.ttbp-light .ttbp-cw-table td,
.ttbp-cw-shell.light .ttbp-cw-table td { color: #1f2937; border-color: #e5e7eb; }
.ttbp-light .ttbp-cw-nav,
.ttbp-cw-shell.light .ttbp-cw-nav { background: #eef2f7; }
.ttbp-light .ttbp-cw-card,
.ttbp-cw-shell.light .ttbp-cw-card { background: #fff; border-color: #e5e7eb; }
.ttbp-light .ttbp-cw-name,
.ttbp-cw-shell.light .ttbp-cw-name { color: #111827; }

/* Light shell, completed 2026-10-02 (contrast pass): this stylesheet was written dark-first and
   only the header, table, nav, card and name were overridden, so the Back button, tabs, labels,
   notes and the green status read at 1.2-2.6:1 on the light panels. Swap the text variables and
   restyle the few pieces that sit on their own backgrounds. Target >= 4.5:1. */
.ttbp-light .ttbp-cw-shell,
.ttbp-cw-shell.light {
  --cw-fg: #1f2937;
  --cw-fg-strong: #111827;
  --cw-fg-dim: #4b5563;
  --cw-good: #166534;
  --cw-bad: #b91c1c;
  --cw-warn: #854d0e;
}
.ttbp-light .ttbp-cw-hdr .bk-close,
.ttbp-cw-shell.light .ttbp-cw-hdr .bk-close { color: #374151 !important; }
.ttbp-light .ttbp-cw-btn.ghost,
.ttbp-cw-shell.light .ttbp-cw-btn.ghost { color: #1f2937; border-color: #9ca3af; }
.ttbp-light .ttbp-cw-nav button,
.ttbp-cw-shell.light .ttbp-cw-nav button { color: #374151; }
.ttbp-light .ttbp-cw-nav button:hover,
.ttbp-cw-shell.light .ttbp-cw-nav button:hover { color: #111827; background: rgba(0,0,0,.05); }
.ttbp-light .ttbp-cw-nav button.active,
.ttbp-cw-shell.light .ttbp-cw-nav button.active { color: #1e3a8a; background: #dbe7f3; font-weight: 700; }
.ttbp-light .ttbp-cw-toolbar input[type="search"],
.ttbp-cw-shell.light .ttbp-cw-toolbar input[type="search"],
.ttbp-light .ttbp-cw-field input,
.ttbp-cw-shell.light .ttbp-cw-field input,
.ttbp-light .ttbp-cw-field select,
.ttbp-cw-shell.light .ttbp-cw-field select,
.ttbp-light .ttbp-cw-field textarea,
.ttbp-cw-shell.light .ttbp-cw-field textarea { background: #fff; border-color: #9ca3af; color: #111827; }
.ttbp-light .ttbp-cw-note-row,
.ttbp-cw-shell.light .ttbp-cw-note-row,
.ttbp-light .ttbp-cw-doc-row,
.ttbp-cw-shell.light .ttbp-cw-doc-row { border-bottom-color: #e5e7eb; }
.ttbp-light .ttbp-cw-shell-note,
.ttbp-cw-shell.light .ttbp-cw-shell-note { border-color: #9ca3af; }

/* ---- Profile Ledger tab (2026-10-10) ---- */
.ttbp-cw-ledger-sum { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.ttbp-cw-ledger-sum .chip { font-size: 13px; font-weight: 700; padding: 5px 10px; border-radius: 999px; background: rgba(255,255,255,.06); color: var(--cw-fg); }
.ttbp-cw-ledger-sum .chip.bad { background: rgba(239,68,68,.16); color: var(--cw-bad); }
.ttbp-cw-ledger-sum .chip.good { background: rgba(34,197,94,.15); color: var(--cw-good); }
.ttbp-cw-ledger-sum .chip.gold { background: rgba(234,179,8,.18); color: var(--cw-warn); }
.ttbp-cw-ledger-warn { flex-basis: 100%; font-size: 13px; color: var(--cw-warn); }
.ttbp-cw-ledger-bar { flex-wrap: wrap; gap: 8px; }
.ttbp-cw-ledger-bar select,
.ttbp-cw-ledger-bar input[type="date"] {
  background: var(--ttbp-navy, #0f1c2e);
  border: 1px solid var(--ttbp-navy-light, #1e293b);
  color: var(--cw-fg);
  padding: 7px 9px;
  border-radius: 6px;
  font-size: 13px;
}
.ttbp-cw-ledger-dates { color: var(--cw-fg-dim); font-size: 13px; white-space: nowrap; }
.ttbp-cw-ledger-wrap { max-height: 58vh; overflow-y: auto; }
.ttbp-cw-ledger-table td { vertical-align: top; font-size: 13px; }
.ttbp-cw-ledger-table tr:hover td { cursor: default; }
.ttbp-cw-ledger-table .num { text-align: right; white-space: nowrap; }
.ttbp-cw-ledger-table .dt { white-space: nowrap; }
.ttbp-cw-ledger-table .t { font-weight: 700; color: var(--cw-fg-strong); }
.ttbp-cw-ledger-table .d { font-size: 12px; color: var(--cw-fg-dim); margin-top: 2px; }
.ttbp-cw-ledger-table .sv { display: inline-block; margin-right: 6px; }
.ttbp-cw-ledger-table tr.open td { background: rgba(239,68,68,.06); }
.ttbp-cw-ledger-table tr.merged td { opacity: .85; }
.ttbp-cw-ledger-table .st { font-size: 12px; font-weight: 700; white-space: nowrap; }
.ttbp-cw-ledger-table .st-open, .ttbp-cw-ledger-table .st-part, .ttbp-cw-ledger-table .st-claimed { color: var(--cw-bad); }
.ttbp-cw-ledger-table .st-paid, .ttbp-cw-ledger-table .st-ahead { color: var(--cw-good); }
.ttbp-cw-ledger-table .st-refunded, .ttbp-cw-ledger-table .st-reversal, .ttbp-cw-ledger-table .st-void { color: var(--cw-warn); }
.ttbp-cw-ledger-table input[type="checkbox"] { width: 18px; height: 18px; cursor: pointer; }
.ttbp-cw-ledger-pager, .ttbp-cw-ledger-pay { display: flex; align-items: center; gap: 10px; margin-top: 10px; flex-wrap: wrap; }
.ttbp-cw-ledger-pay { justify-content: flex-end; }
.ttbp-cw-table .num { text-align: right; }
.ttbp-cw-plans tr:hover td { cursor: default; }
.ttbp-cw-ledger-table tr.open:hover td { background: rgba(58,124,165,.12); }
.ttbp-light .ttbp-cw-ledger-bar select, .ttbp-cw-shell.light .ttbp-cw-ledger-bar select,
.ttbp-light .ttbp-cw-ledger-bar input[type="date"], .ttbp-cw-shell.light .ttbp-cw-ledger-bar input[type="date"] { background: #fff; border-color: #9ca3af; color: #111827; }
.ttbp-light .ttbp-cw-ledger-sum .chip.gold, .ttbp-cw-shell.light .ttbp-cw-ledger-sum .chip.gold { color: #854d0e; }
