:root {
  --navy: #0a1d37;
  --blue: #2563eb;
  --blue-dark: #1747b8;
  --paper: #f4f7fb;
  --white: #ffffff;
  --ink: #142840;
  --muted: #617187;
  --line: #dce5f0;
  --green: #08765b;
  --green-bg: #eaf8f3;
  --amber: #8a5700;
  --amber-bg: #fff7e6;
  --red: #a52a2a;
  --shadow: 0 18px 48px rgba(10, 29, 55, .08);
  --radius: 22px;
}

* { box-sizing: border-box; }
html { color-scheme: light; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 16px/1.6 Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
a { color: inherit; }
button, input { font: inherit; }
.shell { width: min(1160px, calc(100% - 40px)); margin-inline: auto; }
.skip-link { position: fixed; left: 16px; top: -100px; z-index: 100; padding: 10px 14px; background: var(--navy); color: #fff; border-radius: 8px; }
.skip-link:focus { top: 16px; }

.site-header { position: sticky; top: 0; z-index: 20; background: var(--navy); border-bottom: 1px solid rgba(255,255,255,.12); box-shadow: 0 14px 34px rgba(2, 14, 31, .18); }
.header-inner { position: relative; min-height: 92px; display: flex; align-items: center; gap: 28px; }
.brand { display: inline-flex; align-items: center; gap: 11px; color: #fff; text-decoration: none; white-space: nowrap; }
.brand-logo { width: 48px; height: 48px; object-fit: contain; }
.brand-name { font-size: 20px; font-weight: 900; letter-spacing: -.045em; line-height: 1; text-transform: uppercase; }
.brand-name span { color: #50a8ff; font-weight: 400; }
.header-actions { min-width: 0; flex: 1; display: flex; align-items: center; gap: 22px; }
.main-nav { display: flex; align-items: center; gap: 4px; margin-left: auto; }
.main-nav a { padding: 10px 12px; border-radius: 999px; color: #c7dcf5; text-decoration: none; font-size: 12px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.main-nav a:hover, .main-nav a.active { background: rgba(255,255,255,.12); color: #fff; }
.main-nav a:focus-visible, .text-button:focus-visible, .header-link:focus-visible, .menu-toggle:focus-visible { outline: 3px solid #78b9ff; outline-offset: 3px; }
.account-menu { display: flex; align-items: center; gap: 12px; }
.account-menu form { margin: 0; }
.account-badge { padding: 7px 10px; border: 1px solid rgba(120,185,255,.42); border-radius: 999px; background: rgba(37,99,235,.18); color: #d8eaff; font-size: 12px; font-weight: 800; }
.text-button, .header-link { border: 0; background: none; color: #fff; text-decoration: none; font-weight: 800; cursor: pointer; padding: 8px 0; }
.header-link { margin-left: auto; font-size: 12px; letter-spacing: .08em; text-transform: uppercase; }
.header-link:hover, .text-button:hover { color: #78b9ff; }
.menu-toggle { display: none; width: 44px; height: 44px; padding: 10px; border: 1px solid rgba(255,255,255,.24); border-radius: 12px; background: rgba(255,255,255,.08); cursor: pointer; }
.menu-toggle span { display: block; width: 100%; height: 2px; margin: 4px 0; border-radius: 2px; background: #fff; }

.page-shell { min-height: calc(100vh - 150px); padding-block: 48px 76px; }
.eyebrow { margin: 0 0 10px; color: var(--blue); font-size: 12px; font-weight: 850; letter-spacing: .14em; text-transform: uppercase; }
h1, h2, h3 { color: var(--navy); font-family: Georgia, "Times New Roman", serif; line-height: 1.15; letter-spacing: -.025em; }
h1 { margin: 0; font-size: clamp(38px, 6vw, 64px); }
h2 { margin: 0; font-size: clamp(26px, 3vw, 36px); }
h3 { margin: 0; font-size: 22px; }
.lead { max-width: 760px; margin: 18px 0 0; color: var(--muted); font-size: 18px; }
.page-heading { display: flex; justify-content: space-between; align-items: end; gap: 30px; margin-bottom: 34px; }
.page-heading .button { flex: 0 0 auto; }

.hero { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(300px, .75fr); gap: 28px; align-items: stretch; }
.hero-copy, .card, .panel { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.hero-copy { padding: clamp(28px, 5vw, 58px); }
.hero-side { padding: 34px; border-radius: var(--radius); background: linear-gradient(145deg, var(--navy), #123c70); color: #fff; box-shadow: var(--shadow); }
.hero-side h2, .hero-side h3 { color: #fff; }
.hero-side p { color: #d6e2f1; }
.hero-side .mini-list { margin-top: 28px; }
.mini-list { display: grid; gap: 14px; padding: 0; list-style: none; }
.mini-list li { display: flex; gap: 12px; align-items: flex-start; }
.mini-icon { flex: 0 0 26px; width: 26px; height: 26px; display: grid; place-items: center; border-radius: 8px; background: rgba(255,255,255,.13); font-weight: 900; }

.grid { display: grid; gap: 20px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.section { margin-top: 52px; }
.section-heading { display: flex; justify-content: space-between; align-items: end; gap: 20px; margin-bottom: 22px; }
.section-heading p { margin: 7px 0 0; color: var(--muted); }
.card { padding: 26px; }
.card p { color: var(--muted); }
.card-footer { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 24px; }
.card-icon { width: 44px; height: 44px; display: grid; place-items: center; margin-bottom: 22px; border-radius: 13px; background: #edf4ff; color: var(--blue); font-weight: 900; }
.stat { font: 700 36px/1 Georgia, serif; color: var(--navy); }
.status { display: inline-flex; align-items: center; gap: 7px; padding: 6px 10px; border-radius: 999px; font-size: 12px; font-weight: 850; }
.status.done { background: var(--green-bg); color: var(--green); }
.status.todo { background: var(--amber-bg); color: var(--amber); }
.status.locked { background: #eef1f5; color: #617187; }
.status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }

.button { display: inline-flex; min-height: 46px; align-items: center; justify-content: center; gap: 8px; padding: 11px 20px; border: 2px solid var(--blue); border-radius: 999px; background: var(--blue); color: #fff; text-decoration: none; font-weight: 850; cursor: pointer; }
.button:hover { background: var(--blue-dark); border-color: var(--blue-dark); }
.button.secondary { background: #fff; color: var(--navy); border-color: var(--line); }
.button.secondary:hover { border-color: var(--blue); color: var(--blue); }
.button.danger { background: #fff; color: var(--red); border-color: #eccaca; }
.button.danger:hover { background: #fff3f3; border-color: var(--red); }
.link { color: var(--blue-dark); font-weight: 800; text-decoration-thickness: 1px; text-underline-offset: 3px; }

.notice { margin-bottom: 22px; padding: 15px 18px; border: 1px solid #bfd2f7; border-radius: 14px; background: #eef5ff; color: #244f89; }
.notice.error { border-color: #efc1c1; background: #fff1f1; color: #8c2929; }
.notice.success { border-color: #b5dfd2; background: var(--green-bg); color: #08634d; }
.empty { padding: 34px; border: 1px dashed #bfcbd9; border-radius: 18px; background: #fafcfe; text-align: center; color: var(--muted); }

.auth-shell { width: min(1040px, calc(100% - 40px)); margin: 0 auto; display: grid; grid-template-columns: 1fr 460px; gap: 34px; align-items: center; min-height: calc(100vh - 230px); }
.auth-intro { padding: 20px 0; }
.auth-intro .lead { max-width: 530px; }
.auth-card { padding: clamp(26px, 4vw, 42px); background: #fff; border: 1px solid var(--line); border-radius: 26px; box-shadow: var(--shadow); }
.auth-card h1 { font-size: 40px; }
.auth-card > p { color: var(--muted); }
.field { margin-top: 20px; }
.field label, .field-label { display: block; margin-bottom: 7px; color: var(--navy); font-weight: 800; }
.field input[type="text"], .field input[type="email"], .field input[type="password"] { width: 100%; padding: 13px 15px; border: 2px solid var(--line); border-radius: 12px; background: #fff; color: var(--ink); outline: none; }
.field input:focus { border-color: var(--blue); box-shadow: 0 0 0 4px rgba(37,99,235,.11); }
.field input[aria-invalid="true"] { border-color: var(--red); }
.field-error { margin: 7px 0 0; color: var(--red); font-size: 14px; font-weight: 700; }
.check { display: flex; gap: 10px; align-items: flex-start; margin-top: 18px; color: var(--muted); font-size: 14px; }
.check input { width: 18px; height: 18px; margin-top: 3px; accent-color: var(--blue); }
.check input[aria-invalid="true"] { outline: 2px solid var(--red); outline-offset: 2px; }
.auth-actions { display: grid; gap: 12px; margin-top: 24px; }
.auth-meta { margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--line); color: var(--muted); font-size: 14px; }
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

.appointment { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 24px; align-items: center; padding: 26px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.appointment + .appointment { margin-top: 16px; }
.appointment-time { margin: 8px 0; color: var(--navy); font: 700 25px/1.25 Georgia, serif; }
.appointment-meta { margin: 0; color: var(--muted); }
.appointment-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: end; }
.appointment-actions form { margin: 0; }
.appointment-actions details { position: relative; }
.appointment-actions details form { position: absolute; right: 0; z-index: 2; width: min(420px, calc(100vw - 48px)); margin-top: 8px; padding: 18px; border: 1px solid var(--line); border-radius: 16px; background: #fff; box-shadow: var(--shadow); }
.appointment-actions .booking-date { width: 100%; }
.appointment-actions .booking-slots { margin: 12px 0; }
.appointment-actions .booking-message { margin: 10px 0; }
.appointment-actions .booking-slot.selected { background: var(--blue); border-color: var(--blue); color: #fff; }

.booking-panel { max-width: 800px; padding: clamp(26px, 5vw, 44px); }
.booking-picker { margin-top: 30px; }
.booking-date { width: min(100%, 330px); padding: 13px 15px; border: 2px solid var(--line); border-radius: 12px; background: #fff; color: var(--ink); outline: none; }
.booking-date:focus { border-color: var(--blue); box-shadow: 0 0 0 4px rgba(37,99,235,.11); }
.booking-message { min-height: 1.6em; margin: 18px 0; color: var(--muted); }
.booking-slots { display: flex; flex-wrap: wrap; gap: 10px; }
.booking-slot { min-width: 92px; }
#booking-confirmation { margin-top: 28px; }
#booking-confirmation h3, #booking-confirmation p { margin: 0 0 10px; }

.tabs-summary { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 26px; }
.summary-item { padding: 18px; border: 1px solid var(--line); border-radius: 15px; background: #fff; }
.summary-item strong { display: block; color: var(--navy); font-size: 22px; }
.summary-item span { color: var(--muted); font-size: 13px; }
.document-row, .message { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 16px; align-items: center; padding: 18px 0; border-bottom: 1px solid var(--line); }
.document-row:last-child, .message:last-child { border-bottom: 0; }
.document-kind { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 12px; background: #edf4ff; color: var(--blue); font-weight: 900; text-transform: uppercase; }
.document-row p, .message p { margin: 3px 0 0; color: var(--muted); font-size: 14px; }
.portal-document-row { grid-template-columns: minmax(0, 1fr) auto; }
.portal-document-row > div { min-width: 0; }
.portal-document-category { display: inline-flex; padding: 3px 7px; border-radius: 999px; background: #eaf1ff; color: #1d4ed8; font-size: 11px; font-weight: 800; }
.message { grid-template-columns: minmax(0, 1fr) auto; align-items: start; }
.message-body { white-space: pre-line; }
.locked-panel { padding: clamp(30px, 5vw, 54px); border: 1px solid var(--line); border-radius: var(--radius); background: linear-gradient(135deg, #fff, #edf4ff); box-shadow: var(--shadow); }
.locked-panel .lead { max-width: 720px; }

.site-footer { border-top: 1px solid rgba(255,255,255,.1); background: var(--navy); color: #c7dcf5; }
.footer-content { padding-block: 62px 48px; text-align: center; }
.footer-primary { display: flex; align-items: center; justify-content: center; gap: 42px; }
.footer-brand { display: inline-flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; }
.footer-brand img { width: 38px; height: 38px; object-fit: contain; }
.footer-brand > span { font-size: 18px; font-weight: 900; letter-spacing: -.045em; text-transform: uppercase; }
.footer-brand > span span { color: #50a8ff; font-weight: 400; }
.footer-contacts, .footer-legal { display: flex; flex-wrap: wrap; justify-content: center; gap: 14px 28px; }
.footer-contacts a, .footer-legal a { color: inherit; text-decoration: none; font-size: 11px; font-weight: 800; letter-spacing: .09em; text-transform: uppercase; }
.footer-contacts a:hover, .footer-legal a:hover { color: #fff; }
.footer-legal { margin-top: 42px; color: rgba(199,220,245,.64); }
.footer-copy { margin: 28px 0 0; color: rgba(199,220,245,.42); font-size: 10px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; }

@media (max-width: 980px) {
  .header-inner { min-height: 80px; gap: 18px; }
  .brand-logo { width: 44px; height: 44px; }
  .menu-toggle { display: block; margin-left: auto; }
  .header-actions { display: none; position: absolute; top: calc(100% - 1px); left: 0; right: 0; padding: 18px; border: 1px solid rgba(255,255,255,.13); border-top: 0; border-radius: 0 0 18px 18px; background: var(--navy); box-shadow: 0 22px 34px rgba(2,14,31,.24); }
  .header-actions.is-open { display: grid; gap: 14px; }
  .main-nav { display: grid; width: 100%; margin: 0; }
  .main-nav a { padding: 12px 14px; border-radius: 10px; }
  .account-menu { justify-content: space-between; padding: 14px 14px 0; border-top: 1px solid rgba(255,255,255,.12); }
  .hero, .auth-shell { grid-template-columns: 1fr; }
  .auth-shell { padding-block: 30px; }
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 700px) {
  .shell, .auth-shell { width: min(100% - 28px, 1160px); }
  .page-shell { padding-block: 30px 54px; }
  .page-heading, .section-heading { display: block; }
  .page-heading .button, .section-heading .button { margin-top: 18px; }
  .grid-2, .grid-3, .grid-4, .tabs-summary { grid-template-columns: 1fr; }
  .hero-copy, .hero-side, .card { padding: 24px; }
  .appointment { grid-template-columns: 1fr; }
  .appointment-actions { justify-content: start; }
  .appointment-actions .button, .appointment-actions form, .appointment-actions form .button { width: 100%; }
  .document-row { grid-template-columns: auto minmax(0, 1fr); }
  .portal-document-row { grid-template-columns: 1fr; }
  .document-row .button { grid-column: 1 / -1; }
  .footer-content { padding-block: 48px 38px; }
  .footer-primary { flex-direction: column; gap: 22px; }
  .footer-contacts, .footer-legal { flex-direction: column; gap: 12px; }
  .footer-legal { margin-top: 34px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
