:root {
  --brand-blue: #165DFF;
  --brand-blue-dark: #0F48CC;
  --teal: #36CFC7;
  --teal-dark: #149A94;
  --ink: #1D2129;
  --muted: #86909C;
  --line: #E5E6EB;
  --paper: #F7F8FA;
  --surface: #FFFFFF;
  --coral: #E66842;
  --violet: #5E6AD2;
  --mint: #EAFBF9;
  --amber: #FFF3D6;
  --rose: #FFF0EC;
  --sage: #EEF7F5;
  --sidebar: #FFFFFF;
  --shadow: 0 18px 48px rgba(29, 33, 41, .10);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    linear-gradient(rgba(247, 248, 250, .94), rgba(247, 248, 250, .98)),
    url("assets/care-marketplace-people.png") center top / cover fixed;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

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

button {
  cursor: pointer;
}

a {
  color: var(--brand-blue);
}

a:hover {
  text-decoration-thickness: 2px;
}

:focus-visible {
  outline: 3px solid rgba(22, 93, 255, .42);
  outline-offset: 3px;
}

.skip-link {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 200;
  transform: translateY(-160%);
  padding: 10px 14px;
  border-radius: 8px;
  color: #fff;
  background: var(--brand-blue);
  text-decoration: none;
  font-weight: 800;
}

.skip-link:focus {
  transform: translateY(0);
}

button:disabled,
input:disabled {
  cursor: not-allowed;
  opacity: .58;
}

.login-screen {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: none;
  place-items: center;
  padding: 20px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  background:
    linear-gradient(90deg, rgba(29, 33, 41, .93), rgba(22, 93, 255, .48)),
    url("assets/care-marketplace-people.png") center / cover;
}

.login-screen.active {
  display: grid;
}

.auth-required .app-shell {
  filter: blur(4px);
  pointer-events: none;
  user-select: none;
}

.login-card {
  width: min(760px, 100%);
  max-height: min(100%, 960px);
  overflow-y: auto;
  padding: 24px;
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 28px 90px rgba(0, 0, 0, .28);
}

.login-header {
  max-width: 700px;
}

.login-logo {
  width: min(240px, 100%);
  height: auto;
  margin-bottom: 14px;
  border-radius: 8px;
  object-fit: contain;
  mix-blend-mode: multiply;
}

.secret-logo {
  display: inline-grid;
  padding: 0;
  border: 0;
  background: transparent;
}

.login-form {
  display: grid;
  gap: 12px;
  margin: 18px 0 14px;
  max-width: 560px;
}

.login-form label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: .86rem;
  font-weight: 750;
}

.login-form input {
  width: 100%;
  min-height: 44px;
}

.login-form input,
.login-form select,
textarea,
select {
  border: 1px solid var(--line);
  border-radius: 8px;
}

.form-note,
.access-note,
.auth-footer,
.site-footer,
.auth-step {
  color: var(--muted);
  font-size: .82rem;
  line-height: 1.45;
}

.form-note,
.access-note {
  margin: -2px 0 0;
}

.auth-step {
  display: grid;
  gap: 3px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
}

.auth-step strong {
  color: var(--ink);
  font-size: .95rem;
}

.signup-followup {
  max-width: 560px;
  margin-top: 8px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.trust-list {
  display: grid;
  gap: 7px;
  margin: 14px 0 10px;
  padding: 0;
  list-style: none;
  color: var(--ink);
  line-height: 1.45;
}

.trust-list li {
  position: relative;
  padding-left: 24px;
}

.trust-list li::before {
  content: "✓";
  position: absolute;
  left: 0;
  top: 0;
  color: var(--teal-dark);
  font-weight: 900;
}

.audience-cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 14px 0 10px;
}

.audience-cards article {
  display: grid;
  gap: 6px;
  min-height: 116px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 8px 24px rgba(29, 33, 41, .05);
}

.audience-cards strong {
  color: var(--ink);
  font-size: .94rem;
}

.audience-cards span {
  color: var(--muted);
  font-size: .79rem;
  line-height: 1.4;
}

