@font-face { font-family: "Plex"; font-weight: 400; font-display: swap;
  src: url("vendor/fonts/ibm-plex-sans-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Plex"; font-weight: 500; font-display: swap;
  src: url("vendor/fonts/ibm-plex-sans-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "Plex"; font-weight: 600; font-display: swap;
  src: url("vendor/fonts/ibm-plex-sans-latin-600-normal.woff2") format("woff2"); }

/* Ranglar Rishton sopolidan olingan: kobalt, firuza va sirlangan oq. */
:root {
  --kobalt: #17377F;
  --kobalt-deep: #102a63;
  --firuza: #0F7F8D;
  --sir: #F2F6F8;
  --oq: #FFFFFF;
  --siyoh: #16233F;
  --kul: #566079;
  --chiziq: #D5DEE6;
  --yashil: #1C7F55;
  --qahrabo: #A0600A;
  --anor: #B3263A;
  --sovuq: #6B7690;
  --radius: 6px;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; margin: 0; }
body {
  font-family: "Plex", system-ui, sans-serif; font-size: 15px; line-height: 1.45;
  color: var(--siyoh); background: var(--sir); font-variant-numeric: tabular-nums;
}
#root { height: 100%; }
h1 { font-size: 22px; font-weight: 600; margin: 0; letter-spacing: -0.01em; }
h2 { font-size: 16px; font-weight: 600; margin: 0; }
p { margin: 0; }
a { color: var(--kobalt); }
:focus-visible { outline: 2px solid var(--firuza); outline-offset: 2px; }

button, input, select, textarea { font: inherit; color: inherit; }
input, select, textarea {
  width: 100%; padding: 8px 10px; background: var(--oq);
  border: 1px solid #A9B5C4; border-radius: var(--radius);
}
textarea { min-height: 84px; resize: vertical; }
label { display: block; font-weight: 500; }
label > input, label > select, label > textarea { margin-top: 4px; font-weight: 400; }
.pw-field { position: relative; }
.pw-field input { padding-right: 44px; }
.pw-field input::-ms-reveal { display: none; }
.pw-toggle {
  position: absolute; right: 1px; bottom: 1px; width: 42px; height: 38px; padding: 0;
  display: grid; place-items: center; border: 0; background: none; color: var(--kul);
  border-radius: var(--radius); cursor: pointer;
}
.pw-toggle:hover { color: var(--kobalt); }
.pw-toggle:focus-visible { outline-offset: -2px; }
.hint { color: var(--kul); font-size: 13px; font-weight: 400; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 14px; border-radius: var(--radius); border: 1px solid #A9B5C4; white-space: nowrap;
  background: var(--oq); cursor: pointer; font-weight: 500; text-decoration: none; color: var(--siyoh);
}
.btn:hover { background: #E8EEF3; }
.btn.primary { background: var(--kobalt); border-color: var(--kobalt); color: #fff; }
.btn.primary:hover { background: var(--kobalt-deep); }
.btn.danger { color: var(--anor); border-color: #D9A4AC; }
.btn.danger:hover { background: #FBEEF0; }
.btn.small { padding: 4px 10px; font-size: 14px; }
.btn[disabled] { opacity: .55; cursor: default; }

/* Asosiy tuzilma */
.shell { display: grid; grid-template-columns: 208px minmax(0, 1fr); height: 100%; }
.main { min-width: 0; min-height: 0; overflow: auto; }
.rail {
  display: flex; flex-direction: column; color: #fff; background-color: var(--kobalt);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='52' height='52' viewBox='0 0 52 52'%3E%3Cg fill='none' stroke='%23fff' stroke-opacity='.13' stroke-width='1.2'%3E%3Cpath d='M26 4l6.4 15.6L48 26l-15.6 6.4L26 48l-6.4-15.6L4 26l15.6-6.4z'/%3E%3Ccircle cx='26' cy='26' r='5'/%3E%3Cpath d='M0 0l10 10M52 0L42 10M0 52l10-10M52 52L42 42'/%3E%3C/g%3E%3C/svg%3E");
  background-size: 52px 52px; background-position: bottom left;
  background-repeat: repeat-x; background-position-y: 100%;
  padding-bottom: 60px;
}
.rail-brand { padding: 18px 16px 16px; }
.rail-brand strong { display: block; font-size: 17px; font-weight: 600; }
.rail-brand span { font-size: 13px; color: #C9D6EF; }
.rail nav { flex: 1; display: flex; flex-direction: column; gap: 2px; padding: 0 8px; }
.rail nav a {
  display: block; padding: 8px 10px; color: #E4EBF8; text-decoration: none; border-radius: var(--radius);
}
.rail nav a:hover { background: rgba(255,255,255,.1); }
.rail nav a[aria-current="page"] { background: #fff; color: var(--kobalt); font-weight: 600; }
.rail-lang { padding: 8px 16px 0; }
.lang { width: auto; padding: 4px 8px; font-size: 14px; }
.lang-rail { width: 100%; color: #fff; background: rgba(255,255,255,.12); border-color: rgba(255,255,255,.35); }
.lang-rail option { color: var(--siyoh); background: #fff; }
.auth-lang { display: flex; justify-content: flex-end; margin-bottom: -4px; }
.rail-user { padding: 12px 16px; font-size: 14px; border-top: 1px solid rgba(255,255,255,.2); background: var(--kobalt); }
.rail-user button {
  display: block; margin-top: 2px; padding: 0; color: #C9D6EF; background: none; border: 0;
  text-decoration: underline; cursor: pointer;
}
.page { overflow: auto; padding: 24px 28px 48px; min-width: 0; }
.page-head { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-bottom: 16px; }
.page-head .grow { flex: 1; min-width: 200px; }
.page-head p { color: var(--kul); margin-top: 2px; }
.page-head > select { width: auto; }
.page-head > label { display: flex; align-items: center; gap: 8px; }
.page-head > label > input { width: auto; margin-top: 0; }

/* Xarita sahifasi */
.mapview { display: grid; grid-template-columns: 340px minmax(0, 1fr); height: 100%; min-height: 0; }
.roster { display: flex; flex-direction: column; min-height: 0; background: var(--oq); border-right: 1px solid var(--chiziq); }
.roster-head { padding: 14px 16px 12px; border-bottom: 1px solid var(--chiziq); }
.roster-head p { color: var(--kul); font-size: 14px; margin-top: 2px; }
.roster-counts { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 10px; font-size: 14px; }
.alerts { margin-top: 12px; border: 1px solid #E4B4BB; border-radius: var(--radius); background: #FBEEF0; overflow: hidden; }
.alerts-title { padding: 8px 12px; font-weight: 600; color: var(--anor); border-bottom: 1px solid #E4B4BB; }
.alert-row { display: flex; justify-content: space-between; gap: 10px; width: 100%; padding: 7px 12px; text-align: left; background: none; border: 0; border-bottom: 1px solid #F0D8DC; cursor: pointer; }
.alert-row:last-child { border-bottom: 0; }
.alert-row:hover { background: #F7E2E6; }
.alert-why { color: var(--anor); font-weight: 500; white-space: nowrap; }
.mahalla-label { background: rgba(255,255,255,.82); border: 0; box-shadow: none; color: var(--qahrabo); font-weight: 600; font-size: 12px; padding: 1px 4px; }
.mahalla-label::before { display: none; }
.roster-list { flex: 1; overflow: auto; list-style: none; margin: 0; padding: 0; }
.roster-list button {
  display: grid; grid-template-columns: 38px 1fr auto; gap: 10px; align-items: center;
  width: 100%; padding: 9px 16px; text-align: left; background: none; border: 0;
  border-bottom: 1px solid #EBF0F4; cursor: pointer;
}
.roster-list button:hover { background: var(--sir); }
.roster-list button:focus-visible { outline-offset: -2px; }
.who { display: block; font-weight: 500; }
.sub { display: block; font-size: 13px; color: var(--kul); }
.batt { font-size: 13px; color: var(--kul); text-align: right; white-space: nowrap; }
.batt.low { color: var(--anor); font-weight: 600; }

.token {
  display: flex; align-items: center; justify-content: center; width: 36px; height: 36px;
  border-radius: 50%; color: #fff; font-size: 13px; font-weight: 600; letter-spacing: .02em;
  background: var(--sovuq); border: 2px solid #fff; box-shadow: 0 0 0 1px rgba(22,35,63,.25);
}
.p-online { background: var(--yashil); }
.p-offline { background: var(--anor); }
.p-no_gps { background: var(--qahrabo); }
.p-off_hours, .p-pending, .p-awaiting_ack { background: var(--sovuq); }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; }
.t-online { color: var(--yashil); }
.t-offline { color: var(--anor); }
.t-no_gps { color: var(--qahrabo); }
.t-off_hours, .t-pending, .t-awaiting_ack { color: var(--kul); }

.map-wrap { position: relative; min-width: 0; min-height: 0; }
#map { position: absolute; inset: 0; background: #DDE6EA; }
.map-note {
  position: absolute; z-index: 500; top: 12px; left: 56px; max-width: min(70%, 560px); padding: 6px 10px;
  font-size: 13px; background: var(--oq); border: 1px solid var(--chiziq); border-radius: var(--radius);
}
.leaflet-container { font: inherit; }
.marker-wrap { background: none; border: 0; }
.marker-wrap .token.selected { box-shadow: 0 0 0 4px var(--firuza); }

.detail { flex: 1; overflow: auto; padding: 14px 16px 24px; }
.back { padding: 0; margin-bottom: 10px; background: none; border: 0; color: var(--kobalt); cursor: pointer; text-decoration: underline; }
.facts { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; margin: 12px 0 16px; }
.facts dt { color: var(--kul); }
.facts dd { margin: 0; }
.detail section { padding-top: 14px; margin-top: 14px; border-top: 1px solid var(--chiziq); }
.detail section h2 { margin-bottom: 8px; }
.row { display: flex; gap: 8px; align-items: end; flex-wrap: wrap; }
.row > label { flex: 1; min-width: 120px; }
.mini-task { padding: 6px 0; border-bottom: 1px solid #EBF0F4; }
.mini-task:last-child { border: 0; }

/* Jadvallar */
.table-wrap { overflow-x: auto; background: var(--oq); border: 1px solid var(--chiziq); border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 9px 12px; text-align: left; border-bottom: 1px solid #EBF0F4; vertical-align: top; }
th { font-weight: 600; font-size: 14px; background: #E9EFF4; border-bottom: 1px solid var(--chiziq); white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; }
td .actions { display: flex; gap: 6px; flex-wrap: wrap; }
.empty { padding: 28px 16px; text-align: center; color: var(--kul); }
.warn { color: var(--anor); font-weight: 500; }
.ok { color: var(--yashil); }
.code {
  display: block; margin: 12px 0; padding: 14px; font-size: 28px; font-weight: 600; letter-spacing: .08em;
  text-align: center; color: var(--kobalt); background: var(--sir); border: 1px dashed var(--kobalt); border-radius: var(--radius);
}

.form-grid { display: grid; gap: 12px; max-width: 560px; }
.card + .card { margin-top: 16px; }
.card { padding: 18px; background: var(--oq); border: 1px solid var(--chiziq); border-radius: var(--radius); }
.days { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.days label { display: flex; align-items: center; gap: 5px; padding: 4px 10px; font-weight: 400; background: var(--sir); border: 1px solid var(--chiziq); border-radius: var(--radius); }
.days input { width: auto; margin: 0; }
.notice { white-space: pre-line; padding: 12px; background: var(--sir); border-left: 3px solid var(--firuza); }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

dialog { width: min(520px, calc(100vw - 32px)); padding: 0; color: inherit; border: 0; border-radius: 8px; box-shadow: 0 16px 48px rgba(22,35,63,.35); }
dialog::backdrop { background: rgba(22,35,63,.45); }
.dlg { display: grid; gap: 12px; padding: 20px; }
.dlg-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }
.err { color: var(--anor); font-size: 14px; min-height: 1em; }

.auth { display: grid; place-items: center; min-height: 100%; padding: 16px; background-color: var(--kobalt);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='52' height='52' viewBox='0 0 52 52'%3E%3Cg fill='none' stroke='%23fff' stroke-opacity='.13' stroke-width='1.2'%3E%3Cpath d='M26 4l6.4 15.6L48 26l-15.6 6.4L26 48l-6.4-15.6L4 26l15.6-6.4z'/%3E%3Ccircle cx='26' cy='26' r='5'/%3E%3Cpath d='M0 0l10 10M52 0L42 10M0 52l10-10M52 52L42 42'/%3E%3C/g%3E%3C/svg%3E"); }
.auth form { width: min(380px, 100%); display: grid; gap: 12px; padding: 24px; background: var(--oq); border-radius: 8px; }
.auth p { color: var(--kul); }

#toast { position: fixed; z-index: 2000; right: 16px; bottom: 16px; display: grid; gap: 6px; }
#toast div { padding: 10px 14px; color: #fff; background: var(--siyoh); border-radius: var(--radius); max-width: 360px; }
#toast div.error { background: var(--anor); }

@media (max-width: 860px) {
  .shell { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); }
  .rail { min-width: 0; }
  .rail { padding-bottom: 0; background-image: none; }
  .rail-brand { padding: 10px 16px 6px; }
  .rail nav { flex-direction: row; overflow-x: auto; padding: 0 8px 8px; }
  .rail nav a { white-space: nowrap; }
  .rail-user { display: flex; justify-content: space-between; gap: 12px; padding: 6px 16px; }
  .rail-lang { padding: 6px 16px 0; }
  .lang-rail { width: auto; }
  .page { padding: 16px 16px 40px; }
  .mapview { grid-template-columns: minmax(0, 1fr); grid-template-rows: 46vh minmax(0, 1fr); }
  .map-wrap { order: -1; }
  .roster { border-right: 0; border-top: 1px solid var(--chiziq); }
  .map-note { max-width: calc(100% - 68px); }
  .two { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
.district-label { background: rgba(255,255,255,.85); border: 0; box-shadow: none; color: var(--kobalt); font-weight: 600; font-size: 13px; padding: 1px 5px; }
.district-label::before { display: none; }
.facts dd.warn { color: var(--anor); font-weight: 500; }

/* Xarita qatlamlari tugmasining belgisi (Leaflet rasm faylisiz). */
.leaflet-control-layers-toggle,
.leaflet-retina .leaflet-control-layers-toggle {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2317377F' stroke-width='1.8' stroke-linejoin='round'%3E%3Cpath d='M12 3 2.5 8.5 12 14l9.5-5.5z'/%3E%3Cpath d='M4.5 12.5 2.5 13.7 12 19.2l9.5-5.5-2-1.2'/%3E%3C/svg%3E");
  background-size: 26px 26px;
}
