:root {
    --bg: #f6f3ef;
    --surface: #ffffff;
    --surface-soft: #fbf8f4;
    --text: #1f2933;
    --muted: #7c8794;
    --line: #e8ded4;
    --primary: #ec4899;
    --primary-dark: #be185d;
    --primary-soft: #fce7f3;
    --green: #16a34a;
    --red: #dc2626;
    --blue: #0284c7;
    --amber: #d97706;
    --shadow: 0 20px 60px rgba(46, 33, 20, 0.09);
}

* {
    box-sizing: border-box;
}

body {
    min-height: 100vh;
    margin: 0;
    overflow-x: hidden;
    background:
        radial-gradient(circle at top left, rgba(236, 72, 153, 0.16), transparent 34rem),
        linear-gradient(135deg, #fbf7f2 0%, var(--bg) 100%);
    color: var(--text);
    font-family: Inter, Arial, sans-serif;
}

a {
    color: inherit;
    text-decoration: none;
}

.sidebar {
    position: fixed;
    inset: 24px auto 24px 24px;
    width: 260px;
    padding: 22px;
    border: 1px solid var(--line);
    border-radius: 28px;
    background: #fff;
    box-shadow: var(--shadow);
}

.mobile-menu-toggle {
    position: fixed;
    top: 14px;
    left: 14px;
    z-index: 90;
    display: none;
    align-items: center;
    gap: 7px;
    min-height: 42px;
    padding: 0 13px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: #fff;
    color: var(--primary-dark);
    cursor: pointer;
    font: inherit;
    font-size: 13px;
    font-weight: 900;
    box-shadow: 0 10px 28px rgba(46, 33, 20, 0.12);
}

.hamburger-icon {
    display: grid;
    gap: 3px;
}

.hamburger-icon span {
    display: block;
    width: 15px;
    height: 2px;
    border-radius: 999px;
    background: currentColor;
}

.menu-overlay {
    position: fixed;
    inset: 0;
    z-index: 70;
    display: none;
    background: rgba(31, 41, 51, 0.34);
}

.brand {
    display: grid;
    justify-items: center;
    gap: 14px;
    margin-bottom: 28px;
    text-align: center;
}

.brand-logo,
.brand-mark {
    display: grid;
    width: 178px;
    height: 178px;
    place-items: center;
    border-radius: 28px;
    background: linear-gradient(135deg, var(--primary), #f9a8d4);
    color: #fff;
    font-weight: 800;
}

.brand-logo {
    padding: 8px;
    overflow: hidden;
    background: #6f2540;
    box-shadow: 0 18px 42px rgba(111, 37, 64, 0.22);
}

.brand-logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 22px;
}

.brand strong,
.brand small {
    display: block;
}

.brand strong {
    color: var(--text);
    font-size: 18px;
    letter-spacing: -0.03em;
    line-height: 1.15;
}

.brand small,
.eyebrow,
td span,
.stat-card small,
.topbar-card span {
    color: var(--muted);
    font-size: 12px;
}

.brand small {
    margin-top: 5px;
    font-weight: 700;
}

.nav {
    display: grid;
    gap: 10px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 13px 14px;
    border-radius: 16px;
    color: #5d6673;
    font-weight: 700;
    transition: 0.2s ease;
}

.nav-link:hover,
.nav-link.active {
    background: var(--primary-soft);
    color: var(--primary-dark);
}

.nav-icon {
    display: grid;
    width: 32px;
    height: 32px;
    flex: 0 0 32px;
    place-items: center;
    border-radius: 12px;
    background: rgba(236, 72, 153, 0.12);
    color: var(--primary);
}

.nav-icon svg {
    width: 17px;
    height: 17px;
    fill: currentColor;
}

.main {
    width: calc(100vw - 332px);
    max-width: none;
    margin-left: 308px;
    padding: 28px 24px 48px;
    min-width: 0;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 24px;
}

.topbar h1 {
    margin: 4px 0 0;
    font-size: clamp(28px, 4vw, 42px);
    letter-spacing: -0.04em;
}

.eyebrow {
    margin: 0;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.topbar-card,
.panel,
.stat-card {
    border: 1px solid var(--line);
    background: #fff;
    box-shadow: var(--shadow);
}

.topbar-card {
    min-width: 250px;
    padding: 18px;
    border-radius: 22px;
}

.topbar-card strong {
    display: block;
    margin-top: 4px;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logout-link {
    display: grid;
    gap: 3px;
    min-width: 132px;
    padding: 13px 15px;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: #fff;
    color: var(--primary-dark);
    font-size: 13px;
    font-weight: 800;
    box-shadow: var(--shadow);
}

.password-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 48px;
    padding: 0 15px;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: #fff;
    color: var(--primary-dark);
    font-size: 13px;
    font-weight: 800;
    box-shadow: var(--shadow);
}

.logout-link span {
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 18px;
    margin-bottom: 18px;
}

.stats-grid.compact {
    grid-template-columns: minmax(260px, 380px);
}

.stat-card {
    position: relative;
    overflow: hidden;
    padding: 22px;
    border-radius: 26px;
}

.stat-card::after {
    position: absolute;
    top: -34px;
    right: -30px;
    width: 120px;
    height: 120px;
    border-radius: 999px;
    content: "";
    opacity: 0.16;
}

.stat-card span {
    color: var(--muted);
    font-size: 13px;
    font-weight: 800;
}

.stat-card strong {
    display: block;
    margin: 12px 0 8px;
    font-size: 28px;
    letter-spacing: -0.04em;
}

.accent-purple::after { background: var(--primary); }
.accent-green::after { background: var(--green); }
.accent-red::after { background: var(--red); }
.accent-blue::after { background: var(--blue); }
.accent-orange::after { background: #f59e0b; }

.month-navigation {
    display: flex;
    align-items: center;
    gap: 7px;
}

.month-navigation a {
    display: inline-flex;
    min-width: 38px;
    height: 38px;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--surface-soft);
    color: var(--text);
    font-size: 24px;
    font-weight: 800;
    text-decoration: none;
}

.month-navigation .month-today {
    padding: 0 11px;
    font-size: 12px;
}

.monthly-finance {
    display: grid;
    gap: 19px;
}

.finance-row-heading,
.monthly-balance {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
}

.finance-row-heading span,
.monthly-balance span {
    color: var(--muted);
    font-size: 13px;
    font-weight: 800;
}

.finance-bar {
    height: 10px;
    margin-top: 9px;
    overflow: hidden;
    border-radius: 999px;
    background: var(--surface-soft);
}

.finance-bar span {
    display: block;
    height: 100%;
    min-width: 0;
    border-radius: inherit;
}

.finance-bar-income { background: var(--green); }
.finance-bar-expense { background: var(--red); }

.monthly-balance {
    margin-top: 2px;
    padding: 16px;
    border-radius: 18px;
    background: rgba(34, 197, 94, 0.1);
    color: var(--green);
}

.monthly-balance.negative {
    background: rgba(239, 68, 68, 0.1);
    color: var(--red);
}

.content-grid {
    display: grid;
    grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.5fr);
    gap: 18px;
    margin-bottom: 18px;
}

.content-grid.single-column {
    grid-template-columns: minmax(0, 560px);
}

.package-renewal-panel {
    margin-bottom: 18px;
}

.monthly-students-panel {
    margin-bottom: 18px;
}

.monthly-student-columns {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px;
}

.monthly-student-group {
    min-width: 0;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 20px;
    background: var(--surface-soft);
}

.monthly-student-group-title,
.monthly-student-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
}

