/* 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 .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: #1D2F47; color: var(--ink-soft); }
body.dark .chip-green { color: #9BD96B; }
body.dark .chip-yellow { color: #E8C46A; }
body.dark .chip-red { color: #F0938A; }

body.dark .mini-btn { color: var(--ink-soft); }
body.dark .mini-btn:hover { color: var(--blue-light); border-color: var(--blue-light); }
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;
}

.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 4px var(--red-tint); }
.light.yellow { background: var(--yellow); box-shadow: 0 0 0 4px var(--yellow-tint); }
.light.green { background: var(--green); box-shadow: 0 0 0 4px 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); }

/* ===== 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; }

/* 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; }
}

/* 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)); }
