/* Loreto Reflections — global stylesheet aligned with docs/reflection-app.html */

* { box-sizing: border-box; }

:root {
    --bg-grad-1:    #EEF2FF;
    --bg-grad-2:    #FAF5FF;
    --bg-grad-3:    #F0FDFA;
    --sidebar-bg:   #FFFFFF;
    --card:         #FFFFFF;
    --ink:          #1E293B;
    --ink-strong:   #0F172A;
    --muted:        #94A3B8;
    --muted-2:      #64748B;
    --border:       #EEF0F4;
    --border-2:     #E9EBF0;
    --primary:      #2563EB;
    --primary-dark: #1D4ED8;
    --violet:       #7C3AED;
    --violet-soft:  #F3F0FF;
    --green:        #10B981;
    --green-soft:   #ECFDF5;
    --pink:         #EC4899;
    --pink-soft:    #FDF2F8;
    --orange:       #F97316;
    --orange-soft:  #FFF7ED;
    --blue-soft:    #EFF6FF;
    --shadow-card:  0 4px 20px rgba(15, 23, 42, 0.05);
    --shadow-soft:  0 2px 10px rgba(15, 23, 42, 0.04);
    --radius:       16px;
    --radius-sm:    10px;
}

.route-fade-in {
    animation: route-fade-in 320ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes route-fade-in {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
    .route-fade-in { animation: none; }
}

html, body {
    margin: 0;
    padding: 0;
    font-family: 'Inter', 'Segoe UI', Arial, sans-serif;
    background: #FFFFFF;
    color: var(--ink);
    line-height: 1.5;
}

/* Bootstrap reboot (loaded before app.css) resets headings to font-weight: 500
   and gives them oversized default font-sizes (h3 = 28px). The mockup uses
   the design-system weight 600 with explicit per-context sizes for headings. */
.topbar h1,
.content h1, .content h2, .content h3, .content h4, .content h5, .content h6,
.login-box h1, .login-box h2, .login-box h3,
.admin-block__title, .month-pick label,
.stat-card .label,


/* h3 / h4 inside content shouldn't fall back to Bootstrap's giant defaults
   (h3 = 28px / h4 = 24px) when not explicitly sized via .subhead. */
.content h3 { font-size: 18px; }
.content h4 { font-size: 16px; }

/* FocusOnNavigate programmatically focuses the page's h2 on every route change,
   which would draw a focus ring around the heading. The mockup has no focus
   styling on headings, so suppress it. */
h1:focus, h1:focus-visible,
h2:focus, h2:focus-visible,
h3:focus, h3:focus-visible,
h4:focus, h4:focus-visible {
    outline: none;
    box-shadow: none;
}

/* Section sub-heading (e.g., "Individual Submissions", "Sections this month",
   "Add Teacher", "All users") — small grey label used inside content panels.
   Selector is `h3.subhead` (not just `.subhead`) so it beats `.content h3`
   on specificity. */
h3.subhead, h4.subhead {
    margin: 18px 0 8px;
    color: #374151;
    font-size: 15px;
    font-weight: bolder;
}

/* Login screen — matches docs/reflection-app.html .login-screen / .login-box */
.login-screen {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(150deg, var(--bg-grad-1) 0%, var(--bg-grad-2) 45%, var(--bg-grad-3) 100%);
    padding: 24px;
}

.login-box {
    background: white;
    padding: 0 40px;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    max-width: 480px;
    width: 100%;
}

.login-box__logo {
    width: 105px;
    height: 105px;
    margin: 0 auto;
    display: block;
    filter: drop-shadow(0 4px 10px rgba(37, 99, 235, 0.25));
}

.login-box h2 {
    color: var(--ink-strong);
    margin: 0 0 6px;
    font-size: 22px;
    text-align: center;
}

.login-box .subtitle {
    color: #6b7280;
    margin-bottom: 10px;
    font-size: 14px;
    text-align: center;
}

.login-box label.field {
    display: block;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 6px;
    color: #374151;
}

.login-box input[type="email"],
.login-box input[type="password"],
.login-box input[type="text"],
.login-box input[type="tel"] {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 14px;
    margin-bottom: 16px;
    font-family: inherit;
    color: #1f2937;
    background: white;
}

.login-box input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--violet-soft);
}

.login-box .remember-me {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: #374151;
    margin-bottom: 16px;
}

.login-box .remember-me input {
    margin: 0;
    width: auto;
}