.monthly-student-group-title {
    padding-bottom: 12px;
    border-bottom: 1px solid var(--line);
}

.monthly-student-group-title span,
.monthly-student-group-title small {
    display: block;
}

.monthly-student-group-title span {
    font-weight: 900;
}

.monthly-student-group-title small,
.monthly-student-item span,
.monthly-student-meta small {
    margin-top: 3px;
    color: var(--muted);
    font-size: 12px;
}

.monthly-student-group-title > strong {
    display: grid;
    min-width: 38px;
    height: 38px;
    place-items: center;
    border-radius: 13px;
    background: var(--primary-soft);
    color: var(--primary-dark);
}

.monthly-student-list {
    display: grid;
    gap: 9px;
    max-height: 310px;
    overflow-y: auto;
    padding-top: 12px;
}

.monthly-student-list,
.student-table-wrap {
    scrollbar-width: thin;
    scrollbar-color: rgba(236, 72, 153, 0.48) rgba(236, 72, 153, 0.08);
}

.monthly-student-list::-webkit-scrollbar,
.student-table-wrap::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.monthly-student-list::-webkit-scrollbar-track,
.student-table-wrap::-webkit-scrollbar-track {
    border-radius: 999px;
    background: rgba(236, 72, 153, 0.08);
}

.monthly-student-list::-webkit-scrollbar-thumb,
.student-table-wrap::-webkit-scrollbar-thumb {
    border: 2px solid transparent;
    border-radius: 999px;
    background: rgba(236, 72, 153, 0.48);
    background-clip: padding-box;
}

.monthly-student-list::-webkit-scrollbar-thumb:hover,
.student-table-wrap::-webkit-scrollbar-thumb:hover {
    background: var(--primary);
    background-clip: padding-box;
}

.monthly-student-item {
    padding: 11px 12px;
    border-radius: 15px;
    background: #fff;
}

