:root {
  color-scheme: light;
  --ink: #2d2422;
  --muted: #756764;
  --line: #ead9d1;
  --bg: #fff7f3;
  --panel: #ffffff;
  --navy: #174b64;
  --teal: #247f73;
  --mint: #dff4ee;
  --coral: #f67561;
  --coral-strong: #d95849;
  --coral-deep: #a94436;
  --peach: #ffe4dc;
  --amber: #b97624;
  --rose: #b94352;
  --rose-soft: #fde8e4;
  --green-soft: #e7f4dd;
  --sidebar: #543b37;
  --shadow: 0 18px 45px rgba(88, 54, 44, 0.13);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Noto Sans KR", "Segoe UI", sans-serif;
  font-size: 16px;
}

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

button {
  cursor: pointer;
}

.auth-screen {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 20px;
  background: var(--bg);
}

.auth-screen.hidden {
  display: none;
}

.auth-card {
  width: min(100%, 420px);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 24px;
  background: #fff;
  box-shadow: var(--shadow);
}

.auth-brand {
  color: var(--ink);
  margin-bottom: 22px;
}

.auth-brand span {
  color: var(--muted);
}

.auth-card h1 {
  margin-bottom: 8px;
}

.auth-card p {
  color: var(--muted);
  line-height: 1.6;
}

.login-help {
  margin: 8px 0 0;
  font-size: 14px;
  font-weight: 800;
  color: var(--coral-deep) !important;
}

.login-form {
  margin: 18px 0 12px;
}

.auth-message {
  min-height: 22px;
  margin: 10px 0;
  color: var(--rose);
  font-weight: 800;
}

.recent-visit-list {
  display: grid;
  gap: 12px;
}

.recent-visit-item {
  display: grid;
  gap: 8px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.recent-visit-item.needs-review {
  border-color: #f0b5aa;
  background: var(--rose-soft);
}

.recent-visit-item strong {
  display: block;
  font-size: 18px;
  color: var(--navy);
}

.recent-visit-item span,
.recent-visit-item p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.recent-visit-item em {
  justify-self: start;
  padding: 6px 10px;
  border-radius: 999px;
  background: var(--peach);
  color: var(--coral-deep);
  font-style: normal;
  font-weight: 900;
}

.app-shell {
  display: grid;
  grid-template-columns: 280px 1fr;
  min-height: 100vh;
}

.sidebar {
  background:
    linear-gradient(180deg, rgba(246, 117, 97, 0.12), rgba(36, 127, 115, 0.07)),
    var(--sidebar);
  color: #fff;
  padding: 28px 22px;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

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

.brand-logo {
  width: 48px;
  height: 48px;
  border-radius: 8px;
  object-fit: cover;
  background: var(--coral);
  box-shadow: 0 8px 18px rgba(75, 43, 36, 0.22);
}

.brand strong,
.brand span {
  display: block;
}

.brand span {
  margin-top: 2px;
  color: rgba(255, 255, 255, 0.72);
  font-size: 13px;
}

.partner-badge {
  display: grid;
  gap: 10px;
  padding: 13px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.1);
}

.partner-badge span {
  color: rgba(255, 255, 255, 0.78);
  font-size: 13px;
  font-weight: 800;
}

.partner-badge img,
.county-mark img {
  display: block;
  max-width: 100%;
  object-fit: contain;
}

.partner-badge img {
  width: 142px;
  padding: 8px 10px;
  border-radius: 8px;
  background: #fff;
}

.role-card {
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.08);
}

.role-card label {
  color: rgba(255, 255, 255, 0.78);
}

.role-card select {
  min-height: 44px;
  margin-top: 7px;
  border: 0;
}

.role-card small {
  display: block;
  margin-top: 9px;
  color: rgba(255, 255, 255, 0.7);
  line-height: 1.5;
}

.nav {
  display: grid;
  gap: 8px;
}

.nav-item {
  border: 0;
  border-radius: 8px;
  padding: 14px;
  background: transparent;
  color: rgba(255, 255, 255, 0.78);
  text-align: left;
  font-size: 15px;
  font-weight: 800;
}