.login-box button[type="submit"] {
    width: 100%;
    background: linear-gradient(135deg, #2563EB, #4F46E5);
    color: white;
    border: none;
    padding: 12px;
    border-radius: var(--radius-sm);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    box-shadow: 0 8px 20px rgba(37, 99, 235, 0.30);
}

.login-box button[type="submit"]:hover {
    filter: brightness(1.06);
}

.login-box .forgot-link {
    margin: 16px;
    text-align: center;
    font-size: 13px;
}

.login-box .forgot-link a {
    color: var(--primary);
    text-decoration: none;
}

.login-box .forgot-link a:hover {
    text-decoration: underline;
}

.login-box .login-alert {
    background: #fee2e2;
    border-left: 3px solid #dc2626;
    color: #991b1b;
    padding: 10px 12px;
    border-radius: 4px;
    font-size: 13px;
    margin-bottom: 16px;
}

.login-box .login-alert.success {
    background: #d1fae5;
    border-left-color: #059669;
    color: #065f46;
}

.login-box .validation-list {
    list-style: none;
    padding: 0;
    margin: 0 0 12px;
    font-size: 12px;
    color: #b91c1c;
}

a, .btn-link {
    color: var(--primary);
}

/* Headings inside .content */
.content h2 {
    color: var(--ink-strong);
    margin: 0 0 14px;
    font-size: 26px;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.section-desc {
    color: var(--muted-2);
    font-size: 13px;
    margin-bottom: 22px;
    padding: 14px 18px;
    background: rgba(255, 255, 255, 0.75);
    backdrop-filter: blur(4px);
    border: 1px solid #fff;
    border-left: 1px solid #fff;
    border-radius: var(--radius);
    box-shadow: var(--shadow-soft);
}

/* Admin-configured static content shown above the section's form.
   Image sits to the left of the description; both stack on narrow screens. */
.section-intro {
    display: flex;
    gap: 18px;
    align-items: flex-start;
    margin: 0 0 20px;
}

.section-intro__image {
    flex: 0 0 240px;
    width: 240px;
    max-height: 220px;
    object-fit: cover;
    border-radius: 10px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
}

.section-intro__text {
    flex: 1 1 auto;
    min-width: 0;
}

.section-static {
    margin: 0;
    padding: 14px 18px;
    background: #fffbeb;
    border-left: 3px solid #f59e0b;
    border-radius: 6px;
    color: #78350f;
    font-size: 14px;
    line-height: 1.55;
}

/* Rich-text (QuillJS) description content — tidy nested-element spacing. */
.section-static > :first-child { margin-top: 0; }
.section-static > :last-child { margin-bottom: 0; }
.section-static p { margin: 0 0 8px; }
.section-static ul,
.section-static ol { margin: 0 0 8px; padding-left: 22px; }
.section-static h1,
.section-static h2,
.section-static h3 { margin: 12px 0 6px; }
.section-static a { color: #b45309; }
.section-static img { max-width: 100%; height: auto; border-radius: 6px; }

@media (max-width: 600px) {
    .section-intro {
        flex-direction: column;
    }

    .section-intro__image {
        flex-basis: auto;
        width: 100%;
        max-height: 200px;
    }
}

/* QuillJS rich-text editor (section description). */
.quill-editor .ql-toolbar {
    border-radius: 6px 6px 0 0;
    border-color: #d1d5db;
}

.quill-editor .ql-container {
    border-radius: 0 0 6px 6px;
    border-color: #d1d5db;
    font-size: 14px;
    font-family: inherit;
}

.quill-editor .ql-editor {
    min-height: 180px;
    max-height: 360px;
    overflow-y: auto;
}

/* Custom fonts for the Quill font picker. The content classes
   (.ql-font-*) are global so saved descriptions render in the chosen
   font on the teacher's section page, not just inside the editor. */
.ql-font-inter { font-family: 'Inter', sans-serif; }
.ql-font-roboto { font-family: 'Roboto', sans-serif; }
.ql-font-poppins { font-family: 'Poppins', sans-serif; }

.ql-snow .ql-picker.ql-font .ql-picker-label[data-value="inter"]::before,
.ql-snow .ql-picker.ql-font .ql-picker-item[data-value="inter"]::before {
    content: 'Inter';
    font-family: 'Inter', sans-serif;
}

.ql-snow .ql-picker.ql-font .ql-picker-label[data-value="roboto"]::before,
.ql-snow .ql-picker.ql-font .ql-picker-item[data-value="roboto"]::before {
    content: 'Roboto';
    font-family: 'Roboto', sans-serif;
}

.ql-snow .ql-picker.ql-font .ql-picker-label[data-value="poppins"]::before,
.ql-snow .ql-picker.ql-font .ql-picker-item[data-value="poppins"]::before {
    content: 'Poppins';
    font-family: 'Poppins', sans-serif;
}

/* Report template block editor */
.block-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 20px;
}

.block-card {
    border: 1px solid #e5e7eb;
    border-left: 4px solid var(--primary);
    border-radius: 8px;
    background: #fff;
    padding: 12px 14px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
    transition: box-shadow 0.15s, border-color 0.15s, transform 0.15s;
}

.block-card:hover {
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.08);
}

.block-card--dragging {
    opacity: 0.55;
    border-style: dashed;
    border-color: #f59e0b;
}

.block-card__header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}

