/* Explain: Styles for UI components, site header, cards, and progress indicators. */
/* Component styles: header, cards, indicator scoring, report sheet and print */
.site-header {
    background: linear-gradient(180deg, rgba(250, 249, 246, 0.94), rgba(250, 249, 246, 0.74));
    backdrop-filter: blur(18px);
}

.brand-title {
    font-family: var(--font-logo);
    font-size: 1.3rem;
    font-weight: 800;
    line-height: 1.1;
    color: var(--accent-color);
}

.brand-sub {
    font-size: 0.58rem;
    font-weight: 700;
    letter-spacing: 0.28em;
    text-transform: uppercase;
    color: var(--logo-subtitle-color);
}

.site-welcome {
    padding: 0.5rem 1.25rem;
    background: linear-gradient(90deg, var(--primary-color), var(--accent-color));
    color: #ffffff;
    font-size: 0.8rem;
    font-weight: 700;
    line-height: 1.7;
    text-align: center;
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.nav-link {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-color);
    transition: color 250ms ease;
}

.nav-link:hover {
    color: var(--primary-color);
}

.section-kicker {
    display: inline-flex;
    align-items: center;
    gap: 0.7rem;
    color: var(--sage-dark);
    font-size: 0.74rem;
    font-weight: 700;
    letter-spacing: 0.2em;
    text-transform: uppercase;
}

.section-kicker::before {
    display: inline-block;
    width: 2.2rem;
    height: 1px;
    background: var(--accent-color);
    content: "";
}

.panel {
    border: 1px solid var(--glass-border);
    border-radius: 1.75rem;
    background: linear-gradient(145deg, rgba(250, 249, 246, 0.86), rgba(255, 255, 255, 0.56));
    box-shadow: var(--shadow-soft);
    backdrop-filter: blur(14px);
}

.stat-card {
    border: 1px solid var(--glass-border);
    border-radius: 1.4rem;
    background: rgba(250, 249, 246, 0.72);
    padding: 1.1rem 1.2rem;
}

.stat-value {
    font-family: var(--font-heading);
    font-size: 1.9rem;
    font-weight: 800;
    line-height: 1;
    color: var(--primary-color);
}

.teacher-card {
    display: flex;
    flex-direction: column;
    border: 1px solid var(--glass-border);
    border-radius: 1.75rem;
    background: rgba(250, 249, 246, 0.8);
    padding: 1.5rem;
    box-shadow: var(--shadow-soft);
    transition: transform 300ms ease, border-color 300ms ease, box-shadow 300ms ease;
}

.teacher-card:hover {
    border-color: rgba(88, 129, 87, 0.55);
    box-shadow: 0 24px 60px rgba(31, 46, 35, 0.12);
    transform: translateY(-4px);
}

.chip {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    border-radius: 999px;
    padding: 0.3rem 0.8rem;
    font-size: 0.72rem;
    font-weight: 700;
    white-space: nowrap;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
}

