.hero {
  isolation: isolate;
  position: relative;
  overflow: hidden;
  color: var(--ink);
  border-radius: var(--r-lg);
  padding: 30px 34px 28px;
  min-height: 212px;
  display: flex;
  align-items: center;
  border: 1px solid rgba(255, 255, 255, 0.85);
  box-shadow: var(--shadow-card);
  background: repeating-conic-gradient(
      from 0deg at 78% 50%,
      rgba(255, 255, 255, 0.32) 0deg 6deg,
      transparent 6deg 16deg
    ),
    radial-gradient(circle at 78% 50%, #fff7fb 0%, #f9cfe0 45%, #f4b8d0 100%);
}
.hero h2 {
  font-size: clamp(26px, 2.8vw, 38px);
  letter-spacing: -1px;
  font-weight: 650;
}
.hero p {
  color: #5a4a57;
  line-height: 1.5;
  margin: 8px 0 22px;
  font-size: 15px;
  max-width: 390px;
}
.hero-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 14px;
}

/* ---------- Buttons ---------- */
.primary,
.secondary {
  min-height: 46px;
  justify-content: center;
}
.primary {
  background: var(--grad-primary);
  color: #fff;
  border-radius: var(--r-pill);
  padding: 12px 22px;
  font-weight: 650;
  font-size: 15px;
  box-shadow: var(--shadow-raised), inset 0 1px 0 rgba(255, 255, 255, 0.25);
  transition: transform 0.12s, box-shadow 0.12s;
}
.primary:hover {
  transform: translateY(-1px);
}
.primary:active {
  transform: translateY(1px);
  box-shadow: 0 4px 10px -6px rgba(194, 48, 106, 0.6);
}
.hero .textbtn {
  color: var(--rose-700);
  background: rgba(255, 255, 255, 0.75);
  padding: 10px 16px;
  border-radius: var(--r-pill);
}
.textbtn,
.rowlink {
  color: var(--rose-600);
  font-size: 14px;
  font-weight: 650;
  padding: 8px 0;
}
.textbtn svg,
.rowlink svg {
  width: 16px;
  height: 16px;
}
.hero-copy {
  position: relative;
  z-index: 1;
}
.soundprint {
  position: absolute;
  inset: 0 0 0 52%;
  z-index: -1;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  mask-image: linear-gradient(90deg, transparent, #000 15%, #000 85%, transparent);
}
.soundprint i {
  width: 4px;
  min-width: 3px;
  background: var(--rose-400);
  border-radius: 8px;
  opacity: 0.8;
}
.soundprint i:nth-child(3n) {
  background: #fff;
}
.soundprint i:nth-child(4n) {
  background: var(--sky-400);
}

/* ---------- Metrics: three soft tiles ---------- */
.metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin: 0 0 18px;
}
.metric {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 16px 18px;
  background: var(--surface);
  border: 1px solid rgba(255, 255, 255, 0.9);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-card);
}
.metric-icon,
.cardicon {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--rose-100);
  color: var(--rose-600);
  flex: none;
}
.metric:nth-child(2) .metric-icon {
  background: var(--reviewbg);
  color: var(--review);
}
.metric:nth-child(3) .metric-icon {
  background: var(--sky-100);
  color: var(--sky-700);
}
.metric strong {
  font-size: 28px;
  line-height: 1;
  font-weight: 650;
}
.metric span small {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-top: 4px;
}

/* ---------- Panels ---------- */
.columns {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(245px, 1fr);
  gap: 18px;
  align-items: start;
  margin-top: 18px;
}
.panel {
  background: var(--surface);
  border: 1px solid rgba(255, 255, 255, 0.9);
  border-radius: var(--r-lg);
  padding: 22px 22px 14px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-card);
}
.hero + .panel {
  margin-top: 18px;
}
.panel-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 12px;
  margin-bottom: 10px;
}
.panel-head h2 {
  font-size: 19px;
}
.panel-head .rowlink {
  white-space: nowrap;
  font-size: 13px;
}
.visitrow {
  display: flex;
  width: 100%;
  text-align: left;
  align-items: center;
  gap: 12px;
  padding: 11px 12px;
  margin: 0 -12px;
  width: calc(100% + 24px);
  border-radius: var(--r-sm);
  border-top: 0;
  transition: background 0.12s;
}
.visitrow + .visitrow {
  box-shadow: 0 -1px 0 var(--line);
}
.visitrow:hover {
  background: var(--rose-50);
  box-shadow: none;
}
.visitrow:hover + .visitrow {
  box-shadow: none;
}
.visitrow .grow {
  flex: 1;
  min-width: 0;
}
.visitrow strong {
  display: block;
  font-size: 15px;
  font-weight: 630;
}
.visitrow small {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}
.tag {
  padding: 5px 10px;
  border-radius: var(--r-pill);
  font-size: 11px;
  font-weight: 650;
  color: var(--green);
  background: var(--greenbg);
  white-space: nowrap;
}
.tag.flag {
  color: var(--review);
  background: var(--reviewbg);
}
.tag.gray {
  color: #655b6a;
  background: #f2ebef;
}
.visitrow > svg {
  color: var(--rose-300);
  width: 14px;
}
.rightpanel .visitrow {
  gap: 9px;
}
.rightpanel .visitrow .avatar {
  width: 34px;
  height: 34px;
}
.rightpanel .visitrow time {
  font-size: 12px;
  font-weight: 600;
  color: var(--rose-600);
  background: var(--rose-100);
  padding: 4px 9px;
  border-radius: var(--r-pill);
}
.rightpanel .rowlink {
  margin-top: 6px;
}

