/* Naalai sample apps (login, teacher, family, school): shared chrome and controls in the paper world.
   Owned by the apps agent. Tokens come from base.css and paper-kit.css; anything new is defined here (never in base).
   Operate mode: scannable, the same control vocabulary on every page, 44 px targets, text at least 16-17 px, AA. */

:root {
  --ab-h: 68px;
  --line: rgba(30, 42, 90, .11);
  --line-2: rgba(30, 42, 90, .2);
  --rule: rgba(35, 70, 198, .14);                 /* the notebook rule under a line of writing */
  --ok: #2E7D45; --ok-ink: #1F6B3A; --ok-bg: var(--mint);
  --no: #C23B2E; --no-ink: #9A2B22; --no-bg: #FFE0DC;
  --late: var(--amber); --late-ink: #7A4A10; --late-bg: var(--lemon);
  --field: #FFFDF8;
  --cut: 22px 26px 21px 25px / 25px 21px 26px 22px;
  --cut-sm: 12px 14px 11px 13px / 13px 11px 14px 12px;
  --sh: 0 1px 1.5px rgba(90, 42, 0, .26), 0 12px 26px -14px rgba(90, 42, 0, .38);
  --sh-sm: 0 1px 1px rgba(90, 42, 0, .22), 0 4px 9px -6px rgba(90, 42, 0, .36);
  --sh-lift: 0 2px 3px rgba(90, 42, 0, .22), 0 26px 44px -20px rgba(90, 42, 0, .42);
  --edge: inset 0 1px 0 rgba(255, 255, 255, .8), inset 0 -1px 0 rgba(90, 42, 0, .05);
  --settle: var(--m-settle, cubic-bezier(.16, 1, .3, 1));
  --spring: var(--m-spring, cubic-bezier(.16, 1, .3, 1));
}

