* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: Arial, sans-serif;
    background: #f3f4f6;
    color: #111827;
}

.muted {
    color: #6b7280;
    margin-top: 16px;
}

.app {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 240px;
    background: #111827;
    color: white;
    padding: 20px;
}

.sidebar h2 {
    margin-top: 0;
    margin-bottom: 24px;
}

.nav-btn {
    display: block;
    width: 100%;
    padding: 12px;
    margin-bottom: 8px;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: #d1d5db;
    text-align: left;
    cursor: pointer;
}

.nav-btn:hover,
.nav-btn.active {
    background: #2563eb;
    color: white;
}

.nav-btn-highlight {
    background: #0f786c;
    color: #c7fefc;
    font-weight: 600;
    border: 1px solid #0bf5be;
}

.nav-btn-highlight:hover,
.nav-btn-highlight.active {
    background: #0bf5ca;
    color: #1f2937;
}

.nav-btn-highlight-guide {
    background: #3d4e06;
    color: #f5fad1;
    font-weight: 600;
    border: 1px solid #b0b910;
}

.nav-btn-highlight-guide:hover,
.nav-btn-highlight-guide.active {
    background: #b0b910;
    color: #1f2937;
}

.content {
    flex: 1;
    padding: 24px;
}

.topbar {
    background: white;
    padding: 20px;
    border-radius: 14px;
    margin-bottom: 20px;
}

.topbar h1 {
    margin: 0;
}

.tab {
    display: none;
}

.tab.active {
    display: block;
}

.card {
    background: white;
    padding: 20px;
    border-radius: 14px;
    margin-bottom: 20px;
}

input {
    display: block;
    width: 100%;
    max-width: 420px;
    padding: 10px;
    margin-bottom: 12px;
}

button {
    padding: 10px 14px;
    border: none;
    border-radius: 8px;
    background: #2563eb;
    color: white;
    cursor: pointer;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    border: 1px solid #d1d5db;
    padding: 10px;
    text-align: left;
}

th {
    background: #f3f4f6;
}


select {
    display: block;
    width: 100%;
    max-width: 420px;
    padding: 10px;
    margin-bottom: 12px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    background: white;
}

input {
    border: 1px solid #d1d5db;
    border-radius: 8px;
}

textarea {
    border: 1px solid #d1d5db;
    border-radius: 8px;
    padding: 8px;
    font-family: inherit;
    font-size: inherit;
    width: 100%;
    box-sizing: border-box;
    display: block;
    margin-bottom: 10px;
}

textarea:focus {
    outline: none;
    border-color: #2563eb;
}

.guide-admin-edit {
    background: #fffbeb;
    border: 1px dashed #f59e0b;
    margin-top: 20px;
}

.guide-editor-textarea {
    font-family: monospace;
    font-size: 13px;
}

input:focus,
select:focus {
    outline: none;
    border-color: #2563eb;
}

button:hover {
    background: #1d4ed8;
}

button:disabled {
    background: #9ca3af;
    cursor: not-allowed;
}

.danger-btn {
    background: #dc2626;
}

.danger-btn:hover {
    background: #b91c1c;
}

.card h3,
.card h4 {
    margin-top: 0;
}

.card hr {
    border: none;
    border-top: 1px solid #e5e7eb;
    margin: 18px 0;
}

.subgroup-form,
.availability-form {
    margin-top: 14px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 10px;
    align-items: center;
}

.subgroup-form input,
.availability-form input,
.availability-form select {
    margin-bottom: 0;
    max-width: none;
}

td button {
    margin-right: 6px;
    margin-bottom: 4px;
}

table {
    margin-top: 12px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 15px 0;
    cursor: pointer;
    font-size: 18px;
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin: 0;
    flex-shrink: 0;
}

.auth-form .checkbox-label {
    align-items: flex-start;
    font-size: 13px;
    line-height: 1.4;
    gap: 8px;
}