.nav-item.active,
.nav-item:hover {
  background: rgba(246, 117, 97, 0.24);
  color: #fff;
}

.sidebar-note {
  margin-top: auto;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  padding: 18px;
  background: rgba(255, 255, 255, 0.08);
}

.sidebar-note span,
.sidebar-note small {
  display: block;
  color: rgba(255, 255, 255, 0.72);
}

.sidebar-note strong {
  display: block;
  margin: 6px 0;
  font-size: 30px;
}

.main {
  padding: 28px;
  overflow: hidden;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 24px;
}

.county-mark {
  margin-left: auto;
  padding: 8px 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 10px 24px rgba(88, 54, 44, 0.08);
}

.county-mark img {
  width: 118px;
  height: 40px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--coral-deep);
  font-size: 14px;
  font-weight: 700;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: 30px;
}

h2 {
  margin-bottom: 0;
  font-size: 18px;
}

.top-actions {
  display: flex;
  gap: 10px;
}

.primary-button,
.secondary-button,
.icon-button {
  border: 0;
  border-radius: 8px;
  min-height: 48px;
  padding: 0 18px;
  font-weight: 800;
}

.primary-button {
  background: var(--coral-strong);
  color: #fff;
}

.secondary-button,
.icon-button {
  background: #f3e9e4;
  color: var(--coral-deep);
}