/* ---------- Forms ---------- */
.filters {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 15px;
}
select,
input,
textarea {
  padding: 11px 14px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  background: var(--surface-solid);
  color: var(--ink);
  max-width: 100%;
  transition: border-color 0.12s, box-shadow 0.12s;
}
select:hover,
input:hover,
textarea:hover {
  border-color: var(--rose-300);
}
select:focus,
input:focus,
textarea:focus {
  border-color: var(--rose-400);
  box-shadow: 0 0 0 4px var(--rose-100);
}
.filters input,
.filters select {
  border-radius: var(--r-pill);
}
.filters input {
  flex: 1;
  min-width: 140px;
}
input[type='checkbox'],
input[type='radio'] {
  accent-color: var(--rose-600);
  width: 18px;
  height: 18px;
}
.empty,
.notice {
  font-size: 14px;
  color: var(--muted);
  line-height: 1.5;
  padding: 12px 0;
}
.notice {
  background: var(--rose-50);
  border: 1px solid var(--rose-100);
  padding: 12px 16px;
  border-radius: var(--r-sm);
  margin: 12px 0;
}
.notice.warn {
  background: var(--reviewbg);
  border-color: #fbd9c6;
  color: #7a3416;
}
.queue {
  margin-bottom: 16px;
}
.actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 16px;
}

/* ---------- Sheet (dialog) ---------- */
.visitrow.overdue-row {
  border-inline-start: 4px solid var(--review, #963f35);
  background: var(--reviewbg, #ffebe4);
}
.visitrow.overdue-row time {
  color: var(--review, #963f35);
  font-weight: 700;
}
.panel.anm-voice {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}
.panel.anm-voice .sub {
  flex: 1 1 16rem;
  margin: 0;
}

/* ---------- Home: today card, quick actions, demo controls ---------- */
.today-card .panel-head {
  align-items: center;
  gap: 12px;
}
.today-card .panel-head .secondary {
  margin-inline-start: auto;
}
.today-tiles {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  margin: 4px 0 12px;
}
.today-tile {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px;
  border-radius: 16px;
  background: var(--paper, #f8f8fc);
  border: 1px solid var(--line, #e1e2ea);
  min-width: 0;
}
.today-tile strong {
  font-size: 1.7rem;
  line-height: 1;
}
.today-tile small {
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.25;
  overflow-wrap: anywhere;
}
.today-tile.alert {
  background: var(--reviewbg, #fff0e6);
  border-color: transparent;
}
.today-tile.alert strong {
  color: var(--review, #b13a1e);
}
.today-card .hint {
  margin: 10px 0 0;
  font-size: 0.88rem;
}
.quick-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin: 0 0 18px;
}
button.quick {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 64px;
  padding: 12px 16px;
  border-radius: 18px;
  background: white;
  border: 1px solid var(--line, #e1e2ea);
  font-weight: 650;
  text-align: start;
}
button.quick svg {
  color: var(--rose-600, #c2185b);
  width: 22px;
  height: 22px;
}
.demo-controls {
  margin: 18px 0 8px;
  padding: 4px 16px 12px;
  border: 1px dashed var(--line-strong, #c9c1d5);
  border-radius: 16px;
  color: var(--muted);
}
.demo-controls summary {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 48px;
  cursor: pointer;
  font-size: 0.9rem;
}
.demo-controls[open] summary {
  margin-bottom: 8px;
}
.demo-controls label {
  display: grid;
  gap: 6px;
  margin-top: 10px;
}
@media (max-width: 660px) {
  /* Three across, then two wider tiles, so the grid has no gap. */
  .today-tiles {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }
  .today-tile {
    grid-column: span 2;
  }
  .today-tile:nth-child(n + 4) {
    grid-column: span 3;
  }
}

/* ---------- Supervisor: filters, worker summary, case sheet ---------- */
@media (max-width: 660px) {
  .panel .filters {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .panel .filters select,
  .panel .filters input {
    width: 100%;
    min-width: 0;
  }
  .panel .filters > :last-child:nth-child(odd) {
    grid-column: 1 / -1;
  }
}
.worker-summary {
  display: grid;
  gap: 8px;
}
.worker-row {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) repeat(3, minmax(0, 1fr));
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 14px;
  background: var(--paper, #f8f8fc);
}
.worker-row span {
  display: flex;
  flex-direction: column;
  font-size: 0.78rem;
  color: var(--muted);
  line-height: 1.2;
}
.worker-row span b {
  font-size: 1.15rem;
  color: var(--ink);
}
.worker-row span.alert b {
  color: var(--review, #b13a1e);
}
.case-actions {
  margin: 4px 0 16px;
}
.contact-block {
  margin-top: 16px;
  padding: 14px;
  border-radius: 16px;
  background: var(--paper, #f8f8fc);
  display: grid;
  gap: 10px;
}
.contact-block label {
  display: grid;
  gap: 6px;
}
.contact-block #callWorker:not(:empty) {
  justify-self: start;
  padding: 12px 18px;
  border-radius: var(--r-pill, 999px);
  background: var(--grad-primary);
  color: white;
  font-weight: 700;
  text-decoration: none;
}
/* The confirm buttons of the visit check stay in reach at the bottom. */
#sheet[data-stage='review'] #sheetBody > .actions:last-child {
  position: sticky;
  bottom: -1px;
  z-index: 2;
  margin: 12px -4px 0;
  padding: 12px 4px calc(12px + env(safe-area-inset-bottom));
  background: linear-gradient(to bottom, transparent, white 18%);
}
@media (max-width: 660px) {
  .worker-row {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .worker-row strong {
    grid-column: 1 / -1;
  }
}
