/* CTC Tracker - demo app styles */

:root { --card: #ffffff; }

.demo-body { background: var(--bg-soft); }

/* ===== Dark mode ===== */

body.dark {
  --card: #14253E;
  --bg: #0A1626;
  --bg-soft: #0C1B2F;
  --line: #243956;
  --ink: #E8EEF6;
  --ink-soft: #B6C3D4;
  --ink-faint: #8294AB;
  --navy: #E2ECF8;
  --blue-tint: #173455;
  --green-tint: #1C3313;
  --red-tint: #3D1A17;
  --yellow-tint: #3A2E0F;
  --shadow: 0 8px 30px rgba(0, 0, 0, 0.45);
  --shadow-lg: 0 20px 60px rgba(0, 0, 0, 0.55);
  color: var(--ink);
}

body.dark input,
body.dark select {
  background: var(--card);
  color: var(--ink);
  color-scheme: dark;
}

body.dark .contact-form input,
body.dark .contact-form select,
body.dark .contact-form textarea {
  background: #F2F4F7 !important;
  color: #1A2333 !important;
  border-color: #d0dae8 !important;
  color-scheme: light;
}

body.dark form[data-action="login"] input {
  background: #F2F4F7 !important;
  color: #1A2333 !important;
  border-color: #d0dae8 !important;
  color-scheme: light;
}

body.dark .demo-header {
  background: rgba(10, 22, 38, 0.92);
  border-bottom-color: var(--line);
}

body.dark .demo-banner { background: #081C38; color: rgba(255, 255, 255, 0.8); }
body.dark .demo-avatar { background: var(--blue); }
body.dark .brand-blue { color: var(--blue-light); }

body.dark .toast {
  background: #081C38;
  border: 1px solid var(--line);
}

body.dark .demo-footer { background: var(--card); color: var(--ink-soft); }

body.dark .chip-gray { background: #F2F4F7; color: var(--ink-soft); }
body.dark .chip-green { background: #F2F4F7; color: #44801F; }
body.dark .chip-yellow { background: #F2F4F7; color: #A1740F; }
body.dark .chip-red { background: #F2F4F7; color: var(--red); }
body.dark .chip-blue { background: #F2F4F7; color: var(--blue); }
body.dark .chip-urg-high { background: #F2F4F7; color: #0F2D52; }
body.dark .chip-urg-med  { background: #F2F4F7; color: #2E5480; }

body.dark .mini-btn { color: #1A2333; background: #F2F4F7; border-color: #d0dae8; }
body.dark .mini-btn:hover { color: var(--blue); border-color: var(--blue); background: #F2F4F7; }
body.dark .mini-btn.primary { background: var(--blue); color: #fff; }
body.dark .mini-btn.primary:hover { background: var(--blue-light); }
body.dark .mini-btn.cal { background: var(--green); border-color: var(--green); color: #fff; }
body.dark .mini-btn.cal:hover { background: #6FBC3D; border-color: #6FBC3D; }

body.dark .btn-primary { box-shadow: 0 6px 20px rgba(27, 111, 194, 0.5); }

.demo-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}

.demo-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

.demo-user { display: flex; align-items: center; gap: 12px; }

.demo-badge {
  white-space: nowrap;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--blue);
  background: var(--blue-tint);
  border-radius: 999px;
  padding: 4px 12px;
}

.demo-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--navy);
  color: #fff;
  font-size: 0.8rem;
  font-weight: 700;
}

.demo-banner {
  background: var(--navy);
  color: rgba(255, 255, 255, 0.85);
  padding: 10px 0;
  font-size: 0.88rem;
}

.demo-main { padding: 32px 24px 80px; max-width: 860px; }

.demo-footer {
  border-top: 1px solid var(--line);
  background: var(--card);
  padding: 20px 0;
  font-size: 0.9rem;
  color: var(--ink-soft);
}

.demo-footer a { color: var(--blue); font-weight: 600; }

/* ===== Dashboard ===== */

.dash-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}

.dash-head h1 {
  font-size: 1.6rem;
}

.dash-head .btn { padding: 11px 22px; font-size: 0.95rem; }

.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
  margin-bottom: 20px;
}

.panel-title {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--ink-faint);
  margin-bottom: 14px;
}

/* --------- Collapsible urgency panels --------- */
.urgency-panel { padding: 0; overflow: hidden; }
.urgency-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 15px 22px;
  cursor: pointer;
  user-select: none;
  border-radius: var(--radius);
  transition: background 0.15s;
}
.urgency-head:hover { background: var(--bg-soft); }
.is-open .urgency-head {
  border-bottom: 1px solid var(--line);
  border-radius: var(--radius) var(--radius) 0 0;
}
.urgency-title {
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  display: flex;
  align-items: center;
  gap: 8px;
}
.urgency-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
.pin-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 20px;
  transition: background 0.15s;
  color: var(--ink-soft);
  font-family: inherit;
}
.pin-toggle:hover { background: var(--blue-tint); }
.pin-track {
  width: 28px;
  height: 16px;
  border-radius: 8px;
  background: var(--line);
  position: relative;
  flex-shrink: 0;
  transition: background 0.2s;
}
.pin-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,0.25);
  transition: left 0.2s;
}
.pin-toggle.on .pin-track { background: var(--blue); }
.pin-toggle.on .pin-thumb { left: 14px; }
.pin-toggle.on { color: var(--blue); }
.pin-label { font-size: 0.72rem; font-weight: 500; white-space: nowrap; }
.urgency-chevron {
  color: var(--ink-faint);
  display: flex;
  align-items: center;
  transition: transform 0.2s;
}
.is-open .urgency-chevron { transform: rotate(180deg); }
.urgency-body { padding: 16px 22px 14px; }

/* dark mode urgency panel */
body.dark .urgency-head:hover { background: rgba(255,255,255,0.04); }
body.dark .pin-thumb { background: var(--card); }
body.dark .pin-toggle:hover { background: rgba(59,139,235,0.15); }

/* --------- AI email drafter modal --------- */
.ai-btn { border-color: var(--blue); color: var(--blue); display: inline-flex; align-items: center; gap: 6px; }
.ai-btn svg { color: var(--blue); }
body.dark .ai-btn { color: var(--blue); }
body.dark .ai-btn svg { color: var(--blue); }

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(8, 18, 33, 0.55);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 40px 16px;
  overflow-y: auto;
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
}
body.dark .modal-overlay { background: rgba(0, 0, 0, 0.62); }

.modal-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  width: 100%;
  max-width: 620px;
  box-shadow: var(--shadow-lg);
}
.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  padding: 20px 22px 14px;
  border-bottom: 1px solid var(--line);
}
.modal-title { font-size: 1.15rem; margin: 0; display: flex; align-items: center; gap: 8px; }
.modal-title svg { color: var(--blue); }
.modal-sub { font-size: 0.82rem; color: var(--ink-soft); margin: 6px 0 0; line-height: 1.45; }
.modal-close {
  background: none;
  border: none;
  font-size: 1.7rem;
  line-height: 1;
  color: var(--ink-faint);
  cursor: pointer;
  padding: 0 4px;
}
.modal-close:hover { color: var(--ink); }
.modal-body { padding: 18px 22px 22px; }