.block-card__body {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.block-card__footer {
    margin-top: 10px;
    display: flex;
    justify-content: flex-end;
}

.drag-handle,
.drag-glyph {
    cursor: grab;
    font-size: 18px;
    line-height: 1;
    color: #9ca3af;
    user-select: none;
}

.drag-handle:active { cursor: grabbing; }

.block-kind-pill {
    background: #eef2ff;
    color: var(--primary);
    font-size: 12px;
    font-weight: 600;
    padding: 2px 10px;
    border-radius: 999px;
    margin-right: auto;
}

.block-empty {
    padding: 18px;
    border: 1px dashed #d1d5db;
    border-radius: 8px;
    background: #f9fafb;
    color: #6b7280;
    font-size: 14px;
    margin-bottom: 20px;
}

.docx-fallback {
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 0 16px 16px;
    margin-bottom: 18px;
}

.docx-fallback > summary {
    cursor: pointer;
    padding: 12px 0;
    font-weight: 600;
    color: var(--primary);
}

.admin-context-link {
    margin: -8px 0 16px;
    font-size: 13px;
}

.admin-context-link a {
    display: inline-block;
    color: #fff;
    background: linear-gradient(135deg, #2563EB, #4F46E5);
    border: none;
    padding: 12px 18px;
    border-radius: 12px;
    font-size: 13.5px;
    font-weight: 600;
    text-decoration: none;
    box-shadow: 0 8px 20px rgba(37, 99, 235, 0.30);
}

.admin-context-link a:hover {
    filter: brightness(1.06);
    text-decoration: none;
}

.field-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 6px 0 10px;
}

.field-chip {
    background: #eef2ff;
    border: 1px solid #c7d2fe;
    color: #1e293b;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 12px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.field-chip__type {
    background: var(--primary);
    color: white;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 2px 6px;
    border-radius: 4px;
}

.field-stack {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 12px;
}

.field-stack > span:first-child {
    font-size: 12px;
    font-weight: 600;
    color: #374151;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.field-stack input,
.field-stack select {
    padding: 8px 10px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
    color: #1f2937;
    background: white;
}

.field-stack input:focus,
.field-stack select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--violet-soft);
}

.field-stack .muted {
    color: #6b7280;
    font-size: 12px;
}

.options-editor {
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 12px;
}

.options-editor legend {
    font-size: 12px;
    font-weight: 600;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 0 6px;
}

.options-editor__row {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-bottom: 6px;
}

.options-editor__row input {
    flex: 1;
    padding: 6px 8px;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    font-size: 13px;
    font-family: inherit;
}

/* =====================================================================
   Dynamic section field controls (custom sections)
   Theme-tinted native inputs (via accent-color) keep things accessible
   while staying consistent with the rest of the navy/gold palette.
   ===================================================================== */

.custom-section-table input[type="checkbox"],
.custom-section-table input[type="radio"] {
    accent-color: var(--primary);
    width: 16px;
    height: 16px;
    margin: 0;
    flex-shrink: 0;
    cursor: pointer;
}

.custom-section-table .dyn-radio-group,
.custom-section-table .dyn-checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 6px;
}

.custom-section-table .dyn-radio,
.custom-section-table .dyn-checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 13px;
    color: #1f2937;
    cursor: pointer;
    transition: background 0.12s, border-color 0.12s;
    border: 1px solid transparent;
    user-select: none;
}

.custom-section-table .dyn-radio:hover,
.custom-section-table .dyn-checkbox:hover {
    background: #eef2ff;
    border-color: #c7d2fe;
}

.custom-section-table .dyn-radio:has(input:checked),
.custom-section-table .dyn-checkbox:has(input:checked) {
    background: #e0e7ff;
    border-color: var(--primary);
    color: var(--primary);
    font-weight: 500;
}