.journey-steps {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 14px 0 10px;
}

.journey-steps span {
  display: grid;
  gap: 5px;
  min-height: 72px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  color: var(--muted);
  font-size: .78rem;
  line-height: 1.25;
}

.journey-steps strong {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 999px;
  color: #fff;
  background: var(--brand-blue);
  font-size: .82rem;
}

.password-strength {
  display: grid;
  gap: 7px;
  margin-top: -4px;
}

.strength-track {
  display: block;
  width: 100%;
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--line);
}

.strength-track span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--coral);
  transition: width .18s ease, background .18s ease;
}

.password-strength[data-strength="weak"] .strength-track span {
  width: 33%;
}

.password-strength[data-strength="fair"] .strength-track span {
  width: 66%;
  background: #F7BA1E;
}

.password-strength[data-strength="good"] .strength-track span {
  width: 100%;
  background: var(--teal-dark);
}

.auth-footer,
.site-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  align-items: center;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.auth-footer a,
.site-footer a {
  color: var(--brand-blue);
  text-decoration: none;
}

.auth-footer a:hover,
.site-footer a:hover {
  text-decoration: underline;
}

.text-btn {
  justify-self: start;
  min-height: 32px;
  padding: 0;
  border: 0;
  color: var(--brand-blue);
  background: transparent;
  font-weight: 800;
}

.text-btn:hover {
  text-decoration: underline;
}

.hidden {
  display: none !important;
}

.auth-toggle,
.role-picker,
.market-toolbar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.auth-toggle {
  margin-top: 18px;
}

.role-picker label {
  display: flex;
  align-items: center;
  gap: 7px;
  min-height: 40px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: var(--surface);
}

.role-picker input {
  width: 16px;
  min-height: 16px;
  accent-color: var(--brand-blue);
}

.app-shell {
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 26px;
  padding: 22px 18px;
  color: var(--ink);
  background: var(--sidebar);
  border-right: 1px solid var(--line);
}

.brand,
.nav-item {
  color: inherit;
  text-decoration: none;
}

.brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 4px;
  min-width: 0;
}

.brand span {
  display: none;
}

.avatar {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 8px;
  font-weight: 800;
}

.brand-mark {
  flex: 0 1 auto;
  width: min(185px, 100%);
  height: auto;
  object-fit: contain;
  border-radius: 0;
  background: transparent;
  mix-blend-mode: multiply;
}

.brand small,
.user-card span {
  display: block;
  color: var(--muted);
  font-size: .78rem;
  margin-top: 2px;
}

.nav-list {
  display: grid;
  gap: 7px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 42px;
  border: 0;
  border-radius: 8px;
  padding: 0 12px;
  background: transparent;
  color: var(--muted);
  text-align: left;
}

.nav-item span:first-child {
  width: 22px;
  text-align: center;
  font-weight: 800;
}

.nav-item.active,
.nav-item:hover {
  color: var(--brand-blue);
  background: rgba(22, 93, 255, .08);
}

.user-card {
  display: flex;
  align-items: center;
  gap: 11px;
  margin-top: auto;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.logout-btn {
  margin-left: auto;
  border: 0;
  color: var(--muted);
  background: transparent;
  font-size: .76rem;
  font-weight: 800;
}

.logout-btn:hover {
  color: var(--brand-blue);
}

.avatar {
  width: 38px;
  height: 38px;
  color: #fff;
  background: var(--coral);
  font-size: .82rem;
}

.main {
  min-width: 0;
  padding: 26px;
}

.topbar,
.top-actions,
.panel-head,
.toolbar,
.dialog-actions {
  display: flex;
  align-items: center;
}

.topbar {
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 16px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--brand-blue);
  font-size: .74rem;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 8px;
  font-size: clamp(1.75rem, 2vw, 2.45rem);
  line-height: 1.08;
}

h2 {
  margin-bottom: 0;
  font-size: 1.1rem;
}

h3 {
  margin-bottom: 6px;
  font-size: 1rem;
}

