/* ==========================================================================
   HMS — dizayn tizimi
   Palitra: jarrohlik yashili (brand) + zaytun-ko'k siyoh + zafaron signali
   ========================================================================== */

:root {
  --brand:        #1F6E68;
  --brand-deep:   #124A46;
  --brand-soft:   #E3F0EE;
  --signal:       #C8912E;
  --signal-soft:  #FBF2DF;
  --danger:       #B3261E;
  --danger-soft:  #FBEAE9;
  --success:      #1F7A47;

  --ink:          #10202B;
  --ink-2:        #3D5561;
  --ink-3:        #6E848E;
  --line:         #DDE5E4;
  --paper:        #F2F5F4;
  --surface:      #FFFFFF;
  --surface-2:    #F8FAF9;

  --radius-sm: 8px;
  --radius:    14px;
  --radius-lg: 22px;

  --shadow-sm: 0 1px 2px rgba(16, 32, 43, .06);
  --shadow:    0 4px 20px -6px rgba(16, 32, 43, .14);
  --shadow-lg: 0 24px 60px -24px rgba(16, 32, 43, .32);

  --font-display: "Unbounded", "Manrope", system-ui, sans-serif;
  --font-body:    "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono:    "IBM Plex Mono", ui-monospace, "SF Mono", monospace;

  --step-0: 0.9375rem;
  --step-1: 1.0625rem;
  --step-2: 1.375rem;
  --step-3: 1.875rem;
  --step-4: 2.5rem;
}

[data-theme="dark"] {
  --brand:      #4FB3A6;
  --brand-deep: #7FD3C7;
  --brand-soft: #16302E;
  --signal:     #E5B860;
  --signal-soft:#332912;
  --danger:     #F1766B;
  --danger-soft:#3A1917;
  --success:    #5EC489;

  --ink:      #E8EFEE;
  --ink-2:    #A9BCC1;
  --ink-3:    #7A8F96;
  --line:     #24363E;
  --paper:    #0B161C;
  --surface:  #111F27;
  --surface-2:#16272F;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .5);
  --shadow:    0 4px 22px -6px rgba(0, 0, 0, .6);
  --shadow-lg: 0 24px 60px -24px rgba(0, 0, 0, .8);
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: var(--step-0);
  line-height: 1.6;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 500;
  letter-spacing: -0.02em;
  line-height: 1.15;
  margin: 0 0 .5em;
}

a { color: var(--brand); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--brand-deep); }

:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ---------------------------------------------------------------- Layout */
.shell { min-height: 100dvh; display: flex; flex-direction: column; }
.container { width: min(1160px, 100% - 2.5rem); margin-inline: auto; }

/* ------------------------------------------------------------ Auth sahifa */
.auth {
  min-height: 100dvh;
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  background: var(--paper);
}