.monthly-student-item span,
.monthly-student-meta small {
    display: block;
}

.monthly-student-meta {
    flex: 0 0 auto;
    text-align: right;
}

.student-list-header {
    align-items: flex-end;
}

.student-search {
    position: relative;
    display: block;
    width: min(100%, 310px);
}

.student-search input {
    width: 100%;
    height: 44px;
    padding: 0 15px 0 43px;
    border: 1px solid var(--line);
    border-radius: 15px;
    outline: none;
    background: var(--surface-soft);
    color: var(--text);
    font: inherit;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.student-search input:focus {
    border-color: var(--primary);
    background: #fff;
    box-shadow: 0 0 0 4px rgba(236, 72, 153, 0.11);
}

.student-search-icon {
    position: absolute;
    top: 50%;
    left: 14px;
    z-index: 1;
    width: 18px;
    height: 18px;
    color: var(--muted);
    pointer-events: none;
    transform: translateY(-50%);
}

.student-search-icon svg {
    width: 100%;
    height: 100%;
    fill: currentColor;
}

.student-table-wrap {
    max-height: 620px;
    overflow: auto;
}

.student-table-wrap thead {
    position: sticky;
    top: 0;
    z-index: 2;
    background: #fff;
}

.calendar-filter-form {
    margin-bottom: 14px;
}

.calendar-filter-form label {
    display: grid;
    gap: 7px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
}

.calendar-filter-form select {
    width: 100%;
    padding: 11px 12px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: #fff;
    color: var(--text);
    font: inherit;
}

.package-renewal-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(320px, 0.8fr);
    gap: 24px;
}

.payment-received-option {
    display: flex !important;
    flex-direction: row !important;
    align-items: center;
    gap: 10px !important;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: var(--surface-soft);
    cursor: pointer;
}

.payment-received-option input {
    width: 18px;
    height: 18px;
}

.renewal-payment-fields {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.renewal-payment-fields[hidden] {
    display: none;
}

.package-history h3 {
    margin: 0 0 14px;
}

.package-history {
    max-height: 520px;
    overflow-y: auto;
}

.package-history-item {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 5px 14px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 17px;
    background: var(--surface-soft);
}

.package-history-item + .package-history-item {
    margin-top: 10px;
}

.package-history-item span,
.package-history-item small {
    display: block;
    color: var(--muted);
    font-size: 12px;
}

.package-history-item small {
    grid-column: 1 / -1;
}

.lesson-page {
    display: grid;
    gap: 18px;
}

.lesson-form-panel,
.lesson-calendar-panel {
    width: 100%;
}

.lesson-tabs {
    display: inline-flex;
    gap: 4px;
    margin-bottom: 18px;
    padding: 5px;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: var(--surface-soft);
}

.lesson-tab {
    min-height: 40px;
    padding: 0 16px;
    border: 0;
    border-radius: 14px;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    font: inherit;
    font-size: 13px;
    font-weight: 900;
}

.lesson-tab.active {
    background: #fff;
    color: var(--primary-dark);
    box-shadow: 0 8px 24px rgba(46, 33, 20, 0.08);
}

.lesson-tab-panel {
    display: none;
}

.lesson-tab-panel.active {
    display: block;
}

.lesson-form-horizontal {
    grid-template-columns: repeat(6, minmax(150px, 1fr));
    align-items: end;
}

.lesson-form-horizontal label {
    height: 100%;
}

.date-hour-field {
    display: grid;
    gap: 8px;
    color: #47515f;
    font-size: 13px;
    font-weight: 800;
}

.date-hour-field > div {
    display: grid;
    grid-template-columns: minmax(130px, 1fr) 94px;
    gap: 8px;
}

.date-hour-field select,
.date-hour-field input {
    min-height: 48px;
}

.lesson-form-horizontal label:last-of-type {
    grid-column: span 2;
}

.lesson-form-horizontal textarea {
    min-height: 48px;
    max-height: 48px;
}

.lesson-form-horizontal .btn {
    min-height: 48px;
}

.group-appointment-form .group-student-picker {
    grid-column: 1 / -1;
}

.group-appointment-form .group-note-field {
    grid-column: span 5;
}

.group-submit-button {
    align-self: end;
    height: 48px;
    min-height: 48px;
}

.group-student-picker {
    display: grid;
    gap: 8px;
}

.group-student-picker > strong {
    color: #47515f;
    font-size: 13px;
    font-weight: 800;
}

.group-student-selector {
    display: grid;
    grid-template-columns: minmax(220px, 0.9fr) minmax(260px, 1.1fr);
    gap: 12px;
}

.student-pick-box,
.selected-students-box {
    display: grid;
    gap: 8px;
    height: 190px;
    min-height: 190px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: var(--surface-soft);
    overflow: hidden;
}

.student-pick-box label {
    display: grid;
    gap: 8px;
    color: #47515f;
    font-size: 13px;
    font-weight: 800;
}

.student-pick-box small,
.selected-students-box > span {
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
}

.selected-students-list {
    display: grid;
    align-content: start;
    gap: 8px;
    min-height: 0;
    max-height: 128px;
    overflow-y: auto;
    padding-right: 2px;
}

.selected-student-pill {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 9px 10px;
    border-radius: 14px;
    background: #fff;
    box-shadow: 0 8px 22px rgba(46, 33, 20, 0.06);
}

.selected-student-pill span {
    color: var(--text);
    font-size: 13px;
    font-weight: 900;
}

.selected-student-pill button {
    border: 0;
    background: transparent;
    color: var(--red);
    cursor: pointer;
    font: inherit;
    font-size: 12px;
    font-weight: 900;
}

.lesson-management-grid {
    display: grid;
    grid-template-columns: minmax(280px, 0.6fr) minmax(0, 1.4fr);
    gap: 18px;
    align-items: start;
}

.align-start {
    align-items: start;
}

.panel {
    padding: 22px;
    border-radius: 28px;
}

.panel.wide {
    min-width: 0;
}

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
}

