/* View: Profil ucznia (js/views/studentProfile.js) + rozliczenia ucznia (sheet from js/flows/finance.js).
   Hero = tonal panel in the student hue (radius 18); then the figures table, then two columns on desktop
   (lessons + history | contact, ledger, portal, series, notes). Lists are rows with thin rules. */
@layer views {
/* ---- hero ---- */
.page-profile > .back-link { margin-top: 10px; }
.profile-hero {
  display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 4px 16px; align-items: center;
  padding: 16px; margin: var(--widget-gap) 0 0;   /* hue fill + outline: components/widget.css */
}
.profile-hero > .avatar { grid-row: 1 / span 2; }
.ph-name { grid-column: 2; display: flex; align-items: center; flex-wrap: wrap; gap: 4px 10px; min-width: 0; font-size: 28px; line-height: 1.15; overflow-wrap: anywhere; }
.ph-sub { grid-column: 2; color: var(--ink-2); line-height: 1.35; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden; }
.ph-goal { grid-column: 1 / -1; display: flex; align-items: center; gap: 8px; margin-top: 6px; font-size: var(--fs-caption); color: var(--ink-2); }
.ph-goal .ico { flex: none; color: var(--hue); }
.ph-actions { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.ph-actions .btn-secondary { background: var(--surface); }
.ph-actions .btn-icon.square { width: auto; min-width: 44px; }

/* ---- columns ---- */
.prof-cols { display: grid; grid-template-columns: minmax(0, 1fr); }
.prof-col { min-width: 0; }

/* ---- upcoming lessons (up to 2 lines) ---- */
.up-rows .row-main .muted { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.up-rows .chev, .pay-row .chev { flex: none; color: var(--ink-3); }

/* ---- history ---- */
.history { display: flex; flex-direction: column; }
.hist-item { display: grid; grid-template-columns: 56px minmax(0, 1fr) auto; gap: 2px 12px; align-items: start; padding: 12px 0; border-top: 1px solid var(--rule); }
.hist-item:first-child { border-top: 0; }
.hist-item.is-cancelled_student, .hist-item.is-cancelled_tutor, .hist-item.is-noshow { color: var(--ink-2); }
.hist-date { display: flex; flex-direction: column; line-height: 1.2; padding-top: 2px; }
.hist-date b { font-weight: 600; white-space: nowrap; }
.hist-date span { font-size: var(--fs-caption); color: var(--ink-3); }
.hist-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.hist-title { display: inline-flex; align-items: center; min-height: 24px; font-weight: 600; text-align: left; color: var(--ink); overflow-wrap: anywhere; }
.hist-item:not(:has(.st-mark)) .hist-title { font-weight: 500; }
.hw-check { display: flex; align-items: center; gap: 8px; min-height: 36px; font-size: var(--fs-caption); color: var(--ink-2); cursor: pointer; }
.hw-check input {
  -webkit-appearance: none; appearance: none; width: 44px; height: 44px; margin: -4px -10px -4px -12px; flex: none;
  display: inline-grid; place-items: center; background: none; border: 0; cursor: pointer;
}
.hw-check input::before { content: ""; grid-area: 1 / 1; width: 20px; height: 20px; border-radius: 6px; background: var(--surface); box-shadow: inset 0 0 0 1.5px var(--edge); transition: background var(--t-fast); }
.hw-check input::after { content: ""; grid-area: 1 / 1; width: 5px; height: 10px; margin-top: -2px; border: solid var(--paper); border-width: 0 2px 2px 0; transform: rotate(45deg); opacity: 0; }
.hw-check input:checked::before { background: var(--good); box-shadow: none; }
.hw-check input:checked::after { opacity: 1; }
.hw-check input:focus-visible { outline: 0; }
.hw-check input:focus-visible::before { box-shadow: inset 0 0 0 1.5px var(--edge), 0 0 0 3px var(--accent-line); }
.hw-check span.done { text-decoration: line-through; color: var(--ink-3); }
.hist-note { font-family: var(--font-display); font-style: var(--ital-style); font-weight: var(--ital-weight); font-variation-settings: var(--fvs-ital); font-size: 14px; line-height: 1.35; color: var(--ink-2); white-space: pre-wrap; }
.hist-side { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; padding-top: 2px; }
.hist-side .amt { font-weight: 500; color: var(--ink-2); }
.hist-more { display: flex; justify-content: center; padding-top: 6px; }

/* ---- contact ---- */
.contact-list { display: flex; flex-direction: column; }
.contact { display: flex; align-items: center; gap: 12px; min-height: 52px; border-top: 1px solid var(--rule); color: var(--ink-3); text-decoration: none; }
.contact:first-child { border-top: 0; }
.contact .ico { flex: none; }
.contact > span { display: flex; flex-direction: column; gap: 1px; min-width: 0; line-height: 1.3; }
.contact b { color: var(--ink); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.contact .muted { font-size: var(--fs-caption); }
.contact-list > .muted.pad { border-top: 0; }
.notes-text { font-size: 17px; line-height: 1.4; color: var(--ink); white-space: pre-wrap; }

/* ---- ledger (tonal) + payments ---- */
.ledger { display: grid; gap: 8px; padding: 12px 14px; margin-bottom: 6px; background: var(--paper-2); border-radius: var(--r-group); }
.ledger > div { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; color: var(--ink-2); }
.ledger b { color: var(--ink); font-weight: 600; white-space: nowrap; font-family: var(--font-num); font-variant-numeric: tabular-nums; }
.ledger-sum { padding-top: 8px; border-top: 1px solid var(--rule-2); font-weight: 700; }
.ledger-sum span { color: var(--ink); }
.ledger-sum b { font-weight: 700; }
.pay-row .row-main b { font-size: var(--fs-body); }

/* ---- settle sheet (js/flows/finance.js) ---- */
.settle-list { display: grid; max-height: 280px; overflow: auto; margin: 12px 0 8px; padding: 4px 14px; background: var(--paper-2); border-radius: var(--r-group); }
.settle-row { display: flex; align-items: center; gap: 10px; min-height: 48px; border-top: 1px solid var(--rule); cursor: pointer; }
.settle-row:first-child { border-top: 0; }
.settle-row .settle-date { flex: 1; }
.settle-row em { font-style: normal; color: var(--ink-3); margin-left: 6px; }
.settle-row b { font-family: var(--font-num); font-variant-numeric: tabular-nums; white-space: nowrap; }
.settle-total { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }

@media (max-width: 760px) {
  .page-profile > .back-link { display: none; }
  .profile-hero { padding: 14px; }
  .ph-actions .btn-primary { flex: 1 1 100%; }
  .ph-actions .btn-secondary { flex: 1 1 0; }
  .hist-title { min-height: 44px; }
  .hw-check { min-height: 44px; }
  .btn-row .btn-sm { min-height: 44px; }
  .prof-col .btn-row .btn { flex: 1 1 auto; }
}
@media (max-width: 380px) {
  .ph-name { font-size: 24px; }
  .profile-hero { column-gap: 12px; }
  .hist-item { grid-template-columns: 50px minmax(0, 1fr) auto; column-gap: 10px; }
}
@media (min-width: 761px) {
  .ph-actions { grid-column: 2; justify-self: start; }
  .profile-hero { padding: 20px; }
  .ph-name { font-size: 32px; }
  .ph-goal { grid-column: 2; margin-top: 2px; }
}
@media (min-width: 1001px) {
  .prof-cols { grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); column-gap: 40px; align-items: start; }
}
@media (hover: hover) { .settle-row:hover { background: var(--paper-3); } }
}
