:root {
  --plum: #2e1a35;
  --plum-soft: #49304f;
  --ivory: #f7f4ef;
  --warm-white: #fffdf9;
  --ink: #18211f;
  --muted: #5f6966;
  --line: #cfd8d4;
  --teal: #0e6e62;
  --teal-dark: #0a5149;
  --aqua: #65c9bc;
  --coral: #e47a6a;
  --amber: #a66008;
  --red: #a83d32;
  --shadow: 0 12px 34px rgba(37, 52, 48, 0.11);
  --radius: 20px;
  color-scheme: light;
  font-family: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
  background: var(--ivory);
  color: var(--ink);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--ivory);
}

body {
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(circle at 95% 5%, rgba(101, 201, 188, 0.11), transparent 24rem),
    var(--ivory);
  -webkit-font-smoothing: antialiased;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

button:focus-visible,
input:focus-visible,
a:focus-visible {
  outline: 3px solid var(--coral);
  outline-offset: 3px;
}

.hidden {
  display: none !important;
}

.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;
}

.skip-link {
  position: fixed;
  z-index: 200;
  left: 1rem;
  top: -5rem;
  padding: 0.7rem 1rem;
  color: white;
  background: var(--plum);
  border-radius: 10px;
}

.skip-link:focus {
  top: 1rem;
}

.app-header {
  min-height: 96px;
  padding: max(1.05rem, env(safe-area-inset-top)) max(1rem, env(safe-area-inset-right)) 1rem max(1rem, env(safe-area-inset-left));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem;
  color: var(--ivory);
  background: var(--plum);
}

.brand-lockup {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
}

.wordmark {
  display: block;
  width: clamp(138px, 19vw, 210px);
  height: auto;
}

