/* =====================================================================
   AVUKO Market — umumiy dizayn tizimi ("Rishton")
   Ranglar Rishton kulolchiligidan: ishkor (feruza sir), lojuvard, anor, o'rik.
   ===================================================================== */

@font-face { font-family: "Onest"; font-style: normal; font-display: swap; font-weight: 100 900;
  src: url(../fonts/onest-latin-wght-normal.woff2) format("woff2-variations");
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: "Onest"; font-style: normal; font-display: swap; font-weight: 100 900;
  src: url(../fonts/onest-latin-ext-wght-normal.woff2) format("woff2-variations");
  unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }
@font-face { font-family: "Onest"; font-style: normal; font-display: swap; font-weight: 100 900;
  src: url(../fonts/onest-cyrillic-wght-normal.woff2) format("woff2-variations");
  unicode-range: U+0301,U+0400-045F,U+0490-0491,U+04B0-04B1,U+2116; }
@font-face { font-family: "Unbounded"; font-style: normal; font-display: swap; font-weight: 200 900;
  src: url(../fonts/unbounded-latin-wght-normal.woff2) format("woff2-variations");
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: "Unbounded"; font-style: normal; font-display: swap; font-weight: 200 900;
  src: url(../fonts/unbounded-latin-ext-wght-normal.woff2) format("woff2-variations");
  unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+1E00-1E9F,U+2C60-2C7F,U+A720-A7FF; }
@font-face { font-family: "Unbounded"; font-style: normal; font-display: swap; font-weight: 200 900;
  src: url(../fonts/unbounded-cyrillic-wght-normal.woff2) format("woff2-variations");
  unicode-range: U+0301,U+0400-045F,U+0490-0491,U+04B0-04B1,U+2116; }

