/* ───────────────────────────────────────────────
   Studiya jadvali — TDIU Ta’lim kontentini yaratish markazi
   Asosiy rang: ko‘k. Qizil — faqat texnik ishlar va bayram.
   ─────────────────────────────────────────────── */
:root {
  --ink: #1F6FE0;        /* asosiy ko‘k */
  --ink-2: #1A5FC4;      /* hover, quyuqroq */
  --ink-soft: #E9F1FC;   /* band katakning foni */
  --ink-line: #C0D5F6;
  --ink-on: #D2E2F9;     /* ko‘k fon ustidagi och matn */
  --paper: #F3F6FA;
  --surface: #FFFFFF;
  --line: #D9E1EC;
  --line-2: #E7ECF3;
  --text: #13233D;
  --muted: #5A6880;
  --free: #17734A;
  --free-dot: #1F9D5F;
  --free-bg: #EBF6EF;
  --free-line: #9FD3B4;
  --ok: #17734A;
  --no: #B42318;
  --no-bg: #FDECEA;
  --red: #CF3B2F;
  --red-soft: #FDEEEC;
  --red-line: #F2BDB6;
  --amber: #A65F00;
  --amber-bg: #FFF3DD;
  --focus: #1F6FE0;
  --rowmin: 54px;
  --font: "Golos Text", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--text);
  font: 400 15px/1.5 var(--font);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