.brand-lockup > span {
  padding-left: 0.15rem;
  color: rgba(247, 244, 239, 0.78);
  font-size: 0.72rem;
  font-weight: 650;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.person-chip {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  min-width: 0;
  padding: 0.5rem 0.75rem 0.5rem 0.55rem;
  border: 1px solid rgba(247, 244, 239, 0.24);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
}

.person-initials {
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: var(--ink);
  background: var(--aqua);
  font-weight: 800;
}

.person-copy {
  min-width: 0;
  display: flex;
  flex-direction: column;
  line-height: 1.18;
}

.person-copy strong {
  max-width: 13rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.96rem;
}

.person-copy small {
  color: rgba(247, 244, 239, 0.68);
  font-size: 0.76rem;
}

.snapshot-strip {
  position: sticky;
  z-index: 80;
  top: 0;
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  padding: 0.45rem max(1rem, env(safe-area-inset-right)) 0.45rem max(1rem, env(safe-area-inset-left));
  color: var(--teal-dark);
  background: #e6f3f0;
  border-bottom: 1px solid #b9d8d2;
  font-size: 0.83rem;
  font-weight: 650;
}

.snapshot-strip.aging {
  color: #754708;
  background: #fff3d9;
  border-color: #ead09b;
}

.snapshot-strip.stale,
.snapshot-strip.error {
  color: #762c25;
  background: #fff0ed;
  border-color: #efc2bb;
}

.status-dot {
  width: 8px;
  height: 8px;
  flex: 0 0 8px;
  border-radius: 50%;
  background: currentColor;
}

.text-button {
  padding: 0.25rem 0.15rem;
  color: inherit;
  background: transparent;
  border: 0;
  border-bottom: 1px solid currentColor;
  font-weight: 760;
}

.danger-text {
  color: var(--red);
}

main {
  width: min(100%, 1180px);
  min-height: calc(100vh - 200px);
  margin: 0 auto;
  padding: clamp(1.6rem, 4vw, 3.7rem) clamp(1rem, 4vw, 3rem) calc(7rem + env(safe-area-inset-bottom));
}

.view {
  animation: view-in 180ms ease-out;
}

@keyframes view-in {
  from { opacity: 0; transform: translateY(5px); }
  to { opacity: 1; transform: translateY(0); }
}

.page-heading {
  margin-bottom: 2.4rem;
}

.page-heading.compact {
  margin-bottom: 1.7rem;
}

.eyebrow {
  margin: 0 0 0.55rem;
  color: var(--teal);
  font-size: 0.78rem;
  font-weight: 820;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.eyebrow.on-dark {
  color: var(--aqua);
}

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

h1 {
  margin-bottom: 0.55rem;
  font-family: ui-serif, Georgia, serif;
  font-size: clamp(2.55rem, 7vw, 5.25rem);
  font-weight: 600;
  letter-spacing: -0.045em;
  line-height: 0.98;
}

h2 {
  margin-bottom: 0.75rem;
  font-size: clamp(1.25rem, 2.4vw, 1.65rem);
  letter-spacing: -0.025em;
}

.lede {
  max-width: 52rem;
  margin-bottom: 0;
  color: var(--muted);
  font-size: clamp(1rem, 2vw, 1.3rem);
  line-height: 1.5;
}

.appointment-hero {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: clamp(1rem, 3vw, 2rem);
  align-items: start;
  margin-bottom: clamp(2.6rem, 6vw, 4rem);
  padding: clamp(1.35rem, 4vw, 2.5rem);
  color: #fff;
  background:
    radial-gradient(circle at 95% 12%, rgba(101, 201, 188, 0.19), transparent 19rem),
    #0c211d;
  border-radius: clamp(20px, 3vw, 30px);
  box-shadow: 0 24px 44px rgba(19, 39, 34, 0.19);
}

.appointment-date {
  width: clamp(70px, 12vw, 90px);
  overflow: hidden;
  text-align: center;
  border: 1px solid rgba(101, 201, 188, 0.5);
  border-radius: 17px;
  background: rgba(255, 255, 255, 0.05);
}

.appointment-date span {
  display: block;
  padding: 0.4rem 0.3rem;
  color: #10221f;
  background: var(--aqua);
  font-size: 0.72rem;
  font-weight: 850;
  letter-spacing: 0.13em;
}

.appointment-date strong {
  display: block;
  padding: 0.55rem 0.3rem 0.65rem;
  font-size: clamp(1.75rem, 4vw, 2.5rem);
}

.appointment-main h2 {
  margin-bottom: 0.35rem;
  font-size: clamp(1.45rem, 4vw, 2.1rem);
}

.appointment-main > p:not(.eyebrow) {
  max-width: 48rem;
  color: rgba(255, 255, 255, 0.7);
  line-height: 1.5;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1.5rem;
}

.button {
  min-height: 48px;
  padding: 0.78rem 1.15rem;
  border: 1px solid transparent;
  border-radius: 13px;
  font-weight: 780;
  transition: transform 120ms ease, background 120ms ease;
}

.button:hover:not(:disabled) {
  transform: translateY(-1px);
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.button.primary {
  color: white;
  background: var(--teal);
}

.button.primary:hover:not(:disabled) {
  background: var(--teal-dark);
}

.button.secondary {
  color: var(--plum);
  background: transparent;
  border-color: #ad9eb1;
}

.button.aqua {
  color: #0b2621;
  background: var(--aqua);
}

.button.outline-light {
  color: white;
  background: transparent;
  border-color: rgba(255, 255, 255, 0.35);
}

.button.full {
  width: 100%;
}

.dashboard-block {
  margin: 0 0 2.7rem;
}

.section-heading-row {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.count-badge {
  min-width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  margin-bottom: 0.75rem;
  padding: 0 0.45rem;
  color: white;
  background: var(--amber);
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 800;
}

.stack {
  display: grid;
  gap: 0.85rem;
}

.action-card,
.question-card,
.update-card,
.record-card {
  position: relative;
  padding: 1.15rem 1.2rem;
  background: var(--warm-white);
  border: 1px solid var(--line);
  border-radius: 17px;
  box-shadow: 0 4px 15px rgba(41, 60, 54, 0.055);
}

.action-card,
.question-card {
  padding-left: 1.45rem;
  border-left: 5px solid var(--amber);
}

.action-card.act-now {
  border-left-color: var(--coral);
}

.action-top,
.record-top {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-start;
}

.action-card h3,
.question-card h3,
.record-card h3,
.update-card h3 {
  margin: 0;
  font-size: 1.06rem;
  line-height: 1.35;
}

.action-card p,
.question-card p,
.record-card p,
.update-card p {
  margin: 0.32rem 0 0;
  color: var(--muted);
  line-height: 1.45;
}

.due-label {
  flex: 0 0 auto;
  color: var(--amber);
  font-size: 0.8rem;
  font-weight: 780;
}

.act-now .due-label {
  color: var(--red);
}

.empty-card {
  padding: 1.35rem;
  color: var(--muted);
  background: rgba(255, 253, 249, 0.72);
  border: 1px dashed #b9c6c2;
  border-radius: 17px;
  line-height: 1.5;
}

.search-box {
  min-height: 50px;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin-bottom: 1rem;
  padding: 0 1rem;
  background: var(--warm-white);
  border: 1px solid var(--line);
  border-radius: 14px;
}

.search-box svg {
  width: 20px;
  fill: none;
  stroke: var(--muted);
  stroke-linecap: round;
  stroke-width: 1.8;
}

.search-box input {
  width: 100%;
  min-width: 0;
  padding: 0.8rem 0;
  color: var(--ink);
  background: transparent;
  border: 0;
  outline: 0;
}

.filter-row {
  display: flex;
  gap: 0.65rem;
  margin: 0 -1rem 1.5rem;
  padding: 0 1rem 0.4rem;
  overflow-x: auto;
  scroll-snap-type: x proximity;
  scrollbar-width: thin;
}

.filter-row button {
  min-height: 42px;
  flex: 0 0 auto;
  padding: 0.62rem 1rem;
  color: var(--muted);
  background: var(--warm-white);
  border: 1px solid #b8c5c1;
  border-radius: 999px;
  scroll-snap-align: start;
  font-weight: 720;
}

.filter-row button[aria-selected="true"] {
  color: white;
  background: var(--teal);
  border-color: var(--teal);
}

.record-meta {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.75rem;
  color: var(--muted);
  font-size: 0.88rem;
}

.record-meta strong {
  color: var(--ink);
  font-size: 1rem;
}

.record-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 290px), 1fr));
  gap: 0.85rem;
}