.full {
  width: 100%;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.mobile-worker-home {
  display: block;
  margin-bottom: 18px;
}

.worker-home-panel,
.submission-panel,
.group-form-panel {
  margin-bottom: 18px;
}

.worker-home-grid,
.participant-list,
.group-activity-form {
  display: grid;
  gap: 14px;
}

.worker-home-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.worker-home-card {
  min-height: 120px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.worker-home-card strong {
  display: block;
  margin-bottom: 8px;
  color: var(--navy);
}

.worker-home-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.compact-metrics {
  margin-bottom: 16px;
}

.group-section {
  display: grid;
  gap: 14px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f9fbfa;
}

.group-section h3 {
  margin: 0;
  color: var(--navy);
  font-size: 17px;
}

.segmented-row,
.participant-tools,
.phrase-row,
.group-submit-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.segmented-row label {
  min-height: 44px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  font-weight: 800;
}

.participant-tools input {
  flex: 1 1 220px;
}

.participant-list {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  max-height: 360px;
  overflow: auto;
}

.participant-row {
  display: flex;
  gap: 10px;
  align-items: center;
  min-height: 58px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.participant-row span,
.participant-row small {
  display: block;
}

.participant-row small {
  margin-top: 3px;
  color: var(--muted);
}

.risk-report-fields {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid #e5b3b8;
  border-radius: 8px;
  background: var(--rose-soft);
}

.risk-report-fields.emergency-highlight {
  border-width: 2px;
  border-color: var(--rose);
}

.group-submit-bar {
  position: sticky;
  bottom: 0;
  z-index: 5;
  justify-content: flex-end;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 -8px 28px rgba(21, 44, 58, 0.08);
}

.group-submit-bar .draft-status {
  margin-right: auto;
}

.legacy-visit-layout {
  margin-top: 18px;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.metric,
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.metric {
  padding: 18px;
}

.metric span,
.metric small {
  color: var(--muted);
}

.metric strong {
  display: block;
  margin: 8px 0 4px;
  font-size: 34px;
}

.metric.warning strong {
  color: var(--rose);
}

.metric.good strong {
  color: var(--coral-strong);
}

.content-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

.admin-ops {
  margin-top: 18px;
}

.admin-command-center {
  margin-bottom: 18px;
}

.admin-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(340px, 0.7fr);
  gap: 18px;
}

.operations-grid {
  grid-template-columns: minmax(720px, 1fr) minmax(320px, 0.38fr);
}

.operations-panel {
  min-width: 0;
}

.panel-subtitle {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

.admin-worker-cards {
  display: grid;
  grid-template-columns: repeat(4, minmax(180px, 1fr));
  gap: 12px;
}

.admin-worker-card {
  display: grid;
  gap: 8px;
  min-height: 148px;
  padding: 16px;
  border: 1px solid var(--line);
  border-left: 7px solid var(--coral);
  border-radius: 8px;
  background: #fff;
}

.admin-worker-card.needs-review {
  border-left-color: var(--rose);
  background: #fff3ef;
}

.admin-worker-card.in-progress {
  border-left-color: var(--amber);
  background: #fffaf1;
}

.admin-worker-card.complete {
  background: #fff8f4;
}

.admin-worker-card strong,
.admin-worker-card b {
  display: block;
  color: var(--navy);
}

.admin-worker-card strong {
  font-size: 19px;
}

.admin-worker-card b {
  font-size: 30px;
  line-height: 1;
}

.admin-worker-card span,
.admin-worker-card p,
.admin-worker-card small {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.admin-worker-card small {
  font-weight: 800;
}

.service-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.service-legend span {
  padding: 7px 10px;
  border-radius: 999px;
  background: #fff1ec;
  color: var(--navy);
  font-size: 13px;
  font-weight: 900;
}

.admin-filter-bar {
  display: grid;
  grid-template-columns: minmax(180px, 260px) minmax(260px, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}

.admin-feedback-form {
  display: grid;
  grid-template-columns: minmax(160px, 1fr) minmax(160px, 1fr);
  gap: 12px;
  margin-bottom: 16px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff8f4;
}

.admin-feedback-form .wide-field,
.admin-feedback-form button {
  grid-column: 1 / -1;
}

.admin-elder-edit {
  margin-bottom: 18px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff8f4;
}

.sheet-export-panel {
  display: grid;
  gap: 14px;
  margin: 16px 0;
  padding: 16px;
  border: 1px solid #f0cfc6;
  border-radius: 8px;
  background: #fff8f4;
}

.sheet-export-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.sheet-export-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.compact-header {
  margin-bottom: 12px;
}

.compact-header h3 {
  margin: 0;
  font-size: 17px;
}

.edit-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(160px, 1fr));
  gap: 12px;
}

.wide-field {
  grid-column: 1 / -1;
}

.consent-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  margin: 12px 0 14px;
  font-weight: 800;
  color: var(--navy);
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  margin-bottom: 16px;
  background: #fff;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
}

.admin-table th,
.admin-table td {
  border-bottom: 1px solid var(--line);
  padding: 11px 12px;
  text-align: left;
  vertical-align: top;
  font-size: 14px;
}

.admin-table th {
  background: #fff1ec;
  color: var(--navy);
  font-weight: 900;
  white-space: nowrap;
}

.admin-table tr:last-child td {
  border-bottom: 0;
}

.admin-operations-table {
  min-width: 1080px;
}

.admin-operations-table tr.worker-group-a td {
  background: #fff9f5;
}

.admin-operations-table tr.worker-group-b td {
  background: #ffffff;
}

.admin-operations-table tr:nth-child(5n) td {
  border-bottom: 3px solid #b9cbd5;
}

.admin-operations-table td:first-child strong,
.admin-operations-table td:nth-child(2) strong {
  display: block;
  color: var(--navy);
  font-size: 15px;
}

.admin-operations-table td:first-child small,
.admin-operations-table td:nth-child(2) small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  line-height: 1.45;
}

.round-badge,
.care-status,
.service-tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 58px;
  border-radius: 8px;
  padding: 7px 8px;
  font-size: 13px;
  font-weight: 900;
  line-height: 1.25;
  text-align: center;
}

.round-badge small {
  font-size: 11px;
}

.round-badge.done {
  background: var(--peach);
  color: var(--coral-deep);
}

.round-badge.review {
  background: var(--rose-soft);
  color: var(--rose);
}

.round-badge.pending {
  background: #eef3f5;
  color: var(--muted);
}

.care-status {
  min-width: 86px;
}

.status-ok {
  background: var(--peach);
  color: var(--coral-deep);
}

.status-warning,
.status-missing {
  background: #fff1d8;
  color: #9b5d13;
}

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

.status-link {
  background: #e2efff;
  color: #245f9d;
}

.service-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.service-tag {
  min-width: auto;
  padding: 6px 8px;
}

.service-ok {
  background: var(--peach);
  color: var(--coral-deep);
}

.service-missing,
.service-body {
  background: #fff1d8;
  color: #9b5d13;
}

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

.service-link {
  background: #e2efff;
  color: #245f9d;
}

.service-mind {
  background: #f3e8ff;
  color: #6b3aa0;
}

.service-meal {
  background: #eaf3cf;
  color: #4c6c16;
}

.service-cognition {
  background: #e3f4f3;
  color: #116d68;
}

.admin-review-note {
  min-width: 210px;
  margin: 0;
  color: var(--ink);
  font-weight: 700;
  line-height: 1.45;
}

.panel-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.compact-button {
  min-height: 34px;
  padding: 7px 10px;
  font-size: 13px;
}

.next-action-panel {
  margin-top: 18px;
}

.panel {
  padding: 20px;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
}

.badge {
  border-radius: 999px;
  background: var(--mint);
  color: var(--teal);
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

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

.stack-list,
.request-list {
  display: grid;
  gap: 10px;
}

.risk-item,
.request-item,
.elder-card,
.report-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fbfcfb;
}

.risk-item {
  border-left: 5px solid var(--rose);
}

.risk-item strong,
.request-item strong,
.elder-card strong {
  display: block;
  margin-bottom: 5px;
}

.meta {
  color: var(--muted);
  font-size: 13px;
}

.assessment-layout {
  align-items: start;
}

.assessment-form {
  display: grid;
  gap: 18px;
}

.assessment-simple-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.assessment-guide,
.assessment-score-box,
.assessment-record-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.assessment-guide {
  display: grid;
  gap: 6px;
  padding: 16px;
  background: var(--green-soft);
}

.assessment-guide strong {
  color: var(--teal);
  font-size: 22px;
}

.assessment-guide span {
  color: var(--muted);
  line-height: 1.55;
}

.assessment-questions {
  display: grid;
  gap: 12px;
}

.assessment-question-card {
  display: grid;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.assessment-question-card p {
  margin: 0;
  color: var(--ink);
  font-size: 18px;
  font-weight: 850;
  line-height: 1.5;
}

.assessment-choice-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.assessment-choice-row label {
  position: relative;
  flex: 1 1 110px;
}

.assessment-choice-row input {
  position: absolute;
  opacity: 0;
}

.assessment-choice-row span {
  display: grid;
  min-height: 54px;
  place-items: center;
  border: 2px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--muted);
  font-size: 18px;
  font-weight: 900;
}

.assessment-choice-row input:checked + span {
  border-color: var(--teal);
  background: var(--mint);
  color: var(--teal);
}

.assessment-score-box {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 14px;
  align-items: center;
  padding: 18px;
  background: var(--sidebar);
  color: #fff;
}

.assessment-score-box strong {
  font-size: 26px;
}

.assessment-score-box p {
  margin: 6px 0 0;
  color: rgba(255, 255, 255, 0.78);
  line-height: 1.5;
}

.assessment-level {
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
  font-weight: 1000;
  white-space: nowrap;
}

.assessment-level.warn,
.assessment-record-item b.warn {
  background: #fff0bf;
  color: #745214;
}

.assessment-level.danger,
.assessment-record-item b.danger {
  background: var(--rose-soft);
  color: var(--rose);
}

.assessment-record-item {
  display: grid;
  gap: 10px;
  padding: 16px;
}

.assessment-record-item strong,
.assessment-record-item span {
  display: block;
}

.assessment-record-item strong {
  color: var(--navy);
  font-size: 20px;
}

.assessment-record-item span,
.assessment-record-item p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.assessment-record-item b {
  justify-self: start;
  padding: 8px 12px;
  border-radius: 999px;
  background: var(--green-soft);
  color: var(--teal);
}

.timeline {
  display: grid;
  gap: 12px;
  margin: 0;
  padding-left: 20px;
}

.timeline li {
  padding-left: 6px;
}

.split-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(280px, 0.55fr);
  gap: 18px;
}