:root {
  --ishkor: #0F6E78;
  --ishkor-deep: #0A535B;
  --ishkor-soft: #DDEFEF;
  --ishkor-glaze: #EAF5F4;
  --lojuvard: #1B2D52;
  --lojuvard-2: #24396A;
  --anor: #B8233B;
  --anor-soft: #FBE7EA;
  --orik: #E9A23B;
  --orik-soft: #FCF1DE;
  --yashil: #2F7D4F;
  --yashil-soft: #E2F2E8;
  --sir: #EEF4F4;
  --surface: #FFFFFF;
  --line: #D3E1E3;
  --line-strong: #B9CDD1;
  --text: #15253A;
  --muted: #5A6A7B;
  --brand: var(--ishkor);
  --radius-s: 8px;
  --radius: 12px;
  --radius-l: 20px;
  --font: "Onest", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --display: "Unbounded", "Onest", system-ui, sans-serif;
  --tap: 44px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; min-height: 100dvh;
  font: 400 16px/1.5 var(--font); color: var(--text); background: var(--sir);
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
}
img { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--ishkor-deep); text-underline-offset: 3px; }
h1, h2, h3, h4 { margin: 0 0 .5em; line-height: 1.2; letter-spacing: -0.01em; }
h1 { font-size: 1.6rem; font-weight: 750; }
h2 { font-size: 1.25rem; font-weight: 700; }
h3 { font-size: 1.05rem; font-weight: 650; }
p { margin: 0 0 .75em; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--brand) 55%, white); outline-offset: 2px; border-radius: 6px; }
::selection { background: var(--ishkor-soft); }
[hidden], .hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.display { font-family: var(--display); letter-spacing: -0.02em; }
.money { font-family: var(--display); font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; letter-spacing: -0.02em; }
.money small, .cur { font-family: var(--font); font-weight: 500; font-size: .72em; color: var(--muted); letter-spacing: 0; margin-left: .2em; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.tiny { font-size: .78rem; }
.strong { font-weight: 650; }
.right { text-align: right; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.strike { text-decoration: line-through; color: var(--muted); }
.row { display: flex; align-items: center; gap: 10px; }
.row-wrap { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.between { justify-content: space-between; }
.col { display: flex; flex-direction: column; gap: 10px; }
.grow { flex: 1 1 auto; min-width: 0; }
.stack > * + * { margin-top: 12px; }
.mt { margin-top: 16px; } .mt-s { margin-top: 8px; } .mb { margin-bottom: 16px; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Tugmalar ---------- */
.btn {
  --b: var(--surface); --c: var(--text); --bd: var(--line-strong);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: var(--tap); padding: 0 18px; border-radius: var(--radius);
  background: var(--b); color: var(--c); border: 1.5px solid var(--bd);
  font-weight: 600; font-size: .95rem; text-decoration: none; cursor: pointer; user-select: none;
  transition: background .15s, border-color .15s, transform .08s;
}
.btn:hover { --bd: var(--ishkor); }
.btn:active { transform: translateY(1px); }
.btn-primary { --b: var(--brand); --c: #fff; --bd: var(--brand); }
.btn-primary:hover { --b: var(--ishkor-deep); --bd: var(--ishkor-deep); }
.btn-dark { --b: var(--lojuvard); --c: #fff; --bd: var(--lojuvard); }
.btn-danger { --b: var(--surface); --c: var(--anor); --bd: color-mix(in srgb, var(--anor) 45%, white); }
.btn-danger:hover { --b: var(--anor-soft); --bd: var(--anor); }
.btn-solid-danger { --b: var(--anor); --c: #fff; --bd: var(--anor); }
.btn-ok { --b: var(--yashil); --c: #fff; --bd: var(--yashil); }
.btn-ghost { --b: transparent; --bd: transparent; }
.btn-ghost:hover { --b: var(--ishkor-glaze); --bd: transparent; }
.btn-sm { min-height: 34px; padding: 0 12px; font-size: .875rem; border-radius: var(--radius-s); }
.btn-lg { min-height: 54px; padding: 0 24px; font-size: 1.05rem; border-radius: 14px; }
.btn-block { width: 100%; }
.btn-icon { width: var(--tap); padding: 0; }
.btn-sm.btn-icon { width: 34px; }
.btn[disabled], .btn.is-loading { opacity: .55; pointer-events: none; }
.btn.is-loading::after { content: ""; width: 16px; height: 16px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.icon { width: 20px; height: 20px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.icon-s { width: 16px; height: 16px; }
.icon-l { width: 26px; height: 26px; }

/* ---------- Formalar ---------- */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field > span, .field > label, .label { font-size: .86rem; font-weight: 600; color: var(--muted); }
.input, .field input:not([type=checkbox]):not([type=radio]), .field select, .field textarea, select.input, textarea.input {
  width: 100%; min-height: var(--tap); padding: 10px 14px; border-radius: var(--radius);
  border: 1.5px solid var(--line-strong); background: var(--surface); outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.field textarea, textarea.input { min-height: 88px; resize: vertical; line-height: 1.45; }
.input:focus, .field input:focus, .field select:focus, .field textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand) 16%, transparent); }
.field.has-error input, .field.has-error select, .field.has-error textarea { border-color: var(--anor); }
.field-error { color: var(--anor); font-size: .84rem; font-weight: 500; }
.field-hint { color: var(--muted); font-size: .8rem; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 14px; }
@media (max-width: 560px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }
.check { display: flex; align-items: center; gap: 10px; min-height: 40px; cursor: pointer; font-weight: 500; }
.check input { width: 20px; height: 20px; accent-color: var(--brand); flex: none; }
.segmented { display: inline-flex; padding: 4px; gap: 4px; background: var(--ishkor-glaze); border-radius: 14px; border: 1px solid var(--line); flex-wrap: wrap; }
.segmented label { position: relative; cursor: pointer; }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented span { display: inline-flex; align-items: center; gap: 6px; min-height: 38px; padding: 0 14px; border-radius: 10px; font-weight: 600; font-size: .9rem; color: var(--muted); }
.segmented input:checked + span { background: var(--surface); color: var(--text); box-shadow: 0 1px 0 var(--line-strong); }
.segmented input:focus-visible + span { outline: 3px solid color-mix(in srgb, var(--brand) 55%, white); }
.switch { position: relative; display: inline-flex; align-items: center; gap: 12px; cursor: pointer; font-weight: 600; }
.switch input { position: absolute; opacity: 0; }
.switch .track { width: 52px; height: 30px; border-radius: 30px; background: var(--line-strong); position: relative; transition: background .2s; flex: none; }
.switch .track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; transition: transform .2s; }
.switch input:checked + .track { background: var(--yashil); }
.switch input:checked + .track::after { transform: translateX(22px); }
.switch input:focus-visible + .track { outline: 3px solid color-mix(in srgb, var(--brand) 55%, white); outline-offset: 2px; }
.stepper { display: inline-flex; align-items: center; border: 1.5px solid var(--line-strong); border-radius: 12px; background: var(--surface); }
.stepper button { width: 38px; height: 38px; border: 0; background: none; cursor: pointer; display: grid; place-items: center; color: var(--ishkor-deep); border-radius: 10px; }
.stepper button:hover { background: var(--ishkor-glaze); }
.stepper output, .stepper .val { min-width: 46px; text-align: center; font-weight: 700; font-variant-numeric: tabular-nums; }

/* ---------- Holat belgilari ---------- */
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: .78rem; font-weight: 650; white-space: nowrap; background: var(--ishkor-glaze); color: var(--ishkor-deep); }
.badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.badge.plain::before { display: none; }
.st-new { background: var(--orik-soft); color: #8A5A0E; }
.st-confirmed { background: #E6ECF8; color: var(--lojuvard-2); }
.st-accepted, .st-delivering { background: var(--ishkor-soft); color: var(--ishkor-deep); }
.st-delivered, .st-ok { background: var(--yashil-soft); color: var(--yashil); }
.st-canceled, .st-bad, .st-voided { background: var(--anor-soft); color: var(--anor); }
.st-muted { background: #EDF1F3; color: var(--muted); }
.disc { display: inline-block; padding: 2px 7px; border-radius: 7px; background: var(--anor); color: #fff; font: 700 .72rem/1.4 var(--display); letter-spacing: 0; }

/* ---------- Kartalar va ro'yxatlar ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-l); padding: 18px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.card-head h2, .card-head h3 { margin: 0; }
.divider { height: 1px; background: var(--line); margin: 14px 0; border: 0; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: .93rem; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 550; overflow-wrap: anywhere; }
.list { list-style: none; margin: 0; padding: 0; }
.list > li { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.list > li:last-child { border-bottom: 0; }
.empty { text-align: center; padding: 40px 16px; color: var(--muted); }
.empty .icon { width: 44px; height: 44px; margin: 0 auto 10px; color: var(--line-strong); stroke-width: 1.4; }
.empty h3 { color: var(--text); }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius-l); background: var(--surface); }
.table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.table th { text-align: left; font-size: .76rem; font-weight: 650; color: var(--muted); padding: 11px 14px; border-bottom: 1px solid var(--line); background: #F6FAFA; white-space: nowrap; }
.table td { padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr.clickable { cursor: pointer; }
.table tbody tr.clickable:hover { background: var(--ishkor-glaze); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.thumb { width: 44px; height: 44px; border-radius: 10px; object-fit: cover; background: var(--ishkor-glaze); border: 1px solid var(--line); }
.timeline { list-style: none; margin: 0; padding: 0 0 0 18px; border-left: 2px solid var(--line); }
.timeline li { position: relative; padding: 0 0 14px 12px; }
.timeline li::before { content: ""; position: absolute; left: -25px; top: 5px; width: 12px; height: 12px; border-radius: 50%; background: var(--surface); border: 3px solid var(--brand); }

/* ---------- Bildirishnoma (toast) ---------- */
.toasts { position: fixed; z-index: 1000; left: 50%; bottom: calc(18px + var(--safe-b)); transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; width: min(92vw, 420px); pointer-events: none; }
.toast { pointer-events: auto; display: flex; gap: 10px; align-items: flex-start; padding: 12px 16px; border-radius: 14px; background: var(--lojuvard); color: #fff; font-weight: 550; box-shadow: 0 10px 30px rgba(21, 37, 58, .25); animation: toast-in .2s ease-out; }
.toast.ok { background: var(--yashil); }
.toast.bad { background: var(--anor); }
.toast.warn { background: #9A6510; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

/* ---------- Muloqot oynasi ---------- */
dialog.modal { border: 0; padding: 0; border-radius: var(--radius-l); width: min(94vw, 520px); max-height: 90vh; background: var(--surface); color: var(--text); box-shadow: 0 30px 80px rgba(21, 37, 58, .35); }
dialog.modal.wide { width: min(96vw, 860px); }
dialog.modal::backdrop { background: rgba(21, 37, 58, .45); }
.modal-inner { display: flex; flex-direction: column; max-height: 90vh; }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 16px 18px 10px; }
.modal-head h2 { margin: 0; font-size: 1.15rem; }
.modal-body { padding: 4px 18px 16px; overflow-y: auto; }
.modal-foot { display: flex; gap: 10px; justify-content: flex-end; padding: 12px 18px 16px; border-top: 1px solid var(--line); flex-wrap: wrap; }
@media (max-width: 640px) {
  dialog.modal { width: 100vw; max-width: 100vw; margin: auto 0 0; border-radius: 22px 22px 0 0; max-height: 92vh; }
  .modal-foot .btn { flex: 1 1 0; }
  .modal-foot { padding-bottom: calc(16px + var(--safe-b)); }
}

/* ---------- Yuklanish va oflayn ---------- */
.skeleton { background: linear-gradient(90deg, #E3ECED 0%, #F2F7F7 50%, #E3ECED 100%); background-size: 200% 100%; animation: shimmer 1.2s infinite; border-radius: 12px; }
@keyframes shimmer { to { background-position: -200% 0; } }
.spinner { width: 26px; height: 26px; border-radius: 50%; border: 3px solid var(--ishkor-soft); border-top-color: var(--brand); animation: spin .8s linear infinite; margin: 30px auto; }
.offline-bar { position: fixed; z-index: 900; top: 0; left: 0; right: 0; padding: 6px 12px; text-align: center; font-size: .85rem; font-weight: 600; background: var(--orik); color: #3B2604; }
.support-bar { position: sticky; top: 0; z-index: 950; display: flex; align-items: center; justify-content: center; gap: 12px; padding: 8px 12px; background: var(--anor); color: #fff; font-weight: 600; font-size: .88rem; }
.support-bar button { background: #fff; color: var(--anor); border: 0; border-radius: 8px; padding: 4px 10px; font-weight: 700; cursor: pointer; }
.note { padding: 12px 14px; border-radius: var(--radius); background: var(--ishkor-glaze); border: 1px solid var(--line); font-size: .93rem; }
.note-ok { background: var(--yashil-soft); border-color: #BFE0CB; }
.note-bad { background: var(--anor-soft); border-color: #F1C2CA; color: #7B1426; }
.note-warn { background: var(--orik-soft); border-color: #F2D7A6; color: #6A4407; }

/* ---------- Kirish ekrani (barcha ilovalar) ---------- */
.auth { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; align-items: center; padding: 0 16px 40px; }
.auth-band {
  width: 100%; height: 150px; margin: 0 -16px 0; flex: none;
  background-color: var(--lojuvard);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='56' height='56' viewBox='0 0 56 56'%3E%3Cg fill='none' stroke='%232FA3AC' stroke-width='1.4' opacity='.55'%3E%3Crect x='14' y='14' width='28' height='28'/%3E%3Crect x='14' y='14' width='28' height='28' transform='rotate(45 28 28)'/%3E%3Ccircle cx='28' cy='28' r='5'/%3E%3Cpath d='M0 0l14 14M56 0L42 14M0 56l14-14M56 56L42 42'/%3E%3C/g%3E%3C/svg%3E");
  background-size: 56px 56px;
}
.auth-card { width: min(100%, 420px); margin-top: -70px; background: var(--surface); border-radius: 24px; border: 1px solid var(--line); padding: 26px 22px 22px; position: relative; }
.auth-mark { width: 64px; height: 64px; border-radius: 50%; margin: -58px auto 12px; background: var(--surface); display: grid; place-items: center; border: 3px solid var(--ishkor); }
.auth-mark span { font: 800 1.35rem/1 var(--display); color: var(--lojuvard); }
.auth-title { text-align: center; font: 700 1.25rem/1.25 var(--display); margin-bottom: 4px; letter-spacing: -0.02em; }
.auth-sub { text-align: center; color: var(--muted); font-size: .93rem; margin-bottom: 20px; }
.auth-links { display: flex; justify-content: space-between; gap: 10px; margin-top: 14px; font-size: .9rem; flex-wrap: wrap; }
.auth-links button, .linkish { background: none; border: 0; padding: 4px 0; color: var(--ishkor-deep); font-weight: 600; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.code-input { text-align: center; font: 700 1.7rem/1 var(--display) !important; letter-spacing: .4em; padding-left: .4em !important; }
.pw-wrap { position: relative; }
.pw-wrap input { padding-right: 48px !important; }
.pw-wrap button { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); width: 40px; height: 40px; border: 0; background: none; color: var(--muted); cursor: pointer; display: grid; place-items: center; border-radius: 10px; }
.auth-foot { margin-top: 18px; font-size: .8rem; color: var(--muted); text-align: center; max-width: 420px; }

/* ---------- O'rnatish sahifasi ---------- */
.setup { padding: 24px 14px; }
.setup-card { max-width: 760px; margin: 0 auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-l); padding: 24px; }
.setup-title { font-family: var(--display); font-size: 1.4rem; }
.setup-card h2 { margin-top: 26px; }
.setup-table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.setup-table td { padding: 8px 6px; border-bottom: 1px solid var(--line); }
.setup-table .ok { color: var(--yashil); font-weight: 700; }
.setup-table .bad { color: var(--anor); font-weight: 700; }
.setup-form label { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; font-weight: 600; font-size: .9rem; }
.setup-form input { min-height: 44px; padding: 8px 12px; border: 1.5px solid var(--line-strong); border-radius: 10px; }

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

@media print {
  body * { visibility: hidden; }
  .print-area, .print-area * { visibility: visible; }
  .print-area { position: absolute; inset: 0 auto auto 0; width: 80mm; padding: 0; color: #000; }
  .no-print { display: none !important; }
}
