:root {
  --bg: #eef5f1;
  --ink: #14241e;
  --muted: #5a6e66;
  --brand: #0d7a64;
  --brand-deep: #065445;
  --brand-soft: #d4efe7;
  --surface: #ffffff;
  --line: #d5e3dc;
  --warn: #c27803;
  --warn-soft: #fff3d9;
  --danger: #c2304d;
  --danger-soft: #fde8ee;
  --ok: #0f7a55;
  --ok-soft: #ddf5ea;
  --amber: #d97706;
  --font-display: "Fraunces", Georgia, serif;
  --font-body: "Source Sans 3", system-ui, sans-serif;
  --radius: 14px;
  --shadow: 0 16px 48px rgba(20, 36, 30, 0.08);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  color: var(--ink);
  font-family: var(--font-body);
  background:
    radial-gradient(900px 480px at 0% -5%, #c8e8dc 0%, transparent 55%),
    radial-gradient(700px 420px at 100% 0%, #e8f0d8 0%, transparent 45%),
    linear-gradient(180deg, #f4faf7 0%, var(--bg) 40%, #e7f0ea 100%);
}

body {
  padding-bottom: 3rem;
}

a {
  color: var(--brand);
  text-decoration: none;
}

button,
input,
select,
textarea {
  font: inherit;
}

.shell {
  width: min(960px, calc(100% - 1.5rem));
  margin: 0 auto;
}

/* ---------- Chrome ---------- */

.chrome {
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(12px);
  background: rgba(244, 250, 247, 0.88);
  border-bottom: 1px solid rgba(213, 227, 220, 0.7);
  margin: 0 calc(50% - 50vw);
  padding: 0 calc(50vw - 50%);
}

.chrome-inner {
  width: min(960px, calc(100% - 1.5rem));
  margin: 0 auto;
  padding: 0.85rem 0 0;
}

.brand-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.65rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.45rem;
  color: var(--brand-deep);
  letter-spacing: -0.03em;
  text-decoration: none;
}

.brand-mark {
  display: block;
  flex-shrink: 0;
}

.brand em {
  font-style: normal;
  color: var(--brand);
}

.brand-tag {
  font-size: 0.78rem;
  color: var(--muted);
  font-weight: 600;
}

.tabs {
  display: flex;
  gap: 0.15rem;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.tabs::-webkit-scrollbar {
  display: none;
}

.tabs a {
  flex: 0 0 auto;
  padding: 0.7rem 0.95rem;
  color: var(--muted);
  font-weight: 600;
  font-size: 0.92rem;
  text-decoration: none;
  border-bottom: 2px solid transparent;
  transition: color 0.2s var(--ease), border-color 0.2s var(--ease);
}

.tabs a:hover {
  color: var(--brand-deep);
}

.tabs a[aria-current="page"] {
  color: var(--brand-deep);
  border-bottom-color: var(--brand);
}

/* ---------- Shared UI ---------- */

.screen {
  padding-top: 1.35rem;
  animation: rise 0.45s var(--ease) both;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes pop {
  from {
    opacity: 0;
    transform: scale(0.97);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.step-meta {
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin: 0 0 0.45rem;
}

.screen h1 {
  font-family: var(--font-display);
  font-size: clamp(1.55rem, 3.5vw, 2rem);
  letter-spacing: -0.03em;
  margin: 0 0 0.4rem;
  line-height: 1.15;
}

.lede {
  margin: 0 0 1.25rem;
  color: var(--muted);
  max-width: 42ch;
  line-height: 1.45;
}

.choice-grid {
  display: grid;
  gap: 0.75rem;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

.choice {
  appearance: none;
  text-align: left;
  background: var(--surface);
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  padding: 1.1rem 1rem;
  cursor: pointer;
  box-shadow: 0 1px 0 rgba(20, 36, 30, 0.03);
  transition: border-color 0.2s var(--ease), transform 0.2s var(--ease), box-shadow 0.2s var(--ease);
}

.choice:hover {
  border-color: #a8cfc2;
  transform: translateY(-1px);
}

.choice[aria-pressed="true"],
.choice.is-selected {
  border-color: var(--brand);
  background: linear-gradient(180deg, #f3fbf8, #fff);
  box-shadow: 0 0 0 3px rgba(13, 122, 100, 0.12);
}

.choice .ico {
  font-size: 1.7rem;
  line-height: 1;
  margin-bottom: 0.55rem;
  display: block;
}

.choice strong {
  display: block;
  font-size: 1.02rem;
  margin-bottom: 0.2rem;
}

.choice span {
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.35;
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.chip {
  appearance: none;
  border: 1.5px solid var(--line);
  background: var(--surface);
  border-radius: 999px;
  padding: 0.45rem 0.85rem;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--ink);
  cursor: pointer;
  transition: 0.15s var(--ease);
}

.chip:hover {
  border-color: #a8cfc2;
}

.chip[aria-pressed="true"] {
  background: var(--brand-soft);
  border-color: var(--brand);
  color: var(--brand-deep);
}

.section-label {
  font-weight: 700;
  font-size: 0.92rem;
  margin: 1.15rem 0 0.55rem;
}

.nav-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  align-items: center;
  margin-top: 1.5rem;
}

.btn {
  appearance: none;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 0.72rem 1.2rem;
  font-weight: 700;
  cursor: pointer;
  background: var(--brand);
  color: #fff;
  transition: background 0.15s var(--ease), transform 0.15s var(--ease);
}

.btn:hover {
  background: var(--brand-deep);
}

.btn:active {
  transform: scale(0.98);
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn.ghost {
  background: transparent;
  color: var(--muted);
  border-color: transparent;
}

.btn.ghost:hover {
  color: var(--brand-deep);
  background: rgba(13, 122, 100, 0.06);
}

.btn.soft {
  background: var(--brand-soft);
  color: var(--brand-deep);
}

.btn.warn {
  background: var(--warn-soft);
  color: #8a4b00;
}

.btn.danger {
  background: var(--danger-soft);
  color: var(--danger);
}

.btn.ok {
  background: var(--ok-soft);
  color: var(--ok);
}

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.15rem;
  box-shadow: var(--shadow);
}

.hidden {
  display: none !important;
}

.progress {
  display: flex;
  gap: 0.35rem;
  margin: 0 0 1.25rem;
}

.progress i {
  flex: 1;
  height: 4px;
  border-radius: 99px;
  background: var(--line);
}

.progress i.on {
  background: var(--brand);
}

/* ---------- Results ---------- */

.results-hero {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  margin-bottom: 1rem;
}

.results-hero .spark {
  font-size: 1.4rem;
  line-height: 1;
}

.pick {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 0.85rem;
  align-items: center;
  padding: 0.95rem 1rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  margin-bottom: 0.65rem;
  animation: pop 0.4s var(--ease) both;
}

.pick:nth-child(1) {
  animation-delay: 0.05s;
}
.pick:nth-child(2) {
  animation-delay: 0.12s;
}
.pick:nth-child(3) {
  animation-delay: 0.19s;
}

.pick.is-top {
  border-color: var(--brand);
  background: linear-gradient(135deg, #f2fbf7, #fff 55%);
  box-shadow: 0 0 0 3px rgba(13, 122, 100, 0.1);
}

.pick .rank {
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--brand);
  background: var(--brand-soft);
  padding: 0.2rem 0.45rem;
  border-radius: 6px;
  grid-column: 1 / -1;
  width: fit-content;
}

.pick .emoji {
  font-size: 1.8rem;
}

.pick strong {
  display: block;
  font-size: 1.05rem;
}

.pick p {
  margin: 0.15rem 0 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.35;
}

.pick .pct {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 600;
  color: var(--brand-deep);
}

.note {
  display: flex;
  gap: 0.65rem;
  align-items: flex-start;
  background: var(--warn-soft);
  border: 1px solid #f0d7a0;
  border-radius: 12px;
  padding: 0.9rem 1rem;
  margin: 1rem 0 0;
  color: #7a4a08;
  font-size: 0.95rem;
  line-height: 1.4;
}

.note strong {
  display: block;
  margin-bottom: 0.15rem;
}

/* ---------- Admin guide ---------- */

.guide-layout {
  display: grid;
  gap: 1rem;
}

@media (min-width: 820px) {
  .guide-layout {
    grid-template-columns: 1.15fr 0.85fr;
    align-items: start;
  }
}

.video-frame {
  position: relative;
  aspect-ratio: 16 / 10;
  border-radius: 14px;
  overflow: hidden;
  background:
    linear-gradient(145deg, #1a3d34 0%, #0d7a64 45%, #2a5a40 100%);
  color: #fff;
  display: grid;
  place-items: center;
  isolation: isolate;
}

.video-frame::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.12), transparent 40%),
    radial-gradient(circle at 80% 70%, rgba(0, 0, 0, 0.25), transparent 45%);
  z-index: 0;
}

.video-frame .play {
  position: relative;
  z-index: 1;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: 0;
  background: rgba(255, 255, 255, 0.95);
  color: var(--brand-deep);
  font-size: 1.35rem;
  cursor: pointer;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
  transition: transform 0.2s var(--ease);
}

.video-frame .play:hover {
  transform: scale(1.06);
}

.video-meta {
  position: absolute;
  left: 1rem;
  bottom: 1rem;
  z-index: 1;
  font-size: 0.88rem;
  opacity: 0.92;
}

.steps {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.75rem;
}

.steps li {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.75rem;
  align-items: start;
}

.steps .n {
  width: 1.7rem;
  height: 1.7rem;
  border-radius: 50%;
  background: var(--brand-soft);
  color: var(--brand-deep);
  font-weight: 800;
  font-size: 0.85rem;
  display: grid;
  place-items: center;
}

.steps p {
  margin: 0;
  line-height: 1.4;
  font-size: 0.95rem;
}

.related {
  display: grid;
  gap: 0.55rem;
  margin-top: 0.75rem;
}

.related a {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.7rem;
  align-items: center;
  padding: 0.7rem 0.8rem;
  border-radius: 10px;
  border: 1px solid var(--line);
  color: inherit;
  text-decoration: none;
  background: #fff;
}

.related a:hover {
  border-color: var(--brand);
}

.related .thumb {
  width: 2.4rem;
  height: 2.4rem;
  border-radius: 8px;
  background: #1a3d34;
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 0.8rem;
}

.related strong {
  display: block;
  font-size: 0.92rem;
}

.related span {
  color: var(--muted);
  font-size: 0.82rem;
}

/* ---------- Check-in SMS ---------- */

.sms-shell {
  max-width: 420px;
  margin: 0 auto;
}

.sms-header {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  margin-bottom: 1rem;
}

.avatar {
  width: 2.6rem;
  height: 2.6rem;
  border-radius: 50%;
  background: var(--brand-soft);
  color: var(--brand-deep);
  font-weight: 800;
  display: grid;
  place-items: center;
}

.sms-header strong {
  display: block;
}

.live {
  color: var(--ok);
  font-size: 0.82rem;
  font-weight: 700;
}

.thread {
  display: grid;
  gap: 0.75rem;
}

.bubble {
  max-width: 92%;
  padding: 0.8rem 0.95rem;
  border-radius: 16px;
  line-height: 1.4;
  font-size: 0.95rem;
  animation: rise 0.35s var(--ease) both;
}

.bubble.them {
  background: #e8f2ee;
  border-bottom-left-radius: 5px;
  justify-self: start;
}

.bubble.me {
  background: var(--brand);
  color: #fff;
  border-bottom-right-radius: 5px;
  justify-self: end;
}

.bubble .time {
  display: block;
  margin-top: 0.35rem;
  font-size: 0.75rem;
  opacity: 0.7;
}

.quick-replies {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: 0.35rem;
}

.issue-grid {
  display: grid;
  gap: 0.45rem;
  margin-top: 0.55rem;
}

.issue-grid button {
  text-align: left;
  appearance: none;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 10px;
  padding: 0.7rem 0.85rem;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.9rem;
}

.issue-grid button:hover {
  border-color: var(--brand);
  background: #f3fbf8;
}

.refill-card {
  margin-top: 1rem;
  border: 1px solid #f0d7a0;
  background: linear-gradient(180deg, #fffaf0, #fff);
  border-radius: 14px;
  padding: 1rem;
}

.refill-card h3 {
  margin: 0 0 0.35rem;
  font-size: 1rem;
  display: flex;
  gap: 0.4rem;
  align-items: center;
}

.refill-card p {
  margin: 0 0 0.85rem;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.4;
}

/* ---------- Pharmacy ---------- */

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
  margin: 0 0 1.25rem;
}

@media (min-width: 720px) {
  .kpi-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

.kpi {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.9rem;
}

.kpi span {
  display: block;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 600;
}

.kpi strong {
  display: block;
  font-family: var(--font-display);
  font-size: 1.7rem;
  margin: 0.2rem 0;
  letter-spacing: -0.02em;
}

.kpi em {
  font-style: normal;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--ok);
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0 0 0.85rem;
}

.filter {
  appearance: none;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 999px;
  padding: 0.4rem 0.8rem;
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--muted);
  cursor: pointer;
}

.filter[aria-pressed="true"] {
  background: var(--ink);
  border-color: var(--ink);
  color: #fff;
}

.cases {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.cases th {
  text-align: left;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  padding: 0.55rem 0.4rem;
  border-bottom: 1px solid var(--line);
}

.cases td {
  padding: 0.85rem 0.4rem;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

.patient-cell {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.55rem;
  align-items: center;
}

.patient-cell .av {
  width: 2.1rem;
  height: 2.1rem;
  border-radius: 50%;
  background: var(--brand-soft);
  color: var(--brand-deep);
  font-size: 0.72rem;
  font-weight: 800;
  display: grid;
  place-items: center;
}

.patient-cell strong {
  display: block;
}

.patient-cell span {
  color: var(--muted);
  font-size: 0.8rem;
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-weight: 700;
  font-size: 0.85rem;
}

.dot {
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
}

.dot.green {
  background: var(--ok);
}
.dot.yellow {
  background: var(--amber);
}
.dot.red {
  background: var(--danger);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.cases tbody tr {
  cursor: pointer;
  transition: background 0.15s var(--ease);
}

.cases tbody tr:hover {
  background: #f3faf7;
}

.cases tbody tr.is-active {
  background: #eaf6f1;
}

.cases .btn.urgent {
  background: var(--danger);
  color: #fff;
}

.cases .btn.urgent:hover {
  background: #9f1239;
}

/* ---------- Patient detail drawer ---------- */

.drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(20, 36, 30, 0.35);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s var(--ease);
  z-index: 60;
}

.drawer-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

.drawer {
  position: fixed;
  top: 0;
  right: 0;
  height: 100%;
  width: min(420px, 100%);
  background: var(--surface);
  box-shadow: -16px 0 48px rgba(20, 36, 30, 0.16);
  transform: translateX(105%);
  transition: transform 0.3s var(--ease);
  z-index: 70;
  display: flex;
  flex-direction: column;
}

.drawer.open {
  transform: translateX(0);
}

.drawer-head {
  padding: 1.1rem 1.15rem 1rem;
  border-bottom: 1px solid var(--line);
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.75rem;
  align-items: start;
}

.drawer-head h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.25rem;
  letter-spacing: -0.02em;
}

.drawer-head .meta {
  margin: 0.25rem 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.drawer-close {
  appearance: none;
  border: 0;
  background: #eef4f1;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  cursor: pointer;
  font-size: 1.1rem;
  line-height: 1;
  color: var(--muted);
}

.drawer-close:hover {
  background: var(--brand-soft);
  color: var(--brand-deep);
}

.drawer-body {
  overflow-y: auto;
  padding: 1rem 1.15rem 1.5rem;
  flex: 1;
}

.drawer-rx {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.85rem 0.95rem;
  background: #f7fbf9;
  margin-bottom: 1rem;
}

.drawer-rx strong {
  display: block;
  font-size: 0.95rem;
}

.drawer-rx span {
  color: var(--muted);
  font-size: 0.88rem;
}

.drawer-status {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin-top: 0.55rem;
  font-weight: 700;
  font-size: 0.85rem;
}

.drawer-section {
  margin: 0 0 1rem;
}

.drawer-section h3 {
  margin: 0 0 0.65rem;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}

.drawer-thread {
  display: grid;
  gap: 0.55rem;
  margin-bottom: 0.25rem;
}

.drawer-thread .bubble {
  max-width: 100%;
  font-size: 0.9rem;
}

.drawer-banner {
  border-radius: 12px;
  padding: 0.85rem 0.95rem;
  font-size: 0.9rem;
  line-height: 1.4;
  margin-bottom: 1rem;
}

.drawer-banner strong {
  display: block;
  margin-bottom: 0.2rem;
  font-size: 0.95rem;
}

.drawer-banner.problem {
  background: var(--danger-soft);
  border: 1px solid #f3b4c2;
  color: #8f1d38;
}

.drawer-banner.noresponse {
  background: var(--warn-soft);
  border: 1px solid #f0d7a0;
  color: #7a4a08;
}

.drawer-banner.ontrack {
  background: var(--ok-soft);
  border: 1px solid #9ed4bc;
  color: #0b5c40;
}

.drawer-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  padding: 0.25rem 0.5rem;
  border-radius: 6px;
  margin-bottom: 0.55rem;
}

.drawer-badge.warn {
  background: #fde68a;
  color: #92400e;
}

.drawer-badge.ok {
  background: #bbf7d0;
  color: #166534;
}

.drawer-badge.danger {
  background: #fecdd3;
  color: #9f1239;
}

.drawer-meta-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.55rem;
  margin-bottom: 1rem;
}

.drawer-meta-card {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.7rem 0.8rem;
  background: #fff;
}

.drawer-meta-card span {
  display: block;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  margin-bottom: 0.25rem;
}

.drawer-meta-card strong {
  font-size: 0.95rem;
  font-weight: 700;
}

.flavor-history {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.4rem;
}

.flavor-history li {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  font-size: 0.9rem;
  padding: 0.45rem 0.55rem;
  border-radius: 8px;
  background: #f7fbf9;
  border: 1px solid var(--line);
}

.flavor-history li em {
  font-style: normal;
  color: var(--muted);
  font-size: 0.8rem;
}

.flavor-history li.current {
  border-color: var(--brand);
  background: #eef8f4;
}

.suggest-card {
  border-radius: 12px;
  padding: 0.85rem 0.95rem;
  margin-bottom: 1rem;
  background: linear-gradient(135deg, #f3fbf8, #fff8ef);
  border: 1px solid #c5e4d8;
}

.suggest-card .label {
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--brand-deep);
  margin-bottom: 0.35rem;
}

.suggest-card strong {
  display: block;
  font-size: 1rem;
  margin-bottom: 0.25rem;
}

.suggest-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.4;
}

.pending-checkin {
  border: 1.5px dashed #e8c56a;
  background: #fffdf5;
  border-radius: 12px;
  padding: 0.85rem 0.95rem;
  margin-bottom: 0.85rem;
}

.pending-checkin .preview {
  font-size: 0.9rem;
  color: var(--ink);
  line-height: 1.4;
  margin: 0.35rem 0 0;
}

.pending-checkin .ago {
  color: var(--warn);
  font-weight: 700;
  font-size: 0.82rem;
}

.drawer-actions {
  position: sticky;
  bottom: 0;
  margin: 0 -1.15rem -1.5rem;
  padding: 0.9rem 1.15rem 1.15rem;
  background: linear-gradient(180deg, transparent, #fff 28%);
  border-top: 1px solid var(--line);
}

.drawer-actions .actions {
  margin-top: 0.35rem;
}

.drawer-actions .hint {
  margin: 0 0 0.55rem;
  font-weight: 700;
  color: var(--ink);
  font-size: 0.85rem;
}

.drawer-actions.tone-problem {
  background: linear-gradient(180deg, transparent, #fff5f7 30%);
  border-top-color: #f3b4c2;
}

.drawer-actions.tone-noresponse {
  background: linear-gradient(180deg, transparent, #fffaf0 30%);
  border-top-color: #f0d7a0;
}

.btn.primary-danger {
  background: var(--danger);
  color: #fff;
}

.btn.primary-danger:hover {
  background: #9f1239;
}

.btn.primary-warn {
  background: var(--amber);
  color: #fff;
}

.btn.primary-warn:hover {
  background: #b45309;
}

.cases .btn.nudge {
  background: var(--warn-soft);
  color: #8a4b00;
  border-color: #f0d7a0;
}

.cases .btn.nudge:hover {
  background: #fde68a;
}

.onboard {
  margin-top: 1.25rem;
}

.onboard h2 {
  font-family: var(--font-display);
  font-size: 1.2rem;
  margin: 0 0 0.85rem;
}

.onboard-form {
  display: grid;
  gap: 0.65rem;
}

@media (min-width: 700px) {
  .onboard-form {
    grid-template-columns: 1fr 1fr;
    align-items: end;
  }

  .onboard-form .btn[type='submit'] {
    grid-column: 1 / -1;
    justify-self: start;
  }
}

/* ---------- Delivery modal ---------- */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(20, 36, 30, 0.4);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s var(--ease);
  z-index: 80;
}

.modal-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

.modal {
  position: fixed;
  left: 50%;
  top: 50%;
  width: min(520px, calc(100% - 1.5rem));
  max-height: min(90vh, 720px);
  overflow: auto;
  background: var(--surface);
  border-radius: 16px;
  box-shadow: 0 24px 60px rgba(20, 36, 30, 0.22);
  transform: translate(-50%, -46%) scale(0.98);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.25s var(--ease), opacity 0.25s var(--ease);
  z-index: 90;
}

.modal.open {
  transform: translate(-50%, -50%) scale(1);
  opacity: 1;
  pointer-events: auto;
}

.modal-head {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.1rem 1.2rem 0.85rem;
  border-bottom: 1px solid var(--line);
}

.modal-head h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.25rem;
}

.modal-head .meta {
  margin: 0.3rem 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.modal-body {
  padding: 1.1rem 1.2rem 1.3rem;
}

.delivery-options {
  display: grid;
  gap: 0.75rem;
}

.delivery-card {
  text-align: left;
  appearance: none;
  width: 100%;
  border: 1.5px solid var(--line);
  background: #fff;
  border-radius: 12px;
  padding: 0.95rem 1rem;
  cursor: pointer;
  transition: border-color 0.15s var(--ease), box-shadow 0.15s var(--ease);
}

.delivery-card:hover:not(:disabled) {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(13, 122, 100, 0.1);
}

.delivery-card:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.delivery-card strong {
  display: block;
  font-size: 1rem;
  margin-bottom: 0.2rem;
}

.delivery-card span {
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.35;
}

.delivery-card .tag {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: var(--brand-soft);
  color: var(--brand-deep);
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  margin-bottom: 0.4rem;
}

.qr-panel {
  text-align: center;
  padding: 0.5rem 0 0.25rem;
}

.qr-panel img {
  width: 220px;
  height: 220px;
  margin: 0 auto 0.85rem;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #fff;
}

.qr-panel .script {
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.45;
  margin: 0 0 1rem;
  text-align: left;
  background: #f7fbf9;
  border-radius: 10px;
  padding: 0.85rem 0.95rem;
  border: 1px solid var(--line);
}

.link-mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.78rem;
  word-break: break-all;
  color: var(--muted);
  margin: 0.5rem 0 0;
}

.await-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.78rem;
  font-weight: 700;
  color: #1e3a5f;
  background: #e8f0fe;
  border: 1px solid #c5d7f5;
  border-radius: 999px;
  padding: 0.35rem 0.65rem;
  white-space: nowrap;
}

.dot.blue {
  background: #2563eb;
}

.schedule-menu {
  position: absolute;
  z-index: 40;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 0.4rem;
  min-width: 180px;
}

.schedule-menu button {
  display: block;
  width: 100%;
  text-align: left;
  appearance: none;
  border: 0;
  background: transparent;
  padding: 0.55rem 0.7rem;
  border-radius: 8px;
  font: inherit;
  font-weight: 600;
  font-size: 0.88rem;
  cursor: pointer;
  color: var(--ink);
}

.composer {
  border: 1px solid #f3b4c2;
  background: #fff;
  border-radius: 12px;
  padding: 0.75rem;
  margin: 0.85rem 0;
}

.composer label {
  display: block;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--muted);
  margin-bottom: 0.4rem;
}

.composer textarea {
  width: 100%;
  min-height: 88px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.65rem 0.75rem;
  font: inherit;
  color: var(--ink);
  background: #fff;
}

.composer-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  align-items: center;
  margin-top: 0.55rem;
}

.composer select {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.45rem 0.75rem;
  font: inherit;
  font-weight: 600;
  font-size: 0.85rem;
  background: #fff;
  color: var(--ink);
}

.bubble.them.staff {
  background: var(--brand);
  color: #fff;
}

.bubble.them.staff .time {
  opacity: 0.8;
}

.bubble .src {
  display: block;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  opacity: 0.75;
  margin-bottom: 0.2rem;
}

.reform-modal {
  margin: 0.75rem 0;
  padding: 0.9rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f7fbf9;
}

.reform-modal .field {
  margin-bottom: 0.55rem;
}

.field {
  display: grid;
  gap: 0.3rem;
}

.field label {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--muted);
}

.field input,
.field select {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.65rem 0.75rem;
  background: #fff;
}

.hint {
  margin: 0.55rem 0 0;
  color: var(--muted);
  font-size: 0.85rem;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 1.25rem;
  transform: translateX(-50%) translateY(120%);
  background: var(--ink);
  color: #fff;
  padding: 0.75rem 1.1rem;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.92rem;
  z-index: 50;
  transition: transform 0.3s var(--ease);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.2);
}

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

@media (max-width: 700px) {
  .cases .hide-sm {
    display: none;
  }
}
