@font-face {
  font-family: "Vazir";
  src: url("assets/vazir-regular.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: "Vazir";
  src: url("assets/vazir-medium.woff2") format("woff2");
  font-weight: 500;
  font-display: swap;
}

@font-face {
  font-family: "Vazir";
  src: url("assets/vazir-bold.woff2") format("woff2");
  font-weight: 700;
  font-display: swap;
}

:root {
  color-scheme: light;
  --brand: #24489c;
  --ink: #1d3d83;
  --muted: #516283;
  --surface: #fff;
  --backdrop: #edf3fa;
  --tint: #eaf2fc;
  --line: #e1e8f1;
  --gold: #cfab7c;
  --gold-dark: #b27d3f;
  --shadow: 0 3px 15px #25426316;
  font-family: "Vazir", Tahoma, sans-serif;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --brand: #afc8ff;
  --ink: #ecf2ff;
  --muted: #b7c7e2;
  --surface: #1a2942;
  --backdrop: #111b2d;
  --tint: #273e64;
  --line: #354869;
  --gold: #e5ba78;
  --gold-dark: #e5ba78;
  --shadow: 0 3px 14px #070d1860;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  background: var(--backdrop);
  color: var(--ink);
  font-size: 16px;
}
button, input, select, textarea { font: inherit; }
a { color: inherit; text-decoration: none; }
button { cursor: pointer; }
button:disabled { opacity: .55; cursor: default; }
:focus-visible { outline: 3px solid #4b92dc; outline-offset: 3px; }
h1, h2, h3, p { margin: 0; }
h1 { line-height: 1.35; font-size: clamp(1.5rem, 5vw, 2.23rem); }
h2 { line-height: 1.55; font-size: 1.22rem; }
h3 { font-size: 1.06rem; font-weight: 500; }
.records h3 { font-weight: 700; }
p { line-height: 1.73; }
img { display: block; max-width: 100%; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  white-space: nowrap;
  clip-path: inset(50%);
}

.app {
  width: min(100%, 740px);
  min-height: 100dvh;
  margin-inline: auto;
  background: var(--surface);
}
.topbar {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) 44px;
  justify-items: center;
  align-items: center;
  min-height: 70px;
  padding: max(8px, env(safe-area-inset-top)) 20px 8px;
}
.brand { display: block; width: 140px; height: 43px; object-fit: contain; }
.icon-button {
  display: inline-grid;
  width: 42px;
  height: 42px;
  place-items: center;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--surface);
  color: var(--brand);
  font-size: 1.65rem;
  line-height: 1;
}
.back-link { direction: ltr; }
.menu-mark, .menu-mark::before, .menu-mark::after {
  display: block;
  width: 17px;
  height: 2px;
  border-radius: 2px;
  background: currentColor;
}
.menu-mark { position: relative; }
.menu-mark::before, .menu-mark::after { content: ""; position: absolute; inset-inline-start: 0; }
.menu-mark::before { top: -5px; }
.menu-mark::after { top: 5px; }