.auth-form .checkbox-label input[type="checkbox"] {
    width: 15px;
    height: 15px;
    margin-top: 2px;
}

.auth-form .checkbox-label a {
    font-size: 13px;
}

.generation-summary {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-top: 20px;
}

.generation-card,
.result-card {
    background: #ffffff;
    border: 1px solid #dddddd;
    border-radius: 12px;
    padding: 16px;
}

.generation-card strong {
    display: block;
    font-size: 28px;
    margin-top: 8px;
}

.generation-label {
    color: #666666;
    font-size: 14px;
}

.progress {
    height: 8px;
    background: #eeeeee;
    border-radius: 999px;
    overflow: hidden;
    margin-top: 12px;
}

.progress-fill {
    height: 100%;
    background: #222222;
}

.result-card {
    margin-top: 16px;
}

.result-card.success {
    border-color: #b7dfb7;
}

.result-card.warning {
    border-color: #e4c46a;
}

.result-card.error {
    border-color: #d66a6a;
}

.result-card ul {
    margin: 8px 0 0;
    padding-left: 20px;
}

.generation-loading {
    margin-top: 20px;
    padding: 16px;
    background: #ffffff;
    border: 1px solid #dddddd;
    border-radius: 12px;
}
@media (max-width: 900px) {
    .app {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
    }

    .content {
        padding: 16px;
    }
}

.schedule-table {
    width: 100%;
    border-collapse: collapse;
    background: #ffffff;
}

.schedule-table th,
.schedule-table td {
    border: 1px solid #dddddd;
    padding: 8px;
    vertical-align: top;
    text-align: left;
    font-size: 13px;
}

.schedule-table th {
    background: #f0f0f0;
}

.schedule-slot-label {
    white-space: nowrap;
    font-weight: bold;
    background: #fafafa;
}

.schedule-cell-lesson {
    margin-bottom: 8px;
    padding-bottom: 8px;
    border-bottom: 1px dashed #eeeeee;
}

.schedule-cell-lesson:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.schedule-cell-group {
    color: #666666;
    font-size: 12px;
}

#scheduleGroupFilter {
    display: flex;
    align-items: center;
    gap: 8px;
}

.auth-screen {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: #f0f2f5;
}

.auth-card {
    background: #ffffff;
    border-radius: 12px;
    padding: 32px;
    width: 340px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
}

.auth-tabs {
    display: flex;
    gap: 8px;
    margin: 16px 0;
}

.auth-tab-btn {
    flex: 1;
    padding: 8px;
    border: 1px solid #dddddd;
    background: #f5f5f5;
    border-radius: 8px;
    cursor: pointer;
}

.auth-tab-btn.active {
    background: #2563eb;
    color: white;
    border-color: #2563eb;
}

.auth-form input {
    display: block;
    width: 100%;
    margin-bottom: 10px;
    padding: 8px;
    box-sizing: border-box;
}

.auth-form button {
    width: 100%;
    padding: 10px;
}

.auth-error {
    color: #dc2626;
    margin-top: 10px;
    font-size: 13px;
}

.forgot-password-link {
    display: block;
    text-align: center;
    margin-top: 12px;
    font-size: 13px;
    color: #2563eb;
    text-decoration: none;
}

.forgot-password-link:hover {
    text-decoration: underline;
}

.terms-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
}

.terms-card {
    background: white;
    border-radius: 12px;
    padding: 32px;
    max-width: 600px;
    width: 100%;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
}

.terms-text {
    overflow-y: auto;
    flex: 1;
    margin: 16px 0;
    padding: 16px;
    background: #f9fafb;
    border-radius: 8px;
    font-size: 14px;
    line-height: 1.5;
}

.terms-text-inline {
    max-height: 180px;
    flex: none;
    font-size: 12px;
    margin: 12px 0;
}

.terms-page-card {
    max-width: 600px;
    width: 100%;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
}

.terms-page-card .terms-text {
    flex: 1;
    overflow-y: auto;
}

