/* MORASCHA Klassenbuch, JACHAD brand: navy #050577 + teal #69CCCC (from jachad.at).
   The old variable names (--cream, --paper, --gold, ...) stay, because the pages use them inline. */
:root {
  --navy: #050577;
  --navy-hover: #10129A;
  --teal: #69CCCC;
  --teal-ink: #0B6E6E;      /* teal dark enough for text on white (5.9:1) */
  --cream: #F3F5F9;         /* page background */
  --paper: #FFFFFF;         /* surfaces */
  --sunken: #F7F8FB;
  --ink: #0D1236;
  --muted: #565C7A;         /* 6.4:1 on white */
  --line: #E2E5EE;
  --line-strong: #CDD2E0;
  --gold: #9A5B00;          /* rewards: points, prizes, vouchers (5.6:1) */
  --gold-bg: #FFF4E0;
  --present: #0B6E6E;
  --present-bg: #E4F5F4;
  --present-line: #A9DCDA;
  --warn: #B42318;
  --warn-bg: #FDECEA;
  --shadow-sm: 0 1px 2px rgba(13, 18, 54, .06);
  --shadow: 0 1px 2px rgba(13, 18, 54, .05), 0 6px 18px -6px rgba(13, 18, 54, .10);
  --shadow-lg: 0 2px 4px rgba(13, 18, 54, .06), 0 18px 40px -12px rgba(5, 5, 119, .28);
  --tap: 58px;
  --r: 16px;
  --r-sm: 12px;
  --ease: cubic-bezier(.16, 1, .3, 1);
  color-scheme: light;
  accent-color: var(--navy);
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--cream);
  color: var(--ink);
  font: 400 16px/1.5 "Rubik", "Segoe UI", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  min-height: 100vh;
  caret-color: var(--navy);
}
::selection { background: rgba(105, 204, 204, .45); color: var(--ink); }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--navy); text-underline-offset: 3px; }
bdi { unicode-bidi: isolate; }
:focus-visible { outline: 3px solid var(--teal); outline-offset: 2px; }
h1, h2, h3 { letter-spacing: -.01em; }
table, .codebox, .pill, .num { font-variant-numeric: tabular-nums; }
* { scrollbar-color: var(--line-strong) transparent; }