form {
  display: grid;
  gap: 16px;
}

.mobile-stepper {
  display: flex;
  gap: 9px;
  align-items: center;
  justify-content: center;
  margin-bottom: 6px;
}

.step-dot {
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #fff;
  color: var(--muted);
  font-weight: 900;
  cursor: pointer;
}

.step-dot.active {
  border-color: var(--coral-strong);
  background: var(--coral-strong);
  color: #fff;
}

.step-dot.done {
  border-color: var(--coral);
  background: var(--peach);
  color: var(--coral-deep);
}

.form-step {
  display: none;
  gap: 16px;
  scroll-margin-top: 14px;
}

.form-step.active {
  display: grid;
}

.step-title {
  border-radius: 8px;
  padding: 14px;
  background: #fff1ec;
}

.step-title strong,
.step-title span {
  display: block;
}

.step-title strong {
  font-size: 18px;
  color: var(--coral-deep);
}

.step-title span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 14px;
}

label,
fieldset {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 15px;
  font-weight: 800;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  min-height: 48px;
  padding: 12px 13px;
}

textarea {
  resize: vertical;
}

fieldset {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
}

legend {
  padding: 0 6px;
  color: var(--muted);
}

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

.check-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.check-pill,
.toggle-row {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 54px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px 12px;
  background: #fff;
  color: var(--ink);
  font-size: 15px;
  font-weight: 800;
}

