html {
    scroll-behavior: smooth;
}

:root {
    --primary-color: #2c3e50;
    --accent-color: #3498db;
    --success-color: #27ae60;
    --unpaid-color: #e67e22;
    --debt-color: #e74c3c;
    --bg-color: #f0f2f5;
    --text-color: #2c3e50;
    --card-bg: #fff;
    --secondary-color: #34495e;
    --border-radius: 16px;
}

* {
    box-sizing: border-box;
}

/* Ukrycie strzałek w polach numerycznych (v17.1.54) */
input::-webkit-outer-spin-button,
input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
input[type=number] {
    -moz-appearance: textfield;
}


body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    margin: 0;
    padding: 0;
    padding-bottom: 80px;
    line-height: 1.6;
}

header {
    background: var(--primary-color);
    color: white;
    padding: 0.4rem 1rem;
    text-align: center;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

header h1 {
    margin: 0;
    font-size: 0.9rem;
    font-weight: 600;
}

.btn-logout {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: white;
    cursor: pointer;
    font-size: 1rem;
    padding: 2px 8px;
    border-radius: 6px;
    transition: background 0.2s;
}

.btn-logout:hover {
    background: rgba(255, 255, 255, 0.2);
}

main {
    padding: 1rem;
    max-width: 800px;
    margin: 0 auto;
}

/* Statystyki */
.stats-bar {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-item {
    flex: 1;
    background: white;
    padding: 1rem;
    border-radius: var(--border-radius);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.02);
    text-align: center;
}

.stat-item small {
    display: block;
    color: #888;
    font-size: 0.75rem;
    text-transform: uppercase;
    margin-bottom: 0.3rem;
}

.stat-item strong {
    font-size: 1.1rem;
    color: var(--primary-color);
}

.card {
    background: var(--card-bg);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
}

/* Blokada przycisku widoku tygodnia w trybie planowania (v9.5.7) */
body.batch-mode-active #btn-view-week {
    display: none !important;
}

.error-alert {
    background: #fff5f5;
    color: #e03131;
    padding: 10px;
    border-radius: 8px;
    margin-bottom: 1rem;
    border: 1px solid #ffc9c9;
    font-size: 0.9rem;
}

.warn-alert {
    background: #fff9db;
    color: #856404;
    padding: 10px;
    border-radius: 8px;
    margin-bottom: 1rem;
    border: 1px solid #ffeeba;
    font-size: 0.9rem;
}

.tz-badge {
    font-size: 0.7rem;
    background: #f1f5f9;
    color: #64748b;
    padding: 2px 6px;
    border-radius: 4px;
    margin-left: 5px;
    font-weight: 500;
    vertical-align: middle;
    display: inline-flex;
    align-items: center;
    gap: 3px;
    border: 1px solid #e2e8f0;
}
.tz-badge.same {
    background: #f0fdf4;
    color: #166534;
    border-color: #dcfce7;
}

/* Kalendarz */
.calendar-nav {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.8rem;
    /* Smaller gap */
    margin-bottom: 0.5rem;
    /* Smaller margin */
}

.month-title {
    font-weight: 600;
    font-size: 0.95rem;
    /* Smaller font */
    color: var(--primary-color);
}

.btn-sm {
    background: #fff;
    border: 1px solid #ddd;
    padding: 5px 12px;
    border-radius: 8px;
    text-decoration: none;
    color: var(--primary-color);
    font-weight: bold;
}

.btn-compact {
    padding: 3px 8px;
    font-size: 0.8rem;
    font-weight: bold;
    text-decoration: none;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 6px;
    color: var(--primary-color);
}

.btn-primary {
    background: var(--accent-color);
    color: white !important;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: background 0.2s;
}

.btn-primary:hover {
    background: #2980b9;
}

.btn-secondary {
    background: #f1f5f9;
    color: #475569 !important;
    border: 1px solid #cbd5e1;
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s;
}

.btn-secondary:hover {
    background: #e2e8f0;
}

.calendar-container {
    width: 100%;
    overflow-x: hidden;
    touch-action: pan-y;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
    background: #fff;
    padding: 5px;
    border-radius: var(--border-radius);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    min-width: auto;
}

.day-label {
    text-align: center;
    font-size: 0.75rem;
    color: #95a5a6;
    font-weight: 600;
    padding-bottom: 5px;
}

.day {
    min-height: 50px;
    aspect-ratio: 1/1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    border-radius: 8px;
    position: relative;
    cursor: pointer;
    background: #f8f9fa;
    padding: 2px;
}

/* Widok Tras (v7.7.0) */
.route-timeline-container {
    background: #fff;
    padding: 15px 20px;
    border-radius: 12px;
    margin: 10px 0 20px 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    overflow-x: auto;
    white-space: nowrap;
    border: 1px solid #eee;
}

.route-line-wrapper {
    display: flex;
    align-items: flex-start;
    gap: 0;
    padding: 10px 0;
    position: relative;
    min-width: max-content;
}

.route-stop {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    flex: 0 0 100px;
    text-decoration: none;
    color: inherit;
}

.route-stop::after {
    content: '';
    position: absolute;
    top: 15px;
    left: 50%;
    width: 100%;
    height: 2px;
    background: #e0e0e0;
    z-index: 1;
}

.route-stop:last-child::after {
    display: none;
}

