/* Boshqaruv paneli uslubi. Ranglar va o'lchamlar shu yerdagi o'zgaruvchilarda. */
:root {
  --ink: #101828; --muted: #566174; --line: #e1e6ed; --line-strong: #c5ceda; --ground: #f2f4f7; --card: #fff;
  --navy: #0f1c2e; --navy-soft: #17273f; --navy-on: #22365a; --accent: #2457d6; --accent-dark: #1a3f9e;
  --ok: #146c43; --ok-bg: #e4f3ea; --warn: #8a4a00; --warn-bg: #fbefd9; --bad: #b42318; --bad-bg: #fbe7e4;
  --info: #2457d6; --info-bg: #e6edfb; --quiet-bg: #edf0f4;
  --c-ontime: #2563c9; --c-late: #d97706; --c-absent: #b02a1d; --c-paid: #7a4fd0; --c-held: #8a97a6;
  --gap: 18px;
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; color: var(--ink); background: var(--ground);
  font: 14px/1.45 "Segoe UI", system-ui, -apple-system, sans-serif; font-variant-numeric: tabular-nums; }
a { color: var(--accent); } a:hover { color: var(--accent-dark); }
h1 { margin: 0; font-size: 26px; font-weight: 700; letter-spacing: -0.01em; }
h2 { margin: 0; font-size: 17px; font-weight: 600; }
p { margin: 0; }

/* --- Qobiq: chapda menyu, o'ngda sahifa ------------------------------------ */
.shell { display: flex; min-height: 100vh; }
.side { flex: none; width: 248px; position: sticky; top: 0; height: 100vh; overflow-y: auto; background: var(--navy); color: #fff;
  padding: 20px 14px; display: flex; flex-direction: column; gap: 20px; }
