*,
*::before,
*::after {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
    font-size: 14px;
    color: #1a1a2e;
    background: #f4f6fb;
}

.top-bar {
    background: #fff;
    border-bottom: 1px solid #e5e7eb;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.top-bar__inner {
    display: flex;
    align-items: center;
    gap: 24px;
    padding: 10px 24px;
}

.top-bar__brand {
    font-weight: 700;
    font-size: 15px;
    color: #1e2a4a;
}

.top-bar__nav {
    display: flex;
    gap: 8px;
}

.top-bar__link {
    padding: 8px 16px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    font-size: 13px;
    color: #4b5563;
}

.top-bar__link:hover {
    background: #f3f4f6;
}

.top-bar__link--active {
    background: #3b6ef5;
    color: #fff;
}

.layout {
    display: grid;
    grid-template-columns: 220px minmax(0, 1fr);
    min-height: calc(100vh - 49px);
}

.layout--tutor,
.layout--auth {
    grid-template-columns: minmax(0, 1fr);
}

.layout--tutor .content {
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
}

.sidebar {
    grid-column: 1;
    width: 220px;
    min-width: 220px;
    flex-shrink: 0;
    background: #1e2a4a;
    color: #fff;
    display: flex;
    flex-direction: column;
    padding: 24px 0;
    position: relative;
    min-height: 100%;
}

.sidebar__brand {
    padding: 0 20px 28px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    margin-bottom: 16px;
}

.sidebar__logo {
    display: block;
    font-size: 22px;
    font-weight: 700;
    letter-spacing: 0.05em;
}

.sidebar__subtitle {
    display: block;
    margin-top: 6px;
    font-size: 11px;
    line-height: 1.4;
    color: rgba(255, 255, 255, 0.55);
}

.sidebar__nav {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 0 12px;
}

.sidebar__link {
    display: block;
    padding: 10px 14px;
    border-radius: 8px;
    color: rgba(255, 255, 255, 0.75);
    text-decoration: none;
    font-weight: 500;
    transition: background 0.15s, color 0.15s;
}

.sidebar__link:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
}

.sidebar__link--active {
    background: #3b6ef5;
    color: #fff;
}

.content {
    grid-column: 2;
    flex: 1;
    min-width: 0;
    padding: 32px 36px;
    overflow: auto;
}

.layout--tutor .content,
.layout--auth .content {
    grid-column: 1;
}

.page {
    min-width: 0;
    max-width: 100%;
}

.page__header {
    margin-bottom: 24px;
}

.page__title {
    margin: 0 0 4px;
    font-size: 26px;
    font-weight: 700;
}

.page__meta {
    margin: 0;
    color: #6b7280;
}

.table-wrap {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
    overflow: auto;
    max-width: 100%;
}

.table-wrap--scroll {
    overflow-x: auto;
    overflow-y: visible;
    -webkit-overflow-scrolling: touch;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 1400px;
}

.data-table th {
    background: #f8f9fc;
    padding: 12px 14px;
    text-align: left;
    font-size: 12px;
    font-weight: 600;
    color: #4b5563;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    border-bottom: 2px solid #e5e7eb;
    white-space: nowrap;
}

.data-table td {
    padding: 12px 14px;
    border-bottom: 1px solid #f0f1f5;
    vertical-align: top;
}

.data-table tbody tr:hover {
    background: #f8faff;
}

.nowrap {
    white-space: nowrap;
}

.comment-cell {
    max-width: 200px;
    word-break: break-word;
}

.empty-row {
    text-align: center;
    color: #9ca3af;
    padding: 40px !important;
}

.tag {
    display: inline-block;
    background: #e8eeff;
    color: #3b6ef5;
    border-radius: 4px;
    padding: 2px 8px;
    font-size: 12px;
    margin: 2px 2px 2px 0;
}