.panel h2 {
    margin: 4px 0 0;
    font-size: 22px;
    letter-spacing: -0.03em;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 0 16px;
    border: 0;
    border-radius: 14px;
    cursor: pointer;
    font: inherit;
    font-weight: 800;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff;
}

.btn-light {
    background: #f1ecf7;
    color: var(--primary-dark);
}

.mini-calendar {
    display: grid;
    gap: 14px;
    margin-top: 22px;
    padding-top: 20px;
    border-top: 1px solid var(--line);
}

.mini-calendar-header {
    display: grid;
    grid-template-columns: 42px 1fr 42px;
    align-items: center;
    gap: 10px;
    text-align: center;
}

.mini-calendar-header h3 {
    margin: 4px 0;
    font-size: 20px;
    letter-spacing: -0.03em;
}

.mini-calendar-header span {
    color: var(--muted);
    font-size: 13px;
    font-weight: 800;
}

.calendar-nav {
    display: grid;
    width: 42px;
    height: 42px;
    place-items: center;
    border-radius: 14px;
    background: var(--primary-soft);
    color: var(--primary-dark);
    font-size: 24px;
    font-weight: 900;
}

.calendar-weekdays,
.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 7px;
}

.calendar-weekdays span {
    color: var(--muted);
    font-size: 11px;
    font-weight: 900;
    text-align: center;
}

.calendar-empty,
.calendar-day {
    min-height: 52px;
}

.calendar-day {
    display: grid;
    align-content: center;
    gap: 2px;
    width: 100%;
    padding: 7px 4px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: #fff;
    color: var(--text);
    cursor: pointer;
    font: inherit;
    text-align: center;
}

.calendar-day strong {
    font-size: 13px;
}

.calendar-day span {
    color: var(--primary-dark);
    font-size: 10px;
    font-weight: 900;
}

.calendar-day.has-payment {
    border-color: rgba(236, 72, 153, 0.34);
    background: var(--primary-soft);
}

.calendar-day.has-expense {
    border-color: rgba(239, 68, 68, 0.34);
    background: rgba(239, 68, 68, 0.08);
}

#expense-calendar .calendar-day.active {
    border-color: var(--red);
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.13);
}

.calendar-day.active {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(236, 72, 153, 0.14);
}

#payment-calendar .calendar-day,
#expense-calendar .calendar-day {
    min-width: 0;
    height: 54px;
    min-height: 54px;
    overflow: hidden;
}

#payment-calendar .calendar-day strong,
#payment-calendar .calendar-payment-total,
#expense-calendar .calendar-day strong,
#expense-calendar .calendar-expense-total {
    display: block;
    max-width: 100%;
    overflow: hidden;
    line-height: 1.1;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#payment-calendar .calendar-payment-total {
    font-size: 9px;
}

#expense-calendar .calendar-expense-total {
    color: var(--red);
    font-size: 9px;
}

.lesson-calendar {
    margin: 0 0 22px;
    padding: 0 0 20px;
}

.week-schedule {
    display: grid;
    grid-template-columns: 72px repeat(7, minmax(190px, 1fr));
    gap: 6px;
    overflow-x: auto;
    padding-bottom: 6px;
}

.teacher-schedule-section {
    display: grid;
    gap: 10px;
}

.teacher-schedule-section + .teacher-schedule-section {
    margin-top: 22px;
    padding-top: 22px;
    border-top: 1px solid var(--line);
}