.auth__aside {
  position: relative;
  overflow: hidden;
  padding: 3rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  color: #F2F7F6;
  background:
    radial-gradient(120% 90% at 15% 5%, #2A8A82 0%, transparent 55%),
    linear-gradient(155deg, var(--brand-deep) 0%, #0C3330 100%);
}

.auth__brand {
  font-family: var(--font-display);
  font-size: 1.05rem;
  letter-spacing: .01em;
  display: flex;
  align-items: center;
  gap: .6rem;
}

.auth__mark {
  width: 34px; height: 34px;
  display: grid; place-items: center;
  border-radius: 10px;
  background: rgba(255, 255, 255, .14);
  border: 1px solid rgba(255, 255, 255, .2);
}

.auth__claim {
  font-family: var(--font-display);
  font-size: clamp(1.6rem, 3vw, 2.4rem);
  font-weight: 400;
  max-width: 15ch;
  margin: 0;
}
.auth__claim strong { font-weight: 600; }

.auth__meta {
  display: flex; gap: 2rem; flex-wrap: wrap;
  font-size: .8125rem; color: rgba(242, 247, 246, .72);
}
.auth__meta dt { font-family: var(--font-mono); font-size: .6875rem;
  text-transform: uppercase; letter-spacing: .12em; opacity: .65; margin-bottom: .15rem; }
.auth__meta dd { margin: 0; font-weight: 600; color: #F2F7F6; }

/* Signature: ECG chizig'i */
.pulse { position: absolute; inset-inline: 0; bottom: 26%; opacity: .5; pointer-events: none; }
.pulse path {
  fill: none;
  stroke: rgba(200, 145, 46, .9);
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 1400;
  stroke-dashoffset: 1400;
  animation: trace 5.5s cubic-bezier(.5, 0, .3, 1) infinite;
}
@keyframes trace {
  0%   { stroke-dashoffset: 1400; }
  55%  { stroke-dashoffset: 0; }
  85%  { stroke-dashoffset: 0; opacity: 1; }
  100% { stroke-dashoffset: 0; opacity: 0; }
}

.auth__panel {
  display: grid;
  place-items: center;
  padding: 2.5rem 1.5rem;
}

.auth__card { width: min(430px, 100%); }
.auth__title { font-size: var(--step-3); margin-bottom: .35rem; }
.auth__lead { color: var(--ink-2); margin: 0 0 2rem; }
.auth__foot { margin-top: 1.75rem; font-size: .875rem; color: var(--ink-2); text-align: center; }

@media (max-width: 900px) {
  .auth { grid-template-columns: 1fr; }
  .auth__aside { padding: 1.75rem; gap: 1.75rem; }
  .auth__claim { font-size: 1.4rem; max-width: none; }
  .pulse { display: none; }
}

/* ----------------------------------------------------------------- Forms */
.field { margin-bottom: 1.05rem; }
.field__label {
  display: block;
  font-size: .8125rem;
  font-weight: 600;
  color: var(--ink-2);
  margin-bottom: .35rem;
}
.field__input {
  width: 100%;
  padding: .8rem .95rem;
  font: inherit;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  transition: border-color .15s, box-shadow .15s;
}
.field__input:hover { border-color: var(--ink-3); }
.field__input:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-soft);
}
.field__input--code {
  font-family: var(--font-mono);
  font-size: 1.5rem;
  letter-spacing: .55em;
  text-align: center;
  padding-inline: .5rem;
}
.field__help { font-size: .78125rem; color: var(--ink-3); margin-top: .3rem; }
.field__error { font-size: .8125rem; color: var(--danger); margin-top: .3rem; font-weight: 600; }
.field--invalid .field__input { border-color: var(--danger); }

.field--check { display: flex; align-items: flex-start; gap: .55rem; }
.field--check input { margin-top: .25rem; accent-color: var(--brand); width: 1rem; height: 1rem; }
.field--check label { font-size: .875rem; color: var(--ink-2); }

.row { display: flex; gap: .9rem; }
.row > * { flex: 1; }
@media (max-width: 520px) { .row { flex-direction: column; gap: 0; } }

/* --------------------------------------------------------------- Buttons */
.btn {
  position: relative;
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  padding: .8rem 1.35rem;
  font: inherit; font-weight: 700; font-size: .9375rem;
  letter-spacing: .01em;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-decoration: none !important;
  white-space: nowrap;
  transition: transform .15s ease, background .15s ease, border-color .15s ease,
              box-shadow .2s ease, color .15s ease;
}
.btn:hover { text-decoration: none; }
.btn:active { transform: translateY(1px) scale(.98); }
.btn:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

.btn--primary {
  background: linear-gradient(180deg, color-mix(in srgb, var(--brand) 100%, white 10%), var(--brand));
  color: #fff;
  box-shadow:
    0 1px 0 rgba(255,255,255,.25) inset,
    0 10px 24px -8px color-mix(in srgb, var(--brand) 65%, transparent),
    0 0 0 1px color-mix(in srgb, var(--brand) 40%, transparent);
}
.btn--primary:hover {
  background: linear-gradient(180deg, var(--brand), var(--brand-deep));
  color: #fff;
  transform: translateY(-1px);
  box-shadow:
    0 1px 0 rgba(255,255,255,.25) inset,
    0 14px 32px -8px color-mix(in srgb, var(--brand) 75%, transparent),
    0 0 0 1px color-mix(in srgb, var(--brand) 55%, transparent);
}
.btn--ghost {
  background: var(--surface); border-color: var(--line); color: var(--ink);
  box-shadow: 0 1px 2px rgba(16,32,43,.05);
}
.btn--ghost:hover {
  border-color: var(--brand);
  color: var(--brand-deep);
  background: var(--brand-soft);
  transform: translateY(-1px);
}
.btn--danger { background: transparent; border-color: var(--danger); color: var(--danger); }
.btn--danger:hover { background: var(--danger); color: #fff; }
.btn--block { width: 100%; }
.btn--lg { padding: .95rem 1.5rem; font-size: 1rem; }

/* ----------------------------------------------------------------- Cards */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 1.5rem;
}
.card__title { font-size: var(--step-2); margin-bottom: .25rem; }
.card__lead { color: var(--ink-2); margin: 0 0 1.25rem; }

/* -------------------------------------------------------------- Messages */
.alerts { display: grid; gap: .6rem; margin-bottom: 1.25rem; }
.alert {
  display: flex; gap: .65rem; align-items: flex-start;
  padding: .8rem 1rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--surface-2);
  font-size: .875rem;
}
.alert--success { background: var(--brand-soft); border-color: transparent; color: var(--success); }
.alert--error   { background: var(--danger-soft); border-color: transparent; color: var(--danger); }
.alert--warning { background: var(--signal-soft); border-color: transparent; color: var(--signal); }
.alert__dot { width: .5rem; height: .5rem; border-radius: 50%; background: currentColor; margin-top: .5rem; flex: none; }

