:root {
  --bg: #F4F5F8; --card: #FFFFFF; --text: #1C1D21; --muted: #6B7080; --muted2: #4A4F5C; --line: #E6E8EE;
  --accent: #2D6BFF; --accent-dark: #1F55D6; --accent-soft: #EEF3FF; --red: #D93A3F; --red-dark: #B42318;
  --orange: #E08A2E; --orange-dark: #A14B05; --orange-soft: #FFF3E6;
  --c-training: #2D6BFF; --c-excursion: #2E9D4F; --c-presentation: #8B5CF6;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text);
  font-family: Inter, -apple-system, "Segoe UI", Roboto, system-ui, sans-serif; -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent); }
.app { max-width: 560px; margin: 0 auto; min-height: 100vh; display: flex; flex-direction: column; }
.loading, .empty-state { padding: 48px 24px; text-align: center; color: var(--muted); line-height: 1.5; }

.top { background: var(--card); padding: 10px 16px 8px; display: flex; align-items: center; justify-content: space-between;
  gap: 8px; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.top h1 { margin: 0; font-size: 17px; font-weight: 600; text-align: center; flex: 1; }
.top .side { min-width: 72px; display: flex; }
.top .side.right { justify-content: flex-end; }
.link-btn { border: none; background: none; color: var(--accent); font-size: 16px; padding: 10px 4px; }
.icon-btn { width: 44px; height: 44px; border: none; background: none; display: flex; align-items: center; justify-content: center; }
.menu { position: absolute; right: 12px; top: 54px; width: 250px; background: var(--card); border-radius: 14px;
  box-shadow: 0 8px 28px rgba(20,24,40,.18); padding: 6px; display: flex; flex-direction: column; z-index: 10; }
.menu button { height: 44px; border: none; background: none; text-align: left; padding: 0 12px; border-radius: 10px; font-size: 15px; }
.menu button:hover { background: var(--bg); }

.cal { background: var(--card); padding: 6px 16px 10px; border-radius: 0 0 24px 24px; border-bottom: 1px solid var(--line); }
.cal-head { display: flex; align-items: center; justify-content: space-between; padding: 4px 0 8px; }
.cal-head strong { font-size: 18px; }
.nav-btn { width: 44px; height: 36px; border: none; background: #F1F3F7; border-radius: 12px; display: flex; align-items: center; justify-content: center; }
.nav-btn:disabled { opacity: .35; cursor: default; }
.grid7 { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); justify-items: center; }
.dows { font-size: 12px; color: var(--muted); padding: 2px 0 4px; }
.dows .we, .day.we { color: var(--red); }
.day { width: 44px; height: 44px; border-radius: 22px; border: none; background: transparent; padding: 0; display: flex;
  flex-direction: column; align-items: center; justify-content: center; gap: 3px; font-size: 16px; color: var(--text); }
.day.out { color: #B3B8C4; }
.day.today { color: var(--accent); box-shadow: inset 0 0 0 1.5px var(--accent); font-weight: 600; }
.day.sel { background: var(--accent); color: #fff; font-weight: 600; box-shadow: none; }
.dots { display: flex; gap: 2px; height: 5px; }
.dot { width: 5px; height: 5px; border-radius: 3px; }
.day.sel .dot { background: #fff !important; }
.legend { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; font-size: 11px; color: var(--muted2); padding-top: 6px; }
.legend span { display: flex; align-items: center; gap: 5px; }
.legend i { width: 6px; height: 6px; border-radius: 3px; display: inline-block; }

.chips { display: flex; gap: 8px; padding: 12px 16px 2px; overflow-x: auto; scrollbar-width: none; }
.chip { flex-shrink: 0; height: 36px; padding: 0 13px; border-radius: 18px; font-size: 14px; border: 1px solid #DADDE4; background: var(--card); }
.chip.on { background: var(--text); border-color: var(--text); color: #fff; }

.list { flex: 1; padding: 10px 16px 96px; display: flex; flex-direction: column; gap: 10px; }
.list-head { display: flex; align-items: baseline; justify-content: space-between; }
.list-head strong { font-size: 17px; }
.list-head span { font-size: 13px; color: var(--muted); }

.card { background: var(--card); border-radius: 18px; padding: 14px; box-shadow: 0 1px 2px rgba(20,24,40,.05); }
.ev { display: flex; gap: 12px; }
.ev .time { width: 50px; flex-shrink: 0; }
.ev .time b { display: block; font-size: 16px; }
.ev .time span { font-size: 12px; color: var(--muted); }
.ev .body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.ev .title { font-size: 15px; font-weight: 600; line-height: 1.3; }
.ev .title.x, h2.x { text-decoration: line-through; color: var(--muted); }
.sub { font-size: 13px; color: var(--muted2); line-height: 1.4; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.note { font-size: 12px; color: var(--muted); line-height: 1.35; }
.note.warn { color: var(--orange-dark); }
.note.bad { color: var(--red-dark); }
.more { align-self: flex-start; border: none; background: none; padding: 4px 0; font-size: 13px; font-weight: 500; color: var(--accent); }

.tags { display: flex; gap: 6px; flex-wrap: wrap; }
.tag { font-size: 12px; font-weight: 500; border-radius: 8px; padding: 3px 8px; background: #F1F3F7; color: var(--muted2); }
.tag.training { background: #E8F0FF; color: #1F55D6; }
.tag.excursion { background: #E9F7EE; color: #1F7A3D; }
.tag.presentation { background: #F1EBFF; color: #6D3FD1; }
.tag.reg { background: var(--orange-soft); color: var(--orange-dark); }
.tag.aud { background: var(--text); color: #fff; }
.tag.moved { background: #FFE4C2; color: #7A3A05; }
.tag.cancel { background: #FDECEC; color: var(--red-dark); }
.tag.draft { background: #FFF8DB; color: #7A5A00; }

.btn { flex-shrink: 0; height: 36px; padding: 0 12px; border-radius: 12px; font-size: 14px; font-weight: 600; border: none;
  background: var(--accent); color: #fff; }
.btn.ghost { background: var(--card); color: var(--muted2); border: 1px solid #DADDE4; }
.btn.soft { background: var(--accent-soft); color: var(--accent-dark); border: 1px solid #BFD3FF; }
.btn.outline { background: var(--card); color: var(--accent); border: 1px solid #BFD3FF; }
.btn.queue { background: var(--orange-soft); color: var(--orange-dark); border: 1px solid #F5C99B; }
.btn.danger { background: var(--card); color: var(--red-dark); border: 1px solid #F3B8B3; }
.btn.big { width: 100%; height: 50px; border-radius: 14px; font-size: 16px; }
.btn:disabled { opacity: .5; }

.bottom { position: fixed; left: 0; right: 0; bottom: 0; background: var(--card); border-top: 1px solid var(--line);
  padding: 12px 16px calc(14px + env(safe-area-inset-bottom)); z-index: 4; }
.bottom .inner { max-width: 528px; margin: 0 auto; display: flex; flex-direction: column; gap: 6px; }
.bottom .note { text-align: center; }

.banner { background: var(--orange-soft); border: 1px solid #F5C99B; border-radius: 18px; padding: 12px 14px; display: flex; align-items: center; gap: 12px; }
.banner b { display: block; font-size: 15px; color: #7A3A05; }
.banner span { font-size: 13px; color: #7A3A05; }
.banner .btn { background: #C96F12; height: 40px; }
.info { border-radius: 14px; padding: 10px 14px; font-size: 14px; line-height: 1.45; }
.info.warn { background: var(--orange-soft); color: #7A3A05; }
.info.bad { background: #FDECEC; color: #8F1D14; }
.info.ok { background: #E9F7EE; color: #1F5C34; }

.detail { padding: 12px 16px 120px; display: flex; flex-direction: column; gap: 12px; }
.detail h2 { margin: 0; font-size: 21px; line-height: 1.25; }
.photo { width: 100%; max-height: 240px; object-fit: cover; border-radius: 18px; display: block; }
.sec { background: var(--card); border-radius: 18px; padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.sec h3 { margin: 0; font-size: 14px; font-weight: 600; }
.two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.two .btn, .tile { height: 44px; border-radius: 12px; }
.tile { border: 1px solid #DADDE4; background: var(--card); font-size: 14px; font-weight: 600; display: flex; align-items: center; justify-content: center; text-decoration: none; color: var(--text); }
.tile.blue { border: none; background: var(--accent-soft); color: var(--accent-dark); }
.person { display: flex; align-items: center; gap: 10px; padding: 6px 0; border-bottom: 1px solid #F1F3F7; font-size: 14px; }
.person:last-child { border-bottom: none; }
.av { width: 32px; height: 32px; border-radius: 16px; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 600; flex-shrink: 0; background: #E8F0FF; color: #1F55D6; }
.person .me { margin-left: auto; font-size: 12px; color: var(--accent); }
.bar { height: 6px; border-radius: 3px; background: #EEF0F4; overflow: hidden; }
.bar i { display: block; height: 100%; border-radius: 3px; background: var(--c-excursion); }

.mine-item { display: flex; gap: 12px; align-items: center; }
.mine-item .d { width: 44px; text-align: center; flex-shrink: 0; }
.mine-item .d small { display: block; font-size: 12px; color: var(--muted); }
.mine-item .d b { font-size: 20px; }
.mine-item .t { flex: 1; min-width: 0; border: none; background: none; padding: 0; text-align: left; display: flex; flex-direction: column; gap: 4px; }
.h-sec { font-size: 15px; font-weight: 700; padding-top: 6px; }

/* формы администратора */
.form { padding: 14px 16px 140px; display: flex; flex-direction: column; gap: 14px; }
.lbl { font-size: 13px; color: var(--muted); }
.field { background: var(--card); border-radius: 16px; padding: 4px 14px; display: flex; flex-direction: column; }
.field label { display: flex; flex-direction: column; gap: 2px; padding: 10px 0; border-bottom: 1px solid #F1F3F7; }
.field label:last-child { border-bottom: none; }
.field label span { font-size: 12px; color: var(--muted); }
.field input, .field textarea { border: none; padding: 0; font-size: 15px; background: transparent; outline: none; width: 100%; }
.field textarea { min-height: 60px; resize: vertical; }
.seg { display: grid; gap: 4px; background: #E6E9EF; border-radius: 12px; padding: 3px; }
.seg button { height: 36px; border: none; border-radius: 10px; font-size: 14px; background: transparent; color: var(--muted2); }
.seg button.on { background: var(--card); color: var(--text); font-weight: 600; box-shadow: 0 1px 2px rgba(20,24,40,.12); }
.switch { display: flex; align-items: center; justify-content: space-between; padding: 10px 0; font-size: 15px; border: none; background: none; width: 100%; text-align: left; }
.switch i { width: 46px; height: 28px; border-radius: 14px; padding: 2px; background: #C9CDD6; display: flex; flex-shrink: 0; }
.switch i::after { content: ""; width: 24px; height: 24px; border-radius: 12px; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.switch.on i { background: var(--accent); justify-content: flex-end; }
.rooms { display: flex; gap: 6px; flex-wrap: wrap; }
.rooms button { height: 34px; padding: 0 12px; border-radius: 17px; font-size: 13px; border: 1px solid #DADDE4; background: var(--card); }
.rooms button.on { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-dark); }
.upload { display: flex; gap: 8px; align-items: center; }
.upload img { width: 96px; height: 72px; object-fit: cover; border-radius: 10px; }
.upload label { width: 96px; height: 72px; border-radius: 10px; border: 1.5px dashed #BFD3FF; color: var(--accent); font-size: 13px; font-weight: 600; display: flex; align-items: center; justify-content: center; cursor: pointer; }
.adm-item { display: flex; gap: 12px; text-decoration: none; color: var(--text); border: none; width: 100%; text-align: left; }
.adm-item .d { width: 44px; text-align: center; flex-shrink: 0; }
.adm-item .d small { display: block; font-size: 12px; color: var(--muted); }
.adm-item .d b { font-size: 20px; }
.dashed { height: 48px; border-radius: 14px; border: 1.5px dashed #BFD3FF; color: var(--accent); font-size: 15px; font-weight: 600; background: none; }
.login { padding: 48px 24px; display: flex; flex-direction: column; align-items: center; gap: 16px; text-align: center; }
.login .lock { width: 64px; height: 64px; border-radius: 20px; background: var(--text); display: flex; align-items: center; justify-content: center; }
.login input { width: 100%; height: 48px; border-radius: 12px; padding: 0 14px; font-size: 16px; border: 1px solid #DADDE4; background: var(--card); }
.badge-admin { font-size: 11px; font-weight: 600; color: #fff; background: var(--text); border-radius: 6px; padding: 2px 7px; }

.toast { position: fixed; left: 50%; bottom: 110px; transform: translateX(-50%); background: var(--text); color: #fff;
  padding: 10px 16px; border-radius: 12px; font-size: 14px; opacity: 0; pointer-events: none; transition: opacity .2s; max-width: 90%; z-index: 20; }
.toast.show { opacity: 1; }