/* ---------- top bar */
header.bar {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; gap: 10px;
  padding: 10px 16px; padding-top: calc(10px + env(safe-area-inset-top));
  background: var(--navy); color: #fff;
  box-shadow: 0 1px 0 rgba(255, 255, 255, .06), 0 6px 20px -10px rgba(5, 5, 119, .6);
}
header.bar h1 {
  font-size: 18px; font-weight: 600; margin: 0; flex: 1; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
header.bar .sub { color: rgba(255, 255, 255, .72); font-size: 14px; font-weight: 400; margin-inline-start: 4px; }
header.bar .brand { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0; text-decoration: none; color: #fff; }
header.bar .brand img { height: 26px; width: auto; display: block; flex: none; }
header.bar .brand .sep { width: 1px; height: 28px; background: rgba(255, 255, 255, .25); flex: none; }
header.bar .brand .t { min-width: 0; line-height: 1.15; }
header.bar .brand .t b { display: block; font-size: 15px; font-weight: 700; letter-spacing: .14em; }
header.bar .brand .t span { display: block; font-size: 12.5px; color: rgba(255, 255, 255, .72); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
header.bar .iconbtn {
  background: rgba(255, 255, 255, .08); border-color: rgba(255, 255, 255, .18); color: #fff;
}
header.bar .iconbtn:hover { background: rgba(255, 255, 255, .16); }

.iconbtn {
  min-width: 44px; height: 44px; border-radius: var(--r-sm); border: 1px solid var(--line);
  background: var(--paper); display: inline-flex; align-items: center; justify-content: center;
  padding: 0 12px; cursor: pointer; text-decoration: none; color: var(--ink); font-weight: 500; font-size: 14px;
  transition: background .15s var(--ease), border-color .15s var(--ease);
}
.iconbtn:hover { border-color: var(--line-strong); }
.iconbtn svg { width: 22px; height: 22px; }
main { max-width: 760px; margin: 0 auto; padding: 20px 16px 128px; }
main.wide { max-width: 1120px; }

/* ---------- surfaces */
.card {
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--r);
  padding: 18px; margin-bottom: 16px; box-shadow: var(--shadow-sm);
}
.card h2 { font-size: 17px; font-weight: 600; margin: 0 0 12px; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.gold { color: var(--gold); }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
.section-title { font-size: 13px; font-weight: 600; color: var(--muted); margin: 26px 2px 10px; }

/* ---------- buttons and fields */
.btn {
  min-height: 48px; padding: 0 20px; border-radius: var(--r-sm); border: 1px solid var(--navy);
  background: var(--navy); color: #fff; font-weight: 600; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none;
  box-shadow: 0 1px 2px rgba(5, 5, 119, .2);
  transition: background .15s var(--ease), box-shadow .15s var(--ease), transform .1s var(--ease);
}
.btn:hover { background: var(--navy-hover); }
.btn:active { transform: translateY(1px); }
.btn svg { width: 20px; height: 20px; }
.btn.secondary { background: var(--paper); color: var(--ink); border-color: var(--line-strong); box-shadow: var(--shadow-sm); }
.btn.secondary:hover { border-color: var(--navy); color: var(--navy); }
.btn.danger { background: var(--paper); color: var(--warn); border-color: #F1B8B2; box-shadow: none; }
.btn.danger:hover { background: var(--warn-bg); }
.btn:disabled { opacity: .45; cursor: default; transform: none; }
input[type=text], input[type=password], input[type=email], input[type=number], input[type=date], input[type=search], input:not([type]), select, textarea {
  min-height: 48px; padding: 10px 14px; border: 1px solid var(--line-strong); border-radius: var(--r-sm);
  background: #fff; width: 100%; transition: border-color .15s var(--ease), box-shadow .15s var(--ease);
}
input::placeholder, textarea::placeholder { color: #6E7491; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--navy); box-shadow: 0 0 0 4px rgba(105, 204, 204, .35); }
label.f { display: block; margin: 14px 0 6px; font-weight: 500; font-size: 14px; color: var(--ink); }
input[type=checkbox] { width: 20px; height: 20px; }
input[type=file] { max-width: 100%; font-size: 14px; color: var(--muted); }
input[type=file]::file-selector-button {
  min-height: 44px; margin-inline-end: 10px; padding: 0 16px; border-radius: var(--r-sm); border: 1px solid var(--line-strong);
  background: var(--paper); color: var(--ink); font: inherit; font-weight: 500; cursor: pointer;
}

/* ---------- home: admin shortcuts + class list */
.hello { margin: 4px 2px 18px; }
.hello h1 { font-size: 24px; font-weight: 700; color: var(--navy); margin: 0; letter-spacing: .06em; }
.hello h1 span { font-weight: 400; color: var(--muted); letter-spacing: 0; margin-inline-start: 4px; }
.hello p { margin: 4px 0 0; color: var(--muted); display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
/* the page itself carries the MORASCHA title, so the home bar shows only the logo */
header.bar .brand .sep, header.bar .brand .t { display: none; }
.adminnav { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-bottom: 8px; }
@media (min-width: 640px) { .adminnav { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.adminnav a {
  display: flex; align-items: center; gap: 12px; padding: 14px; min-height: 68px; font-size: 15px; line-height: 1.25;
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow-sm);
  color: var(--ink); text-decoration: none; font-weight: 500;
  transition: border-color .15s var(--ease), box-shadow .15s var(--ease);
}
.adminnav a:hover { border-color: var(--teal); box-shadow: var(--shadow); }
.adminnav .ic {
  width: 38px; height: 38px; border-radius: 10px; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  background: #EEF0FB; color: var(--navy);
}
.adminnav .ic svg { width: 20px; height: 20px; }

.classlist a {
  display: flex; align-items: center; gap: 14px; padding: 16px 18px; margin-bottom: 10px;
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow-sm);
  text-decoration: none; color: var(--ink); min-height: 76px;
  transition: border-color .15s var(--ease), box-shadow .15s var(--ease), transform .15s var(--ease);
}
.classlist a:hover { border-color: var(--teal); box-shadow: var(--shadow); }
.classlist a:active { transform: scale(.995); }
.classlist .badge {
  width: 46px; height: 46px; border-radius: 14px; flex: none;
  display: inline-flex; flex-direction: column; align-items: center; justify-content: center;
  background: var(--present-bg); color: var(--teal-ink); font-weight: 700; font-size: 17px; line-height: 1;
}
.classlist .badge small { font-size: 9.5px; font-weight: 500; margin-top: 3px; letter-spacing: .02em; }
.classlist .name { font-size: 18px; font-weight: 600; }
.classlist .meta { color: var(--muted); font-size: 14px; margin-top: 2px; }
.chev { margin-inline-start: auto; color: var(--line-strong); display: inline-flex; }
.chev svg { width: 22px; height: 22px; }
[dir=rtl] .chev { transform: scaleX(-1); }

/* ---------- class book: date bar */
.datebar {
  display: flex; align-items: center; gap: 8px; margin-bottom: 14px;
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--r); padding: 8px; box-shadow: var(--shadow-sm);
}
.datebar .date { flex: 1; text-align: center; font-weight: 600; font-size: 17px; }
.datebar .date small { display: block; font-weight: 400; color: var(--muted); font-size: 13px; }
.datebar .iconbtn { font-size: 24px; border-color: transparent; background: var(--sunken); }
.pill { display: inline-block; padding: 3px 10px; border-radius: 99px; background: var(--sunken); border: 1px solid var(--line); font-size: 12.5px; font-weight: 500; }
.pill.ok { background: var(--present-bg); border-color: var(--present-line); color: var(--present); }
.pill.warn { background: var(--warn-bg); border-color: #F6C9C3; color: var(--warn); }
.pill.strong { background: var(--warn); border-color: var(--warn); color: #fff; }

/* ---------- roster: the screen a teacher lives in */
.roster { list-style: none; padding: 0; margin: 0; }
.roster li {
  display: flex; align-items: stretch; gap: 6px; margin-bottom: 8px;
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: background .18s var(--ease), border-color .18s var(--ease);
}
.roster li.on { background: var(--present-bg); border-color: var(--present-line); }
.roster .who {
  flex: 1; display: flex; align-items: center; gap: 14px; padding: 0 16px; min-height: var(--tap);
  background: none; border: 0; text-align: start; cursor: pointer; font-size: 18px; font-weight: 500;
  touch-action: manipulation; user-select: none;
}
.roster .tick {
  width: 30px; height: 30px; border-radius: 50%; border: 2px solid var(--line-strong); flex: none;
  display: inline-flex; align-items: center; justify-content: center; background: #fff;
  transition: background .18s var(--ease), border-color .18s var(--ease), transform .18s var(--ease);
}
.roster li.on .tick { background: var(--teal-ink); border-color: var(--teal-ink); color: #fff; transform: scale(1.04); }
.roster .extra { display: flex; align-items: center; gap: 4px; padding-inline-end: 8px; }
.roster .extra button {
  min-width: 46px; height: 42px; border-radius: 10px; border: 1px solid var(--line); background: #fff;
  font-weight: 600; cursor: pointer; touch-action: manipulation;
}
.roster .extra .plus { border-color: #E9C98F; background: var(--gold-bg); color: var(--gold); }
.roster .extra .n { min-width: 28px; text-align: center; font-weight: 700; color: var(--gold); }
.roster li:not(.on) .extra { visibility: hidden; }
/* "+1" / "+2" must read left-to-right inside Hebrew, or they show as "1+". */
.roster .extra .plus, .roster .extra .n { direction: ltr; unicode-bidi: isolate; }

.lessonbox textarea { min-height: 52px; resize: vertical; }
.photo-row { display: flex; gap: 10px; align-items: center; margin-top: 12px; }
.photo-row img { width: 84px; height: 84px; object-fit: cover; border-radius: 12px; border: 1px solid var(--line); }
.camera { display: inline-flex; align-items: center; gap: 8px; }
.camera input { display: none; }

.footer-actions {
  position: fixed; inset-inline: 0; bottom: 0; z-index: 4;
  background: linear-gradient(to top, var(--cream) 72%, rgba(243, 245, 249, 0));
  padding: 16px 16px calc(14px + env(safe-area-inset-bottom));
}
.footer-actions .inner { max-width: 760px; margin: 0 auto; display: flex; gap: 10px; }
.footer-actions .btn { flex: 1; min-height: 54px; box-shadow: var(--shadow-lg); }
.footer-actions .btn.secondary { box-shadow: var(--shadow); }

.sync { font-size: 13px; color: var(--muted); }
.sync.pending { color: var(--gold); }
.sync.err { color: var(--warn); }

.toast {
  position: fixed; inset-inline: 16px; bottom: 96px; z-index: 50; margin: 0 auto; max-width: 520px;
  background: var(--ink); color: #fff; padding: 13px 18px; border-radius: var(--r-sm); font-weight: 500;
  box-shadow: var(--shadow-lg);
  opacity: 0; transform: translateY(10px); transition: opacity .2s var(--ease), transform .2s var(--ease); pointer-events: none;
}
.toast.show { opacity: 1; transform: none; }

dialog {
  border: 0; border-radius: 20px; padding: 0; width: min(560px, calc(100vw - 32px)); max-height: 86vh;
  background: var(--paper); color: var(--ink); box-shadow: var(--shadow-lg);
}
dialog::backdrop { background: rgba(5, 5, 60, .45); backdrop-filter: blur(2px); }
dialog .dh { display: flex; align-items: center; padding: 14px 16px 14px 20px; border-bottom: 1px solid var(--line); }
dialog .dh h3 { margin: 0; flex: 1; font-size: 17px; font-weight: 600; }
dialog .db { padding: 18px 20px; overflow: auto; max-height: calc(86vh - 70px); }

table { width: 100%; border-collapse: collapse; font-size: 15px; }
th, td { text-align: start; padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 12.5px; color: var(--muted); font-weight: 500; background: var(--sunken); }
tbody tr:hover td { background: #FAFBFD; }
.tablewrap { overflow-x: auto; border-radius: var(--r-sm); }

.tabs { display: flex; gap: 4px; margin-bottom: 16px; overflow-x: auto; padding: 4px; background: #E8EBF3; border-radius: 14px; width: fit-content; max-width: 100%; }
.tabs button {
  min-height: 40px; padding: 0 16px; border-radius: 10px; border: 0; background: transparent;
  font-weight: 500; cursor: pointer; white-space: nowrap; color: var(--muted);
}
.tabs button.on { background: var(--paper); color: var(--navy); box-shadow: var(--shadow-sm); font-weight: 600; }

.bars { display: flex; align-items: flex-end; gap: 6px; height: 96px; padding-top: 8px; }
.bars .b { flex: 1; max-width: 72px; background: #C9E9E8; border-radius: 6px 6px 2px 2px; position: relative; min-height: 2px; }
.bars .b:last-child { background: var(--navy); }
.bars .b span { position: absolute; top: -19px; inset-inline: 0; text-align: center; font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.barlabels { display: flex; gap: 6px; font-size: 11px; color: var(--muted); margin-top: 4px; }
.barlabels span { flex: 1; max-width: 72px; text-align: center; }

.codebox {
  font-size: 34px; font-weight: 700; letter-spacing: 8px; text-align: center; padding: 16px;
  background: var(--present-bg); color: var(--navy); border: 1px dashed var(--present-line); border-radius: var(--r-sm); direction: ltr;
}

/* ---------- login */
.login-wrap { min-height: 100vh; display: flex; flex-direction: column; }
.login-hero {
  background: var(--navy); color: #fff; padding: calc(52px + env(safe-area-inset-top)) 24px 96px; text-align: center;
  position: relative; overflow: hidden;
}
.login-hero::after {
  /* the teal Alef from the JACHAD mark, large and quiet behind the title */
  content: ""; position: absolute; inset-inline-end: -40px; bottom: -70px; width: 260px; height: 224px;
  background: url(/brand/alef-white.png) no-repeat center / contain; opacity: .06; pointer-events: none;
}
.login-hero img { height: 34px; width: auto; }
.login-hero h1 { font-size: 30px; font-weight: 700; letter-spacing: .2em; margin: 26px 0 2px; padding-inline-start: .2em; }
.login-hero p { margin: 0; color: rgba(255, 255, 255, .75); font-size: 16px; }
.login {
  width: min(420px, calc(100% - 32px)); margin: -60px auto 0; position: relative;
  background: var(--paper); border-radius: 20px; padding: 26px 22px 22px; box-shadow: var(--shadow-lg);
}
.login .hint { margin: 0 0 14px; color: var(--muted); text-align: center; }
.login h2 { font-size: 18px; font-weight: 600; text-align: center; margin: 0 0 6px; }
.login input { font-size: 26px; text-align: center; letter-spacing: 6px; direction: ltr; min-height: 58px; font-weight: 600; }
.login .btn { width: 100%; min-height: 54px; font-size: 17px; }
.login .btn + .btn { margin-top: 10px; }
.login input[type=email], .login #pw { font-size: 17px; letter-spacing: 0; font-weight: 400; text-align: start; min-height: 52px; }
.login #pw { margin-top: 10px; }
.pwlogin { margin-top: 16px; border-top: 1px solid var(--line); padding-top: 12px; }
.pwlogin summary { cursor: pointer; color: var(--muted); font-size: 14px; text-align: center; list-style: none; }
.pwlogin summary::-webkit-details-marker { display: none; }
.pwlogin[open] summary { margin-bottom: 12px; color: var(--ink); }
.pwlogin input { font-size: 17px; letter-spacing: 0; min-height: 50px; font-weight: 400; text-align: start; margin-bottom: 10px; }
.parent-cta {
  display: block; width: min(420px, calc(100% - 32px)); margin: 16px auto 0; padding: 16px; text-align: center;
  border: 1px solid var(--present-line); background: var(--present-bg); color: var(--teal-ink); border-radius: var(--r);
  font-weight: 600; text-decoration: none;
}
.parent-cta:hover { border-color: var(--teal); }
.login-foot { margin-top: auto; padding: 28px 16px 22px; text-align: center; }

.foot { text-align: center; color: var(--muted); font-size: 12px; margin: 36px 0 10px; }
.foot img { height: 14px; width: auto; vertical-align: -2px; opacity: .55; margin-inline-end: 6px; }
.empty { text-align: center; color: var(--muted); padding: 34px 12px; background: var(--paper); border: 1px dashed var(--line-strong); border-radius: var(--r); }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0s !important; animation-duration: 0s !important; }
}

@media print {
  header.bar, .footer-actions, .noprint, .toast { display: none !important; }
  body { background: #fff; font-size: 11pt; }
  main { max-width: none; padding: 0; }
  .card { border: 0; padding: 0; background: none; box-shadow: none; }
}
/* The e-mail field on the parent login: normal text, not the spaced-out code look. */
.login input[type=email] { font-size: 18px; letter-spacing: 0; }