/* ---------------------------------------------------------------- Tables */
.table { width: 100%; border-collapse: collapse; font-size: .875rem; }
.table th {
  text-align: left; font-family: var(--font-mono); font-size: .6875rem;
  text-transform: uppercase; letter-spacing: .1em; color: var(--ink-3);
  padding: .6rem .75rem; border-bottom: 1px solid var(--line); font-weight: 500;
}
.table td { padding: .75rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: none; }
.table-wrap { overflow-x: auto; }

.tag {
  display: inline-block; padding: .2rem .55rem; border-radius: 999px;
  font-size: .75rem; font-weight: 600;
}
.tag--ok   { background: var(--brand-soft); color: var(--success); }
.tag--bad  { background: var(--danger-soft); color: var(--danger); }
.tag--warn { background: var(--signal-soft); color: var(--signal); }

/* ----------------------------------------------------------------- Utils */
.stack > * + * { margin-top: 1.25rem; }
.muted { color: var(--ink-3); }
.mono { font-family: var(--font-mono); }
.center { text-align: center; }
.divider { height: 1px; background: var(--line); border: 0; margin: 1.5rem 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;
}

.theme-toggle {
  position: fixed; top: 1rem; right: 1rem; z-index: 50;
  width: 40px; height: 40px; display: grid; place-items: center;
  border-radius: 50%; border: 1px solid var(--line);
  background: var(--surface); color: var(--ink); cursor: pointer;
}

/* ------------------------------------------------------- Xato sahifalari */
.error-page { min-height: 100dvh; display: grid; place-items: center; padding: 2rem; text-align: center; }
.error-page__code {
  font-family: var(--font-display); font-size: clamp(4rem, 14vw, 8rem);
  font-weight: 600; line-height: 1; color: var(--brand); margin: 0;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  .pulse path { stroke-dashoffset: 0; }
}

/* ======================================================================
   Bosh sahifa — Hero
   ====================================================================== */
