* {
    box-sizing: border-box;
}

[hidden] {
    display: none !important;
}

html {
    height: 100%;
}

body {
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background-color: #ffffff;
    color: #111111;
    font-family: Arial, sans-serif;
}

.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 10px;
}

header {
    background-color: #ffffff;
    padding: 10px 0;
    text-align: center;
}

.header-bar {
    position: relative;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    min-height: 40px;
}

.header-session {
    position: absolute;
    top: 0;
    right: 0;
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-nav {
    position: absolute;
    top: 0;
    left: 0;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    z-index: 10;
}

.header-logo {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    flex: 1;
}

.header-logo img {
    max-width: 100%;
    height: auto;
}

.main-content-title {
    margin: 0;
    font-size: 36px;
    font-weight: 700;
    color: #111111;
    text-align: center;
    background: transparent;
}

main {
    flex: 1 0 auto;
    background-color: #ffffff;
    padding: 20px 0;
}

.main-content {
    min-height: 10px;
    display: flex;
    justify-content: center;
    align-items: flex-start;
}

.auth-card {
    width: 100%;
    max-width: 420px;
    padding: 24px 20px;
    border: 1px solid #d8d8d8;
    border-radius: 12px;
    background-color: #ffffff;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
}

.auth-title {
    margin: 0 0 16px;
    font-size: 28px;
    font-weight: 700;
    text-align: center;
    color: #111111;
}

.auth-message {
    margin: 0 0 14px;
    padding: 10px 12px;
    border-radius: 8px;
    font-size: 14px;
    line-height: 1.4;
    text-align: center;
}

.auth-message--ok {
    background-color: #e8f5e9;
    color: #1b5e20;
    border: 1px solid #a5d6a7;
}

.auth-message--err {
    background-color: #ffebee;
    color: #b71c1c;
    border: 1px solid #ef9a9a;
}

.auth-message--info {
    background-color: #e3f2fd;
    color: #0d47a1;
    border: 1px solid #90caf9;
}

.auth-role {
    margin: 0 0 12px;
    font-size: 14px;
    font-weight: 600;
    text-align: center;
    color: #444444;
}

.auth-role--admin {
    color: #b71c1c;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.auth-label {
    font-size: 14px;
    font-weight: 600;
    color: #222222;
}

.auth-input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #c9c9c9;
    border-radius: 8px;
    font-size: 16px;
    color: #111111;
    background-color: #ffffff;
}

.auth-input:focus {
    outline: none;
    border-color: #4a7cff;
    box-shadow: 0 0 0 3px rgba(74, 124, 255, 0.2);
}

.auth-button {
    margin-top: 6px;
    padding: 12px;
    border: none;
    border-radius: 8px;
    background-color: #1f5eff;
    color: #ffffff;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
}

.auth-button:hover {
    background-color: #1848c7;
}

.auth-logout {
    display: block;
    width: 100%;
    margin-top: 12px;
    padding: 10px;
    border: 1px solid #c9c9c9;
    border-radius: 8px;
    background: #ffffff;
    color: #333333;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
}

.auth-logout:hover {
    background: #f5f5f5;
}

.auth-back {
    margin: 14px 0 0;
    text-align: center;
}

.auth-back-link {
    font-size: 14px;
    font-weight: 600;
    color: #1f5eff;
    text-decoration: none;
}

.auth-back-link:hover {
    text-decoration: underline;
}

.stub-card {
    width: 100%;
    max-width: 480px;
    margin: 0 auto;
    padding: 28px 22px;
    border: 1px solid #d8d8d8;
    border-radius: 12px;
    background-color: #ffffff;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
}

.stub-title {
    margin: 0 0 10px;
    font-size: 26px;
    font-weight: 700;
    text-align: center;
    color: #111111;
}

.stub-lead {
    margin: 0 0 20px;
    font-size: 15px;
    line-height: 1.5;
    text-align: center;
    color: #444444;
}

.stub-user {
    margin: 0 0 20px;
    padding: 16px;
    border-radius: 10px;
    background: #f7f8fa;
}

.stub-row {
    display: grid;
    grid-template-columns: 110px 1fr;
    gap: 8px 16px;
    padding: 8px 0;
    border-bottom: 1px solid #e4e6eb;
}

.stub-row:last-child {
    border-bottom: none;
}

.stub-row dt {
    margin: 0;
    font-size: 13px;
    font-weight: 700;
    color: #666666;
}

.stub-row dd {
    margin: 0;
    font-size: 15px;
    font-weight: 600;
    color: #111111;
}

.stub-role {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 999px;
    font-size: 14px;
    font-weight: 700;
    background: #e3f2fd;
    color: #0d47a1;
}

.stub-role--admin {
    background: #ffebee;
    color: #b71c1c;
}