.record-card {
  min-height: 120px;
}

.record-card .record-label {
  display: inline-block;
  margin-top: 0.8rem;
  padding: 0.28rem 0.5rem;
  color: var(--teal-dark);
  background: #e5f3f0;
  border-radius: 7px;
  font-size: 0.72rem;
  font-weight: 780;
  letter-spacing: 0.02em;
}

.quick-questions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin-bottom: 1.6rem;
}

.quick-questions button {
  padding: 0.55rem 0.8rem;
  color: var(--teal-dark);
  background: #e5f3f0;
  border: 0;
  border-radius: 999px;
  font-size: 0.84rem;
  font-weight: 720;
}

.ask-form {
  padding: clamp(1rem, 3vw, 1.5rem);
  background: var(--warm-white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.ask-form > label {
  display: block;
  margin-bottom: 0.65rem;
  font-weight: 750;
}

.ask-control {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.65rem;
}

.ask-control input {
  width: 100%;
  min-height: 50px;
  padding: 0.7rem 0.9rem;
  color: var(--ink);
  background: #fff;
  border: 1px solid #b8c5c1;
  border-radius: 12px;
}

.answer-panel {
  margin-top: 1.25rem;
  padding: clamp(1.2rem, 4vw, 2rem);
  color: white;
  background: var(--plum);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.answer-panel .eyebrow {
  color: var(--aqua);
}

.answer-segments {
  display: grid;
  gap: 0.85rem;
}

.answer-segment {
  padding: 1rem;
  color: var(--ink);
  background: var(--warm-white);
  border-radius: 13px;
}

.answer-segment.calculation {
  border-left: 5px solid var(--aqua);
}

.answer-segment.warning {
  border-left: 5px solid #e9ad4b;
}

.answer-segment.danger {
  border-left: 5px solid var(--coral);
}

.segment-label {
  display: block;
  margin-bottom: 0.35rem;
  color: var(--teal);
  font-size: 0.72rem;
  font-weight: 850;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.answer-segment p {
  margin-bottom: 0;
  line-height: 1.52;
}

.evidence-list {
  margin: 0.75rem 0 0;
  padding: 0.65rem 0 0;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.45;
}

.safety-note,
.process-note,
.privacy-card {
  margin-top: 1.3rem;
  padding: 1.1rem 1.2rem;
  color: var(--muted);
  background: rgba(255, 253, 249, 0.8);
  border: 1px solid var(--line);
  border-radius: 16px;
  line-height: 1.5;
}

.safety-note strong {
  color: var(--red);
}

.upload-panel {
  padding: 1rem;
  background: var(--warm-white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.drop-zone {
  min-height: 220px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 1.5rem;
  text-align: center;
  color: var(--teal-dark);
  background: #eef7f5;
  border: 2px dashed #8bbcb3;
  border-radius: 15px;
  cursor: pointer;
}

.drop-zone svg {
  width: 44px;
  margin-bottom: 0.45rem;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.drop-zone strong {
  font-size: 1.12rem;
}

.drop-zone span,
.upload-rule {
  color: var(--muted);
  font-size: 0.86rem;
}

.upload-rule {
  margin: 0.8rem 0 0;
  text-align: center;
}

.file-preview {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 0.8rem;
  align-items: center;
  margin-top: 1rem;
  padding: 1rem;
  background: var(--warm-white);
  border: 1px solid var(--line);
  border-radius: 15px;
}

.file-icon {
  width: 48px;
  height: 54px;
  display: grid;
  place-items: center;
  color: white;
  background: var(--plum);
  border-radius: 9px;
  font-size: 0.67rem;
  font-weight: 850;
}

.file-details {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.18rem;
}

.file-details strong,
.file-details span,
.file-details code {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-details span,
.file-details code {
  color: var(--muted);
  font-size: 0.75rem;
}

.upload-action {
  margin-top: 1rem;
}

.upload-action p {
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.4;
}

.process-note {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.65rem 0.75rem;
}

.process-note p {
  margin: 0;
}

.step-number {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  color: white;
  background: var(--teal);
  border-radius: 50%;
  font-size: 0.75rem;
  font-weight: 800;
}

.detail-list {
  margin: 0 0 1rem;
  background: var(--warm-white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}

.detail-list div {
  display: grid;
  grid-template-columns: minmax(8rem, 0.7fr) minmax(0, 1.3fr);
  gap: 1rem;
  padding: 1rem 1.15rem;
  border-bottom: 1px solid #e5eae7;
}

.detail-list div:last-child {
  border-bottom: 0;
}

.detail-list dt {
  color: var(--muted);
}

.detail-list dd {
  margin: 0;
  overflow-wrap: anywhere;
  text-align: right;
  font-weight: 720;
}

.privacy-card h2 {
  color: var(--ink);
}

.settings-actions {
  display: grid;
  gap: 0.7rem;
}

.privacy-card p:last-child {
  margin-bottom: 0;
}

.demo-disclosure {
  padding-top: 0.8rem;
  border-top: 1px solid var(--line);
}

.load-gate {
  min-height: 55vh;
  display: grid;
  place-items: center;
}

.gate-card {
  width: min(100%, 520px);
  padding: 2rem;
  text-align: center;
  background: var(--warm-white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.gate-card h1 {
  margin: 1rem 0 0.6rem;
  font-family: inherit;
  font-size: 1.55rem;
  font-weight: 780;
  letter-spacing: -0.025em;
  line-height: 1.2;
}

.gate-card p {
  color: var(--muted);
  line-height: 1.5;
}

.spinner {
  width: 38px;
  height: 38px;
  margin: 0 auto;
  border: 4px solid #d9e5e1;
  border-top-color: var(--teal);
  border-radius: 50%;
  animation: spin 700ms linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.bottom-nav {
  position: fixed;
  z-index: 100;
  left: 50%;
  bottom: 0;
  width: min(100%, 760px);
  min-height: calc(66px + env(safe-area-inset-bottom));
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  padding: 0.45rem max(0.35rem, env(safe-area-inset-right)) env(safe-area-inset-bottom) max(0.35rem, env(safe-area-inset-left));
  transform: translateX(-50%);
  background: rgba(255, 253, 249, 0.97);
  border: 1px solid rgba(173, 190, 184, 0.82);
  border-bottom: 0;
  border-radius: 19px 19px 0 0;
  box-shadow: 0 -10px 30px rgba(30, 46, 41, 0.1);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
}

.bottom-nav button {
  min-width: 0;
  min-height: 54px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.14rem;
  padding: 0.25rem;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: 12px;
  font-size: 0.68rem;
  font-weight: 720;
}

.bottom-nav button[aria-current="page"] {
  color: var(--teal);
  background: #e9f5f2;
}

.bottom-nav svg {
  width: 23px;
  height: 23px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.bottom-nav .nav-send svg {
  stroke-width: 2.1;
}

@media (max-width: 640px) {
  .app-header {
    min-height: 82px;
    gap: 0.6rem;
  }

  .wordmark {
    width: 126px;
  }

  .brand-lockup > span {
    font-size: 0.58rem;
  }

  .person-chip {
    padding: 0.36rem;
  }

  .person-initials {
    width: 36px;
    height: 36px;
    flex-basis: 36px;
    font-size: 0.82rem;
  }

  .person-copy {
    display: none;
  }

  .snapshot-strip {
    justify-content: flex-start;
    font-size: 0.75rem;
  }

  .snapshot-strip .text-button {
    margin-left: auto;
  }

  main {
    padding-top: 1.7rem;
  }

  .page-heading {
    margin-bottom: 1.7rem;
  }

  .appointment-hero {
    grid-template-columns: 64px 1fr;
    padding: 1.2rem;
  }

  .appointment-date {
    width: 64px;
  }

  .button-row .button {
    flex: 1 1 8.5rem;
  }

  .action-top,
  .record-top {
    flex-direction: column;
    gap: 0.35rem;
  }

  .ask-control {
    grid-template-columns: 1fr;
  }

  .file-preview {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .file-preview .text-button {
    grid-column: 2;
    justify-self: start;
  }

  .detail-list div {
    grid-template-columns: 1fr;
    gap: 0.25rem;
  }

  .detail-list dd {
    text-align: left;
  }
}

@media (min-width: 900px) {
  .app-header {
    padding-left: max(2rem, calc((100vw - 1120px) / 2));
    padding-right: max(2rem, calc((100vw - 1120px) / 2));
  }

  .snapshot-strip {
    justify-content: center;
  }

  .bottom-nav {
    bottom: 1rem;
    padding-bottom: 0.45rem;
    border-bottom: 1px solid rgba(173, 190, 184, 0.82);
    border-radius: 19px;
  }

  main {
    padding-bottom: 9rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