.teacher-schedule-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.teacher-schedule-title strong {
    font-size: 18px;
    letter-spacing: -0.03em;
}

.teacher-schedule-title span {
    padding: 7px 10px;
    border-radius: 999px;
    background: var(--primary-soft);
    color: var(--primary-dark);
    font-size: 12px;
    font-weight: 900;
}

.schedule-corner,
.schedule-day-head,
.schedule-hour,
.schedule-cell {
    border: 1px solid var(--line);
    border-radius: 14px;
    background: #fff;
}

.schedule-corner,
.schedule-day-head,
.schedule-hour {
    display: grid;
    place-items: center;
    min-height: 54px;
    padding: 8px;
    font-weight: 900;
}

.schedule-day-head {
    align-content: center;
    gap: 3px;
    color: var(--primary-dark);
    text-align: center;
    text-decoration: none;
}

.schedule-day-head.selected {
    border-color: var(--primary);
    background: var(--primary-soft);
    box-shadow: 0 0 0 3px rgba(236, 72, 153, 0.12);
}

.schedule-day-head span {
    color: var(--muted);
    font-size: 11px;
    font-weight: 800;
}

.schedule-hour {
    color: var(--muted);
    font-size: 12px;
}

.schedule-cell {
    display: grid;
    align-content: start;
    gap: 6px;
    min-height: 76px;
    max-height: 104px;
    overflow-y: auto;
    padding: 6px;
    background: var(--surface-soft);
}

.selectable-slot {
    cursor: pointer;
}

.selectable-slot.selected {
    border-color: var(--primary);
    background: rgba(236, 72, 153, 0.16);
    box-shadow: inset 0 0 0 2px rgba(236, 72, 153, 0.2);
}

.lesson-calendar-grid .calendar-day {
    align-content: start;
    min-height: 132px;
    gap: 6px;
    padding: 9px;
    text-align: left;
}

.lesson-calendar-grid .calendar-day > strong {
    display: block;
    color: var(--muted);
    font-size: 12px;
}

.lesson-chip {
    display: grid;
    align-content: center;
    justify-items: center;
    gap: 2px;
    width: 100%;
    height: 58px;
    max-height: 58px;
    overflow: hidden;
    padding: 6px;
    border: 0;
    border-radius: 12px;
    background: #fff;
    color: inherit;
    cursor: pointer;
    font: inherit;
    text-align: center;
    box-shadow: 0 8px 22px rgba(46, 33, 20, 0.06);
}

.lesson-chip b {
    color: var(--primary-dark);
    font-size: 12px;
}

.lesson-chip span {
    display: block;
    max-width: 100%;
    overflow: hidden;
    color: var(--text);
    font-size: 10.5px;
    font-weight: 900;
    line-height: 1.15;
    overflow-wrap: anywhere;
    text-overflow: ellipsis;
}

.lesson-chip small {
    color: var(--muted);
    font-size: 11px;
    font-weight: 800;
}

.lesson-chip em {
    max-width: 100%;
    overflow: hidden;
    color: var(--muted);
    font-size: 11px;
    font-style: normal;
    font-weight: 700;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.calendar-details {
    display: grid;
    gap: 10px;
}

.calendar-detail {
    display: none;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: var(--surface-soft);
}

.calendar-detail.active {
    display: grid;
    gap: 10px;
}

.calendar-detail > strong {
    font-size: 14px;
}

.calendar-detail-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    color: var(--muted);
    font-size: 13px;
}

.calendar-detail-row b {
    color: var(--text);
}

.timeline,
.list,
.form {
    display: grid;
    gap: 14px;
}

.compact-form {
    margin-top: 0;
    padding-top: 0;
    border-top: 0;
}

.inline-form select {
    min-width: 150px;
    padding: 9px 10px;
    border-radius: 12px;
    font-size: 13px;
}

.day-filter-form {
    display: flex;
    align-items: center;
    gap: 10px;
}

.day-filter-form input {
    min-width: 160px;
}

.teacher-list {
    display: grid;
    gap: 10px;
    margin-top: 18px;
    padding-top: 18px;
    border-top: 1px solid var(--line);
}

.teacher-list > strong {
    font-size: 14px;
}

.teacher-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--surface-soft);
}

.teacher-row span {
    display: grid;
    gap: 3px;
    font-size: 13px;
    font-weight: 800;
}

.teacher-row small {
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
}

.teacher-row button {
    border: 0;
    background: transparent;
    color: var(--red);
    cursor: pointer;
    font: inherit;
    font-size: 13px;
    font-weight: 900;
}

.group-form {
    margin-top: 18px;
    padding-top: 18px;
    border-top: 1px solid var(--line);
}

.checkbox-list {
    display: grid;
    max-height: 180px;
    overflow-y: auto;
    gap: 8px;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--surface-soft);
}