.custom-section-table .dyn-radio input:focus-visible,
.custom-section-table .dyn-checkbox input:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* Select dropdown — flat row inside the cell, navy chevron, focus ring */
.custom-section-table select {
    appearance: none;
    -webkit-appearance: none;
    width: 100%;
    padding: 8px 32px 8px 12px;
    border: 1px solid transparent;
    background-color: transparent;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 7' fill='none' stroke='%232563EB' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 10px 6px;
    font-family: inherit;
    font-size: 13px;
    color: #1f2937;
    cursor: pointer;
    border-radius: 6px;
    transition: border-color 0.12s, background-color 0.12s;
}

.custom-section-table select:hover {
    background-color: #f9fafb;
}

.custom-section-table select:focus {
    outline: none;
    background-color: white;
    border-color: #f59e0b;
    box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.18);
}

.custom-section-table select:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Date / Number inputs inside dynamic cells — match text input visuals */
.custom-section-table input[type="date"],
.custom-section-table input[type="number"] {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid transparent;
    background: transparent;
    border-radius: 6px;
    font-family: inherit;
    font-size: 13px;
    color: #1f2937;
}

.custom-section-table input[type="date"]:hover,
.custom-section-table input[type="number"]:hover {
    background: #f9fafb;
}

.custom-section-table input[type="date"]:focus,
.custom-section-table input[type="number"]:focus {
    outline: none;
    background: white;
    border-color: #f59e0b;
    box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.18);
}

/* Native calendar picker indicator — tint to navy for theme cohesion */
.custom-section-table input[type="date"]::-webkit-calendar-picker-indicator {
    filter: invert(20%) sepia(67%) saturate(2010%) hue-rotate(218deg) brightness(78%) contrast(98%);
    cursor: pointer;
}

/* MultiDate field — chip list + bare date input on the same row */
.custom-section-table .dyn-multidate {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
    padding: 8px 10px;
    min-height: 40px;
}

.custom-section-table .dyn-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #e0e7ff;
    color: var(--primary);
    padding: 4px 6px 4px 10px;
    border: 1px solid #c7d2fe;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 500;
}

.custom-section-table .dyn-chip__x {
    background: rgba(37, 99, 235, 0.12);
    border: none;
    color: var(--primary);
    cursor: pointer;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    padding: 0;
    font-size: 11px;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background 0.12s;
}

.custom-section-table .dyn-chip__x:hover {
    background: var(--primary);
    color: white;
}

.custom-section-table .dyn-multidate input[type="date"] {
    flex: 0 0 auto;
    width: auto;
    min-width: 150px;
    padding: 4px 8px;
    border: 1px dashed #c7d2fe;
    background: white;
    color: var(--primary);
    font-size: 12px;
}

.custom-section-table .dyn-multidate input[type="date"]:hover {
    border-color: var(--primary);
    background: #f8fafc;
}

/* Tables — applied broadly to <table> inside .content unless overridden.
   The height:1px / height:inherit chain is the canonical trick that lets a
   <td> expose its row height to its children, so editable input/textarea
   inside a row with a tall sibling textarea can stretch to match. */
.content table {
    width: 100%;
    border-collapse: collapse;
    background: var(--card);
    border-radius: var(--radius-sm);
    overflow: hidden;
    box-shadow: var(--shadow-card);
    margin-bottom: 14px;
    height: 1px;
}

.content thead {
    background: #b3d3f3;
    color: var(--ink);
}

.content th {
    padding: 11px 14px;
    text-align: left;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid var(--border);
}

.content tr {
    height: 100%;
}

.content td {
    padding: 10px 14px;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
    vertical-align: top;
    height: inherit;
}

.content tr:last-child td {
    border-bottom: none;
}

/* Editable cells — the input/textarea covers the entire cell, so the row
   height comes from the tallest control and every cell stays flush. */
.content td.editable {
    padding: 0;
}

/* Delete-row cell stays tight so it doesn't inflate editable-row height. */
.content td.actions-col {
    padding: 2px 6px;
}

