/* Стиль в духе Apple: системный шрифт, мягкие тени вместо рамок, скругления,
   полупрозрачные панели, круглые отметки. Цвета бренда не меняются. */
body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", system-ui, Roboto, Arial, sans-serif;
  letter-spacing: -0.01em;
  --r: 18px; --r-sm: 12px;
  --shadow: 0 1px 2px rgba(0,0,0,.04), 0 6px 20px rgba(0,0,0,.05);
  --hair: rgba(60,60,67,.12);
  --fill: rgba(118,118,128,.12);
  --fill-2: rgba(118,118,128,.08);
}
h1, h2, h3, .pagehead h1, .dhero h1, .brandpanel h1 { letter-spacing: -0.025em; }
.pagehead h1 { font-size: 34px; font-weight: 700; }
.dhero h1 { font-size: 28px; font-weight: 700; }
.panel h2, .modal h3 { letter-spacing: -0.02em; }
:focus-visible { outline: none; box-shadow: 0 0 0 4px rgba(23,155,64,.32); }

/* поверхности: без рамок, с мягкой тенью */
.panel, .stats, .dpick, .modal { border: 0; box-shadow: var(--shadow); }
.panel, .stats { border-radius: 20px; }
.stat { border-left-color: var(--hair); }
.stat .v { font-weight: 700; letter-spacing: -0.03em; }
.panel-head, .dhead { border-bottom-color: var(--hair); }