.route-dot {
    width: 30px;
    height: 30px;
    background: #fff;
    border: 2px solid var(--secondary-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    position: relative;
    z-index: 2;
    transition: transform 0.2s, box-shadow 0.2s;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.route-stop:hover .route-dot {
    transform: scale(1.1);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.route-info {
    margin-top: 8px;
    text-align: center;
}

.route-time {
    font-size: 0.75rem;
    font-weight: bold;
    color: var(--secondary-color);
    display: block;
}

.route-name {
    font-size: 0.7rem;
    color: #666;
    display: block;
    max-width: 90px;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Kompaktowe przyciski lokalizacji (v7.7.0) */
.compact-loc-label {
    flex: 1;
    text-align: center;
    padding: 6px !important;
    border: 1px solid #ddd;
    border-radius: 8px;
    cursor: pointer;
    background: #fff;
    transition: background 0.2s, border-color 0.2s;
}

.compact-loc-label:has(input:checked) {
    border-color: var(--secondary-color);
    background: #f0f7ff;
}

.compact-loc-icon {
    font-size: 1.1rem !important;
}

.compact-loc-text {
    font-size: 0.65rem !important;
}

.day-number {
    position: absolute;
    top: 2px;
    left: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    color: #95a5a6;
    z-index: 1;
}

.day.empty {
    background: transparent;
    cursor: default;
}

.day.today {
    background: #fffdf6;
    border: 2px solid #f39c12;
    font-weight: bold;
}

.day.has-lessons {
    background: #e6fffa;
    color: #00875a;
    font-weight: 600;
}

.day.has-lessons.unpaid {
    background: #fff5f5;
    color: var(--debt-color);
}

.day.holiday {
    background: #fff5f5;
    border: 1px solid #feb2b2;
}

.day.holiday::before {
    content: '🚩';
    position: absolute;
    top: 2px;
    left: 2px;
    font-size: 0.6rem;
}

.day-capacity {
    position: absolute;
    bottom: 2px;
    left: 10%;
    width: 80%;
    height: 3px;
    background: #eee;
    border-radius: 2px;
    overflow: hidden;
}

.capacity-fill {
    height: 100%;
    background: var(--accent-color);
    transition: width 0.3s;
}

.capacity-over {
    background: var(--debt-color);
}

.day-lesson-info {
    width: 100%;
    margin-top: 2px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.cal-lesson-item {
    font-size: 0.7rem;
    line-height: 1.2;
    background: rgba(255, 255, 255, 0.7);
    padding: 2px 4px;
    border-radius: 3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    border-left: 3px solid var(--accent-color);
}

.unpaid .cal-lesson-item {
    border-left-color: var(--debt-color);
}

.cal-lesson-item.cancelled {
    border-left-color: #dcdde1;
    color: #95a5a6;
    text-decoration: line-through;
    opacity: 0.7;
}

.week-lesson-item.cancelled {
    background: #f8f9fa;
    color: #95a5a6;
    text-decoration: line-through;
    border: 1px solid #eee;
}

.day.past {
    opacity: 0.6;
    background: #e9ecef;
}

.day.free:not(.past):not(.today):not(.holiday) {
    background: #f0fff4;
    border: 1px dashed #c6f6d5;
}

.day.free:not(.past):not(.today):not(.holiday)::after {
    content: '🆓';
    position: absolute;
    top: 2px;
    right: 2px;
    font-size: 0.6rem;
    opacity: 0.5;
}

/* Widok tygodnia */
.week-view {
    background: #fff;
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
}

.week-day-row {
    display: flex;
    padding: 10px;
    border-bottom: 1px solid #eee;
    min-height: 60px;
    cursor: pointer;
}

.week-day-row.today {
    background: #e3f2fd;
}

.timeline-slot-link {
    text-decoration: none;
    height: 100%;
    width: 100%;
    display: block;
    border-bottom: 1px dotted #ccc;
    /* Darker and dotted for visibility */
    z-index: 1;
    /* Ensure distinct from background */
}

.week-date {
    width: 80px;
    font-size: 0.85rem;
    font-weight: 600;
    color: #7f8c8d;
    border-right: 1px solid #f0f2f5;
    padding-right: 10px;
}

.week-lessons {
    flex: 1;
    padding-left: 10px;
}

.week-lesson-item {
    font-size: 0.8rem;
    padding: 2px 5px;
    background: #e6fffa;
    border-radius: 4px;
    margin-bottom: 2px;
    color: #00875a;
}

.week-lesson-item.paid {
    background: #f0f0f0;
    color: #999;
    text-decoration: line-through;
}

.lesson-item.cancelled {
    background: #f8f9fa;
    color: #95a5a6;
    border-left: 4px solid #dcdde1;
}

.lesson-item.cancelled .lesson-info strong,
.lesson-item.cancelled .lesson-info .topic {
    text-decoration: line-through;
}

.lesson-item.cancelled .price-tag {
    background: #eee;
    color: #bbb;
}

.actions-inline {
    display: flex;
    gap: 8px;
    margin-top: 8px;
}

.btn-cancel {
    background: #fff;
    border: 1px solid #e74c3c;
    color: #e74c3c;
    padding: 10px 15px;
    border-radius: 10px;
    font-size: 0.9rem;
    cursor: pointer;
    font-weight: 600;
    width: 100%;
    transition: all 0.2s;
}

.btn-cancel:hover {
    background: #fff5f5;
}

.btn-restore {
    background: #fff;
    border: 1px solid var(--success-color);
    color: var(--success-color);
    padding: 10px 15px;
    border-radius: 10px;
    font-size: 0.9rem;
    cursor: pointer;
    font-weight: 600;
    width: 100%;
    transition: all 0.2s;
}

.btn-restore:hover {
    background: #f0fff4;
}

.btn-delete-small {
    background: none;
    border: none;
    color: #ccc;
    font-size: 0.75rem;
    cursor: pointer;
    padding: 3px;
}

.btn-delete-small:hover {
    color: #e74c3c;
}

.btn-edit-modal {
    background: #fff;
    border: 1px solid #f39c12;
    color: #f39c12;
    padding: 10px 15px;
    border-radius: 10px;
    font-size: 0.9rem;
    cursor: pointer;
    font-weight: 600;
    width: 100%;
    margin-top: 5px;
    transition: all 0.2s;
}

.btn-edit-modal:hover {
    background: #fff9f0;
}

.btn-sm.active {
    background: var(--accent-color);
    color: white;
    border-color: var(--accent-color);
}

h2 {
    margin: 0 0 1rem 0;
    font-size: 1.1rem;
    color: var(--primary-color);
}


/* Lekcje */
.lesson-item {
    background: #fff;
    border: 1px solid #edf2f7;
    padding: 1rem;
    margin-bottom: 0.8rem;
    border-radius: 12px;
}

.lesson-main {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.lesson-info {
    flex: 1;
    text-align: left !important;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    min-width: 0;
}

.lesson-header-row {
    font-size: 1rem;
    margin-bottom: 4px;
    width: 100%;
}

.cancelled-tag {
    color: var(--debt-color);
    font-weight: bold;
    font-size: 0.85em;
    margin-left: 5px;
}

.lesson-info strong {
    font-size: 1rem;
}

.topic {
    display: block;
    font-size: 0.85rem;
    color: #7f8c8d;
}

.price-tag {
    display: inline-block;
    background: #f8f9fa;
    padding: 2px 8px;
    border-radius: 6px;
    font-size: 0.8rem;
    margin-top: 5px;
    font-weight: 600;
}

.lesson-item.paid {
    background-color: #f0fff4;
    border-color: #c6f6d5;
}

.paid-badge {
    font-size: 1.2rem;
}

.payment-done {
    display: flex;
    align-items: center;
    gap: 10px;
}

.btn-edit-inline {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    opacity: 0.5;
}

.btn-edit-inline:hover {
    opacity: 1;
}

/* Modal */
.modal {
    display: none;
    /* JS switches to flex */
    justify-content: center;
    align-items: center;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    padding: 10px;
}

#rescheduleModal {
    z-index: 3000;
    /* Musi być nad harmonogramem (2000) */
}

/* Toast Notification (v3.11) */
/* Schedule Modal Grid Layout (v13.8.36) */
.sch-lesson-row {
    background: white;
    padding: 8px 12px;
    border-radius: 8px;
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    font-size: 0.85rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.03);
    margin-bottom: 8px;
}

.sch-actions-grid {
    display: grid;
    grid-template-columns: repeat(3, auto);
    gap: 5px;
}

@media (max-width: 600px) {
    .sch-lesson-row {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .sch-actions-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .sch-actions-grid .btn-sm,
    .sch-actions-grid .btn-cancel,
    .sch-actions-grid .btn-delete-small {
        font-size: 0.7rem !important;
        padding: 4px 2px !important;
    }

    /* Hide text on mobile for compact view */
    .sch-actions-grid .btn-text {
        display: none;
    }
}

/* Schedule Modal Navigation Grid (v13.8.38) */
.sch-nav-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 1.5rem;
}

.sch-nav-grid .btn-sm,
.sch-nav-grid .btn-toggle-cal {
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 !important;
    padding: 0 15px !important;
    font-size: 0.85rem !important;
    border-radius: 12px !important;
    width: 100% !important;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.sch-nav-grid .btn-toggle-cal {
    border: 1px solid #ddd;
}

@media (max-width: 480px) {
    .sch-nav-grid {
        gap: 8px;
    }

    .sch-nav-grid .btn-sm,
    .sch-nav-grid .btn-toggle-cal {
        font-size: 0.75rem !important;
        padding: 0 8px !important;
    }
}

.toast {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: #27ae60;
    color: white;
    padding: 12px 25px;
    border-radius: 30px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    z-index: 9999;
    display: none;
    font-weight: 600;
    animation: toastIn 0.3s ease-out, toastOut 0.3s ease-in 2.7s forwards;
}

@keyframes toastIn {
    from {
        top: -50px;
        opacity: 0;
    }

    to {
        top: 20px;
        opacity: 1;
    }
}

@keyframes toastOut {
    from {
        top: 20px;
        opacity: 1;
    }

    to {
        top: -50px;
        opacity: 0;
    }
}

.toast-center {
    top: 50% !important;
    transform: translate(-50%, -50%) !important;
    background: rgba(0, 0, 0, 0.75) !important;
    font-size: 1.4rem !important;
    padding: 20px 40px !important;
    text-align: center;
    line-height: 1.2;
    animation: toastCenterIn 0.3s ease-out, toastCenterOut 0.3s ease-in 1.2s forwards !important;
}

@keyframes toastCenterIn {
    from {
        opacity: 0;
        transform: translate(-50%, -60%);
    }

    to {
        opacity: 1;
        transform: translate(-50%, -50%);
    }
}

@keyframes toastCenterOut {
    from {
        opacity: 1;
        transform: translate(-50%, -50%);
    }

    to {
        opacity: 0;
        transform: translate(-50%, -40%);
    }
}

.modal-content {
    background-color: white;
    margin: auto;
    /* Centering fix for flex */
    padding: 20px;
    border-radius: var(--border-radius);
    width: 95%;
    max-width: 400px;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

@media (max-width: 600px) {
    .modal-content {
        padding: 14px !important;
        width: 98% !important;
        margin: 0 auto !important;
        box-sizing: border-box !important;
    }
    .modal-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }
}

.modal-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-top: 10px;
}

.input-money {
    width: 65px;
    padding: 6px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 0.9rem;
    text-align: right;
}


.note-box {
    display: block !important;
    width: 100% !important;
    text-align: left !important;
    margin: 4px 0 !important;
    padding: 0 !important;
    background: none !important;
    border: none !important;
    box-shadow: none !important;
    font-size: 0.85rem !important;
    line-height: 1.4 !important;
    color: #444 !important;
    white-space: pre-wrap !important;
    overflow-wrap: break-word !important;
    word-break: break-word !important;
}

.previous-lesson-box {
    background: #f0f7ff;
    border: 1px dashed #3498db;
    padding: 10px;
    margin: 10px 0;
    border-radius: 8px;
    font-size: 0.82rem;
    line-height: 1.4;
    color: #444;
}

.note-label {
    font-weight: 700;
    margin-right: 6px;
    color: #555;
    font-size: 0.85rem;
}

.topic-row {
    text-align: left !important;
    font-size: 0.9rem;
    margin-bottom: 4px;
    color: #333;
}

.btn-pay {
    background: var(--unpaid-color);
    border: none;
    color: white;
    padding: 6px 10px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1rem;
}

/* Uczniowie */
.student-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 0;
    border-bottom: 6px solid #bae6fd;
}

.student-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

@media (max-width: 600px) {
    .student-row {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }
    
    .student-actions {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(60px, 1fr));
        gap: 8px;
        width: 100%;
    }
    
    .student-actions .btn-action {
        text-align: center;
        width: 100%;
        padding: 12px 8px;
        box-sizing: border-box;
    }
}

.student-main-info {
    display: flex;
    flex-direction: column;
}

.student-name {
    text-decoration: none;
    color: var(--primary-color);
    font-weight: 600;
    font-size: 1rem;
}

.student-balance {
    font-size: 0.8rem;
    font-weight: 600;
    color: #95a5a6;
}

.student-balance.debt {
    color: var(--debt-color);
}

.student-balance.surplus {
    color: var(--success-color);
}

.balance-box {
    padding: 1rem;
    border-radius: 10px;
    text-align: center;
    margin-bottom: 1rem;
    background: #f8f9fa;
}

.balance-box.debt {
    background: #fff5f5;
    color: var(--debt-color);
}

.balance-box.surplus {
    background: #f0fff4;
    color: var(--success-color);
}

/* Przyciski */
.btn {
    display: block;
    width: 100%;
    background: var(--accent-color);
    color: white;
    padding: 0.8rem 1.2rem;
    border-radius: 12px;
    text-decoration: none;
    border: none;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

@media (max-width: 480px) {
    .btn {
        padding: 0.85rem 1rem;
        font-size: 0.95rem;
    }

    .btn-sm,
    .btn-action {
        padding: 8px 15px;
        /* Wider buttons for mobile */
    }

    /* Fix Calendar Grid Overflow (v4.3.8) */
    .calendar-grid {
        gap: 2px !important;
        padding: 4px !important;
    }

    .day {
        min-height: 35px !important;
    }

    .day-number {
        font-size: 0.65rem !important;
        top: 1px !important;
        left: 2px !important;
    }

    .lesson-count-badge {
        width: 18px !important;
        height: 18px !important;
        font-size: 0.65rem !important;
    }
}

.btn-add-circle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 35px;
    height: 35px;
    background: var(--accent-color);
    color: white;
    border-radius: 50%;
    text-decoration: none;
    font-size: 1.2rem;
    font-weight: bold;
}

.btn-action {
    background: #f8f9fa;
    padding: 8px;
    border-radius: 10px;
    text-decoration: none;
}

/* Formularze */
.form-group {
    margin-bottom: 1.2rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    font-size: 0.85rem;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.9rem;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    font-size: 1rem;
}

/* Nawigacja */
nav {
    display: flex;
    justify-content: space-around;
    background: #7dd3fc; /* Light Sky Blue (v17.1.58) */
    backdrop-filter: blur(10px);
    padding: 0.7rem 0;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    box-shadow: 0 -4px 15px rgba(0, 0, 0, 0.1);
    border-top: 1px solid rgba(255, 255, 255, 0.2);
}

nav a {
    text-decoration: none;
    font-size: 1.4rem;
    color: #0c4a6e; /* Darker navy for contrast on sky blue */
    padding: 0.5rem 1.5rem;
    border-radius: 12px;
    transition: all 0.2s;
}

nav a.active {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.3); /* Stronger highlight for sky blue */
}

@media (max-width: 480px) {
    nav a {
        padding: 0.5rem 0.8rem;
        font-size: 1.2rem;
    }
}

.lesson-history-item {
    font-size: 0.85rem;
    padding: 0.8rem 0;
    border-bottom: 1px solid #f8f9fa;
    cursor: pointer;
    transition: background-color 0.2s;
}

.lesson-history-item:hover {
    background-color: #f0f7ff;
}

/* Tabele i RWD */
.table-container {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-bottom: 1rem;
    border-radius: 8px;
}

/* Wybrany dzień (Sticky Navigation) */
.day.selected-day {
    border: 2px solid var(--accent-color);
    box-shadow: 0 0 10px rgba(52, 152, 219, 0.3);
    background-color: #ebf5ff !important;
}

table {
    min-width: 600px;
    /* Gwarantuje czytelność kolumn */
}

@media (max-width: 600px) {
    table {
        font-size: 0.8rem;
    }

    .table-container th,
    .table-container td {
        padding: 8px 5px !important;
    }

    /* Karty na urządzenia mobilne dla ustawień (eliminacja przewijania poziomego) */
    .settings-cards table {
        display: block;
        min-width: 100%;
    }

    .settings-cards thead {
        display: none;
    }

    .settings-cards tbody {
        display: block;
    }

    .settings-cards tr {
        display: block;
        background: #fff;
        border: 1px solid #edf2f7;
        margin-bottom: 1rem;
        border-radius: 8px;
        padding: 10px;
        box-shadow: 0 2px 5px rgba(0, 0, 0, 0.02);
    }

    .settings-cards td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 8px 0 !important;
        border-bottom: 1px dashed #eee;
        font-size: 0.9rem;
    }

    .settings-cards td:last-child {
        border-bottom: none;
    }

    .settings-cards td::before {
        content: attr(data-label);
        font-weight: 600;
        color: #7f8c8d;
        flex-shrink: 0;
        margin-right: 15px;
        max-width: 40%;
    }

    .settings-cards input:not([type="checkbox"]),
    .settings-cards select {
        text-align: right;
        max-width: 60%;
    }

    .settings-cards .new-entry-row {
        background: #f8f9fa !important;
        border: 2px dashed #cbd5e0 !important;
    }
}