.check-pill input,
.toggle-row input {
  width: 20px;
  height: 20px;
  flex: none;
}

.check-pill:has(input:checked),
.toggle-row:has(input:checked) {
  border-color: var(--coral-strong);
  background: var(--peach);
}

.check-pill.urgent {
  border-color: #f1b6bb;
  background: #fff8f8;
}

.check-pill.urgent:has(input:checked) {
  border-color: var(--rose);
  background: var(--rose-soft);
}

.plain-list {
  padding-left: 18px;
  color: var(--ink);
  line-height: 1.75;
}

.soft-box {
  margin-top: 16px;
  border-radius: 8px;
  padding: 15px;
  background: var(--green-soft);
}

.soft-box p {
  margin: 7px 0 0;
  color: var(--muted);
}

.field-help {
  margin: 2px 0 0;
  color: var(--rose);
  font-size: 13px;
  font-weight: 800;
}

.field-help.neutral {
  color: var(--muted);
}

.emergency-box {
  border-color: #f1b6bb;
  background: #fffafa;
}

.question-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
}

.followup-section {
  background: #fbf7ee;
  border-color: #ead8b9;
}

.followup-list {
  display: grid;
  gap: 14px;
}

.followup-group {
  display: grid;
  gap: 10px;
}

.followup-group strong {
  color: var(--amber);
}

.hidden {
  display: none !important;
}

.form-preview,
.next-action-item,
.feedback-item {
  border: 1px solid var(--line);
  border-left: 5px solid var(--amber);
  border-radius: 8px;
  padding: 14px;
  background: #fffdf7;
}

.form-preview strong,
.next-action-item strong,
.feedback-item strong {
  display: block;
  margin-bottom: 6px;
}

.form-preview p,
.next-action-item p,
.feedback-item p {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.draft-status {
  border-radius: 8px;
  padding: 12px 14px;
  background: #fff1ec;
  color: var(--coral-deep);
  font-size: 14px;
  font-weight: 800;
}

.mobile-form-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.mobile-elder-list {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}

.install-hint {
  border: 1px solid var(--line);
  border-left: 5px solid var(--coral);
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 12px;
  background: #fff8f4;
}

.install-hint strong {
  display: block;
  margin-bottom: 5px;
  color: var(--coral-deep);
}

.install-hint p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
}

.mobile-elder-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 10px;
  min-height: 168px;
  padding: 18px;
  background: #fff;
  color: var(--ink);
  text-align: left;
  box-shadow: 0 8px 20px rgba(102, 55, 42, 0.08);
}

