/* סדרן – האזור האישי לתלמיד. Mobile first; logical properties so RTL and LTR both work. */
.tvl-portal {
  --tvl-p-accent: #1d6fa5;   /* set inline from the teacher's colour, already contrast-safe */
  --tvl-p-ink: #1d6fa5;
  --tvl-p-text: #111827;
  --tvl-p-muted: #4b5563;
  --tvl-p-line: #e5e7eb;
  --tvl-p-soft: #f6f7f9;
  --tvl-p-radius: 14px;
  max-width: 560px;
  margin-inline: auto;
  padding: 16px;
  box-sizing: border-box;
  color: var(--tvl-p-text);
  font-size: 16px;
  line-height: 1.5;
}
.tvl-portal *, .tvl-portal *::before, .tvl-portal *::after { box-sizing: border-box; }
.tvl-portal p { margin: 0; }

.tvl-p-muted { color: var(--tvl-p-muted); }
.tvl-p-small { font-size: 14px; }
.tvl-p-error { margin-block-start: 12px !important; padding: 10px 12px; border-radius: 10px; background: #fdecec; color: #8a1c1c; }
.tvl-p-ok { margin-block: 0 12px !important; padding: 10px 12px; border-radius: 10px; background: #e8f6ec; color: #135e2c; }

/* ---------- brand + header */
.tvl-p-brand { display: flex; align-items: center; gap: 10px; margin-block-end: 16px; }
.tvl-p-brand__logo { width: 40px; height: 40px; object-fit: contain; border-radius: 10px; }
.tvl-p-brand__name { font-weight: 700; color: var(--tvl-p-ink); }

.tvl-p-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-block-end: 12px; }
.tvl-p-title { margin: 0 0 4px; font-size: 22px; line-height: 1.3; }
.tvl-p-h { margin: 22px 0 10px; font-size: 17px; }

/* ---------- cards, inputs, buttons */
.tvl-p-card { padding: 18px; border: 1px solid var(--tvl-p-line); border-radius: var(--tvl-p-radius); background: #fff; }
.tvl-p-signin { display: grid; gap: 10px; }
.tvl-p-label { font-weight: 600; font-size: 15px; }
.tvl-p-input {
  width: 100%;
  min-height: 48px;
  padding: 10px 12px;
  border: 1px solid #cbd0d8;
  border-radius: 10px;
  background: #fff;
  color: inherit;
  font: inherit;
  font-size: 18px; /* 16px+ stops iOS from zooming into the field */
}
.tvl-p-input:focus { outline: 3px solid color-mix(in srgb, var(--tvl-p-accent) 35%, transparent); outline-offset: 1px; border-color: var(--tvl-p-accent); }
.tvl-p-input--code { letter-spacing: .35em; text-align: center; font-size: 24px; }

.tvl-p-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 10px 18px;
  border: 1px solid transparent;
  border-radius: 10px;
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}
.tvl-p-btn[disabled] { opacity: .6; cursor: default; }
.tvl-p-btn--primary { background: var(--tvl-p-accent); color: #fff; }
.tvl-p-btn--primary:hover, .tvl-p-btn--primary:focus-visible { filter: brightness(.92); color: #fff; }
.tvl-p-btn--quiet { background: #fff; border-color: #cbd0d8; color: var(--tvl-p-text); min-height: 40px; padding: 6px 14px; }
.tvl-p-btn--danger { background: #b42318; color: #fff; min-height: 40px; padding: 6px 14px; }
.tvl-p-link { padding: 6px 0; border: 0; background: none; color: var(--tvl-p-ink); font: inherit; font-size: 15px; text-decoration: underline; cursor: pointer; }
.tvl-p-row { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; }

/* ---------- student switcher + tabs */
.tvl-p-switch { display: grid; gap: 4px; margin-block-end: 12px; }
.tvl-p-tabs {
  display: flex;
  gap: 4px;
  padding: 4px;
  margin-block-end: 4px;
  border-radius: 12px;
  background: var(--tvl-p-soft);
}
.tvl-p-tab {
  flex: 1;
  min-height: 42px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--tvl-p-muted);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
.tvl-p-tab[aria-selected="true"] { background: #fff; color: var(--tvl-p-ink); box-shadow: 0 1px 3px rgba(0, 0, 0, .12); }

/* ---------- lessons */
.tvl-p-lesson {
  display: flex;
  gap: 14px;
  padding: 14px;
  margin-block-end: 10px;
  border: 1px solid var(--tvl-p-line);
  border-radius: var(--tvl-p-radius);
  background: #fff;
}
.tvl-p-lesson.is-pending { border-style: dashed; }
.tvl-p-lesson__when {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 0 0 64px;
  min-height: 64px;
  border-radius: 12px;
  background: var(--tvl-p-accent);
  color: #fff;
}
.tvl-p-lesson__day { font-size: 13px; line-height: 1.2; }
.tvl-p-lesson__date { font-size: 20px; font-weight: 700; line-height: 1.2; }
.tvl-p-lesson__main { display: grid; gap: 4px; align-content: start; flex: 1; min-width: 0; }
.tvl-p-lesson__main .tvl-p-btn { justify-self: start; margin-block-start: 6px; }
.tvl-p-lesson__time { font-size: 18px; font-weight: 700; }
.tvl-p-lesson__type { color: var(--tvl-p-muted); }
.tvl-p-badge { justify-self: start; padding: 2px 10px; border-radius: 999px; background: #fff4d6; color: #7a4b00; font-size: 13px; font-weight: 600; }
.tvl-p-lesson .tvl-p-confirm { flex-basis: 100%; }
.tvl-p-lesson:has(.tvl-p-confirm) { flex-wrap: wrap; }
.tvl-p-confirm { display: grid; gap: 10px; padding: 12px; margin-block-start: 6px; border-radius: 10px; background: #fff6f5; }
.tvl-p-confirm .tvl-p-row { justify-content: flex-start; }
.tvl-p-book { width: 100%; margin-block: 6px 10px; }

.tvl-p-history { display: grid; gap: 8px; }
.tvl-p-past { border: 1px solid var(--tvl-p-line); border-radius: 12px; background: #fff; }
.tvl-p-past summary {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 4px 12px;
  padding: 12px 14px;
  cursor: pointer;
  list-style: none;
}
.tvl-p-past summary::-webkit-details-marker { display: none; }
.tvl-p-past__date { font-weight: 600; }
.tvl-p-past__meta { color: var(--tvl-p-muted); font-size: 14px; }
.tvl-p-past__body { display: grid; gap: 6px; padding: 0 14px 14px; }
.tvl-p-summary { white-space: pre-line; }

/* ---------- progress */
.tvl-p-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(100px, 1fr)); gap: 8px; margin-block: 14px; }
.tvl-p-stat { display: grid; gap: 2px; padding: 14px; border-radius: 12px; background: var(--tvl-p-soft); text-align: center; }
.tvl-p-stat__value { font-size: 24px; font-weight: 700; color: var(--tvl-p-ink); }
.tvl-p-stat__label { font-size: 13px; color: var(--tvl-p-muted); }
.tvl-p-topics { display: grid; gap: 6px; margin: 0; padding: 0; list-style: none; }
.tvl-p-topic {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--tvl-p-line);
  background: #fff;
}
.tvl-p-topic__state { flex: none; font-size: 14px; font-weight: 600; }
.tvl-p-topic.is-mastered { background: #ecf8f0; border-color: #bfe5cc; }
.tvl-p-topic.is-mastered .tvl-p-topic__state { color: #135e2c; }
.tvl-p-topic.is-practiced .tvl-p-topic__state { color: var(--tvl-p-ink); }
.tvl-p-topic.is-untouched .tvl-p-topic__state { color: var(--tvl-p-muted); font-weight: 400; }

/* ---------- payments */
.tvl-p-balance { display: grid; gap: 8px; justify-items: start; padding: 18px; margin-block: 14px 10px; border-radius: var(--tvl-p-radius); background: #ecf8f0; }
.tvl-p-balance.is-owed { background: var(--tvl-p-soft); }
.tvl-p-balance__label { font-weight: 600; }
.tvl-p-balance__value { font-size: 30px; font-weight: 700; line-height: 1.1; }
.tvl-p-package { margin-block-end: 10px; }
.tvl-p-totals { display: grid; grid-template-columns: 1fr auto; gap: 6px 12px; margin: 0; padding: 14px; border-radius: 12px; border: 1px solid var(--tvl-p-line); }
.tvl-p-totals dt { color: var(--tvl-p-muted); }
.tvl-p-totals dd { margin: 0; font-weight: 600; }

.tvl-p-pays { display: grid; gap: 6px; margin: 0 0 14px; padding: 0; list-style: none; }
.tvl-p-pay { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 12px; padding: 10px 12px; border: 1px solid var(--tvl-p-line); border-radius: 10px; background: #fff; }
.tvl-p-pay__amount { font-weight: 700; }

/* ---------- offers + waiting list */
.tvl-p-regular { margin-block-end: 10px !important; padding: 8px 12px; border-radius: 10px; background: var(--tvl-p-soft); font-weight: 600; }
.tvl-p-offer { display: grid; gap: 6px; justify-items: start; padding: 16px; margin-block: 4px 12px; border-radius: var(--tvl-p-radius); border: 2px solid var(--tvl-p-accent); background: #fff; }
.tvl-p-offer__title { font-weight: 700; color: var(--tvl-p-ink); }
.tvl-p-offer__when { font-size: 18px; font-weight: 700; }
.tvl-p-wait { display: grid; gap: 8px; margin-block: 14px; }
.tvl-p-wait .tvl-p-h { margin: 0; }
.tvl-p-wait__form { display: grid; gap: 8px; }
.tvl-p-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.tvl-p-chip input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.tvl-p-chip label { display: inline-flex; align-items: center; min-height: 40px; padding: 6px 14px; border: 1px solid #cbd0d8; border-radius: 999px; background: #fff; cursor: pointer; }
.tvl-p-chip input:checked + label { background: var(--tvl-p-accent); border-color: var(--tvl-p-accent); color: #fff; }
.tvl-p-chip input:focus-visible + label { outline: 3px solid color-mix(in srgb, var(--tvl-p-accent) 35%, transparent); outline-offset: 1px; }
.tvl-p-wait__form .tvl-p-btn { justify-self: start; }

@media (min-width: 600px) {
  .tvl-portal { padding: 24px; }
  .tvl-p-title { font-size: 26px; }
}

/* "Are you coming?" — from the reminder link */
.tvl-p-attend { display: grid; gap: 4px; margin-block: 14px; border-inline-start: 4px solid var(--tvl-p-accent); }
.tvl-p-attend.is-confirmed { border-inline-start-color: #1a7f37; }
.tvl-p-attend.is-declined { border-inline-start-color: #b42318; }
.tvl-p-attend p { margin: 0; }
.tvl-p-attend__when { font-size: 18px; }
.tvl-p-attend__actions { margin-block-start: 12px; display: grid; gap: 8px; justify-items: start; }
.tvl-p-attend__state { font-weight: 600; }
.tvl-p-attend.is-confirmed .tvl-p-attend__state { color: #135e2c; }
.tvl-p-attend.is-declined .tvl-p-attend__state { color: #8a1c12; }