.content tbody tr:hover td { background: #fafbff; }

.editable {
    background: #ffffff;
}

.editable:hover {
    background: #FEF3C7;
}

.editable input,
.editable textarea {
    box-sizing: border-box;
    display: block;
    width: 100%;
    height: 100%;
    min-height: 28px;
    margin: 0;
    border: 1px solid transparent;
    background: transparent;
    padding: 4px 6px;
    font-family: inherit;
    font-size: 13px;
    line-height: 1.4;
    color: #1f2937;
    resize: vertical;
    border-color:var(--muted);
}

.editable textarea {
    /* textareas can still grow past the row's min-height when content is
       long, which pulls the whole row taller — siblings follow via the
       height:inherit chain above. */
    min-height: 28px;
}

.editable input:focus,
.editable textarea:focus {
    outline: none;
    border-color: #f59e0b;
    background: white;
}

/* Dynamic rows — violet left marker on the first cell */
tr.dynamic-row td:first-child {
    border-left: 3px solid var(--violet);
}

/* Add Row button — violet dashed pill, matches the dynamic-row violet rail */
.add-row-btn {
    background: var(--violet-soft);
    color: var(--violet);
    border: 1px dashed var(--violet);
    padding: 9px 16px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 20px;
}

.add-row-btn:hover:not(:disabled) {
    background: #E9E2FF;
}

.add-row-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Delete row trash button */
.delete-row {
    background: none;
    border: none;
    color: #dc2626;
    cursor: pointer;
    font-size: 25px;
    padding: 4px;
    line-height: 1;
}

.delete-row:hover { color: #991b1b; }

/* Standard buttons */
/* Inline button spinner — sits inside a button while a server roundtrip is
   in flight. Picks up the button's text colour via currentColor so the same
   element works on navy / white / green buttons. */
.btn-spinner {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: btn-spin 0.7s linear infinite;
    vertical-align: -2px;
    margin-right: 6px;
}

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

.btn-primary,
.btn-success {
    background: linear-gradient(135deg, #2563EB, #4F46E5);
    color: white;
    border: none;
    padding: 12px 18px;
    border-radius: 12px;
    cursor: pointer;
    font-size: 13.5px;
    font-weight: 600;
    text-decoration: none;
    display: inline-block;
    box-shadow: 0 8px 20px rgba(37, 99, 235, 0.30);
}
.btn-primary:hover:not(:disabled),
.btn-success:hover:not(:disabled) { filter: brightness(1.06); color: white; }
.btn-primary:disabled,
.btn-success:disabled { opacity: 0.6; cursor: not-allowed; box-shadow: none; }

.btn-secondary {
    background: rgba(255, 255, 255, 0.85);
    color: var(--primary);
    border: 1px solid #fff;
    padding: 12px 18px;
    border-radius: 12px;
    cursor: pointer;
    font-size: 13.5px;
    font-weight: 600;
    text-decoration: none;
    display: inline-block;
    box-shadow: var(--shadow-soft);
}
.btn-secondary:hover:not(:disabled) { background: #fff; color: var(--primary); }
.btn-secondary:disabled { opacity: 0.6; cursor: not-allowed; }

.btn-warn {
    background: var(--orange);
    color: white;
    border: none;
    padding: 12px 18px;
    border-radius: 12px;
    cursor: pointer;
    font-size: 13.5px;
    font-weight: 600;
    text-decoration: none;
    display: inline-block;
}
.btn-warn:hover:not(:disabled) { filter: brightness(0.94); color: white; }
.btn-warn:disabled { opacity: 0.6; cursor: not-allowed; }

.btn-danger {
    background: #DC2626;
    color: white;
    border: none;
    padding: 12px 18px;
    border-radius: 12px;
    cursor: pointer;
    font-size: 13.5px;
    font-weight: 600;
    text-decoration: none;
    display: inline-block;
}
.btn-danger:hover:not(:disabled) { filter: brightness(0.94); color: white; }
.btn-danger:disabled { opacity: 0.6; cursor: not-allowed; }

/* Danger zone — Admin Report unlock/delete confirmations */
.danger-zone {
    margin-top: 28px;
    padding: 16px;
    border: 1px dashed #cbd5e1;
    border-radius: 10px;
    background: #fafafa;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.danger-zone__row {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
}

.confirm-card {
    background: #fffbeb;
    border: 1px solid #fbbf24;
    border-radius: 8px;
    padding: 14px 16px;
    font-size: 13px;
    color: #78350f;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.confirm-card--danger {
    background: #fef2f2;
    border-color: #fca5a5;
    color: #7f1d1d;
}

.confirm-card input[type="text"] {
    width: 100%;
    max-width: 360px;
    padding: 8px 10px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
}

.confirm-card__actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

/* Permission banner */
.permission-banner {
    background: var(--blue-soft);
    border: 1px solid #DBEAFE;
    padding: 14px 18px;
    border-radius: var(--radius);
    margin-bottom: 22px;
    font-size: 13px;
    color: #1E40AF;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Action bar at bottom of a section editor */
.actions {
    margin-top: 24px;
    display: flex;
    gap: 10px;
    align-items: center;
}

/* Admin stat grid */
.admin-stat-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--card);
    padding: 20px;
    border-radius: var(--radius);
    border: 1px solid #fff;
    box-shadow: var(--shadow-card);
    display: flex;
    align-items: center;
    gap: 16px;
}

.stat-card__icon {
    width: 54px;
    height: 54px;
    border-radius: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.stat-card__icon--blue   { background: var(--blue-soft);   color: var(--primary); }
.stat-card__icon--green  { background: var(--green-soft);  color: var(--green); }
.stat-card__icon--pink   { background: var(--pink-soft);   color: var(--pink); }
.stat-card__icon--violet { background: var(--violet-soft); color: var(--violet); }

.stat-card .label {
    font-size: 11px;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 700;
}

.stat-card .value {
    font-size: 32px;
    font-weight: 700;
    color: var(--ink-strong);
    line-height: 1.1;
    margin-top: 2px;
}

.stat-card .value--warn { color: var(--pink); }

.stat-card .sub {
    font-size: 11.5px;
    color: var(--green);
    margin-top: 3px;
}

/* Teacher submission card (collapsible) */
.teacher-submission-card {
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: var(--shadow-card);
    border: 1px solid #fff;
    margin-bottom: 14px;
    overflow: hidden;
}

.teacher-submission-card .header {
    padding: 14px 18px;
    background: #fafbfc;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    border-bottom: 1px solid var(--border);
}

.teacher-submission-card .header strong { color: var(--ink-strong); }

.teacher-submission-card .header__title {
    min-width: 0;
    flex: 1 1 auto;
}

.teacher-submission-card .header__subtitle {
    color: #6b7280;
    font-size: 12px;
}

.teacher-submission-card .header__right {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.teacher-submission-card .body {
    padding: 14px 16px;
    display: none;
}

.teacher-submission-card.open .body { display: block; }

.teacher-submission-card .chevron {
    transition: transform 0.2s;
    color: #6b7280;
}

.teacher-submission-card.open .chevron { transform: rotate(90deg); }

.submission-status {
    font-size: 11px;
    padding: 3px 8px;
    border-radius: 10px;
    background: #d1fae5;
    color: #065f46;
    font-weight: 600;
}

.submission-status.pending {
    background: #fed7aa;
    color: #9a3412;
}

/* Toast (simple custom popup) */
.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: var(--card);
    color: var(--ink);
    padding: 12px 16px 12px 14px;
    border-radius: var(--radius-sm);
    border-left: 4px solid var(--green);
    box-shadow: var(--shadow-card);
    z-index: 2000;
    font-size: 14px;
    animation: slideUp 0.3s;
}

.toast.toast--info  { border-left-color: var(--orange); }
.toast.toast--error { border-left-color: #DC2626; }

@keyframes slideUp {
    from { transform: translateY(20px); opacity: 0; }
    to   { transform: translateY(0);    opacity: 1; }
}

.error-text { color: #b91c1c; font-size: 13px; margin-top: 6px; }

/* Sidebar admin links (NavLink-rendered; scoped CSS in SidebarNav.razor.css
   can't reach them because NavLink emits its own <a>). */
.admin-link {
    display: flex;
    align-items: center;
    padding: 9px 13px;
    margin: 1px 0;
    color: var(--muted-2);
    text-decoration: none;
    font-size: 13.5px;
    font-weight: 500;
    border-radius: var(--radius-sm);
}

.admin-link:hover {
    background: #f8fafc;
    color: var(--ink);
}

.admin-link.active {
    background: var(--primary);
    color: #fff;
    font-weight: 600;
    box-shadow: 0 6px 16px rgba(37, 99, 235, 0.30);
}

/* =====================================================================
   Mobile drawer open state — JS toggles `body.drawer-open` (see App.razor).
   Lives here (global) because scoped CSS can't target body from a child.
   The transform/opacity values mirror the ones in MainLayout.razor.css.
   ===================================================================== */
@media (max-width: 900px) {
    body.drawer-open .sidebar {
        transform: translateX(0);
    }

    body.drawer-open .sidebar-backdrop {
        opacity: 1;
        pointer-events: auto;
    }

    /* When the drawer is open, lock body scroll so users don't scroll the
       page behind the overlay. */
    body.drawer-open {
        overflow: hidden;
    }
}

/* =====================================================================
   Desktop sidebar collapse — JS toggles `body.sidebar-collapsed` (see
   App.razor). The hamburger slides the sidebar off-canvas so the content
   area uses the full width. Mobile (≤900px) uses `drawer-open` instead.
   ===================================================================== */
@media (min-width: 901px) {
    body.sidebar-collapsed .sidebar {
        margin-left: -260px;
    }
}

/* =====================================================================
   Mobile breakpoints
   ===================================================================== */

/* Tablet & phone (≤ 900px): collapse stat grid, shrink content padding,
   make tables horizontally scrollable when they overflow. */
@media (max-width: 900px) {
    .content {
        padding: 16px 18px;
    }

    .admin-stat-grid {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }

    /* Tables: allow horizontal scroll inside the table itself when the
       cell content makes the table wider than the viewport. */
    .content table {
        display: block;
        overflow-x: auto;
        max-width: 100%;
        white-space: normal;
        /* Cancel the desktop `height: 1px` editable-cell stretch trick — on a
           `display: block` element it is a real height and collapses the
           whole table to 1px tall. */
        height: auto;
    }

    /* (Add Teacher form's single-column stack now lives in AdminUsers.razor.css
       so it can win against the scoped [b-…] selector.) */
}

/* Phone (≤ 600px): single-column stat grid, tighter type, more padding fixes. */
@media (max-width: 600px) {
    .admin-stat-grid {
        grid-template-columns: 1fr;
    }

    .content {
        padding: 14px 14px;
    }

    .content h2 { font-size: 18px; }
    .content h3 { font-size: 16px; }
    h3.subhead, h4.subhead { font-size: 14px; }

    .login-box { padding: 28px 24px; }
    .login-box h2 { font-size: 19px; }

    .actions { flex-wrap: wrap; }
    .actions .btn-primary,
    .actions .btn-secondary,
    .actions .btn-success {
        flex: 1 1 auto;
        text-align: center;
    }

    /* Toast: full-width-ish at the bottom */
    .toast {
        left: 16px;
        right: 16px;
        bottom: 16px;
        text-align: center;
    }

    /* Bump form fields to ≥16px so iOS Safari doesn't zoom on focus.
       Covers editable table cells (every section editor) plus login,
       Add-Teacher, and the report month/year pickers. */
    .editable input,
    .editable textarea,
    .login-box input[type="email"],
    .login-box input[type="password"],
    .login-box input[type="text"],
    .login-box input[type="tel"] {
        font-size: 16px;
    }

    /* Submission card header: wrap title above the status pill on phones */
    .teacher-submission-card .header {
        flex-wrap: wrap;
        gap: 6px 10px;
    }

    .teacher-submission-card .header__title {
        flex: 1 1 100%;
    }
}

/* Submission-mix donut on the Admin Overview — donut + side legend */
.donut-card {
    background: var(--card);
    border: 1px solid #fff;
    border-radius: var(--radius);
    box-shadow: var(--shadow-card);
    padding: 18px 24px;
    display: inline-flex;
    flex-direction: row;
    align-items: center;
    gap: 24px;
}

.donut {
    width: 124px;
    height: 124px;
    border-radius: 50%;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.donut__hole {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: var(--card);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.donut__hole b {
    font-size: 24px;
    font-weight: 700;
    color: var(--ink-strong);
    line-height: 1;
}
.donut__hole span {
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--muted);
    margin-top: 3px;
}

.donut-legend__title {
    font-size: 14px;
    font-weight: 700;
    color: var(--ink-strong);
    margin-bottom: 10px;
}

.donut-legend__row {
    display: flex;
    align-items: center;
    gap: 9px;
    font-size: 13px;
    color: var(--muted-2);
    margin: 5px 0;
}

.donut-legend__row .sw {
    width: 11px;
    height: 11px;
    border-radius: 3px;
    flex-shrink: 0;
}

.sw--sub  { background: #4F46E5; }
.sw--prog { background: var(--orange); }
.sw--none { background: #E2E8F0; }

/* Overview row — donut card + quick-actions card side by side */
.overview-row {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    margin-bottom: 22px;
    align-items: stretch;
}

.actions-card {
    flex: 1;
    min-width: 300px;
    background: var(--card);
    border: 1px solid #fff;
    border-radius: var(--radius);
    box-shadow: var(--shadow-card);
    padding: 18px 22px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    justify-content: center;
}

.actions-card__title {
    font-size: 14px;
    font-weight: 700;
    color: var(--ink-strong);
}

.actions-card .actions {
    margin-top: 0;
    flex-wrap: wrap;
}

/* Phone: stack the donut card and quick-actions card full-width */
@media (max-width: 600px) {
    .overview-row {
        flex-direction: column;
    }

    .overview-row .donut-card,
    .overview-row .actions-card {
        width: 100%;
        min-width: 0;
    }
}

/* =====================================================================
   Phone: collapse data tables into stacked, labelled cards — one card per
   row, every cell on its own line prefixed by its column label. The labels
   come from `data-label` attributes that window.LoretoTableLabels copies
   from each column's <th>. This overrides the ≤900px horizontal-scroll
   treatment above (later in source order = wins).
   ===================================================================== */
@media (max-width: 600px) {
    .content table {
        display: block;
        background: transparent;
        box-shadow: none;
        border-radius: 0;
        overflow: visible;
        margin-bottom: 14px;
    }

    /* Header row stays in the DOM (LoretoTableLabels reads it) but is hidden. */
    .content thead {
        display: none;
    }

    .content tbody {
        display: block;
    }

    .content tbody tr {
        display: block;
        background: var(--card);
        border: 1px solid var(--border);
        border-radius: var(--radius);
        box-shadow: var(--shadow-card);
        padding: 4px 14px;
        margin-bottom: 12px;
    }

    .content tbody tr:hover td {
        background: transparent;
    }

    .content td {
        display: block;
        width: 100%;
        height: auto;
        padding: 9px 0;
        border-bottom: 1px solid var(--border);
        font-size: 14px;
    }

    .content tbody tr td:last-child {
        border-bottom: none;
    }

    /* Column label above each cell (skipped when the column has no header). */
    .content td[data-label]:not([data-label=""])::before {
        content: attr(data-label);
        display: block;
        margin-bottom: 4px;
        font-size: 10.5px;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: 0.05em;
        color: var(--muted);
    }

    /* Editable cells: the input filled the grid cell borderlessly on desktop;
       as a stacked field it needs its own visible box. */
    .content td.editable {
        padding: 9px 0;
        background: transparent;
    }
    .content td.editable:hover {
        background: transparent;
    }
    .content .editable input,
    .content .editable textarea {
        border: 1px solid var(--border-2);
        border-radius: var(--radius-sm);
        background: #fff;
        padding: 10px 12px;
        min-height: 42px;
    }

    /* Dynamic-row marker moves from the first cell to the whole card. */
    .content tr.dynamic-row {
        border-left: 3px solid var(--violet);
    }
    .content tr.dynamic-row td:first-child {
        border-left: none;
    }

    /* Delete-row button: its own right-aligned line, no label. */
    .content td.actions-col {
        text-align: right;
        padding-top: 4px;
    }
    .content td.actions-col::before {
        display: none;
    }

    /* Empty-state row spans the card. */
    .content td.empty-row {
        text-align: center;
        border-bottom: none;
    }
}

/* Role controls on the Users page */
.role-select {
    padding: 6px 10px;
    border: 1px solid var(--border-2);
    border-radius: var(--radius-sm);
    font-size: 12.5px;
    font-family: inherit;
    background: #fff;
    color: var(--ink);
    cursor: pointer;
}
.role-select:disabled { opacity: 0.6; cursor: not-allowed; }

.role-pill--super {
    background: var(--violet);
    color: #fff;
}

/* ── Report-template editor: section chip and Insert dropdown ────────── */
.ql-section-chip {
    border: 1.5px dashed #93a7e6;
    background: #f5f7ff;
    border-radius: 9px;
    padding: 12px 16px;
    margin: 12px 0;
    font-size: 13px;
    font-weight: 600;
    color: #1e3a8a;
    user-select: none;
}
.ql-insert {
    height: 26px;
    border: 1px solid #c7d2fe;
    background: #eef2ff;
    color: #1e3a8a;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
}

/* Report Template page — layout-mode tabs. */
.report-tabs {
    display: flex;
    align-items: center;
    gap: 6px;
    border-bottom: 2px solid #e5e7eb;
    margin-bottom: 16px;
}

.report-tab {
    border: none;
    background: transparent;
    padding: 9px 16px;
    font-size: 14px;
    font-weight: 600;
    color: #6b7280;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
}

.report-tab--active {
    color: #1e3a8a;
    border-bottom-color: #1e3a8a;
}

.report-tab__hint {
    margin-left: auto;
    font-size: 12px;
    color: #6b7280;
}