.subhead,
.panel-note {
  color: var(--muted);
  line-height: 1.45;
}

.subhead {
  max-width: 680px;
  margin-bottom: 0;
}

.panel-note {
  margin: 5px 0 0;
  font-size: .84rem;
}

.top-actions {
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.search-field {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: min(360px, 100%);
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  background: var(--surface);
}

.search-field input {
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
}

.primary-btn,
.secondary-btn,
.icon-btn,
.chip,
.tab {
  min-height: 38px;
  border-radius: 8px;
  border: 1px solid transparent;
  font-weight: 750;
}

.primary-btn {
  padding: 0 16px;
  color: #fff;
  background: var(--brand-blue);
}

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

.secondary-btn {
  padding: 0 14px;
  color: var(--brand-blue);
  border-color: var(--line);
  background: var(--surface);
}

.secondary-btn:hover {
  border-color: var(--brand-blue);
  background: var(--mint);
}

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

.mini-actions .primary-btn,
.mini-actions .secondary-btn {
  min-height: 34px;
  padding-inline: 10px;
  font-size: .82rem;
}

.icon-btn {
  width: 38px;
  color: var(--ink);
  border-color: var(--line);
  background: #fff;
  font-size: 1.2rem;
}

.hero-strip {
  position: relative;
  min-height: 210px;
  display: grid;
  grid-template-columns: 1fr minmax(260px, 390px);
  gap: 18px;
  overflow: hidden;
  margin-bottom: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.hero-strip img {
  width: 100%;
  height: 100%;
  min-height: 210px;
  object-fit: cover;
}

.hero-copy {
  align-self: center;
  padding: 22px 24px 22px 0;
}

.hero-copy strong,
.hero-copy span {
  display: block;
}

.hero-copy strong {
  font-size: 1.15rem;
  line-height: 1.28;
}

.hero-copy span {
  margin-top: 8px;
  color: var(--muted);
  line-height: 1.45;
}

.quick-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

.guide-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.guide-row article {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.guide-row strong {
  display: block;
  margin-bottom: 4px;
}

.guide-row p {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.4;
  font-size: .88rem;
}

.step-number {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  color: #fff;
  background: var(--brand-blue);
  font-weight: 850;
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

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

.metrics-grid article {
  padding: 15px;
}

.metrics-grid span {
  display: block;
  color: var(--muted);
  font-size: .84rem;
}

.metrics-grid strong {
  display: block;
  margin-top: 5px;
  font-size: 1.9rem;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.workspace-grid {
  display: grid;
  grid-template-columns: minmax(260px, 320px) minmax(360px, 1fr) minmax(290px, 360px);
  gap: 14px;
  align-items: start;
}

.panel {
  min-width: 0;
  padding: 16px;
}

.full-panel {
  min-height: 420px;
}

.panel-head {
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.filter-row,
.tabs {
  display: flex;
  gap: 7px;
  overflow-x: auto;
}

.chip,
.tab {
  white-space: nowrap;
  padding: 0 11px;
  color: var(--muted);
  background: var(--paper);
}

.chip.active,
.tab.active {
  color: #fff;
  background: var(--brand-blue);
}

.case-list,
.match-list,
.chat-feed,
.enquiry-list,
.inbox-list {
  display: grid;
  gap: 10px;
}

.enquiry-list {
  margin-bottom: 16px;
}

.room-list {
  display: grid;
  gap: 10px;
  margin-bottom: 16px;
}

.email-actions {
  display: flex;
  justify-content: flex-end;
  margin: 0 0 12px;
}

.case-list {
  margin-top: 12px;
}

.case-card,
.match-card,
.directory-card,
.market-card,
.inbox-item,
.kanban-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.case-card {
  width: 100%;
  padding: 12px;
  text-align: left;
  transition: border-color .2s ease, box-shadow .2s ease, transform .2s ease;
}

.case-card:hover,
.match-card:hover,
.directory-card:hover,
.market-card:hover {
  border-color: rgba(22, 93, 255, .38);
  transform: translateY(-1px);
}

.case-card.active {
  border-color: var(--brand-blue);
  box-shadow: 0 0 0 3px rgba(22, 93, 255, .12);
}

.case-title,
.card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.case-card p,
.match-card p,
.directory-card p,
.market-card p,
.inbox-item p,
.provider-summary p,
.safeguarding-box p {
  color: var(--muted);
  line-height: 1.45;
}

.case-card p {
  margin: 7px 0 10px;
  font-size: .88rem;
}

.badges,
.need-grid,
.provider-tags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.badge,
.status-pill,
.score,
.distance {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 0 8px;
  font-size: .75rem;
  font-weight: 800;
}

.badge {
  color: var(--ink);
  background: var(--paper);
}

.badge.urgent,
.status-pill.urgent {
  color: #8d2d1b;
  background: var(--rose);
}

.badge.high {
  color: #81530a;
  background: var(--amber);
}

.status-pill {
  color: var(--teal-dark);
  background: var(--mint);
}

.need-grid {
  margin-bottom: 14px;
}

.need-grid .badge {
  min-height: 32px;
  padding-inline: 10px;
}

.toolbar {
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 14px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
}

.toolbar label {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: .78rem;
  font-weight: 750;
}

select,
input,
textarea {
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: var(--surface);
}

select,
input {
  min-height: 38px;
  padding: 0 10px;
}

textarea {
  width: 100%;
  resize: vertical;
  padding: 10px;
}

.toggle-label {
  grid-auto-flow: column;
  align-items: center;
  min-height: 38px;
}

.toggle-label input {
  width: 18px;
  height: 18px;
  min-height: 18px;
  accent-color: var(--brand-blue);
}

.match-card {
  padding: 14px;
  transition: border-color .2s ease, transform .2s ease;
}

.score {
  color: #fff;
  background: var(--brand-blue);
}

.distance {
  color: #4d3c08;
  background: var(--amber);
}

.match-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  margin: 12px 0;
}

.progress {
  width: min(220px, 100%);
  height: 9px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--line);
}

.progress span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--brand-blue), var(--teal));
}

.card-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.provider-summary {
  padding: 12px;
  margin-bottom: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
}

.provider-summary h3 {
  margin-bottom: 4px;
}

.tabs {
  margin-bottom: 12px;
}

.tab {
  flex: 1;
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

.chat-feed {
  max-height: 310px;
  overflow: auto;
  padding-right: 4px;
}

.message {
  padding: 10px;
  border-radius: 8px;
  background: var(--paper);
}

.message strong {
  display: block;
  margin-bottom: 4px;
  font-size: .82rem;
}

.message.me {
  color: #fff;
  background: var(--brand-blue);
}

.message.me p {
  color: rgba(255, 255, 255, .9);
}

.message p {
  margin-bottom: 0;
}

.message-form {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.action-list,
.risk-list {
  display: grid;
  gap: 8px;
  padding: 0;
  margin: 0;
  list-style: none;
}

.action-list li,
.risk-list li {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.action-list input {
  margin-right: 8px;
  accent-color: var(--brand-blue);
}

.safeguarding-box {
  padding: 12px;
  margin-bottom: 10px;
  border-radius: 8px;
  background: var(--rose);
}

.governance-box {
  display: grid;
  gap: 10px;
  padding: 12px;
  margin: 12px 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #eef5ee;
}

.governance-box h3 {
  margin: 0;
}

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

.market-toolbar {
  margin-bottom: 12px;
}

.market-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.directory-card {
  padding: 14px;
  transition: border-color .2s ease, transform .2s ease;
}

.market-card {
  padding: 14px;
  transition: border-color .2s ease, transform .2s ease;
}

.directory-card p {
  min-height: 62px;
}

.provider-tags {
  margin: 10px 0 14px;
}

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

.kanban-column {
  min-height: 280px;
  padding: 10px;
  border-radius: 8px;
  background: var(--paper);
}

.kanban-column h3 {
  margin-bottom: 10px;
}

.kanban-card {
  padding: 10px;
  margin-bottom: 9px;
}

.inbox-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 12px;
}

.admin-users {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.admin-user-card {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.danger-btn {
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid #d9b4ac;
  border-radius: 8px;
  color: #873b2e;
  background: #fbede9;
  font-weight: 750;
}

.danger-btn:hover {
  background: #f5dcd5;
}

.inbox-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--coral);
}

dialog {
  width: min(720px, calc(100vw - 24px));
  border: 0;
  border-radius: 8px;
  padding: 0;
  box-shadow: 0 30px 90px rgba(0, 0, 0, .28);
}

dialog::backdrop {
  background: rgba(25, 39, 37, .44);
}

.dialog-card {
  padding: 18px;
}

.room-dialog-card {
  width: min(1040px, calc(100vw - 24px));
}

.room-status-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  margin: 12px 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--mint);
}

.room-status-bar p {
  margin: 3px 0 0;
  color: var(--muted);
}

.billing-plan {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--mint);
}