.table-container::-webkit-scrollbar {
    height: 6px;
}

.table-container::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.table-container::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 3px;
}

.table-container::-webkit-scrollbar-thumb:hover {
    background: #bbb;
}


/* Formularz filtrów raportu */
.report-filter-form {
    display: flex;
    gap: 15px;
    align-items: flex-end;
    flex-wrap: wrap;
}

@media (max-width: 480px) {
    .report-filter-form {
        gap: 10px;
        width: 100%;
        margin-top: 10px;
    }

    .report-filter-form .form-group {
        flex: 1 1 140px;
    }

    .report-filter-form button {
        width: 100%;
        margin-top: 5px;
    }
}

/* Siatka raportów tekstowych */
.report-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 15px;
}

.report-textarea {
    width: 100%;
    height: 120px;
    font-size: 0.75rem;
    color: #555;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 8px;
    background: #fff;
    resize: vertical;
    font-family: inherit;
}

/* Ustawienia v2.0 */
.card h3 {
    margin-top: 1.5rem;
    color: var(--primary-color);
    border-bottom: 2px solid var(--bg-color);
    padding-bottom: 5px;
}

.table-container input[type="time"],
.table-container input[type="number"],
.table-container input[type="date"],
.table-container select {
    padding: 5px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.9rem;
}