.checkbox-list label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 800;
}

.checkbox-list input {
    width: auto;
}

.modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 50;
    display: none;
    place-items: center;
    padding: 20px;
    background: rgba(31, 41, 51, 0.42);
}

.modal-backdrop.active {
    display: grid;
}

.lesson-modal {
    position: relative;
    width: min(100%, 460px);
    padding: 26px;
    border-radius: 28px;
    background: #fff;
    box-shadow: var(--shadow);
}

.lesson-modal h3 {
    margin: 6px 0 18px;
    font-size: 24px;
    letter-spacing: -0.04em;
}

.modal-close {
    position: absolute;
    top: 14px;
    right: 14px;
    display: grid;
    width: 34px;
    height: 34px;
    place-items: center;
    border: 0;
    border-radius: 12px;
    background: var(--primary-soft);
    color: var(--primary-dark);
    cursor: pointer;
    font-size: 22px;
    font-weight: 900;
}

.modal-detail-list {
    display: grid;
    gap: 10px;
}

.modal-detail-list div {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
    padding: 10px 0;
    border-bottom: 1px solid var(--line);
}

.modal-detail-list span {
    color: var(--muted);
    font-size: 13px;
    font-weight: 800;
}

.modal-detail-list strong {
    text-align: right;
}

.modal-action-form {
    margin-top: 18px;
}

.modal-action-form .btn {
    width: 100%;
}

.timeline-item,
.list-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: var(--surface-soft);
}

.timeline-item {
    justify-content: flex-start;
}

.timeline-dot {
    width: 12px;
    height: 12px;
    border-radius: 999px;
    background: var(--primary);
    box-shadow: 0 0 0 6px rgba(236, 72, 153, 0.13);
}

.timeline p,
.empty {
    margin: 4px 0 0;
    color: var(--muted);
}

.table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

table {
    width: 100%;
    min-width: 720px;
    border-collapse: collapse;
}

th {
    color: var(--muted);
    font-size: 12px;
    letter-spacing: 0.08em;
    text-align: left;
    text-transform: uppercase;
}

th,
td {
    padding: 14px 12px;
    border-bottom: 1px solid var(--line);
    vertical-align: top;
}

td strong,
td span {
    display: block;
}

.form label {
    display: grid;
    gap: 8px;
    color: #47515f;
    font-size: 13px;
    font-weight: 800;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

input,
select,
textarea {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: #fff;
    color: var(--text);
    font: inherit;
    font-weight: 600;
    outline: none;
    padding: 13px 14px;
}

textarea {
    resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
    border-color: rgba(236, 72, 153, 0.65);
    box-shadow: 0 0 0 4px rgba(236, 72, 153, 0.12);
}

.form-actions,
.actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.actions a {
    color: var(--primary-dark);
    font-size: 13px;
    font-weight: 800;
}

.actions .danger {
    color: var(--red);
}

.badge {
    display: inline-flex;
    width: max-content;
    padding: 7px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 800;
}

.badge-success {
    background: rgba(22, 163, 74, 0.12);
    color: var(--green);
}

.badge-warning {
    background: rgba(217, 119, 6, 0.12);
    color: var(--amber);
}

.badge-danger {
    background: rgba(220, 38, 38, 0.12);
    color: var(--red);
}

.badge-muted {
    background: rgba(124, 135, 148, 0.12);
    color: var(--muted);
}

.alert {
    margin-bottom: 18px;
    padding: 14px 16px;
    border-radius: 18px;
    font-weight: 800;
}

.alert-success {
    background: rgba(22, 163, 74, 0.12);
    color: var(--green);
}

.alert-error {
    background: rgba(220, 38, 38, 0.12);
    color: var(--red);
}

.alert-warning {
    background: rgba(217, 119, 6, 0.12);
    color: var(--amber);
}

.alert a {
    color: inherit;
    font-weight: 900;
    text-decoration: underline;
}

.login-body {
    display: grid;
    min-height: 100vh;
    place-items: center;
    padding: 24px;
}

.login-shell {
    width: min(100%, 500px);
}

.login-card {
    padding: 34px;
    border: 1px solid var(--line);
    border-radius: 32px;
    background: #fff;
    box-shadow: var(--shadow);
    text-align: center;
}

.login-logo {
    width: 260px;
    height: 260px;
    margin: 0 auto 22px;
    overflow: hidden;
    border: 8px solid #fff;
    border-radius: 34px;
    background: #6f2540;
    box-shadow: 0 18px 40px rgba(190, 24, 93, 0.18);
}

.login-logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 26px;
}

.login-card h1 {
    margin: 6px 0 8px;
    font-size: 32px;
    letter-spacing: -0.04em;
}