.terms-back-btn {
    align-self: flex-start;
    background: none !important;
    border: none !important;
    color: #2563eb !important;
    font-size: 14px !important;
    font-weight: normal !important;
    cursor: pointer;
    padding: 0 !important;
    margin-bottom: 12px;
    width: auto !important;
}

.terms-back-btn:hover {
    background: none !important;
    text-decoration: underline;
}

.terms-text h3 {
    margin-top: 16px;
    margin-bottom: 8px;
    font-size: 15px;
}

.terms-text h3:first-child {
    margin-top: 0;
}

.terms-text p {
    margin: 6px 0;
}

.terms-card .checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
    cursor: pointer;
}

.terms-card button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.account-info {
    color: #d1d5db;
    font-size: 13px;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid #374151;
}

.reference-subnav {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
}

.subnav-btn {
    padding: 8px 16px;
    border: 1px solid #dddddd;
    background: #cacaca;
    border-radius: 8px;
    cursor: pointer;
}

.subnav-btn.active {
    background: #2563eb;
    color: white;
    border-color: #2563eb;
}

.subtab {
    display: none;
}

.subtab.active {
    display: block;
}

.badge-own {
    background: #dbeafe;
    color: #1e40af;
    padding: 2px 8px;
    border-radius: 6px;
    font-size: 12px;
}

.badge-blocked {
    background: #fee2e2;
    color: #991b1b;
    padding: 2px 8px;
    border-radius: 6px;
    font-size: 12px;
}

.badge-warning {
    background: #fef3c7;
    color: #92400e;
    padding: 2px 8px;
    border-radius: 6px;
    font-size: 12px;
}

.admin-summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
}

.admin-summary-item {
    background: #f3f4f6;
    border-radius: 8px;
    padding: 14px;
    text-align: center;
}

.admin-summary-number {
    font-size: 28px;
    font-weight: 700;
    color: #1f2937;
}

.admin-summary-label {
    font-size: 13px;
    color: #6b7280;
    margin-top: 4px;
}

.admin-summary-item.admin-summary-warning {
    background: #fef3c7;
}

.admin-summary-item.admin-summary-warning .admin-summary-number {
    color: #92400e;
}

.admin-summary-item.admin-summary-overdue {
    background: #fee2e2;
}

.admin-summary-item.admin-summary-overdue .admin-summary-number {
    color: #991b1b;
}

.schedule-history-buttons {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

.schedule-history-buttons button {
    background: #f3f4f6;
    color: #374151;
    font-size: 13px;
    padding: 6px 12px;
}

.schedule-history-buttons button.active {
    background: #2563eb;
    color: white;
}

.payments-history {
    margin-top: 8px;
    font-size: 12px;
}

.payments-history-title {
    color: #6b7280;
    margin-bottom: 2px;
}

.payments-history ul {
    margin: 0;
    padding-left: 16px;
}

.badge-global {
    background: #f3f4f6;
    color: #4b5563;
    padding: 2px 8px;
    border-radius: 6px;
    font-size: 12px;
}

.muted {
    color: #4b5563;
    font-size: 14px;
}

.notice {
    color: #374151;
    font-size: 15px;
    background: #f3f4f6;
    padding: 10px 14px;
    border-radius: 8px;
    border-left: 3px solid #9ca3af;
    margin: 10px 0;
}

.notice.success {
    background: #dcfce7;
    color: #166534;
    border-left-color: #22c55e;
}

.notice.error {
    background: #fee2e2;
    color: #991b1b;
    border-left-color: #ef4444;
}

.working-days-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin: 16px 0;
}

.working-day-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 15px;
    cursor: pointer;
}

.working-day-item input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}
.generation-loading {
    text-align: center;
    padding: 30px 20px;
}

.spinner {
    width: 42px;
    height: 42px;
    margin: 0 auto 16px;
    border: 4px solid #e2e8f0;
    border-top-color: #2563eb;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}