@media (max-width: 600px) {
    .table-container:not(.settings-cards) table {
        min-width: 500px;
    }
}

/* Timeline v3.0 */
.timeline-container {
    position: relative;
    background: #fff;
    border-radius: var(--border-radius);
    padding: 10px 10px 10px 0;
    margin-top: 1rem;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    overflow-x: auto;
}

.timeline-grid {
    display: grid;
    grid-template-columns: 60px 1fr;
    position: relative;
    min-width: 300px;
}

.timeline-hours {
    display: flex;
    flex-direction: column;
}

.hour-label {
    min-height: 120px; /* v14.13.1 */
    font-size: 0.7rem;
    color: #999;
    text-align: center;
    border-top: 1px solid #f0f0f0;
    padding-top: 5px;
    box-sizing: border-box;
}

.hour-label.night-hour {
    background: #f8f9fc;
    color: #b0b0cc;
}

.night-row {
    display: none !important; /* v14.13.1 Hide explicitly to collapse auto rows */
}

.unified-agenda-grid.show-night .night-row {
    display: block !important; 
}

/* Specific elements need flex when shown */
.unified-agenda-grid.show-night .timeline-lesson.night-row,
.unified-agenda-grid.show-night .ghost-pills-container.night-row {
    display: flex !important;
}

.timeline-content {
    display: grid;
    grid-template-rows: repeat(60, minmax(30px, auto));
    /* 15 hours * 4 quarters = 60 rows of 15 min */
    grid-template-columns: 1fr;
    /* Force single column */
    position: relative;
    /* Removed static background image to allow dynamic row heights */
}

/* Half-hour lines handled by slot borders now */

.timeline-lesson {
    background: #e3f2fd;
    border-left: 4px solid var(--accent-color);
    border-radius: 6px;
    margin: 1px 5px;
    padding: 3px 8px;
    font-size: 0.85rem;
    overflow: visible;
    min-height: 100%;
    height: auto;
    cursor: pointer;
    z-index: 10;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.08);
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    /* Was center, now start to allow growth */
    position: relative;
    /* For absolute button */
    grid-column: 1;
}

.timeline-lesson:hover {
    filter: brightness(0.95);
    z-index: 20;
}

.timeline-lesson.paid {
    background: #f8f9fa;
    border-left-color: #cbd5e0;
    color: #718096;
}

.timeline-lesson.cancelled {
    background: #fff5f5;
    border-left-color: #feb2b2;
    text-decoration: line-through;
    opacity: 0.7;
    color: #c0392b;
}

/* Ghost Lesson Container (v10.6.4) */
.ghost-pills-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    z-index: 50;
    pointer-events: auto !important;
    align-items: flex-start;
    overflow: hidden;
    background: transparent;
}

.ghost-pills-row {
    display: flex;
    flex-wrap: wrap;
    gap: 3px;
    padding: 2px 4px 1px 4px;
    width: 100%;
}

.ghost-filler-link {
    flex-grow: 1;
    min-height: 20px;
    /* Strong target (v10.6.4) */
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    text-decoration: none !important;
    color: #1b5e20 !important;
    /* Dark Green (v10.6.4) */
    font-size: 1.4rem !important;
    font-weight: 900 !important;
    pointer-events: auto !important;
    opacity: 0.8 !important;
    /* Always very visible (v10.6.4) */
    transition: all 0.2s;
    border-top: 1px dashed rgba(46, 204, 113, 0.4);
    background: rgba(46, 204, 113, 0.08);
    /* Fixed background (v10.6.4) */
}

.ghost-pills-container:hover .ghost-filler-link {
    opacity: 1 !important;
    background: rgba(46, 204, 113, 0.2);
}

/* Ghost Lesson - Compact View (v10.6.3) */
.timeline-lesson.cancelled.compact {
    min-height: 17px;
    height: 17px;
    padding: 0 6px;
    font-size: 0.7rem;
    z-index: 60 !important;
    overflow: hidden;
    margin: 0 !important;
    border-left-width: 3px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    background: rgba(255, 245, 245, 0.95);
    width: fit-content;
    max-width: 150px;
    white-space: nowrap;
    pointer-events: auto !important;
    /* Make pills clickable */
    border-radius: 4px;
}

.timeline-lesson.cancelled.compact .lesson-card-item {
    flex-direction: row;
    align-items: center;
    gap: 8px;
    padding: 0;
}

.timeline-lesson.cancelled.compact .time-meta,
.timeline-lesson.cancelled.compact .topic-line,
.timeline-lesson.cancelled.compact .price-tag,
.timeline-lesson.cancelled.compact .status-line,
.timeline-lesson.cancelled.compact .loc-row,
.timeline-lesson.cancelled.compact .lesson-type-icon,
.timeline-lesson.cancelled.compact .btn-settle-action {
    display: none !important;
}

.timeline-lesson.cancelled.compact .student-name-row {
    margin: 0;
    font-size: 0.75rem;
    white-space: nowrap;
}

