* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: #f4f6f9;
    color: #1f2937;
}

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

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

.sidebar {
    width: 250px;
    background: #1f2a44;
    color: white;
    display: flex;
    flex-direction: column;
    position: fixed;
    inset: 0 auto 0 0;
}

.sidebar-brand {
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid rgba(255,255,255,.1);
}

.sidebar-brand strong {
    display: block;
    font-size: 18px;
}

.sidebar-brand span {
    display: block;
    font-size: 12px;
    opacity: .7;
}

.brand-icon {
    width: 42px;
    height: 42px;
    border-radius: 11px;
    background: white;
    color: #1f2a44;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
}

.sidebar-nav {
    padding: 18px 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.sidebar-nav a {
    padding: 11px 14px;
    border-radius: 8px;
    opacity: .85;
}

.sidebar-nav a:hover,
.sidebar-nav a.active {
    background: rgba(255,255,255,.12);
    opacity: 1;
}

.sidebar-footer {
    margin-top: auto;
    padding: 18px;
    border-top: 1px solid rgba(255,255,255,.1);
}

.user-summary strong,
.user-summary span {
    display: block;
}

.user-summary span {
    font-size: 12px;
    opacity: .7;
    margin-top: 3px;
    overflow-wrap: anywhere;
}

.logout-button {
    width: 100%;
    margin-top: 14px;
    border: 1px solid rgba(255,255,255,.25);
    background: transparent;
    color: white;
    padding: 9px;
    border-radius: 7px;
    cursor: pointer;
}

.main-content {
    margin-left: 250px;
    width: calc(100% - 250px);
}

.topbar {
    min-height: 78px;
    display: flex;
    align-items: center;
    background: white;
    border-bottom: 1px solid #e5e7eb;
    padding: 0 32px;
}

.topbar h1 {
    margin: 0;
    font-size: 23px;
}

.content {
    padding: 32px;
}

.welcome h2 {
    margin-bottom: 4px;
}

.welcome p {
    margin-top: 0;
    color: #6b7280;
}

.cards {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 18px;
    margin: 28px 0;
}

.card,
.panel {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
}

.card {
    padding: 22px;
}

.card-label {
    display: block;
    color: #6b7280;
    margin-bottom: 10px;
}

.card-number {
    font-size: 32px;
}

.panel {
    padding: 24px;
}

.page-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 22px;
}

.page-actions h2 {
    margin: 0 0 4px;
}

.page-actions p {
    margin: 0;
    color: #6b7280;
}

.button-primary,
.button-secondary {
    display: inline-block;
    padding: 11px 16px;
    border-radius: 8px;
    border: 0;
    cursor: pointer;
    font-weight: 600;
}

.button-primary {
    background: #1f2a44;
    color: white;
}

.button-secondary {
    background: #e5e7eb;
    color: #1f2937;
}

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

.data-table th,
.data-table td {
    text-align: left;
    padding: 13px 10px;
    border-bottom: 1px solid #e5e7eb;
}

.data-table th {
    color: #6b7280;
    font-size: 13px;
}

.badge {
    display: inline-block;
    background: #eef2ff;
    padding: 5px 8px;
    border-radius: 999px;
    font-size: 12px;
    margin-right: 4px;
}

.status-active {
    color: #047857;
    font-weight: 600;
}

.status-inactive {
    color: #b91c1c;
    font-weight: 600;
}

.form-panel {
    max-width: 760px;
}

label {
    display: block;
    margin: 18px 0 7px;
    font-weight: 600;
}

input,
select {
    width: 100%;
    padding: 12px 13px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 15px;
}

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

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 24px;
}

.alert {
    background: #fee2e2;
    color: #991b1b;
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 16px;
}

.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.login-card {
    width: 100%;
    max-width: 420px;
    background: white;
    border-radius: 18px;
    padding: 40px;
    box-shadow: 0 12px 40px rgba(0,0,0,.08);
}

.login-card .brand {
    text-align: center;
    margin-bottom: 32px;
}