.nav {
  position: sticky; top: 0; z-index: 40;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.nav__row {
  display: flex; align-items: center; justify-content: space-between;
  padding-block: 1rem;
}
.nav__brand {
  font-family: var(--font-display); font-size: 1.05rem;
  display: flex; align-items: center; gap: .6rem; color: var(--ink);
}
.nav__mark {
  width: 34px; height: 34px; display: grid; place-items: center;
  border-radius: 10px; background: var(--brand-soft); color: var(--brand);
}
.nav__links { display: flex; align-items: center; gap: .5rem; }
@media (max-width: 640px) { .nav__links .btn span.btn__text { display: none; } }

.hero {
  position: relative; overflow: hidden;
  padding-block: clamp(3rem, 8vw, 6rem);
  background:
    radial-gradient(90% 70% at 85% -10%, var(--brand-soft) 0%, transparent 60%),
    var(--paper);
}
.hero__grid {
  display: grid; grid-template-columns: 1.1fr .9fr; gap: 3rem; align-items: center;
}
@media (max-width: 900px) { .hero__grid { grid-template-columns: 1fr; } }

.hero__eyebrow {
  display: inline-flex; align-items: center; gap: .45rem;
  font-family: var(--font-mono); font-size: .75rem; text-transform: uppercase;
  letter-spacing: .12em; color: var(--brand);
  background: var(--brand-soft); border-radius: 999px; padding: .35rem .8rem;
  margin-bottom: 1.25rem;
}
.hero__eyebrow .dot { width: .4rem; height: .4rem; border-radius: 50%; background: var(--brand); }

.hero__title {
  font-size: clamp(2rem, 4.5vw, 3.4rem); margin-bottom: 1rem; max-width: 16ch;
}
.hero__title strong { color: var(--brand); font-weight: 600; }
.hero__lead { font-size: var(--step-1); color: var(--ink-2); max-width: 46ch; margin: 0 0 2rem; }
.hero__actions { display: flex; gap: .9rem; flex-wrap: wrap; margin-bottom: 2.25rem; }

.hero__stats { display: flex; gap: clamp(1.25rem, 4vw, 2.5rem); flex-wrap: wrap; }
.hero__stat b { display: block; font-family: var(--font-display); font-size: var(--step-3); color: var(--ink); }
.hero__stat span { font-size: .8125rem; color: var(--ink-3); }

.hero__art {
  position: relative; aspect-ratio: 4/5; border-radius: var(--radius-lg);
  background: linear-gradient(155deg, var(--brand-deep) 0%, #0C3330 100%);
  overflow: hidden; box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column; justify-content: space-between; padding: 1.75rem;
  color: #F2F7F6;
}
.hero__art .pulse { bottom: 38%; }
.hero__art-card {
  background: rgba(255, 255, 255, .1); border: 1px solid rgba(255, 255, 255, .16);
  border-radius: var(--radius); padding: 1rem 1.1rem; backdrop-filter: blur(6px);
}
.hero__art-card b { display: block; font-family: var(--font-display); font-size: 1.1rem; }
.hero__art-card span { font-size: .8rem; opacity: .8; }

/* ------------------------------------------------------------- Sections */
.section { padding-block: clamp(2.5rem, 6vw, 4.5rem); }
.section__head { max-width: 62ch; margin-bottom: 2.25rem; }
.section__eyebrow {
  font-family: var(--font-mono); font-size: .75rem; text-transform: uppercase;
  letter-spacing: .12em; color: var(--brand); margin-bottom: .5rem; display: block;
}
.section__title { font-size: var(--step-3); margin-bottom: .5rem; }
.section__lead { color: var(--ink-2); margin: 0; }
.section--tinted { background: var(--surface-2); }

.features {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1.25rem;
}
.feature {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1.5rem; box-shadow: var(--shadow-sm);
}
.feature__icon {
  width: 44px; height: 44px; display: grid; place-items: center; margin-bottom: 1rem;
  border-radius: var(--radius-sm); background: var(--brand-soft); color: var(--brand);
}
.feature h3 { font-size: 1.05rem; margin-bottom: .35rem; }
.feature p { color: var(--ink-2); margin: 0; font-size: .9rem; }

/* ============================================================== Doctors */
.doctor-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1.5rem;
}

.doctor-card {
  display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg);
  overflow: hidden; box-shadow: var(--shadow-sm);
  transition: transform .18s ease, box-shadow .18s ease;
}
.doctor-card:hover { transform: translateY(-4px); box-shadow: var(--shadow); }

.doctor-card__photo {
  aspect-ratio: 4/3.2; width: 100%; object-fit: cover; background: var(--surface-2);
  color: var(--ink-3);
}
.doctor-card__photo-fallback {
  aspect-ratio: 4/3.2; width: 100%; display: grid; place-items: center;
  background: var(--brand-soft); color: var(--brand);
  font-family: var(--font-display); font-size: 2.5rem;
}
.doctor-card__body { padding: 1.15rem 1.25rem 1.35rem; display: flex; flex-direction: column; gap: .6rem; flex: 1; }
.doctor-card__name { font-size: 1.05rem; margin: 0; }
.doctor-card__spec { color: var(--brand); font-weight: 600; font-size: .8125rem; margin: 0; }
.doctor-card__meta { display: flex; gap: .5rem; flex-wrap: wrap; font-size: .75rem; color: var(--ink-3); }
.doctor-card__chips { display: flex; gap: .4rem; flex-wrap: wrap; margin-top: .1rem; }
.doctor-card__foot {
  margin-top: auto; padding-top: .85rem; border-top: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between; gap: .5rem;
}
.doctor-card__price { font-family: var(--font-mono); font-weight: 600; color: var(--ink); font-size: .875rem; }
.doctor-card__price span { color: var(--ink-3); font-weight: 400; font-size: .75rem; }

