:root {
  --ink: #18212b;
  --ink-2: #56606b;
  --line: #d5d9df;
  --paper: #ffffff;
  --mist: #eef0f3;
  --brand: #0a56b4;      /* Uztelecom ko'ki */
  --brand-deep: #06306e;
  --brand-sky: #1aa6e8;
  --signal: var(--brand); /* asosiy amal */
  --ats: #c00000;
  --warn: #b26a00;
  --radius-s: 8px;
  --radius-l: 16px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", sans-serif;
  --safe-b: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; font: 15px/1.45 var(--font); color: var(--ink); background: var(--mist); -webkit-tap-highlight-color: transparent; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--signal); outline-offset: 2px; }
#map { position: fixed; inset: 0; }
[hidden] { display: none !important; }

/* --- yuqori qator */
.top { position: fixed; top: max(10px, env(safe-area-inset-top)); left: 10px; right: 10px; display: flex; gap: 8px; align-items: flex-start; z-index: 5; pointer-events: none; }
.top > * { pointer-events: auto; }
.crumb { display: flex; align-items: center; flex-wrap: wrap; gap: 2px; background: var(--paper); border-radius: 999px; padding: 4px 6px; box-shadow: 0 1px 2px rgba(24,33,43,.18), 0 4px 14px rgba(24,33,43,.10); min-width: 0; }
.crumb button { border: 0; background: none; padding: 6px 10px; border-radius: 999px; font-weight: 650; color: var(--c, var(--ink)); white-space: nowrap; }
.crumb button:hover { background: var(--mist); }
.crumb .crumb-root { color: var(--ats); letter-spacing: .01em; }
.crumb-sep { color: var(--ink-2); }
.avatar { margin-left: auto; width: 42px; height: 42px; flex: none; border-radius: 50%; border: 0; background: var(--brand); color: #fff; font-weight: 700; font-size: 14px; box-shadow: 0 2px 8px rgba(24,33,43,.25); }
.menu { position: absolute; right: 0; top: 50px; background: var(--paper); border-radius: var(--radius-s); box-shadow: 0 8px 28px rgba(24,33,43,.22); min-width: 230px; padding: 6px; }
.menu-head { padding: 8px 10px 10px; border-bottom: 1px solid var(--line); margin-bottom: 4px; display: grid; }
.menu-head span { color: var(--ink-2); font-size: 13px; }
.menu button { display: block; width: 100%; text-align: left; border: 0; background: none; padding: 10px; border-radius: 6px; }
.menu button:hover { background: var(--mist); }

/* --- suzuvchi tugmalar */
.fab-col { position: fixed; right: 10px; bottom: calc(96px + var(--safe-b)); display: grid; gap: 10px; z-index: 4; }
.fab { width: 48px; height: 48px; border-radius: 50%; border: 0; background: var(--paper); color: var(--ink); display: grid; place-items: center; box-shadow: 0 2px 10px rgba(24,33,43,.22); }
.fab:active { transform: scale(.96); }
.me-dot { width: 16px; height: 16px; border-radius: 50%; background: var(--signal); border: 3px solid #fff; box-shadow: 0 0 0 6px rgba(10,86,180,.22); }
.maplibregl-ctrl-bottom-left { bottom: var(--safe-b); }

/* --- tugmalar */
.btn { border: 1px solid var(--line); background: var(--paper); border-radius: var(--radius-s); padding: 10px 16px; font-weight: 600; min-height: 44px; }
.btn-primary { background: var(--signal); border-color: var(--signal); color: #fff; }
.btn-danger { color: #b00020; border-color: #e7b3b8; }
.btn-wide { width: 100%; }
.btn:disabled { opacity: .55; }

/* --- xabar */
.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(100px + var(--safe-b)); background: var(--brand-deep); color: #fff; padding: 10px 16px; border-radius: var(--radius-s); z-index: 50; max-width: min(92vw, 460px); box-shadow: 0 6px 20px rgba(0,0,0,.25); }
.toast[data-kind="error"] { background: #9b1c1c; }
.toast[data-kind="warn"] { background: var(--warn); }

/* --- pastki varaq (telefonda) / yon panel (kompyuterda) */
.sheet { position: fixed; z-index: 20; background: var(--paper); box-shadow: 0 -6px 30px rgba(24,33,43,.22); display: flex; flex-direction: column;
  left: 0; right: 0; bottom: 0; max-height: 62vh; border-radius: var(--radius-l) var(--radius-l) 0 0; padding-bottom: var(--safe-b); animation: up .22s ease-out; }
@keyframes up { from { transform: translateY(24px); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .sheet { animation: none; } }
@media (min-width: 820px) {
  .sheet { left: auto; top: 70px; right: 10px; bottom: 10px; width: 380px; max-height: none; border-radius: var(--radius-l); box-shadow: 0 8px 30px rgba(24,33,43,.2); }
  .sheet.wide { width: min(760px, calc(100vw - 20px)); }
}
.sheet-head { border-top: 4px solid var(--brand); border-radius: inherit; display: flex; align-items: center; gap: 10px; padding: 14px 14px 10px 18px; border-bottom: 1px solid var(--line); }
.sheet-head h2 { margin: 0; font-size: 18px; line-height: 1.25; flex: 1; }
.sheet-head .x { width: 40px; height: 40px; border: 0; border-radius: 50%; background: var(--mist); font-size: 22px; line-height: 1; flex: none; }
.sheet-body { overflow: auto; padding: 12px 18px 18px; overscroll-behavior: contain; }
.chip { display: inline-block; font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: #fff3d6; color: #7a4b00; }

/* uchastka oynasi */
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 4px 0 14px; }
.stat { background: var(--mist); border-radius: var(--radius-s); padding: 10px 12px; }
.stat b { display: block; font-size: 24px; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat span { font-size: 13px; color: var(--ink-2); }
.stat.big { grid-column: 1 / -1; display: flex; align-items: baseline; gap: 10px; }
.stat.big b { font-size: 34px; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; font-size: 14px; margin: 0 0 12px; }
.kv dt { color: var(--ink-2); }
.kv dd { margin: 0; font-variant-numeric: tabular-nums; }
details.grp { border-top: 1px solid var(--line); }
details.grp summary { padding: 12px 0; font-weight: 650; cursor: pointer; display: flex; justify-content: space-between; list-style: none; }
details.grp summary::-webkit-details-marker { display: none; }
details.grp summary::after { content: '+'; color: var(--ink-2); font-weight: 400; font-size: 20px; line-height: 1; }
details.grp[open] summary::after { content: '−'; }
details.grp summary em { font-style: normal; color: var(--ink-2); font-weight: 400; margin-left: auto; margin-right: 12px; }
.list { list-style: none; margin: 0 0 12px; padding: 0; }
.list li button, .list li span { display: block; width: 100%; text-align: left; border: 0; background: none; padding: 8px 6px; border-radius: 6px; }
.list li button:hover { background: var(--mist); }
.muted { color: var(--ink-2); font-size: 13px; }

/* formalar */
.form { display: grid; gap: 12px; }
.form label { display: grid; gap: 4px; font-weight: 600; font-size: 14px; }
.form input, .form select, .login input { border: 1px solid var(--line); border-radius: var(--radius-s); padding: 11px 12px; min-height: 46px; background: #fff; font-weight: 400; }
.row { display: flex; gap: 8px; flex-wrap: wrap; }
.row > .btn { flex: 1; }
.seg { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.seg button { display: flex; align-items: center; gap: 10px; border: 1px solid var(--line); background: #fff; border-radius: var(--radius-s); padding: 12px; min-height: 56px; text-align: left; font-weight: 600; }
.seg button i { width: 18px; height: 18px; border-radius: 4px; flex: none; }

/* tahrir rejimi paneli */
.add-btn { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(22px + var(--safe-b)); z-index: 6; height: 56px; padding: 0 24px 0 18px; border-radius: 999px; border: 0;
  background: var(--signal); color: #fff; font-weight: 700; font-size: 16px; display: flex; align-items: center; gap: 8px; box-shadow: 0 6px 18px rgba(10,86,180,.4); }
.add-btn span { font-size: 26px; line-height: 0; font-weight: 400; }
.modebar { position: fixed; left: 10px; right: 10px; bottom: calc(14px + var(--safe-b)); z-index: 7; background: var(--brand-deep); color: #fff; border-radius: var(--radius-l); padding: 12px; display: grid; gap: 10px; box-shadow: 0 8px 26px rgba(0,0,0,.3); max-width: 560px; margin: 0 auto; }
.modebar p { margin: 0; }
.modebar .btn { background: transparent; color: #fff; border-color: rgba(255,255,255,.35); }
.modebar .btn-primary { background: #fff; color: var(--brand-deep); border-color: #fff; }
.crosshair { position: fixed; left: 50%; top: 50%; width: 36px; height: 36px; margin: -18px 0 0 -18px; z-index: 3; pointer-events: none; }
.crosshair::before, .crosshair::after { content: ''; position: absolute; background: var(--ink); }
.crosshair::before { left: 17px; top: 0; width: 2px; height: 36px; }
.crosshair::after { top: 17px; left: 0; height: 2px; width: 36px; }

/* jadval (boshqaruv) */
.tabs { display: flex; gap: 4px; padding: 0 14px; border-bottom: 1px solid var(--line); overflow-x: auto; }
.tabs button { border: 0; background: none; padding: 12px; font-weight: 600; color: var(--ink-2); border-bottom: 3px solid transparent; white-space: nowrap; }
.tabs button[aria-selected="true"] { color: var(--ink); border-color: var(--signal); }
table.t { width: 100%; border-collapse: collapse; font-size: 14px; }
table.t th, table.t td { text-align: left; padding: 9px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.t th { color: var(--ink-2); font-weight: 600; font-size: 13px; }
.ats-checks { display: flex; flex-wrap: wrap; gap: 6px; }
.ats-checks label { display: flex; align-items: center; gap: 6px; border: 1px solid var(--line); border-radius: 999px; padding: 6px 12px; font-weight: 600; }

/* Uztelecom belgisi */
.brand { display: flex; align-items: center; gap: 10px; }
.brand img { height: 34px; width: auto; display: block; }
.brand-word { font-weight: 800; font-size: 26px; letter-spacing: -.02em; color: var(--brand); }
.brand-word::before { content: ''; display: inline-block; width: .62em; height: .62em; margin-right: .28em; border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, var(--brand-sky), var(--brand) 70%); box-shadow: .18em 0 0 -.08em var(--brand-sky); vertical-align: .02em; }
.brand-light .brand-word { color: #fff; }
.brand-light .brand-word::before { background: radial-gradient(circle at 35% 35%, #fff, var(--brand-sky) 70%); }
.brand-chip { background: var(--paper); border-radius: 999px; padding: 0 14px; height: 42px; box-shadow: 0 1px 2px rgba(24,33,43,.18), 0 4px 14px rgba(24,33,43,.10); flex: none; }
.brand-chip .brand-word { font-size: 18px; }
.brand-chip img { height: 24px; }
@media (max-width: 640px) { .brand-chip { display: none; } }

/* login */
.login-page { min-height: 100%; background: radial-gradient(120% 90% at 80% 10%, #0d63c7 0%, var(--brand-deep) 55%, #041d45 100%); color: var(--ink); }
.login-bg { position: fixed; inset: -4vmin; background: url(/brand/hudud.svg) no-repeat 70% 50% / min(120vmin, 1100px) auto; opacity: .55; pointer-events: none; }
.login-bg::after { content: ''; position: absolute; inset: 0; background: radial-gradient(60% 60% at 30% 50%, rgba(4,29,69,.65), transparent 70%); }
.login-wrap { position: relative; min-height: 100vh; min-height: 100dvh; display: grid; align-content: center; justify-items: start; gap: 22px; padding: 32px clamp(18px, 9vw, 120px); }
@media (max-width: 640px) { .login-wrap { justify-items: center; } .login-bg { background-position: 50% 80%; opacity: .4; } }
.login { width: min(380px, 100%); background: var(--paper); border-radius: var(--radius-l); padding: 28px 26px 22px; box-shadow: 0 24px 60px rgba(0,10,40,.45); border-top: 5px solid var(--brand-sky); }
.login h1 { margin: 0; font-size: 30px; color: var(--ats); letter-spacing: .01em; }
.login-sub { margin: 2px 0 22px; color: var(--ink-2); }
.login form { display: grid; gap: 14px; }
.login label { display: grid; gap: 4px; font-weight: 600; font-size: 14px; }
.login input:focus { border-color: var(--brand); outline: none; box-shadow: 0 0 0 3px rgba(10,86,180,.18); }
.login-err { color: #b00020; min-height: 1.2em; margin: 0; font-size: 14px; }
.login-foot { margin: 14px 0 0; font-size: 13px; color: var(--ink-2); }