.email-label {
  display: block;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-faint);
  margin: 16px 0 7px;
}
.email-label:first-child { margin-top: 0; }

.email-input {
  width: 100%;
  padding: 11px 14px;
  border: 2px solid var(--line);
  border-radius: 10px;
  font-family: inherit;
  font-size: 0.95rem;
  background: var(--card);
  color: var(--ink);
}
.email-input:focus { border-color: var(--blue); outline: none; }
.email-subject { font-weight: 600; }
.email-body {
  min-height: 280px;
  resize: vertical;
  line-height: 1.55;
  white-space: pre-wrap;
}

.email-pills { display: flex; flex-wrap: wrap; gap: 8px; }
.email-pill {
  font-family: inherit;
  font-size: 0.85rem;
  padding: 7px 13px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--bg-soft);
  color: var(--ink-soft);
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}
.email-pill:hover { border-color: var(--blue); color: var(--blue); }
.email-pill.on { background: var(--blue); border-color: var(--blue); color: #fff; }
.lang-pill {
  background: #D6E6F7;
  border-color: #A8C8EE;
  color: #1B4F8C;
  font-weight: 600;
}
.lang-pill:hover { background: #C0D8F0; border-color: var(--blue); color: var(--blue); }
.lang-pill.on { background: var(--blue); border-color: var(--blue); color: #fff; }

.email-tone-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
}
.email-tone-row > div { flex: 1; min-width: 0; }
.btn-generate-email {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 20px;
  border-radius: 10px;
  border: none;
  background: #5FA831;
  color: #fff;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s;
  margin-bottom: 1px;
}
.btn-generate-email:hover { background: #4f8e29; }
.email-result { margin-top: 20px; }
.email-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 14px; }
.email-foot { font-size: 0.75rem; color: var(--ink-faint); margin-top: 12px; line-height: 1.4; }

/* CC / BCC */
.email-ccbcc-toggle {
  background: none; border: none; cursor: pointer;
  font-size: 0.8rem; font-weight: 600; color: var(--blue);
  padding: 4px 0; margin-top: 4px; display: block;
}
.email-ccbcc-toggle:hover { opacity: 0.75; }
.email-label-hint { font-weight: 400; color: var(--ink-faint); font-size: 0.78rem; }
.ccbcc-row { margin-top: 8px; }
.ccbcc-quick { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.ccbcc-chip {
  background: #EAF3FC; border: 1px solid #C4D9EF; color: #0F2D52;
  border-radius: 999px; font-size: 0.75rem; font-weight: 600;
  padding: 3px 10px; cursor: pointer;
}
.ccbcc-chip:hover { background: #d4e8f7; }

/* Document attachment */
.email-attach-bar { margin-top: 12px; }
.email-attach-toggle {
  background: none; border: 1.5px dashed var(--line); border-radius: 8px;
  cursor: pointer; font-size: 0.82rem; font-weight: 600; color: var(--ink-soft);
  padding: 7px 14px; width: 100%; text-align: left;
  transition: border-color 0.15s, color 0.15s;
}
.email-attach-toggle:hover { border-color: var(--blue); color: var(--blue); }
.attach-count {
  background: var(--blue); color: #fff; border-radius: 999px;
  font-size: 0.7rem; font-weight: 700; padding: 1px 6px; margin-left: 6px;
}
.email-attach-list {
  border: 1px solid var(--line); border-radius: 8px;
  margin-top: 6px; overflow: hidden;
}
.email-attach-item {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 14px; cursor: pointer; font-size: 0.85rem;
  border-bottom: 1px solid var(--line); transition: background 0.1s;
}
.email-attach-item:last-child { border-bottom: none; }
.email-attach-item:hover { background: var(--bg-soft); }
.email-attach-item input[type="checkbox"] { width: 15px; height: 15px; flex-shrink: 0; }
.email-attach-name { flex: 1; color: var(--ink); font-weight: 500; }
.email-attach-type { font-size: 0.75rem; color: var(--ink-faint); }

/* Attached docs summary in result */
.email-attached-summary {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
  margin-top: 10px; padding: 8px 12px;
  background: #EAF3FC; border-radius: 8px; color: #0F2D52;
  font-size: 0.8rem;
}
.attached-doc-pill {
  background: #fff; border: 1px solid #C4D9EF; border-radius: 999px;
  padding: 2px 10px; font-size: 0.75rem; font-weight: 600; color: #0F2D52;
}

body.dark .email-attach-toggle { border-color: #3a4a60; color: #aab8cc; }
body.dark .email-attach-toggle:hover { border-color: var(--blue); color: var(--blue); }
body.dark .email-attach-item:hover { background: #1e2d40; }
body.dark .ccbcc-chip { background: #1e3048; border-color: #2e4a6a; color: #7BAAD9; }
body.dark .email-attached-summary { background: #1a2e45; color: #7BAAD9; }
body.dark .attached-doc-pill { background: #0e1e30; border-color: #2e4a6a; color: #90B8E0; }

.text-charcount { font-size: 0.76rem; color: var(--ink-faint); margin-top: 7px; }
.text-message { min-height: 120px; resize: vertical; line-height: 1.5; }
.text-schedule { display: flex; gap: 12px; margin-top: 4px; }
.text-schedule > div { flex: 1; }

.text-confirm { text-align: center; padding: 14px 0 18px; }
.text-confirm-check {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--green-tint);
  color: var(--green);
  margin-bottom: 14px;
}
.text-confirm-title { font-weight: 800; color: var(--navy); font-size: 1.05rem; }
.text-confirm-sub { color: var(--ink-soft); font-size: 0.9rem; margin-top: 6px; }

body.dark .email-pill { background: #0C1B2F; }
body.dark .email-pill.on { background: var(--blue); color: #fff; border-color: var(--blue); }
body.dark .email-modal .email-input,
body.dark .text-modal .email-input {
  background: #F2F4F7 !important;
  color: #1A2333 !important;
  border-color: #d0dae8 !important;
  color-scheme: light;
}
body.dark .text-confirm-title { color: var(--navy); }

/* --------- */

.today-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
  background: var(--card);
  cursor: pointer;
  transition: border-color 0.15s ease;
}

.today-item:hover { border-color: var(--blue); }

.today-item .light {
  flex-shrink: 0;
  width: 11px;
  height: 11px;
  border-radius: 50%;
}

.light.red { background: var(--red); box-shadow: 0 0 0 2px var(--red-tint); }
.light.yellow { background: var(--yellow); box-shadow: 0 0 0 2px var(--yellow-tint); }
.light.green { background: var(--green); box-shadow: 0 0 0 2px var(--green-tint); }

.today-item strong { display: block; font-size: 0.92rem; color: var(--navy); line-height: 1.3; }
.today-item small { color: var(--ink-faint); font-size: 0.8rem; }

.empty-note { color: var(--ink-faint); font-size: 0.92rem; padding: 6px 2px; }

.tx-card {
  display: block;
  width: 100%;
  text-align: left;
  font-family: inherit;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px 22px;
  margin-bottom: 12px;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.tx-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
  border-color: var(--blue);
}

.tx-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 4px;
}

.tx-card-top strong { font-size: 1.05rem; color: var(--navy); font-family: var(--font-display); }

.tx-addr { color: var(--ink-soft); font-size: 0.93rem; }

.tx-card-bottom {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
  flex-wrap: wrap;
}

.chip {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 999px;
  padding: 3px 12px;
}

.chip-blue { background: var(--blue-tint); color: var(--blue); }
.chip-gray { background: #EEF1F5; color: var(--ink-soft); }
.chip-green { background: var(--green-tint); color: #44801F; }
.chip-yellow { background: var(--yellow-tint); color: #A1740F; }
.chip-red { background: var(--red-tint); color: var(--red); }
.chip-urg-high { background: #E3EAF3; color: #0F2D52; }
.chip-urg-med  { background: #E8EFF7; color: #2E5480; }
.urg-color-deposits { color: #0F2D52; font-weight: 800; }
.urg-color-tasks    { color: #0F2D52; font-weight: 800; }
.urg-color-deadlines{ color: #2E5480; font-weight: 800; }
body.dark .urg-color-deposits { color: #7BAAD9; }
body.dark .urg-color-tasks    { color: #7BAAD9; }
body.dark .urg-color-deadlines{ color: #90B8E0; }
body.dark .chip-urg-high { background: #1A3A5C; color: #A8CAE8; }
body.dark .chip-urg-med  { background: #1E3F5E; color: #B8D4EC; }

/* ===== Transaction card: stage progress + task buckets ===== */

.tx-stage { margin-top: 16px; }

.tx-stage-bar { display: flex; gap: 4px; }

.tx-stage-seg {
  flex: 1;
  height: 8px;
  border-radius: 4px;
  background: var(--line);
  transition: background 0.2s ease;
}
.tx-stage-seg.done { background: var(--green); }
.tx-stage-seg.current { background: var(--blue); }
.tx-stage-seg.cancelled { background: var(--ink-faint); }

.tx-stage-caption {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 7px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--ink-soft);
}
.tx-stage-pct { color: var(--ink-faint); font-weight: 600; }

.tx-buckets {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
  flex-wrap: wrap;
}
.tx-buckets-icon {
  display: inline-flex;
  align-items: center;
  color: var(--ink-faint);
  margin-right: 1px;
}

.tx-bucket {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 4px 12px 4px 5px;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 600;
  line-height: 1;
}
.tx-bucket-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 21px;
  height: 21px;
  padding: 0 5px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 800;
  color: #fff;
}
.tx-bucket.red { background: var(--red-tint); color: var(--red); }
.tx-bucket.red .tx-bucket-num { background: var(--red); }
.tx-bucket.orange { background: #FFEDE0; color: #C2570A; }
.tx-bucket.orange .tx-bucket-num { background: #FF6A00; }
.tx-bucket.yellow { background: var(--yellow-tint); color: #A1740F; }
.tx-bucket.yellow .tx-bucket-num { background: var(--yellow); }
.tx-bucket.zero { background: var(--bg-soft); color: var(--ink-faint); }
.tx-bucket.zero .tx-bucket-num { background: var(--ink-faint); }

body.dark .today-item { background: #F2F4F7; border-color: #d0dae8; }
body.dark .today-item strong { color: #1A2333; }
body.dark .today-item small { color: #4A5568; }
body.dark .today-item:hover { border-color: var(--blue); }

body.dark .tx-bucket { background: #F2F4F7; }
body.dark .tx-bucket.red { color: var(--red); }
body.dark .tx-bucket.orange { color: #C2570A; }
body.dark .tx-bucket.yellow { color: #A1740F; }
body.dark .tx-bucket.zero { background: #F2F4F7; color: var(--ink-soft); }

/* ===== Transaction page ===== */

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: none;
  font-family: inherit;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--blue);
  cursor: pointer;
  padding: 0;
  margin-bottom: 18px;
}

.tx-header {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 20px;
  position: sticky;
  top: 64px;
  z-index: 50;
  box-shadow: 0 4px 16px rgba(14, 42, 79, 0.06);
}

.tx-header h1 { font-size: 1.35rem; margin-bottom: 2px; }

.tx-header-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.section-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin-bottom: 14px;
  overflow: hidden;
}

.section-card summary {
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  padding: 18px 22px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.02rem;
  color: var(--navy);
}

.section-card summary::-webkit-details-marker { display: none; }

.section-card summary::after {
  content: '';
  width: 10px;
  height: 10px;
  border-right: 2.5px solid var(--ink-faint);
  border-bottom: 2.5px solid var(--ink-faint);
  transform: rotate(45deg);
  transition: transform 0.2s ease;
  margin-left: 12px;
  flex-shrink: 0;
}

.section-card[open] summary::after { transform: rotate(225deg); }

.section-body { padding: 0 22px 20px; }

.row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}

.row:last-child { border-bottom: none; }

.row-main { flex: 1; min-width: 200px; }
.row-main strong { display: block; font-size: 0.95rem; color: var(--navy); }
.row-main small { color: var(--ink-faint); font-size: 0.82rem; }

.row-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

.mini-btn {
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: 999px;
  border: 1.5px solid var(--line);
  background: var(--card);
  color: var(--ink-soft);
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}

.mini-btn:hover { border-color: var(--blue); color: var(--blue); }

.mini-btn.primary {
  background: var(--blue);
  border-color: var(--blue);
  color: #fff;
}

.mini-btn.primary:hover { background: var(--blue-dark); }

.mini-btn.cal {
  background: var(--green);
  border-color: var(--green);
  color: #fff;
}

.mini-btn.cal:hover {
  background: #4E8C27;
  border-color: #4E8C27;
  color: #fff;
}

/* Checklist rows */

.check-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
}

.check-row:last-child { border-bottom: none; }

.check-row input[type="checkbox"] {
  width: 20px;
  height: 20px;
  accent-color: var(--green);
  cursor: pointer;
  flex-shrink: 0;
}

.check-row span { font-size: 0.95rem; color: var(--ink); }

.check-row.done span {
  text-decoration: line-through;
  color: var(--ink-faint);
}

/* Contacts */

.contact-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.contact-card {
  position: relative;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 14px 36px 14px 16px;
}

.contact-remove {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 26px;
  height: 26px;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--ink-faint);
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.contact-remove:hover { background: var(--red-tint); color: var(--red); }

.contact-form {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--bg-soft);
  padding: 16px 18px 18px;
  margin-top: 14px;
}

.contact-role {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--blue);
}

.contact-card strong { display: block; color: var(--navy); font-size: 0.95rem; margin: 2px 0; }
.contact-card small { color: var(--ink-faint); font-size: 0.8rem; display: block; }
.contact-card small.contact-detail { color: var(--navy); }

/* Documents */

.doc-card {
  display: flex;
  align-items: center;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  margin-bottom: 8px;
}

.doc-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: var(--blue-tint);
  color: var(--blue);
  font-size: 0.7rem;
  font-weight: 800;
  flex-shrink: 0;
}

.doc-card strong { display: block; font-size: 0.92rem; color: var(--navy); }
.doc-card small { color: var(--ink-faint); font-size: 0.78rem; }

/* Ordered / Scheduled / Completed date fields */

.date-trio {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin: 8px 0 4px;
  width: 100%;
}

.date-field { display: flex; flex-direction: column; gap: 3px; }

.date-field span {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--ink-faint);
}

.date-field input[type="date"],
.date-field input[type="time"],
.date-field input[type="text"],
.date-field input[type="tel"],
.date-field select {
  padding: 6px 10px;
  border: 1.5px solid var(--line);
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.82rem;
  color: var(--ink);
  background: var(--card);
}

.date-field input:focus, .date-field select:focus { border-color: var(--blue); outline: none; }

/* ===== Guided workflows ===== */

.wf-card {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--card);
  padding: 16px 18px;
  margin-bottom: 12px;
}

.wf-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.wf-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.98rem;
  color: var(--navy);
}

.wf-steps { position: relative; }

.wf-steps::before {
  content: '';
  position: absolute;
  left: 11px;
  top: 12px;
  bottom: 12px;
  width: 2px;
  background: var(--line);
}

.wf-step {
  position: relative;
  display: flex;
  gap: 14px;
  padding: 9px 0;
}

.wf-dot {
  position: relative;
  z-index: 1;
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--card);
  border: 2.5px solid var(--line);
  margin-top: 1px;
}

.wf-step.done .wf-dot {
  background: var(--green);
  border-color: var(--green);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none'%3E%3Cpath d='M6 12.5l4 4 8-9' stroke='white' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-size: 13px;
  background-repeat: no-repeat;
  background-position: center;
}

.wf-step.active .wf-dot {
  border-color: var(--blue);
  box-shadow: 0 0 0 4px var(--blue-tint);
}

.wf-step.locked { opacity: 0.5; }

.wf-step-title { font-weight: 600; font-size: 0.93rem; color: var(--navy); }

.wf-meta { font-size: 0.8rem; color: var(--ink-faint); }

.wf-stamp { font-size: 0.78rem; color: var(--green); font-weight: 600; }

.wf-fields {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: flex-end;
  margin-top: 8px;
}

.wf-outcome {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 10px;
  padding-left: 38px;
}

.wf-chooser {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 12px;
  padding: 14px;
  border: 1px dashed var(--line);
  border-radius: var(--radius-sm);
  background: var(--bg-soft);
}

/* Activity log */

.activity-item {
  display: flex;
  gap: 12px;
  align-items: baseline;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
  font-size: 0.88rem;
}

.activity-item:last-child { border-bottom: none; }

.activity-time {
  flex-shrink: 0;
  width: 120px;
  font-size: 0.76rem;
  color: var(--ink-faint);
  white-space: nowrap;
}

@media (max-width: 600px) {
  .wf-fields .date-field { flex: 1 1 45%; min-width: 120px; }
  .activity-item { flex-direction: column; gap: 2px; }
  .activity-time { width: auto; }
}

/* ===== Locked dates ===== */

.lock-wrap {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.lock-wrap input:disabled {
  background: var(--bg-soft);
  color: var(--ink-soft);
  border-style: dashed;
  cursor: not-allowed;
}

.lock-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  border: 1.5px solid var(--line);
  background: var(--card);
  cursor: pointer;
  flex-shrink: 0;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.lock-btn.locked { border-color: var(--blue); background: var(--blue-tint); color: var(--blue); }
.lock-btn.unlocked { border-color: var(--yellow); background: var(--yellow-tint); color: #A1740F; }
.lock-btn:hover { border-color: var(--navy); }

body.dark .lock-btn { background: #F2F4F7; border-color: #d0dae8; color: #1A2333; }
body.dark .lock-btn.locked { background: #F2F4F7; border-color: var(--blue); color: var(--blue); }
body.dark .lock-btn.unlocked { background: #F2F4F7; border-color: #E8A823; color: #A1740F; }

/* ===== Segmented choice buttons (instead of dropdowns) ===== */

.seg-group { display: flex; gap: 10px; flex-wrap: wrap; }

.seg-btn {
  flex: 1;
  min-width: 130px;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  padding: 13px 16px;
  border-radius: 12px;
  border: 2px solid var(--line);
  background: var(--card);
  color: var(--ink-soft);
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}

.seg-btn.active {
  border-color: var(--blue);
  background: var(--blue-tint);
  color: var(--blue);
}

/* ===== Money pill input ===== */

.money-pill {
  display: inline-flex;
  align-items: center;
  gap: 1px;
  background: var(--blue-tint);
  color: var(--blue);
  border: 2px solid transparent;
  border-radius: 999px;
  padding: 9px 18px;
  font-weight: 700;
  font-size: 1.05rem;
  transition: border-color 0.15s ease;
}

.money-pill:focus-within { border-color: var(--blue); }

.money-pill .currency { font-weight: 700; }

.money-pill input {
  border: none;
  background: transparent;
  color: var(--blue);
  font-family: inherit;
  font-weight: 700;
  font-size: 1.05rem;
  width: 120px;
  padding: 0;
  outline: none;
}

.money-pill input::placeholder { color: var(--blue); opacity: 0.45; }

body.dark .money-pill { background: #EAF3FC; color: var(--blue); }
body.dark .money-pill input { background: #EAF3FC; color: var(--blue); }
body.dark .money-pill input::placeholder { color: var(--blue); opacity: 0.45; }

/* ===== Notes fields ===== */

.note-field { display: block; margin-top: 12px; }

.note-field span {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--ink-soft);
  margin-bottom: 5px;
}

.note-lock-wrap {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.note-lock-wrap textarea { flex: 1; }

.note-lock-wrap .lock-btn { margin-top: 2px; flex-shrink: 0; }

.note-field textarea {
  width: 100%;
  min-height: 112px;
  padding: 10px 14px;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  font-family: inherit;
  font-size: 16px;
  color: var(--ink);
  background: #ffffff;
  resize: vertical;
}

.note-field textarea:disabled {
  background: #f8fafc;
  color: var(--ink-soft);
  border-style: dashed;
  cursor: not-allowed;
}

.note-field textarea:focus { border-color: var(--blue); outline: none; }

body.dark .note-field textarea { background: #F2F4F7; color: #1A2333; border-color: #d0dae8; }
body.dark .note-field textarea:disabled { background: #f1f5f9; color: #4A5568; }

/* ===== Helper text and tip banners ===== */

.field-help {
  font-size: 0.8rem;
  color: var(--ink-faint);
  margin-top: 5px;
}

.tip-banner {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  background: var(--yellow-tint);
  border: 1px solid rgba(232, 168, 35, 0.4);
  border-radius: var(--radius-sm);
  padding: 11px 14px;
  font-size: 0.86rem;
  color: #7A5A0B;
  margin: 10px 0;
}

body.dark .tip-banner { color: #E8C46A; }

.info-banner {
  background: #ffffff;
  border: 1px solid rgba(27, 111, 194, 0.25);
  border-radius: var(--radius-sm);
  padding: 11px 14px;
  font-size: 0.86rem;
  color: var(--blue);
  margin: 10px 0;
}

body.dark .info-banner { background: #F2F4F7; color: var(--blue); border-color: rgba(27, 111, 194, 0.4); }

/* ===== Onboarding checklist ===== */

.onboarding {
  background: var(--card);
  border: 2px solid var(--blue);
  border-radius: var(--radius);
  padding: 20px 22px;
  margin-bottom: 20px;
}

.onboarding-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}

.onboarding-head strong { font-family: var(--font-display); color: var(--navy); font-size: 1.05rem; }

/* ===== Offline banner ===== */

.offline-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 300;
  background: var(--yellow);
  color: #3A2E0F;
  text-align: center;
  font-size: 0.88rem;
  font-weight: 600;
  padding: 8px 16px;
}

/* ===== Contact quick actions ===== */

.contact-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.contact-actions a {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--blue);
  text-decoration: none;
  border: 1.5px solid var(--line);
  border-radius: 999px;
  padding: 4px 12px;
  transition: border-color 0.15s ease;
}

.contact-actions a:hover { border-color: var(--blue); }

.consent-request-btn {
  font-size: 0.78rem;
  font-weight: 600;
  color: #5FA831;
  background: none;
  border: 1.5px solid #5FA831;
  border-radius: 999px;
  padding: 4px 12px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.consent-request-btn:hover { background: #5FA831; color: #fff; }

body.dark .contact-card small { color: var(--navy); }
body.dark .contact-actions a { background: #F2F4F7; color: var(--blue); border-color: #d0dae8; }
body.dark .contact-actions a:hover { border-color: var(--blue); }
body.dark .consent-request-btn { border-color: #5FA831; color: #5FA831; }
body.dark .consent-request-btn:hover { background: #5FA831; color: #fff; }

/* Toast */

.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: var(--navy);
  color: #fff;
  padding: 12px 24px;
  border-radius: 999px;
  font-size: 0.9rem;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  transition: transform 0.3s ease, opacity 0.3s ease;
  z-index: 200;
  pointer-events: none;
  max-width: 90vw;
  text-align: center;
}

.toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

@media (max-width: 600px) {
  .contact-grid { grid-template-columns: 1fr; }
  .tx-header { position: static; }
  .demo-main { padding: 24px 16px 64px; }
  .row-actions { width: 100%; justify-content: flex-end; }
  .date-trio { gap: 8px; }
  .date-field { flex: 1; min-width: 96px; }
  .date-field input[type="date"] { width: 100%; }
}

/* Touch devices: larger tap targets, no accidental zoom on focus */
@media (pointer: coarse) {
  .mini-btn { padding: 10px 16px; font-size: 0.88rem; }
  .check-row { padding: 13px 0; }
  .check-row input[type="checkbox"] { width: 22px; height: 22px; }
  .today-item { padding: 14px; }
  input, select, textarea { font-size: 16px !important; }
}

/* Notched phones: respect safe areas */
.demo-header { padding-top: env(safe-area-inset-top); }

.demo-main {
  padding-left: max(24px, env(safe-area-inset-left));
  padding-right: max(24px, env(safe-area-inset-right));
}

.demo-footer { padding-bottom: max(20px, env(safe-area-inset-bottom)); }
