/* School system — app-specific styles. The look (tokens, shell, Tabler
   re-skin) lives in design.css; keep this file for the few things that
   belong to this app only. Use Bootstrap/Tabler utility classes first. */

/* Dashboard quick actions */
.quick-action .avatar { width: 3.25rem; height: 3.25rem; }
.quick-action:focus-visible { outline: 2px solid var(--tw-primary); outline-offset: 2px; }

/* Profile header used by detail pages. */
.profile-photo {
    width: 5.5rem;
    height: 5.5rem;
    object-fit: cover;
    border-radius: var(--tw-radius-card);
}

/* Wide data-entry grids (scores, skills, attendance) keep their header row in view. */
.grid-sticky thead th { position: sticky; top: 0; z-index: 2; background: var(--tw-surface); }
.grid-sticky td:first-child, .grid-sticky th:first-child { position: sticky; left: 0; z-index: 1; background: var(--tw-surface-raised); }

/* HTMX: thin progress bar along the top while a request runs. */
.htmx-progress {
    position: fixed;
    top: 0;
    inset-inline-start: 0;
    height: 3px;
    width: 0;
    background: var(--tw-accent);
    z-index: 2000;
    opacity: 0;
    transition: width .4s ease, opacity .3s ease;
}
body.htmx-busy .htmx-progress { width: 70%; opacity: 1; transition: width 4s cubic-bezier(.1, .7, .3, 1); }
.htmx-indicator { display: none; }
.htmx-request .htmx-indicator, .htmx-request.htmx-indicator { display: inline-block; }

.notification-menu { width: min(22rem, 92vw); }

/* ---------- Photos ----------
   One frame for every person photo (partials/components/photo.html).
   Photos are stored as 3:4 portraits; object-position keeps the face in
   view when a round avatar crops them. */