.brand { display: flex; align-items: center; gap: 10px; padding: 0 8px; color: #fff; text-decoration: none; }
.brand:hover { color: #fff; }
.brand b { display: block; font-size: 16px; } .brand small { display: block; font-size: 12px; color: #9fb0c8; }
.logo { width: 36px; height: 36px; flex: none; border-radius: 10px; background: var(--accent); display: flex; align-items: center; justify-content: center; }
.side nav { display: flex; flex-direction: column; gap: 4px; }
.side nav a, .logout button { display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 0 12px; border-radius: 10px;
  color: #b8c4d6; text-decoration: none; font-size: 15px; font-weight: 500; }
.side nav a:hover, .logout button:hover { color: #fff; background: var(--navy-soft); }
.side nav a.on { color: #fff; background: var(--navy-on); font-weight: 600; }
.side nav em { margin-left: auto; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 11px; background: #f2b544; color: #2a1b00;
  font-size: 12px; font-weight: 700; font-style: normal; display: inline-flex; align-items: center; justify-content: center; }
.side nav .short { display: none; }
.logout { margin-top: auto; }
.logout button { width: 100%; border: none; background: none; font-family: inherit; cursor: pointer; height: auto; }
main { flex: 1; min-width: 0; padding: 24px 28px 48px; display: flex; flex-direction: column; gap: var(--gap); }
main.plain { min-height: 100vh; }

/* --- Umumiy bo'laklar ------------------------------------------------------ */
.pagehead { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.pagehead > div:first-child, .pagehead > h1:first-child { margin-right: auto; }
.pagehead > div:first-child { display: flex; flex-direction: column; gap: 2px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 20px; display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.cardhead { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.split { display: flex; flex-wrap: wrap; gap: var(--gap); align-items: stretch; }
.split > .card { flex: 1 1 320px; } .split > .card.wide { flex: 2 1 520px; }
.cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: var(--gap); align-items: start; }
.three { display: flex; flex-wrap: wrap; gap: var(--gap); align-items: flex-start; }
.stack-col { flex: 1 1 300px; min-width: 0; display: flex; flex-direction: column; gap: var(--gap); }
.stack-col:nth-child(2) { flex: 1.6 1 420px; }
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-end; }
.row > label { flex: 1 1 160px; }
.list { display: flex; flex-direction: column; }
.list > * { padding: 12px 0; border-top: 1px solid var(--line); } .list > *:first-child { border-top: none; padding-top: 0; }
.list > *:last-child { padding-bottom: 0; }
.grow { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.strong { font-weight: 600; } a.strong { color: var(--ink); text-decoration: none; } a.strong:hover { color: var(--accent); text-decoration: underline; }
.muted { color: var(--muted); font-size: 13px; }
.ok { color: var(--ok); } .warn { color: var(--warn); } .bad { color: var(--bad); } .info { color: var(--info); }
.empty { color: var(--muted); padding: 8px 0; }
.flash { border-radius: 10px; padding: 12px 16px; font-weight: 600; }
.flash.ok { background: var(--ok-bg); color: var(--ok); } .flash.bad { background: var(--bad-bg); color: var(--bad); }
.notice { background: var(--warn-bg); border: 1px solid #e0c08a; border-radius: 10px; padding: 12px 16px; }
.code { background: var(--ground); border-radius: 10px; padding: 12px 14px; font-weight: 600; overflow-wrap: anywhere; }
.chip { display: inline-flex; align-items: center; min-height: 26px; padding: 2px 10px; border-radius: 13px; font-size: 13px; font-weight: 600; white-space: nowrap; }
.chip.ok { background: var(--ok-bg); } .chip.warn { background: var(--warn-bg); } .chip.bad { background: var(--bad-bg); }
.chip.info { background: var(--info-bg); } .chip.muted { background: var(--quiet-bg); color: var(--muted); }

/* --- Ko'rsatkich kartalari ------------------------------------------------- */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 14px; }
.tile { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 18px 20px; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.tile small { font-size: 13px; color: var(--muted); } .tile .sub { font-size: 13px; color: var(--muted); }
.tile b { font-size: 28px; font-weight: 700; line-height: 1.1; white-space: nowrap; }
.tile.dark { background: var(--navy); border-color: var(--navy); color: #fff; } .tile.dark small, .tile.dark .sub { color: #aebbd0; }
.tile-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 8px; }
.spark polyline { stroke: var(--c-ontime); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* --- Tugma va maydonlar ---------------------------------------------------- */
input, select, textarea { font: inherit; color: var(--ink); min-height: 44px; border: 1px solid var(--line-strong); border-radius: 10px;
  padding: 0 12px; background: #fff; width: 100%; min-width: 0; }
textarea { padding: 10px 12px; resize: vertical; }
input[type=checkbox] { width: 20px; min-height: 20px; height: 20px; padding: 0; flex: none; accent-color: var(--accent); }
input[type=file] { padding: 8px; height: auto; }
input:focus, select:focus, textarea:focus, button:focus-visible, a:focus-visible, summary:focus-visible, [tabindex]:focus-visible { outline: 3px solid #9dbcf0; outline-offset: 1px; }
label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }
label.inline { flex: 1 1 100%; }
button, .btnlike { font: inherit; font-weight: 600; min-height: 44px; padding: 0 16px; border-radius: 10px; border: 1px solid var(--line-strong);
  background: #fff; color: var(--ink); cursor: pointer; white-space: nowrap; display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none; }
button:hover, a.btnlike:hover { background: var(--ground); color: var(--ink); }
button.primary, .btnlike.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
button.primary:hover, a.btnlike.primary:hover { background: var(--accent-dark); border-color: var(--accent-dark); color: #fff; }
button.danger, .btnlike.danger { color: var(--bad); border-color: #e4b5af; }
/* Jadval qatori ichidagi kichik tugma: tugmaga o'xshaydi, lekin qatorni cho'zmaydi. */
button.sm, .btnlike.sm { min-height: 32px; padding: 0 10px; font-size: 13px; gap: 6px; }
/* Bir qatorda turgan bir nechta tugma (masalan arxiv oyining amallari). */
.btnrow { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
.search { flex: 0 1 280px; flex-direction: row; align-items: center; gap: 8px; min-height: 44px; padding: 0 14px; border-radius: 10px;
  background: #fff; border: 1px solid var(--line-strong); color: var(--muted); }
.search input { border: none; min-height: 40px; padding: 0; outline: none; background: transparent; }
.search:focus-within { outline: 3px solid #9dbcf0; outline-offset: 1px; }
fieldset { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; margin: 0; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
legend { padding: 0 6px; font-size: 13px; color: var(--muted); }
.checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 4px 14px; }
.check { flex-direction: row; align-items: center; gap: 10px; min-height: 44px; font-size: 14px; color: var(--ink); cursor: pointer; }
.form-col { display: flex; flex-direction: column; gap: 14px; }
details summary { cursor: pointer; list-style: none; } details summary::-webkit-details-marker { display: none; }
.tabs { display: flex; gap: 4px; flex-wrap: wrap; }
.tabs a { min-height: 40px; padding: 0 14px; border-radius: 10px; display: inline-flex; align-items: center; text-decoration: none; font-weight: 600; color: var(--muted); }
.tabs a:hover { background: var(--ground); } .tabs a.on { background: var(--info-bg); color: var(--accent); }

/* --- Jadval ---------------------------------------------------------------- */
.scroll { overflow-x: auto; } .scroll.tall { max-height: 420px; overflow-y: auto; }
table { border-collapse: collapse; width: 100%; min-width: 860px; } table.plain { min-width: 460px; }
th { text-align: left; font-size: 12px; font-weight: 500; color: var(--muted); padding: 6px 8px; white-space: nowrap; background: var(--card); }
td { padding: 10px 8px; border-top: 1px solid var(--line); vertical-align: middle; }
td.num, th.num { text-align: right; white-space: nowrap; }
tr.total td { border-top: 2px solid var(--ink); font-weight: 700; }
tr[hidden] { display: none; }
td form { margin: 0; }
.name b, .name a.strong { display: block; } .name span { font-size: 12px; }
.w-role { min-width: 140px; } .w-time { min-width: 110px; } .w-pay { min-width: 130px; }

/* --- Xodim rasmi ----------------------------------------------------------- */
.who { display: flex; align-items: center; gap: 12px; min-width: 0; } .who > div { min-width: 0; display: flex; flex-direction: column; }
.avatar { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; flex: none; display: inline-flex; align-items: center; justify-content: center;
  background: #c9d7ea; color: var(--ink); font-weight: 700; font-size: 15px; }
.avatar.sm { width: 34px; height: 34px; font-size: 13px; } .avatar.big { width: 48px; height: 48px; font-size: 18px; }
.avatar.xl { width: 88px; height: 88px; font-size: 32px; }
.name .avatar { font-size: 15px; } .name .avatar.big { font-size: 18px; }
.avatar.none { border: 2px dashed #8a97a6; }
.photo-edit { flex: none; } .photo-edit summary { border-radius: 50%; display: block; line-height: 0; }
.photo-edit summary:hover .avatar { outline: 3px solid #9dbcf0; }
.photo-edit[open] { flex: 1 1 100%; } .who:has(.photo-edit[open]) { flex-wrap: wrap; } .who:has(.photo-edit[open]) > div { order: -1; flex: 1 1 100%; }
.photo-edit form { margin-top: 8px; width: min(300px, 100%); display: flex; flex-direction: column; gap: 8px; padding: 12px; border-radius: 12px; background: var(--ground); border: 1px solid var(--line); }

/* --- Bosh sahifa: jonli holat, so'rovlar, reyting -------------------------- */
.live { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.live .who { flex: 1 1 220px; } .live-note { flex: 1 1 180px; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.live .chip { margin-left: auto; }
.track { height: 6px; border-radius: 3px; background: #e7ebf1; overflow: hidden; } .track i { display: block; height: 100%; border-radius: 3px; }
.req { display: flex; flex-direction: column; gap: 10px; }
.req-head { display: flex; gap: 12px; } .req-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.req-icon { width: 36px; height: 36px; flex: none; border-radius: 10px; background: var(--info-bg); color: var(--accent); display: flex; align-items: center; justify-content: center; }
.req-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; } .req-actions > button, .req-actions > form { flex: 1 1 110px; } .req-actions > form button { width: 100%; }
.rank, .due { display: flex; align-items: center; gap: 12px; } .due { flex-wrap: wrap; }
.place { width: 18px; color: var(--muted); font-weight: 600; } .score { font-size: 18px; }

/* --- Xodim kartasi --------------------------------------------------------- */
.profile { flex-direction: row; align-items: center; gap: 20px; flex-wrap: wrap; }
.profile-main { flex: 1 1 320px; min-width: 0; display: flex; flex-direction: column; gap: 10px; }
.facts { display: flex; flex-wrap: wrap; gap: 6px 18px; color: var(--muted); } .facts span { display: inline-flex; align-items: center; gap: 6px; }
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.cal-head { text-align: center; font-size: 12px; color: var(--muted); }
.cal-day { min-height: 52px; border-radius: 8px; display: flex; flex-direction: column; align-items: center; justify-content: center; font-weight: 600; }
.cal-day small { font-size: 10px; font-weight: 600; }
.d-none { border: 1px dashed var(--line-strong); color: var(--muted); font-weight: 400; }
.d-on { background: #dce8fb; color: #12398f; } .d-late { background: #fce6c4; color: #7a4100; }
.d-abs { background: #f9d6d1; color: #8f1c12; } .d-leave { background: #e3e0f8; color: #3f2c99; }
.cal-day.today { box-shadow: 0 0 0 2px var(--accent); }
.sw.d-on { border: 1px solid #12398f; } .sw.d-late { border: 1px solid #7a4100; } .sw.d-abs { border: 1px solid #8f1c12; } .sw.d-leave { border: 1px solid #3f2c99; }

/* --- Grafiklar ------------------------------------------------------------- */
.s-ontime { background: var(--c-ontime); } .s-late { background: var(--c-late); } .s-absent { background: var(--c-absent); }
.m-left { background: var(--c-ontime); } .m-paid { background: var(--c-paid); } .m-held { background: var(--c-held); }
.legend { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 13px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; }
.sw { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; flex: none; }
.chart { display: flex; gap: 8px; height: 220px; }
.yaxis { display: flex; flex-direction: column; justify-content: space-between; padding-bottom: 22px; font-size: 11px; color: var(--muted); text-align: right; min-width: 14px; }
.plot { flex: 1; min-width: 0; display: flex; gap: clamp(1px, 0.4vw, 6px); border-bottom: 1px solid var(--line-strong); margin-bottom: 22px; }
.col { flex: 1 1 0; min-width: 0; position: relative; display: flex; justify-content: center; cursor: pointer; border-radius: 4px 4px 0 0; }
.col:hover, .col:focus { background: rgba(16, 24, 40, 0.07); }
.col.today { background: var(--info-bg); }
.stackbar { width: 100%; max-width: 24px; height: 100%; display: flex; flex-direction: column-reverse; gap: 2px; }
.stackbar i { display: block; min-height: 3px; border-radius: 3px; }
.tick { position: absolute; top: 100%; margin-top: 6px; font-size: 11px; color: var(--muted); }
.tip { position: absolute; z-index: 9; background: var(--ink); color: #fff; padding: 6px 10px; border-radius: 8px; font-size: 12px; max-width: calc(100vw - 16px); pointer-events: none; }
.hbar { display: flex; gap: 2px; height: 14px; } .hbar i { display: block; min-width: 6px; border-radius: 4px; flex-basis: 0; }
.kv { margin: 0; display: flex; flex-direction: column; }
.kv div { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-top: 1px solid var(--line); }
.kv div:first-child { border-top: none; } .kv dt { color: var(--muted); display: inline-flex; align-items: center; } .kv dd { margin: 0; font-weight: 600; white-space: nowrap; }
.kv .sum dd { font-size: 16px; } .kv .sum dt { color: var(--ink); font-weight: 600; }
.meter { display: flex; align-items: center; gap: 8px; min-width: 140px; }
.meter .track { flex: 1; height: 8px; border-radius: 4px; } .meter i { background: var(--c-ontime); border-radius: 4px; }
.meter span { font-weight: 600; min-width: 38px; text-align: right; }

.login { max-width: 360px; width: 100%; margin: 12vh auto 0; }

/* --- Planshet va telefon: menyu pastga tushadi, jadval qatorlari kartaga aylanadi --- */
@media (max-width: 900px) {
  .shell { flex-direction: column; }
  .side { width: auto; height: auto; position: static; flex-direction: row; align-items: center; padding: 10px 14px; gap: 10px; overflow: visible; }
  .brand small { display: none; }
  .logout { margin: 0 0 0 auto; } .logout button { width: auto; } .logout span { display: none; }
  .side nav { position: fixed; z-index: 8; left: 0; right: 0; bottom: 0; flex-direction: row; gap: 0; background: var(--navy);
    padding: 4px 4px calc(4px + env(safe-area-inset-bottom)); border-top: 1px solid var(--navy-on); }
  .side nav a { flex: 1 1 0; min-width: 0; flex-direction: column; gap: 2px; justify-content: center; padding: 4px 2px; min-height: 52px; font-size: 10px; position: relative; }
  .side nav .long { display: none; } .side nav .short { display: block; }
  .side nav a span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .side nav em { position: absolute; top: 2px; left: 50%; margin-left: 4px; min-width: 18px; height: 18px; font-size: 11px; }
  main { padding: 14px 14px 84px; gap: 12px; } :root { --gap: 12px; }
  h1 { font-size: 21px; }
  .card { padding: 14px; } .tile { padding: 14px; } .tile b { font-size: 22px; }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; } .tiles .tile:first-child { grid-column: 1 / -1; }
  .cols { grid-template-columns: minmax(0, 1fr); }
  .pagehead .btnlike, .pagehead .search { flex: 1 1 140px; }
  .row > label { flex: 1 1 100%; } .row > button, .row > .btnlike { flex: 1 1 auto; }
  .live .chip { margin-left: 0; }
  .profile { flex-direction: column; align-items: flex-start; }
  table.stack { min-width: 0; } table.stack thead { display: none; }
  table.stack, table.stack tbody, table.stack tr, table.stack td { display: block; width: 100%; }
  table.stack tr { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; margin-top: 10px; background: #fff; }
  table.stack tr[hidden] { display: none; }
  table.stack td { border: none; padding: 5px 0; text-align: left; }
  table.stack td.num { text-align: right; }
  table.stack td[data-label] { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
  table.stack td[data-label]::before { content: attr(data-label); color: var(--muted); font-size: 12px; text-align: left; flex: 0 0 38%; }
  table.stack td[data-label] > input, table.stack td[data-label] > select, table.stack td[data-label] > .meter { flex: 1; min-width: 0; }
  table.stack td.name b, table.stack td.name a.strong { font-size: 16px; } table.stack td.empty { display: none; }
  table.stack td.act { display: inline-block; width: auto; margin: 6px 8px 0 0; vertical-align: top; text-align: left; }
  table.stack tr.total { border: 2px solid var(--ink); } table.stack tr.total td { border-top: none; }
  table.stack .btnrow { justify-content: flex-start; margin-top: 6px; }
  .w-role, .w-time, .w-pay { min-width: 0; }
  .chart { height: 180px; } .legend { width: 100%; }
  .kv div { flex-wrap: wrap; }
  .cal { gap: 4px; } .cal-day { min-height: 44px; }
}
@media (min-width: 1700px) { body { font-size: 15px; } .tile b { font-size: 32px; } .chart { height: 280px; } }

/* --- Havola-tugmalar va #add belgisi ---------------------------------------- */
.card > .btnlike { align-self: flex-start; }
#add { scroll-margin-top: 16px; }
#add:target > .card { outline: 3px solid var(--accent); outline-offset: 2px; }

/* --- Kun xaritasi (xodim kartasi: yo'l izi) ---------------------------------- */
#daymap { position: relative; height: 340px; border-radius: 12px; overflow: hidden;
  background: var(--ground); border: 1px solid var(--line); cursor: grab;
  touch-action: pan-y; /* telefonda barmoq sahifani suradi, xaritani emas */ }
#daymap.is-dragging { cursor: grabbing; }
.daymap-tiles { position: absolute; inset: 0; }
.daymap-tiles img { position: absolute; width: 256px; height: 256px; }
.daymap-ink { position: absolute; inset: 0; }
.daymap-credit { position: absolute; right: 6px; bottom: 4px; font-size: 11px; color: var(--muted);
  background: rgba(255, 255, 255, 0.75); padding: 0 5px; border-radius: 6px; }
.zone-ring { fill: rgba(36, 87, 214, 0.08); stroke: var(--accent); stroke-width: 1.5; stroke-dasharray: 6 5; }
.trail-line { fill: none; stroke: var(--accent); stroke-width: 3; stroke-linejoin: round; stroke-linecap: round; opacity: 0.85; }
.trail-dot { fill: var(--accent); stroke: #fff; stroke-width: 1; }
.trail-out { fill: var(--bad); stroke: #fff; stroke-width: 1; }
.trail-start { fill: var(--ok); stroke: #fff; stroke-width: 2; }
.trail-end { fill: var(--navy); stroke: #fff; stroke-width: 2; }
.office-dot { fill: #fff; stroke: var(--accent); stroke-width: 3; }
.daymap-zoom { position: absolute; right: 8px; top: 8px; display: flex; flex-direction: column; gap: 4px; }
.daymap-zoom button { min-height: 32px; width: 32px; padding: 0; font-size: 16px; line-height: 1;
  background: rgba(255, 255, 255, 0.94); box-shadow: 0 1px 3px rgba(16, 24, 40, 0.2); }
.daymap-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 13px; color: var(--muted); }
.daymap-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 5px; vertical-align: -1px; }