.login-card button {
    width: 100%;
    margin-top: 24px;
    padding: 14px;
    border: 0;
    border-radius: 9px;
    background: #1f2a44;
    color: white;
    font-size: 16px;
    font-weight: 600;
}

.google-placeholder {
    margin-top: 22px;
    padding-top: 20px;
    border-top: 1px solid #e5e7eb;
    text-align: center;
    color: #9ca3af;
}

.google-placeholder span {
    display: block;
    font-size: 12px;
}

@media (max-width: 900px) {
    .cards {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 700px) {
    .sidebar {
        width: 200px;
    }

    .main-content {
        margin-left: 200px;
        width: calc(100% - 200px);
    }

    .cards,
    .form-grid {
        grid-template-columns: 1fr;
    }
}

textarea {
    width: 100%;
    padding: 12px 13px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 15px;
    font-family: inherit;
    resize: vertical;
}

.muted {
    color: #6b7280;
}

.breadcrumb {
    color: #6b7280;
    font-size: 14px;
    margin: 0 0 22px;
}

.breadcrumb a {
    color: #374151;
    font-weight: 600;
}

.subject-header,
.session-editor-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 24px;
    margin-bottom: 28px;
}

.subject-header h2,
.session-editor-header h2 {
    margin: 5px 0;
}

.units-list {
    display: flex;
    flex-direction: column;
    gap: 22px;
}

.unit-card {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    overflow: hidden;
}

.unit-header {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    padding: 22px 24px;
    background: #fafafa;
    border-bottom: 1px solid #e5e7eb;
}

.unit-header h3 {
    margin: 4px 0;
}

.unit-header p {
    margin: 7px 0 0;
    color: #6b7280;
}

.unit-number,
.session-number,
.block-number {
    font-size: 12px;
    font-weight: 700;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: .05em;
}

.unit-actions,
.session-actions,
.session-editor-actions {
    display: flex;
    align-items: center;
    gap: 9px;
}

.sessions-list {
    padding: 0 24px;
}

.session-row {
    min-height: 66px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    border-bottom: 1px solid #e5e7eb;
}

.session-row:last-child {
    border-bottom: 0;
}

.session-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.session-info a:hover {
    text-decoration: underline;
}

.visibility {
    display: inline-block;
    padding: 5px 9px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
}

.visibility.visible {
    background: #d1fae5;
    color: #047857;
}

.visibility.hidden {
    background: #f3f4f6;
    color: #6b7280;
}

.small-button {
    border: 1px solid #d1d5db;
    background: white;
    padding: 6px 10px;
    border-radius: 7px;
    cursor: pointer;
}

.unit-footer {
    padding: 16px 24px;
    border-top: 1px solid #e5e7eb;
    background: #fafafa;
}

.empty-inline {
    padding: 22px 0;
    color: #9ca3af;
}

.empty-state {
    padding: 60px 30px;
    background: white;
    border: 1px dashed #d1d5db;
    border-radius: 14px;
    text-align: center;
}

.empty-state p {
    color: #6b7280;
    margin-bottom: 24px;
}

.checkbox-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.checkbox-row input {
    width: auto;
}

.form-help {
    margin-top: 7px;
    color: #6b7280;
    font-size: 13px;
}

.session-blocks {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.pedagogical-block {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    padding: 22px 24px;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
}

.pedagogical-block h3 {
    margin: 4px 0;
}

.pedagogical-block p {
    margin: 0;
    color: #6b7280;
}

.highlight-block {
    border-left: 4px solid #1f2a44;
}

.coming-soon {
    white-space: nowrap;
    color: #9ca3af;
    font-size: 13px;
}

@media (max-width: 800px) {
    .subject-header,
    .unit-header,
    .session-editor-header,
    .session-row {
        flex-direction: column;
    }

    .unit-actions,
    .session-actions,
    .session-editor-actions {
        align-items: flex-start;
        flex-wrap: wrap;
    }
}

.danger-button {
    border-color: #fecaca;
    background: #fff;
    color: #b91c1c;
}

.danger-button:hover {
    background: #fef2f2;
}
