:root {
  color-scheme: light;
  --ink: #20283a;
  --muted: #596378;
  --line: #e8ebf1;
  --paper: #fff;
  --canvas: #f5f7fb;
  --purple: #7658d6;
  --purple-light: #f1edff;
  --mint: #34a98c;
  --red: #df7181;
  font-family: "DM Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--canvas); color: var(--ink); }
a { color: inherit; text-decoration: none; }
:focus-visible { outline: 3px solid #6042b3; outline-offset: 3px; }
.topbar { min-height: 72px; padding: 10px 12px; display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; background: #fff; border-bottom: 1px solid #eceef3; }
.top-actions { display: flex; flex-wrap: wrap; align-items: center; }
.topbar form { margin: 0; }
.topbar form button { border: 0; cursor: pointer; background: transparent; }
.brand { display: flex; gap: 11px; align-items: center; font: 800 17px Manrope, sans-serif; letter-spacing: -.5px; }
.brand-mark { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 12px; color: #fff; background: linear-gradient(145deg, #9478ed, #6246c6); font-size: 19px; }
.brand small { display: block; margin-top: 1px; color: var(--muted); font: 500 10px "DM Sans", sans-serif; letter-spacing: .45px; text-transform: uppercase; }
.settings-link { display: inline-flex; align-items: center; padding: 10px 14px; border-radius: 10px; color: #727a8d; font-size: 13px; font-weight: 600; transition: .18s ease; }
.settings-link:hover, .settings-link.active { background: var(--purple-light); color: var(--purple); }
.shell { padding: 32px 12px 28px; }
.page-heading { display: flex; justify-content: space-between; align-items: flex-end; gap: 24px; margin-bottom: 28px; }
.eyebrow { margin: 0 0 7px; color: #655b81; font-size: 11px; font-weight: 700; letter-spacing: 1.65px; }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 0; font: 800 clamp(25px, 3vw, 34px)/1.2 Manrope, sans-serif; letter-spacing: -1.2px; }
.week-nav { display: flex; align-items: center; gap: 11px; }
.nav-arrow { width: 34px; height: 34px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 10px; background: #fff; color: #727a8d; font-size: 23px; line-height: 1; transition: .15s; }
.nav-arrow:hover { border-color: #c9bdf3; color: var(--purple); }
.week-caption { min-width: 182px; text-align: center; }
.week-caption strong { display: block; font-size: 13px; font-weight: 700; }
.week-caption span { display: block; margin-top: 3px; color: var(--muted); font-size: 11px; }
.today-link { margin-left: 3px; color: var(--purple); font-size: 12px; font-weight: 700; }
.progress-panel { display: grid; grid-template-columns: auto minmax(100px, 1fr) auto; align-items: center; gap: 19px; margin-bottom: 25px; padding: 14px 19px; background: #fff; border: 1px solid var(--line); border-radius: 13px; box-shadow: 0 3px 12px #25304c05; }
.progress-copy { display: flex; align-items: baseline; gap: 7px; white-space: nowrap; }
.progress-copy strong { color: var(--purple); font: 800 18px Manrope, sans-serif; }
.progress-copy strong span { color: #a5aabb; font: 500 11px "DM Sans", sans-serif; }
.progress-copy > span { color: var(--muted); font-size: 12px; }
.progress-track { height: 6px; overflow: hidden; border-radius: 8px; background: #eeedf4; }
.progress-track span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #9b83ec, #6e52cc); transition: width .3s ease; }
.progress-hint { color: var(--muted); font-size: 12px; text-align: right; }
.payments-panel { margin-bottom: 22px; padding: 16px 18px; border: 1px solid var(--line); border-radius: 14px; background: #fff; box-shadow: 0 3px 12px #25304c05; }
.payments-heading { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 18px; cursor: pointer; }
.payments-title { display: inline-flex; align-items: center; gap: 9px; font: 700 14px Manrope, sans-serif; }
.payments-title::before { content: "▸"; color: var(--purple); }
.payments-panel[open] .payments-title::before { content: "▾"; }
.payments-heading { list-style: none; }
.payments-heading::-webkit-details-marker { display: none; }
.payments-summary, .payments-description { color: var(--muted); font-size: 12px; line-height: 1.4; }
.payments-description { margin: 12px 0; }
.payment-dot { background: #7e9bc9; box-shadow: 0 0 0 4px #eff4fc; }
.payments-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 9px; }
.payment-card { min-width: 0; padding: 12px; border: 1px solid #e9edf4; border-radius: 11px; background: #fbfcfe; }
.payment-title { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.payment-title > strong { color: #434d61; font-size: 12px; overflow-wrap: anywhere; }
.payment-status { padding: 4px 6px; border-radius: 7px; background: #f3f4f7; color: var(--muted); font-size: 11px; font-weight: 600; overflow-wrap: anywhere; }
.payment-status.is-paid { background: #eaf7f1; color: #389377; }
.payment-status.is-unpaid { background: #fff0e3; color: #a85b1e; }
.payment-metrics { display: flex; justify-content: space-between; gap: 7px; margin-top: 12px; }
.payment-metrics > div { display: grid; gap: 3px; }
.payment-metrics > div:last-child { text-align: right; }
.payment-metrics span { color: var(--muted); font-size: 12px; }
.payment-metrics strong { color: #505b70; font: 700 13px Manrope, sans-serif; }
.payment-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px; margin-top: 11px; }
.payment-date-input { min-width: 0; max-width: 100%; min-height: 36px; padding: 5px 4px; border: 1px solid #e4e8ef; border-radius: 6px; background: #fff; color: #505b70; font: 500 12px "DM Sans", sans-serif; }
.paid-date { color: var(--muted); font-size: 12px; }
.payment-toggle { min-height: 36px; padding: 6px 8px; border: 0; border-radius: 7px; background: #edf2fb; color: #425f91; font: 600 12px "DM Sans", sans-serif; cursor: pointer; transition: background .15s, color .15s; }
.payment-toggle:hover:not(:disabled) { background: #dfe9f8; color: #425f91; }
.payment-toggle:disabled { background: #f1f2f5; color: #b2b7c1; cursor: not-allowed; }
[hidden] { display: none !important; }
.workspace { display: grid; grid-template-columns: minmax(0, 1fr) 220px; align-items: start; gap: 12px; }
.calendar-area, .side-panel { min-width: 0; padding: 17px; border: 1px solid var(--line); border-radius: 14px; background: #fff; box-shadow: 0 3px 12px #25304c05; }
.section-title { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.section-title > div { display: flex; align-items: center; gap: 9px; }
.section-title h2 { margin: 0; font: 700 14px Manrope, sans-serif; letter-spacing: -.2px; }
.section-title > span { color: var(--muted); font-size: 12px; text-align: right; }
.section-dot { width: 8px; height: 8px; border-radius: 50%; }
.calendar-dot { background: #8165dd; box-shadow: 0 0 0 4px #f1edff; }
.warehouse-dot { background: #35ad8c; box-shadow: 0 0 0 4px #e8f7f2; }
.missed-dot { background: #df7887; box-shadow: 0 0 0 4px #fff0f2; }
.calendar-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 125px), 1fr)); gap: 8px; margin-top: 17px; }
.day-column { min-width: 0; }
.day-heading { position: relative; min-height: 42px; padding: 8px 25px 7px 7px; color: var(--muted); font-size: 12px; font-weight: 600; line-height: 1.35; overflow-wrap: anywhere; }
.day-heading b { position: absolute; top: 5px; right: 3px; min-width: 20px; min-height: 20px; display: grid; place-items: center; border-radius: 6px; background: #f0f1f5; color: #596378; font-size: 11px; }
.day-heading.is-today { color: var(--purple); }
.day-heading.is-today b { background: var(--purple-light); color: var(--purple); }
.day-heading i { display: block; margin-top: 3px; color: #6042b3; font-size: 11px; font-style: normal; }
.dropzone { min-height: 142px; padding: 5px; border: 1px dashed #e2e5ed; border-radius: 10px; background: #fafbfe; transition: background .15s, border-color .15s, box-shadow .15s; }
.dropzone.is-over { border-color: #9a84e5; background: #f4f0ff; box-shadow: inset 0 0 0 1px #aa9ae8; }
.day-dropzone { min-height: 205px; }
.lesson-card { position: relative; margin-bottom: 6px; padding: 8px 7px 6px; border: 1px solid #ebe8f6; border-left: 3px solid var(--card-accent, #ebe8f6); border-radius: 8px; background: var(--card-bg, #fff); box-shadow: 0 2px 6px #3023540a; cursor: grab; transition: transform .15s, box-shadow .15s, opacity .15s; }
.lesson-card[data-subject="Английский язык"] { --card-bg: #f0f5ff; --card-accent: #9db8ec; }
.lesson-card[data-subject="Математика"] { --card-bg: #eff8f2; --card-accent: #98c8a7; }
.lesson-card[data-subject="История"] { --card-bg: #fff6ea; --card-accent: #e8bd7d; }
.lesson-card[data-subject="Украинский язык"] { --card-bg: #fff0f1; --card-accent: #e3a0a8; }
.lesson-card:hover { transform: translateY(-1px); box-shadow: 0 4px 11px #30235412; }
.lesson-card:active { cursor: grabbing; }
.lesson-card.is-dragging { opacity: .42; transform: rotate(1deg); }
.card-top { display: flex; justify-content: space-between; align-items: center; gap: 3px; }
.person { min-width: 0; color: #30374a; font-size: 13px; font-weight: 700; overflow-wrap: anywhere; }
.card-number { flex: 0 0 auto; color: #596378; font-size: 11px; }
.subject { margin-top: 4px; color: #505268; font-size: 12px; line-height: 1.3; overflow-wrap: anywhere; }
.card-payment-state { display: inline-flex; align-items: center; margin-top: 5px; padding: 2px 5px; border: 1px solid transparent; border-radius: 5px; font-size: 11px; font-weight: 700; line-height: 1.2; }
.card-payment-state.is-unpaid { border-color: #f2d5b6; background: #fff5e9; color: #9c541d; }
.card-payment-state.is-paid { border-color: #cce9dd; background: #eff9f4; color: #327b62; }
.history-details { margin-top: 5px; color: var(--muted); font-size: 12px; line-height: 1.4; overflow-wrap: anywhere; }
.lesson-card[data-imported="true"] { cursor: default; }
.payment-outstanding { margin-top: 8px; color: #8e5429; font-size: 12px; }
.payment-receipts { margin-top: 6px; color: #327b62; font-size: 12px; line-height: 1.6; }
.move-label { display: block; margin-top: 6px; color: var(--muted); font-size: 12px; }
.move-select { display: block; width: 100%; min-height: 36px; margin-top: 2px; padding: 3px 2px; border: 0; border-top: 1px solid #d5d9e3; background: transparent; color: #505268; font: 500 12px "DM Sans", sans-serif; cursor: pointer; }
.move-select:focus-visible { color: var(--purple); }
.empty-note { padding: 15px 3px; color: var(--muted); font-size: 12px; line-height: 1.5; text-align: center; overflow-wrap: anywhere; }
.side-area { display: grid; gap: 12px; }
.side-panel { padding: 16px; }
.zone-description { min-height: 30px; margin: 8px 0 11px; color: var(--muted); font-size: 12px; line-height: 1.5; }
.stack-dropzone { min-height: 120px; max-height: 510px; overflow-y: auto; padding: 8px; }
.stack-dropzone .lesson-card { padding: 9px 10px 7px; }
.save-note { display: flex; align-items: center; justify-content: flex-end; gap: 6px; margin: 13px 3px 0; color: var(--muted); font-size: 12px; }
.save-note span { color: #4ab796; font-size: 9px; }
.board-tools, .extra-form, .backup-actions, .login-shell { max-width: 640px; }
.login-panel { margin-top: 40px; }
.login-form { display: grid; gap: 14px; padding: 20px 24px 24px; }
.login-form label { display: grid; gap: 6px; color: #687286; font-size: 12px; }
.login-form input { width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; font: inherit; }
.login-message { margin: 0 24px 20px; color: #687286; font-size: 12px; }
.board-tools, .extra-form, .backup-actions, .month-nav { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.board-tools { margin-bottom: 12px; padding: 12px; background: #fff; border: 1px solid var(--line); border-radius: 12px; font-size: 12px; }
.board-tools label, .extra-form label { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.board-tools select, .extra-form select { max-width: 100%; min-height: 36px; padding: 6px; border: 1px solid var(--line); border-radius: 6px; background: #fff; color: var(--ink); font-size: 12px; }
.board-tools button { border: 0; cursor: pointer; }
[data-filter-count] { color: var(--muted); font-size: 12px; }
.extra-panel { padding: 12px; margin-bottom: 16px; border: 1px solid var(--line); border-radius: 12px; background: #fff; font-size: 12px; }
.extra-panel summary { cursor: pointer; color: var(--purple); font-weight: 700; }
.extra-form { margin-top: 12px; }
.extra-panel p { margin: 10px 0 0; color: #687286; line-height: 1.5; }
.compact-cards .lesson-card, .compact-cards .stack-dropzone .lesson-card { padding: 5px 6px; margin-bottom: 4px; }
.compact-cards .subject { margin-top: 2px; }
.compact-cards .move-label { margin-top: 3px; }
.compact-cards .move-select { padding: 4px 2px; margin-top: 0; }
.compact-cards .card-payment-state, .compact-cards .history-details { margin-top: 3px; }
.report-panel { max-width: none; margin-bottom: 20px; }
.report-table-wrap { overflow-x: auto; padding: 0 20px 16px; }
.month-nav { margin-top: 14px; color: var(--purple); }

.settings-panel { max-width: 870px; overflow: hidden; border: 1px solid var(--line); border-radius: 14px; background: #fff; box-shadow: 0 3px 12px #25304c05; }
.saved-notice { padding: 11px 22px; background: #effaf6; color: #318d74; font-size: 11px; font-weight: 600; }
.panel-intro { display: flex; gap: 14px; padding: 22px 24px; border-bottom: 1px solid #eef0f4; }
.intro-icon { flex: 0 0 38px; height: 38px; display: grid; place-items: center; border-radius: 12px; background: var(--purple-light); color: var(--purple); font-size: 19px; }
.panel-intro h2 { margin: 1px 0 5px; font: 700 15px Manrope, sans-serif; }
.panel-intro p { max-width: 640px; margin-bottom: 0; color: #858da0; font-size: 12px; line-height: 1.6; }
.schedule-form { padding: 0 24px 19px; }
.form-note { padding: 11px 8px 14px; color: #969eae; font-size: 10px; }
.price-intro { border-top: 1px solid #eef0f4; }
.schedule-table-wrap { max-height: min(57vh, 550px); overflow: auto; }
.schedule-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.schedule-table th { position: sticky; top: 0; padding: 13px 8px 10px; background: #fff; color: #989fb0; font-size: 10px; font-weight: 600; text-align: left; }
.schedule-table td { padding: 8px; border-top: 1px solid #f0f1f4; color: #656e80; }
.schedule-table .table-person { width: 23%; color: #333b4d; font-weight: 700; }
.schedule-table input { width: 68px; height: 34px; padding: 0 10px; border: 1px solid #e6e8ee; border-radius: 8px; outline: none; color: #343c4e; font: 600 12px "DM Sans", sans-serif; }
.schedule-table input:focus { border-color: #a998e9; box-shadow: 0 0 0 3px #f2effe; }
.form-footer { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding-top: 15px; border-top: 1px solid #eff0f4; }
.form-footer > span { color: #969eae; font-size: 10px; }
.primary-button { padding: 10px 15px; border: 0; border-radius: 9px; background: #7658d6; color: #fff; font: 600 11px "DM Sans", sans-serif; cursor: pointer; box-shadow: 0 4px 9px #7658d62b; transition: background .15s, transform .15s; }
.primary-button:hover { transform: translateY(-1px); background: #684cc8; }

@media (max-width: 1050px) {
  .calendar-area { padding: 12px 9px; }
  .dropzone { padding: 3px; }
  .lesson-card { padding: 6px 5px 5px; }
  .payments-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  .topbar { min-height: 62px; }
  .shell { padding: 24px 12px 22px; }
  .page-heading { align-items: flex-start; flex-direction: column; gap: 18px; margin-bottom: 20px; }
  .week-nav { width: 100%; justify-content: flex-start; flex-wrap: wrap; }
  .week-caption { min-width: 0; }
  .progress-panel { grid-template-columns: auto 1fr; gap: 10px 14px; }
  .progress-track { grid-column: 1 / -1; grid-row: 2; }
  .progress-hint { grid-column: 1 / -1; text-align: left; }
  .workspace { grid-template-columns: 1fr; }
  .payments-heading { align-items: flex-start; flex-direction: column; }
  .day-heading { min-height: 37px; padding-left: 5px; }
  .day-dropzone { min-height: 110px; }
  .side-area { grid-template-columns: minmax(0, 1fr); align-items: start; }
  .side-panel { padding: 13px; }
  .stack-dropzone { max-height: 360px; }
}
@media (max-width: 480px) {
  .day-dropzone { min-height: 100px; }
  .payments-grid { grid-template-columns: 1fr; }
  .side-panel { padding: 15px; }
  .stack-dropzone { max-height: 370px; }
  .panel-intro { padding: 18px 17px; }
  .schedule-form { padding: 0 15px 15px; }
  .schedule-table { font-size: 11px; }
  .schedule-table .table-person { width: 21%; }
  .schedule-table th, .schedule-table td { padding-right: 4px; padding-left: 4px; }
  .form-footer { align-items: flex-start; flex-direction: column; }
  .form-footer .primary-button { width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  .settings-link, .nav-arrow, .progress-track span, .payment-toggle, .dropzone, .lesson-card, .primary-button { transition: none; }
  .lesson-card:hover, .lesson-card.is-dragging, .primary-button:hover { transform: none; }
}