.billing-plan strong {
  display: block;
  margin: 6px 0;
  font-size: 1.5rem;
  line-height: 1.2;
}

.billing-plan p:last-child {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.45;
}

.billing-status {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.billing-status p {
  margin: 7px 0 0;
}

.billing-link {
  display: inline-flex;
  margin-top: 10px;
}

.document-upload {
  display: grid;
  gap: 8px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.document-upload input,
.document-upload textarea {
  width: 100%;
}

.room-grid {
  display: grid;
  grid-template-columns: 1.15fr 1fr 1fr;
  gap: 14px;
  align-items: start;
}

.room-grid section {
  min-width: 0;
}

.room-grid h3 {
  margin-top: 12px;
}

.room-send-btn {
  width: 100%;
  margin-top: 8px;
}

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

.dialog-card label {
  display: grid;
  gap: 6px;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: .82rem;
  font-weight: 750;
}

.dialog-actions {
  justify-content: flex-end;
  gap: 8px;
  padding: 0;
  margin: 12px 0 0;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 1180px) {
  .workspace-grid,
  .directory-grid,
  .market-list,
  .room-grid,
  .kanban {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .collaboration-panel {
    grid-column: 1 / -1;
  }
}

@media (max-width: 820px) {
  body {
    padding-bottom: calc(76px + env(safe-area-inset-bottom));
    background:
      linear-gradient(rgba(247, 248, 250, .97), rgba(247, 248, 250, .99)),
      url("assets/care-marketplace-people.png") center top / cover scroll;
  }

  body.auth-required {
    padding-bottom: 0;
  }

  .login-screen {
    display: none;
    align-items: start;
    place-items: start center;
    padding: max(12px, env(safe-area-inset-top)) 12px max(18px, env(safe-area-inset-bottom));
    background: linear-gradient(180deg, rgba(247, 248, 250, .98), rgba(234, 251, 249, .98));
  }

  .login-screen.active {
    display: grid;
  }

  .login-card {
    width: 100%;
    max-height: none;
    padding: 18px;
    box-shadow: 0 14px 44px rgba(29, 33, 41, .13);
  }

  .login-logo {
    width: min(220px, 100%);
    height: auto;
    margin-bottom: 10px;
  }

  .login-form {
    max-width: none;
  }

  .signup-followup {
    max-width: none;
  }

  .auth-toggle {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .journey-steps {
    grid-template-columns: 1fr;
  }

  .audience-cards {
    grid-template-columns: 1fr;
  }

  .audience-cards article {
    min-height: 0;
  }

  .journey-steps span {
    min-height: 0;
    grid-template-columns: auto 1fr;
    align-items: center;
  }

  .auth-toggle .tab {
    min-height: 44px;
  }

  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: sticky;
    z-index: 20;
    height: auto;
    padding: 10px 14px;
    border-bottom: 1px solid var(--line);
  }

  .brand {
    justify-content: center;
  }

  .nav-list {
    position: fixed;
    z-index: 30;
    left: 10px;
    right: 10px;
    bottom: calc(10px + env(safe-area-inset-bottom));
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 6px;
    padding: 7px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--sidebar);
    box-shadow: 0 18px 44px rgba(14, 25, 23, .28);
  }

  .nav-item {
    display: grid;
    justify-content: center;
    justify-items: center;
    gap: 3px;
    min-height: 54px;
    padding: 5px 4px;
    font-size: .72rem;
    text-align: center;
  }

  .nav-item span:first-child {
    width: auto;
    font-size: 1rem;
  }

  .nav-item span:last-child {
    display: block;
  }

  .user-card {
    display: none;
  }

  .main {
    padding: 14px 14px 4px;
  }

  .topbar,
  .hero-strip,
  .room-status-bar {
    grid-template-columns: 1fr;
  }

  .topbar {
    display: grid;
    gap: 12px;
  }

  .room-status-bar {
    display: grid;
  }

  .top-actions,
  .search-field {
    width: 100%;
  }

  .top-actions {
    justify-content: stretch;
  }

  .primary-btn,
  .secondary-btn {
    flex: 1;
    min-height: 46px;
  }

  .search-field {
    min-height: 48px;
  }

  .hero-strip {
    gap: 0;
  }

  .hero-strip img {
    min-height: 150px;
    max-height: 230px;
  }

  .hero-copy {
    padding: 14px 16px 16px;
  }

  .quick-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .metrics-grid,
  .guide-row,
  .workspace-grid,
  .directory-grid,
  .market-list,
  .room-grid,
  .kanban,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .inbox-item {
    grid-template-columns: auto 1fr;
  }

  .inbox-item .secondary-btn {
    grid-column: 1 / -1;
  }

  .panel {
    padding: 14px;
  }

  .panel-head {
    align-items: flex-start;
  }

  .filter-row,
  .tabs {
    padding-bottom: 2px;
    scrollbar-width: none;
  }

  .filter-row::-webkit-scrollbar,
  .tabs::-webkit-scrollbar {
    display: none;
  }

  .chip,
  .tab {
    min-height: 42px;
  }

  .toolbar {
    display: grid;
    grid-template-columns: 1fr;
  }

  .toolbar select {
    width: 100%;
  }

  .case-card,
  .match-card,
  .directory-card,
  .market-card,
  .inbox-item,
  .kanban-card {
    box-shadow: none;
  }

  .case-card:hover,
  .match-card:hover,
  .directory-card:hover,
  .market-card:hover {
    transform: none;
  }

  .card-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .match-meta {
    justify-content: flex-start;
  }

  .progress {
    width: 100%;
  }

  .chat-feed {
    max-height: 260px;
  }

  dialog {
    width: min(100vw - 18px, 720px);
    max-height: calc(100dvh - 18px);
  }

  .dialog-card {
    max-height: calc(100dvh - 18px);
    overflow: auto;
  }
}

@media (max-width: 480px) {
  .brand {
    justify-content: flex-start;
  }

  .brand small {
    display: none;
  }

  h1 {
    font-size: 1.85rem;
  }

  .subhead {
    font-size: .96rem;
  }

  .hero-strip {
    margin-inline: -2px;
  }

  .guide-row article,
  .metrics-grid article,
  .panel {
    border-radius: 8px;
  }

  .metrics-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .metrics-grid article {
    padding: 12px;
  }

  .metrics-grid strong {
    font-size: 1.55rem;
  }

  .quick-actions,
  .card-actions {
    grid-template-columns: 1fr;
  }

  .case-title,
  .card-top {
    display: grid;
    gap: 7px;
  }

  .score,
  .status-pill {
    width: max-content;
  }

  .nav-list {
    left: 8px;
    right: 8px;
  }

  .nav-item {
    min-width: 0;
    font-size: .68rem;
  }

  .login-card {
    padding: 16px;
  }

  .trust-list,
  .access-note,
  .form-note {
    font-size: .86rem;
  }

  .auth-footer,
  .site-footer {
    gap: 8px 10px;
  }
}