.stub-role--ppe {
    background: #e8f5e9;
    color: #1b5e20;
}

.stub-note {
    margin: 0 0 18px;
    font-size: 14px;
    text-align: center;
    color: #666666;
}

.stub-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: stretch;
}

.stub-link {
    display: block;
    padding: 10px;
    border-radius: 8px;
    border: 1px solid #c9c9c9;
    text-align: center;
    font-size: 15px;
    font-weight: 600;
    color: #1f5eff;
    text-decoration: none;
}

.stub-link:hover {
    background: #f5f7ff;
}

.stub-logout {
    margin-top: 0;
}

.container--wide {
    max-width: 1280px;
}

.main-content--wide {
    width: 100%;
    max-width: none;
    justify-content: flex-start;
}

.admin-app {
    width: 100%;
    padding-bottom: 24px;
}

.admin-error {
    margin: 0 0 12px;
    padding: 12px;
    border-radius: 8px;
    background: #ffebee;
    color: #b71c1c;
    font-size: 14px;
    text-align: center;
}

.admin-top {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 4px;
}

.admin-user-chip {
    font-size: 14px;
    color: #444444;
    font-weight: 600;
}

.admin-logout {
    padding: 8px 14px;
    border: 1px solid #c9c9c9;
    border-radius: 8px;
    background: #ffffff;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}

.admin-logout:hover {
    background: #f5f5f5;
}

.admin-subjects {
    display: flex;
    flex-direction: column;
    gap: 10px;
    justify-content: center;
    align-items: stretch;
    flex: 1;
    min-width: 0;
}

.admin-subject-group {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    justify-content: center;
}

.admin-subject-group-label {
    font-size: 13px;
    font-weight: 700;
    color: #37474f;
    white-space: nowrap;
}

.admin-subject-group-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
}

.admin-subject-sep {
    width: 100%;
    height: 1px;
    background: #90a4ae;
    margin: 2px 0;
    flex-shrink: 0;
}

.admin-subject-tab {
    padding: 10px 14px;
    border: none;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.02em;
    color: #ffffff;
    cursor: pointer;
    background: linear-gradient(135deg, #6a5acd 0%, #4169e1 55%, #1e88e5 100%);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.admin-subject-tab:hover {
    filter: brightness(1.08);
}

.admin-subject-tab.is-active {
    outline: 3px solid #ffd54f;
    outline-offset: 2px;
}

.admin-subject-tab.is-submitted:not(.is-active) {
    opacity: 0.72;
    box-shadow: inset 0 0 0 2px rgba(46, 125, 50, 0.85);
}

.admin-nav-links {
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: stretch;
    margin: 0;
}

.admin-home-link,
.admin-schedule-link {
    display: block;
    padding: 8px 18px;
    border-radius: 8px;
    background: #2e7d32;
    color: #ffffff;
    font-size: 13px;
    font-weight: 700;
    text-decoration: none;
    text-align: center;
    white-space: nowrap;
}

.admin-schedule-link {
    background: #1565c0;
}

.admin-schedule-link:hover {
    background: #0d47a1;
}

.admin-exam-date {
    margin: 0 0 8px;
    font-size: 15px;
    font-weight: 600;
    text-align: center;
    color: #333333;
}

.exams-card {
    width: 100%;
    max-width: 960px;
    margin: 0 auto;
    padding: 24px 20px;
    border: 1px solid #d8d8d8;
    border-radius: 12px;
    background: #ffffff;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
}

.exams-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 16px;
}

.exams-form {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px 16px;
    margin-bottom: 28px;
}

.exams-form .auth-button {
    grid-column: 1 / -1;
}

.exams-list-title {
    margin-top: 8px;
}

.exams-import-block {
    margin: 20px 0 8px;
    padding-top: 16px;
    border-top: 1px solid #e8e8e8;
}

.exams-import-hint {
    margin: 0;
    font-size: 13px;
    color: #666666;
    line-height: 1.45;
}

.calendar-card {
    max-width: 880px;
}

