:root {
    --accent: #ef6c00; --accent-dark: #c25400; --ink: #1d1d1f; --muted: #6e6e73; --line: #e6e1dc; --bg: #fffaf5; --card: #fff;
    --school: #ffe0c2; --rental: #e8eef7; --free: #fff; --hold: #fff1b3; --busy: #ece9e6; --mine: #c9ecd0;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: var(--ink); background: var(--bg); }
a { color: var(--accent-dark); }
.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 10px 16px; background: #1d1d1f; }
.logo { color: #fff; text-decoration: none; display: flex; align-items: baseline; gap: 8px; }
.logo b { font-size: 24px; letter-spacing: 2px; color: var(--accent); }
.logo span { font-size: 13px; color: #bbb; }
.top nav { display: flex; gap: 4px; flex-wrap: wrap; }
.top nav a { color: #eee; text-decoration: none; padding: 6px 12px; border-radius: 18px; font-size: 15px; }
.top nav a.on, .top nav a:hover { background: var(--accent); color: #fff; }
main { max-width: 1180px; margin: 0 auto; padding: 16px; }
footer { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; padding: 20px 16px; background: #1d1d1f; color: #ccc; font-size: 14px; }
footer a { color: #fff; font-size: 18px; text-decoration: none; }
footer a.chat { display: inline-block; margin: 8px 8px 0 0; font-size: 14px; padding: 4px 12px; border: 1px solid #666; border-radius: 16px; }
h1 { font-size: 30px; line-height: 1.2; margin: 8px 0 8px; }
h2 { font-size: 21px; margin: 24px 0 8px; }
h3 { font-size: 17px; margin: 18px 0 6px; }
.muted { color: var(--muted); } .small { font-size: 13px; }
.hero p { margin: 4px 0 12px; color: var(--muted); }
.btn { display: inline-block; padding: 10px 18px; border-radius: 22px; border: 2px solid var(--accent); background: #fff; color: var(--accent-dark);
       font: inherit; font-weight: 600; text-decoration: none; cursor: pointer; }
.btn.primary { background: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-dark); border-color: var(--accent-dark); }
.btn.vk { background: #0077ff; border-color: #0077ff; color: #fff; }
button.link { background: none; border: 0; padding: 0; color: var(--accent-dark); text-decoration: underline; cursor: pointer; font: inherit; }
.flash { padding: 10px 14px; border-radius: 10px; background: #e2f4e5; margin: 0 0 12px; }
.flash.err { background: #fde3e0; }
.narrow { max-width: 620px; }

/* расписание */
.weeknav { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin: 16px 0 8px; }
.weeknav .dl { margin-left: auto; font-size: 14px; }
table.week { width: 100%; border-collapse: collapse; table-layout: fixed; background: var(--card); }
table.week th { background: #1d1d1f; color: #fff; padding: 6px 4px; font-size: 14px; font-weight: 600; }
table.week th.today { background: var(--accent); }
table.week td { border: 1px solid var(--line); vertical-align: top; padding: 4px; height: 80px; }
.cls { border-radius: 8px; padding: 6px 8px; margin-bottom: 4px; font-size: 13px; line-height: 1.3; background: var(--rental); }
.cls.k-school { background: var(--school); }
.cls time { display: block; font-weight: 700; color: var(--accent-dark); }
.cls b { display: block; }
.cls span { display: block; color: var(--muted); }
.by-day { display: none; }
.by-day h3.today { color: var(--accent-dark); }
@media (max-width: 760px) {
    .by-hall { display: none; } .by-day { display: block; }
    .by-day .cls { font-size: 15px; }
    h1 { font-size: 25px; }
}
.dirs ul { padding-left: 20px; }

/* аренда */
.prices { display: flex; gap: 24px; flex-wrap: wrap; margin: 8px 0 16px; }
.prices ul { margin: 4px 0; padding-left: 18px; }
nav.days { display: flex; gap: 6px; overflow-x: auto; padding: 4px 0 10px; }
nav.days a { flex: 0 0 auto; text-align: center; padding: 6px 10px; border-radius: 10px; background: var(--card); border: 1px solid var(--line);
             text-decoration: none; color: var(--ink); font-size: 14px; }
nav.days a small { display: block; color: var(--muted); }
nav.days a.we small { color: var(--accent-dark); }
nav.days a.on { background: var(--accent); border-color: var(--accent); color: #fff; }
nav.days a.on small { color: #fff; }
.legend span { display: inline-block; padding: 2px 8px; margin-right: 6px; border-radius: 6px; border: 1px solid var(--line); font-size: 13px; }
.legend .free { background: var(--free); } .legend .hold { background: var(--hold); } .legend .busy { background: var(--busy); } .legend .mine { background: var(--mine); }
table.rent { border-collapse: collapse; width: 100%; max-width: 760px; background: var(--card); font-size: 14px; }
table.rent th { padding: 2px 8px; color: var(--muted); font-weight: normal; text-align: right; vertical-align: top; width: 64px; }
table.rent thead th { text-align: center; color: var(--ink); font-weight: 600; padding: 6px; width: auto; }
table.rent td { border: 1px solid var(--line); height: 26px; padding: 2px 6px; text-align: center; }
table.rent td.free { cursor: pointer; background: var(--free); }
table.rent td.free:hover { background: #fff0e0; }
table.rent td.sel { background: var(--accent) !important; }
table.rent td.past { background: #f6f4f2; }
table.rent td.busy { background: var(--busy); color: var(--muted); }
table.rent td.hold { background: var(--hold); }
table.rent td.mine { background: var(--mine); }
table.rent td form { display: inline; }
.pick { position: sticky; bottom: 0; display: flex; gap: 10px; align-items: end; flex-wrap: wrap; margin: 12px 0; padding: 12px;
        background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 -2px 10px rgba(0,0,0,.06); max-width: 760px; }
.pick label { display: flex; flex-direction: column; font-size: 13px; color: var(--muted); }
.pick select { font: inherit; padding: 6px; border-radius: 8px; border: 1px solid var(--line); }
.pick output { font-weight: 700; font-size: 18px; min-width: 90px; }

/* формы */
.form { margin: 12px 0; }
.form .f { display: block; margin-bottom: 12px; }
.form .f > span { display: block; font-size: 14px; color: var(--muted); margin-bottom: 2px; }
.form .f input, .form .f textarea { width: 100%; padding: 10px 12px; font: inherit; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.form .f.bad input { border-color: #d33; }
.form em, fieldset em { display: block; color: #c62828; font-style: normal; font-size: 14px; }
.form fieldset { border: 1px solid var(--line); border-radius: 10px; margin: 0 0 12px; padding: 8px 12px; }
.form fieldset.bad { border-color: #d33; }
.form label.radio { display: block; padding: 6px 0; font-size: 17px; }
.form .hp { position: absolute; left: -9999px; }
table.kv th { text-align: left; color: var(--muted); font-weight: normal; padding: 4px 16px 4px 0; vertical-align: top; }

/* кабинет */
.booking { background: var(--card); border: 1px solid var(--line); border-left: 5px solid #bbb; border-radius: 10px; padding: 10px 14px; margin-bottom: 10px; }
.booking.st-hold { border-left-color: #e6b800; } .booking.st-paid { border-left-color: #2e9e4a; } .booking.st-confirmed { border-left-color: #7cc48a; }
.booking.st-cancelled, .booking.st-expired { opacity: .6; }
.booking .code { margin-top: 6px; font-size: 18px; }
.booking .code b { font-size: 26px; letter-spacing: 3px; color: var(--accent-dark); }

/* Карточка занятия-ссылка и страница группы */
a.cls { display: block; color: inherit; text-decoration: none; }
a.cls:hover b { text-decoration: underline; }
.dirs li { margin: 0 0 14px; }
.group .when { padding-left: 20px; }
.group .about { margin: 16px 0; max-width: 720px; }
.group .video { position: relative; max-width: 720px; aspect-ratio: 16 / 9; margin: 16px 0; }
.group .video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; border-radius: 10px; }
/* афиши вертикальные — без обрезки, по порядку загрузки */
.group .gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; margin: 16px 0; align-items: start; max-width: 760px; }
.group .gallery img { width: 100%; height: auto; border-radius: 8px; display: block; }

/* Мероприятия: карточки на странице расписания, ячейка в сетке, страница event.php */
.cls.k-event { background: #f6d9f2; }
.cls em, .ecard em, .event .etype { display: block; font-style: normal; font-size: 12px; text-transform: uppercase; letter-spacing: .5px; color: #9c2a8c; }
.events .ecards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; margin-bottom: 16px; }
.ecard { display: flex; gap: 12px; align-items: center; background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 8px; color: inherit; text-decoration: none; }
.ecard:hover b { text-decoration: underline; }
.ecard img { width: 72px; height: 96px; object-fit: cover; border-radius: 6px; flex: none; }
.ecard b { display: block; }
.event .etype { font-size: 14px; margin-top: 8px; }
.event .ewhen { font-size: 20px; font-weight: 600; }
.event .ebody { display: flex; gap: 24px; align-items: flex-start; flex-wrap: wrap; }
.event .einfo { flex: 1 1 340px; max-width: 640px; }
.event .program { list-style: none; padding: 0; }
.event .program li { padding: 4px 0; border-bottom: 1px solid var(--line); }
.event .program time { display: inline-block; min-width: 56px; font-weight: 700; color: var(--accent-dark); }
.event .poster { flex: 0 1 420px; }
.event .poster img { width: 100%; height: auto; border-radius: 10px; display: block; }
