:root {
    --bg: #f4f6fb;
    --card: #ffffff;
    --primary: #2f5dff;
    --primary-dark: #1e3cb8;
    --text: #1f2933;
    --muted: #6b7280;
    --border: #e2e8f0;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg);
    color: var(--text);
}

.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
    background: var(--card);
    border-bottom: 1px solid var(--border);
}

.brand {
    font-weight: 700;
    font-size: 1.3rem;
}

.nav-links a {
    margin-left: 1rem;
    text-decoration: none;
    color: var(--primary);
    font-weight: 500;
}

.nav-links {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
}

.nav-links .nav-cta {
    background: var(--primary);
    color: #fff;
    padding: 0.4rem 0.9rem;
    border-radius: 0.6rem;
}

.nav-links .nav-cta:hover {
    color: #fff;
}

.content {
    max-width: 1100px;
    margin: 2rem auto;
    padding: 0 1rem 2rem;
}

.flash-container {
    margin-bottom: 1rem;
}

.flash {
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    margin-bottom: 0.5rem;
}

.flash.success { background: #dcfce7; color: #14532d; }
.flash.info { background: #e0f2fe; color: #0c4a6e; }
.flash.danger { background: #fee2e2; color: #991b1b; }

.login-box {
    max-width: 400px;
    margin: 4rem auto;
    padding: 2rem;
    background: var(--card);
    border-radius: 1rem;
    box-shadow: 0 15px 35px rgba(15, 23, 42, 0.08);
}

.login-box h1 {
    text-align: center;
    margin-top: 0;
}

.form-card {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

label {
    font-size: 0.9rem;
    color: var(--muted);
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="month"],
textarea,
select {
    width: 100%;
    padding: 0.75rem;
    border-radius: 0.6rem;
    border: 1px solid var(--border);
    font-size: 1rem;
    font-family: inherit;
}

textarea {
    resize: vertical;
}

button {
    padding: 0.85rem 1.3rem;
    border: none;
    border-radius: 0.7rem;
    background: var(--primary);
    color: #fff;
    font-size: 1rem;
    cursor: pointer;
    font-weight: 600;
    transition: background 0.2s ease;
}

button.secondary {
    background: #e5e7eb;
    color: #111827;
}

button:hover {
    background: var(--primary-dark);
}

button.secondary:hover {
    background: #cbd5f5;
}

.panel {
    background: var(--card);
    border-radius: 1rem;
    padding: 2rem;
    box-shadow: 0 20px 40px rgba(15, 23, 42, 0.08);
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
}

.user-pill {
    padding: 0.6rem 1rem;
    background: #eef2ff;
    border-radius: 999px;
    font-weight: 600;
}

.table-wrapper {
    overflow-x: auto;
}

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

.entry-table th,
.entry-table td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    margin-top: 1rem;
}

.month-selector {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin: 1.5rem 0;
}

.export-card {
    border: 1px solid var(--border);
    border-radius: 0.9rem;
    padding: 1.25rem;
    background: #fff;
    box-shadow: 0 10px 25px rgba(15, 23, 42, 0.06);
    margin-bottom: 2rem;
}

.export-card h3 {
    margin: 0 0 0.4rem;
}

.export-card p {
    margin: 0 0 1rem;
    color: var(--muted);
}

.export-form {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    align-items: flex-end;
}

.schedule-card {
    border: 1px solid var(--border);
    border-radius: 1rem;
    padding: 1.25rem;
    background: #fff;
    box-shadow: 0 15px 30px rgba(15, 23, 42, 0.06);
    margin-bottom: 2rem;
}

.schedule-header h3 {
    margin: 0;
}

.schedule-form {
    margin-top: 1rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.schedule-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
}

.schedule-field {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    font-weight: 600;
    color: var(--text);
}

.schedule-field span {
    font-size: 0.95rem;
}

.schedule-actions {
    display: flex;
    justify-content: flex-end;
}

.export-field {
    flex: 1;
    min-width: 200px;
}

.export-actions {
    display: flex;
    align-items: flex-end;
}

.calendar-card {
    border: 1px solid var(--border);
    border-radius: 1rem;
    padding: 1rem;
    margin-bottom: 2rem;
}

.calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.calendar-header a {
    text-decoration: none;
    color: var(--primary);
    font-weight: 600;
}

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

.calendar-table th,
.calendar-table td {
    text-align: center;
    padding: 0;
    border: 1px solid var(--border);
}

.calendar-table td.other-month {
    background: #f9fafb;
    color: var(--muted);
}

.calendar-table td.has-data {
    background: #eef2ff;
    position: relative;
}

.calendar-day {
    min-width: 110px;
    padding: 0;
}

.day-link {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    text-decoration: none;
    color: inherit;
    padding: 0.65rem 0.35rem;
    min-height: 70px;
    width: 100%;
    height: 100%;
    transition: background 0.2s ease;
    cursor: pointer;
}

.calendar-day.selected-day {
    outline: 2px solid var(--primary);
    outline-offset: -2px;
    box-shadow: inset 0 0 0 2px rgba(47, 93, 255, 0.15);
}

.calendar-day:not(.selected-day) .day-link:hover {
    background: rgba(47, 93, 255, 0.08);
}

.calendar-day .day-link:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

.day-number {
    font-weight: 600;
}

.day-count {
    font-size: 0.8rem;
    color: var(--primary-dark);
}

.selected-day-card {
    border: 1px solid var(--border);
    border-radius: 0.9rem;
    padding: 1.25rem;
    margin-bottom: 2rem;
    background: #fafbff;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

.selected-day-header {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: baseline;
}

.link-clear {
    align-self: center;
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
}

.professor-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1rem;
    margin-top: 1.5rem;
}

.prof-card {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 0.85rem;
    padding: 1rem;
    box-shadow: 0 10px 20px rgba(15, 23, 42, 0.05);
}

.prof-card-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 0.75rem;
}

.prof-name {
    font-size: 1.05rem;
    font-weight: 600;
}

.prof-count {
    font-size: 0.9rem;
    color: var(--muted);
}

.student-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.student-item {
    border-top: 1px solid var(--border);
    padding-top: 0.75rem;
}

.student-item:first-child {
    border-top: none;
    padding-top: 0;
}

.student-info {
    display: flex;
    justify-content: space-between;
    gap: 0.5rem;
    flex-wrap: wrap;
    font-weight: 600;
}

.student-name {
    font-size: 1rem;
}

.student-class {
    font-size: 0.9rem;
    color: var(--muted);
    background: #eef2ff;
    border-radius: 999px;
    padding: 0.1rem 0.65rem;
}

.student-work {
    margin-top: 0.35rem;
    font-size: 0.95rem;
    color: var(--text);
    line-height: 1.4;
}

.pending-panel {
    margin-bottom: 2rem;
}

.pending-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.pending-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.pending-card {
    border: 1px solid var(--border);
    border-radius: 0.85rem;
    padding: 1rem;
    background: #f9fafb;
}

.pending-info {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.pending-name {
    font-size: 1.05rem;
    font-weight: 600;
}

.pending-meta,
.pending-signature {
    font-size: 0.9rem;
    color: var(--muted);
}

.signature-preview {
    display: block;
    margin-top: 0.35rem;
    max-width: 220px;
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    background: #fff;
}

.pending-fields {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.pending-fields label {
    display: flex;
    flex-direction: column;
    font-size: 0.9rem;
    color: var(--muted);
    gap: 0.3rem;
}

.validated-list {
    margin-top: 1.5rem;
    background: #fff;
    border: 1px dashed var(--border);
    border-radius: 0.75rem;
    padding: 1rem;
}

.validated-list ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.validated-list small {
    display: block;
    color: var(--muted);
}

.empty-state {
    margin: 1rem 0;
    color: var(--muted);
}

.kiosk-panel {
    max-width: 480px;
    margin: 1rem auto 3rem;
    background: var(--card);
    border-radius: 1.5rem;
    padding: 2rem;
    box-shadow: 0 15px 40px rgba(15, 23, 42, 0.12);
    text-align: center;
}

.kiosk-badge {
    display: inline-flex;
    padding: 0.3rem 0.9rem;
    border-radius: 999px;
    background: #eef2ff;
    color: var(--primary-dark);
    font-weight: 600;
}

.kiosk-title {
    margin: 0.5rem 0 0;
    font-size: 1.8rem;
}

.kiosk-date {
    margin: 0.25rem 0 1.5rem;
    color: var(--muted);
    font-weight: 600;
}

.kiosk-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    text-align: left;
}

.kiosk-form label span {
    font-size: 0.95rem;
    font-weight: 600;
}

.kiosk-form input {
    font-size: 1.1rem;
}

.signature-field {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.signature-field canvas {
    width: 100%;
    border: 2px dashed var(--border);
    border-radius: 0.75rem;
    background: #fff;
}

.signature-actions {
    display: flex;
    justify-content: flex-end;
}

.kiosk-form button {
    font-size: 1.1rem;
}

.kiosk-note {
    margin-top: 1.2rem;
    color: var(--muted);
    font-size: 0.95rem;
}

.kiosk-login-btn {
    display: inline-block;
    margin-top: 1rem;
    padding: 0.8rem 1.4rem;
    border-radius: 999px;
    background: var(--primary);
    color: #fff;
    text-decoration: none;
    font-weight: 600;
}

.kiosk-login-btn:hover {
    color: #fff;
    background: var(--primary-dark);
}

.entries-list .session-block {
    margin-bottom: 2rem;
}

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

.data-table th,
.data-table td {
    border-bottom: 1px solid var(--border);
    padding: 0.65rem;
}

.data-table th {
    text-align: left;
    text-transform: uppercase;
    font-size: 0.8rem;
    letter-spacing: 0.04em;
    color: var(--muted);
}

.data-table td {
    vertical-align: top;
}

.history-table {
    margin-top: 2rem;
}

.history-table .session-block {
    margin-bottom: 1.5rem;
}

@media (max-width: 700px) {
    .app-header {
        flex-direction: column;
        gap: 0.5rem;
    }

    .panel {
        padding: 1.25rem;
    }

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

    .kiosk-panel {
        margin: 0.5rem;
        padding: 1.5rem;
        border-radius: 1rem;
    }

    .pending-card {
        padding: 0.85rem;
    }
}