.login-copy {
    max-width: 360px;
    margin: 0 auto 22px;
    color: var(--muted);
    line-height: 1.6;
}

.login-card .form {
    text-align: left;
}

.login-secondary-link {
    display: inline-flex;
    margin-top: 16px;
    color: var(--primary-dark);
    font-size: 14px;
    font-weight: 800;
}

@media (max-width: 1280px) {
    .brand-logo,
    .brand-mark {
        width: 150px;
        height: 150px;
    }

    .lesson-form-horizontal {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .group-appointment-form .group-note-field {
        grid-column: span 2;
    }

    .week-schedule {
        grid-template-columns: 64px repeat(7, minmax(168px, 1fr));
    }
}

@media (max-width: 1100px) {
    .mobile-menu-toggle {
        display: inline-flex;
    }

    .sidebar {
        position: fixed;
        inset: 12px auto 12px 12px;
        z-index: 80;
        width: min(320px, calc(100vw - 24px));
        margin: 0;
        padding: 18px;
        overflow-y: auto;
        transform: translateX(calc(-100% - 24px));
        transition: transform 0.2s ease;
    }

    body.menu-open .sidebar {
        transform: translateX(0);
    }

    body.menu-open .menu-overlay {
        display: block;
    }

    .main {
        width: 100%;
        margin-left: 0;
        padding: 72px 16px 36px;
    }

    .stats-grid,
    .content-grid {
        grid-template-columns: 1fr 1fr;
    }

    .package-renewal-grid {
        grid-template-columns: 1fr;
    }

    .brand {
        grid-template-columns: auto 1fr;
        justify-items: start;
        margin-bottom: 18px;
        text-align: left;
    }

    .brand-logo,
    .brand-mark {
        width: 92px;
        height: 92px;
        border-radius: 22px;
    }

    .brand-logo img {
        border-radius: 16px;
    }

    .nav {
        grid-template-columns: 1fr;
    }

    .lesson-form-horizontal,
    .lesson-management-grid {
        grid-template-columns: 1fr 1fr;
    }

    .group-student-selector {
        grid-template-columns: 1fr;
    }

    .group-appointment-form .group-student-picker,
    .lesson-form-horizontal label:last-of-type {
        grid-column: span 2;
    }

    .group-appointment-form .group-note-field,
    .group-submit-button {
        grid-column: span 1;
    }

    .week-schedule {
        grid-template-columns: 60px repeat(7, minmax(150px, 1fr));
    }
}

@media (max-width: 720px) {
    .monthly-student-columns {
        grid-template-columns: 1fr;
    }

    .monthly-student-item {
        align-items: flex-start;
    }

    .renewal-payment-fields {
        grid-template-columns: 1fr;
    }

    body {
        background:
            radial-gradient(circle at top left, rgba(236, 72, 153, 0.12), transparent 24rem),
            linear-gradient(135deg, #fbf7f2 0%, var(--bg) 100%);
    }

    .sidebar {
        padding: 14px;
        border-radius: 22px;
    }

    .main {
        padding: 68px 10px 28px;
    }

    .topbar,
    .topbar-actions,
    .panel-header,
    .teacher-schedule-title,
    .list-row {
        align-items: flex-start;
        flex-direction: column;
    }

    .nav,
    .stats-grid,
    .stats-grid.compact,
    .content-grid,
    .lesson-form-horizontal,
    .lesson-management-grid,
    .form-row {
        grid-template-columns: 1fr;
    }

    .nav {
        gap: 7px;
    }

    .nav-link {
        padding: 11px 12px;
    }

    .topbar {
        gap: 12px;
        margin-bottom: 16px;
    }

    .topbar h1 {
        font-size: 28px;
    }

    .topbar-actions {
        width: 100%;
        gap: 8px;
    }

    .panel {
        padding: 16px;
        border-radius: 22px;
    }

    .panel h2 {
        font-size: 20px;
    }

    .lesson-tabs {
        display: grid;
        grid-template-columns: 1fr 1fr;
        width: 100%;
    }

    .lesson-tab {
        padding: 0 10px;
        font-size: 12px;
    }

    .lesson-form-horizontal label:last-of-type {
        grid-column: auto;
    }

    .group-appointment-form .group-student-picker,
    .group-appointment-form .group-note-field,
    .group-submit-button {
        grid-column: auto;
    }

    .topbar-card {
        width: 100%;
    }

    .logout-link {
        width: 100%;
    }

    .password-link {
        width: 100%;
    }

    .brand-logo {
        width: 76px;
        height: 76px;
    }

    .brand strong {
        font-size: 16px;
    }

    .date-hour-field > div {
        grid-template-columns: minmax(0, 1fr) 88px;
    }

    .student-pick-box,
    .selected-students-box {
        height: 170px;
        min-height: 170px;
    }

    .mini-calendar-header {
        grid-template-columns: 38px minmax(0, 1fr) 38px;
    }

    #payment-calendar .calendar-grid,
    #payment-calendar .calendar-weekdays,
    #expense-calendar .calendar-grid,
    #expense-calendar .calendar-weekdays {
        gap: 4px;
    }

    #payment-calendar .calendar-day,
    #expense-calendar .calendar-day {
        height: 46px;
        min-height: 46px;
        padding: 4px 2px;
        border-radius: 11px;
    }

    #payment-calendar .calendar-day strong,
    #expense-calendar .calendar-day strong {
        font-size: 12px;
    }

    #payment-calendar .calendar-payment-total,
    #expense-calendar .calendar-expense-total {
        font-size: 7.8px;
        letter-spacing: -0.03em;
    }

    .calendar-nav {
        width: 38px;
        height: 38px;
    }

    .week-schedule {
        grid-template-columns: 54px repeat(7, minmax(132px, 1fr));
        gap: 5px;
        margin-right: -6px;
        padding-right: 6px;
        scroll-snap-type: x proximity;
    }

    .schedule-corner,
    .schedule-day-head,
    .schedule-hour {
        min-height: 48px;
        padding: 6px;
        font-size: 11px;
    }

    .schedule-cell {
        min-height: 72px;
        max-height: 96px;
        padding: 5px;
        scroll-snap-align: start;
    }

    .lesson-chip {
        height: 54px;
        max-height: 54px;
        padding: 5px;
    }

    .lesson-chip span {
        font-size: 10px;
    }

    .day-filter-form {
        width: 100%;
        flex-direction: column;
        align-items: stretch;
    }

    .day-filter-form input {
        min-width: 0;
    }

    .teacher-row,
    .form-actions,
    .actions {
        align-items: stretch;
        flex-direction: column;
    }

    .teacher-row button,
    .actions a,
    .actions button {
        width: 100%;
        text-align: center;
    }

    .lesson-modal {
        max-height: calc(100vh - 32px);
        overflow-y: auto;
        padding: 22px;
        border-radius: 24px;
    }

    .login-card {
        padding: 24px;
    }

    .login-logo {
        width: 210px;
        height: 210px;
    }
}