html { scrollbar-color: rgba(30, 42, 90, .3) transparent; scrollbar-gutter: stable; }
body.app { font-size: 17px; line-height: 1.55; }
@media (min-width: 900px) { body.app { font-size: 18px; } }
body.app :is(input, textarea) { caret-color: var(--blue); }
::-webkit-scrollbar { width: 12px; height: 12px; }
::-webkit-scrollbar-thumb { background: rgba(30, 42, 90, .26); border: 3px solid transparent; background-clip: padding-box; border-radius: 99px; }
::-webkit-scrollbar-track { background: transparent; }
.num { font-variant-numeric: tabular-nums; }
[hidden] { display: none !important; }
.ico { width: 22px; height: 22px; flex: none; }
.tag { height: auto; min-height: 26px; padding: 3px 11px; font-size: 13.5px; line-height: 1.2; }
.tag--free { background: var(--mint); color: var(--ok-ink); }
.tag--soon { background: var(--pink); color: #8A2440; }
.tag--to { background: rgba(30, 42, 90, .08); color: var(--ink-2); }
.face { display: block; flex: none; border-radius: 50%; box-shadow: 0 1px 1.5px rgba(90, 42, 0, .28), 0 5px 10px -6px rgba(90, 42, 0, .4); }

/* =====================================================================================================================
   Top bar: a cream paper strip with a scissor-cut edge. Logo, app name, the sample label, who is signed in, actions.
   ===================================================================================================================== */
.ab { position: sticky; top: 0; z-index: 60; }
.ab__bar { position: relative; z-index: 2; background: var(--paper) url(/assets/art/textures/paper-tile.webp) 0 0 / 512px 512px; }
.ab__bar::after, .ab__bar::before { content: ""; position: absolute; left: 0; right: 0; top: calc(100% - 1px); pointer-events: none; }
.ab__bar::after { height: 12px; background: var(--paper) url(/assets/art/textures/paper-tile.webp) 0 0 / 512px 512px;
  -webkit-mask: url(/assets/art/textures/edge-cut.svg) 0 0 / auto 100% repeat-x; mask: url(/assets/art/textures/edge-cut.svg) 0 0 / auto 100% repeat-x; }
.ab__bar::before { height: 32px; opacity: 0; transition: opacity 300ms var(--settle);
  background: url(/assets/art/textures/edge-cut-shadow.webp) 0 0 / auto 12px repeat-x, linear-gradient(rgba(90, 42, 0, .14), rgba(90, 42, 0, 0)); }
.ab.is-stuck .ab__bar::before { opacity: 1; }
.ab__inner { width: min(1240px, calc(100% - 2 * var(--gutter))); margin-inline: auto; min-height: var(--ab-h);
  display: grid; grid-template-columns: auto auto 1fr auto; grid-template-areas: "logo title sample acts"; align-items: center; column-gap: 16px; }
.ab__logo { grid-area: logo; display: block; padding: 4px; margin-left: -4px; border-radius: 12px; }
.ab__logo img { width: 136px; height: auto; }
.ab__title { grid-area: title; position: relative; padding: 4px 0 4px 18px; font: 800 20px/1.1 var(--font-display); color: var(--ink); white-space: nowrap; }
.ab__title::before { content: ""; position: absolute; left: 0; top: 50%; width: 2px; height: 26px; translate: 0 -50%; border-radius: 2px; background: var(--line-2); } /* a hand-ruled divider after the logo */
.ab__sample { grid-area: sample; justify-self: end; display: flex; align-items: center; gap: 8px; margin: 0; font: 700 15px/1.3 var(--font-body); color: var(--ink-2); }
.ab__acts { grid-area: acts; display: flex; align-items: center; gap: 10px; }
.ab__who { display: grid; justify-items: end; gap: 2px; margin: 0 4px 0 6px; line-height: 1.15; text-align: right; }
.ab__who b { font: 800 16px/1.15 var(--font-body); color: var(--ink); }
.ab__who span { font: 700 15px/1.15 var(--font-body); color: var(--ink-2); }
.ab__btn, .ab__menu { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 15px 0 12px; border: 0; white-space: nowrap;
  border-radius: 14px 16px 13px 15px / 15px 13px 16px 14px; background: var(--card); color: var(--ink); font: 800 15.5px/1 var(--font-body);
  box-shadow: inset 0 0 0 2px rgba(30, 42, 90, .12), 0 1px 1px rgba(90, 42, 0, .14); transition: transform 100ms var(--settle), box-shadow 200ms var(--settle); }
.ab__btn .ico, .ab__menu .ico { width: 20px; height: 20px; color: var(--ink-2); }
@media (hover: hover) and (pointer: fine) { .ab__btn:hover, .ab__menu:hover { box-shadow: inset 0 0 0 2px rgba(30, 42, 90, .26), var(--sh-sm); } }
.ab__btn:active, .ab__menu:active { transform: scale(.97); }
.ab__menu { display: none; grid-area: acts; }

@media (max-width: 1159.98px) {
  .ab__sample-text { display: none; }
}
/* phones: the sample line becomes a strip under the bar; the actions drop down from a Menu button */
@media (max-width: 779.98px) {
  :root { --ab-h: 60px; }
  .ab__inner { grid-template-columns: auto 1fr auto; grid-template-areas: "logo title acts" "sample sample sample"; column-gap: 12px; }
  .ab__logo img { width: 112px; }
  .ab__title { font-size: 18px; padding-left: 13px; justify-self: start; }
  .ab__sample { justify-self: stretch; justify-content: center; padding: 7px 0 9px; border-top: 1.5px dashed var(--line-2); }
  .ab__sample-text { display: inline; }
  .ab__menu { display: inline-flex; }
  .ab__acts { position: absolute; top: calc(100% + 6px); right: var(--gutter); z-index: 3; min-width: min(300px, calc(100vw - 2 * var(--gutter)));
    display: none; flex-direction: column; align-items: stretch; gap: 8px; padding: 14px;
    background: var(--card) url(/assets/art/textures/paper-tile.webp) 0 0 / 512px 512px; border-radius: var(--cut); box-shadow: var(--edge), var(--sh-lift); }
  .ab.is-open .ab__acts { display: flex; animation: ab-drop 260ms var(--settle) both; }
  .ab__who { justify-items: start; text-align: left; margin: 2px 4px 6px; }
  .ab__acts .ab__btn { justify-content: flex-start; min-height: 48px; }
}
@media (max-width: 379.98px) {
  .ab__sample { font-size: 14.5px; }
  .ab__menu span { display: none; }
  .ab__menu { padding: 0 12px; }
}
@keyframes ab-drop { from { opacity: 0; transform: translateY(-6px) scale(.98); } }

/* =====================================================================================================================
   Page frame
   ===================================================================================================================== */
.app-main { width: min(1180px, calc(100% - 2 * var(--gutter))); margin-inline: auto; padding: 30px 0 96px; }
@media (max-width: 779.98px) { .app-main { padding-top: 22px; } }
.ph { display: flex; align-items: center; gap: 16px; margin: 6px 0 26px; }
.ph__art { flex: none; }
.ph h1 { font-size: 32px; line-height: 1.08; }
.ph__sub { margin-top: 6px; font: 700 17px/1.4 var(--font-body); color: var(--ink-2); }
@media (min-width: 900px) { .ph h1 { font-size: 42px; } .ph__sub { font-size: 18px; } }
.ph__side { margin-left: auto; display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }

.cols { display: grid; gap: 22px; align-items: start; }
@media (min-width: 1000px) {
  .cols { grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: 28px; }
  .cols > .col { display: grid; gap: 28px; align-content: start; }
}
.col { display: grid; gap: 22px; align-content: start; min-width: 0; }

/* a sheet of paper: one per task on the page, never nested */
.sheet { position: relative; isolation: isolate; padding: clamp(18px, 2.4vw, 28px); background: var(--card); color: var(--ink);
  border-radius: var(--cut); box-shadow: var(--edge), var(--sh); }
.sheet::after { content: ""; position: absolute; inset: 0; z-index: -1; border-radius: inherit; pointer-events: none;
  background: url(/assets/art/textures/grain-tile.webp) 0 0 / 256px 256px; mix-blend-mode: multiply; opacity: .45; }
.sheet--sky { background: var(--sky); }
.sheet--lemon { background: #FFF3C4; }
.sheet__head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px 14px; margin-bottom: 16px; }
.sheet__head h2 { font-size: 24px; line-height: 1.15; }
.sheet__head p { font: 700 16px/1.35 var(--font-body); color: var(--ink-2); }
.sheet__title { display: flex; align-items: center; gap: 12px; min-width: 0; }
.sheet__title img { width: 40px; height: 40px; flex: none; }
.sheet h3 { font-size: 19px; line-height: 1.2; }
@media (min-width: 900px) { .sheet__head h2 { font-size: 26px; } }

/* =====================================================================================================================
   Buttons (base .btn is the paper pill; these are the app's sizes and the quiet and icon kinds)
   ===================================================================================================================== */
.btn { touch-action: manipulation; }
.btn .ico { width: 20px; height: 20px; }
.btn--sm { min-height: 44px; padding: 0 18px; font-size: 16px; gap: 8px; }
.btn--wide { width: 100%; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .55; cursor: not-allowed; box-shadow: none; transform: none; }
.btn--blue:hover { background: var(--blue-deep); }
.btn--quiet { min-height: 44px; padding: 0 12px; background: transparent; color: var(--blue); box-shadow: none; font-size: 16px; gap: 8px; }
.btn--quiet:hover { background: rgba(35, 70, 198, .08); box-shadow: none; }
.ibtn { display: inline-grid; place-items: center; width: 44px; height: 44px; flex: none; border: 0; border-radius: 13px 15px 12px 14px / 14px 12px 15px 13px;
  background: transparent; color: var(--ink-2); transition: background-color 150ms var(--settle), transform 100ms var(--settle); }
.ibtn:hover { background: rgba(30, 42, 90, .07); color: var(--ink); }
.ibtn:active { transform: scale(.94); }
.ibtn--danger:hover { background: var(--no-bg); color: var(--no-ink); }
.ibtn .ico { width: 21px; height: 21px; }
.linkish { padding: 12px 0; margin: -12px 0; border: 0; background: none; color: var(--blue); font: inherit; font-weight: 800; text-decoration: underline; text-underline-offset: .18em; cursor: pointer; }

/* =====================================================================================================================
   Fields
   ===================================================================================================================== */
.field { display: grid; gap: 8px; min-width: 0; }
fieldset.field { margin: 0; padding: 0; border: 0; }
fieldset.field > legend { padding: 0; margin-bottom: 8px; }
.label { font: 800 16.5px/1.25 var(--font-body); color: var(--ink); }
.hint { font: 600 15.5px/1.45 var(--font-body); color: var(--ink-2); }
.input, .textarea, .select { width: 100%; min-height: 54px; padding: 13px 16px; border: 0; border-radius: 14px 16px 13px 15px / 15px 13px 16px 14px;
  background: var(--field); color: var(--ink); font: 650 18px/1.35 var(--font-body);
  box-shadow: inset 0 0 0 2px rgba(30, 42, 90, .2), inset 0 3px 4px -2px rgba(90, 42, 0, .12); transition: box-shadow 150ms var(--settle); }
.textarea { min-height: 104px; resize: vertical; }
.select { appearance: none; padding-right: 46px; cursor: pointer;
  background: var(--field) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='m6.5 9.5 5.5 5.5 5.5-5.5' fill='none' stroke='%2348506F' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") right 14px center / 22px no-repeat; }
.input:hover, .textarea:hover, .select:hover { box-shadow: inset 0 0 0 2px rgba(30, 42, 90, .34), inset 0 3px 4px -2px rgba(90, 42, 0, .12); }
.input:focus-visible, .textarea:focus-visible, .select:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; box-shadow: inset 0 0 0 2px var(--blue); }
.input::placeholder, .textarea::placeholder { color: var(--ink-3); opacity: 1; font-weight: 600; }
.input[aria-invalid="true"], .textarea[aria-invalid="true"] { box-shadow: inset 0 0 0 2px var(--no), inset 0 3px 4px -2px rgba(90, 42, 0, .12); }
.err { display: flex; align-items: flex-start; gap: 8px; margin: 0; font: 750 16px/1.4 var(--font-body); color: var(--no-ink); }
.err::before { content: ""; flex: none; width: 20px; height: 20px; margin-top: 1px; border-radius: 50%; background: var(--no);
  -webkit-mask: url(/assets/art/icons/mark-cross.svg) center / 70% no-repeat, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask: url(/assets/art/icons/mark-cross.svg) center / 70% no-repeat exclude, linear-gradient(#000 0 0); }
.err:empty { display: none; }

/* pills that are radio buttons or checkboxes: the input covers the pill, so it stays a real control */
.pick { position: relative; display: inline-flex; }
.pick input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.pick > span { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 16px; border-radius: 13px 15px 12px 14px / 14px 12px 15px 13px;
  background: var(--card); color: var(--ink-2); font: 800 16px/1.1 var(--font-body); white-space: nowrap;
  box-shadow: inset 0 0 0 2px rgba(30, 42, 90, .14), 0 1px 0 rgba(255, 255, 255, .8); transition: background-color 150ms var(--settle), color 150ms var(--settle), transform 100ms var(--settle); }
.pick:hover > span { color: var(--ink); box-shadow: inset 0 0 0 2px rgba(30, 42, 90, .28); }
.pick input:checked + span { background: var(--ink); color: #FFFFFF; box-shadow: inset 0 1px 0 rgba(255, 255, 255, .18), var(--sh-sm); }
.pick input:focus-visible + span { outline: 3px solid var(--blue); outline-offset: 3px; }
.pick input:active + span { transform: scale(.96); }
.picks { display: flex; flex-wrap: wrap; gap: 8px; }
.picks--scroll { flex-wrap: nowrap; overflow-x: auto; padding: 4px 2px 8px; margin: -4px -2px -8px; scrollbar-width: none; }
.picks--scroll::-webkit-scrollbar { display: none; }

/* a paper tick-box (checkbox) with a 44 px target */
.tick { position: relative; display: inline-grid; place-items: center; width: 44px; height: 44px; flex: none; }
.tick input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.tick span { width: 32px; height: 32px; border-radius: 10px 11px 9px 11px / 11px 9px 11px 10px; background: var(--field);
  box-shadow: inset 0 0 0 2.2px rgba(30, 42, 90, .3), 0 1px 0 rgba(255, 255, 255, .8); display: grid; place-items: center; transition: background-color 150ms var(--settle); }
.tick span::after { content: ""; width: 22px; height: 22px; background: #FFFFFF; transform: scale(0); transition: transform 300ms var(--spring);
  -webkit-mask: url(/assets/art/icons/mark-tick.svg) center / contain no-repeat; mask: url(/assets/art/icons/mark-tick.svg) center / contain no-repeat; }
.tick input:checked + span { background: var(--ok); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .3), var(--sh-sm); }
.tick input:checked + span::after { transform: scale(1); }
.tick input:focus-visible + span { outline: 3px solid var(--blue); outline-offset: 3px; }
.tick:hover input:not(:checked) + span { box-shadow: inset 0 0 0 2.2px rgba(30, 42, 90, .5); }

/* =====================================================================================================================
   Notes and states
   ===================================================================================================================== */
.note { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: var(--cut-sm); background: var(--sky); color: var(--ink);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .6), 0 1px 0 rgba(90, 42, 0, .1); font: 650 16px/1.45 var(--font-body); }
.note b { font-weight: 800; }
.note > img { width: 34px; height: 34px; flex: none; }
.note--sun { background: #FFF1C2; }
.note--mint { background: var(--mint); }
.note--pink { background: #FFE3EA; }
.empty { display: grid; justify-items: center; gap: 10px; padding: 22px 12px 18px; text-align: center; }
.empty img { width: 92px; height: auto; }
.empty p { max-width: 34ch; font: 650 17px/1.45 var(--font-body); color: var(--ink-2); }
.empty b { color: var(--ink); }
.state { display: inline-flex; align-items: center; gap: 6px; min-height: 30px; padding: 3px 11px; border-radius: 99px; font: 800 14.5px/1.15 var(--font-body); white-space: nowrap; }
.state--ok { background: var(--ok-bg); color: var(--ok-ink); }
.state--no { background: var(--no-bg); color: var(--no-ink); }
.state--late { background: var(--late-bg); color: var(--late-ink); }
.state--wait { background: var(--paper-deep); color: #6A4A1A; }
.state--plain { background: rgba(30, 42, 90, .07); color: var(--ink-2); }
.state--new { background: var(--blue); color: #FFFFFF; }

/* a line in a list: picture, words, actions */
.line { display: flex; align-items: center; gap: 14px; padding: 12px 0; border-bottom: 1.5px solid var(--rule); min-width: 0; }
.line:last-child { border-bottom: 0; }
.line__body { flex: 1; min-width: 0; }
.line__title { font: 800 17px/1.35 var(--font-body); color: var(--ink); overflow-wrap: anywhere; }
.line__meta { margin-top: 2px; font: 600 15px/1.4 var(--font-body); color: var(--ink-2); }
.line__acts { display: flex; gap: 2px; margin-left: auto; flex: none; }

/* =====================================================================================================================
   Toast
   ===================================================================================================================== */
.toast { position: fixed; left: 50%; bottom: max(18px, env(safe-area-inset-bottom)); z-index: 90; display: flex; align-items: center; gap: 14px;
  max-width: min(560px, calc(100vw - 32px)); padding: 12px 12px 12px 20px; border-radius: 18px 20px 17px 19px / 19px 17px 20px 18px;
  background: var(--night) url(/assets/art/textures/night-paper-tile.webp) 0 0 / 256px 256px; color: #FFFFFF; font: 700 16px/1.4 var(--font-body);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .14), 0 2px 3px rgba(11, 26, 85, .3), 0 22px 40px -18px rgba(11, 26, 85, .6);
  opacity: 0; pointer-events: none; transform: translate(-50%, 14px); transition: opacity 220ms var(--settle), transform 420ms var(--settle); }
.toast.is-on { opacity: 1; pointer-events: auto; transform: translate(-50%, 0); }
.toast p { margin: 0; }
.toast p:only-child { padding-right: 8px; }
.toast__act { flex: none; min-height: 44px; padding: 0 16px; border: 0; border-radius: 12px 14px 11px 13px / 13px 11px 14px 12px; background: var(--lemon); color: var(--ink);
  font: 800 16px/1 var(--font-body); }
.toast__act:focus-visible { outline-color: var(--lemon); }

@media (prefers-reduced-motion: reduce) {
  .toast { transition: opacity 1ms; transform: translate(-50%, 0); }
  .ab.is-open .ab__acts { animation: none; }
}
@media (prefers-contrast: more) {
  .sheet, .note, .input, .textarea, .select, .pick > span { box-shadow: inset 0 0 0 1.5px var(--ink); }
  .sheet::after { display: none; }
  .hint, .line__meta { color: var(--ink); }
}
@media (forced-colors: active) {
  .sheet, .note, .pick > span, .tick span, .state, .toast { border: 1px solid CanvasText; }
  .pick input:checked + span { outline: 2px solid Highlight; }
}