.timeline-lesson strong {
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.timeline-lesson span.topic {
    font-size: 0.75rem;
    opacity: 0.8;
}

.current-time-indicator {
    position: absolute;
    left: 0;
    right: 0;
    height: 1px;
    background: var(--accent-color);
    opacity: 0.5;
    z-index: 30;
    pointer-events: none;
}

/* Asystent Planowania - v8.1.26/v8.1.28 Visibility Classes */
.background-lesson {
    display: none !important;
    /* Ukryte w trybie zwykłym */
}

.batch-only {
    display: none !important;
    /* Ukryte w trybie zwykłym */
}

body.batch-mode-active .background-lesson {
    display: flex !important;
    /* Widoczne w trybie asystenta */
    opacity: 0.35;
    filter: grayscale(80%);
    border: 1px dashed #ccc !important;
    background: #fcfcfc !important;
    box-shadow: none !important;
}

body.batch-mode-active .batch-only {
    display: flex !important;
    /* Widoczne w trybie asystenta */
}

body.batch-mode-active .filtered-only {
    display: none !important;
    /* Ukryte w trybie asystenta */
}

.timeline-lesson.filtered-target,
.lesson-item.filtered-target {
    border: 2px solid var(--accent-color) !important;
    box-shadow: 0 0 10px rgba(52, 152, 219, 0.4) !important;
    z-index: 100 !important;
}

.current-time-indicator::after {
    content: '';
    position: absolute;
    left: 0;
    top: -3px;
    width: 6px;
    height: 6px;
    background: var(--accent-color);
    border-radius: 50%;
}

/* Unified Agenda Grid (v4.0.3) - Solves alignment issues */
.unified-agenda-grid {
    display: grid;
    grid-template-columns: 60px 1fr;
    grid-template-rows: repeat(1440, auto); /* v17.1.65: 1 row = 1 minute, auto height to collapse empty tracks */
    position: relative;
    min-width: 300px;
}

/* v14.13.1 explicitly style slot links */
.timeline-slot-link {
    display: block;
    min-height: 30px;
    border-top: 1px dashed #f0f0f0;
}

.timeline-slot-link.night-row {
    min-height: 0;
}

/* Moon Bar v14.13.0 */
.moon-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: #f1f5f9;
    padding: 8px;
    border-radius: 10px;
    margin-bottom: 10px;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px dashed #cbd5e1;
    color: #475569;
    font-weight: 600;
    font-size: 0.85rem;
}

.moon-bar:hover {
    background: #e2e8f0;
    border-color: #94a3b8;
}

.moon-bar.active {
    background: #1e293b;
    color: #f1f5f9;
    border-style: solid;
}

/* Update Hour Label to work in unified grid */
.unified-agenda-grid .hour-label {
    height: auto;
    /* Let it stretch if needed or span */
    text-align: center;
    font-size: 0.7rem;
    color: #999;
    border-top: 1px solid #f0f0f0;
    padding-top: 5px;
    /* No fixed height, spans 4 rows */
}

/* Ensure current time indicator spans full width of grid */
.unified-agenda-grid .current-time-indicator {
    position: relative;
    /* Inside grid cell */
    top: -1px;
    /* Align with border */
    width: 100%;
    z-index: 30;
    height: 1px;
    pointer-events: none;
}


/* Modal v3.0 */
.modal-content {
    background-color: #fff;
    margin: 5% auto;
    padding: 2rem;
    border-radius: var(--border-radius);
    width: 90%;
    max-width: 500px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    position: relative;
    animation: modalIn 0.3s ease-out;
}

@keyframes modalIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Mini-calendar in student schedule modal (v3.9) */
.mini-calendar {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
    margin: 1rem 0 1.5rem 0;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 12px;
    font-size: 0.8rem;
}

.mini-calendar-day {
    aspect-ratio: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    cursor: default;
    background: #fff;
    border: 1px solid #eee;
}

.mini-calendar-day.has-lesson {
    background: #d5f5e3;
    cursor: pointer;
    font-weight: bold;
    color: #27ae60;
    border-color: #2ecc71;
}

.mini-calendar-day.has-lesson:hover {
    background: #2ecc71;
    color: white;
}

.mini-calendar-day.other-month {
    opacity: 0.3;
}

.mini-calendar-header {
    grid-column: span 7;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: bold;
    margin-bottom: 8px;
    padding: 0 5px;
}

.mini-calendar-weekday {
    text-align: center;
    color: #999;
    font-weight: 600;
    font-size: 0.7rem;
    padding-bottom: 5px;
}

.month-header {
    background: #f3f4f6;
    padding: 10px 15px;
    margin: 1.5rem 0 0.8rem 0;
    border-radius: 10px;
    font-weight: bold;
    color: #374151;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 5;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.month-badge {
    background: #6b7280;
    color: white;
    font-size: 0.7rem;
    padding: 2px 8px;
    border-radius: 10px;
}

.btn-toggle-cal {
    background: #fff;
    border: 1px solid #e2e8f0;
    color: #4a5568;
    font-size: 0.85rem;
    padding: 6px 16px;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.2s;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 6px;
    width: fit-content;
    margin-left: auto;
    margin-right: auto;
    font-weight: 600;
}

.btn-toggle-cal:hover {
    background: #f7fafc;
    border-color: #cbd5e0;
}

.future-notice {
    text-align: center;
    margin-top: 15px;
    font-size: 0.85rem;
    color: #666;
    font-style: italic;
    background: #f8f9fa;
    padding: 8px;
    border-radius: 8px;
}

/* Lesson Count Badge (v4.0.5) */
.lesson-count-badge {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: var(--primary-color);
    color: white;
    font-size: 0.75rem;
    font-weight: bold;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
    z-index: 2;
}

.lesson-count-badge.has-cancelled {
    background-color: var(--debt-color);
}

/* Responsive Utilities v4.2.19 */
.flex-responsive {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 15px;
    flex-wrap: wrap;
}

@media (max-width: 600px) {
    .flex-responsive {
        flex-direction: column;
        align-items: stretch;
    }

    .flex-responsive>div {
        text-align: left !important;
    }

    .student-details-header {
        margin-bottom: 20px;
    }
}

.table-responsive-wrapper {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.payment-time {
    display: block;
    font-size: 0.75rem;
    color: #888;
    margin-top: 2px;
}

/* History Link v4.3.0 */
.history-link {
    color: var(--accent-color);
    text-decoration: underline;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.history-link:hover {
    color: var(--primary-color);
}

#paymentHistoryModal .modal-content {
    max-width: 500px;
    width: 94%;
}

@media (max-width: 480px) {
    #paymentHistoryModal .modal-content {
        padding: 15px;
    }

    #paymentHistoryModal table th,
    #paymentHistoryModal table td {
        padding: 8px 5px !important;
        font-size: 0.8rem;
    }
}

/* Nowy Widok Szczegółów Ucznia (v4.5.0) */
.student-details-header-modern {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 20px;
}

.student-main-profile {
    display: flex;
    flex-direction: column;
}

.student-header-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.student-main-profile h2 {
    font-size: 1.4rem;
}

.finance-banner {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 12px 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.finance-banner.surplus {
    background: #f0fff4;
    border: 1px solid #c6f6d5;
}

.finance-banner.debt {
    background: #fff5f5;
    border: 1px solid #ffc9c9;
}

.finance-info {
    display: flex;
    flex-direction: column;
}

.finance-info .balance-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    color: #7f8c8d;
    font-weight: 600;
}

.finance-info .balance-value {
    font-size: 1.25rem;
    font-weight: 700;
}

.finance-actions {
    display: flex;
    gap: 8px;
}

.stats-mini-bar {
    display: flex;
    gap: 15px;
    padding: 8px 0;
    font-size: 0.85rem;
    color: #666;
    border-top: 1px solid #eee;
    margin-top: 10px;
}

.contact-grid-modern {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
    margin: 15px 0;
    width: 100%;
    box-sizing: border-box;
}

