:root {
  --ink: #17212f;
  --muted: #4b5664;
  --brand: #0b5cad;
  --brand-dark: #08457f;
  --accent: #e8f1fb;
  --line: #c9d3df;
  --bg: #f4f7fb;
  --card: #fff;
}
* { box-sizing: border-box; }
html { font-size: 100%; scroll-behavior: smooth; scroll-padding-top: 1rem; }
html[data-text-size="large"] { font-size: 112.5%; }
html[data-text-size="larger"] { font-size: 125%; }
body { margin: 0; font: 1rem/1.6 system-ui, -apple-system, "Segoe UI", sans-serif; color: var(--ink); background: var(--bg); }
h1, h2, h3, h4 { line-height: 1.25; margin: 0 0 .5rem; }
h2 { font-size: 1.6rem; }
a { color: var(--brand); }

/* Controls */
input, select, button, textarea { font: inherit; padding: 10px 12px; border: 1px solid #758293; border-radius: 8px; background: #fff; color: var(--ink); }
input[type="checkbox"] { width: 1.2em; height: 1.2em; margin: 0; padding: 0; accent-color: var(--brand); }
button { min-height: 44px; background: var(--brand); color: #fff; border-color: var(--brand); cursor: pointer; font-weight: 600; }
button:hover { background: var(--brand-dark); }
button.secondary { background: #fff; color: var(--brand-dark); border-color: #758293; }
button.secondary:hover { background: var(--accent); }
button:disabled { opacity: .6; cursor: not-allowed; }
button.link { min-height: 0; padding: 0; border: 0; background: none; color: var(--brand); text-decoration: underline; font-weight: 400; }
.chip { min-height: 32px; padding: 2px 12px; border-radius: 99px; background: #fff; color: var(--brand-dark); border: 1px solid #758293; font-weight: 500; }
.chip:hover { background: var(--accent); }
.chip[aria-pressed="true"] { background: var(--brand-dark); color: #fff; }
.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 48px; padding: 10px 22px; border-radius: 10px; background: #fff; color: var(--brand-dark); font-weight: 700; text-decoration: none; border: 2px solid #fff; }
.btn:hover { background: var(--accent); }
.btn.ghost { background: transparent; color: #fff; border-color: #fff; }
.btn.ghost:hover { background: rgba(255,255,255,.15); }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, summary:focus-visible, main:focus-visible {
  outline: 3px solid #1a73e8;
  outline-offset: 3px;
}
.hero a:focus-visible, .hero button:focus-visible, .site-footer a:focus-visible { outline-color: #ffe066; }
.skip-link { position: absolute; z-index: 20; top: 8px; left: 8px; padding: 8px 12px; transform: translateY(-160%); background: #fff; color: #003b7a; }
.skip-link:focus { transform: translateY(0); }

/* Header */
.site-header { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 24px; padding: 12px max(24px, calc((100vw - 1080px) / 2)); background: #fff; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10; }
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 800; font-size: 1.15rem; color: var(--ink); text-decoration: none; }
.brand-mark { display: block; width: 40px; height: 40px; border-radius: 10px; background: var(--brand); color: #fff; font-size: 1.3rem; font-weight: 800; line-height: 40px; text-align: center; }
.site-header nav { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 20px; }
.site-header nav a { color: var(--ink); text-decoration: none; font-weight: 500; }
.site-header nav a:hover { color: var(--brand); text-decoration: underline; }
#auth { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 8px; }
#auth button { min-height: 42px; padding: 8px 16px; }
#auth button:not(.secondary) { border-radius: 8px; }

/* Layout */
main { max-width: 1080px; margin: 0 auto; padding: 0 24px 48px; }
section { margin: 40px 0; }
.hero { min-height: min(68vh, 640px); margin: 0; padding: 40px 0; display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 28px; text-align: center; }
.hero.search-open { min-height: 0; align-items: stretch; text-align: left; }
.hero-heading { display: flex; align-items: center; justify-content: center; gap: 20px; }
.hero.search-open .hero-heading { justify-content: flex-start; flex-wrap: wrap; }
.hero.search-open > .search-launch { align-self: center; }
.hero h1 { font-size: clamp(2.4rem, 6vw, 4.5rem); margin: 0; }
.headline-more-filters { display: none; position: relative; flex: 0 0 auto; margin-left: auto; }
.hero.search-open .headline-more-filters { display: block; }
.headline-more-filters .filters-more { position: absolute; top: calc(100% + 8px); right: 0; width: min(680px, calc(100vw - 48px)); padding: 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--card); box-shadow: 0 10px 28px rgba(10,37,64,.16); z-index: 3; }
.headline-more-filters .filter-checks { align-content: start; }
.search-launch { display: grid; place-items: center; width: clamp(112px, 18vw, 168px); height: clamp(112px, 18vw, 168px); border: 0; border-radius: 50%; background: var(--brand); box-shadow: 0 12px 34px rgba(11,92,173,.25); transition: transform .15s ease, background .15s ease; }
.search-launch:hover { transform: translateY(-2px); background: var(--brand-dark); }
.search-launch svg { width: 52%; height: 52%; fill: none; stroke: #fff; stroke-width: 1.6; stroke-linecap: round; }
.search-engine { width: 100%; margin-top: 12px; }
[hidden] { display: none !important; }

/* Search */
#filters { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 20px; display: grid; grid-template-columns: 1fr; gap: 12px; box-shadow: 0 8px 28px rgba(10,37,64,.06); }
.search-primary { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; }
.icon-field { position: relative; }
.icon-field svg { position: absolute; left: 14px; top: 50%; width: 22px; height: 22px; transform: translateY(-50%); fill: none; stroke: var(--brand-dark); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; pointer-events: none; }
.icon-field select, .icon-field input { width: 100%; height: 52px; padding-left: 46px; font-weight: 400; }
.filters-main, .filters-more { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; align-items: end; }
.filter-checks { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; min-width: 0; margin: 0; padding: 0; border: 0; }
.filter-checks legend { width: 100%; margin-bottom: 2px; font-weight: 600; }
.filter-checks .check { min-height: 36px; }
.field { display: grid; gap: 4px; font-weight: 600; font-size: .95rem; }
.field input, .field select { font: inherit; font-weight: 400; width: 100%; height: 48px; }
.check { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; }
.more-filters summary { cursor: pointer; font-weight: 600; color: var(--brand-dark); padding: 6px 0; }
.more-filters[open] summary { margin-bottom: 8px; }
.search-submit { display: inline-flex; align-items: center; justify-content: center; gap: 8px; justify-self: end; min-width: 180px; white-space: nowrap; border-radius: 10px; }
.search-submit svg { width: 20px; height: 20px; flex: 0 0 auto; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
#search { scroll-margin-top: 24px; }
#count { margin: 16px 0 8px; font-weight: 600; color: var(--muted); }
.empty { background: var(--card); border: 1px dashed #758293; border-radius: 12px; padding: 24px; text-align: center; grid-column: 1 / -1; }

/* Cards */
#results, .tiers { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); gap: 16px; }
.card { min-width: 0; background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 18px; box-shadow: 0 1px 2px rgba(10,37,64,.06); }
.card.featured { border: 2px solid #b07a00; background: #fffdf6; }
.card-head { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center; margin-bottom: 8px; }
.card-head h3 { margin: 0; font-size: 1.1rem; }
.card-head p { margin: 0; }
.avatar { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 50%; background: var(--accent); color: var(--brand-dark); font-weight: 800; }
.rate { font-size: 1.3rem; font-weight: 800; text-align: right; }
.rate small { font-size: .8rem; font-weight: 500; color: var(--muted); }
.badges { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 10px; }
.badge { display: inline-block; font-size: .78rem; font-weight: 600; padding: 2px 10px; border-radius: 99px; }
.badge.ok { background: #d6f5df; color: #0f4d25; }
.badge.demo { background: #fff; color: #394858; border: 1px dashed #758293; }
.badge.feat { background: #fbe39a; color: #5b3b00; }
.badge.avail { background: #e3f1ff; color: #0a4a85; }
.badge.busy { background: #eceff3; color: #3d4753; }
.tag { display: inline-block; background: var(--accent); color: var(--brand-dark); border-radius: 6px; padding: 1px 8px; margin: 2px 4px 2px 0; font-size: .85rem; font-weight: 600; }
.tag.alt { background: #eef0f3; color: #2b3542; font-weight: 500; text-transform: capitalize; }
.muted { color: var(--muted); font-size: .9rem; }
.locked { background: #f1f4f8; border: 1px solid var(--line); padding: 10px 12px; border-radius: 10px; margin-top: 10px; overflow-wrap: anywhere; }
.row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.row button { flex: 1 1 auto; }
.policy-copy { margin: 14px 0; padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: #f8fafc; }
.policy-copy summary { cursor: pointer; color: var(--brand-dark); font-weight: 700; }
.policy-copy h3 { margin: 12px 0 4px; font-size: 1rem; }
.policy-copy p { margin: 0; color: var(--muted); font-size: .9rem; }
.consent-check { align-items: flex-start; gap: 10px; font-size: .9rem; }
.consent-check input { flex: 0 0 auto; margin-top: .35em; }
.notice-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.notice-item { padding: 14px; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.notice-item.unread { border-left: 4px solid var(--brand); }
.notice-item h3, .notice-item p { margin: 0 0 8px; }
.notice-meta { color: var(--muted); font-size: .82rem; }
.conversation-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.conversation-link { width: 100%; display: flex; justify-content: space-between; align-items: center; gap: 12px; text-align: left; color: var(--ink); background: #fff; border: 1px solid var(--line); }
.conversation-link:hover { background: var(--accent); }
.conversation-link small { color: var(--muted); font-weight: 400; }
.assignment-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.assignment-item { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; padding: 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--card); }
.assignment-item h3, .assignment-item p { margin: 0 0 4px; }
.assignment-item .row { margin-top: 0; }
.assignment-item .row button { flex: 0 1 auto; }
.location-fields { display: grid; gap: 8px; min-width: 0; margin: 0; padding: 14px; border: 1px solid var(--line); border-radius: 10px; }
.location-fields[hidden] { display: none; }
.location-fields legend { padding: 0 6px; font-weight: 700; }
dialog .filter-checks { display: grid; gap: 4px 12px; }
.message-thread { list-style: none; margin: 0 0 12px; padding: 12px; max-height: min(52vh, 480px); overflow-y: auto; display: flex; flex-direction: column; gap: 10px; background: #f4f7fb; border: 1px solid var(--line); border-radius: 12px; }
.message { width: min(88%, 34rem); padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px 12px 12px 3px; background: #fff; overflow-wrap: anywhere; }
.message.mine { align-self: flex-end; border-color: #9dbfe0; background: #e8f1fb; border-radius: 12px 12px 3px 12px; }
.message-meta, .message-body { margin: 0; }
.message-meta { margin-bottom: 4px; color: var(--muted); font-size: .78rem; }
.message-body { white-space: pre-wrap; }

/* How it works */
.steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }
.steps li { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 20px; }
.step-num { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; background: var(--brand); color: #fff; font-weight: 800; margin-bottom: 8px; }
.steps h3 { margin-bottom: 4px; }
.steps p { margin: 0; color: var(--muted); }

/* Pricing */
.group { margin: 24px 0 12px; font-size: 1.1rem; color: var(--muted); }
.plan h4 { margin-bottom: 4px; font-size: 1.1rem; }
.plan .price { font-size: 2rem; font-weight: 800; margin: 0 0 8px; }
.plan .price small { font-size: .9rem; font-weight: 500; color: var(--muted); }
.plan p:last-child { margin: 0; color: var(--muted); }
.plan.popular { border: 2px solid var(--brand); }

.site-footer { padding: 24px; text-align: center; color: var(--muted); border-top: 1px solid var(--line); background: #fff; }
.site-footer p { margin: 0; }

/* Dialog */
dialog { border: 0; border-radius: 16px; padding: 24px; width: min(92%, 460px); max-height: 90vh; overflow: auto; color: var(--ink); background: #fff; box-shadow: 0 20px 60px rgba(0,0,0,.35); }
dialog::backdrop { background: rgba(10,37,64,.65); }
dialog h2 { margin-bottom: 12px; }
dialog label { display: block; margin: 10px 0; font-weight: 600; font-size: .95rem; }
dialog label:has(input[type="checkbox"]) { font-weight: 400; }
dialog input:not([type="checkbox"]), dialog select, dialog textarea { width: 100%; font-weight: 400; margin-top: 4px; }
.error { color: #8b0018; font-weight: 600; }

/* High contrast */
.high-contrast { --ink: #000; --muted: #1a1a1a; --bg: #fff; --line: #000; --accent: #fff; --brand: #000; --brand-dark: #000; }
.high-contrast .card, .high-contrast .locked, .high-contrast #filters, .high-contrast .steps li { border: 2px solid #000; box-shadow: none; }
.high-contrast .conversation-link, .high-contrast .message, .high-contrast .message-thread { color: #000; background: #fff; border: 2px solid #000; }
.high-contrast .tag, .high-contrast .badge, .high-contrast .avatar { background: #fff; color: #000; border: 1px solid #000; }
.high-contrast button, .high-contrast .btn { border: 2px solid #000; }
.high-contrast button.secondary, .high-contrast .chip { background: #fff; color: #000; }

@media (prefers-contrast: more) {
  input, select, button, textarea, .card { border-width: 2px; }
}
@media (forced-colors: active) {
  :focus-visible { outline: 3px solid Highlight; }
  button, input, select, textarea, .card { border: 1px solid CanvasText; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
@media (max-width: 640px) {
  .site-header { padding-left: 16px; padding-right: 16px; }
  main { padding: 0 16px 16px; }
  .hero { min-height: 65vh; }
  .hero.search-open .hero-heading { align-items: flex-start; gap: 8px; }
  .hero.search-open .hero-heading h1 { font-size: clamp(1.8rem, 8vw, 2.6rem); }
  .headline-more-filters summary { font-size: .9rem; }
  section { margin: 28px 0; }
  .search-submit { justify-self: stretch; }
  .card-head { grid-template-columns: auto 1fr; }
  .rate { grid-column: 1 / -1; text-align: left; }
  .site-header { position: static; }
}
