:root {
    --mifid-text: #1f2937;
    --mifid-muted: #6b7280;
    --mifid-border: #e5e7eb;
    --mifid-ring: rgba(200, 25, 36, 0.18);
    --mifid-accent: #c81924;
    --mifid-accent-dark: #9f121b;
    --mifid-shadow: 0 20px 50px rgba(17, 24, 39, 0.18);
}

html {
    font-size: 14px;
    min-height: 100%;
}

@media (min-width: 768px) {
    html {
        font-size: 16px;
    }
}

* {
    box-sizing: border-box;
}

body {
    background:
        radial-gradient(900px 600px at 15% 15%, rgba(200, 25, 36, 0.12), transparent 60%),
        radial-gradient(900px 600px at 85% 20%, rgba(17, 24, 39, 0.08), transparent 60%),
        linear-gradient(160deg, #ffffff, #f6f7f9);
    background-attachment: fixed;
    color: var(--mifid-text);
    display: flex;
    flex-direction: column;
    font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    margin: 0;
    min-height: 100vh;
}

a {
    color: var(--mifid-accent);
}

.box-shadow {
    box-shadow: 0 0.25rem 0.75rem rgba(17, 24, 39, 0.05);
}

.mifid-navbar {
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(10px);
}

.brand {
    font-size: 1.35rem;
    font-weight: 800;
    line-height: 1;
    margin-right: 1rem;
    white-space: nowrap;
}

.brand,
.brand:hover,
.brand:focus {
    text-decoration: none;
}

.brand-mifid {
    color: var(--mifid-accent);
}

.brand-report {
    color: #111827;
}

.navbar .nav-link {
    color: #293241;
    font-weight: 600;
}

.navbar .nav-link:hover,
.navbar .nav-link:focus {
    color: var(--mifid-accent);
}

.navbar .nav-link.active {
    background: rgba(200, 25, 36, 0.1);
    border-radius: 0.375rem;
    color: var(--mifid-accent);
}

.user-nav {
    gap: 0.75rem;
}

.user-name {
    color: var(--mifid-muted);
    font-size: 0.9rem;
}

.logout-form {
    margin: 0;
}

.page-shell {
    flex: 1 0 auto;
    max-width: 1320px;
    padding-bottom: 1.5rem;
    padding-top: 1.5rem;
    width: 100%;
}

.page-shell-full {
    max-width: none;
    padding-left: 0;
    padding-right: 0;
}

.page-header {
    margin-bottom: 1.5rem;
}

.page-title {
    color: #111827;
    font-size: 1.75rem;
    font-weight: 700;
    margin: 0 0 0.5rem;
}

.page-subtitle {
    color: var(--mifid-muted);
    margin: 0;
}

.panel {
    background: rgba(255, 255, 255, 0.94);
    border: 1px solid rgba(229, 231, 235, 0.86);
    border-radius: 0.5rem;
    box-shadow: 0 10px 30px rgba(17, 24, 39, 0.08);
    padding: 1.25rem;
}

.footer {
    border-top: 1px solid var(--mifid-border);
    flex-shrink: 0;
    font-size: 0.9rem;
    padding: 1rem 0;
}

.login-page {
    display: grid;
    min-height: 100vh;
    padding: 32px 16px;
    place-items: center;
}

.login-wrap {
    animation: login-enter 0.35s ease-out both;
    max-width: 430px;
    width: 100%;
}

.setup-wrap {
    max-width: 520px;
}

@keyframes login-enter {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

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

.login-card {
    background: rgba(255, 255, 255, 0.96);
    border: 1px solid rgba(226, 232, 240, 0.75);
    border-radius: 18px;
    box-shadow: var(--mifid-shadow);
    overflow: hidden;
    backdrop-filter: blur(10px);
}

.login-header {
    align-items: center;
    border-bottom: 1px solid rgba(226, 232, 240, 0.7);
    display: flex;
    gap: 12px;
    padding: 22px 22px 14px;
}

.login-mark {
    align-items: center;
    background: linear-gradient(135deg, var(--mifid-accent), #111827);
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(200, 25, 36, 0.18);
    color: #ffffff;
    display: flex;
    flex: 0 0 auto;
    font-weight: 800;
    height: 44px;
    justify-content: center;
    letter-spacing: 0.5px;
    width: 44px;
}

.login-title {
    font-size: 18px;
    font-weight: 700;
    line-height: 1.2;
    margin: 0;
}

.login-subtitle {
    color: var(--mifid-muted);
    font-size: 13px;
    margin: 4px 0 0;
}

.login-card form,
.setup-content {
    padding: 18px 22px 22px;
}

.setup-content {
    padding-bottom: 0;
}

.field {
    margin-top: 14px;
}

.field label,
.setup-content label {
    color: #334155;
    display: block;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 6px;
}

.input,
.manual-key {
    background: #ffffff;
    border: 1px solid var(--mifid-border);
    border-radius: 12px;
    font: inherit;
    outline: none;
    padding: 12px;
    width: 100%;
}

.input:focus {
    border-color: rgba(200, 25, 36, 0.75);
    box-shadow: 0 0 0 6px var(--mifid-ring);
}

.manual-key {
    color: #111827;
    font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
    word-break: break-all;
}

.btn-primary-action {
    background: linear-gradient(135deg, var(--mifid-accent), var(--mifid-accent-dark));
    border: 0;
    border-radius: 12px;
    box-shadow: 0 14px 30px rgba(200, 25, 36, 0.2);
    color: #ffffff;
    cursor: pointer;
    font: inherit;
    font-weight: 700;
    padding: 12px 14px;
    width: 100%;
}

.btn-primary-action:hover,
.btn-primary-action:focus {
    filter: brightness(1.03);
}

.login-error {
    background: rgba(200, 25, 36, 0.07);
    border: 1px solid rgba(200, 25, 36, 0.25);
    border-radius: 12px;
    color: var(--mifid-accent-dark);
    font-size: 13px;
    margin: 12px 22px 0;
    padding: 10px 12px;
}

.login-error:empty {
    display: none;
}

.validation-message,
.field-validation-error {
    color: var(--mifid-accent-dark);
    font-size: 12px;
}

.check-field label {
    align-items: center;
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0;
}

.qr-box {
    text-align: center;
}

.qr-box img {
    background: #ffffff;
    border: 1px solid var(--mifid-border);
    border-radius: 12px;
    max-width: 220px;
    padding: 0.5rem;
    width: 100%;
}

@media (max-width: 720px) {
    .user-nav {
        align-items: flex-start !important;
        margin-top: 0.75rem;
    }
}

.report-filter-panel {
    margin-bottom: 1rem;
}

.report-controls {
    width: 100%;
}

.report-filter-form {
    align-items: end;
    display: grid;
    gap: 1rem;
    grid-template-columns: minmax(18rem, 2fr) minmax(10rem, 1fr) minmax(10rem, 1fr) minmax(16rem, 1.2fr) auto;
}

.report-field label {
    color: #334155;
    display: block;
    font-size: 0.85rem;
    font-weight: 700;
    margin-bottom: 0.35rem;
}

.report-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.report-toolbar {
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
    margin: 1rem 0;
}

.report-table-wrap {
    background: rgba(255, 255, 255, 0.94);
    border: 1px solid rgba(229, 231, 235, 0.86);
    border-radius: 0.5rem;
    box-shadow: 0 10px 30px rgba(17, 24, 39, 0.08);
    min-width: 100%;
    overflow: visible;
    width: max-content;
}

.report-table {
    font-size: 0.86rem;
    margin-bottom: 0;
    min-width: 1200px;
    white-space: nowrap;
}

.report-table thead th {
    background: #f8fafc;
    position: sticky;
    top: 0;
    z-index: 1;
}

.report-table th,
.report-table td {
    padding: 0.75rem;
}

.course-settings-page {
    width: 100%;
}

.course-settings-filter {
    margin-bottom: 1rem;
}

.course-settings-filter label {
    color: #334155;
    display: block;
    font-size: 0.9rem;
    font-weight: 700;
    margin-bottom: 0.45rem;
}

.course-settings-filter .form-select {
    max-width: 56rem;
}

.course-settings-grid {
    display: grid;
    gap: 1rem;
    grid-template-columns: 1fr;
}

.course-settings-card-header {
    margin-bottom: 1rem;
}

.course-settings-card-header-actions {
    align-items: start;
    display: flex;
    gap: 1rem;
    justify-content: space-between;
}

.course-settings-card-header h2 {
    color: #111827;
    font-size: 1.15rem;
    font-weight: 700;
    margin: 0 0 0.35rem;
}

.course-settings-card-header p,
.empty-state {
    color: var(--mifid-muted);
    margin: 0;
}

.course-settings-table {
    font-size: 0.86rem;
    margin-bottom: 0;
    white-space: nowrap;
}

.course-settings-table thead th {
    background: #f8fafc;
    color: #334155;
    font-size: 0.8rem;
}

.course-settings-select {
    min-width: 18rem;
}

.course-settings-time-input {
    min-width: 7rem;
}

.course-settings-row-actions {
    align-items: center;
    display: flex;
    gap: 0.5rem;
}

.course-settings-row-actions form {
    margin: 0;
}

.course-settings-modal-fields {
    display: grid;
    gap: 1rem;
}

.course-settings-modal-fields label {
    color: #334155;
    display: block;
    font-size: 0.85rem;
    font-weight: 700;
    margin-bottom: 0.35rem;
}

@media (max-width: 1100px) {
    .report-filter-form {
        grid-template-columns: 1fr 1fr;
    }

    .report-actions {
        grid-column: 1 / -1;
    }
}

@media (max-width: 720px) {
    .report-filter-form {
        grid-template-columns: 1fr;
    }

    .report-toolbar {
        justify-content: flex-start;
    }
}