.contact-grid-modern>div {
    min-width: 0;
    /* Kluczowe dla poprawnego działania ellipsis wewnątrz gridu */
}

@media (max-width: 600px) {
    .contact-grid-modern {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .contact-card-mini {
        padding: 12px;
        flex-direction: column;
        align-items: flex-start;
        /* Wyrównanie do lewej na górze */
        gap: 6px;
    }

    .contact-card-mini>div:first-child {
        width: 100%;
        margin-bottom: 2px;
    }

    .contact-card-mini strong {
        white-space: normal;
        font-size: 0.95rem;
        color: #2c3e50;
        margin-bottom: 0;
    }

    .contact-details-mobile {
        display: none !important;
    }

    /* Dolny wiersz na mobile */
    .contact-actions-mobile-row {
        display: flex !important;
        width: 100%;
        justify-content: space-between;
        align-items: center;
        margin-top: 4px;
        padding-top: 6px;
        border-top: 1px solid rgba(0, 0, 0, 0.03);
    }
}

.contact-card-mini {
    background: white;
    border: 1px solid #edf2f7;
    padding: 10px 12px;
    border-radius: 10px;
    font-size: 0.85rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-sizing: border-box;
    overflow: hidden;
    /* Zapobiega wyciekaniu treści */
}

.contact-card-mini strong {
    display: block;
    font-size: 0.75rem;
    color: #95a5a6;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}

.contact-links {
    display: flex;
    gap: 12px;
    align-items: center;
}

.contact-actions-mobile-row {
    display: contents;
    /* Na desktopie zachowuje się jakby ich nie było (flex row kontynuuje) */
}

.contact-details-mobile {
    display: none;
    font-size: 0.75rem;
    color: #7f8c8d;
    margin-top: 2px;
}

@media (max-width: 600px) {
    .contact-details-mobile {
        display: block;
    }
}

.contact-notes-container {
    display: none;
    flex: 1;
    margin: 0 10px 0 0;
    /* Zmieniony margines dla mobile */
    padding-left: 10px;
    border-left: 1px solid #f0f0f0;
    font-size: 0.72rem;
    color: #95a5a6;
    overflow: hidden;
    cursor: pointer;
    min-width: 0;
}

.contact-notes-preview {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.2;
}

@media (max-width: 600px) {
    .contact-notes-container {
        display: block;
    }
}

.contact-links a {
    text-decoration: none;
    font-size: 1.1rem;
}

.lesson-preview-row {
    padding: 10px;
    border-bottom: 1px solid #f8f9fa;
    cursor: pointer;
    transition: background 0.2s;
}

.lesson-preview-row:hover {
    background: #f0f8ff;
}

.lesson-preview-header {
    display: flex;
    justify-content: space-between;
    font-weight: 600;
    font-size: 0.9rem;
}

.lesson-preview-topic {
    font-size: 0.85rem;
    color: #444;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.lesson-preview-meta {
    font-size: 0.75rem;
    color: #7f8c8d;
    display: flex;
    flex-direction: column;
    gap: 3px;
    margin-top: 5px;
    padding-top: 5px;
    border-top: 1px solid rgba(0, 0, 0, 0.02);
}

.lesson-meta-item {
    display: flex;
    align-items: flex-start;
    gap: 6px;
}

.lesson-meta-item span:first-child {
    flex-shrink: 0;
}

.line-clamp-1 {
    display: -webkit-box;
    -webkit-line-clamp: 1;
    line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.info-tooltip-icon {
    font-size: 0.7rem;
    cursor: help;
    vertical-align: middle;
}

/* Sekcje kolorystyczne w szczegółach ucznia (v4.5.2) */
.student-sect {
    padding: 15px;
    border-radius: 12px;
    margin-bottom: 20px;
    border: 1px solid #edf2f7;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.02);
}

.sect-profile {
    background: #ffffff;
}

.sect-finances {
    background: #fffdf2;
    border-color: #f39c1222;
}

.sect-upcoming {
    background: #fafdff;
    border-color: #3498db22;
}

.sect-history {
    background: #fafafa;
    border-color: #eee;
}

.sect-title {
    font-size: 0.75rem;
    text-transform: uppercase;
    color: #95a5a6;
    font-weight: 700;
    margin-bottom: 12px;
    display: block;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    padding-bottom: 4px;
}

/* Payment grid fix (v4.5.3) */
.payment-preview-grid {
    display: grid;
    grid-template-columns: 95px 85px 1fr;
    gap: 5px;
    align-items: center;
    padding: 4px 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.02);
    font-size: 0.8rem;
}

/* Sticky Calendar Header Container (v4.6.3+) */
.calendar-sticky-header {
    position: sticky;
    top: 36px;
    /* Below main header */
    background: #fff !important;
    z-index: 900;
    /* Below main header z-index (1000) */
    padding: 0;
    margin-bottom: 0;
    border-bottom: 2px solid #ddd;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

.sticky-day-labels {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    background: #fff;
    padding: 5px 5px 2px 5px;
    border-top: 1px solid #eee;
}

/* Redefined Batch Planning for Sticky (v4.6.4) */
.batch-planning-bar {
    background: #fff;
    border-radius: 12px;
    margin-bottom: 4px;
    text-align: center;
    border: 1px solid #d0e1f9;
    overflow: hidden;
}

.batch-planning-header {
    background: #f0f7ff;
    /* Delicate distinct background */
    padding: 8px 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #e1ecf8;
}

.batch-planning-title {
    margin-bottom: 0;
    font-weight: 700;
    font-size: 0.75rem;
    color: #5a6c7d;
    text-transform: uppercase;
    letter-spacing: 0.8px;
}

.batch-planning-controls {
    display: flex;
    padding: 10px;
    justify-content: center;
    align-items: center;
}

.batch-planning-select {
    padding: 6px;
    border-radius: 6px;
    border: 1px solid #bdd5ea;
    font-size: 0.9rem;
    width: 100%;
}

.batch-planning-hint {
    display: block;
    margin-top: 5px;
    color: #666;
    font-size: 0.75rem;
}

/* Prettier Button for Batch Planning (v4.6.3+) */
.btn-batch-toggle {
    background: var(--accent-color);
    color: white;
    border: none;
    padding: 4px 12px;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.75rem;
}

.btn-batch-toggle:hover {
    background: #2980b9;
}

.btn-batch-toggle.active {
    background: var(--success-color) !important;
}

/* Polish Month Indicator (v4.6.4 Refinement) */
.month-indicator-sticky {
    background: #fff;
    padding: 4px 0;
    text-align: center;
    font-weight: 700;
    font-size: 0.85rem;
    /* Smaller as requested */
    color: #7f8c8d;
    border-radius: 6px;
    margin: 0 5px;
    text-transform: uppercase;
}

@media (max-width: 480px) {
    .calendar-sticky-header {
        top: 35px;
    }

    .batch-planning-controls {
        flex-direction: column;
        width: 100%;
    }

    .batch-planning-select {
        width: 100%;
    }

    .btn-batch-toggle {
        width: 100%;
    }
}

/* --- MULTI-PLANNING BASKET & GENERATOR (v4.7.0) --- */
.day.in-basket,
.week-day-row.in-basket {
    border: 2px solid var(--accent-color) !important;
    background: #ebf8ff !important;
    box-shadow: inset 0 0 5px rgba(52, 152, 219, 0.3);
}

.day.in-basket::after {
    content: '🛒';
    position: absolute;
    top: 2px;
    right: 2px;
    font-size: 0.7rem;
    z-index: 2;
}

/* Planning Mode active state (v4.7.8-4.7.9) */
body.batch-mode-active {
    background-color: #fed7d7;
    /* More intense reddish background */
    transition: background-color 0.3s ease;
}

.batch-mode-active .main-header {
    border-bottom: 2px solid #f56565;
}

.batch-mode-active .batch-planning-bar {
    border: 1px solid #f56565;
    box-shadow: 0 4px 20px rgba(229, 62, 62, 0.3);
}

/* Mobile Assistant Bar optimization v4.9.2 */
@media (max-width: 600px) {
    .planning-main-row {
        flex-direction: column;
        align-items: stretch !important;
    }

    .preferred-time-container {
        width: 100% !important;
        margin-top: 5px;
    }

    .batch-planning-controls {
        padding: 8px !important;
    }

    .btn-generate {
        width: 100%;
        margin-top: 5px;
    }
}

/* Workload Badge v4.9.2.1 - smaller and distinct color */
.workload-badge {
    position: absolute;
    bottom: 1px;
    right: 1px;
    background: #2d3748;
    /* Darker, more neutral */
    color: #e2e8f0;
    font-size: 0.55rem;
    padding: 0px 3px;
    border-radius: 3px;
    min-width: 12px;
    text-align: center;
    line-height: 1.2;
    font-weight: normal;
    opacity: 0.7;
    pointer-events: none;
}

.batch-mode-active .workload-badge {
    background: #c53030;
    opacity: 1;
}

/* Override calendar cell colors in planning mode */
.batch-mode-active .day {
    background: #fff5f5;
}

.batch-mode-active .day.has-lessons {
    background: #feb2b2;
    color: #9b2c2c;
}

.batch-mode-active .day.today {
    border: none;
    background: #fff5f5;
    /* Match regular planning mode day */
}

.batch-mode-active .day.holiday {
    background: #fff5f5;
    border: 1px solid #fc8181;
}

.in-basket {
    background-color: #feb2b2 !important;
    border-color: #f56565 !important;
    color: #fff !important;
}

.basket-bar-fixed {
    position: fixed;
    bottom: 60px;
    /* Above main navigation */
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 800px;
    background: #2c3e50;
    color: white;
    padding: 10px 15px;
    display: none;
    /* Shown via JS when basket not empty */
    justify-content: space-between;
    align-items: center;
    z-index: 1500;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.2);
    border-top: 2px solid var(--accent-color);
}

.basket-info {
    font-size: 0.9rem;
    font-weight: 600;
}

.btn-basket-action {
    background: var(--accent-color);
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: bold;
    cursor: pointer;
}

.basket-drawer {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 800px;
    background: white;
    z-index: 1600;
    max-height: 80vh;
    display: none;
    flex-direction: column;
    border-radius: 20px 20px 0 0;
    box-shadow: 0 -5px 25px rgba(0, 0, 0, 0.3);
}

.basket-drawer-header {
    padding: 15px;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f8f9fa;
    border-radius: 20px 20px 0 0;
}

.basket-list {
    overflow-y: auto;
    padding: 10px;
}

.basket-item-info.collision {
    color: #e74c3c !important;
    background: #fdf2f2;
    border-radius: 4px;
    padding: 2px 5px;
}
.basket-item-info.collision strong {
    color: #e74c3c !important;
}

.basket-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    border-bottom: 1px solid #f0f0f0;
    font-size: 0.9rem;
}

.basket-item-info {
    flex: 1;
}

.basket-item-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.basket-item input[type="time"] {
    padding: 4px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.85rem;
}

.btn-remove-basket {
    background: none;
    border: none;
    color: #e74c3c;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0 5px;
}

.generator-ui {
    background: #fdfdfd;
    border: 1px solid #d0e1f9;
    padding: 10px;
    margin-top: 5px;
    border-radius: 0 0 8px 8px;
}

.day-selector {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-bottom: 10px;
}

.day-checkbox {
    display: none;
}

.day-label-chip {
    padding: 6px 10px;
    background: #eee;
    border-radius: 20px;
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid transparent;
}

.day-checkbox:checked+.day-label-chip {
    background: var(--accent-color);
    color: white;
    border-color: #2980b9;
}

.generator-controls {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.generator-controls input {
    padding: 6px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 0.85rem;
}

.btn-generate {
    background: #27ae60;
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 8px;
    font-weight: bold;
    cursor: pointer;
    flex: 1;
}

/* Teacher Unavailability Styles (v4.13.0) */
.day.day-off {
    background-color: #ebedef !important;
    /* Slightly darker than standard grey */
    opacity: 0.8;
}

.day.partial-off {
    background: linear-gradient(135deg, transparent 50%, rgba(0, 0, 0, 0.07) 50%) !important;
}

.week-date.day-off {
    background-color: #ebedef !important;
}

.week-date.partial-off {
    background: linear-gradient(135deg, #fff 50%, #ebedef 50%) !important;
}

/* Settle Modal Card Layout (v7.6.0) */
.settle-cards-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.settle-card {
    background: #fff;
    border: 1px solid #e0e6ed;
    border-radius: 12px;
    padding: 12px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
}

.settle-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    border-bottom: 1px solid #f0f4f8;
    padding-bottom: 8px;
}

.settle-card-name {
    font-weight: bold;
    font-size: 1rem;
    color: var(--primary-color);
}

.settle-card-balance {
    font-size: 0.8rem;
    color: #7f8c8d;
}

.settle-card-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.settle-card-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.settle-card-field label {
    font-size: 0.7rem;
    color: #95a5a6;
    text-transform: uppercase;
    font-weight: bold;
}

.settle-card-field input {
    width: 100%;
    padding: 8px;
    border: 1px solid #ccd6e0;
    border-radius: 6px;
    font-size: 0.95rem;
    text-align: right;
}

.balance-preview {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px dashed #eee;
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    font-weight: 500;
}

.balance-after {
    font-weight: bold;
}

.balance-after.positive {
    color: var(--success-color);
}

.balance-after.negative {
    color: var(--debt-color);
}

/* Mobile optimization for cards */
@media (max-width: 600px) {
    .settle-card-grid {
        grid-template-columns: 1fr 1fr;
    }

    .settle-card-field:first-child {
        grid-column: span 2;
    }
}

/* --- UNIFIED LESSON CARD UI (v8.1.3) --- */
.lesson-card-item {
    position: relative;
    padding: 8px 12px;
    /* Reduced vertical padding (v10.6.4) */
    background: white;
    border-radius: 10px;
}

.lesson-card-item .time-meta {
    font-size: 0.75rem;
    opacity: 0.8;
    display: block;
}

.lesson-card-item .student-name-row {
    font-weight: bold;
    overflow-wrap: break-word;
    line-height: 1.1;
    margin-top: 2px;
    padding-right: 70px;
}

.lesson-card-item .topic-line {
    font-weight: 800;
    font-size: 0.85rem;
    margin-top: 2px;
    overflow-wrap: break-word;
    line-height: 1.1;
}

.lesson-card-item .price-tag {
    font-size: 0.85rem;
    margin-top: 3px;
    font-weight: bold;
    color: #2c3e50;
}

.lesson-card-item .status-line {
    font-size: 0.8rem;
    margin-top: 2px;
    color: #555;
    white-space: nowrap;
}

.lesson-card-item .prep-line {
    font-size: 0.75rem;
    font-style: italic;
    font-weight: normal;
    margin-top: 2px;
    color: #555;
    overflow-wrap: break-word;
    line-height: 1.2;
}

.lesson-card-item .homework-line {
    font-size: 0.75rem;
    font-style: italic;
    font-weight: normal;
    margin-top: 2px;
    color: #e67e22;
    overflow-wrap: break-word;
    line-height: 1.2;
}

.lesson-card-item .loc-row {
    font-size: 0.75rem;
    margin-top: 4px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.lesson-card-item .maps-link {
    color: #27ae60;
    text-decoration: none;
    font-weight: 600;
}

.lesson-card-item .btn-settle-action {
    position: absolute;
    top: 5px;
    right: 5px;
    color: white;
    padding: 2px 8px;
    font-size: 0.75rem;
    border: none;
    border-radius: 4px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    white-space: nowrap;
    z-index: 15;
    cursor: pointer;
}

.lesson-card-item .btn-settle-action.individual {
    background: #27ae60;
}

.lesson-card-item .btn-settle-action.group {
    background: #2980b9;
}

.lesson-card-item .balance-tag {
    font-weight: bold;
    font-size: 0.75rem;
    margin-left: 5px;
}

.lesson-card-item .balance-tag.debt {
    color: #e74c3c;
}

.lesson-card-item .balance-tag.surplus {
    color: #27ae60;
}

@media (max-width: 600px) {
    #modalHeaderButtons>div {
        display: grid !important;
        grid-template-columns: 1fr 1fr;
        gap: 8px !important;
        width: 100%;
    }

    #modalHeaderButtons>div>div {
        display: contents !important;
    }

    #modalHeaderButtons button {
        width: 100%;
        margin: 0 !important;
        padding: 4px 2px !important;
        white-space: normal !important;
        height: 100% !important;
        min-height: 30px;
        font-size: 0.65rem !important;
    }
}