@media (max-width: 460px) {
    .sidebar {
        inset: 8px auto 8px 8px;
        width: min(300px, calc(100vw - 16px));
        padding: 12px;
    }

    .mobile-menu-toggle {
        top: 10px;
        left: 10px;
        min-height: 40px;
        padding: 0 11px;
    }

    .main {
        padding: 62px 8px 24px;
    }

    .brand {
        gap: 10px;
    }

    .brand-logo,
    .brand-mark {
        width: 64px;
        height: 64px;
        border-radius: 18px;
    }

    .nav-link {
        gap: 9px;
        font-size: 13px;
    }

    .nav-icon {
        width: 28px;
        height: 28px;
        flex-basis: 28px;
    }

    .stats-grid {
        gap: 12px;
    }

    .stat-card {
        padding: 18px;
        border-radius: 22px;
    }

    .lesson-tabs {
        grid-template-columns: 1fr;
    }

    .group-student-selector {
        gap: 10px;
    }

    .student-pick-box,
    .selected-students-box {
        height: 158px;
        min-height: 158px;
        padding: 10px;
    }

    .mini-calendar-header h3 {
        font-size: 17px;
    }

    #payment-calendar .calendar-grid,
    #payment-calendar .calendar-weekdays,
    #expense-calendar .calendar-grid,
    #expense-calendar .calendar-weekdays {
        gap: 3px;
    }

    #payment-calendar .calendar-day,
    #expense-calendar .calendar-day {
        height: 42px;
        min-height: 42px;
        padding: 3px 1px;
        border-radius: 10px;
    }

    #payment-calendar .calendar-day strong,
    #expense-calendar .calendar-day strong {
        font-size: 11px;
    }

    #payment-calendar .calendar-payment-total,
    #expense-calendar .calendar-expense-total {
        font-size: 7px;
    }

    .monthly-student-item {
        flex-direction: column;
    }

    .monthly-student-meta {
        width: 100%;
        text-align: left;
    }

    .week-schedule {
        grid-template-columns: 50px repeat(7, minmax(118px, 1fr));
    }

    .schedule-day-head span {
        font-size: 10px;
    }

    .lesson-chip span {
        font-size: 9.5px;
    }

    .modal-backdrop {
        padding: 12px;
    }

    .login-body {
        padding: 12px;
    }

    .login-card {
        padding: 18px;
        border-radius: 24px;
    }

    .login-logo {
        width: 170px;
        height: 170px;
    }
}