.tag--programming { background: #e8eeff; color: #3b6ef5; }
.tag--math { background: #d1fae5; color: #065f46; }

.data-table--tutors {
    min-width: 600px;
}

.checkbox-list--inline {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    max-height: none;
}

.checkbox-inline {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
}

.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}

.badge--new { background: #dbeafe; color: #1d4ed8; }
.badge--contacted { background: #e0e7ff; color: #4338ca; }
.badge--trial_scheduled { background: #fef3c7; color: #b45309; }
.badge--trial_done { background: #d1fae5; color: #065f46; }
.badge--thinking { background: #fce7f3; color: #9d174d; }
.badge--converted { background: #bbf7d0; color: #166534; }
.badge--rejected { background: #fee2e2; color: #991b1b; }

.placeholder {
    background: #fff;
    border-radius: 12px;
    padding: 48px;
    text-align: center;
    color: #6b7280;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

.page__header--row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}

.back-link {
    display: inline-block;
    margin-bottom: 8px;
    color: #3b6ef5;
    text-decoration: none;
    font-size: 13px;
}

.back-link:hover {
    text-decoration: underline;
}

.btn {
    display: inline-block;
    padding: 10px 18px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    border: none;
    cursor: pointer;
    background: #e5e7eb;
    color: #1a1a2e;
}

.btn--primary {
    background: #3b6ef5;
    color: #fff;
}

.btn--secondary {
    background: #e8eeff;
    color: #3b6ef5;
}

.btn--small {
    padding: 5px 10px;
    font-size: 12px;
}

.btn:hover {
    opacity: 0.9;
}

.data-table--clients {
    min-width: 900px;
}

.data-table--clients tbody tr.row--color > td:first-child {
    box-shadow: inset 4px 0 0 var(--list-stripe, #9ca3af);
}

.data-table--clients tbody tr.row--color-red { --list-stripe: #ef4444; }
.data-table--clients tbody tr.row--color-orange { --list-stripe: #f97316; }
.data-table--clients tbody tr.row--color-yellow { --list-stripe: #eab308; }
.data-table--clients tbody tr.row--color-green { --list-stripe: #22c55e; }
.data-table--clients tbody tr.row--color-teal { --list-stripe: #14b8a6; }
.data-table--clients tbody tr.row--color-blue { --list-stripe: #3b82f6; }
.data-table--clients tbody tr.row--color-purple { --list-stripe: #a855f7; }
.data-table--clients tbody tr.row--color-pink { --list-stripe: #ec4899; }
.data-table--clients tbody tr.row--color-gray { --list-stripe: #9ca3af; }

.list-color-header {
    margin: 8px 0 10px;
}

.list-color-header--compact {
    margin: 4px 0 6px;
}

.list-color-header__form {
    margin: 0;
}

.list-color-header__row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 14px;
}

.list-color-header--compact .list-color-header__row {
    gap: 4px 6px;
}

.list-color-header__label {
    font-size: 12px;
    font-weight: 600;
    color: #6b7280;
}

.list-color-header__options {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.list-color-header--compact .list-color-header__options {
    gap: 4px;
}

.list-color-picker {
    margin: 4px 0 12px;
}

.list-color-picker__label {
    display: block;
    margin-bottom: 8px;
    font-size: 12px;
    font-weight: 600;
    color: #4b5563;
}

.list-color-picker__options {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.list-color-picker__option {
    position: relative;
    display: inline-flex;
    margin: 0;
    padding: 0;
    border: none;
    background: transparent;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
}

.list-color-picker__swatch {
    display: block;
    width: 28px;
    height: 28px;
    border-radius: 8px;
    border: 2px solid #e5e7eb;
    background: #fff;
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.04);
    transition: border-color 0.12s ease, transform 0.12s ease, box-shadow 0.12s ease;
}

.list-color-header--compact .list-color-picker__swatch {
    width: 16px;
    height: 16px;
    border-radius: 4px;
    border-width: 1.5px;
}

.list-color-picker__option--none .list-color-picker__swatch {
    background:
        linear-gradient(135deg, transparent 46%, #d1d5db 46%, #d1d5db 54%, transparent 54%),
        #fff;
}

.list-color-picker__option--red .list-color-picker__swatch { background: #ef4444; border-color: #fecaca; }
.list-color-picker__option--orange .list-color-picker__swatch { background: #f97316; border-color: #fed7aa; }
.list-color-picker__option--yellow .list-color-picker__swatch { background: #eab308; border-color: #fde68a; }
.list-color-picker__option--green .list-color-picker__swatch { background: #22c55e; border-color: #bbf7d0; }
.list-color-picker__option--teal .list-color-picker__swatch { background: #14b8a6; border-color: #99f6e4; }
.list-color-picker__option--blue .list-color-picker__swatch { background: #3b82f6; border-color: #bfdbfe; }
.list-color-picker__option--purple .list-color-picker__swatch { background: #a855f7; border-color: #e9d5ff; }
.list-color-picker__option--pink .list-color-picker__swatch { background: #ec4899; border-color: #fbcfe8; }
.list-color-picker__option--gray .list-color-picker__swatch { background: #9ca3af; border-color: #e5e7eb; }

.list-color-picker__option:hover .list-color-picker__swatch {
    transform: translateY(-1px);
}

.list-color-picker__option--active .list-color-picker__swatch {
    border-color: #1e2a4a;
    box-shadow: 0 0 0 2px #fff, 0 0 0 4px #3b6ef5;
}

.list-color-display {
    display: contents;
}

.list-color-display__swatch {
    display: inline-block;
    width: 14px;
    height: 14px;
    border-radius: 4px;
    margin-right: 8px;
    vertical-align: -2px;
    border: 1px solid rgba(0, 0, 0, 0.08);
}

.list-color-display__swatch--red { background: #ef4444; }
.list-color-display__swatch--orange { background: #f97316; }
.list-color-display__swatch--yellow { background: #eab308; }
.list-color-display__swatch--green { background: #22c55e; }
.list-color-display__swatch--teal { background: #14b8a6; }
.list-color-display__swatch--blue { background: #3b82f6; }
.list-color-display__swatch--purple { background: #a855f7; }
.list-color-display__swatch--pink { background: #ec4899; }
.list-color-display__swatch--gray { background: #9ca3af; }

.data-table--branches {
    min-width: 0;
    table-layout: fixed;
}

.data-table--branches th:nth-child(1),
.data-table--branches td:nth-child(1) {
    width: 18%;
}

.data-table--branches th:nth-child(2),
.data-table--branches td:nth-child(2) {
    width: 27%;
}

.data-table--branches th:nth-child(3),
.data-table--branches td:nth-child(3) {
    width: 45%;
    word-break: break-word;
}

.data-table--branches th:nth-child(4),
.data-table--branches td:nth-child(4) {
    width: 10%;
    white-space: nowrap;
}

.clickable-row {
    cursor: pointer;
}

.clickable-row:hover {
    background: #f0f5ff !important;
}

.card {
    background: #fff;
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 20px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

.card__title {
    margin: 0 0 16px;
    font-size: 18px;
    font-weight: 700;
}

.card__empty {
    color: #9ca3af;
    margin: 0;
}

.card-form {
    margin-bottom: 8px;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 14px 20px;
}

.form-grid label,
.form-grid .tag-picker,
.inline-formset-row label {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 12px;
    font-weight: 600;
    color: #4b5563;
}

.tag-picker {
    min-width: 0;
}

.tag-picker__label {
    font-size: 12px;
    font-weight: 600;
    color: #4b5563;
}

.tag-picker__control {
    position: relative;
    width: 100%;
}

.tag-picker__trigger,
.tag-picker__item {
    appearance: none;
    -webkit-appearance: none;
    font-family: inherit;
    box-sizing: border-box;
}

.tag-picker__trigger {
    width: 100%;
    min-height: 38px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 8px 10px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    background: #fff;
    font-size: 14px;
    font-weight: 400;
    color: #111827;
    cursor: pointer;
    text-align: left;
    line-height: 1.4;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.tag-picker__trigger:hover {
    border-color: #9ca3af;
}

.tag-picker__trigger:focus-visible {
    outline: none;
    border-color: #3b6ef5;
    box-shadow: 0 0 0 3px rgba(59, 110, 245, 0.15);
}

.tag-picker__control.tag-picker--open .tag-picker__trigger {
    border-color: #3b6ef5;
    box-shadow: 0 0 0 3px rgba(59, 110, 245, 0.15);
}

.tag-picker__value {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tag-picker__value--empty {
    color: #9ca3af;
}

.tag-picker__caret {
    flex-shrink: 0;
    width: 16px;
    height: 16px;
    color: #6b7280;
    transition: transform 0.15s ease;
}

.tag-picker__control.tag-picker--open .tag-picker__caret {
    transform: rotate(180deg);
}

.tag-picker__menu {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    z-index: 200;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    box-shadow: 0 12px 32px rgba(15, 23, 42, 0.14);
    overflow: hidden;
}

.tag-picker__menu-body {
    max-height: 220px;
    overflow-y: auto;
    padding: 6px;
}

.tag-picker__item {
    display: flex;
    align-items: center;
    width: 100%;
    padding: 9px 10px;
    border: none;
    border-radius: 7px;
    background: transparent;
    text-align: left;
    font-size: 14px;
    font-weight: 400;
    color: #111827;
    cursor: pointer;
    transition: background-color 0.12s ease;
}

.tag-picker__item-text {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tag-picker__item:hover {
    background: #f3f4f6;
}

.tag-picker__item--active {
    background: #eef3ff;
    color: #1d4ed8;
    font-weight: 600;
}

.tag-picker__item--active::after {
    content: "✓";
    flex-shrink: 0;
    margin-left: 10px;
    font-size: 13px;
    color: #3b6ef5;
}

.tag-picker__menu-footer {
    padding: 6px;
    border-top: 1px solid #eef0f4;
    background: #fafbfc;
}

.tag-picker__item--add {
    justify-content: flex-start;
    gap: 8px;
    color: #3b6ef5;
    font-weight: 600;
    background: transparent;
}

.tag-picker__item--add:hover {
    background: #eef3ff;
}

.tag-picker__add-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #e8eeff;
    font-size: 14px;
    line-height: 1;
}

.modal--compact .modal__card {
    max-width: 320px;
    padding: 20px;
}

.modal__field {
    display: block;
    margin-bottom: 12px;
    font-size: 12px;
    font-weight: 600;
    color: #4b5563;
}

.form-grid input,
.form-grid select,
.form-grid textarea,
.inline-formset-row input,
.inline-formset-row select {
    font-size: 14px;
    padding: 8px 10px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-weight: 400;
}

.full-width {
    grid-column: 1 / -1;
}

.inline-formset-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr) auto;
    gap: 12px;
    align-items: end;
    padding: 12px 0;
    border-bottom: 1px solid #f0f1f5;
}

.inline-formset-row--deleted {
    opacity: 0.5;
}

.inline-formset-row--deleted input:not([type="checkbox"]),
.inline-formset-row--deleted select,
.inline-formset-row--deleted textarea {
    text-decoration: line-through;
}

.inline-formset-row__actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    min-height: 38px;
    padding-bottom: 1px;
}

.inline-formset-row__actions input[type="checkbox"] {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

.btn-formset-delete {
    appearance: none;
    border: none;
    background: none;
    color: #dc2626;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    padding: 8px 4px;
    text-decoration: underline;
    text-underline-offset: 2px;
    white-space: nowrap;
}

.btn-formset-delete:hover {
    color: #b91c1c;
}

.btn-formset-delete--undo {
    color: #4b5563;
    text-decoration: none;
}

.btn-formset-delete--undo:hover {
    color: #111827;
    text-decoration: underline;
}

.formset__rows .inline-formset-row:last-child {
    border-bottom: none;
}

.formset [data-formset-add] {
    margin-top: 12px;
}

.messages {
    list-style: none;
    padding: 0;
    margin: 0 0 16px;
}

.message {
    padding: 10px 14px;
    border-radius: 8px;
    margin-bottom: 8px;
}

.message--success { background: #d1fae5; color: #065f46; }
.message--warning { background: #fef3c7; color: #92400e; }
.message--info { background: #dbeafe; color: #1e40af; }
.message--error { background: #fee2e2; color: #991b1b; }

.referral-list {
    margin: 0;
    padding-left: 20px;
}

.referral-list a {
    color: #3b6ef5;
}

.import-columns {
    margin: 12px 0 20px;
    padding-left: 20px;
    color: #4b5563;
}

.import-form label {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-weight: 600;
}

.help-text {
    font-size: 12px;
    color: #6b7280;
    margin: 8px 0 16px;
}

.data-table--groups {
    width: max-content;
    min-width: 100%;
    table-layout: auto;
}

.data-table--groups th,
.data-table--groups td {
    padding: 10px 12px;
    font-size: 13px;
}

.data-table--groups .data-table__name {
    min-width: 200px;
    max-width: 280px;
    white-space: normal;
    word-break: break-word;
    line-height: 1.35;
}

.data-table--groups .data-table__count {
    text-align: center;
    font-weight: 700;
    white-space: nowrap;
    min-width: 88px;
}

.data-table--inline {
    min-width: auto;
    box-shadow: none;
}

.calendar-page .calendar-filters select {
    padding: 8px 10px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 14px;
}

.calendar-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.calendar-nav {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.calendar-nav__label {
    min-width: 180px;
    text-align: center;
}

.btn--disabled {
    opacity: 0.45;
    cursor: default;
}

.calendar-legend {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.legend-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: #4b5563;
}

.legend-item::before {
    content: '';
    width: 12px;
    height: 12px;
    border-radius: 3px;
}

.legend-item--programming::before { background: #3b6ef5; }
.legend-item--kt::before { background: #8b5cf6; }
.legend-item--math_os::before { background: #10b981; }
.legend-item--math_dop::before { background: #f59e0b; }

.calendar-wrap {
    overflow: auto;
    padding: 0;
}

.calendar-table {
    width: 100%;
    min-width: 960px;
    border-collapse: separate;
    border-spacing: 0;
    table-layout: fixed;
}

.calendar-table__corner {
    width: 72px;
    min-width: 72px;
    background: #f8f9fc;
    border-bottom: 1px solid #e5e7eb;
    position: sticky;
    left: 0;
    z-index: 2;
}

.calendar-table__day {
    text-align: center;
    padding: 12px 8px;
    background: #f8f9fc;
    border-bottom: 1px solid #e5e7eb;
    border-left: 1px solid #eef0f4;
}

.calendar-table__day--today {
    background: #e8eeff;
}

.calendar-table__day--off {
    background: #f3f4f6;
    opacity: 0.65;
}

.calendar-table__weekday {
    display: block;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #6b7280;
    font-weight: 600;
}

.calendar-table__date {
    display: block;
    margin-top: 4px;
    font-size: 18px;
    font-weight: 700;
    color: #111827;
}

.calendar-table__time {
    width: 72px;
    min-width: 72px;
    background: #f8f9fc;
    text-align: center;
    font-weight: 700;
    font-size: 14px;
    color: #374151;
    padding: 12px 8px;
    border-bottom: 1px solid #eef0f4;
    vertical-align: top;
    position: sticky;
    left: 0;
    z-index: 1;
}

.calendar-table__cell {
    min-height: 88px;
    padding: 8px;
    vertical-align: top;
    border-bottom: 1px solid #eef0f4;
    border-left: 1px solid #eef0f4;
    background: #fff;
}

.calendar-table__cell--off {
    background: #fafafa;
}

.calendar-table__empty {
    padding: 32px;
    text-align: center;
    color: #6b7280;
}

.calendar-unscheduled {
    margin-top: 16px;
    padding: 16px 20px;
}

.calendar-unscheduled__title {
    margin: 0 0 12px;
    font-size: 15px;
    font-weight: 600;
}

.calendar-unscheduled__list {
    margin: 0;
    padding: 0;
    list-style: none;
    display: grid;
    gap: 8px;
}

.calendar-unscheduled__list li {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    font-size: 14px;
}

.calendar-unscheduled__branch {
    color: #6b7280;
    font-size: 12px;
    white-space: nowrap;
}

.calendar-event {
    display: block;
    padding: 8px 10px;
    margin-bottom: 6px;
    border-radius: 8px;
    text-decoration: none;
    color: #fff;
    font-size: 12px;
    line-height: 1.35;
    transition: transform 0.12s, box-shadow 0.12s;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.12);
}

.calendar-event:last-child {
    margin-bottom: 0;
}

.calendar-event:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.18);
}

.calendar-event__name {
    display: block;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
}

.calendar-event__meta {
    display: block;
    margin-top: 4px;
    opacity: 0.92;
    font-size: 11px;
}

.calendar-event--programming { background: linear-gradient(135deg, #3b6ef5, #2563eb); }
.calendar-event--kt { background: linear-gradient(135deg, #8b5cf6, #7c3aed); }
.calendar-event--math_os { background: linear-gradient(135deg, #10b981, #059669); }
.calendar-event--math_dop { background: linear-gradient(135deg, #f59e0b, #d97706); }

.client-name--paid {
    color: #15803d;
    font-weight: 600;
}

.client-name--unpaid {
    color: #dc2626;
    font-weight: 600;
}

.client-name--lead {
    color: #1e3a5f;
    font-weight: 600;
}

.badge--paid {
    background: #bbf7d0;
    color: #166534;
}

.badge--unpaid {
    background: #fee2e2;
    color: #991b1b;
}

.badge--lead {
    background: #e0e7ff;
    color: #3730a3;
    font-size: 11px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 999px;
    vertical-align: middle;
}

.participant-row {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 8px;
}

.participant-row__meta {
    font-size: 12px;
    color: #6b7280;
}

.directions-stack {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 16px;
}

.directions-stack__title {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    color: #1e2a4a;
}

.direction-card {
    border-left: 3px solid #3b6ef5;
}

.direction-card__schedule {
    margin: 10px 0 0;
    font-size: 13px;
    color: #6b7280;
}

.card__subtitle {
    margin: 20px 0 12px;
    font-size: 15px;
    font-weight: 700;
}

.finance-legend {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.legend-item--paid::before { background: #22c55e; }
.legend-item--unpaid::before { background: #ef4444; }

.finance-filters {
    margin-bottom: 20px;
}

.finance-filters .form-grid {
    margin-bottom: 12px;
}

.data-table--finance {
    min-width: 900px;
}

.account-chip {
    font-size: 13px;
    margin-bottom: 4px;
}

.text-muted {
    color: #9ca3af;
}

.checkbox-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 8px 16px;
    max-height: 280px;
    overflow-y: auto;
    padding: 4px 0;
}

.checkbox-list ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: contents;
}

.checkbox-list li {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
}

.checkbox-list label {
    font-weight: 400;
    cursor: pointer;
}

.form-errors {
    list-style: none;
    padding: 10px 14px;
    margin: 0 0 16px;
    background: #fee2e2;
    color: #991b1b;
    border-radius: 8px;
}

.report-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 20px;
}

.report-tabs__link {
    padding: 8px 14px;
    border-radius: 8px;
    background: #fff;
    color: #4b5563;
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.report-tabs__link--active {
    background: #3b6ef5;
    color: #fff;
}

.report-filters {
    margin-bottom: 16px;
}

.report-filters .form-grid {
    margin-bottom: 12px;
}

.report-section {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid #f0f1f5;
}

.report-section:first-of-type {
    border-top: none;
    padding-top: 0;
}

.report-group {
    margin: 16px 0;
}

.report-group__title {
    margin: 0 0 10px;
    font-size: 15px;
}

.report-group__title a {
    color: #3b6ef5;
    text-decoration: none;
}

.makeup-student {
    margin-bottom: 20px;
}

.makeup-student__name {
    font-weight: 700;
    margin-bottom: 10px;
}

.makeup-student__name a {
    color: #1a1a2e;
    text-decoration: none;
}

.makeup-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.makeup-cell {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 10px 12px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    background: #f8f9fc;
    min-width: 120px;
    max-width: 160px;
    cursor: pointer;
    font-size: 12px;
    text-align: center;
}

.makeup-cell input {
    width: 18px;
    height: 18px;
}

.makeup-cell__date {
    font-weight: 700;
    color: #dc2626;
}

.makeup-cell__topic {
    color: #4b5563;
    line-height: 1.3;
}

.tutor-select-form {
    display: flex;
    align-items: end;
    gap: 12px;
    flex-wrap: wrap;
}

.tutor-select-form label {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-weight: 600;
    min-width: 280px;
}

.lesson-rules {
    font-size: 13px;
    color: #4b5563;
    margin-bottom: 16px;
}

.lesson-table {
    min-width: 900px;
}

.lesson-table input[type="number"] {
    width: 64px;
    padding: 6px 8px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
}

.lesson-table__check {
    text-align: center;
}

.lesson-actions {
    display: flex;
    gap: 12px;
    margin-top: 20px;
}

.futures-preview {
    font-weight: 700;
    color: #3b6ef5;
    text-align: center;
}

.lesson-row input:disabled {
    background: #f3f4f6;
    opacity: 0.7;
}

.page__actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 8px;
}

.page__header--row .page__actions {
    margin-top: 0;
}

.card__header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.card__header-row .card__title {
    margin-bottom: 0;
}

.info-list {
    display: grid;
    grid-template-columns: 180px 1fr;
    gap: 8px 16px;
    margin: 0 0 16px;
}

.info-list dt {
    color: #6b7280;
    font-size: 13px;
}

.info-list dd {
    margin: 0;
    font-weight: 600;
}

.lesson-topic-input {
    min-width: 240px;
    padding: 4px 8px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
}

.pagination {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 16px;
}

.pagination__info {
    color: #6b7280;
    font-size: 13px;
}

.layout--auth .content {
    max-width: 480px;
    margin: 48px auto;
    padding: 0 24px;
}

.page--centered {
    display: flex;
    justify-content: center;
}

.login-card {
    width: 100%;
    max-width: 400px;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 20px;
}

.login-form label {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 13px;
    font-weight: 600;
    color: #374151;
}

.login-form input {
    padding: 10px 12px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 14px;
}

.btn--full {
    width: 100%;
    margin-top: 8px;
}

/* Leads kanban */
.leads-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.location-switch {
    display: flex;
    gap: 8px;
    background: #f3f4f6;
    padding: 4px;
    border-radius: 10px;
}

.location-switch__btn {
    padding: 8px 20px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    font-size: 13px;
    color: #4b5563;
}

.location-switch__btn--active {
    background: #fff;
    color: #1e2a4a;
    box-shadow: 0 1px 3px rgba(0,0,0,.08);
}

.leads-toolbar__right {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.kanban-board {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    padding-bottom: 16px;
    align-items: flex-start;
}

.kanban-column {
    flex: 0 0 280px;
    min-width: 280px;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 220px);
}

.kanban-column__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px;
    border-bottom: 1px solid #e5e7eb;
    background: #fff;
    border-radius: 12px 12px 0 0;
}

.kanban-column__title {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.kanban-column__name {
    font-weight: 700;
    font-size: 13px;
    color: #1e2a4a;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.kanban-column__count {
    background: #e5e7eb;
    color: #374151;
    font-size: 12px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 10px;
}

.kanban-column__actions {
    display: flex;
    gap: 2px;
}

.kanban-icon-btn {
    background: none;
    border: none;
    color: #9ca3af;
    cursor: pointer;
    font-size: 16px;
    padding: 2px 6px;
    border-radius: 4px;
}

.kanban-icon-btn:hover {
    background: #f3f4f6;
    color: #374151;
}

.kanban-column__body {
    padding: 10px;
    overflow-y: auto;
    flex: 1;
    min-height: 80px;
}

.kanban-column__body--over {
    background: #eff6ff;
    outline: 2px dashed #3b6ef5;
    outline-offset: -2px;
}

.kanban-column__empty {
    color: #9ca3af;
    font-size: 12px;
    text-align: center;
    padding: 16px 8px;
}

.kanban-card {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 0;
    margin-bottom: 8px;
    cursor: grab;
    box-shadow: 0 1px 2px rgba(0,0,0,.04);
    position: relative;
    overflow: hidden;
}

.kanban-card--color::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: var(--list-stripe, #9ca3af);
    z-index: 1;
}

.kanban-card--color-red { --list-stripe: #ef4444; }
.kanban-card--color-orange { --list-stripe: #f97316; }
.kanban-card--color-yellow { --list-stripe: #eab308; }
.kanban-card--color-green { --list-stripe: #22c55e; }
.kanban-card--color-teal { --list-stripe: #14b8a6; }
.kanban-card--color-blue { --list-stripe: #3b82f6; }
.kanban-card--color-purple { --list-stripe: #a855f7; }
.kanban-card--color-pink { --list-stripe: #ec4899; }
.kanban-card--color-gray { --list-stripe: #9ca3af; }

.kanban-card--dragging {
    opacity: 0.5;
}

.kanban-card__link {
    display: block;
    padding: 12px;
    text-decoration: none;
    color: inherit;
}

.kanban-card__link:hover .kanban-card__title {
    color: #3b6ef5;
}

.kanban-card__title {
    font-weight: 700;
    font-size: 14px;
    color: #1e2a4a;
    text-decoration: none;
    display: block;
    margin-bottom: 4px;
}

.kanban-card__meta,
.kanban-card__phone,
.kanban-card__trial,
.kanban-card__manager,
.kanban-card__age {
    font-size: 12px;
    color: #6b7280;
    margin: 2px 0;
}

.kanban-card__age {
    font-weight: 600;
    color: #4b5563;
}

.kanban-card__comment {
    font-size: 11px;
    color: #9ca3af;
    margin-top: 6px;
}

.inline-form {
    display: inline;
}

.badge--stage {
    background: #e0e7ff;
    color: #4338ca;
}

.modal[hidden] {
    display: none !important;
}

.modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,.4);
}

.modal__card {
    position: relative;
    background: #fff;
    border-radius: 12px;
    padding: 24px;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 8px 32px rgba(0,0,0,.15);
}

.modal__title {
    margin: 0 0 16px;
    font-size: 18px;
}

.modal__input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    margin-top: 6px;
}

.modal__actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    margin-top: 16px;
}

.card__subtitle {
    font-size: 13px;
    font-weight: 600;
    color: #4b5563;
    margin: 16px 0 8px;
}

.phone-field {
    display: flex;
    align-items: center;
    gap: 6px;
}

.phone-field__prefix {
    font-weight: 600;
    color: #374151;
    white-space: nowrap;
}

.phone-field__input {
    flex: 1;
    min-width: 0;
}

.comment-list {
    list-style: none;
    margin: 0 0 16px;
    padding: 0;
}

.comment-list__item {
    padding: 10px 12px;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    margin-bottom: 8px;
}

.comment-list__meta {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    font-size: 12px;
    color: #6b7280;
    margin-bottom: 4px;
}

.comment-list__author {
    font-weight: 600;
    color: #374151;
}

.comment-list__text {
    margin: 0;
    font-size: 14px;
    white-space: pre-wrap;
}

.comment-list__new {
    margin-top: 8px;
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 12px 20px;
    margin: 0;
}

.info-grid dt {
    font-size: 12px;
    color: #6b7280;
    margin-bottom: 2px;
}

.info-grid dd {
    margin: 0;
    font-size: 14px;
    color: #1e2a4a;
    font-weight: 500;
}

.plain-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.plain-list li {
    padding: 6px 0;
    border-bottom: 1px solid #f3f4f6;
    font-size: 14px;
}

.plain-list li:last-child {
    border-bottom: none;
}

.lead-chat-card {
    display: flex;
    flex-direction: column;
}

.lead-chat {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 420px;
    overflow-y: auto;
    padding: 12px;
    margin: 0 0 14px;
    background: #f3f4f6;
    border-radius: 12px;
    border: 1px solid #e5e7eb;
}

.lead-chat__empty {
    margin: 24px 0;
    text-align: center;
    color: #9ca3af;
    font-size: 13px;
}

.lead-chat__msg {
    display: flex;
    justify-content: flex-start;
}

.lead-chat__msg--mine {
    justify-content: flex-end;
}

.lead-chat__bubble {
    max-width: min(520px, 88%);
    padding: 10px 14px;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px 12px 12px 4px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.lead-chat__msg--mine .lead-chat__bubble {
    background: #e8eefc;
    border-color: #c7d7f5;
    border-radius: 12px 12px 4px 12px;
}

.lead-chat__meta {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 4px;
    font-size: 11px;
    color: #6b7280;
}

.lead-chat__author {
    font-weight: 700;
    color: #374151;
}

.lead-chat__text {
    margin: 0;
    font-size: 14px;
    line-height: 1.45;
    white-space: pre-wrap;
    color: #1e2a4a;
}

.lead-chat__compose {
    display: flex;
    gap: 10px;
    align-items: flex-end;
}

.lead-chat__input-label {
    flex: 1;
    margin: 0;
}

.lead-chat__compose textarea {
    width: 100%;
    min-height: 64px;
    resize: vertical;
}

.comms-panel__header {
    margin-bottom: 14px;
}

.comms-panel__tabs {
    display: flex;
    gap: 4px;
    padding: 4px;
    background: #f3f4f6;
    border-radius: 10px;
    width: fit-content;
    max-width: 100%;
}

.comms-panel__tab {
    appearance: none;
    border: none;
    background: transparent;
    color: #6b7280;
    font: inherit;
    font-size: 13px;
    font-weight: 600;
    padding: 8px 14px;
    border-radius: 8px;
    cursor: pointer;
    line-height: 1.2;
}

.comms-panel__tab:hover {
    color: #374151;
}

.comms-panel__tab--active,
.comms-panel__tab[aria-selected="true"] {
    background: #fff;
    color: #1e2a4a;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
}

.comms-panel__body[hidden] {
    display: none !important;
}

.messenger-panel {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.messenger-panel__toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px 16px;
}

.messenger-panel__channel {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    font-size: 12px;
    font-weight: 600;
    color: #6b7280;
}

.messenger-panel__channel-select {
    font-size: 13px;
    font-weight: 500;
    color: #374151;
    padding: 6px 10px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    background: #fff;
    min-width: 160px;
}

.messenger-panel__channel-select:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    background: #f9fafb;
}

.messenger-panel__status {
    font-size: 12px;
    font-weight: 600;
    color: #9a3412;
    background: #ffedd5;
    border: 1px solid #fed7aa;
    border-radius: 999px;
    padding: 4px 10px;
}

.messenger-panel__contacts {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.messenger-panel__contact {
    display: inline-flex;
    flex-direction: column;
    gap: 2px;
    padding: 8px 12px;
    background: #f8fafc;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    min-width: 140px;
}

.messenger-panel__contact-name {
    font-size: 12px;
    font-weight: 700;
    color: #374151;
}

.messenger-panel__contact-phone {
    font-size: 13px;
    color: #1e2a4a;
    font-variant-numeric: tabular-nums;
}

.messenger-panel__hint {
    margin: 0;
    font-size: 13px;
    color: #9ca3af;
}

.messenger-panel__thread {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 320px;
    overflow-y: auto;
    padding: 12px;
    background: #f3f4f6;
    border-radius: 12px;
    border: 1px dashed #d1d5db;
    min-height: 140px;
}

.messenger-panel__compose {
    display: flex;
    gap: 10px;
    align-items: flex-end;
}

.messenger-panel__textarea {
    width: 100%;
    min-height: 64px;
    resize: vertical;
    padding: 8px 10px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font: inherit;
    font-size: 14px;
}

.messenger-panel__textarea:disabled,
.messenger-panel__compose .btn:disabled {
    opacity: 0.65;
    cursor: not-allowed;
}

.group-picker {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.group-picker__native-wrap {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
}

.group-picker__chips {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.group-picker__chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 8px 6px 12px;
    background: #f3f4f6;
    border: 1px solid #e5e7eb;
    border-radius: 999px;
    font-size: 13px;
    color: #1e2a4a;
}

.group-picker__chip-remove {
    border: none;
    background: transparent;
    color: #6b7280;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    padding: 0 2px;
}

.group-picker__chip-remove:hover {
    color: #1e2a4a;
}

.group-picker__empty {
    margin: 0;
    font-size: 13px;
    color: #9ca3af;
}

.group-picker__controls {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.group-picker__select {
    min-width: 220px;
    max-width: 100%;
    padding: 8px 10px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 14px;
    background: #fff;
}

.branch-switcher {
    margin-top: 12px;
}

.branch-switcher__select {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
}

.branch-switcher__select option {
    color: #1a1a2e;
    background: #fff;
}

.sidebar__search {
    padding: 0 16px 12px;
    margin-bottom: 4px;
}

.sidebar__search-input {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    font-size: 13px;
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
}

.sidebar__search-input::placeholder {
    color: rgba(255, 255, 255, 0.45);
}

.login-branches {
    margin-bottom: 20px;
    padding: 12px;
    background: #f9fafb;
    border-radius: 8px;
}

.login-branches__title {
    font-size: 13px;
    font-weight: 600;
    color: #374151;
    margin: 0 0 8px;
}

.login-branches__list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.login-branches__list li {
    padding: 6px 0;
    font-size: 13px;
    color: #4b5563;
}

.login-branches__list span {
    display: block;
    color: #6b7280;
    font-size: 12px;
}

.search-form {
    display: flex;
    gap: 12px;
    align-items: flex-end;
    margin-bottom: 16px;
}

.search-form__input {
    min-width: 280px;
    padding: 8px 12px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
}

.clients-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: flex-end;
    margin-bottom: 16px;
    padding: 14px 16px;
}

.clients-toolbar__search {
    flex: 1 1 240px;
}

.clients-toolbar__input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
}

.clients-toolbar__sort {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 13px;
    color: #4b5563;
}

.clients-toolbar__sort select {
    min-width: 180px;
    padding: 8px 10px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
}

.groups-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 20px 28px;
    margin-bottom: 20px;
    padding: 14px 16px;
}

.groups-toolbar__form {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 12px;
    align-items: flex-end;
}

.groups-toolbar__title {
    width: 100%;
    font-size: 13px;
    font-weight: 600;
    color: #4b5563;
}

.groups-toolbar__form label {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 12px;
    color: #6b7280;
}

.groups-section {
    margin-bottom: 28px;
}

.groups-section__title {
    margin: 0 0 12px;
    font-size: 18px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
}

.groups-section__count {
    font-size: 13px;
    font-weight: 600;
    color: #6b7280;
    background: #f3f4f6;
    border-radius: 999px;
    padding: 2px 10px;
}

.groups-section__hall {
    margin: 0 0 8px;
    font-size: 14px;
    font-weight: 600;
    color: #4b5563;
}

.group-extra {
    margin-top: 14px;
}

.group-extra summary {
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    color: #2563eb;
    margin-bottom: 10px;
}

.data-table--roster {
    min-width: 0;
}

.roster-col-status {
    width: 28px;
    padding-right: 0 !important;
    text-align: center;
}

.roster-marker {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    vertical-align: middle;
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.08);
}

.roster-marker--paid {
    background: #22c55e;
}

.roster-marker--unpaid {
    background: #ef4444;
}

.roster-marker--last {
    background: #eab308;
}

.roster-marker--lead {
    background: #6366f1;
}

.roster-name {
    color: #111827;
    font-weight: 600;
    text-decoration: none;
}

.roster-name:hover {
    color: #2563eb;
    text-decoration: underline;
}

.roster-legend {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 16px;
    margin: 12px 0 0;
}

.roster-legend .roster-marker {
    margin-right: 4px;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* --- Card detail: visits widget + right sidebar (Alfa-style) --- */

.page--card-detail {
    max-width: none;
}

.page--card-detail > .page__header {
    margin-bottom: 14px;
}

.page__header--card-client .back-link {
    margin-bottom: 2px;
}

.page__header--card-client .page__title {
    margin: 0 0 2px;
    line-height: 1.2;
}

.page__groups {
    margin: 0 0 6px;
    font-size: 14px;
    font-weight: 500;
    color: #4b5563;
    line-height: 1.35;
}

.page__group-name {
    display: inline;
}

.page__groups-sep {
    margin: 0 6px;
    color: #9ca3af;
}

.direction-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 0 0 6px;
}

.direction-chips--table {
    margin: 0;
}

.direction-chip {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    line-height: 1.4;
    letter-spacing: 0.01em;
    background: #f3f4f6;
    color: #374151;
    border: 1px solid #e5e7eb;
    white-space: nowrap;
}

.direction-chip--programming {
    background: #eff6ff;
    border-color: #bfdbfe;
    color: #1d4ed8;
}

.direction-chip--kt {
    background: #ecfdf5;
    border-color: #a7f3d0;
    color: #047857;
}

.direction-chip--math {
    background: #fff7ed;
    border-color: #fed7aa;
    color: #c2410c;
}

.card-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(280px, 360px);
    gap: 20px;
    align-items: start;
}

.card-layout--visits-top {
    grid-template-areas:
        "visits visits"
        "main side";
}

.card-layout--visits-top > .card-layout__visits {
    grid-area: visits;
}

.card-layout--visits-top > .card-layout__main {
    grid-area: main;
}

.card-layout--visits-top > .card-layout__side {
    grid-area: side;
}

.card-layout__visits {
    min-width: 0;
}

.card-layout__main,
.card-layout__side {
    min-width: 0;
}

.card-layout__side {
    position: sticky;
    top: 16px;
    max-height: calc(100vh - 32px);
    overflow: auto;
}

.card-layout__side .card {
    padding: 18px;
}

.form-grid--stack,
.card-layout__side .form-grid--stack {
    grid-template-columns: 1fr;
}

.form-grid--compact {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.inline-formset-row--stack {
    grid-template-columns: 1fr;
    align-items: stretch;
}

.inline-formset-row--stack .inline-formset-row__actions {
    justify-content: flex-start;
    min-height: auto;
}

.info-grid--stack {
    grid-template-columns: 1fr;
}

.visits-widget {
    padding-bottom: 18px;
}

.card-layout--visits-top .visits-widget {
    padding: 18px 20px 20px;
}

.visits-widget__header {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px 16px;
    margin-bottom: 14px;
}

.visits-widget__title-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 14px;
    min-width: 0;
}

.visits-widget__title {
    margin: 0;
}

.visits-widget__alert {
    font-size: 13px;
    font-weight: 600;
    color: #c60f14;
}

.visits-widget__alert--makeup {
    color: #c2410c;
}

.visits-widget__controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

.visits-widget__range {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    font-size: 12px;
    font-weight: 600;
    color: #6b7280;
}

.visits-widget__range-select {
    font-size: 13px;
    font-weight: 500;
    color: #374151;
    padding: 6px 10px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    background: #fff;
}

.visits-widget__track {
    display: grid;
    grid-template-rows: repeat(4, auto);
    grid-auto-flow: column;
    grid-auto-columns: 46px;
    gap: 6px;
    align-items: start;
    justify-content: start;
    overflow-x: auto;
    padding-bottom: 6px;
    -webkit-overflow-scrolling: touch;
}

.card-layout--visits-top .visits-widget__track {
    gap: 7px;
    grid-auto-columns: 50px;
    min-height: 0;
    padding-top: 2px;
    padding-bottom: 8px;
}

.visits-widget__item {
    position: relative;
    box-sizing: border-box;
    width: 46px;
    height: 52px;
    padding: 10px 2px 4px;
    border: 1px dashed #e5e7eb;
    border-radius: 4px;
    background: #fff;
    color: #6b7280;
    text-align: center;
    line-height: 1.15;
    font-size: 11px;
    font-weight: 600;
    cursor: default;
    user-select: none;
}

.card-layout--visits-top .visits-widget__item {
    width: 50px;
    height: 58px;
    padding-top: 12px;
}

.visits-widget__icon {
    position: absolute;
    top: 1px;
    left: 3px;
    font-size: 10px;
    line-height: 1;
    opacity: 0.7;
}

.visits-widget__subject {
    position: absolute;
    top: 1px;
    right: 2px;
    font-size: 8px;
    font-weight: 700;
    line-height: 1;
    letter-spacing: -0.02em;
    opacity: 0.85;
    color: inherit;
}

.visits-widget__subject--programming {
    color: #1d4ed8;
}

.visits-widget__subject--kt {
    color: #047857;
}

.visits-widget__subject--math {
    color: #c2410c;
}

.visits-widget__subject--sample {
    position: static;
    display: inline-block;
    margin-right: 2px;
    font-size: 11px;
    opacity: 1;
}

.visits-widget__weekday,
.visits-widget__date {
    display: block;
}

.visits-widget__item--attended {
    border-style: solid;
    border-color: #86efac;
    background: #dcfce7;
    color: #166534;
}

.visits-widget__item--missed {
    border-style: solid;
    border-color: #fca5a5;
    background: #fee2e2;
    color: #b91c1c;
}

.visits-widget__item--makeup {
    border-style: solid;
    border-color: #fdba74;
    background: #ffedd5;
    color: #c2410c;
}

.visits-widget__item--makeup_done {
    border-style: solid;
    border-color: #5eead4;
    background: #ccfbf1;
    color: #0f766e;
}

.visits-widget__item--planned {
    border-color: #d1d5db;
    background: #f9fafb;
    color: #6b7280;
}

.visits-widget__item--unconducted {
    border-color: #c60f14 !important;
    border-style: dashed;
    background: #fff;
    color: #6b7280;
}

.visits-widget__item--in_progress {
    border-style: solid;
    border-color: #93c5fd;
    background: #dbeafe;
    color: #1d4ed8;
}

.visits-widget__item--trial {
    border-style: solid;
    border-color: #7dd3fc;
    background: #e0f2fe;
    color: #0369a1;
}

.visits-widget__now {
    box-sizing: border-box;
    width: 46px;
    height: 52px;
    padding: 6px 2px 4px;
    border: 1px dashed #bbf7d0;
    border-radius: 4px;
    color: #15803d;
    text-align: center;
    font-size: 10px;
    font-weight: 700;
    line-height: 1.15;
}

.card-layout--visits-top .visits-widget__now {
    width: 50px;
    height: 58px;
    padding-top: 8px;
}

.visits-widget__now-flag {
    display: block;
    font-size: 14px;
    line-height: 1.2;
}

.visits-widget__now-label {
    display: block;
}

.visits-widget__legend {
    margin-top: 12px;
    font-size: 13px;
}

.visits-widget__legend summary {
    cursor: pointer;
    color: #2563eb;
    font-weight: 500;
    list-style: none;
}

.visits-widget__legend summary::-webkit-details-marker {
    display: none;
}

.visits-widget__legend-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 8px 16px;
    margin: 12px 0 0;
    padding: 0;
    list-style: none;
    color: #4b5563;
    font-size: 12px;
}

.visits-widget__legend-list li {
    display: flex;
    align-items: center;
    gap: 8px;
}

.visits-widget__item--sample,
.visits-widget__now--sample {
    width: 36px;
    height: 28px;
    padding: 4px 0 0;
    flex-shrink: 0;
}

.visits-widget__now--sample {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.visits-widget__item--sample .visits-widget__icon {
    position: static;
    opacity: 1;
}

@media (max-width: 1100px) {
    .card-layout,
    .card-layout--visits-top {
        grid-template-columns: 1fr;
        grid-template-areas:
            "visits"
            "main"
            "side";
    }

    .card-layout__side {
        position: static;
        max-height: none;
        overflow: visible;
    }
}