@media (max-width: 600px) {
    #lessonActions>div {
        display: grid !important;
        grid-template-columns: 1fr 1fr;
        gap: 8px !important;
        width: 100%;
        margin-bottom: 8px !important;
    }

    #lessonActions button {
        width: 100% !important;
        margin: 0 !important;
        padding: 4px 2px !important;
        white-space: normal !important;
        height: 100% !important;
        min-height: 30px;
        font-size: 0.65rem !important;
    }
}
/* Public Profile Status Card (v16.3.22) */
.public-status-card {
    background: linear-gradient(135deg, #e0f2fe 0%, #f0f9ff 100%);
    border: 1px solid #bae6fd;
    border-radius: 16px;
    padding: 1.25rem;
    margin-bottom: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    box-shadow: 0 4px 12px rgba(186, 230, 253, 0.2);
}

.status-info-header {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    flex: 1;
}

.status-info-header strong {
    color: #0369a1;
    font-size: 1rem;
    display: flex;
    align-items: center;
    gap: 6px;
}

.url-display-box {
    background: rgba(255, 255, 255, 0.6);
    border: 1px solid #e0f2fe;
    padding: 10px 12px;
    border-radius: 10px;
    color: #0c4a6e;
    font-size: 0.85rem;
    font-family: inherit;
    word-break: break-all;
    line-height: 1.4;
}

.status-actions {
    display: flex;
    gap: 10px;
    flex-direction: column;
}

.status-actions .btn-secondary,
.status-actions .btn-primary {
    width: 100%;
    display: inline-flex;
    justify-content: center;
    padding: 10px;
    align-items: center;
}

/* Desktop Styles (v16.3.22) */
@media (min-width: 600px) {
    .public-status-card {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        padding: 1.5rem;
    }

    .status-actions {
        flex-direction: row;
        width: auto;
    }

    .status-actions .btn-secondary,
    .status-actions .btn-primary {
        width: auto;
    }
}

/* Welcome Page New Sections (v17.2.5) */
.p-problem-solution ul li {
    position: relative;
    padding-left: 30px;
    margin-bottom: 15px;
    font-size: 1.1rem;
    color: #475569;
    line-height: 1.4;
}

.p-problem-solution ul li::before {
    content: "✕";
    position: absolute;
    left: 0;
    color: #ef4444;
    font-weight: 900;
}

.p-faq-item h3 {
    cursor: pointer;
    transition: color 0.2s;
}

.p-faq-item h3:hover {
    color: var(--p-primary);
}

/* Akordeony ustawień nauczyciela */
.acc-settings-toggle {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    background: none;
    border: none;
    border-bottom: 1px solid #e9ecef;
    padding: 12px 0;
    cursor: pointer;
    font-size: 1.1rem;
    font-weight: 700;
    color: inherit;
    text-align: left;
    margin-bottom: 0;
}
.acc-settings-toggle:hover { opacity: 0.8; }
.acc-settings-label { flex: 1; }
.acc-settings-chevron { transition: transform 0.2s; font-size: 1.3rem; color: #fde047; -webkit-text-stroke: 1.5px black; flex-shrink: 0; align-self: flex-start; margin-left: 8px; margin-top: 0; }
.acc-settings-body { display: none; padding-top: 15px; }
.acc-settings-body.open { display: block; background: #fef9c3; padding: 12px 10px 15px; border-radius: 0 0 8px 8px; margin-bottom: 8px; }
.acc-settings-toggle:has(+ .acc-settings-body.open) { background: #fef9c3; border-bottom-color: transparent; border-radius: 8px 8px 0 0; padding-left: 10px; padding-right: 10px; }
@media (max-width: 480px) {
    .acc-settings-toggle { font-size: 0.88rem; }
}

/* Akordeon Opiekuna 2 */
.accordion-parent2 {
    background: #f8f9fa;
    border-radius: 8px;
    margin: 15px 0;
    border: 1px solid #e9ecef;
    overflow: hidden;
}
.accordion-parent2-toggle {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    color: var(--secondary-color);
    font-weight: 600;
    text-align: left;
}
.accordion-parent2-toggle:hover { background: #f0f0f0; }
.accordion-chevron { transition: transform 0.2s; font-size: 1.3rem; color: #fde047; -webkit-text-stroke: 1.5px black; }
.accordion-parent2-body { display: none; padding: 0 15px 15px; }
.accordion-parent2-body.open { display: block; background: #fef9c3; }

/* Akordeony karty ucznia (v20.8.3) */
.acc-card-toggle {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: none;
    border: none;
    border-top: 1px dashed #e2e8f0;
    cursor: pointer;
    padding: 10px 0 0;
    margin-top: 12px;
    font-size: 0.82rem;
    color: #64748b;
    text-align: left;
}
.acc-card-toggle:hover { color: #334155; }
.acc-card-label { flex: 1; }
.acc-card-chevron { flex-shrink: 0; transition: transform 0.2s; font-size: 1.3rem; color: #fde047; -webkit-text-stroke: 1.5px black; margin-left: 8px; }
.acc-card-toggle[aria-expanded="true"] .acc-card-chevron { transform: rotate(90deg); }
.acc-card-body { padding-top: 12px; }
.acc-card-toggle[aria-expanded="true"] + .acc-card-body { background: #fef9c3; padding: 10px; border-radius: 0 0 8px 8px; }

/* v20.12.2: Podpowiedź pod polem stawki w karcie ucznia.
   Mobile first — pełna szerokość, zawijanie, nie wypycha układu rzędu z ceną/walutą/długością. */
.reprice-hint {
    background: #fff9db;
    border: 1px solid #ffeeba;
    border-left: 4px solid #f0c040;
    color: #856404;
    border-radius: 8px;
    padding: 10px 12px;
    margin: -6px 0 15px 0;
    font-size: 0.85rem;
    line-height: 1.45;
}
