/* =====================================================================
   jm.css — App-UI mockup component library ("jm" = JSE mock)
   ---------------------------------------------------------------------
   A faithful CSS port of the production app's design system
   (docs/design-system.md in the app repo): サンライズ palette, the
   Inter + Noto Sans JP type scale, the 6/8/12/16/22 radius ladder, the
   36px control ladder, and the tone table (success / warn / danger /
   info / coral / sage / trial / neutral).

   Everything is scoped under `.jse-mock`, so the surrounding marketing
   page keeps the site's own sky-blue / gold brand palette.

   Two device frames:
     .app-phone   — a phone (max 350px wide) whose screen is the app's
                    mobile shell. Fits every viewport; a mild `zoom`
                    keeps proportions on narrow phones.
     .app-window  — a desktop "browser window" with the sidebar rail.
                    Container queries collapse the rail below 620px,
                    exactly like the real app does at its md breakpoint.
   ===================================================================== */

.jse-mock {
  /* ---- Tokens (sunrise palette, light mode) ---- */
  --m-canvas:    #FBF8F4;
  --m-surface:   #FFFFFF;
  --m-surface2:  #F5F0E8;
  --m-line:      #ECE4D7;
  --m-line2:     #E2D8C5;
  --m-ink:       #1F1A14;
  --m-ink2:      #4A3F30;
  --m-ink3:      #6E5F49;
  --m-ink4:      #B8AB94;
  --m-coral:     #ED6332;
  --m-coral-solid: #C24316;
  --m-coral-50:  #FFF6F2;
  --m-coral-100: #FFE8DC;
  --m-coral-200: #FFCDB3;
  --m-coral-700: #A8390F;
  --m-amber:     #E89A1A;
  --m-amber-100: #FFF1CC;
  --m-amber-200: #FDE3A8;
  --m-amber-700: #6B450C;
  --m-success:   #1F6B41; --m-success-bg: #E6F2EA; --m-success-line: #C9E2D2;
  --m-warn:      #8A5A10; --m-warn-bg:    #FCEFD1; --m-warn-line:    #F2DEA5;
  --m-danger:    #A93325; --m-danger-bg:  #FBE6E2; --m-danger-line:  #F1CEC7;
  --m-info:      #275E9C; --m-info-bg:    #E3EEF8; --m-info-line:    #C5DAEC;
  --m-sage:      #4F6F4A; --m-sage-bg:    #E9F0E5; --m-sage-line:    #D5E2CE;
  --m-staff:     #2F6FB5;
  --m-r-xs: 6px; --m-r-sm: 8px; --m-r-md: 12px; --m-r-lg: 16px; --m-r-xl: 22px;
  --m-shadow-xs: 0 1px 0 rgba(31, 26, 20, 0.04);
  --m-shadow-sm: 0 1px 2px rgba(31, 26, 20, 0.05), 0 0 0 1px rgba(255, 255, 255, 0.04);
  --m-shadow-md: 0 4px 12px -4px rgba(31, 26, 20, 0.08);
  --m-shadow-lg: 0 12px 32px -8px rgba(31, 26, 20, 0.12);
  --m-font: 'Inter', 'Noto Sans JP', 'Hiragino Sans', system-ui, sans-serif;
  --m-font-jp: 'Noto Sans JP', 'Hiragino Sans', 'Yu Gothic', sans-serif;
  --m-font-brand: 'Caveat', cursive;
  --m-font-mono: 'JetBrains Mono', ui-monospace, Menlo, monospace;

  font-family: var(--m-font);
  font-size: 13.5px;
  line-height: 1.5;
  font-weight: 400;
  color: var(--m-ink);
  text-align: left;
  letter-spacing: 0;
  -webkit-font-smoothing: antialiased;
  font-variant-numeric: tabular-nums;
}
.jse-mock *, .jse-mock *::before, .jse-mock *::after { box-sizing: border-box; }
.jse-mock p, .jse-mock h1, .jse-mock h2, .jse-mock h3, .jse-mock h4, .jse-mock ul, .jse-mock ol { margin: 0; padding: 0; }
.jse-mock ul, .jse-mock ol { list-style: none; }
.jse-mock button, .jse-mock input { font: inherit; color: inherit; }
.jse-mock svg { display: block; }