/* кнопки-«пилюли» */
.btn { border: 0; border-radius: 999px; background: var(--fill); min-height: 40px; padding: 0 18px; font-weight: 600; transition: background .15s, transform .1s; }
.btn:hover { background: rgba(118,118,128,.2); }
.btn:active { transform: scale(.97); }
.btn.primary { background: var(--pitch); color: #fff; }
.btn.primary:hover { background: var(--pitch-d); }
.btn.danger { background: var(--danger-l); color: var(--danger); }
.btn.danger:hover { background: #f7d9cd; }
.btn.danger-solid { background: var(--danger); }
.btn.sm { min-height: 32px; padding: 0 14px; }
.iconbtn { border: 0; border-radius: 50%; background: var(--fill); width: 36px; height: 36px; }
.iconbtn:hover { background: rgba(118,118,128,.2); }

/* поля ввода: заливка вместо рамки */
input, textarea { border: 1px solid transparent; background: var(--fill-2); border-radius: 12px; transition: background .15s, box-shadow .15s; }
input:focus, textarea:focus { outline: none; background: #fff; border-color: var(--pitch-m); box-shadow: 0 0 0 4px rgba(23,155,64,.18); }

/* полупрозрачные панели навигации */
.side { background: rgba(255,255,255,.72); -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px); border-right: 1px solid var(--hair); }
.nav-item { border-radius: 10px; color: var(--ink); font-weight: 500; }
.nav-item .ic { color: var(--pitch); }
.nav-item:hover { background: var(--fill-2); }
.nav-item.active { background: var(--fill); color: var(--ink); font-weight: 600; box-shadow: none; }
.dtop, .mobilebar { background: rgba(255,255,255,.75); -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px); border-bottom: 1px solid var(--hair); }

/* статусы и полосы */
.pill { height: 24px; font-weight: 600; }
.seg { gap: 4px; }
.seg i { height: 8px; border-radius: 99px; background: var(--fill); }
.seg.big i { height: 10px; }
.meter { height: 6px; background: var(--fill); }

/* значки отделов — как иконки приложений */
.dtile { border-radius: 10px; background: var(--pitch); color: #fff; }
.dtile.lg { border-radius: 15px; }
.dtile.bad { background: var(--danger); color: #fff; }

/* круглые отметки, как в «Напоминаниях» */
.chk { border-radius: 50%; border: 2px solid #c7c7cc; }
.dpage .chk { width: 30px; height: 30px; border-radius: 50%; }
.item.done .chk { background: var(--pitch); border-color: var(--pitch); }
button.chk:hover:not(:disabled) { border-color: var(--pitch); background: var(--pitch-l); }
.item { border-bottom-color: var(--hair); }
.dpage .items .item { margin-left: 0; }
.item.done .txt { color: var(--faint); }

/* экран входа: список отделов, как в «Настройках» iPhone */
.login { background: var(--paper); }
.brandpanel { border-right: 0; box-shadow: 1px 0 0 var(--hair); }
.dgrid { gap: 12px; }
.dpick { border-radius: 16px; min-height: 64px; font-weight: 600; transition: transform .12s, box-shadow .12s; }
.dpick:hover { border-color: transparent; transform: translateY(-1px); box-shadow: 0 2px 4px rgba(0,0,0,.05), 0 10px 28px rgba(0,0,0,.08); }

/* таблица отделов */
.drow { border-bottom-color: var(--hair); }
.drow:hover { background: rgba(0,0,0,.025); }
.drow.sel { background: var(--pitch-l); }
.fi { border-bottom-color: var(--hair); }

/* окна и шторка */
.overlay { background: rgba(0,0,0,.28); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.modal { border-radius: 22px; padding: 26px; }
.scrim { background: rgba(0,0,0,.2); -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px); }
.drawer { border-radius: 22px 0 0 22px; box-shadow: -10px 0 40px rgba(0,0,0,.12); }
.drawer-head { border-bottom-color: var(--hair); }

/* уведомления, как на iPhone */
.toast { background: rgba(255,255,255,.86); color: var(--ink); -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px);
  border: 0; border-radius: 18px; box-shadow: 0 8px 30px rgba(0,0,0,.14); padding: 12px 16px; }
.toast .meta { color: var(--muted); opacity: 1; }
.toast.t-issue { background: rgba(255,255,255,.92); }
.toast.t-issue b, .toast.t-err b { color: var(--danger); }

/* настройки: группы-списки */
details.acc summary { padding: 14px 18px; }
details.acc { border-bottom-color: var(--hair); }
.issue { border-radius: 12px; }
.notice, .success { border-radius: 14px; }
.fb { border-radius: 12px; background: var(--fill-2); }

@media (max-width: 899px) {
  .side { background: rgba(255,255,255,.8); border-top: 1px solid var(--hair); border-right: 0; }
  .nav-item, .nav-item.active { background: none; color: var(--faint); }
  .nav-item.active { color: var(--pitch); }
  .nav-item .ic { color: inherit; }
  .pagehead h1 { font-size: 28px; }
  .drawer { border-radius: 0; }
}

/* цвет полосы готовности: красный → жёлтый (с половины) → зелёный */
.seg.stage-low i:not(.on) { background: #e5484d; }
.seg.stage-mid i:not(.on) { background: var(--gold); }
.seg i.on, .seg.full i.on { background: var(--pitch-m); }
.seg.full i.on { background: var(--pitch); }
.seg i.bad:not(.on) { background: repeating-linear-gradient(-45deg, #b42318 0 3px, #f3a5a0 3px 6px); }
.meter.stage-low > i { background: #e5484d; }
.meter.stage-mid > i { background: var(--gold); }
.meter.full > i { background: var(--pitch); }

/* комментарий отдела к пункту */
.cmt { display: flex; gap: 8px; align-items: flex-start; margin-top: 6px; padding: 8px 10px; border-radius: 12px;
  background: var(--fill-2); color: var(--ink); font-size: 13.5px; line-height: 1.4; text-decoration: none; }
.cmt .ic { margin-top: 1px; color: var(--pitch); flex: none; }
.cmt small { display: block; color: var(--faint); font-size: 12px; margin-top: 2px; }
.item.done .cmt { color: var(--muted); }
.item-side { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; flex: none; }
.item-btns { display: flex; gap: 6px; }
.item-btns:empty { display: none; }
.cmtbtn { width: 36px; padding: 0; }
.cmtbtn.on { color: var(--pitch); background: var(--pitch-l); }

/* главная: выбор отдела по центру и крупнее (~30%) */
@media (min-width: 900px) {
  .chooser { position: relative; min-height: 100vh; max-width: 980px; justify-content: center; padding: 96px 48px; }
  .chooser-top { position: absolute; top: 40px; right: 48px; margin: 0; }
  .chooser h2 { font-size: 32px; text-align: center; }
  .chooser .sub { font-size: 18px; text-align: center; margin: 8px 0 30px; }
}
.dgrid { gap: 16px; }
.dpick { min-height: 84px; padding: 18px 22px; gap: 18px; font-size: 19px; border-radius: 20px; }
.dpick .dtile { width: 52px; height: 52px; border-radius: 14px; }
.dpick .dtile svg { width: 28px; height: 28px; }
.dpick .chev svg { width: 22px; height: 22px; }
@media (min-width: 900px) { .dgrid { grid-auto-rows: 1fr; } }
@media (min-width: 900px) {
  .chooser { padding: 88px 48px 48px; }
  .chooser .sub { margin-bottom: 24px; }
  .dpick { min-height: 0; padding: 14px 20px; font-size: 18px; line-height: 1.3; }
}
/* вход координатора — под списком отделов, по центру */
.coord-login { display: flex; justify-content: center; margin-top: 28px; }
.coord-login .btn { min-height: 48px; padding: 0 26px; font-size: 16px; }
.chooser h2 { margin-bottom: 24px; }
@media (min-width: 900px) { .chooser { padding: 48px; } }
/* вход координатора — карточка в стиле отделов, ключ перевёрнут */
.coord-login { display: flex; justify-content: center; margin-top: 16px; }
.coord-login .dpick.coord { width: calc(50% - 8px); }
.key-flip { display: inline-flex; transform: scaleY(-1); }
@media (max-width: 899px) { .coord-login .dpick.coord { width: 100%; } }
.dgrid .dpick.coord { grid-column: 1 / -1; justify-self: center; width: calc(50% - 8px); }
@media (max-width: 899px) { .dgrid .dpick.coord { width: 100%; } }
/* главная: левая часть — футбольное поле */
.brandpanel.field { padding: 0; background: #1c8738; box-shadow: none; border: 0; position: relative; overflow: hidden; }
.field-svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.logo-badge { position: absolute; top: 28px; left: 28px; background: rgba(255,255,255,.94); border-radius: 18px; padding: 14px 18px;
  box-shadow: 0 8px 24px rgba(0,0,0,.18); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
.logo-badge img { display: block; width: 170px; height: auto; }
@media (max-width: 899px) {
  .brandpanel.field { min-height: 220px; }
  .logo-badge { top: 16px; left: 16px; padding: 10px 14px; border-radius: 14px; }
  .logo-badge img { width: 130px; }
}
.brandpanel.field > .field-svg { position: absolute; inset: 0; }
.brandpanel.field > .logo-badge { position: absolute; z-index: 1; }
/* главная: только список отделов, по центру всей страницы */
.login { display: flex; align-items: center; justify-content: center; }
.login .chooser { margin: 0 auto; }
/* режимы чек-листов */
select { font: inherit; width: 100%; min-height: 44px; padding: 0 12px; border: 1px solid transparent; background: var(--fill-2); border-radius: 12px; color: var(--ink); }
select:focus { outline: none; background: #fff; border-color: var(--pitch-m); box-shadow: 0 0 0 4px rgba(23,155,64,.18); }
.modes { margin-bottom: 16px; }
.modes-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.modes-head p { margin-top: 4px; }
.modetabs { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.modetab { display: inline-flex; flex-direction: column; align-items: flex-start; gap: 2px; border: 0; cursor: pointer; font: inherit; font-weight: 600;
  padding: 10px 16px; border-radius: 14px; background: var(--fill-2); color: var(--ink); transition: background .15s; }
.modetab span { font-size: 12px; font-weight: 500; color: var(--faint); }
.modetab:hover { background: var(--fill); }
.modetab.on { background: var(--pitch); color: #fff; }
.modetab.on span { color: rgba(255,255,255,.8); }
.modes-actions { margin-top: 12px; gap: 8px; }
.filebtn { cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
@media (max-width: 899px) { .modes-head { flex-direction: column; } }
/* Telegram */
.tg-panel { margin-top: 16px; }
.tg-panel h2 { display: flex; align-items: center; gap: 8px; }
.tg-panel h2 .ic { color: var(--pitch); }
.tg-steps { margin: 14px 0 6px 20px; padding: 0; line-height: 1.55; color: var(--ink); }
.tg-steps li { margin-bottom: 4px; }
.tg-steps code { background: var(--fill-2); padding: 1px 6px; border-radius: 6px; font-size: 13px; }
.tg-status { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 14px; }
.tgkinds { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 16px; margin-top: 8px; }
.tgk { display: flex; align-items: center; gap: 10px; font-weight: 500; cursor: pointer; margin: 0; }
.tgk input { width: 20px; height: 20px; accent-color: var(--pitch); flex: none; }
@media (max-width: 899px) { .tgkinds { grid-template-columns: 1fr; } }
/* телефон: название отдела во всю ширину, статус — под ним справа */
@media (max-width: 899px) {
  .drow { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "name name" "prog pill"; }
  .drow .pill { align-self: center; }
}
/* полоса готовности — одна сплошная, заполняется по мере выполнения */
.pbar { position: relative; width: 100%; height: 10px; border-radius: 99px; background: var(--fill); overflow: hidden; }
.pbar.big { height: 14px; }
.pbar > i { display: block; height: 100%; border-radius: 99px; transition: width .5s cubic-bezier(.2,.8,.2,1), background-color .3s; }
.pbar.stage-low > i { background: #e5484d; }
.pbar.stage-mid > i { background: var(--gold); }
.pbar.full > i { background: var(--pitch); }
/* отделы-участники мероприятия */
.dpick-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 10px; margin-top: 14px; }
.dpick-head label { margin: 0; }
.deptchecks { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-top: 8px; max-height: 300px; overflow: auto; }
.deptcheck { display: flex; align-items: center; gap: 10px; margin: 0; padding: 8px 10px; border-radius: 12px; background: var(--fill-2); cursor: pointer; font-weight: 500; font-size: 14px; line-height: 1.25; }
.deptcheck input { width: 18px; height: 18px; accent-color: var(--pitch); flex: none; }
.deptcheck .dtile { width: 28px; height: 28px; border-radius: 8px; flex: none; }
.deptcheck .dtile svg { width: 16px; height: 16px; }
.deptcheck:has(input:not(:checked)) { opacity: .6; }
.drow.off { opacity: .5; }
@media (max-width: 560px) { .deptchecks { grid-template-columns: 1fr; } }
/* отдел: выбор мероприятия */
.evswitch { display: flex; align-items: center; gap: 10px; margin: 4px 0 14px; }
.evswitch label { display: inline-flex; align-items: center; gap: 6px; margin: 0; white-space: nowrap; color: var(--muted); font-weight: 600; }
.evswitch label .ic { color: var(--pitch); }
.evswitch select { flex: 1; min-width: 0; background: #fff; box-shadow: var(--shadow); font-weight: 600; }
.notice .btn { margin-left: auto; flex: none; }
.empty-state .btn { margin-top: 14px; }
@media (max-width: 560px) { .evswitch { flex-direction: column; align-items: stretch; gap: 6px; } .notice { flex-wrap: wrap; } .notice .btn { margin-left: 0; } }
/* сроки пунктов */
.due { display: inline-flex; align-items: center; gap: 4px; margin-left: 8px; padding: 1px 8px; border-radius: 99px; font-size: 12px; font-weight: 600; background: var(--fill-2); color: var(--muted); vertical-align: 1px; white-space: nowrap; }
.due .ic { width: 12px; height: 12px; }
.due.late { background: #fde7e4; color: #b42318; }
.due.late-done { background: #fff4d6; color: #8a5a00; }
.due.ok { background: var(--pitch-l); color: var(--pitch-d); }
.item.done .due { opacity: .9; }
/* календарь мероприятий */
.seg-toggle { display: inline-flex; background: var(--fill); border-radius: 999px; padding: 3px; gap: 2px; }
.seg-toggle button { border: 0; background: none; font: inherit; font-weight: 600; font-size: 14px; padding: 7px 14px; border-radius: 999px; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; color: var(--ink); }
.seg-toggle button.on { background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.12); }
.cal-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.cal-head h2 { min-width: 170px; text-align: center; }
.cal-head .flip { display: inline-flex; transform: scaleX(-1); }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.cal-w { font-size: 12px; font-weight: 600; color: var(--faint); text-align: center; padding-bottom: 4px; }
.cal-cell { min-height: 96px; border-radius: 12px; background: var(--fill-2); padding: 6px; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.cal-cell.empty { background: none; }
.cal-cell.today { box-shadow: inset 0 0 0 2px var(--pitch); }
.cal-d { font-size: 13px; font-weight: 700; color: var(--muted); }
.cal-cell.today .cal-d { color: var(--pitch); }
.cal-ev { display: block; width: 100%; text-align: left; border: 0; cursor: pointer; font: inherit; font-size: 12px; line-height: 1.3; padding: 4px 6px; border-radius: 8px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-ev.st-active { background: var(--pitch); color: #fff; }
.cal-ev.st-feedback { background: #ffe8a3; color: #6b4b00; }
.cal-ev.st-closed { background: #e4e6ea; color: #5b5f69; }
.cal-legend { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; }
.cal-legend .cal-ev { width: auto; cursor: default; }
@media (max-width: 899px) {
  .cal-cell { min-height: 64px; padding: 4px; }
  .cal-ev { font-size: 10px; padding: 2px 4px; }
  .cal-ev b { display: none; }
  .cal-head h2 { min-width: 0; flex: 1; font-size: 18px; }
}
/* фото к сообщению */
.photo-pick { display: flex; align-items: center; gap: 12px; margin-top: 10px; flex-wrap: wrap; }
.photo-prev { position: relative; display: inline-flex; }
.photo-prev img { width: 88px; height: 88px; object-fit: cover; border-radius: 12px; box-shadow: var(--shadow); }
.photo-prev .iconbtn { position: absolute; top: -8px; right: -8px; width: 26px; height: 26px; background: #fff; box-shadow: 0 1px 4px rgba(0,0,0,.25); }
.issue-photo { display: block; margin-top: 6px; }
.issue-photo img { display: block; max-width: 220px; max-height: 160px; border-radius: 10px; object-fit: cover; }
/* загрузка файла на все отделы */
.bulk-list { margin-top: 12px; display: flex; flex-direction: column; gap: 6px; max-height: 50vh; overflow: auto; }
.bulk-row { display: flex; align-items: center; gap: 12px; padding: 8px 10px; border-radius: 12px; background: var(--fill-2); }
.bulk-row .grow { min-width: 0; }
.bulk-row .muted { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* статистика */
.stats-table { margin-top: 16px; }
.tscroll { overflow-x: auto; margin-top: 10px; }
.stats-table table { width: 100%; border-collapse: collapse; font-size: 14px; }
.stats-table th { text-align: left; font-size: 12px; font-weight: 600; color: var(--faint); padding: 8px 10px; border-bottom: 1px solid var(--hair); white-space: nowrap; }
.stats-table td { padding: 10px; border-bottom: 1px solid var(--hair); vertical-align: middle; }
.stats-table tr:last-child td { border-bottom: 0; }
.stats-table td.num { text-align: center; font-variant-numeric: tabular-nums; }
.stats-table .dname { display: flex; align-items: center; gap: 10px; font-weight: 600; min-width: 180px; }
.sbar { display: flex; align-items: center; gap: 8px; min-width: 130px; }
.sbar .pbar { flex: 1; }
.sbar b { font-size: 13px; min-width: 38px; text-align: right; font-variant-numeric: tabular-nums; }
.bulk-row .grow { flex: 1; }
.issue-photo img { max-width: 160px; max-height: 120px; }
.drow .pill { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