.auth-shell {
  display: grid;
  min-height: 100dvh;
  place-items: start center;
  padding: max(27px, env(safe-area-inset-top)) 20px calc(18px + env(safe-area-inset-bottom));
}
.auth-flow, .auth-check { width: min(100%, 380px); }
.auth-card {
  display: grid;
  grid-template-rows: minmax(84px, 26%) auto 1fr;
  justify-items: center;
  align-items: center;
  min-height: clamp(365px, 77dvh, 656px);
  padding: 22px 20px 18px;
  border: 1px solid var(--line);
  border-radius: 28px;
  background: #f0f1f3;
  box-shadow: var(--shadow);
  text-align: center;
}
.auth-check { grid-template-rows: auto; gap: 10px; align-self: center; min-height: 250px; align-content: center; }
.auth-check h1 { font-size: 1.24rem; }
.auth-brand { width: min(72%, 228px); height: auto; }
.auth-check .auth-brand { width: min(57%, 151px); margin-bottom: 8px; }
.auth-company { width: 111px; min-height: 24px; align-self: end; object-fit: contain; margin-top: 8px; }
.auth-fields { width: 100%; padding-block: clamp(14px, 4.2dvh, 35px) 13px; }
.auth-fields h1 { margin-bottom: 25px; font-size: clamp(1rem, 4.2vw, 1.2rem); font-weight: 400; }
#otp-title { margin-bottom: 7px; }
.auth-fields .note { margin-top: 5px; }
.auth-next { width: 100%; margin-top: 13px; }
.action-label { display: block; width: 37px; height: 22px; object-fit: contain; filter: brightness(0) invert(1); }
.auth-flow[data-busy] .action-label { opacity: .64; }
.auth-dots { display: flex; justify-content: center; gap: 5px; margin: 9px auto 0; }
.auth-dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--gold); }
.auth-dots .on { background: var(--brand); }
.intro-image {
  display: grid;
  justify-items: center;
  align-content: space-between;
  min-height: clamp(382px, 77dvh, 656px);
  padding: 21px 13px;
  border-radius: 28px;
  background: #e9eaed url("assets/intro-meter.webp") center / cover no-repeat;
  text-align: center;
}
.intro-image .auth-brand { width: min(49%, 160px); margin-top: 5%; }
.intro-caption { text-shadow: 0 1px 7px #fff; }
.intro-caption h1 { font-size: 1.12rem; }
.intro-caption p { color: #745123; font-size: .72rem; font-weight: 700; }
.phone-input {
  width: min(100%, 292px);
  min-height: 49px;
  padding: 9px 12px;
  border: 1px solid var(--gold);
  border-radius: 28px;
  background: var(--surface);
  color: var(--ink);
  text-align: center;
  font-size: 1.04rem;
}
.otp-control {
  position: relative;
  width: min(100%, 286px);
  margin: 14px auto 9px;
  border-radius: 16px;
}
.otp-slots { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; pointer-events: none; }
.otp-slots span {
  display: grid;
  min-height: 52px;
  place-items: center;
  border-radius: 12px;
  background: #d7e5f6;
  color: var(--ink);
  font-size: 1.26rem;
  font-weight: 500;
}
.otp-control:focus-within .otp-slots span.active {
  outline: 1px solid var(--brand);
  outline-offset: 2px;
}
.otp-control:focus-within .otp-slots span.selected { box-shadow: inset 0 0 0 1px var(--gold); }
.otp-control:has(input[aria-invalid="true"]) span, .phone-input[aria-invalid="true"] {
  box-shadow: inset 0 0 0 1px #a22639;
}
.otp-control input {
  position: absolute;
  inset: 0;
  width: 100%;
  border: 0;
  outline: none;
  opacity: 0;
}
.auth-options { display: flex; flex-wrap: wrap; gap: 5px 17px; justify-content: center; margin-top: 7px; }
.text-button {
  padding: 4px 0;
  min-height: 44px;
  border: 0;
  background: none;
  color: var(--brand);
  font-size: .86rem;
  text-decoration: underline;
  text-underline-offset: 3px;
}
main {
  display: grid;
  gap: 16px;
  align-content: start;
  min-height: calc(100dvh - 70px);
  padding: 0 18px calc(91px + env(safe-area-inset-bottom));
}
#screen:focus { outline: none; }
.app-view { display: grid; align-content: start; gap: 13px; }
.app-view > h1 { padding: 0 3px; font-size: 1.35rem; }
.meter-hero {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 212px;
  padding: 18px 20px 35px;
  border-radius: 24px;
  background: #d5e1f4 url("assets/home-backdrop.webp") center 42% / cover no-repeat;
}
.meter-hero > img {
  width: min(64%, 318px);
  height: auto;
  border-radius: 20px;
}
.hero-actions { position: absolute; inset-inline-start: 9px; bottom: 8px; display: flex; gap: 8px; }
.hero-actions .icon-button { position: relative; overflow: hidden; background: #f1f6ffe8; border: 0; }
.hero-actions img { position: absolute; width: 62px; height: 62px; max-width: none; object-fit: contain; }
.home-actions { display: grid; }
.calendar { display: grid; gap: 14px; }
.calendar h2 { margin: 0; font-size: 1rem; }
.calendar .icon-button { border: 0; direction: ltr; width: 35px; height: 36px; }
.calendar-days { display: grid; gap: 5px; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.day-chip {
  display: grid;
  place-content: center;
  gap: 1px;
  min-height: 53px;
  border: 1px solid transparent;
  border-radius: 14px;
  background: var(--tint);
  color: var(--ink);
  text-align: center;
  font-size: .84rem;
}
.day-chip.has-reading { border-color: var(--gold); }
.day-chip[aria-current="date"] { background: #24489c; color: #fff; border-color: var(--gold); }

.bottom-nav {
  position: fixed;
  inset-inline: 0;
  bottom: max(8px, env(safe-area-inset-bottom));
  z-index: 2;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 2px;
  width: min(calc(100% - 24px), 704px);
  min-height: 63px;
  margin-inline: auto;
  padding: 3px;
  border: 1px solid var(--gold);
  border-radius: 38px;
  background: var(--surface);
  box-shadow: var(--shadow);
  text-align: center;
}
.bottom-nav a { display: grid; place-content: center; justify-items: center; gap: 3px; border-radius: 32px; color: var(--brand); font-size: .8rem; }
.bottom-nav img { width: 24px; height: 24px; object-fit: contain; }
.bottom-nav a[aria-current="page"] { color: white; background: #24489c; font-weight: 700; }
.bottom-nav a[aria-current="page"] img { filter: brightness(0) invert(1); }

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 7px 21px;
  border: 1px solid var(--brand);
  border-radius: 100px;
  background: var(--brand);
  color: white;
  font-weight: 500;
}
.button.outline {
  background: var(--surface);
  border-color: var(--gold);
  color: var(--ink);
}
.button.small { min-height: 40px; padding-inline: 14px; font-size: .87rem; }
.panel {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--surface);
  box-shadow: var(--shadow);
}
.entry h1 { text-align: center; }
.entry-form { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: stretch; gap: 8px; }
.reading-field {
  position: relative;
  display: flex;
  flex-direction: row-reverse;
  align-items: center;
  border: 1px solid var(--gold);
  border-radius: 100px;
}
.reading-field input {
  flex: 1;
  width: 100%;
  min-width: 0;
  min-height: 48px;
  border: 0;
  padding: 8px 4px 8px 12px;
  border-radius: inherit;
  background: transparent;
  color: var(--ink);
  text-align: center;
  font-size: 1.08rem;
}
.reading-field input::placeholder { color: var(--muted); opacity: 1; }
.reading-field > .unit { padding-inline-start: 12px; }
.unit {
  display: inline-block;
  direction: ltr;
  font-size: .71rem;
  color: var(--muted);
  white-space: nowrap;
}
.note { color: var(--muted); font-size: .87rem; }
.entry > .note { margin-top: 10px; }
.error { margin-top: 7px; color: #a22639; font-size: .88rem; }
.save-status { margin-top: 7px; color: #167450; font-size: .88rem; }
.save-status:empty { margin: 0; }

.analysis { display: grid; align-items: start; gap: 13px; }
.analysis > h2 { padding-inline-start: 4px; }
.empty { display: grid; place-items: center; min-height: 85px; background: #f6faff; color: var(--muted); text-align: center; }
#summary:not(.empty) { display: grid; gap: 12px; }
.measure { display: grid; gap: 4px; min-width: 0; }
.measure-label { color: var(--muted); font-size: .9rem; font-weight: 500; }
.value-row { display: flex; flex-direction: row-reverse; justify-content: flex-end; align-items: baseline; gap: 6px; }
.number { font-size: clamp(1.8rem, 8vw, 2.55rem); font-weight: 400; line-height: 1.18; }
.change { width: fit-content; padding: 3px 9px; border-radius: 100px; background: var(--tint); font-size: .83rem; }
.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 7px; }
.stats .measure { padding: 8px 5px; border: 1px solid var(--line); border-radius: 16px; text-align: center; }
.stats .value-row { flex-wrap: wrap; justify-content: center; gap: 4px; }
.stats .number { font-size: 1.27rem; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.trend > .note { margin: 3px 0 8px; }
#chart { display: block; width: 100%; height: 150px; }
.record-list { padding: 0; margin: 9px 0 0; list-style: none; }
.record {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 7px;
  padding: 8px 0;
  border-top: 1px solid var(--line);
}
#show-more { margin-top: 11px; }
.card-list, .form-stack, .info-page { display: grid; gap: 10px; }
.two-columns { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.setting-row {
  display: flex;
  align-items: center;
  min-height: 53px;
  width: 100%;
  padding: 10px 15px;
  color: var(--ink);
  font-size: .94rem;
  text-align: start;
}
.setting-row.appearance, .profile-row { justify-content: space-between; }
.danger { color: #a03c4b; }
.profile-row { display: flex; align-items: baseline; gap: 10px; font-size: .9rem; }
.profile-name { margin: 4px 0; text-align: center; }
.profile-row strong { overflow-wrap: anywhere; }
.form-stack label { display: grid; gap: 4px; font-size: .9rem; }
.form-stack input:not([type="checkbox"]):not([type="radio"]), .form-stack select, .form-stack textarea {
  width: 100%;
  min-width: 0;
  min-height: 44px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--surface);
  color: var(--ink);
}
.form-stack fieldset { margin: 0; padding: 8px 10px; border: 1px solid var(--line); border-radius: 14px; }
.form-stack legend { padding-inline: 4px; font-size: .88rem; }
.form-stack :is(input, textarea, select):focus-visible { outline-offset: 1px; }
.feature-image, .feature-card img { width: 100%; height: clamp(114px, 28vw, 218px); border-radius: 16px; object-fit: cover; background: var(--tint); }
.feature-card { display: grid; gap: 9px; }
.feature-card h1, .info-page h1 { font-size: 1.3rem; }
.education-card, .health-status { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.education-card { flex-direction: row-reverse; }
.education-card h2 { font-size: .99rem; }
.education-card img, .health-status img { width: min(33%, 150px); height: 67px; object-fit: cover; border-radius: 12px; }
.health-status { flex-direction: row-reverse; }
.health-status h2 { font-size: .99rem; }
.company-mark { width: 150px; justify-self: center; margin: 22px 0; }
.choices { display: grid; max-height: 330px; overflow-y: auto; }
.choices .share-choice { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 6px; min-height: 44px; border-top: 1px solid var(--line); }
.choices .share-choice:first-child { border: 0; }
.share-choice time { text-align: end; }
.rating { display: flex; gap: 4px; flex-wrap: wrap; }
.rating label { position: relative; cursor: pointer; }
.rating input { position: absolute; opacity: 0; }
.rating label span { display: grid; place-items: center; min-width: 44px; min-height: 44px; color: var(--muted); font-size: 1.45rem; }
.rating label:has(input:checked) span, .rating label:has(~ label input:checked) span { color: var(--gold-dark); }
.rating input:focus-visible + span { outline: 3px solid #4b92dc; border-radius: 8px; }
.dialog-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 9px; }

dialog {
  width: min(calc(100% - 34px), 430px);
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: var(--shadow);
  color: var(--ink);
  background: var(--surface);
}
dialog::backdrop { background: #192f5970; }
dialog p { margin: 8px 0 16px; }
.side-menu {
  width: min(340px, calc(100% - 32px));
  max-width: none;
  height: 100dvh;
  max-height: none;
  margin: 0;
  margin-inline-end: auto;
  padding: 14px 17px;
  border-radius: 0 0 0 22px;
}
.side-menu nav { display: grid; margin-top: 14px; }
.side-menu nav :is(a, button) { min-height: 46px; padding: 10px 4px; border-bottom: 1px solid var(--line); text-align: start; }
.side-menu .brand { max-width: 65%; }

[data-theme="dark"] .auth-card { background: #19263e; }
[data-theme="dark"] .otp-slots span, [data-theme="dark"] .empty { background: var(--tint); }
[data-theme="dark"] .brand, [data-theme="dark"] .auth-card .auth-brand { filter: brightness(1.55); }
[data-theme="dark"] .button:not(.outline) { background: #2d56a7; border-color: #426dc2; }
[data-theme="dark"] .bottom-nav a:not([aria-current="page"]) img { filter: brightness(1.6); }
[data-theme="dark"] .error, [data-theme="dark"] .danger { color: #ffa5ad; }
[data-theme="dark"] .save-status { color: #81d8ad; }

@media (min-width: 700px) {
  .app { box-shadow: 0 0 46px #15386e20; }
  .topbar { padding-inline: 26px; }
  main { padding-inline: 26px; }
  .meter-hero { min-height: 290px; }
  #summary:not(.empty) { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: center; }
}

@media (max-width: 355px) {
  main { padding-inline: 12px; }
  .entry-form { grid-template-columns: 1fr; }
  .auth-shell { padding-inline: 12px; }
  .auth-card { padding-inline: 13px; }
}


.home-actions { gap: 10px; }
.records-notice { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }
.care, .care-section, .care-list, .care-messages { display: grid; gap: 12px; }
.care-section { min-width: 0; }
.care-list, .care-messages { padding: 0; margin: 0; list-style: none; }
.care-doctor { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.care-doctor > * { min-width: 0; overflow-wrap: anywhere; }
.care-doctor .button { flex: 0 0 auto; padding-inline: 12px; }
.care fieldset { min-width: 0; padding: 0; margin: 0; border: 0; }
.care-ticket summary { cursor: pointer; font-weight: 700; overflow-wrap: anywhere; }
.care-ticket summary .note { padding-inline-start: 10px; font-weight: 400; }
.care-ticket[open] summary { margin-bottom: 10px; }
.care-message { padding: 10px 12px; border-radius: 10px; background: var(--tint); overflow-wrap: anywhere; }
.care-message-heading { display: flex; flex-wrap: wrap; justify-content: space-between; column-gap: 10px; font-weight: 700; }
.care-message p { white-space: pre-wrap; margin-top: 3px; }
.care-reply { border-top: 1px solid var(--line); margin-top: 12px; padding-top: 12px; }
.care-reply textarea { resize: vertical; }
@media (min-width: 430px) {
  .home-actions { grid-template-columns: repeat(2, 1fr); }
}
#care-name-note a { color: var(--brand); text-decoration: underline; text-underline-offset: 3px; }