/* ---- Type ---- */
.jm-jp        { font-family: var(--m-font-jp); }
.jm-brand     { font-family: var(--m-font-brand); font-weight: 700; letter-spacing: -0.01em; color: var(--m-coral-solid); font-size: 22px; line-height: 1.2; white-space: nowrap; }
.jm-display   { font-size: 32px; line-height: 1.15; letter-spacing: -0.02em; font-weight: 600; }
.jm-h1        { font-size: 26px; line-height: 1.2; letter-spacing: -0.02em; font-weight: 600; }
.jm-h2        { font-size: 22px; line-height: 1.25; letter-spacing: -0.015em; font-weight: 600; }
.jm-page-title{ font-size: 18px; line-height: 1.4; letter-spacing: -0.01em; font-weight: 600; font-family: var(--m-font-jp); }
.jm-h3        { font-size: 16px; line-height: 1.3; letter-spacing: -0.01em; font-weight: 600; font-family: var(--m-font-jp); }
.jm-body-lg   { font-size: 16px; line-height: 1.55; }
.jm-body      { font-size: 13.5px; line-height: 1.5; }
.jm-small     { font-size: 12.5px; line-height: 1.45; color: var(--m-ink3); }
.jm-xs        { font-size: 12.5px; line-height: 1.45; }
.jm-2xs       { font-size: 11px; line-height: 1.45; }
.jm-eyebrow   { font-size: 11px; line-height: 1.45; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--m-ink3); }
.jm-num       { font-variant-numeric: tabular-nums; }
.jm-mono      { font-family: var(--m-font-mono); }
.jm-ink       { color: var(--m-ink); }
.jm-ink2      { color: var(--m-ink2); }
.jm-ink3      { color: var(--m-ink3); }
.jm-coral     { color: var(--m-coral-700); }
.jm-success   { color: var(--m-success); }
.jm-warn      { color: var(--m-warn); }
.jm-danger    { color: var(--m-danger); }
.jm-info      { color: var(--m-info); }
.jm-w500 { font-weight: 500; } .jm-w600 { font-weight: 600; } .jm-w700 { font-weight: 700; }
.jm-truncate  { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.jm-center    { text-align: center; }
.jm-right     { text-align: right; }

/* ---- Layout helpers ---- */
.jm-stack     { display: flex; flex-direction: column; gap: 16px; }
.jm-stack-sm  { display: flex; flex-direction: column; gap: 8px; }
.jm-stack-lg  { display: flex; flex-direction: column; gap: 24px; }
.jm-row-flex  { display: flex; align-items: center; gap: 8px; min-width: 0; }
.jm-between   { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-width: 0; }
.jm-grow      { flex: 1; min-width: 0; }
.jm-shrink0   { flex-shrink: 0; }
.jm-grid-2    { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.jm-grid-3    { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.jm-fit       { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 12px; }
.jm-divider   { height: 1px; background: var(--m-line); }
.jm-mt-2 { margin-top: 8px; } .jm-mt-3 { margin-top: 12px; } .jm-mt-4 { margin-top: 16px; } .jm-mt-1 { margin-top: 4px; }
.jm-mb-2 { margin-bottom: 8px; } .jm-mb-3 { margin-bottom: 12px; } .jm-mb-4 { margin-bottom: 16px; }
.jm-p-3 { padding: 12px; } .jm-p-4 { padding: 16px; }
.jm-px-4 { padding-left: 16px; padding-right: 16px; }

/* ---- Icons (lucide sprite) ---- */
.jm-i { width: 16px; height: 16px; flex-shrink: 0; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.jm-i--14 { width: 14px; height: 14px; }
.jm-i--18 { width: 18px; height: 18px; }
.jm-i--20 { width: 20px; height: 20px; }
.jm-i--24 { width: 24px; height: 24px; }
.jm-i--32 { width: 32px; height: 32px; stroke-width: 1.75; }

/* ---- Card (rounded-jse-lg, border line, shadow xs) ---- */
.jm-card {
  background: var(--m-surface);
  border: 1px solid var(--m-line);
  border-radius: var(--m-r-lg);
  box-shadow: var(--m-shadow-xs);
  min-width: 0;
}
.jm-card--pad { padding: 16px; }
.jm-card--soft { background: var(--m-surface2); box-shadow: none; }
.jm-card--flat { box-shadow: none; }
.jm-card--md { border-radius: var(--m-r-md); }
.jm-card--active { border-color: var(--m-coral-200); box-shadow: 0 0 0 1px var(--m-coral-200); }

/* ---- Section (title row: jse-h3 + optional action) ---- */
.jm-section { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.jm-section-head { display: flex; align-items: center; gap: 8px; min-height: 36px; flex-wrap: wrap; }
.jm-section-head .jm-h3 { margin: 0; }
.jm-section-desc { font-size: 12.5px; color: var(--m-ink3); margin-top: -6px; }
.jm-link { display: inline-flex; align-items: center; gap: 2px; font-size: 12.5px; font-weight: 500; color: var(--m-coral-700); margin-left: auto; white-space: nowrap; }
.jm-link .jm-i { width: 14px; height: 14px; }

/* ---- Buttons (36px default step) ---- */
.jm-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 36px; padding: 0 14px; border-radius: var(--m-r-md);
  font-size: 13.5px; font-weight: 500; line-height: 1; white-space: nowrap;
  background: var(--m-coral-solid); color: #fff; border: 1px solid transparent;
  cursor: default; text-decoration: none;
}
.jm-btn .jm-i { width: 16px; height: 16px; }
.jm-btn--primary   { background: var(--m-ink); color: var(--m-surface); }
.jm-btn--outline   { background: var(--m-surface); color: var(--m-ink2); border-color: var(--m-line); }
.jm-btn--soft      { background: var(--m-surface2); color: var(--m-ink); border-color: var(--m-line); }
.jm-btn--ghost     { background: transparent; color: var(--m-ink2); }
.jm-btn--danger    { background: var(--m-danger); color: #fff; }
.jm-btn--link      { background: transparent; color: var(--m-coral-solid); padding: 0; height: auto; text-decoration: underline; text-underline-offset: 4px; }
.jm-btn--lg        { height: 44px; padding: 0 18px; font-size: 16px; }
.jm-btn--sm        { height: 30px; padding: 0 10px; font-size: 12.5px; }
.jm-btn--icon      { width: 36px; padding: 0; }
.jm-btn--icon-lg   { width: 44px; height: 44px; padding: 0; }
.jm-btn--icon-sm   { width: 30px; height: 30px; padding: 0; }
.jm-btn--round     { border-radius: 999px; }
.jm-btn--fab       { width: 56px; height: 56px; padding: 0; border-radius: 999px; box-shadow: var(--m-shadow-lg); }
.jm-btn--fab .jm-i { width: 24px; height: 24px; }
.jm-btn--block     { display: flex; width: 100%; white-space: normal; text-align: center; line-height: 1.2; }
.jm-btn-row        { display: flex; flex-wrap: wrap; gap: 8px; }

/* ---- Badge / status pill (22px, 11px type, tone table) ---- */
.jm-badge {
  display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 8px;
  border-radius: 999px; border: 1px solid var(--m-line); font-size: 11px; font-weight: 500;
  line-height: 1; white-space: nowrap; background: var(--m-surface2); color: var(--m-ink2);
}
.jm-badge .jm-i { width: 12px; height: 12px; }
.jm-badge--sm    { height: 18px; padding: 0 6px; gap: 4px; }
.jm-badge--count { height: 18px; min-width: 18px; justify-content: center; padding: 0 4px; font-weight: 600; }
.jm-badge--solid   { background: var(--m-ink); color: var(--m-surface); border-color: var(--m-ink); }
.jm-badge--outline { background: transparent; color: var(--m-ink2); border-color: var(--m-line); }
.jm-badge--coral   { background: var(--m-coral-100); color: var(--m-coral-700); border-color: var(--m-coral-200); }
.jm-badge--coral-solid { background: var(--m-coral-solid); color: #fff; border-color: var(--m-coral-solid); }
.jm-badge--trial   { background: var(--m-amber-100); color: var(--m-amber-700); border-color: var(--m-amber-200); }
.jm-badge--sage    { background: var(--m-sage-bg); color: var(--m-sage); border-color: var(--m-sage-line); }
.jm-badge--success { background: var(--m-success-bg); color: var(--m-success); border-color: var(--m-success-line); }
.jm-badge--warn    { background: var(--m-warn-bg); color: var(--m-warn); border-color: var(--m-warn-line); }
.jm-badge--danger  { background: var(--m-danger-bg); color: var(--m-danger); border-color: var(--m-danger-line); }
.jm-badge--info    { background: var(--m-info-bg); color: var(--m-info); border-color: var(--m-info-line); }
.jm-chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }

/* ---- Filter pills (36px, coral when active) ---- */
.jm-pills { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.jm-pill {
  display: inline-flex; align-items: center; height: 36px; padding: 0 14px; border-radius: 999px;
  border: 1px solid var(--m-line); background: var(--m-surface2); color: var(--m-ink2);
  font-size: 13.5px; font-weight: 500; font-family: var(--m-font-jp); white-space: nowrap; line-height: 1;
}
.jm-pill.is-active { background: var(--m-coral-100); color: var(--m-coral-700); border-color: var(--m-coral-200); }
.jm-pill--sm { height: 30px; padding: 0 10px; font-size: 12.5px; }

/* ---- Tabs (44px segmented, surface active) ---- */
.jm-tabs { display: inline-flex; align-items: stretch; height: 44px; padding: 4px; border-radius: var(--m-r-md); background: var(--m-surface2); color: var(--m-ink3); }
.jm-tabs--block { display: flex; width: 100%; }
.jm-tabs--block .jm-tab { flex: 1; }
.jm-tab { display: inline-flex; align-items: center; justify-content: center; padding: 6px 12px; border-radius: var(--m-r-sm); font-size: 13.5px; font-weight: 500; white-space: nowrap; }
.jm-tab.is-active { background: var(--m-surface); color: var(--m-ink); box-shadow: var(--m-shadow-xs); }

/* ---- List card + rows (JseListCard / JseListRow) ---- */
.jm-list { background: var(--m-surface); border: 1px solid var(--m-line); border-radius: var(--m-r-lg); box-shadow: var(--m-shadow-xs); overflow: hidden; min-width: 0; }
.jm-list-head { display: none; }
.jm-row { display: flex; align-items: center; gap: 12px; padding: 12px 16px; min-width: 0; }
.jm-row + .jm-row, .jm-row + .jm-row-group, .jm-row-group + .jm-row { border-top: 1px solid var(--m-line); }
.jm-row--compact { padding: 10px 14px; gap: 10px; }
.jm-row--top { align-items: flex-start; }
.jm-row-lead { flex-shrink: 0; color: var(--m-ink3); display: flex; }
.jm-row-body { flex: 1; min-width: 0; }
.jm-row-title { font-size: 13.5px; font-weight: 500; font-family: var(--m-font-jp); color: var(--m-ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.jm-row-title--wrap { white-space: normal; }
.jm-row-sub { font-size: 12.5px; color: var(--m-ink3); margin-top: 2px; font-variant-numeric: tabular-nums; }
.jm-row-trail { flex-shrink: 0; display: flex; align-items: center; gap: 8px; }
.jm-chev { color: var(--m-ink3); }
.jm-row-group-label { padding: 8px 16px 4px; font-size: 11px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--m-ink3); background: var(--m-surface2); border-bottom: 1px solid var(--m-line); }

/* ---- Stat tile ---- */
.jm-stat { position: relative; overflow: hidden; display: flex; flex-direction: column; gap: 2px; padding: 12px 14px; background: var(--m-surface); border: 1px solid var(--m-line); border-radius: var(--m-r-lg); box-shadow: var(--m-shadow-xs); min-width: 0; }
.jm-stat--accent::before { content: ''; position: absolute; left: 0; right: 0; top: 0; height: 3px; background: var(--m-coral); }
.jm-stat--accent-success::before { background: var(--m-success); }
.jm-stat--accent-amber::before { background: var(--m-amber); }
.jm-stat--accent-info::before { background: var(--m-staff); }
.jm-stat-label { font-size: 12.5px; color: var(--m-ink3); font-family: var(--m-font-jp); }
.jm-stat-value { font-size: 22px; line-height: 1.25; font-weight: 600; color: var(--m-ink); font-variant-numeric: tabular-nums; }
.jm-stat-value small { font-size: 12.5px; font-weight: 500; color: var(--m-ink3); margin-left: 2px; }
.jm-stat-sub { font-size: 12.5px; color: var(--m-ink3); margin-top: auto; font-variant-numeric: tabular-nums; }
.jm-stat-sub.is-up { color: var(--m-success); }

/* ---- Progress ---- */
.jm-progress { position: relative; height: 6px; width: 100%; border-radius: 999px; background: var(--m-surface2); overflow: hidden; }
.jm-progress > i { display: block; height: 100%; width: var(--v, 50%); background: var(--m-coral-solid); border-radius: inherit; }
.jm-progress--success > i { background: var(--m-success); }
.jm-progress--amber > i { background: var(--m-amber); }
.jm-progress--thin { height: 4px; }
.jm-progress--thick { height: 8px; }

/* ---- Score bar (label + bar + value) ---- */
.jm-score { display: grid; grid-template-columns: 5.5em minmax(0, 1fr) 3.2em; align-items: center; gap: 10px; font-size: 12.5px; }
.jm-score-label { color: var(--m-ink2); font-family: var(--m-font-jp); white-space: nowrap; }
.jm-score-val { text-align: right; font-weight: 600; color: var(--m-ink); font-variant-numeric: tabular-nums; }

/* ---- Bars (mini chart) ---- */
.jm-bars { display: flex; align-items: flex-end; gap: 6px; height: 72px; padding-top: 4px; }
.jm-bar { flex: 1; min-width: 0; height: var(--v, 40%); background: var(--m-coral-200); border-radius: 4px 4px 2px 2px; position: relative; }
.jm-bar.is-hot { background: var(--m-coral-solid); }
.jm-bar-axis { display: flex; gap: 6px; margin-top: 6px; }
.jm-bar-axis span { flex: 1; min-width: 0; text-align: center; font-size: 10.5px; color: var(--m-ink3); font-variant-numeric: tabular-nums; }

/* ---- Sparkline (line chart) ---- */
.jm-spark { width: 100%; height: 88px; display: block; }

/* ---- Inputs ---- */
.jm-field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.jm-label { font-size: 12.5px; font-weight: 500; color: var(--m-ink2); font-family: var(--m-font-jp); }
.jm-label--sm { font-size: 11px; color: var(--m-ink3); }
.jm-input {
  display: flex; align-items: center; gap: 8px; height: 36px; width: 100%; padding: 0 12px;
  border-radius: var(--m-r-md); border: 1px solid var(--m-line2); background: var(--m-surface);
  font-size: 13.5px; color: var(--m-ink); min-width: 0;
}
.jm-input--lg { height: 44px; font-size: 16px; }
.jm-input .jm-ph, .jm-input--ph { color: var(--m-ink3); }
.jm-input .jm-i { color: var(--m-ink3); }
.jm-input.is-focus { border-color: var(--m-coral-solid); box-shadow: 0 0 0 3px rgba(194, 67, 22, 0.25); }
.jm-textarea { align-items: flex-start; min-height: 96px; padding: 10px 12px; height: auto; line-height: 1.55; white-space: pre-wrap; }
.jm-select::after { content: ''; margin-left: auto; width: 8px; height: 8px; border-right: 1.5px solid var(--m-ink3); border-bottom: 1.5px solid var(--m-ink3); transform: rotate(45deg) translateY(-2px); }
.jm-help { font-size: 12.5px; color: var(--m-ink3); }
.jm-error { font-size: 12.5px; color: var(--m-danger); }

/* ---- Switch / checkbox / radio ---- */
.jm-switch { position: relative; display: inline-block; width: 44px; height: 24px; border-radius: 999px; background: var(--m-ink4); flex-shrink: 0; }
.jm-switch::after { content: ''; position: absolute; top: 2px; left: 2px; width: 20px; height: 20px; border-radius: 50%; background: var(--m-canvas); box-shadow: var(--m-shadow-sm); }
.jm-switch.is-on { background: var(--m-coral-solid); }
.jm-switch.is-on::after { left: 22px; }
.jm-check { display: inline-flex; align-items: center; justify-content: center; width: 16px; height: 16px; border-radius: 4px; border: 1px solid var(--m-line2); background: var(--m-surface); flex-shrink: 0; color: #fff; }
.jm-check.is-on { background: var(--m-coral-solid); border-color: var(--m-coral-solid); }
.jm-check .jm-i { width: 11px; height: 11px; stroke-width: 3; }
.jm-radio { display: inline-block; width: 16px; height: 16px; border-radius: 50%; border: 1px solid var(--m-line2); background: var(--m-surface); flex-shrink: 0; position: relative; }
.jm-radio.is-on { border-color: var(--m-coral-solid); }
.jm-radio.is-on::after { content: ''; position: absolute; inset: 3px; border-radius: 50%; background: var(--m-coral-solid); }

/* ---- Alert (rounded-jse-md, tone surface) ---- */
.jm-alert { display: flex; align-items: flex-start; gap: 10px; padding: 12px; border-radius: var(--m-r-md); border: 1px solid var(--m-line); background: var(--m-surface2); color: var(--m-ink2); }
.jm-alert .jm-i { margin-top: 1px; }
.jm-alert-title { font-size: 13.5px; font-weight: 600; font-family: var(--m-font-jp); }
.jm-alert-desc { font-size: 12.5px; margin-top: 2px; line-height: 1.5; }
.jm-alert--info    { background: var(--m-info-bg);    border-color: var(--m-info-line);    color: var(--m-info); }
.jm-alert--success { background: var(--m-success-bg); border-color: var(--m-success-line); color: var(--m-success); }
.jm-alert--warn    { background: var(--m-warn-bg);    border-color: var(--m-warn-line);    color: var(--m-warn); }
.jm-alert--danger  { background: var(--m-danger-bg);  border-color: var(--m-danger-line);  color: var(--m-danger); }
.jm-alert--coral   { background: var(--m-coral-100);  border-color: var(--m-coral-200);    color: var(--m-coral-700); }

/* ---- Avatar (28 / 36 / 40 / 48) ---- */
.jm-avatar { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; border-radius: 50%; background: var(--m-surface2); color: var(--m-ink2); font-weight: 500; font-size: 13.5px; flex-shrink: 0; font-family: var(--m-font-jp); }
.jm-avatar--sm { width: 28px; height: 28px; font-size: 11px; }
.jm-avatar--lg { width: 40px; height: 40px; font-size: 14px; }
.jm-avatar--xl { width: 48px; height: 48px; font-size: 16px; }
.jm-avatar--student  { border: 1.5px solid var(--m-coral); }
.jm-avatar--guardian { border: 1.5px solid var(--m-sage); }
.jm-avatar--staff    { border: 1.5px solid var(--m-staff); }

/* ---- App icon (PWA) ---- */
.jm-appicon { display: inline-flex; align-items: center; justify-content: center; width: 56px; height: 56px; border-radius: 14px; background: var(--m-coral); color: #fff; font-family: var(--m-font-brand); font-weight: 700; font-size: 34px; line-height: 1; letter-spacing: -0.02em; flex-shrink: 0; }
.jm-appicon--sm { width: 40px; height: 40px; border-radius: 10px; font-size: 24px; }
.jm-appicon--lg { width: 72px; height: 72px; border-radius: 18px; font-size: 44px; }

/* ---- Key / value (DataGrid) ---- */
.jm-kv { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.jm-kv--1 { grid-template-columns: 1fr; }
.jm-kv-label { font-size: 12.5px; color: var(--m-ink3); font-family: var(--m-font-jp); }
.jm-kv-value { font-size: 13.5px; color: var(--m-ink); margin-top: 2px; overflow-wrap: anywhere; }
.jm-kv-full { grid-column: 1 / -1; }

/* ---- Choice tiles (exam / vocab answers) ---- */
.jm-choices { display: flex; flex-direction: column; gap: 8px; }
.jm-choice { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: var(--m-r-md); border: 1px solid var(--m-line); background: var(--m-surface); font-size: 13.5px; color: var(--m-ink); }
.jm-choice-key { display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; border-radius: 50%; background: var(--m-surface2); color: var(--m-ink2); font-size: 12px; font-weight: 600; flex-shrink: 0; }
.jm-choice.is-selected { border-color: var(--m-coral); background: var(--m-coral-50); box-shadow: 0 0 0 1px var(--m-coral); }
.jm-choice.is-selected .jm-choice-key { background: var(--m-coral-solid); color: #fff; }
.jm-choice.is-correct { border-color: var(--m-success-line); background: var(--m-success-bg); }
.jm-choice.is-correct .jm-choice-key { background: var(--m-success); color: #fff; }
.jm-choice.is-wrong { border-color: var(--m-danger-line); background: var(--m-danger-bg); }
.jm-choice.is-wrong .jm-choice-key { background: var(--m-danger); color: #fff; }
.jm-choices--grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }

/* ---- Chat ---- */
.jm-chat { display: flex; flex-direction: column; gap: 12px; }
.jm-msg { display: flex; gap: 8px; align-items: flex-start; max-width: 100%; }
.jm-msg--user { justify-content: flex-end; }
.jm-msg--user .jm-bubble { background: var(--m-surface2); border: 1px solid var(--m-line); color: var(--m-ink); border-radius: 16px 16px 4px 16px; max-width: 86%; }
.jm-bubble { padding: 10px 12px; font-size: 13.5px; line-height: 1.6; border-radius: 16px; min-width: 0; }
.jm-msg--ai .jm-bubble { padding: 2px 0 0; max-width: 100%; }
.jm-msg--ai .jm-bubble p + p { margin-top: 6px; }
.jm-msg--ai .jm-bubble strong { font-weight: 600; }
.jm-msg--ai .jm-bubble ul { list-style: disc; padding-left: 18px; margin: 4px 0; }
.jm-msg--ai .jm-bubble code { font-family: var(--m-font-mono); font-size: 12px; background: var(--m-surface2); padding: 1px 4px; border-radius: 4px; }
.jm-ai-avatar { width: 28px; height: 28px; border-radius: 8px; background: var(--m-coral); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-family: var(--m-font-brand); font-weight: 700; font-size: 17px; flex-shrink: 0; }
.jm-chat-input { display: flex; align-items: center; gap: 8px; padding: 6px 6px 6px 12px; border: 1px solid var(--m-line2); border-radius: 22px; background: var(--m-surface); }
.jm-chat-input .jm-ph { flex: 1; font-size: 13.5px; color: var(--m-ink3); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.jm-chat-input .jm-btn--icon { border-radius: 50%; }
.jm-chat-chips { display: flex; gap: 6px; overflow: hidden; }

/* ---- Calendar month mini grid ---- */
.jm-cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 2px; font-size: 11.5px; text-align: center; }
.jm-cal-dow { color: var(--m-ink3); font-size: 10.5px; padding: 2px 0 4px; font-weight: 500; }
.jm-cal-dow.is-sun { color: var(--m-danger); } .jm-cal-dow.is-sat { color: var(--m-info); }
.jm-cal-d { position: relative; height: 32px; display: flex; align-items: center; justify-content: center; border-radius: 8px; color: var(--m-ink2); font-variant-numeric: tabular-nums; }
.jm-cal-d.is-muted { color: var(--m-ink4); }
.jm-cal-d.is-today { background: var(--m-coral-solid); color: #fff; font-weight: 600; }
.jm-cal-d.has-dot::after { content: ''; position: absolute; bottom: 3px; left: 50%; width: 5px; height: 5px; margin-left: -2.5px; border-radius: 50%; background: var(--m-coral); }
.jm-cal-d.is-today.has-dot::after { background: #fff; }
.jm-cal-d.has-dot--trial::after { background: var(--m-amber); }

/* ---- Lesson chip (calendar / day column) ---- */
.jm-lesson { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: var(--m-r-md); background: var(--m-surface); border: 1px solid var(--m-line); border-left: 3px solid var(--m-coral); }
.jm-lesson--trial { border-left-color: var(--m-amber); }
.jm-lesson--done { border-left-color: var(--m-success); }
.jm-lesson--cancel { border-left-color: var(--m-ink4); opacity: 0.8; }
.jm-lesson-time { font-size: 12.5px; font-weight: 600; color: var(--m-ink); font-variant-numeric: tabular-nums; white-space: nowrap; }
.jm-lesson-meta { font-size: 12.5px; color: var(--m-ink3); }

/* ---- Toast ---- */
.jm-toast { display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px; background: var(--m-surface); border: 1px solid var(--m-line); border-radius: var(--m-r-md); box-shadow: var(--m-shadow-lg); }
.jm-toast-title { font-size: 13.5px; font-weight: 600; font-family: var(--m-font-jp); }
.jm-toast-desc { font-size: 12.5px; color: var(--m-ink3); margin-top: 2px; }

/* ---- Skeleton / empty ---- */
.jm-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; padding: 24px 16px; text-align: center; color: var(--m-ink3); font-size: 12.5px; }
.jm-empty .jm-i { width: 24px; height: 24px; color: var(--m-ink4); }

/* ---- Step indicator (onboarding) ---- */
.jm-steps { display: flex; align-items: center; gap: 6px; }
.jm-step { display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 26px; border-radius: 50%; font-size: 12px; font-weight: 600; background: var(--m-surface2); color: var(--m-ink3); border: 1px solid var(--m-line); flex-shrink: 0; }
.jm-step.is-done { background: var(--m-success); border-color: var(--m-success); color: #fff; }
.jm-step.is-current { background: var(--m-coral-solid); border-color: var(--m-coral-solid); color: #fff; }
.jm-step-line { flex: 1; height: 2px; background: var(--m-line); min-width: 8px; }
.jm-step-line.is-done { background: var(--m-success); }

/* ---- Donut score ring ---- */
.jm-ring { position: relative; width: 96px; height: 96px; border-radius: 50%; background: conic-gradient(var(--m-coral-solid) calc(var(--v, 70) * 1%), var(--m-surface2) 0); display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.jm-ring::before { content: ''; position: absolute; inset: 10px; border-radius: 50%; background: var(--m-surface); }
.jm-ring > span { position: relative; font-size: 22px; font-weight: 600; font-variant-numeric: tabular-nums; }
.jm-ring > span small { display: block; font-size: 10.5px; font-weight: 500; color: var(--m-ink3); text-align: center; }
.jm-ring--success { background: conic-gradient(var(--m-success) calc(var(--v, 70) * 1%), var(--m-surface2) 0); }
.jm-ring--sm { width: 64px; height: 64px; } .jm-ring--sm::before { inset: 7px; } .jm-ring--sm > span { font-size: 15px; }

/* ---- Dots / legend ---- */
.jm-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--m-coral); flex-shrink: 0; }
.jm-dot--success { background: var(--m-success); } .jm-dot--warn { background: var(--m-amber); } .jm-dot--danger { background: var(--m-danger); } .jm-dot--info { background: var(--m-staff); } .jm-dot--muted { background: var(--m-ink4); } .jm-dot--sage { background: var(--m-sage); }

/* ---- Vocab swipe card ---- */
.jm-flash { position: relative; padding: 28px 20px 22px; border-radius: var(--m-r-xl); background: var(--m-surface); border: 1px solid var(--m-line); box-shadow: var(--m-shadow-md); text-align: center; }
.jm-flash-word { font-size: 32px; line-height: 1.15; letter-spacing: -0.02em; font-weight: 600; }
.jm-flash-pos { font-size: 11px; color: var(--m-ink3); text-transform: lowercase; margin-top: 4px; }
.jm-flash-hint { font-size: 12.5px; color: var(--m-ink3); margin-top: 14px; }
.jm-flash-under { position: absolute; left: 12px; right: 12px; bottom: -10px; height: 10px; border-radius: 0 0 var(--m-r-xl) var(--m-r-xl); background: var(--m-surface2); border: 1px solid var(--m-line); border-top: 0; z-index: -1; }
.jm-swipe-hints { display: flex; justify-content: space-between; font-size: 12px; margin-top: 18px; }
.jm-swipe-hints span { display: inline-flex; align-items: center; gap: 4px; }

/* ---- Spelling boxes ---- */
.jm-spell { display: flex; gap: 4px; justify-content: center; flex-wrap: wrap; }
.jm-spell span { width: 26px; height: 34px; border-radius: 6px; border: 1px solid var(--m-line2); background: var(--m-surface); display: inline-flex; align-items: center; justify-content: center; font-size: 16px; font-weight: 600; }
.jm-spell span.is-cursor { border-color: var(--m-coral-solid); box-shadow: 0 0 0 2px rgba(194, 67, 22, 0.2); }
.jm-spell span.is-ok { background: var(--m-success-bg); border-color: var(--m-success-line); color: var(--m-success); }

/* ---- Mastery bar (segmented) ---- */
.jm-mastery { display: flex; gap: 3px; height: 8px; }
.jm-mastery span { flex: 1; border-radius: 3px; background: var(--m-surface2); }
.jm-mastery span.is-1 { background: var(--m-coral-200); } .jm-mastery span.is-2 { background: var(--m-coral); } .jm-mastery span.is-3 { background: var(--m-success); }

/* ---- Timer chip / header controls in players ---- */
.jm-timer { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 10px; border-radius: 999px; background: var(--m-surface); border: 1px solid var(--m-line); font-size: 12.5px; font-weight: 600; font-variant-numeric: tabular-nums; }
.jm-timer.is-low { color: var(--m-danger); border-color: var(--m-danger-line); background: var(--m-danger-bg); }
.jm-qnav { display: flex; gap: 4px; flex-wrap: wrap; }
.jm-qnav span { width: 24px; height: 24px; border-radius: 6px; border: 1px solid var(--m-line); background: var(--m-surface); font-size: 11px; display: inline-flex; align-items: center; justify-content: center; color: var(--m-ink3); }
.jm-qnav span.is-done { background: var(--m-coral-100); border-color: var(--m-coral-200); color: var(--m-coral-700); }
.jm-qnav span.is-current { background: var(--m-coral-solid); border-color: var(--m-coral-solid); color: #fff; font-weight: 600; }

/* ---- Passage / prose block ---- */
.jm-prose { font-size: 13.5px; line-height: 1.7; color: var(--m-ink2); }
.jm-prose p + p { margin-top: 8px; }
.jm-prose mark { background: var(--m-amber-100); color: var(--m-ink); padding: 0 2px; border-radius: 3px; }
.jm-prose .jm-vocab { border-bottom: 1.5px dotted var(--m-coral); color: var(--m-ink); font-weight: 500; }
.jm-prose--en { font-family: var(--m-font); }

/* ---- Writing correction marks ---- */
.jm-del { color: var(--m-danger); text-decoration: line-through; background: var(--m-danger-bg); border-radius: 3px; padding: 0 2px; }
.jm-ins { color: var(--m-success); background: var(--m-success-bg); border-radius: 3px; padding: 0 2px; font-weight: 500; }

/* ---- Payment card brand chips ---- */
.jm-cardbrand { display: inline-flex; align-items: center; justify-content: center; height: 22px; padding: 0 7px; border-radius: 4px; border: 1px solid var(--m-line); background: var(--m-surface); font-size: 10px; font-weight: 700; letter-spacing: 0.04em; color: var(--m-ink2); font-family: var(--m-font); }
.jm-cardbrand--visa { color: #1A1F71; } .jm-cardbrand--mc { color: #EB001B; } .jm-cardbrand--jcb { color: #0E4C96; } .jm-cardbrand--amex { color: #2E77BC; }

/* =====================================================================
   PHONE FRAME
   ===================================================================== */
.app-phone {
  position: relative;
  width: 100%;
  max-width: 350px;
  margin-inline: auto;
  padding: 10px;
  border-radius: 46px;
  background: #1F1A14;
  box-shadow:
    0 30px 60px -24px rgba(31, 26, 20, 0.40),
    0 8px 20px -10px rgba(31, 26, 20, 0.25),
    inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}
.app-phone::before {
  /* thin bezel highlight */
  content: '';
  position: absolute;
  inset: 3px;
  border-radius: 43px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  pointer-events: none;
}
.app-phone-screen {
  position: relative;
  border-radius: 36px;
  background: var(--m-canvas);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.app-phone-status {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 44px;
  padding: 6px 24px 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--m-ink);
  letter-spacing: -0.01em;
}
.app-phone-status::before {
  /* dynamic island */
  content: '';
  position: absolute;
  top: 10px;
  left: 50%;
  width: 92px;
  height: 26px;
  margin-left: -46px;
  border-radius: 999px;
  background: #1F1A14;
}
.app-phone-status-icons { display: inline-flex; align-items: center; gap: 5px; }
.app-phone-status-icons svg { display: block; }
.app-phone-body { flex: 1; padding: 8px 14px 18px; min-width: 0; }
.app-phone-body--flush { padding: 0 0 18px; }
.app-phone-home { height: 5px; width: 118px; margin: 4px auto 8px; border-radius: 999px; background: #1F1A14; opacity: 0.9; }

/* Mobile shell top bar (☰ · title/brand · 🔔) */
.jm-topbar { display: flex; align-items: center; gap: 12px; padding: 4px 8px 10px; border-bottom: 1px solid var(--m-line); margin: 0 -6px 12px; }
.jm-topbar .jm-page-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.jm-topbar .jm-brand { flex: 1; min-width: 0; }
.jm-iconbtn { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; border-radius: 50%; color: var(--m-ink2); flex-shrink: 0; position: relative; }
.jm-iconbtn--36 { width: 36px; height: 36px; }
.jm-iconbtn .jm-badge--count { position: absolute; top: 2px; right: 2px; }
/* PageHeader (detail screens): ← + title, sticky band */
.jm-pagehead { display: flex; align-items: center; gap: 8px; padding: 4px 6px 12px; border-bottom: 1px solid var(--m-line); margin: 0 -6px 12px; }
.jm-pagehead .jm-page-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.jm-pagehead-actions { display: flex; gap: 6px; flex-shrink: 0; }

/* Fullscreen player header (exam / reading / writing) */
.jm-player-head { display: flex; align-items: center; gap: 8px; padding: 4px 6px 10px; border-bottom: 1px solid var(--m-line); margin: 0 -6px 12px; }
.jm-player-head .jm-page-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 15px; }
.jm-player-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding-top: 12px; border-top: 1px solid var(--m-line); margin-top: 14px; }

/* Sheet / dialog inside a phone */
.jm-sheet { position: absolute; left: 0; right: 0; bottom: 0; background: var(--m-surface); border-radius: 22px 22px 0 0; padding: 12px 16px 24px; box-shadow: 0 -12px 40px rgba(31, 26, 20, 0.2); border-top: 1px solid var(--m-line); }
.jm-sheet-handle { width: 36px; height: 4px; border-radius: 999px; background: var(--m-line2); margin: 0 auto 12px; }
.jm-scrim { position: absolute; inset: 0; background: rgba(31, 26, 20, 0.35); }
.jm-dialog { position: absolute; left: 16px; right: 16px; top: 50%; transform: translateY(-50%); background: var(--m-surface); border-radius: var(--m-r-lg); padding: 16px; box-shadow: var(--m-shadow-lg); border: 1px solid var(--m-line); }
.jm-dialog-title { font-size: 16px; font-weight: 600; font-family: var(--m-font-jp); }
.jm-dialog-desc { font-size: 12.5px; color: var(--m-ink3); margin-top: 4px; line-height: 1.55; }
.jm-dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; }

/* Native-ish OS bits (PWA install banner, push notification) */
.jm-os-notif { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: 18px; background: rgba(255, 255, 255, 0.92); backdrop-filter: blur(10px); box-shadow: 0 8px 24px rgba(31, 26, 20, 0.16); border: 1px solid rgba(31, 26, 20, 0.06); }
.jm-os-notif-app { font-size: 11px; color: var(--m-ink3); display: flex; justify-content: space-between; gap: 8px; }
.jm-os-notif-title { font-size: 13px; font-weight: 600; margin-top: 1px; }
.jm-os-notif-body { font-size: 12.5px; color: var(--m-ink2); line-height: 1.45; }

/* =====================================================================
   DESKTOP APP WINDOW
   ===================================================================== */
.app-window {
  container-type: inline-size;
  container-name: appwin;
  width: 100%;
  max-width: 820px;
  margin-inline: auto;
  border-radius: 16px;
  background: var(--m-canvas);
  border: 1px solid rgba(31, 26, 20, 0.10);
  box-shadow:
    0 30px 70px -30px rgba(31, 26, 20, 0.35),
    0 10px 24px -14px rgba(31, 26, 20, 0.18);
  overflow: hidden;
}
.app-window-chrome { display: flex; align-items: center; gap: 12px; height: 40px; padding: 0 14px; background: #fff; border-bottom: 1px solid var(--m-line); }
.app-window-dots { display: inline-flex; gap: 6px; flex-shrink: 0; }
.app-window-dots i { width: 10px; height: 10px; border-radius: 50%; background: var(--m-line2); display: block; }
.app-window-url { flex: 1; min-width: 0; display: flex; align-items: center; justify-content: center; gap: 6px; height: 26px; margin: 0 auto; max-width: 360px; padding: 0 12px; border-radius: 8px; background: var(--m-surface2); color: var(--m-ink3); font-size: 11.5px; font-family: var(--m-font); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.app-window-url .jm-i { width: 11px; height: 11px; }
.app-window-body { display: grid; grid-template-columns: 216px minmax(0, 1fr); min-height: 420px; }
.app-window-sidebar { background: var(--m-surface); border-right: 1px solid var(--m-line); padding: 14px 10px 12px; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.app-window-main { padding: 22px 26px 26px; min-width: 0; container-type: inline-size; container-name: appmain; }
.app-window-mobilebar { display: none; }
@container appwin (max-width: 620px) {
  .app-window-body { grid-template-columns: minmax(0, 1fr); }
  .app-window-sidebar { display: none; }
  .app-window-mobilebar { display: flex; }
  .app-window-main { padding: 14px 16px 20px; }
}

/* Sidebar rail internals */
.jm-side-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 0 6px 6px; }
.jm-side-account { display: flex; align-items: center; gap: 10px; padding: 8px 6px; border-radius: var(--m-r-sm); }
.jm-side-account .jm-name { font-size: 13.5px; font-weight: 500; font-family: var(--m-font-jp); line-height: 1.3; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.jm-side-account .jm-role { font-size: 11px; color: var(--m-ink3); font-family: var(--m-font-jp); }
.jm-nav { display: flex; flex-direction: column; gap: 2px; }
.jm-nav-label { display: flex; align-items: center; height: 28px; padding: 0 8px; font-size: 11px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--m-ink3); margin-top: 8px; }
.jm-nav-item { position: relative; display: flex; align-items: center; gap: 10px; height: 36px; padding: 0 8px; border-radius: var(--m-r-sm); font-size: 13.5px; color: var(--m-ink2); font-family: var(--m-font-jp); white-space: nowrap; overflow: hidden; }
.jm-nav-item .jm-i { color: var(--m-ink3); }
.jm-nav-item.is-active { background: var(--m-surface2); color: var(--m-ink); font-weight: 500; }
.jm-nav-item.is-active::before { content: ''; position: absolute; left: 0; top: 8px; bottom: 8px; width: 3px; border-radius: 0 6px 6px 0; background: var(--m-coral); }
.jm-nav-item.is-active .jm-i { color: var(--m-coral); }
.jm-nav-item .jm-badge { margin-left: auto; }
.jm-side-foot { margin-top: auto; padding-top: 8px; border-top: 1px solid var(--m-line); }

/* Dashboard header (role accent bar + greeting) */
.jm-dash-head { display: flex; align-items: stretch; gap: 12px; }
.jm-dash-accent { width: 3px; border-radius: 999px; background: var(--m-coral); flex-shrink: 0; }
.jm-dash-accent--guardian { background: var(--m-sage); }
.jm-dash-head .jm-page-title { margin: 0; }
.jm-dash-head .jm-small { margin-top: 4px; }

/* ---- Two-column page grid inside the window main.
   Keyed to the MAIN column's own width (like the app's @lg container
   variant), not the window's, so the rail never squeezes the columns. ---- */
.jm-page-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 24px; }
@container appmain (min-width: 560px) {
  .jm-page-grid--2 { grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr); }
}
/* Hide a block when the window has collapsed to its phone layout */
@container appwin (max-width: 620px) {
  .jm-hide-narrow { display: none !important; }
}

/* =====================================================================
   RESPONSIVE SAFETY — narrow phones
   The frames are fluid; `zoom` keeps the internal proportions readable
   when the phone frame itself has to shrink below its design width.
   ===================================================================== */
@media (max-width: 420px) {
  .app-phone { zoom: 0.9; }
}
@media (max-width: 360px) {
  .app-phone { zoom: 0.8; }
}
@media (max-width: 360px) {
  .jse-mock .jm-brand { font-size: 19px; }
}

/* =====================================================================
   CLIPPED SCROLL REGIONS
   A mockup's inner scroll area is cropped to keep the frame a sensible
   height. The crop gets a fade band anchored to the bottom of the clip
   (a constant height, not a percentage), so it always reads as "this
   screen scrolls" instead of slicing a live control in half.
   ===================================================================== */
.jse-mock .jm-clip { position: relative; min-width: 0; overflow: hidden; }
.jse-mock .jm-clip::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 40px;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(251, 248, 244, 0) 0%, var(--m-canvas) 92%);
}
/* A region that happens to fit needs no fade. */
.jse-mock .jm-clip--none::after { display: none; }