a { color: var(--ink-2); }
a:hover { color: #154EA3; }
img { max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.sr { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip { position: absolute; left: 12px; top: -48px; background: #fff; padding: 8px 12px; border-radius: 8px; z-index: 100; }
.skip:focus { top: 12px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.num, .tnum { font-variant-numeric: tabular-nums; }

/* ── Header ─────────────────────────────────── */
.topbar { background: var(--ink); color: #fff; position: relative; z-index: 20; flex: none; }
.topbar-in {
  max-width: 1440px; margin: 0 auto; padding: 0 32px;
  min-height: 58px; display: flex; align-items: center; gap: 28px;
}
.brand { display: flex; align-items: center; gap: 12px; color: #fff; text-decoration: none; min-width: 0; }
.brand:hover { color: #fff; }
.brand-mark { flex: none; display: grid; }
.brand-mark img { width: 36px; height: 36px; object-fit: contain; border-radius: 8px; background: #fff; }
.brand-text { min-width: 0; line-height: 1.25; }
.brand-text b { display: block; font-size: 16px; font-weight: 600; }
.brand-text small { display: block; font-size: 12px; color: var(--ink-on); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.topnav { flex: 1; display: flex; align-items: center; justify-content: space-between; gap: 20px; min-width: 0; }
.nav { display: flex; gap: 2px; flex-wrap: wrap; }
.nav a { color: rgba(255,255,255,.85); text-decoration: none; font-size: 14px; font-weight: 500; padding: 8px 12px; border-radius: 8px; }
.nav a:hover { color: #fff; background: rgba(255,255,255,.12); }
.nav a[aria-current="page"] { color: #fff; background: rgba(255,255,255,.2); }
.usr { display: flex; align-items: center; gap: 10px; }
.usr form { margin: 0; }
.usr-name { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; line-height: 1.25; }
.usr-name:hover { color: #fff; }
.usr-name b { display: block; font-size: 14px; font-weight: 600; }
.usr-name small { display: block; font-size: 12px; color: var(--ink-on); }
.usr-av { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: rgba(255,255,255,.2); font-weight: 600; font-size: 14px; }
.usr-out, .login-link {
  background: transparent; color: #fff; border: 1px solid rgba(255,255,255,.45);
  border-radius: 8px; padding: 7px 14px; font-size: 13.5px; font-weight: 500; cursor: pointer; text-decoration: none; white-space: nowrap;
}
.usr-out:hover, .login-link:hover { background: rgba(255,255,255,.14); color: #fff; }
.login-link { margin-left: auto; }
.menu-btn { display: none; margin-left: auto; align-items: center; gap: 8px; background: rgba(255,255,255,.16); color: #fff; border: 0; border-radius: 8px; padding: 8px 12px; font-size: 14px; font-weight: 500; cursor: pointer; }

/* ── Ma’lumot qatori (bosh sahifa) ──────────── */
.infobar { background: var(--surface); border-bottom: 1px solid var(--line); flex: none; }
.infobar-in { max-width: 1440px; margin: 0 auto; padding: 12px 32px; display: flex; align-items: center; gap: 24px; }
.ib-clock { display: flex; flex-direction: column; line-height: 1.1; }
.ib-clock b { font-size: 32px; font-weight: 600; letter-spacing: -0.02em; }
.ib-clock span { font-size: 12.5px; color: var(--muted); margin-top: 4px; }
.ib-contact { margin-left: auto; display: flex; align-items: center; gap: 18px; min-width: 0; }
.ib-loc { display: flex; flex-direction: column; gap: 3px; }
.ib-loc span { font-size: 12.5px; color: var(--muted); }
.ib-loc b { display: inline-flex; align-items: center; gap: 7px; font-size: 14.5px; font-weight: 600; white-space: nowrap; }
.ib-loc b svg { color: var(--ink); flex: none; }
.ib-sep { width: 1px; height: 46px; background: var(--line); }
.ib-duty { display: flex; align-items: center; gap: 10px; }
.ib-duty > div { display: flex; flex-direction: column; line-height: 1.35; }
.ib-duty b { font-size: 14.5px; font-weight: 600; }
.ib-duty > div > span { font-size: 12.5px; color: var(--muted); }
.ib-duty > div > span.ok { color: var(--free); font-weight: 500; }
.ib-num { color: var(--text); font-weight: 500; margin-left: 4px; }
.ib-av { flex: none; width: 40px; height: 40px; border-radius: 50%; background: var(--ink); color: #fff; display: grid; place-items: center; font-weight: 600; font-size: 13.5px; }
.ib-call { height: 44px; padding: 0 18px; border-radius: 11px; font-size: 14.5px; font-weight: 600; }

/* ── Page shell ─────────────────────────────── */
.page { flex: 1; width: 100%; max-width: 1440px; margin: 0 auto; padding: 24px 32px 40px; }
.foot { border-top: 1px solid var(--line); flex: none; }
.foot-in { max-width: 1440px; margin: 0 auto; padding: 14px 32px; display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; font-size: 13px; color: var(--muted); }
.foot-seo { color: var(--muted); opacity: .85; }

h1, h2, h3 { line-height: 1.2; letter-spacing: -0.01em; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px 20px; margin-bottom: 18px; }
.page-head h1 { margin: 0; font-size: 28px; font-weight: 600; }
.page-head p { margin: 4px 0 0; color: var(--muted); }

/* ── Buttons ────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 16px; border-radius: 10px; border: 1px solid var(--ink);
  background: var(--ink); color: #fff; font-size: 14px; font-weight: 500; line-height: 1;
  cursor: pointer; text-decoration: none; white-space: nowrap;
}
.btn:hover { background: var(--ink-2); border-color: var(--ink-2); color: #fff; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-ghost { background: var(--surface); color: var(--ink-2); border-color: var(--line); }
.btn-ghost:hover { background: var(--ink-soft); border-color: var(--ink-line); color: var(--ink-2); }
.btn-icon { width: 40px; padding: 0; }
.btn-block { width: 100%; height: 46px; font-size: 15px; }
.btn-ok { background: var(--ok); border-color: var(--ok); }
.btn-danger { background: var(--no); border-color: var(--no); }
.btn-danger:hover { background: #8F1C13; border-color: #8F1C13; }
.btn-text { background: none; border: 0; padding: 8px 4px; color: var(--ink-2); font-size: 14px; font-weight: 500; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.btn-text.danger { color: var(--no); }
.btn-sm { height: 32px; padding: 0 12px; font-size: 13px; border-radius: 8px; }

/* ── Alerts, chips, badges ──────────────────── */
.alert { padding: 12px 14px; border-radius: 10px; margin: 0 0 16px; font-size: 14px; border: 1px solid transparent; }
.alert-success { background: var(--free-bg); color: #125A38; border-color: #BCDDC9; }
.alert-error { background: var(--no-bg); color: var(--no); border-color: #F2C8C3; }
.alert-info { background: var(--ink-soft); color: #154EA3; border-color: var(--ink-line); }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; font-size: 13px; font-weight: 500; text-decoration: none; }
.chip-amber { background: var(--amber-bg); color: var(--amber); border: 1px solid #F0D3A2; }
.chip-amber:hover { color: #7F4800; }
.badge { display: inline-flex; align-items: center; padding: 2px 9px; border-radius: 999px; font-size: 12.5px; font-weight: 600; white-space: nowrap; }
.badge-booked { background: var(--ink-soft); color: #154EA3; }
.badge-attended { background: var(--free-bg); color: var(--ok); }
.badge-no_show { background: #EEF1F5; color: #4A5568; }
.badge-cancelled { background: #EEF1F5; color: var(--muted); }
.badge-unmarked { background: var(--amber-bg); color: var(--amber); }
.badge-off { background: #EEF1F5; color: var(--muted); }

/* ── Week header ────────────────────────────── */
.board-wrap { display: flex; flex-direction: column; gap: 12px; }
.wk-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 20px; }
.wk-left { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; min-width: 0; }
.wk-arrows { display: flex; gap: 6px; }
.wk-arrow {
  width: 40px; height: 40px; border-radius: 11px; border: 1px solid var(--line); background: var(--surface);
  color: var(--ink); display: grid; place-items: center; text-decoration: none;
}
a.wk-arrow:hover { background: var(--ink-soft); border-color: var(--ink-line); color: var(--ink-2); }
.wk-arrow.is-off { color: #B8C2D0; background: #F7F9FC; cursor: not-allowed; }
.wk-head h1 { margin: 0; font-size: clamp(22px, 2.4vw, 28px); font-weight: 600; font-variant-numeric: tabular-nums; }
.wk-rel { font-size: 12.5px; font-weight: 600; color: var(--ink-2); background: var(--ink-soft); border-radius: 999px; padding: 3px 10px; text-decoration: none; white-space: nowrap; }
a.wk-rel { background: #FFF3DD; color: var(--amber); }
a.wk-rel:hover { background: #FBE6C0; color: #7F4800; }
.wk-right { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.wk-free { font-size: 13.5px; color: var(--muted); }
.wk-free b { color: var(--free); font-weight: 600; }
/* ── Studiya almashtirgichi (tablar) ─────────── */
.st-seg { display: inline-flex; gap: 4px; padding: 4px; background: #E6ECF5; border-radius: 12px; }
.st-opt { display: flex; flex-direction: column; gap: 1px; padding: 6px 14px; border-radius: 9px; color: var(--text); text-decoration: none; line-height: 1.2; min-width: 112px; transition: background .15s, box-shadow .15s; }
.st-opt b { font-size: 14.5px; font-weight: 600; }
.st-opt span { font-size: 12px; color: var(--muted); }
.st-opt span.ok { color: var(--free); font-weight: 500; }
.st-opt:hover { background: rgba(255,255,255,.6); }
.st-opt.is-on { background: var(--surface); box-shadow: 0 1px 2px rgba(16,24,40,.12), 0 0 0 1px var(--ink-line); }
.st-opt.is-on b { color: var(--ink-2); }

.studio-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 16px; }
.studio-card { border: 1px solid var(--line); border-radius: 12px; padding: 16px; background: #FBFCFE; }
.studio-card code { font-size: 12px; }
.studio-cards + .warn-line { margin-top: 14px; }
.studio-card .warn-line { margin: 0 0 12px; }

/* ── Studiyani tanlash sahifasi ─────────────── */
.chooser { max-width: 880px; margin: 24px auto 40px; text-align: center; }
.chooser h1 { font-size: clamp(24px, 3vw, 32px); margin: 0 0 8px; }
.chooser > p { margin: 0 auto 28px; max-width: 560px; }
.ch-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 18px; text-align: left; }
.ch-card { position: relative; display: flex; flex-direction: column; gap: 8px; padding: 24px 24px 22px; background: var(--surface); border: 1px solid var(--line); border-radius: 18px;
  color: var(--text); text-decoration: none; box-shadow: 0 1px 2px rgba(16,24,40,.05); transition: transform .18s, box-shadow .18s, border-color .18s;
  animation: cell-in .5s cubic-bezier(.2,.75,.25,1) backwards; animation-delay: var(--d, 0ms); }
.ch-card:hover { transform: translateY(-3px); border-color: var(--ink-line); box-shadow: 0 14px 30px rgba(16,40,90,.12); }
.ch-num { position: absolute; top: 18px; right: 20px; width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--ink-soft); color: var(--ink-2); font-weight: 700; font-size: 18px; }
.ch-name { font-size: 22px; font-weight: 700; }
.ch-loc { display: flex; align-items: flex-start; gap: 7px; font-size: 14.5px; color: var(--text); padding-right: 48px; }
.ch-loc svg { color: var(--ink); flex: none; margin-top: 1px; }
.ch-free { font-size: 14px; color: var(--muted); }
.ch-free.ok { color: var(--free); font-weight: 600; }
.ch-duty { font-size: 13.5px; color: var(--muted); }
.ch-go { margin-top: 10px; align-self: flex-start; gap: 8px; }
.ch-card:hover .ch-go { background: var(--ink-2); border-color: var(--ink-2); }
/* Bino rasmlari: o‘qituvchi qaysi binodagi studiya ekanini rasmdan taniydi */
.chooser .ch-card { overflow: hidden; isolation: isolate; }
.chooser .ch-card > :not(.ch-photo):not(.ch-num) { position: relative; z-index: 1; }
.chooser .ch-num { z-index: 2; }
.ch-photo { position: absolute; inset: 0; z-index: 0; background-size: cover; background-position: center 72%; transition: transform .7s ease; }
.ch-photo::after { content: ''; position: absolute; inset: 0; background: linear-gradient(100deg, rgba(255,255,255,.96) 34%, rgba(255,255,255,.76) 62%, rgba(255,255,255,.42) 100%); }
.ch-card:hover .ch-photo { transform: scale(1.05); }
.ch-bgs { display: none; }
@media (min-width: 721px) {
  /* Kompyuterda sahifa foni ikkiga bo‘linadi: chapda 1-studiya binosi, o‘ngda 2-studiya binosi (kirish eshigi pastda ko‘rinadi) */
  .ch-split .ch-photo { display: none; }
  .ch-split .ch-bgs { display: block; position: fixed; left: 0; right: 0; top: var(--top-h, 56px); bottom: var(--foot-h, 48px); z-index: -1; pointer-events: none; overflow: hidden; }
  .ch-bg { position: absolute; top: 0; bottom: 0; width: 50%; background-size: cover; background-position: center bottom; animation: bg-in 1.2s ease-out both; }
  .ch-bg::after { content: ''; position: absolute; inset: 0; background: linear-gradient(to bottom, rgba(243,246,250,.94) 0%, rgba(243,246,250,.84) 40%, rgba(243,246,250,.42) 100%); }
  .ch-bg-1 { left: 0; -webkit-mask-image: linear-gradient(to right, #000 74%, transparent); mask-image: linear-gradient(to right, #000 74%, transparent); }
  .ch-bg-2 { right: 0; -webkit-mask-image: linear-gradient(to left, #000 74%, transparent); mask-image: linear-gradient(to left, #000 74%, transparent); }
  .ch-split .ch-card { background: rgba(255,255,255,.86); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); }
}
@keyframes bg-in { from { opacity: 0; transform: scale(1.03); } }

/* «Ikkalasi birga» navbatchilik: ikkala adminning raqami */
.ib-pair { display: grid; grid-template-columns: auto auto; column-gap: 22px; row-gap: 4px; align-items: center; }
.ib-person { display: flex; align-items: center; gap: 9px; }
.ib-person .ib-av { width: 34px; height: 34px; font-size: 12.5px; }
.ib-person > div { display: flex; flex-direction: column; line-height: 1.3; }
.ib-person b { font-size: 14px; font-weight: 600; white-space: nowrap; }
.ib-tel { display: inline-flex; align-items: center; gap: 5px; color: var(--ink-2); font-weight: 600; font-size: 13.5px; text-decoration: none; white-space: nowrap; }
.ib-tel svg { width: 14px; height: 14px; }
.ib-tel:hover { text-decoration: underline; }
.ib-pair-note { grid-column: 1 / -1; font-size: 12px; color: var(--muted); }
.ib-pair-note.ok { color: var(--free); font-weight: 500; }
.mc-calls { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.mc-call { justify-content: flex-start; gap: 8px; height: auto; min-height: 48px; padding: 7px 12px; text-align: left; }
.mc-call svg { flex: none; }
.mc-call span { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.mc-call b { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mc-call small { font-size: 12px; opacity: .92; }
.duty-note { margin: 0 0 4px; font-size: 13.5px; color: var(--muted); }
.duty-note.ok { color: var(--free); font-weight: 500; }
.duty-card-call { margin: 8px 0; }
.duty-card-call > div { flex: 1; }

/* Sozlamalar: navbatchilik tartibi va bino rasmi */
.l-both { display: none; }
.studio-card[data-mode="both"] .l-both { display: inline; }
.studio-card[data-mode="both"] .l-shift { display: none; }
/* Hozirgi vaqt chizig‘i (bugungi ustun, joriy soat ichida silliq yuradi) */
.now-line { position: absolute; top: 0; left: 0; height: 2px; margin-top: -1px; background: #E5483C; z-index: 4; pointer-events: none;
  transition: transform 30s linear; animation: now-in .6s ease-out .8s backwards; }
.now-line.no-anim { transition: none; }
.now-dot { position: absolute; left: -6px; top: -5px; width: 12px; height: 12px; border-radius: 50%; background: #E5483C; box-shadow: 0 0 0 3px rgba(229, 72, 60, .22); }
.now-pill { position: absolute; top: -11px; height: 22px; padding: 0 7px; border-radius: 11px; background: #E5483C; color: #fff; font-size: 12px; font-weight: 600; line-height: 22px; white-space: nowrap; box-shadow: 0 2px 6px rgba(0, 0, 0, .18); }
@keyframes now-in { from { opacity: 0; } }
@media (max-width: 720px) {
  .now-dot { left: -4px; top: -4px; width: 9px; height: 9px; }
  .now-pill { top: -9px; height: 18px; padding: 0 4px; border-radius: 9px; font-size: 10.5px; line-height: 18px; }
}
@media print { .now-line { display: none; } }

/* Sozlamalar: texnik holat */
.tech-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px; }
.tech-grid > div { display: flex; flex-direction: column; gap: 3px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; background: #FBFCFE; }
.tech-grid span { font-size: 12.5px; color: var(--muted); }
.tech-grid b { font-size: 14.5px; font-weight: 600; }
.tech-grid b.ok { color: var(--free); }
.tech-grid b.bad { color: var(--no); }
.err-log { max-height: 260px; overflow: auto; background: #10192B; color: #D6E2F5; font-size: 12px; line-height: 1.5; padding: 12px 14px; border-radius: 10px; white-space: pre-wrap; word-break: break-word; margin: 0 0 10px; }
details.restore { margin-top: 14px; }
details.restore summary { cursor: pointer; color: var(--ink-2); font-weight: 600; }
.photo-row { display: flex; align-items: center; gap: 12px; }
.photo-row input[type=file] { min-width: 0; font-size: 13.5px; }
.photo-thumb { width: 104px; height: 64px; object-fit: cover; object-position: center 72%; border-radius: 8px; border: 1px solid var(--line); flex: none; }

.wk-clock { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); order: 2; padding-left: 12px; border-left: 1px solid var(--line); }
.wk-clock b { font-size: 15px; font-weight: 600; color: var(--text); }

/* ── Board grid (kartochkalar) ──────────────── */
.board-scroll { min-height: 0; }
.board {
  position: relative;
  display: grid;
  grid-template-columns: 70px repeat(var(--days, 5), minmax(0, 1fr));
  gap: 6px;
  min-width: 0;
}
.b-corner { }
.b-day {
  position: relative; border: 0; margin: 0; padding: 0 12px; border-radius: 10px; background: transparent;
  display: flex; align-items: center; gap: 8px; text-align: left; color: var(--text); font: inherit;
  border-bottom: 1px solid var(--line); border-radius: 10px 10px 0 0; min-width: 0;
}
button.b-day { cursor: pointer; }
button.b-day:not(.is-today):hover { background: #EAF0F8; }
.b-dd { font-size: 19px; font-weight: 600; font-variant-numeric: tabular-nums; }
.b-dn { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.b-dn .short { display: none; }
.b-today { margin-left: auto; font-size: 11.5px; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: rgba(255,255,255,.22); color: #fff; }
.b-day.is-today { background: var(--ink); color: #fff; border-bottom: 0; border-radius: 10px; }
.b-day.is-today .b-dn { color: var(--ink-on); }
.b-day.is-past .b-dd { color: var(--muted); }
.b-time { display: flex; flex-direction: column; justify-content: center; line-height: 1.2; font-variant-numeric: tabular-nums; }
.b-time b { font-size: 14px; font-weight: 600; }
.b-time span { font-size: 11.5px; color: var(--muted); }
.b-break { grid-column: 1 / -1; display: flex; align-items: center; }
.b-break::before { content: ""; flex: 1; height: 1px; background: var(--line); }

.c {
  position: relative; display: flex; flex-direction: column; justify-content: center; align-items: flex-start; gap: 1px;
  min-width: 0; min-height: 0; margin: 0; padding: 6px 12px; border: 0; border-radius: 10px; overflow: hidden;
  background: var(--surface); text-align: left; color: var(--text); font: inherit;
}
button.c { cursor: pointer; }
.c:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; z-index: 2; }

.c-free { border: 1.5px dashed var(--free-line); }
.c-fl { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; font-weight: 600; color: var(--free); }
.c-fl::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--free-dot); }
.c-add { font-size: 12px; font-weight: 600; color: var(--ink-2); display: none; }
body[data-role="admin"] button.c-free:hover .c-add,
body[data-role="superadmin"] button.c-free:hover .c-add,
button.c-free:focus-visible .c-add { display: block; }
button.c-free:not(.is-past):hover { background: var(--free-bg); }
.c-free.is-past { background: #E9EDF2; border: 0; }
body[data-role="admin"] button.c-free.is-past:hover,
body[data-role="superadmin"] button.c-free.is-past:hover { background: #E1E6ED; }

.c-busy { background: var(--ink-soft); border: 1px solid var(--ink-line); }
button.c-busy:hover { background: #DDE9FA; }
.c-nm { font-size: 13px; font-weight: 600; line-height: 1.3; max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding-right: 18px; }
.nm-s { display: none; }
.c-dp { font-size: 12px; color: var(--muted); max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.c-busy.is-past:not(.st-no_show) { opacity: .8; }

.c.is-now.c-busy { background: var(--ink); border-color: var(--ink); color: #fff; }
.c.is-now.c-busy .c-dp { color: var(--ink-on); }
.c.is-now .c-nm { padding-right: 52px; }
.c.is-now.c-free { border: 2px solid var(--ink); }
.c-now {
  position: absolute; right: 9px; top: 7px; font-size: 11px; font-weight: 600; line-height: 1.5;
  padding: 0 7px; border-radius: 999px; background: rgba(255,255,255,.22); color: #fff;
}
.c-free .c-now { background: var(--ink-soft); color: var(--ink-2); }

.c-flag {
  position: absolute; top: 7px; right: 8px; width: 18px; height: 18px; border-radius: 50%;
  display: grid; place-items: center; font-size: 11px; font-weight: 700; color: #fff; line-height: 1;
}
.c.is-now .c-flag { top: auto; bottom: 7px; }
.st-attended .c-flag { background: var(--ok); }
.st-no_show { background: #EEF1F5; border-color: #DDE3EA; }
.st-no_show .c-nm { color: #5A6880; }
.c.is-now.st-no_show .c-nm, .c.is-now.st-no_show .nm-s .in { color: var(--ink-on); }
.st-no_show .c-flag { background: #8A96A8; }
.st-unmarked .c-flag { width: 9px; height: 9px; top: 10px; right: 10px; background: #E39A1F; box-shadow: 0 0 0 3px var(--amber-bg); }

.c-tech { background: repeating-linear-gradient(135deg, var(--red-soft) 0 8px, #FADDD9 8px 16px); border: 1px solid var(--red-line); }
.c-hol { background: var(--red); border: 1px solid var(--red); }
.c-blk { font-size: 13px; font-weight: 600; color: var(--no); max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.c-tech .c-dp { color: #9A2A1E; }
.c-hol .c-blk { color: #fff; }
.c-hol .c-dp { color: #FBE0DC; }

.board-foot { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 18px; }
.legend { list-style: none; display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 0; padding: 0; font-size: 12.5px; color: var(--muted); }
.legend li { display: inline-flex; align-items: center; gap: 7px; }
.sw { display: inline-block; width: 20px; height: 13px; border-radius: 4px; flex: none; }
.sw-free { background: #fff; border: 1.5px dashed var(--free-line); }
.sw-busy { background: var(--ink-soft); border: 1px solid var(--ink-line); }
.sw-now { background: var(--ink); }
.sw-tech { background: repeating-linear-gradient(135deg, var(--red-soft) 0 3px, #F6CFC9 3px 6px); border: 1px solid var(--red-line); }
.sw-hol { background: var(--red); }
.sw-ic { width: 15px; height: 15px; border-radius: 50%; display: inline-grid; place-items: center; color: #fff; font-size: 9px; font-weight: 700; font-style: normal; }
.sw-ok { background: var(--ok); }
.sw-no { background: #8A96A8; }
.sw-dot { width: 9px; height: 9px; border-radius: 50%; background: #E39A1F; display: inline-block; }
.lunch-note { margin-left: auto; font-size: 12.5px; color: var(--muted); }

/* Davomat tugmasi */
.att-btn {
  display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; height: 44px; margin-top: 6px;
  border-radius: 10px; border: 1.5px solid var(--line); background: var(--surface); color: var(--text);
  font-weight: 600; font-size: 14.5px; cursor: pointer;
}
.att-btn span { color: var(--no); }
.att-btn:hover:not(:disabled) { border-color: #8A96A8; background: #F4F6F9; }
.att-btn.is-on { background: #EEF1F5; border-color: #B8C2D0; color: #4A5568; }
.att-btn:disabled { opacity: .5; cursor: not-allowed; }

/* ── ⚡ Muhim ────────────────────────────────── */
.c-urg { display: inline-block; margin-right: 4px; font-size: 12px; line-height: 1; vertical-align: 1px; }
.c.is-urgent { box-shadow: inset 3px 0 0 #F2A900; }
.sw-urg { background: var(--amber-bg); color: var(--amber); font-size: 10px; box-shadow: inset 0 0 0 1px #F0D3A2; }
.check.check-urg { padding: 10px 12px; border: 1px solid #F0D3A2; background: #FFFBF3; border-radius: 10px; align-items: flex-start; line-height: 1.4; }
.check.check-urg input { margin-top: 1px; flex: none; }
.check-urg small { display: block; color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.urg-toggle { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 12px; margin: 0 0 14px;
  border: 1px solid var(--line); border-radius: 10px; font-size: 14px; }
.urg-toggle.is-on { border-color: #F0D3A2; background: #FFFBF3; }
.urg-toggle b { font-weight: 600; }
.urg-toggle small { display: block; color: var(--muted); font-size: 12.5px; }
.urg-box { border: 1px solid #F0D3A2; background: #FFFBF3; border-radius: 12px; padding: 12px 14px 6px; margin: 0 0 16px; }
.urg-box h3 { margin: 0 0 2px; font-size: 14.5px; font-weight: 600; }
.urg-box > p { margin: 0 0 6px; font-size: 12.5px; color: var(--muted); }
.urg-item { display: flex; flex-direction: column; gap: 8px; padding: 11px 0; border-top: 1px solid #F3E3C4; }
.urg-item:first-of-type { border-top: 0; }
.urg-who { display: flex; flex-direction: column; gap: 1px; }
.urg-who b { font-size: 14.5px; font-weight: 600; }
.urg-who span { font-size: 12.5px; color: var(--muted); }
.urg-act { display: flex; flex-wrap: wrap; gap: 8px; }
.urg-act .btn { white-space: nowrap; }
.urg-act svg { width: 15px; height: 15px; }
@media (max-width: 560px) {
  .urg-act > * { flex: 1; justify-content: center; }
}

/* ── Animatsiyalar ──────────────────────────── */
@keyframes cell-in { from { opacity: 0; transform: translate(var(--fx, 0px), 10px) scale(.97); } }
@keyframes fade-down { from { opacity: 0; transform: translateY(-6px); } }
@keyframes now-glow { 0%, 100% { box-shadow: 0 0 0 0 rgba(31, 111, 224, .40); } 60% { box-shadow: 0 0 0 8px rgba(31, 111, 224, 0); } }
@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: .2; } }
@keyframes ring { 0%, 86%, 100% { transform: rotate(0); } 88% { transform: rotate(-14deg); } 90% { transform: rotate(12deg); } 92% { transform: rotate(-10deg); } 94% { transform: rotate(8deg); } 96% { transform: rotate(-4deg); } }

/* Sahifa ochilganda kataklar burchakdan to‘lqin bo‘lib chiqadi; hafta almashganda yon tomondan siljiydi */
.board.anim > * { animation: cell-in .5s cubic-bezier(.2, .75, .25, 1) backwards; animation-delay: var(--d, 0ms); }
.board.anim-n { --fx: 26px; }
.board.anim-p { --fx: -26px; }
.wk-head.anim h1, .wk-head.anim .wk-rel { animation: fade-down .45s ease-out backwards; }
.wk-head.anim .wk-rel { animation-delay: .12s; }
.infobar.anim .ib-clock, .infobar.anim .ib-contact { animation: fade-down .5s ease-out backwards; }
.infobar.anim .ib-contact { animation-delay: .12s; }

/* «Hozir» katagi — jonli puls */
.c.is-now { animation: now-glow 2.6s ease-in-out infinite; }
.board.anim > .c.is-now { animation: cell-in .5s cubic-bezier(.2, .75, .25, 1) backwards, now-glow 2.6s ease-in-out 1s infinite; animation-delay: var(--d, 0ms), 1s; }
.c-now::before { content: ""; display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: currentColor; margin-right: 5px; vertical-align: 1px; animation: blink 1.4s ease-in-out infinite; }

/* Soat ikki nuqtasi va qo‘ng‘iroq tugmasi */
#clock .colon { animation: blink 2s ease-in-out infinite; }
.ib-call svg, .m-contact .btn svg, .ib-tel svg { transform-origin: 50% 55%; animation: ring 6s ease-in-out 2s infinite; }

/* Sichqoncha bilan: kataklar ko‘tariladi */
@media (hover: hover) {
  button.c { transition: transform .16s ease, box-shadow .16s ease, background-color .16s ease; }
  button.c:hover { transform: translateY(-2px); box-shadow: 0 8px 18px rgba(19, 35, 61, .10); z-index: 1; }
  .wk-arrow { transition: background-color .15s ease, transform .1s ease; }
}
a.wk-arrow:active, button.wk-arrow:active { transform: scale(.93); }

/* Telefon uchun aloqa kartasi (kompyuterda yashirin) */
.m-contact { display: none; }

/* ── Sheet (modal) ──────────────────────────── */
dialog.sheet {
  border: 0; padding: 0; border-radius: 16px; width: min(520px, calc(100vw - 32px));
  max-height: calc(100vh - 48px); max-height: calc(100dvh - 48px);
  background: var(--surface); color: var(--text); box-shadow: 0 24px 64px rgba(16, 32, 60, .28);
}
dialog.sheet::backdrop { background: rgba(12, 26, 50, .45); }
dialog.sheet[open] { animation: sheet-in .18s ease-out; }
@keyframes sheet-in { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
.sheet-in { display: flex; flex-direction: column; max-height: inherit; }
.sheet-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 20px 22px 6px; }
.sheet-kicker { margin: 0; font-size: 13.5px; font-weight: 500; color: var(--muted); }
.sheet-head h2 { margin: 2px 0 0; font-size: 21px; font-weight: 600; font-variant-numeric: tabular-nums; }
.sheet-x { flex: none; width: 36px; height: 36px; border-radius: 8px; border: 0; background: transparent; color: var(--muted); cursor: pointer; display: grid; place-items: center; }
.sheet-x:hover { background: var(--paper); color: var(--text); }
.sheet-body { padding: 10px 22px 22px; overflow: auto; }
.sheet-body .lead { font-size: 16px; font-weight: 500; margin: 4px 0 6px; }
.sheet-body hr { border: 0; border-top: 1px solid var(--line-2); margin: 18px 0; }
.duty-card { display: flex; align-items: center; gap: 12px; padding: 14px; border-radius: 12px; background: var(--ink-soft); border: 1px solid var(--ink-line); margin: 12px 0; }
.duty-card > div { display: flex; flex-direction: column; line-height: 1.35; min-width: 0; }
.duty-card b { font-size: 15px; font-weight: 600; }
.duty-card > div > span { font-size: 13px; color: var(--muted); }
.duty-card > div > span.ok { color: var(--free); font-weight: 500; }
.loc-line { display: flex; align-items: center; gap: 8px; font-size: 14.5px; font-weight: 600; margin: 10px 0 0; }
.loc-line svg { color: var(--ink); }

.kv { display: grid; grid-template-columns: 112px 1fr; gap: 9px 14px; margin: 8px 0 0; font-size: 14.5px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 500; overflow-wrap: anywhere; }
.kv a { font-weight: 600; text-decoration: none; }

.seg { display: flex; gap: 4px; padding: 4px; background: var(--paper); border-radius: 11px; margin: 4px 0 16px; }
.seg button { flex: 1; height: 38px; border: 0; border-radius: 8px; background: transparent; cursor: pointer; font-size: 14px; font-weight: 500; color: var(--muted); }
.seg button:hover { color: var(--text); }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink-2); box-shadow: 0 1px 2px rgba(16,24,40,.1), 0 0 0 1px var(--line); }
.seg button:disabled { cursor: not-allowed; opacity: .55; }
.seg-att button[data-st="attended"][aria-pressed="true"] { color: var(--ok); box-shadow: 0 1px 2px rgba(16,24,40,.1), 0 0 0 1px #BCDDC9; background: var(--free-bg); }
.seg-att button[data-st="no_show"][aria-pressed="true"] { color: #4A5568; box-shadow: 0 1px 2px rgba(16,24,40,.1), 0 0 0 1px #CBD3DE; background: #EEF1F5; }
.sec-label { margin: 18px 0 4px; font-size: 13px; font-weight: 600; color: var(--muted); }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 18px; }
.actions .push { margin-left: auto; }
.confirm-box { margin-top: 16px; padding: 14px; border-radius: 12px; background: var(--no-bg); border: 1px solid #F2C8C3; }
.confirm-box p { margin: 0 0 10px; font-size: 14px; }

/* ── Forms ──────────────────────────────────── */
.form { margin: 0; }
.fld { position: relative; margin-bottom: 14px; min-width: 0; }
.fld label, .fld .lbl { display: block; margin-bottom: 6px; font-size: 13.5px; font-weight: 600; }
.fld input[type="text"], .fld input[type="tel"], .fld input[type="password"], .fld input[type="date"], .fld input[type="search"],
.fld input:not([type]), .fld select, .fld textarea {
  display: block; width: 100%; height: 44px; padding: 0 12px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--surface); font-size: 15px; color: var(--text); appearance: none; -webkit-appearance: none;
}
.fld select {
  padding-right: 36px; text-overflow: ellipsis;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5 6 6.5l5-5' fill='none' stroke='%235A6880' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center;
}
.fld textarea { height: auto; min-height: 80px; padding: 10px 12px; resize: vertical; }
.fld input:focus, .fld select:focus, .fld textarea:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 3px rgba(31, 111, 224, .16); }
.phone-in { display: flex; align-items: stretch; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); overflow: hidden; }
.phone-in span { display: flex; align-items: center; padding: 0 4px 0 12px; color: var(--muted); font-size: 15px; font-variant-numeric: tabular-nums; }
.fld .phone-in input { border: 0; border-radius: 0; box-shadow: none; padding-left: 6px; font-variant-numeric: tabular-nums; letter-spacing: .01em; }
.phone-in:focus-within { border-color: var(--ink); box-shadow: 0 0 0 3px rgba(31, 111, 224, .16); }
.hint { margin: 6px 0 0; font-size: 13px; color: var(--muted); }
.hint.ok { color: var(--ok); }
.hint.warn { color: var(--amber); }
.check { display: flex; align-items: center; gap: 10px; font-size: 14px; margin: 4px 0 16px; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--ink); margin: 0; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }

.suggest {
  position: absolute; left: 0; right: 0; top: calc(100% - 8px); z-index: 10; background: var(--surface);
  border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 12px 28px rgba(16, 24, 40, .16);
  max-height: 248px; overflow: auto; padding: 4px;
}
.suggest button { display: block; width: 100%; text-align: left; border: 0; background: transparent; border-radius: 8px; padding: 9px 10px; cursor: pointer; line-height: 1.3; }
.suggest button:hover, .suggest button.is-active { background: var(--ink-soft); }
.suggest b { display: block; font-size: 14px; font-weight: 600; }
.suggest small { display: block; font-size: 12.5px; color: var(--muted); }

/* ── Filters & tables ───────────────────────── */
.filters { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px 12px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; margin-bottom: 16px; }
.filters .fld { margin: 0; flex: 1 1 160px; }
.filters .fld.wide { flex: 2 1 240px; }
.filters .fld label { font-size: 12.5px; color: var(--muted); font-weight: 500; margin-bottom: 4px; }
.filters .fld input, .filters .fld select { height: 40px; font-size: 14px; }
.filters .f-actions { display: flex; gap: 8px; align-items: center; }
.active-filter { display: inline-flex; align-items: center; gap: 8px; margin: -4px 0 14px; font-size: 14px; }
.active-filter a { text-decoration: none; font-weight: 600; }

.result-line { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px; margin: 0 0 10px; font-size: 14px; color: var(--muted); }
.table-wrap { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; overflow: auto; }
.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th { text-align: left; font-size: 12.5px; font-weight: 600; color: var(--muted); padding: 11px 14px; background: #F6F9FC; border-bottom: 1px solid var(--line); white-space: nowrap; position: sticky; top: 0; }
.tbl th a { color: inherit; text-decoration: none; }
.tbl th a:hover { color: var(--ink-2); }
.tbl th .sort { color: var(--ink-2); }
.tbl td { padding: 11px 14px; border-bottom: 1px solid var(--line-2); vertical-align: top; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl td.num, .tbl th.num { text-align: right; font-variant-numeric: tabular-nums; }
.tbl td.nowrap { white-space: nowrap; }
.tbl .sub { display: block; font-size: 12.5px; color: var(--muted); }
.tbl tbody tr:hover td { background: #F8FAFD; }
.empty { text-align: center; padding: 48px 16px; color: var(--muted); }
.empty h1, .empty h2 { color: var(--text); font-size: 20px; }
.pager { display: flex; justify-content: center; align-items: center; gap: 12px; margin-top: 16px; font-size: 14px; color: var(--muted); }

.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(176px, 1fr)); gap: 12px; margin-bottom: 20px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; }
.kpi b { display: block; font-size: 26px; font-weight: 600; font-variant-numeric: tabular-nums; line-height: 1.2; }
.kpi span { font-size: 13.5px; color: var(--muted); }
.kpi.k-ok b { color: var(--ok); }
.kpi.k-no b { color: #4A5568; }
.kpi.k-amber b { color: var(--amber); }
.bar { height: 6px; border-radius: 3px; background: var(--line-2); overflow: hidden; min-width: 80px; margin-top: 6px; }
.bar i { display: block; height: 100%; background: var(--ink); border-radius: 3px; }
.quick { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.quick a { font-size: 13.5px; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); text-decoration: none; color: var(--ink-2); font-weight: 500; }
.quick a[aria-current="true"] { background: var(--ink); border-color: var(--ink); color: #fff; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 20px 22px; margin-bottom: 20px; }
.card > h2 { margin: 0 0 4px; font-size: 19px; font-weight: 600; }
.card > p.muted { margin: 0 0 16px; font-size: 14px; }
.card-cols { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.inline-form { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
.inline-form .fld { margin: 0; flex: 1 1 180px; }
.dept-fac { margin: 18px 0 6px; font-size: 13.5px; font-weight: 600; color: var(--muted); }
.dept-list { list-style: none; margin: 0; padding: 0; border: 1px solid var(--line-2); border-radius: 10px; }
.dept-list li { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 12px; border-bottom: 1px solid var(--line-2); font-size: 14px; }
.dept-list li:last-child { border-bottom: 0; }
.dept-list li.off span { color: var(--muted); text-decoration: line-through; }
.dept-list form { margin: 0; display: flex; gap: 6px; }
.dept-all { margin-top: 18px; border-top: 1px solid var(--line-2); padding-top: 14px; }
.dept-all summary { cursor: pointer; font-weight: 600; font-size: 14.5px; color: var(--ink-2); padding: 4px 0; }
.duty-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 14px; max-width: 980px; }
.warn-line { font-size: 13px; color: var(--amber); margin: -6px 0 12px; }

/* ── Login / install ────────────────────────── */
.login-card { max-width: 420px; margin: 40px auto; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 28px; }
.login-card.wide { max-width: 580px; }
.login-card h1 { margin: 0 0 6px; font-size: 24px; font-weight: 600; }
.login-card > p.muted { margin: 0 0 20px; }
.checks { list-style: none; padding: 0; margin: 0 0 18px; font-size: 14px; }
.checks li { padding: 6px 0 6px 26px; position: relative; }
.checks li::before { position: absolute; left: 0; top: 5px; width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center; font-size: 11px; font-weight: 700; color: #fff; }
.checks li.ok::before { content: "✓"; background: var(--ok); }
.checks li.bad::before { content: "✕"; background: var(--no); }
.checks li.warn::before { content: "!"; background: #E39A1F; }

/* ── Toast ──────────────────────────────────── */
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 1000; background: #13233D; color: #fff; padding: 12px 18px; border-radius: 10px; font-size: 14px; font-weight: 500; box-shadow: 0 12px 32px rgba(16, 24, 40, .28); max-width: calc(100vw - 32px); }
.toast.toast-error { background: var(--no); }

/* ── Kompyuter: jadval ekranga to‘liq sig‘adi ── */
@media (min-width: 721px) {
  /* Jadval bo‘sh joyni to‘ldiradi; joy yetmasa sahifa pastga cho‘ziladi, hech narsa ustma-ust tushmaydi */
  body.pg-board { min-height: 100vh; min-height: 100dvh; }
  body.pg-board .page { display: flex; flex-direction: column; padding-top: 14px; padding-bottom: 14px; }
  body.pg-board .board-wrap { flex: 1; }
  body.pg-board .board-scroll { flex: 1; display: flex; }
  body.pg-board .board { flex: 1; }
  body.pg-board .foot { display: none; }
}
/* Pastroq ekranlar (noutbuk 1366×768 va h.k.): hammasi ixchamroq */
@media (min-width: 721px) and (max-height: 860px) {
  :root { --rowmin: 44px; }
  .topbar-in { min-height: 52px; }
  .infobar-in { padding-top: 8px; padding-bottom: 8px; }
  .ib-clock b { font-size: 26px; }
  .ib-call { height: 40px; }
  body.pg-board .page { padding-top: 10px; padding-bottom: 10px; }
  .board-wrap { gap: 8px; }
  .wk-arrow { width: 36px; height: 36px; }
  .wk-head h1 { font-size: 22px; }
  .board { gap: 5px; }
  .c { padding-top: 3px; padding-bottom: 3px; }
}
@media (min-width: 721px) and (max-height: 700px) {
  :root { --rowmin: 40px; }
  .ib-clock span { display: none; }
  .c-dp { font-size: 11.5px; }
}

/* ── Responsive ─────────────────────────────── */
@media (max-width: 1180px) {
  .ib-loc span { display: none; }
  .ib-duty > div > span:nth-child(3) { display: none; }
}
@media (max-width: 980px) {
  .topbar-in { gap: 12px; padding: 0 20px; }
  .menu-btn { display: inline-flex; }
  .topnav {
    display: none; position: absolute; top: 100%; left: 0; right: 0; background: var(--ink);
    flex-direction: column; align-items: stretch; padding: 6px 16px 16px; gap: 10px; border-top: 1px solid rgba(255,255,255,.15);
    box-shadow: 0 12px 24px rgba(0,0,0,.18);
  }
  .topbar.open .topnav { display: flex; }
  .nav { flex-direction: column; gap: 0; }
  .nav a { padding: 11px 10px; font-size: 15px; }
  .usr { justify-content: space-between; padding-top: 10px; border-top: 1px solid rgba(255,255,255,.18); }
  body[data-role="public"] .topnav { display: flex; position: static; flex-direction: row; background: none; padding: 0; border: 0; box-shadow: none; flex: none; margin-left: auto; }
  .card-cols { grid-template-columns: 1fr; }
  .infobar-in { padding: 10px 20px; }
  .page { padding: 20px; }
  .ib-clock b { font-size: 26px; }
  .ib-loc { display: none; }
  .ib-sep { display: none; }
  .duty-grid { grid-template-columns: 1fr; }
}

@media (max-width: 720px) {
  :root { --rowmin: 46px; }
  .topbar-in { padding: 0 16px; min-height: 54px; }
  .brand-text small { max-width: 52vw; }
  .infobar { display: none; }
  .page { padding: 12px 14px 24px; }
  .foot-in { padding: 14px 16px; }
  .page-head h1 { font-size: 23px; }
  .login-link { padding: 6px 10px; font-size: 13px; }
  .menu-btn span { display: none; }

  .wk-head { gap: 8px; }
  .wk-left { gap: 10px; }
  .wk-arrow { width: 38px; height: 38px; }
  .wk-head h1 { font-size: 19px; }
  .wk-right { width: 100%; justify-content: space-between; }
  .st-seg { width: 100%; }
  .st-opt { flex: 1; min-width: 0; padding: 7px 10px; }
  .chooser { margin-top: 8px; }
  .ch-card { padding: 20px 18px 18px; }
  .wk-free { font-size: 12.5px; }

  .board { grid-template-columns: 36px repeat(var(--days, 5), minmax(0, 1fr)); gap: 4px; }
  .b-day { flex-direction: column; justify-content: center; gap: 0; padding: 0; line-height: 1.1; border-radius: 8px 8px 0 0; }
  .b-day.is-today { border-radius: 8px; }
  .b-dd { font-size: 14px; order: 2; }
  .b-dn { font-size: 10.5px; order: 1; }
  .b-dn .long { display: none; }
  .b-dn .short { display: inline; }
  .b-today { display: none; }
  .b-time { align-items: flex-start; }
  .b-time b { font-size: 11px; }
  .b-time span { display: none; }
  .c { padding: 0 4px 0 6px; border-radius: 8px; }
  .c-free { border-width: 1.5px; }
  .c-fl { font-size: 10.5px; gap: 0; }
  .c-fl::before { display: none; }
  .c-add { display: none !important; }
  .c-nm { padding-right: 0; width: 100%; }
  .nm-l { display: none; }
  .nm-s { display: flex; flex-direction: column; min-width: 0; }
  .nm-s .sn { font-size: 10.5px; font-weight: 600; line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .nm-s .in { font-size: 10px; font-weight: 500; line-height: 1.3; color: var(--muted); }
  .c.is-now.c-busy .nm-s .in { color: var(--ink-on); }
  .c-dp { display: none; }
  .c-blk { font-size: 10px; }
  .c-now { display: none; }
  .c-flag { top: auto; bottom: 4px; right: 4px; width: 12px; height: 12px; font-size: 8px; }
  .st-unmarked .c-flag { bottom: 6px; right: 5px; width: 7px; height: 7px; top: auto; box-shadow: none; }
  .legend { font-size: 11.5px; gap: 4px 10px; }
  .lunch-note { display: none; }

  .m-contact {
    display: flex; flex-direction: column; gap: 10px; background: var(--surface); border: 1px solid var(--line);
    border-radius: 16px; padding: 12px 14px; box-shadow: 0 -6px 20px rgba(19,35,61,.06);
    position: sticky; bottom: 8px; z-index: 5;
  }
  .mc-row { display: flex; align-items: center; gap: 10px; }
  .mc-who { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.3; }
  .mc-who b { font-size: 14px; font-weight: 600; }
  .mc-who span { font-size: 12px; color: var(--muted); }
  .mc-who span.ok { color: var(--free); font-weight: 500; }
  .mc-loc { font-size: 11.5px; color: var(--muted); text-align: right; max-width: 34%; line-height: 1.3; }
  .mc-who b { font-size: 13.5px; }
  .m-contact .ib-av { width: 36px; height: 36px; font-size: 12.5px; }
  .mc-num { font-size: 12px; color: var(--muted); text-align: center; margin-top: -4px; }

  dialog.sheet { width: 100%; max-width: 100%; margin: auto 0 0; border-radius: 18px 18px 0 0; max-height: calc(100vh - 32px); max-height: calc(100dvh - 32px); }
  dialog.sheet[open] { animation: sheet-up .22s ease-out; }
  .sheet-head { padding: 18px 18px 4px; }
  .sheet-body { padding: 8px 18px calc(20px + env(safe-area-inset-bottom)); }
  .kv { grid-template-columns: 96px 1fr; font-size: 14px; }
  .grid2 { grid-template-columns: 1fr; }
  .filters { padding: 12px; }
  .filters .fld { flex: 1 1 100%; }
  .filters .fld.half { flex: 1 1 calc(50% - 6px); }
  .card { padding: 16px; }
  .login-card { margin: 16px auto; padding: 22px 18px; }
  .kpi b { font-size: 22px; }
}
@keyframes sheet-up { from { transform: translateY(40px); opacity: .6; } to { transform: none; opacity: 1; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

@media print {
  body { background: #fff; height: auto !important; }
  .topbar, .infobar, .foot, .wk-arrows, .chip, .m-contact, .skip, .toast { display: none !important; }
  .page { padding: 0; max-width: none; }
  .board, .c, .b-day { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