.tw-photo {
    display: inline-flex;
    flex-shrink: 0;
    overflow: hidden;
    background: #E4E8F0;
    vertical-align: middle;
}
.tw-photo img { width: 100%; height: 100%; object-fit: cover; object-position: center 22%; display: block; }
.tw-photo-xs { width: 28px; height: 28px; border-radius: 50%; }
.tw-photo-sm { width: 36px; height: 36px; border-radius: 50%; }
.tw-photo-md { width: 48px; height: 48px; border-radius: 50%; box-shadow: 0 0 0 2px var(--tw-surface-raised, #fff); }
.tw-photo-lg, .tw-photo-xl {
    border-radius: 14px;
    border: 4px solid #fff;
    box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.08), 0 10px 28px rgba(15, 23, 42, 0.16);
}
.tw-photo-lg { width: 96px; height: 128px; }
.tw-photo-xl { width: 150px; height: 200px; border-radius: 18px; }
[data-bs-theme="dark"] .tw-photo-lg, [data-bs-theme="dark"] .tw-photo-xl { border-color: #2A3040; }
@media (max-width: 575.98px) { .tw-photo-xl { width: 120px; height: 160px; } }

/* ---------- Student profile dashboard ---------- */
.pd-stat .card-body { position: relative; padding: 18px 20px; }
.pd-stat-label { font-size: 12px; font-weight: 600; color: var(--tw-muted); margin-bottom: 4px; padding-right: 44px; }
.pd-stat-value { font-size: 22px; font-weight: 700; line-height: 1.2; font-variant-numeric: tabular-nums; padding-right: 44px; overflow-wrap: anywhere; }
.pd-stat-note { font-size: 12px; color: var(--tw-muted); margin-top: 4px; }
.pd-stat-icon {
    position: absolute; top: 16px; right: 16px; width: 38px; height: 38px; border-radius: 12px;
    display: inline-flex; align-items: center; justify-content: center; font-size: 18px;
}
@media (max-width: 575.98px) { .pd-stat-value { font-size: 18px; padding-right: 0; } .pd-stat-icon { display: none; } }

.pd-ring {
    width: 146px; height: 146px; padding: 2px; border-radius: 50%;
    background: var(--tw-primary, var(--brand-primary));
}
.tw-photo-ring { width: 142px; height: 142px; border-radius: 50%; border: 4px solid var(--tw-surface-raised, #fff); }
.pd-name { font-size: 20px; font-weight: 700; line-height: 1.25; }
.pd-facts { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px; border-top: 1px solid var(--tw-border); padding-top: 12px; }
.pd-facts dt { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--tw-muted); }
.pd-facts dd { margin: 0; font-weight: 600; }
.pd-contact { background: color-mix(in srgb, var(--brand-primary) 6%, transparent); border-radius: 12px; padding: 10px 12px; }
.pd-icon-btn {
    width: 40px; height: 40px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
    color: var(--brand-primary); background: color-mix(in srgb, var(--brand-primary) 9%, transparent);
    font-size: 17px; text-decoration: none; transition: background .15s, color .15s, transform .15s;
}
.pd-icon-btn:hover { background: var(--brand-primary); color: #fff; transform: translateY(-1px); }

.pd-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 10px; }
.pd-tile {
    display: flex; flex-direction: column; align-items: center; text-align: center; gap: 4px;
    padding: 12px 8px; border: 1px solid var(--tw-border); border-radius: 14px; color: inherit; text-decoration: none;
    background: var(--tw-surface); transition: border-color .15s, box-shadow .15s;
}
a.pd-tile:hover { border-color: var(--brand-primary); box-shadow: 0 6px 16px rgba(15, 23, 42, .08); }
.pd-tile-name { font-weight: 600; font-size: 13px; line-height: 1.2; }
.pd-tile-note { font-size: 12px; color: var(--tw-muted); line-height: 1.2; }
.pd-tile-icon { width: 40px; height: 40px; border-radius: 12px; display: inline-flex; align-items: center; justify-content: center; font-size: 18px; }

.pd-calendar { background: var(--brand-primary); color: var(--brand-on-primary, #fff); border: 0; }
.pd-calendar .card-title { color: inherit; }
:root.glass .card.pd-calendar { background-color: color-mix(in srgb, var(--brand-primary) 90%, transparent); }
.pd-cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; text-align: center; }
.pd-cal-head { font-size: 11px; font-weight: 600; opacity: .7; padding: 4px 0; }
.pd-cal-day {
    font-size: 12px; font-weight: 600; line-height: 30px; height: 30px; border-radius: 9px;
    background: rgba(255, 255, 255, .08); font-variant-numeric: tabular-nums;
}
.pd-cal-day.is-none { opacity: .55; background: transparent; }
.pd-cal-day.is-present { background: rgba(47, 179, 68, .9); color: #fff; }
.pd-cal-day.is-absent { background: #F9C6A8; color: #7A2E0B; }
.pd-cal-day.is-today { box-shadow: 0 0 0 2px #fff inset; }
.pd-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; vertical-align: middle; }
.pd-dot.is-present { background: #2fb344; }
.pd-dot.is-absent { background: #F9C6A8; }

.pd-pill { font-size: 12px; font-weight: 600; padding: 4px 12px; border-radius: 8px; flex-shrink: 0; }
.pd-pill.is-paid { background: #D3F4DC; color: #1B7A35; }
.pd-pill.is-part { background: #FFF1D0; color: #8A5A00; }
.pd-pill.is-due { background: #FDE0CF; color: #A23E0B; }
[data-bs-theme="dark"] .pd-pill.is-paid { background: rgba(47, 179, 68, .2); color: #7EE29A; }
[data-bs-theme="dark"] .pd-pill.is-part { background: rgba(245, 159, 0, .2); color: #FFD27A; }
[data-bs-theme="dark"] .pd-pill.is-due { background: rgba(253, 126, 20, .2); color: #FFB48A; }

/* All tabs visible: they wrap onto a second line instead of scrolling. */
.pd-tabs { flex-wrap: wrap; row-gap: 2px; }
.pd-tabs .nav-link { white-space: nowrap; }
@media (max-width: 575.98px) {
    .pd-tabs .nav-item { flex: 1 1 50%; }
    .pd-tabs .nav-link { justify-content: flex-start; }
}
@media print {
    .pd-calendar { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
    .pd-icon-btn { display: none; }
}

/* ---------- Money figures always on one line ----------
   Figures shrink with their card (container query units) instead of
   wrapping or being cut off with "...". */
.pd-stat .card-body, .stat-card .card-body, .tw-kpi-card { container-type: inline-size; }
.pd-stat-value {
    white-space: nowrap; overflow-wrap: normal;
    font-size: clamp(13px, calc(10cqi - 5px), 24px);
}
/* Browsers without container queries (some school computers, seen over Tailscale
   2026-10-17): the figure may wrap and never runs out of its card. */
@supports not (container-type: inline-size) {
    .pd-stat-value, .stat-card .tw-fit-value, .tw-kpi-value { white-space: normal; overflow-wrap: anywhere; font-size: 18px; }
}
.pd-stat .card-body, .stat-card .card-body { min-width: 0; overflow: hidden; }
.stat-card .tw-fit-value, .tw-kpi-value {
    white-space: nowrap; overflow: visible; text-overflow: clip;
    font-size: clamp(13px, calc(9cqi - 4px), 22px);
}

/* Long forms split into steps (app.js): one screen at a time. */
[data-step-hidden] { display: none !important; }
.tw-form-steps .step-item { cursor: pointer; text-decoration: none; color: inherit; }
.tw-step-nav .btn { min-width: 7rem; }
/* A step taller than the screen keeps Back / Next in reach at the bottom. */
.tw-stepped .tw-step-nav {
    position: sticky; bottom: 0; z-index: 5;
    padding: .5rem; border-radius: 10px;
    background: color-mix(in srgb, var(--tblr-body-bg) 80%, transparent);
    -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
}
@media (max-width: 575.98px) {
    .tw-form-steps .step-item:not(.active) { font-size: 0; }   /* numbers only on phones */
    .tw-form-steps .step-item.active { flex-basis: 40%; }
}


/* Scuola, the system's own logo (partials/scuola_logo.html): footer and sign-in. */
.tw-powered { display: inline-flex; align-items: center; gap: .4rem; color: var(--tblr-secondary); font-size: .75rem; text-decoration: none; }
.tw-powered:hover { color: var(--tblr-secondary); opacity: .85; }
.tw-powered.justify-content-center { display: flex; }
.tw-scuola-logo { width: auto; display: inline-block; }
.tw-scuola-dark { display: none; }
[data-bs-theme="dark"] .tw-scuola-light { display: none; }
[data-bs-theme="dark"] .tw-scuola-dark { display: inline-block; }