.mobile-elder-card span,
.mobile-elder-card strong,
.mobile-elder-card small {
  display: block;
}

.mobile-elder-card strong {
  font-size: 24px;
  line-height: 1.15;
}

.mobile-elder-card small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.35;
}

.elder-sub-info b {
  color: var(--navy);
  font-size: 18px;
}

.elder-tap-label {
  display: flex;
  min-height: 52px;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: var(--coral-strong);
  color: #fff;
  font-size: 20px;
  font-weight: 900;
}

.elder-tap-label.needs-review {
  background: var(--rose);
}

.visit-rounds {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  margin: 4px 0 10px;
}

.visit-rounds.simple-rounds {
  grid-template-columns: 1fr 1fr;
  margin: 0;
}

.visit-rounds span {
  display: grid;
  min-height: 48px;
  align-content: center;
  justify-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 4px;
  background: #fff8f4;
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}

.visit-rounds span.done {
  border-color: #f1b5aa;
  background: var(--peach);
  color: var(--coral-deep);
}

.visit-rounds span.current {
  border-color: #e7bd84;
  background: #fff4df;
  color: var(--amber);
}

.visit-rounds small {
  overflow: hidden;
  width: 100%;
  margin-top: 2px;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 11px;
}

.mobile-elder-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.mobile-focus-box {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.mobile-focus-box > div {
  border: 1px solid #f0cfc6;
  border-left: 6px solid var(--coral);
  border-radius: 8px;
  padding: 12px;
  background: #fff8f4;
}

.mobile-focus-box > div.focus-alert {
  border-color: #edc3c8;
  border-left-color: var(--rose);
  background: var(--rose-soft);
}

.mobile-focus-box b {
  display: inline-flex;
  margin-bottom: 5px;
  border-radius: 999px;
  padding: 4px 8px;
  background: var(--coral-strong);
  color: #fff;
  font-size: 12px;
  line-height: 1;
}

.mobile-focus-box .focus-alert b {
  background: var(--rose);
}

.mobile-focus-box p {
  color: var(--ink);
  font-weight: 800;
}

.group-form-panel.admin-only:not(.active-admin-panel) {
  display: none;
}

.privacy-box {
  border: 1px solid var(--line);
  border-left: 5px solid var(--coral);
  border-radius: 8px;
  padding: 14px;
  background: #fff8f4;
}

.privacy-box strong {
  display: block;
  margin-bottom: 6px;
  color: var(--coral-deep);
}

.privacy-box p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.elder-grid,
.report-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.tag {
  border-radius: 999px;
  padding: 5px 8px;
  background: #eef3f5;
  color: var(--navy);
  font-size: 12px;
  font-weight: 800;
}

.status {
  display: inline-flex;
  border-radius: 999px;
  padding: 5px 9px;
  font-size: 12px;
  font-weight: 900;
}

.status.open {
  background: var(--rose-soft);
  color: var(--rose);
}

.status.progress {
  background: #fff0d9;
  color: var(--amber);
}

.status.done {
  background: var(--green-soft);
  color: var(--teal);
}

@media (max-width: 980px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    padding: 16px;
    gap: 14px;
  }

  .nav {
    grid-template-columns: repeat(6, minmax(120px, 1fr));
    overflow-x: auto;
  }

  .sidebar-note {
    display: none;
  }

  .mobile-worker-home {
    display: block;
  }

  .metric-grid,
  .content-grid,
  .admin-grid,
  .admin-worker-cards,
  .split-layout,
  .elder-grid,
  .report-grid,
  .question-grid,
  .worker-home-grid,
  .participant-list,
  .mobile-elder-list,
  .sheet-export-grid {
    grid-template-columns: 1fr;
  }

  .admin-filter-bar {
    grid-template-columns: 1fr;
  }

  .admin-feedback-form {
    grid-template-columns: 1fr;
  }

  .edit-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  body {
    font-size: 19px;
  }

  .main {
    padding: 10px;
    padding-bottom: 104px;
  }

  .auth-screen {
    align-items: stretch;
    padding: 10px;
  }

  .auth-card {
    align-self: center;
    padding: 22px;
  }

  .auth-card h1 {
    font-size: 32px;
  }

  label {
    gap: 9px;
    font-size: 19px;
  }

  input,
  select,
  textarea {
    min-height: 56px;
    padding: 14px 15px;
    font-size: 20px;
  }

  textarea {
    min-height: 112px;
  }

  button,
  .primary-button,
  .secondary-button {
    min-height: 56px;
    font-size: 19px;
  }

  .sidebar {
    padding: 12px;
    gap: 12px;
  }

  .brand strong {
    font-size: 19px;
  }

  .brand-logo {
    width: 42px;
    height: 42px;
  }

  .brand span {
    font-size: 14px;
  }

  .nav {
    grid-template-columns: repeat(3, minmax(104px, 1fr));
    gap: 8px;
  }

  .nav-item {
    min-height: 54px;
    padding: 12px 8px;
    font-size: 17px;
  }

  .topbar,
  .top-actions,
  .two-cols {
    align-items: stretch;
    flex-direction: column;
    grid-template-columns: 1fr;
  }

  .county-mark {
    align-self: flex-start;
    margin-left: 0;
  }

  .check-grid {
    grid-template-columns: 1fr;
  }

  .worker-home-grid,
  .participant-list,
  .sheet-export-grid,
  .assessment-simple-grid {
    grid-template-columns: 1fr;
  }

  .group-section {
    padding: 14px;
  }

  .segmented-row,
  .participant-tools,
  .phrase-row,
  .group-submit-bar {
    align-items: stretch;
    flex-direction: column;
  }

  .group-submit-bar .draft-status {
    margin-right: 0;
  }

  .metric-grid {
    gap: 8px;
  }

  .metric {
    padding: 16px;
  }

  .metric strong {
    font-size: 34px;
  }

  .panel {
    padding: 16px;
  }

  .panel-header h2 {
    font-size: 23px;
  }

  .mobile-elder-card {
    min-height: 190px;
    padding: 20px;
  }

  .mobile-elder-card strong {
    font-size: 28px;
  }

  .mobile-elder-card small {
    font-size: 18px;
  }

  .elder-sub-info b {
    font-size: 20px;
  }

  .elder-tap-label {
    min-height: 60px;
    font-size: 23px;
  }

  .visit-rounds {
    gap: 8px;
    margin: 6px 0 12px;
  }

  .visit-rounds span {
    min-height: 60px;
    font-size: 17px;
  }

  .visit-rounds small {
    font-size: 13px;
  }

  .check-pill,
  .radio-card,
  .assessment-choice-row span {
    min-height: 58px;
    padding: 14px;
    font-size: 19px;
  }

  .assessment-score-box {
    grid-template-columns: 1fr;
  }

  .step-title strong {
    font-size: 22px;
  }

  .step-title span,
  .helper-text,
  .meta {
    font-size: 16px;
  }

  .recent-visit-item {
    padding: 18px;
  }

  .recent-visit-item strong {
    font-size: 22px;
  }

  .recent-visit-item span,
  .recent-visit-item p {
    font-size: 17px;
  }

  .mobile-form-actions {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 30;
    padding: 12px;
    background: rgba(245, 247, 244, 0.96);
    border-top: 1px solid var(--line);
  }

  .mobile-form-actions .hidden {
    display: none !important;
  }

  .role-card {
    padding: 12px;
  }

}

@media print {
  .sidebar,
  .top-actions,
  #dashboard,
  #visit,
  #elders,
  #requests {
    display: none !important;
  }

  .app-shell,
  .main,
  .view.active,
  #monthly {
    display: block;
  }

  .main {
    padding: 0;
  }

  .panel,
  .metric {
    box-shadow: none;
  }
}
.demo-notice {
  margin: 0 0 12px;
  padding: 12px 16px;
  border: 1px solid #a85a00;
  border-radius: 8px;
  background: #fff2d5;
  color: #703800;
  font-weight: 700;
}

.demo-notice.hidden { display: none; }