.calendar-nav-links {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.calendar-picker {
    max-width: 420px;
    margin: 0 auto 16px;
}

.calendar-date-select {
    width: 100%;
}

.calendar-summary {
    text-align: center;
    font-size: 16px;
    font-weight: 600;
    margin: 0 0 16px;
    color: #333333;
}

.calendar-groups {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.calendar-group-title {
    margin: 0 0 8px;
    font-size: 15px;
    font-weight: 700;
    color: #37474f;
}

.calendar-hint {
    margin: 18px 0 0;
    text-align: center;
}

.calendar-table td {
    font-size: 14px;
}

@media (max-width: 640px) {
    .exams-form {
        grid-template-columns: 1fr;
    }
}

.admin-home-link:hover {
    background: #1b5e20;
}

.admin-page-title {
    margin: 8px 0 6px;
    font-size: 28px;
    font-weight: 800;
    text-align: center;
    color: #111111;
}

.admin-stats {
    margin: 0 0 14px;
    font-size: 14px;
    font-weight: 600;
    text-align: right;
    color: #333333;
}

.admin-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 12px;
}

.admin-btn {
    padding: 10px 18px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
}

.admin-btn--ok {
    background: #2e7d32;
    color: #ffffff;
}

.admin-btn--ok:hover {
    background: #1b5e20;
}

.admin-btn--danger {
    background: #c62828;
    color: #ffffff;
}

.admin-btn--danger:hover {
    background: #8e0000;
}

.admin-table-wrap {
    overflow-x: auto;
    border: 1px solid #bdbdbd;
    border-radius: 4px;
    background: #ffffff;
}

.admin-table {
    width: 100%;
    min-width: 900px;
    border-collapse: collapse;
    font-size: 13px;
}

.admin-th {
    padding: 12px 10px;
    text-align: left;
    font-weight: 700;
    color: #ffffff;
    background: linear-gradient(180deg, #1e88e5 0%, #1565c0 100%);
    border-right: 1px solid rgba(255, 255, 255, 0.25);
}

.admin-th:last-child {
    border-right: none;
}

.admin-th--ppe {
    min-width: 120px;
}

.admin-th--narrow {
    width: 72px;
    text-align: center;
}

.admin-th-ico {
    font-size: 10px;
    opacity: 0.85;
    margin-left: 4px;
}

.admin-table tbody tr:nth-child(even) {
    background: #f5f9fc;
}

.admin-table tbody tr.admin-row--ready,
.admin-table tbody tr.admin-row--ready:nth-child(even) {
    background-color: #e8f5e9;
}

.admin-table tbody tr.admin-row--error,
.admin-table tbody tr.admin-row--error:nth-child(even) {
    background-color: #ffebee;
}

.admin-table tbody tr.admin-row--saving {
    outline: 2px solid #ffb74d;
    outline-offset: -2px;
}

.admin-table tbody tr.admin-row--ready:hover,
.admin-table tbody tr.admin-row--ready:nth-child(even):hover {
    background-color: #dcefdc;
}

.admin-table td {
    padding: 6px 8px;
    border-bottom: 1px solid #e0e0e0;
    vertical-align: middle;
}

.admin-td-check {
    text-align: center;
    width: 90px;
}

.admin-cell-checkbox {
    width: 22px;
    height: 22px;
    cursor: pointer;
    accent-color: #1565c0;
}

.admin-cell {
    width: 100%;
    box-sizing: border-box;
    padding: 8px;
    border: 1px solid #cfd8dc;
    border-radius: 4px;
    font-size: 13px;
}

.admin-cell--ppe {
    font-weight: 600;
}

.admin-cell--textarea {
    min-height: 48px;
    resize: vertical;
    font-family: inherit;
}

.admin-cell--select {
    cursor: pointer;
}

.admin-td-del {
    text-align: center;
    width: 56px;
}

.admin-btn-remove {
    width: 36px;
    height: 36px;
    padding: 0;
    border: none;
    border-radius: 6px;
    background: #c62828;
    color: #ffffff;
    font-size: 20px;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
}

.admin-btn-remove:hover {
    background: #8e0000;
}

.ppe-app {
    width: 100%;
}

.ppe-top {
    margin-bottom: 12px;
    text-align: center;
}

.ppe-giaform {
    margin: 4px 0 0;
    font-size: 14px;
    font-weight: 600;
    text-align: center;
    color: #555555;
}

.ppe-subject-picker {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    margin-bottom: 14px;
}

.ppe-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 14px;
}

.ppe-status {
    display: inline-block;
    min-width: 7rem;
    padding: 8px 12px;
    border-radius: 8px;
    background: #f0f0f0;
    font-size: 14px;
    font-weight: 700;
    text-align: center;
    color: #333333;
}

.ppe-table td:last-child {
    text-align: center;
    vertical-align: middle;
}

#ppe-ready-btn:disabled {
    opacity: 0.65;
    cursor: not-allowed;
}

.ppe-notice {
    margin: 0 0 14px;
    padding: 12px 16px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.45;
}

.ppe-notice--success {
    background: #e8f5e9;
    border: 1px solid #81c784;
    color: #1b5e20;
}

.ppe-notice--info {
    background: #e3f2fd;
    border: 1px solid #64b5f6;
    color: #0d47a1;
}

footer {
    flex-shrink: 0;
    margin-top: auto;
    background-color: #7c7c7c;
    color: #ffffff;
    padding: 10px 0;
    text-align: center;
}