.chip-excellent {
    border: 1px solid rgba(58, 90, 64, 0.55);
    background: linear-gradient(135deg, #4A6B53, #3A5A40);
    color: #ffffff;
}

.chip-verygood {
    border: 1px solid rgba(88, 129, 87, 0.45);
    background: linear-gradient(135deg, #7AA87A, #588157);
    color: #ffffff;
}

.chip-good {
    border: 1px solid rgba(176, 145, 40, 0.5);
    background: linear-gradient(135deg, #E6BE4A, #D4A530);
    color: #4A3A10;
}

.chip-accept {
    border: 1px solid rgba(180, 100, 40, 0.5);
    background: linear-gradient(135deg, #E2944A, #D2783A);
    color: #ffffff;
}

.chip-needs {
    border: 1px solid rgba(140, 55, 45, 0.55);
    background: linear-gradient(135deg, #BE5444, #9B4A3D);
    color: #ffffff;
}

.chip-muted {
    border: 1px solid var(--glass-border);
    background: var(--surface-color);
    color: var(--text-muted);
}

.progress-track {
    height: 0.55rem;
    border-radius: 999px;
    background: var(--sage-soft);
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    border-radius: 999px;
    background: linear-gradient(90deg, var(--primary-color), var(--primary-hover));
    transition: width 400ms ease;
}

.indicator-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 0;
    border-bottom: 1px solid var(--border-color);
}

.indicator-row:last-of-type {
    border-bottom: 0;
}

@media (min-width: 768px) {
    .indicator-row {
        grid-template-columns: minmax(0, 1fr) auto;
        align-items: center;
        gap: 1.5rem;
    }
}

.score-group {
    display: flex;
    flex-shrink: 0;
    flex-wrap: wrap;
    align-self: center;
    justify-content: center;
    gap: 0.4rem;
}

.score-btn {
    min-width: 4.9rem;
    min-height: 2.7rem;
    padding: 0.35rem 0.65rem;
    border: 1px solid var(--glass-border);
    border-radius: 0.85rem;
    background: var(--field-bg);
    color: var(--text-muted);
    font-size: 0.72rem;
    font-weight: 700;
    line-height: 1.25;
    transition: all 220ms ease;
}

.score-btn:hover {
    border-color: var(--accent-color);
    color: var(--text-color);
}

.score-btn.is-active {
    border-color: var(--primary-color);
    background: var(--primary-color);
    color: #ffffff;
    box-shadow: 0 8px 20px rgba(74, 107, 83, 0.28);
}

.score-btn.is-active.tone-excellent {
    border-color: #3A5A40;
    background: linear-gradient(135deg, #4A6B53, #3A5A40);
    color: #ffffff;
    box-shadow: 0 8px 20px rgba(58, 90, 64, 0.3);
}

.score-btn.is-active.tone-verygood {
    border-color: #588157;
    background: linear-gradient(135deg, #7AA87A, #588157);
    color: #ffffff;
    box-shadow: 0 8px 20px rgba(88, 129, 87, 0.3);
}

.score-btn.is-active.tone-good {
    border-color: #D4A530;
    background: linear-gradient(135deg, #E6BE4A, #D4A530);
    color: #4A3A10;
    box-shadow: 0 8px 20px rgba(212, 165, 48, 0.3);
}

.score-btn.is-active.tone-accept {
    border-color: #D2783A;
    background: linear-gradient(135deg, #E2944A, #D2783A);
    color: #ffffff;
    box-shadow: 0 8px 20px rgba(210, 120, 58, 0.3);
}

.score-btn.is-active.tone-needs {
    border-color: #9B4A3D;
    background: linear-gradient(135deg, #BE5444, #9B4A3D);
    color: #ffffff;
    box-shadow: 0 8px 20px rgba(155, 74, 61, 0.3);
}

.member-dot {
    display: inline-flex;
    width: 0.6rem;
    height: 0.6rem;
    border-radius: 999px;
    background: rgba(31, 46, 35, 0.18);
}

.member-dot.is-done {
    background: var(--primary-color);
}

.indicator-no {
    display: inline-flex;
    min-width: 1.6rem;
    height: 1.6rem;
    align-items: center;
    justify-content: center;
    margin-inline-end: 0.55rem;
    border-radius: 999px;
    background: var(--sage-soft);
    color: var(--sage-dark);
    font-size: 0.7rem;
    font-weight: 800;
    vertical-align: middle;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-color);
    font-size: 0.74rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.form-status {
    min-height: 1.2rem;
}

.form-status.success {
    color: #4A6B53;
}

.form-status.error {
    color: #9B4A3D;
}

.app-toast {
    position: fixed;
    inset-inline: 0;
    bottom: 1.25rem;
    z-index: 90;
    margin-inline: auto;
    max-width: 22rem;
    border-radius: 1rem;
    background: var(--primary-color);
    padding: 0.85rem 1.1rem;
    color: #ffffff;
    font-size: 0.875rem;
    font-weight: 600;
    text-align: center;
    box-shadow: 0 18px 40px rgba(31, 46, 35, 0.25);
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 250ms ease, transform 250ms ease;
    pointer-events: none;
}

.app-toast.is-visible {
    opacity: 1;
    transform: translateY(0);
}

.app-toast.is-error {
    background: #9B4A3D;
}

.report-sheet {
    border: 1px solid var(--border-color);
    border-radius: 1.75rem;
    background: #ffffff;
    padding: clamp(1.25rem, 4vw, 2.5rem);
    box-shadow: var(--shadow-soft);
}

#teamNotesInput {
    min-height: 8rem;
    overflow-y: hidden;
    resize: vertical;
    field-sizing: content;
}

.visit-meta-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.6rem;
}

@media (min-width: 640px) {
    .visit-meta-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

.visit-meta-item {
    border: 1px solid var(--glass-border);
    border-radius: 0.95rem;
    background: #CBD8B4;
    padding: 0.7rem 0.9rem;
}

.visit-meta-label {
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--sage-dark);
}

.visit-meta-value {
    margin-top: 0.3rem;
    font-size: 1rem;
    font-weight: 800;
    line-height: 1.5;
    color: var(--text-color);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.data-table th,
.data-table td {
    padding: 0.65rem 0.55rem;
    border-bottom: 1px solid var(--border-color);
    text-align: right;
    vertical-align: top;
}

.data-table thead th {
    color: var(--sage-dark);
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

@media print {
    .site-header,
    footer,
    .no-print {
        display: none !important;
    }

    body {
        background: #ffffff;
    }

    .section-pad {
        padding: 0;
    }

    .report-sheet {
        border: 0;
        border-radius: 0;
        box-shadow: none;
        padding: 0;
    }

    .plan-team-card {
        break-inside: avoid;
        page-break-inside: avoid;
    }

    body:not(.is-printing-team) .plan-team-card + .plan-team-card {
        break-before: page;
        page-break-before: always;
    }

    body.is-printing-team .plan-sheet-logo,
    body.is-printing-team .plan-sheet-title,
    body.is-printing-team .plan-approvals {
        display: none !important;
    }

    body.is-printing-team .plan-team-card {
        display: none !important;
    }

    body.is-printing-team .plan-team-card.is-print-target {
        display: block !important;
        border: 0;
        border-radius: 0;
        background: #ffffff;
        box-shadow: none;
        padding: 0;
    }

    body.is-printing-team .plan-team-card.is-print-target .plan-print-head,
    body.is-printing-team .plan-team-card.is-print-target .plan-print-foot {
        display: block !important;
    }
}

html:not([data-role="admin"]) [data-admin-only] {
    display: none !important;
}

html:not([data-manage="1"]) [data-manage-only] {
    display: none !important;
}

.access-overlay {
    position: fixed;
    inset: 0;
    z-index: 120;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow-y: auto;
    padding: 1.5rem;
    background: rgba(31, 46, 35, 0.55);
    backdrop-filter: blur(6px);
}

.access-card {
    width: 100%;
    max-width: 26rem;
    padding: clamp(1.5rem, 4vw, 2rem);
    text-align: center;
}

.obs-info {
    display: inline-flex;
    width: 1.5rem;
    height: 1.5rem;
    align-items: center;
    justify-content: center;
    margin-inline-start: 0.45rem;
    border: 1px solid var(--glass-border);
    border-radius: 999px;
    background: var(--sage-soft);
    color: var(--sage-dark);
    font-size: 0.82rem;
    font-weight: 800;
    line-height: 1;
    vertical-align: middle;
    transition: all 220ms ease;
}

.obs-info:hover,
.obs-info:focus-visible {
    border-color: var(--primary-color);
    background: var(--primary-color);
    color: #ffffff;
    outline: none;
}

.obs-modal {
    position: fixed;
    inset: 0;
    z-index: 115;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1.25rem;
}

.obs-modal.is-open {
    display: flex;
}

.obs-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(31, 46, 35, 0.55);
    backdrop-filter: blur(6px);
}

.obs-modal-card {
    position: relative;
    width: 100%;
    max-width: 36rem;
    max-height: 88vh;
    overflow-y: auto;
    padding: clamp(1.25rem, 4vw, 2rem);
}

.obs-level {
    border: 1px solid var(--glass-border);
    border-radius: 1.2rem;
    background: rgba(250, 249, 246, 0.7);
    padding: 0.9rem 1.05rem;
}

/* Keep wide report tables readable on phones by letting them scroll sideways */
@media (max-width: 767px) {
    .screen-report .overflow-x-auto {
        -webkit-overflow-scrolling: touch;
        padding-bottom: 0.35rem;
    }

    .screen-report .data-table {
        min-width: 34rem;
    }

    .report-sheet {
        border-radius: 1.25rem;
    }
}

/* Single-page printable final report sheet */
.print-sheet {
    display: none;
    color: var(--text-color);
    font-size: 1.03rem;
    line-height: 1.32;
}

.print-head {
    display: flex;
    align-items: center;
    justify-content: center;
    padding-bottom: 0.1rem;
}

.print-head img {
    height: 42px;
    width: auto;
    max-width: 100%;
    object-fit: contain;
}

.print-titlebar {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: baseline;
    gap: 0.1rem 0.75rem;
    margin-bottom: 0.15rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.15rem;
}

.print-title {
    grid-column: 2;
    justify-self: center;
    text-align: center;
    font-size: 1.38rem;
    font-weight: 800;
    color: var(--text-color);
}

.print-sub {
    grid-column: 3;
    justify-self: end;
    text-align: left;
    font-size: 0.86rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    color: var(--text-muted);
}

.print-meta {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.12rem 0.3rem;
    font-size: 0.89rem;
    line-height: 1.3;
    color: var(--text-muted);
}

.print-meta p {
    border: 1px solid var(--border-color);
    border-radius: 0.35rem;
    background: #CBD8B4;
    padding: 0.06rem 0.28rem;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
}

.print-meta .font-bold {
    color: var(--text-color);
}

.print-overall {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.6rem;
    margin-top: 0.15rem;
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    background: #CBD8B4;
    padding: 0.16rem 0.5rem;
    font-size: 0.95rem;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
}

.print-sheet .lvl {
    display: inline-block;
    border-radius: 999px;
    padding: 0.1rem 0.6rem;
    font-size: 1rem;
    font-weight: 800;
    white-space: nowrap;
    color: var(--sage-dark);
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
}

.print-sheet .lvl.tone-excellent {
    background: #3A5A40;
    color: #ffffff;
}

.print-sheet .lvl.tone-verygood {
    background: #588157;
    color: #ffffff;
}

.print-sheet .lvl.tone-good {
    background: #D4A530;
    color: #4A3A10;
}

.print-sheet .lvl.tone-accept {
    background: #D2783A;
    color: #ffffff;
}

.print-sheet .lvl.tone-needs {
    background: #9B4A3D;
    color: #ffffff;
}

.print-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 0 0.55rem;
    margin-top: 0.12rem;
}

.print-item {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    border-bottom: 1px solid rgba(58, 90, 64, 0.42);
    padding: 0.05rem 0;
}

.print-item .no {
    display: inline-flex;
    flex: 0 0 auto;
    min-width: 1.15rem;
    height: 1.15rem;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    background: var(--sage-soft);
    color: var(--sage-dark);
    font-size: 0.7rem;
    font-weight: 800;
}

.print-item .txt {
    flex: 1 1 auto;
    font-size: 0.95rem;
    line-height: 1.28;
}

.print-item .lvl {
    flex: 0 0 auto;
    min-width: 4.2rem;
    text-align: center;
    font-size: 0.85rem;
}

.print-summary {
    margin-top: 0.15rem;
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    background: #CBD8B4;
    padding: 0.24rem 0.55rem;
    font-size: 0.95rem;
    line-height: 1.36;
    white-space: pre-line;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
}

.print-notes-list {
    display: grid;
    gap: 0.22rem;
    margin-top: 0.22rem;
}

.print-notes-list.cols-3 {
    grid-template-columns: repeat(3, 1fr);
    gap: 0.4rem;
}

.print-member-note {
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    background: #ffffff;
    padding: 0.28rem 0.55rem;
    font-size: 0.78rem;
    line-height: 1.5;
    white-space: pre-line;
    break-inside: avoid;
    page-break-inside: avoid;
}

.print-member-note p {
    margin: 0;
}

.print-member-name {
    margin-bottom: 0.12rem !important;
    border-bottom: 1px dotted var(--border-color);
    padding-bottom: 0.12rem;
    color: var(--text-color);
    font-size: 0.8rem;
    font-weight: 800;
}

.print-member-note .muted {
    color: var(--text-muted);
}

.print-block-title {
    margin-top: 0.22rem;
    font-size: 0.97rem;
    font-weight: 800;
    color: var(--text-color);
}

.print-signs {
    display: grid;
    gap: 0.2rem;
    margin-top: 0.15rem;
}

.print-signs.cols-3 {
    grid-template-columns: repeat(3, 1fr);
    margin-top: 3mm;
}

.print-signs.cols-2 {
    grid-template-columns: repeat(2, 1fr);
    margin-top: 3.5mm;
    padding-top: 1.2mm;
    border-top: 1px solid var(--border-color);
}

.print-sign {
    font-size: 0.92rem;
    line-height: 1.24;
}

.print-sign .muted {
    color: var(--text-muted);
}

.print-sign .line {
    height: 0;
    margin-top: 0.12rem;
    border-bottom: 1px dashed var(--text-muted);
}

@media print {
    @page {
        size: A4 landscape;
        margin: 4mm;
    }

    .screen-report {
        display: none !important;
    }

    .print-sheet {
        display: flex !important;
        flex-direction: column;
        width: 100%;
        min-height: 0;
        overflow: visible;
    }

    .print-notes {
        flex: 0 0 auto;
        height: auto;
        min-height: 12mm;
        max-height: none;
        overflow: visible;
    }

    .report-page {
        padding: 0 !important;
    }

    #reportRoot {
        max-width: 100% !important;
    }

    main {
        padding: 0 !important;
    }
}