/* View: Pulpit (js/views/dashboard.js) — mockup #dashboard.
   Phone / tablet (≤ 1000): one column in thumb order — Dziś → Do potwierdzenia → Następna lekcja → Kto zalega
   → liczby → Kolejne dni → tydzień → Podpowiedzi (the two .dash-home columns melt via display: contents + order).
   Desktop (≥ 1001): two columns 1.5fr / 1fr, gap 40, each column in DOM order.
   .dash-grid / .dash-col (two-column page grid) are shared with finance, student profile and the student portal. */
@layer views {
/* ---- shared two-column grid (other views) ---- */
.dash-grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: 0 40px; align-items: stretch; }
.dash-col { display: flex; flex-direction: column; min-width: 0; }
.dash-col > .card:last-child { flex: 1 1 auto; }
@media (max-width: 1000px) { .dash-grid { grid-template-columns: minmax(0, 1fr); } }

/* ---- greeting: css/views/greeting.css ---- */
.dash .section-title h2 { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.dash .section-title h2 b { color: var(--ink); font-weight: 600; }
.dash .section-title h2 b.amt { color: var(--danger); }
.dash .section-title .more-link { min-height: 28px; }

/* ---- layout ---- */
.dash-home { display: flex; flex-direction: column; }
.dash-home > .dash-main, .dash-home > .dash-side { display: contents; }
.dash-today { order: 1; }
.dash-inbox { order: 2; }
.dash-hero-sec { order: 3; }
.dash-debt { order: 4; }
.dash-figs { order: 5; }
.dash-upcoming { order: 6; }
.dash-week { order: 7; }
.insights-card { order: 8; }

/* ---- agenda rows (Dziś, Kolejne dni): the hue bar structures the list, no rules ---- */
.timeline { display: flex; flex-direction: column; }
.tl-item { display: flex; align-items: center; gap: 6px; min-height: 60px; }
.tl-main { flex: 1; min-width: 0; display: grid; grid-template-columns: 52px 4px minmax(0, 1fr); gap: 0 12px; align-items: center; padding: 8px 0; text-align: left; color: inherit; }
.tl-time { display: flex; flex-direction: column; line-height: 1.15; }
.tl-time b { font-weight: 600; font-size: var(--fs-body); }
.tl-time span { font-size: var(--fs-caption); color: var(--ink-3); }
.tl-bar { width: 4px; height: 40px; border-radius: 2px; background: var(--hue); }
.tl-body { min-width: 0; display: flex; flex-direction: column; gap: 2px; line-height: 1.35; }
.tl-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* the note may run to a second muted line instead of being cut */
.tl-sub { font-size: var(--fs-caption); color: var(--ink-2); line-height: 1.35; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden; overflow-wrap: anywhere; }
.tl-side { flex: none; display: flex; align-items: center; gap: 6px; }
.tl-side .btn-sm { min-height: 40px; }
.tl-item.is-done .tl-name { color: var(--ink-2); }
.tl-item.is-done .tl-bar { opacity: .45; }
.tl-item.is-cancelled_student .tl-name, .tl-item.is-cancelled_tutor .tl-name, .tl-item.is-noshow .tl-name { color: var(--ink-3); text-decoration: line-through; }

/* ---- "Do potwierdzenia": warn tray (fill + 2 px warn rule: components/widget.css) ---- */
.dash-inbox .section-title { margin-bottom: 4px; flex-wrap: nowrap; }
.dash-inbox .section-title .btn-text { white-space: nowrap; }
.dash-inbox .section-title h2, .dash-inbox-cap { color: var(--ink-2); }
.dash-inbox-cap { margin: 0 0 8px; font-size: var(--fs-caption); line-height: 1.4; }
.dash-inbox .btn-success { background: var(--surface); }
.inbox-list { display: flex; flex-direction: column; }
.inbox-row { position: relative; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 0 12px; align-items: center; min-height: 64px; padding: 8px 0; border-top: 1px solid var(--rule-2); }
.inbox-row:first-child { border-top: 0; }
.inbox-main { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
/* the name is the row's link: its ::after covers the whole row; actions sit above it */
.inbox-name { font-weight: 600; padding: 9px 0; margin: -9px 0; text-align: left; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.inbox-name::after { content: ""; position: absolute; inset: 0; }
.inbox-sub { display: flex; flex-wrap: wrap; align-items: center; gap: 0 8px; font-size: var(--fs-caption); color: var(--ink-2); }
.inbox-sub > * { white-space: nowrap; }
.inbox-actions { position: relative; z-index: 1; display: flex; align-items: center; gap: 4px; }
.inbox-actions .btn-sm { min-height: 40px; }
.inbox-more { padding: 10px 0 0; font-size: var(--fs-caption); }

/* ---- "Kto zalega": name · amount · Wpłata ---- */
.debt-row { gap: 10px; }
.debt-who { min-height: 44px; justify-content: center; color: inherit; text-decoration: none; }
.debt-row > .amt { flex: none; }
.debt-row > .btn { flex: none; }

/* ---- hero "Następna lekcja": the section itself is the student-hue widget (--h on the section, widget.css) ---- */
.dash-hero { display: grid; gap: 12px; }
.dash-hero-who { display: flex; align-items: center; gap: 14px; min-width: 0; }
.dash-hero-text { min-width: 0; }
.dash-hero-name { font-family: var(--font-display); font-weight: var(--w-display); font-size: 26px; letter-spacing: var(--ls-display); line-height: 1.15; font-variation-settings: var(--fvs-display); overflow-wrap: anywhere; }
.dash-hero-sub { margin-top: 2px; font-size: var(--fs-caption); color: var(--ink-2); }
.dash-hero-when { font-family: var(--font-display); font-weight: var(--w-display); font-size: 20px; line-height: 1.25; letter-spacing: var(--ls-display); font-variation-settings: var(--fvs-display); }
.dash-hero-when b { color: var(--accent); font-weight: inherit; }
.dash-prep { display: flex; flex-direction: column; gap: 8px; padding: 12px 14px; background: var(--surface); border-radius: var(--r-ctl); box-shadow: inset 3px 0 0 var(--hue); font-size: var(--fs-caption); color: var(--ink-2); line-height: 1.4; }
.prep-row { display: flex; gap: 8px; align-items: flex-start; }
.prep-row > .ico { flex: none; margin-top: 2px; color: var(--ink-3); }
.prep-row b { color: var(--ink); font-weight: 600; }
.prep-hw { margin-top: 1px; } .prep-hw.done { color: var(--good-ink); }
.prep-notes { white-space: pre-wrap; }
.dash-hero-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---- figures (one column, stacked) ---- */
.dash-figs .stat-grid { margin-bottom: 0; }

/* ---- week strip ---- */
.week-strip { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.ws-day { display: flex; flex-direction: column; align-items: center; gap: 4px; min-height: 84px; padding: 8px 0 6px; border-radius: 14px; color: var(--ink); }
.ws-letter { font-size: var(--fs-kicker); font-weight: 700; letter-spacing: .08em; color: var(--ink-3); }
.ws-date { font-family: var(--font-display); font-weight: var(--w-display); font-size: 20px; line-height: 1; font-variant-numeric: tabular-nums; font-variation-settings: var(--fvs-display); }
.ws-bar { width: 100%; height: 28px; display: flex; align-items: flex-end; justify-content: center; }
.ws-bar i { width: 4px; height: calc(var(--p, 0) * 100%); min-height: 2px; border-radius: 2px; background: var(--accent); }
.ws-count { font-size: 12px; color: var(--ink-3); font-family: var(--font-num); font-variant-numeric: tabular-nums; }
.ws-day.is-today { background: var(--accent); color: var(--on-accent); }
.ws-day.is-today .ws-letter, .ws-day.is-today .ws-count { color: var(--on-accent); opacity: .85; }
.ws-day.is-today .ws-bar i { background: var(--on-accent); }
.ws-day.is-past { opacity: .55; }

/* ---- insights ---- */
.insights-toggle { display: flex; justify-content: center; margin-top: 4px; }
.insights-locked .insight-title { font-weight: 500; color: var(--ink-2); }
.btn.insights-toggle { margin-top: 12px; }

/* ---- onboarding checklist ---- */
.card.panel.onboarding { display: flex; flex-direction: column; gap: 10px; }
.onboarding .section-title { margin-bottom: 0; }
.onb-cap { margin: 0; font-size: var(--fs-caption); color: var(--ink-2); }
.onb-steps { display: flex; flex-direction: column; }
.onb-step { display: flex; align-items: center; gap: 12px; min-height: 56px; padding: 8px 0; border-top: 1px solid var(--rule); }
.onb-step:first-child { border-top: 0; }
.onb-step.done { color: var(--ink-3); }
.onb-step.done .onb-text b { color: var(--ink-3); text-decoration: line-through; }
.onb-num { width: 26px; height: 26px; flex: none; display: grid; place-items: center; border-radius: 50%; box-shadow: inset 0 0 0 1.5px var(--rule-3); font-weight: 600; font-size: var(--fs-caption); color: var(--ink-2); }
.onb-step.done .onb-num { box-shadow: none; background: var(--good-soft); color: var(--good-ink); }
.onb-text { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.35; }
.onb-text b { font-weight: 600; }
.onb-text .muted { font-size: var(--fs-caption); }

/* ---- phone ---- */
@media (max-width: 760px) {
  .dash .section-title { align-items: center; }
  .dash .section-title .more-link { min-height: 44px; }
  /* inbox: no avatar, one line of facts, three 44 px icon actions (✓ / ✎ / ×) */
  .inbox-row { grid-template-columns: minmax(0, 1fr) auto; min-height: 60px; }
  .inbox-row > .avatar, .inbox-actions .lbl { display: none; }
  .inbox-actions .btn-success { width: 44px; min-height: 44px; padding: 0; }
  .dash-figs .stat-grid.stack > .stat .stat-value { font-size: 26px; }
  .tl-side .btn-sm { min-height: 44px; }
  /* Dziś / Kolejne dni: icon-only Odbyta, so the name, pencil and cancel fit (the word stays from 761px) */
  .tl-main { grid-template-columns: 46px 4px minmax(0, 1fr); gap: 0 8px; }
  .tl-side { gap: 4px; }
  .tl-side .lbl { display: none; }
  .tl-side .btn-success { width: 44px; min-height: 44px; padding: 0; }
  .tl-name { white-space: normal; }
}
@media (max-width: 380px) {
  .dash-figs .stat-grid.stack > .stat .stat-value { font-size: 24px; }
  .ws-day { min-height: 76px; }
  .week-strip { gap: 2px; }   /* seven 44 px targets still fit inside the widget at 360 px */
  .tl-main { grid-template-columns: 46px 4px minmax(0, 1fr); gap: 0 8px; }
  .debt-row { gap: 8px; }
}

/* ---- desktop ---- */
@media (min-width: 761px) {
  .dash-hero-name { font-size: 30px; }
}
@media (min-width: 1001px) {
  .dash-home { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 0 40px; align-items: start; }
  .dash-home > .dash-main, .dash-home > .dash-side { display: flex; flex-direction: column; min-width: 0; }
  .dash-home > div > * { order: 0; }
  .dash-home > div > :first-child { margin-top: 0; }
}
/* wide screens: the page is full width, so the columns open up instead of stretching thin */
@media (min-width: 1440px) {
  .dash-home, .dash-grid { column-gap: 48px; }
  .dash-hero { grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); align-items: start; column-gap: 24px; }
  .dash-hero > :not(.dash-hero-who, .dash-hero-when) { grid-column: 1 / -1; }
}
@media (min-width: 1800px) {
  .dash-home { grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); }
  /* the side column becomes two: figures | week, debt | insights */
  .dash-home > .dash-side { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: var(--widget-gap); align-items: start; align-content: start; }
  .dash-home > .dash-side > :nth-child(2) { margin-top: 0; }
}
@media (hover: hover) {
  .tl-item:hover, .ws-day:hover:not(.is-today) { background: var(--paper-2); }
  .inbox-row:hover .inbox-name { text-decoration: underline; text-underline-offset: 3px; }
  .debt-who:hover b { text-decoration: underline; text-underline-offset: 3px; }
}
}