.chip {
  display: inline-flex; align-items: center; padding: .25rem .6rem; border-radius: 999px;
  font-size: .7rem; font-weight: 600; background: var(--surface-2); color: var(--ink-2);
  border: 1px solid var(--line); white-space: nowrap;
}
.chip--brand { background: var(--brand-soft); color: var(--brand-deep); border-color: transparent; }
.chip--active { background: var(--brand); color: #fff; border-color: transparent; }
.chip-list { display: flex; gap: .5rem; flex-wrap: wrap; }
a.chip { text-decoration: none; transition: transform .1s; }
a.chip:hover { transform: translateY(-1px); }

.empty-state {
  text-align: center; padding: 3.5rem 1.5rem; color: var(--ink-3);
  border: 1px dashed var(--line); border-radius: var(--radius-lg);
}

/* ----------------------------------------------------------- Doctor page */
.doctor-hero {
  display: grid; grid-template-columns: 260px 1fr; gap: 2rem; align-items: start;
  margin-bottom: 2.5rem;
}
@media (max-width: 720px) { .doctor-hero { grid-template-columns: 1fr; } }
.doctor-hero__photo {
  width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}
.doctor-hero__photo-fallback {
  width: 100%; aspect-ratio: 1; border-radius: var(--radius-lg); display: grid; place-items: center;
  background: var(--brand-soft); color: var(--brand); font-family: var(--font-display); font-size: 3.5rem;
}
.doctor-hero__spec { color: var(--brand); font-weight: 600; margin: .2rem 0 .75rem; }
.doctor-hero__meta { display: flex; gap: 1.5rem; flex-wrap: wrap; margin: 1rem 0; }
.doctor-hero__meta dt { font-family: var(--font-mono); font-size: .6875rem; text-transform: uppercase; letter-spacing: .1em; color: var(--ink-3); margin-bottom: .15rem; }
.doctor-hero__meta dd { margin: 0; font-weight: 600; }

.split { display: grid; grid-template-columns: 1.3fr 1fr; gap: 2rem; align-items: start; }
@media (max-width: 900px) { .split { grid-template-columns: 1fr; } }

.map-embed {
  width: 100%; aspect-ratio: 16/10; border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; background: var(--surface-2);
}
.map-embed iframe { width: 100%; height: 100%; border: 0; }

.kind-toggle { display: flex; gap: .6rem; margin-bottom: 1rem; }
.kind-toggle label {
  flex: 1; display: flex; align-items: center; justify-content: center; gap: .4rem;
  padding: .7rem .5rem; border: 1px solid var(--line); border-radius: var(--radius-sm);
  font-size: .875rem; font-weight: 600; cursor: pointer; color: var(--ink-2);
  transition: border-color .15s, background .15s, color .15s;
}
.kind-toggle input { position: absolute; opacity: 0; pointer-events: none; }
.kind-toggle input:checked + span { color: var(--brand); }
.kind-toggle label:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); color: var(--brand-deep); }

/* ------------------------------------------------------------ My profile */
.avatar-edit { display: flex; align-items: center; gap: 1.1rem; margin-bottom: 1.5rem; }
.avatar-edit img, .avatar-edit__fallback {
  width: 84px; height: 84px; border-radius: 50%; object-fit: cover;
  background: var(--brand-soft); color: var(--brand); display: grid; place-items: center;
  font-family: var(--font-display); font-size: 1.75rem; flex: none;
}
.checkbox-row { display: flex; align-items: center; gap: .55rem; margin-bottom: 1rem; }
.checkbox-row input { width: 1.05rem; height: 1.05rem; accent-color: var(--brand); }
.checkbox-row label { font-weight: 600; font-size: .9rem; }
.field__checklist {
  display: flex; flex-wrap: wrap; gap: .5rem;
  padding: .3rem 0;
}
.field__checklist label {
  display: inline-flex; align-items: center; gap: .35rem; font-size: .8125rem;
  padding: .4rem .75rem; border: 1px solid var(--line); border-radius: 999px; cursor: pointer;
  color: var(--ink-2);
}
.field__checklist input { accent-color: var(--brand); }

/* --------------------------------------------------------------- Footer */
.site-footer {
  border-top: 1px solid var(--line); padding-block: 2.5rem; margin-top: 2rem;
  color: var(--ink-3); font-size: .875rem;
}
.site-footer__row { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
