/* ===== SportZania wide.css — assembled from partials. Mobile (<640) untouched. ===== */

/* ===================== CORE + HOME DASHBOARDS ===================== */
/* =====================================================================
   _wide-core.css — RESPONSIVE WIDE-SCREEN LAYER for SportZania
   ---------------------------------------------------------------------
   Adds a tablet + desktop experience ON TOP of the live mobile-first UI.
   HARD RULE: every rule here lives inside a min-width media query, so
   nothing below 640px is ever touched — the phone UI stays 100% intact.
     - Desktop : @media (min-width:1024px)
     - Tablet  : @media (min-width:640px) and (max-width:1023px)
   All selectors are scoped to screen ids / their real classes so styles
   never leak globally. Reuses the existing emerald glass aesthetic and
   the real DOM classes (.prof-section, .qa-grid, .qb, .mp-card,
   .mp-card-hero, .mp-card-stats, .home-drawer, .drawer-item, .av,
   .login-card, .login-glow, .modal-backdrop, .bottom-sheet).
   No JS required. Emulates _prod_pull/preview-home-v2 & preview-emp-home.
   ===================================================================== */


/* =====================================================================
   1 · DESKTOP  (≥1024px)
   ===================================================================== */
@media (min-width: 1024px) {

  /* ---- 1.1 Global wide foundation -------------------------------- */
  /* Page-based screens: keep their content centered in a ≤1280px frame.
     The .screen itself stays full-width (it owns the background); only the
     inner page-body / list region is constrained & centered. Home screens
     are handled separately as dashboards (see 1.3 / 1.4).               */
  /* RULE: full-width content on wide — never a container narrower than the
     screen. Page header/body span the full width with edge padding only.   */
  .screen:not(#screen-login):not(#screen-ddl-home):not(#screen-mentor-home):not(#screen-child-home) .page-header,
  .screen:not(#screen-login):not(#screen-ddl-home):not(#screen-mentor-home):not(#screen-child-home) .page-body {
    max-width: none;
    width: 100%;
    padding-left: clamp(20px, 3vw, 48px);
    padding-right: clamp(20px, 3vw, 48px);
  }
  /* lists fill the width with an auto-fill grid (more columns on big screens) */
  .screen:not(#screen-login):not(#screen-ddl-home):not(#screen-mentor-home):not(#screen-child-home) .page-body .list-gap {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 14px;
    align-items: start;
  }


  /* ---- 1.2 Sheet → centered modal -------------------------------- */
  /* The JS builds: <div class="modal-backdrop"><div class="bottom-sheet …">.
     On mobile the backdrop pins the sheet to the bottom (align-items:
     flex-end). On desktop we center it and round all corners.          */
  .modal-backdrop {
    align-items: center;
    justify-content: center;
    padding: 32px;
  }
  .modal-backdrop > .bottom-sheet {
    width: 100%;
    max-width: 640px;
    max-height: 88vh;
    overflow-y: auto;
    border-radius: 26px;          /* round ALL corners now */
    border: 1px solid rgba(255, 255, 255, .14);
    padding: 24px 28px 28px;
    box-shadow: 0 26px 80px rgba(0, 0, 0, .55);
    animation: wide-modal-in .22s ease;
    position: relative;
  }
  /* wider for dense detail sheets (shift detail, squads, children) */
  .modal-backdrop > .bottom-sheet.sheet-wide { max-width: 760px; }
  /* premium header: the first .sheet-title becomes a header bar */
  .modal-backdrop > .bottom-sheet .sheet-title {
    font-size: 19px; font-weight: 800; letter-spacing: -.01em;
    padding: 2px 40px 14px 0; margin-bottom: 16px;
    border-bottom: 1px solid rgba(255, 255, 255, .10);
  }
  /* premium close ✕ — top-right of the modal */
  .modal-backdrop .sheet-close {
    display: flex; align-items: center; justify-content: center;
    position: absolute; top: 18px; right: 18px; z-index: 4;
    width: 32px; height: 32px; border-radius: 10px;
    background: rgba(255, 255, 255, .08); border: 1px solid rgba(255, 255, 255, .14);
    color: #fff; font-size: 13px; cursor: pointer; transition: .15s;
  }
  .modal-backdrop .sheet-close:hover { background: rgba(231, 76, 60, .22); border-color: rgba(231, 76, 60, .45); }
  /* the drag handle is meaningless on a centered modal */
  .modal-backdrop > .bottom-sheet .sheet-handle { display: none; }
  /* nested scroll containers in dense sheets shouldn't double-cap height */
  .modal-backdrop > .bottom-sheet .list-gap { max-height: none; }
  @keyframes wide-modal-in {
    from { transform: translateY(14px) scale(.985); opacity: 0; }
    to   { transform: translateY(0)    scale(1);    opacity: 1; }
  }


  /* ---- DDL / MENTOR HOME — reference-style BLOCK layout --------------
     js/wide.js re-composes the real elements into .wide-topbar (brand +
     profile chip) + .wide-main (.wide-left: hero shift-card + quick
     actions / .wide-right: stats card + drawer panel). The screen-level
     display rule is scoped to .active.wide-on to avoid showing hidden
     screens. The original .prof-section is hidden (chip replaces it).   */
  #screen-ddl-home.active.wide-on,
  #screen-mentor-home.active.wide-on {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 18px;
    padding: 22px clamp(20px, 4vw, 56px) 56px;
    overflow-y: auto;
  }
  #screen-ddl-home.wide-on   > .prof-section,
  #screen-mentor-home.wide-on > .prof-section { display: none; }

  /* RULE: full-width — bands span the whole screen (only the .screen padding insets) */
  .wide-topbar, .wide-main { width: 100%; max-width: none; margin: 0; }

  /* top bar: brand left, profile chip right */
  .wide-topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
  .wide-brand { display: flex; align-items: center; gap: 11px; font-weight: 800; font-size: 17px; color: #fff; }
  .wide-brand img { width: 40px; height: 40px; border-radius: 11px; object-fit: contain; padding: 3px;
    background: rgba(255,255,255,.06); border: 1px solid rgba(20,232,142,.25); box-shadow: 0 0 22px rgba(20,232,142,.25); }
  .wide-chip { display: flex; align-items: center; gap: 13px; cursor: pointer;
    background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.12);
    backdrop-filter: blur(20px); border-radius: 999px; padding: 7px 18px 7px 7px; transition: .2s; }
  .wide-chip:hover { border-color: rgba(20,232,142,.4); background: rgba(20,232,142,.08); }
  .wide-chip .wb-av { width: 46px; height: 46px; border-radius: 50%; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 16px; color: #fff;
    border: 2px solid var(--green); background: linear-gradient(135deg, var(--green), var(--purple));
    background-size: cover; background-position: center; }
  .wb-text { display: flex; flex-direction: column; gap: 1px; line-height: 1.25; }
  .wb-name { font-weight: 700; font-size: 14px; color: #fff; }
  .wb-pos { font-size: 11px; color: rgba(255,255,255,.55); }
  .wb-links { font-size: 11px; color: rgba(255,255,255,.4); margin-top: 3px; }
  .wb-links .wb-prof { color: var(--green-br); font-weight: 700; cursor: pointer; }
  .wb-links .wb-out { cursor: pointer; }
  .wb-links .wb-prof:hover, .wb-links .wb-out:hover { color: #fff; }

  /* 2-column main: left = hero + actions, right = stats + drawer panel.
     The grid fills the viewport height so there's no big empty band below;
     the hero and the drawer stretch to take the slack.                   */
  .wide-main { display: grid; grid-template-columns: 1.15fr .85fr; gap: 20px;
    align-items: start; }
  .wide-col { display: flex; flex-direction: column; gap: 18px; min-width: 0; }

  /* hero shift-card → a BANNER block that fills the left column: the shift
     poster (or the emerald gradient fallback) is the background, and the
     caption (name / dates / status) sits at the bottom. js/wide.js sets the
     poster background from the card's data-poster.                         */
  .wide-left > [id$="-shift-card"] {
    margin: 0; padding: 30px 34px; border-radius: 28px;
    flex: 0 0 auto; height: clamp(330px, 46vh, 470px);
    display: flex; flex-direction: column; justify-content: flex-end;
    position: relative; overflow: hidden;
    background-size: cover; background-position: center;
  }
  .wide-left > [id$="-shift-card"].has-poster { border-color: rgba(255,255,255,.14); }
  .wide-left > [id$="-shift-card"] .mp-title  { font-size: clamp(24px, 2.2vw, 34px); line-height: 1.08; }
  .wide-left > [id$="-shift-card"] .mp-label  { font-size: 12px; }
  .wide-left > [id$="-shift-card"] .mp-meta   { font-size: 14px; }
  .wide-left > [id$="-shift-card"] .mp-status { font-size: 12px; align-self: flex-start; width: auto; }

  /* quick actions 4-up, a touch taller to balance the tall hero */
  .wide-left > .qa-grid { grid-template-columns: repeat(4, 1fr); margin: 0; padding: 0; flex: 0 0 auto; }
  .wide-left > .qa-grid .qb { min-height: 104px; }
  .wide-left > .qa-grid .qb:hover { transform: translateY(-2px); }

  /* right column: stats card (fixed) + drawer panel (stretches to fill) */
  .wide-right > [id$="-stats-card"] { margin: 0; border-radius: 24px; padding: 26px; flex: 0 0 auto; }
  .wide-right > [id$="-stats-card"] .mp-stats-left .mp-stats-num { font-size: 48px; }
  .wide-right > .home-drawer { margin: 0 !important; border-radius: 24px; max-height: none; overflow: visible;
    flex: 0 0 auto; }
  .wide-right > .home-drawer > .handle { display: none; }
  .wide-right > .home-drawer .drawer-item { border-radius: 12px; transition: background .15s; }
  .wide-right > .home-drawer .drawer-item:hover { background: rgba(20,232,142,.08); }

  /* keep the glow gentle on wide so it doesn't wash out the background */
  #screen-ddl-home > .login-glow,
  #screen-mentor-home > .login-glow { opacity: .55; }


  /* ---- 1.5 LOGIN  #screen-login ---------------------------------- */
  /* Center the login card as a comfortable column on the branded
     background instead of stretching it full-width at the bottom.     */
  #screen-login {
    justify-content: center;
    align-items: center;
    flex-direction: column;
    gap: 8px;
    padding: 40px 24px;
  }
  #screen-login .login-top {
    flex: 0 0 auto;
    padding: 0 24px 8px;
  }
  #screen-login .login-card {
    width: 100%;
    max-width: 440px;
    flex-shrink: 0;
    border-radius: 28px;           /* round all corners (was top-only) */
    border: 1px solid rgba(255, 255, 255, .14);
    padding: 26px 28px 30px;
    box-shadow: 0 30px 80px rgba(0, 0, 0, .5);
  }
  /* keep the login glows comfortably inside the frame */
  #screen-login .login-glow {
    max-width: 55vw;
    max-height: 70vh;
  }
  /* mouse hover on the primary CTA */
  #screen-login .btn-primary:hover {
    filter: brightness(1.06);
  }


  /* ---- 1.6 Generic desktop hover polish (home heroes/cards) ------ */
  #screen-ddl-home > #ddl-shift-card.mp-card-hero:hover,
  #screen-mentor-home > #mentor-shift-card.mp-card-hero:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(20, 232, 142, .15);
  }
}


/* =====================================================================
   2 · TABLET  (640px – 1023px)
   ===================================================================== */
@media (min-width: 640px) and (max-width: 1023px) {

  /* ---- 2.1 Center page content ----------------------------------- */
  .screen:not(#screen-login):not(#screen-ddl-home):not(#screen-mentor-home):not(#screen-child-home) .page-header,
  .screen:not(#screen-login):not(#screen-ddl-home):not(#screen-mentor-home):not(#screen-child-home) .page-body {
    max-width: 760px;
    margin-left: auto;
    margin-right: auto;
    width: 100%;
  }

  /* ---- 2.2 Sheets as centered modals (lighter) ------------------- */
  .modal-backdrop {
    align-items: center;
    justify-content: center;
    padding: 28px;
  }
  .modal-backdrop > .bottom-sheet {
    width: 100%;
    max-width: 520px;
    max-height: 88vh;
    border-radius: 22px;
    border: 1px solid var(--border);
    box-shadow: 0 20px 56px rgba(0, 0, 0, .4);
  }
  .modal-backdrop > .bottom-sheet.bottom-sheet-dark,
  .modal-backdrop > .bottom-sheet.bottom-sheet-ddl {
    border: 1px solid rgba(255, 255, 255, .14);
  }
  .modal-backdrop > .bottom-sheet .sheet-handle { display: none; }

  /* ---- 2.3 Home screens: centered single column, qa-grid 4-up ---- */
  #screen-ddl-home,
  #screen-mentor-home {
    align-items: center;
  }
  #screen-ddl-home > .prof-section,
  #screen-ddl-home > .qa-grid,
  #screen-ddl-home > #ddl-shift-card,
  #screen-ddl-home > #ddl-stats-card,
  #screen-ddl-home > .home-drawer,
  #screen-mentor-home > .prof-section,
  #screen-mentor-home > .qa-grid,
  #screen-mentor-home > #mentor-shift-card,
  #screen-mentor-home > #mentor-stats-card,
  #screen-mentor-home > .home-drawer {
    width: 100%;
    max-width: 680px;
    margin-left: auto;
    margin-right: auto;
  }
  #screen-ddl-home > .qa-grid,
  #screen-mentor-home > .qa-grid {
    grid-template-columns: repeat(4, 1fr);
  }
  /* drawer stays a panel but doesn't need to fill the tall viewport */
  #screen-ddl-home > .home-drawer,
  #screen-mentor-home > .home-drawer {
    flex: 0 0 auto;
    border-radius: 24px;
    margin-top: 14px;
  }

  /* ---- 2.4 Login centered ---------------------------------------- */
  #screen-login {
    justify-content: center;
    align-items: center;
    padding: 36px 24px;
  }
  #screen-login .login-card {
    width: 100%;
    max-width: 420px;
    border-radius: 26px;
    margin: 0 auto;
  }
}


/* =====================================================================
   SECTION SUMMARY
   ---------------------------------------------------------------------
   1   DESKTOP (≥1024px)
   1.1 Global wide foundation — ≤1280px centered frame for page-based
       screens; long item lists become a 2-up grid.
   1.2 Sheet → modal — restyles JS .modal-backdrop / .bottom-sheet (incl.
       -ddl / -dark variants) into a vertically-centered ≤560px modal with
       all corners rounded; hides the drag handle.
   1.3/1.4 DDL & Mentor home dashboards — turns the real children
       (.prof-section, .qa-grid, #*-shift-card .mp-card-hero,
       #*-stats-card .mp-card-stats, .home-drawer) into a 2-column grid
       (1.1fr / .9fr) via grid-template-areas: profile top-right, hero +
       quick actions left, stats + drawer(notifications) right. Glow
       layers constrained; mouse hover states added.
   1.5 Login — centers the .login-card column on the branded background,
       rounds all corners, constrains glows.
   1.6 Hero/card hover polish for mouse users.
   2   TABLET (640–1023px) — lighter: centered page content, sheets as
       centered modals, home as a centered single column with a 4-up
       qa-grid, centered login card.

   Notes / classes NOT found:
   - No dedicated wide-only class existed; all targeting reuses the real
     mobile classes/ids confirmed in index.html + base/glass/app.css.
   - The validated previews use helper classes (.shell/.main/.media/.fn/
     .profile-chip) that do NOT exist in the live DOM; their LOOK is
     emulated here using the real elements instead of those class names.
   ===================================================================== */

/* ===================== LISTS + ROLE-SHIFT + SQUAD ===================== */
/* =====================================================================
   _wide-lists.css — WIDE-SCREEN CARD-GRID LAYER for SportZania list screens
   ---------------------------------------------------------------------
   Adds a tablet + desktop reading experience ON TOP of the live mobile
   UI for the long list/roster screens. HARD RULE: every rule lives inside
   a min-width media query, so nothing below 640px is ever touched — the
   phone / Telegram UI stays 100% intact.
     - Desktop : @media (min-width:1024px)
     - Tablet  : @media (min-width:640px) and (max-width:1023px)

   Scope (real ids / classes confirmed in index.html + js/screens):
     DDL list screens — #screen-ddl-shifts / -staff / -venues /
       -checklists / -challenges. Shared skeleton: .page-header
       (back-btn + h2 + action btn) + .page-body holding a `.list-gap`
       container (#shifts-list / #staff-list / #venues-list /
       #checklists-list / #challenges-pool-list). Cards are .shift-card /
       .staff-card / inline-styled blocks. #screen-ddl-shifts renders a
       pills bar as the FIRST child INSIDE #shifts-list; #screen-ddl-staff
       has a .search-field block ABOVE the .page-body; challenges renders
       <details> period sections as the direct children.
     #screen-role-shift — JS fills #role-shift-body with one padded
       wrapper div: a tab bar (first child) + a flat stream of card divs +
       a stats panel (last child).
     #screen-mentor-squad — #squad-list filled with .staff-card items.

   Reuses CSS vars (--border) and the emerald glass aesthetic. No JS.
   Emulates _prod_pull/preview-ddl-*.html + preview-emp-shift /-squad.html.

   These id-scoped selectors intentionally out-specify the generic
   `.screen:not(...) .page-body .list-gap` 2-up grid in _wide-core.css
   (an id always beats class chains) so each list gets a proper card grid.
   ===================================================================== */


/* =====================================================================
   1 · DESKTOP  (≥1024px)
   ===================================================================== */
@media (min-width: 1024px) {

  /* ---- 1.1 DDL list screens — centered ≤1100px column --------------
     Constrain the header + the body (and the standalone search block on
     the staff screen) to a comfortable reading column, centered.       */
  /* RULE: full-width list screens — no narrow centered column */
  #screen-ddl-shifts     .page-header,
  #screen-ddl-staff      .page-header,
  #screen-ddl-venues     .page-header,
  #screen-ddl-checklists .page-header,
  #screen-ddl-challenges .page-header,
  #screen-ddl-shifts     .page-body,
  #screen-ddl-staff      .page-body,
  #screen-ddl-venues     .page-body,
  #screen-ddl-checklists .page-body,
  #screen-ddl-challenges .page-body {
    max-width: none;
    width: 100%;
    padding-left: clamp(20px, 3vw, 48px);
    padding-right: clamp(20px, 3vw, 48px);
  }
  #screen-ddl-staff > div:has(> .search-field) {
    max-width: none;
    width: 100%;
    box-sizing: border-box;
    padding-left: clamp(20px, 3vw, 48px);
    padding-right: clamp(20px, 3vw, 48px);
  }
  #screen-ddl-staff .search-field { width: 100%; box-sizing: border-box; }

  /* ---- 1.2 List → responsive card grid ----------------------------
     Turn the single narrow column into auto-filling cards so the width
     is actually used. minmax(300px,1fr) → as many columns as fit.       */
  #screen-ddl-shifts     #shifts-list,
  #screen-ddl-staff      #staff-list,
  #screen-ddl-venues     #venues-list,
  #screen-ddl-checklists #checklists-list,
  #screen-ddl-challenges #challenges-pool-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 14px;
    align-items: start;
  }

  /* Drop the per-card inline bottom margins so grid `gap` is the single
     source of spacing (cards on shifts/checklists/venues/challenges use
     inline margin-bottom in the JS templates).                          */
  #screen-ddl-shifts     #shifts-list > .shift-card,
  #screen-ddl-venues     #venues-list > .shift-card,
  #screen-ddl-checklists #checklists-list > .shift-card {
    margin-bottom: 0 !important;
  }
  #screen-ddl-challenges #challenges-pool-list > details {
    margin-bottom: 0 !important;
  }

  /* Elements that must NOT be a single grid cell but span the whole row:
     - the filter pills bar (1st child of #shifts-list, inline flex)
     - any empty-state placeholder                                       */
  #screen-ddl-shifts #shifts-list > div:first-child,
  #screen-ddl-shifts     #shifts-list     > .empty-state,
  #screen-ddl-staff      #staff-list      > .empty-state,
  #screen-ddl-venues     #venues-list     > .empty-state,
  #screen-ddl-checklists #checklists-list > .empty-state,
  #screen-ddl-challenges #challenges-pool-list > .empty-state {
    grid-column: 1 / -1;
  }

  /* ---- 1.3 Card hover affordances (mouse only) -------------------- */
  #screen-ddl-shifts     #shifts-list > .shift-card,
  #screen-ddl-venues     #venues-list > .shift-card,
  #screen-ddl-checklists #checklists-list > .shift-card,
  #screen-ddl-staff      #staff-list  > .staff-card {
    transition: transform .14s ease, box-shadow .14s ease, border-color .14s ease;
  }
  #screen-ddl-shifts     #shifts-list > .shift-card:hover,
  #screen-ddl-venues     #venues-list > .shift-card:hover,
  #screen-ddl-checklists #checklists-list > .shift-card:hover,
  #screen-ddl-staff      #staff-list  > .staff-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 26px rgba(0, 0, 0, .12);
    border-color: rgba(20, 232, 142, .45);
  }


  /* ---- 1.4 ROLE-SHIFT  #screen-role-shift -------------------------
     JS fills #role-shift-body with a single padded wrapper containing:
     tab bar (1st child) → flat card stream → stats panel (last child).
     Center the wrapper and flow its card stream into multiple columns. */
  #screen-role-shift .page-header {
    max-width: 1100px;
    margin-left: auto;
    margin-right: auto;
    width: 100%;
  }
  #screen-role-shift #role-shift-body {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
  }
  /* the inner padded wrapper the JS creates (div with padding:12px 16px) */
  #screen-role-shift #role-shift-body > div {
    max-width: 1100px;
    margin-left: auto;
    margin-right: auto;
    width: 100%;
    box-sizing: border-box;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 12px;
    align-items: start;
  }
  /* kill the inline margin-bottom:10px the JS sets on every card so the
     grid `gap` controls spacing instead.                                */
  #screen-role-shift #role-shift-body > div > * {
    margin-bottom: 0 !important;
  }
  /* Full-width rows: the tab bar (1st child, inline flex), the
     download-passports button, and the bottom stats panel (last child). */
  #screen-role-shift #role-shift-body > div > div:first-child,
  #screen-role-shift #role-shift-body > div > button,
  #screen-role-shift #role-shift-body > div > div:last-child {
    grid-column: 1 / -1;
  }
  /* The tab bar itself stays a horizontal flex row, full row width. */
  #screen-role-shift #role-shift-body > div > div:first-child {
    display: flex;
  }
  /* role-shift cards are clickable → mouse hover lift */
  #screen-role-shift #role-shift-body > div > div[onclick] {
    transition: transform .14s ease, box-shadow .14s ease;
  }
  #screen-role-shift #role-shift-body > div > div[onclick]:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 26px rgba(0, 0, 0, .28);
  }


  /* ---- 1.5 MENTOR SQUAD  #screen-mentor-squad --------------------- */
  #screen-mentor-squad .page-header,
  #screen-mentor-squad .page-body {
    max-width: 1100px;
    margin-left: auto;
    margin-right: auto;
    width: 100%;
  }
  #screen-mentor-squad #squad-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 14px;
    align-items: start;
  }
  #screen-mentor-squad #squad-list > .empty-state {
    grid-column: 1 / -1;
  }
  #screen-mentor-squad #squad-list > .staff-card {
    transition: transform .14s ease, box-shadow .14s ease, border-color .14s ease;
  }
  #screen-mentor-squad #squad-list > .staff-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 26px rgba(0, 0, 0, .12);
    border-color: rgba(20, 232, 142, .45);
  }
}


/* =====================================================================
   2 · TABLET  (640px – 1023px)
   ---------------------------------------------------------------------
   Lighter: a fixed 2-column grid in a centered ≤760px column.
   ===================================================================== */
@media (min-width: 640px) and (max-width: 1023px) {

  /* ---- 2.1 DDL list screens — centered column -------------------- */
  #screen-ddl-shifts     .page-header,
  #screen-ddl-staff      .page-header,
  #screen-ddl-venues     .page-header,
  #screen-ddl-checklists .page-header,
  #screen-ddl-challenges .page-header,
  #screen-ddl-shifts     .page-body,
  #screen-ddl-staff      .page-body,
  #screen-ddl-venues     .page-body,
  #screen-ddl-checklists .page-body,
  #screen-ddl-challenges .page-body {
    max-width: 760px;
    margin-left: auto;
    margin-right: auto;
    width: 100%;
  }
  #screen-ddl-staff > div:has(> .search-field) {
    max-width: 760px;
    margin-left: auto;
    margin-right: auto;
    width: 100%;
    box-sizing: border-box;
  }
  #screen-ddl-staff .search-field { width: 100%; box-sizing: border-box; }

  /* ---- 2.2 List → 2-column grid ---------------------------------- */
  #screen-ddl-shifts     #shifts-list,
  #screen-ddl-staff      #staff-list,
  #screen-ddl-venues     #venues-list,
  #screen-ddl-checklists #checklists-list,
  #screen-ddl-challenges #challenges-pool-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    align-items: start;
  }
  #screen-ddl-shifts     #shifts-list > .shift-card,
  #screen-ddl-venues     #venues-list > .shift-card,
  #screen-ddl-checklists #checklists-list > .shift-card {
    margin-bottom: 0 !important;
  }
  #screen-ddl-challenges #challenges-pool-list > details {
    margin-bottom: 0 !important;
  }
  #screen-ddl-shifts #shifts-list > div:first-child,
  #screen-ddl-shifts     #shifts-list     > .empty-state,
  #screen-ddl-staff      #staff-list      > .empty-state,
  #screen-ddl-venues     #venues-list     > .empty-state,
  #screen-ddl-checklists #checklists-list > .empty-state,
  #screen-ddl-challenges #challenges-pool-list > .empty-state {
    grid-column: 1 / -1;
  }

  /* ---- 2.3 ROLE-SHIFT — 2-up, centered --------------------------- */
  #screen-role-shift .page-header {
    max-width: 760px;
    margin-left: auto;
    margin-right: auto;
    width: 100%;
  }
  #screen-role-shift #role-shift-body > div {
    max-width: 760px;
    margin-left: auto;
    margin-right: auto;
    width: 100%;
    box-sizing: border-box;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    align-items: start;
  }
  #screen-role-shift #role-shift-body > div > * {
    margin-bottom: 0 !important;
  }
  #screen-role-shift #role-shift-body > div > div:first-child,
  #screen-role-shift #role-shift-body > div > button,
  #screen-role-shift #role-shift-body > div > div:last-child {
    grid-column: 1 / -1;
  }
  #screen-role-shift #role-shift-body > div > div:first-child {
    display: flex;
  }

  /* ---- 2.4 MENTOR SQUAD — 2-up, centered ------------------------- */
  #screen-mentor-squad .page-header,
  #screen-mentor-squad .page-body {
    max-width: 760px;
    margin-left: auto;
    margin-right: auto;
    width: 100%;
  }
  #screen-mentor-squad #squad-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    align-items: start;
  }
  #screen-mentor-squad #squad-list > .empty-state {
    grid-column: 1 / -1;
  }
}


/* =====================================================================
   SECTION SUMMARY
   ---------------------------------------------------------------------
   1   DESKTOP (≥1024px)
   1.1 DDL list screens — center .page-header + .page-body (and the
       staff screen's standalone .search-field wrapper) in a ≤1100px
       column; search field runs full column width.
   1.2 Lists (#shifts-list/#staff-list/#venues-list/#checklists-list/
       #challenges-pool-list) become an auto-fill card grid
       repeat(auto-fill,minmax(300px,1fr)); inline card margin-bottoms
       neutralised in favour of grid gap.
       Full-row spanners: the #shifts-list pills bar (1st child) and any
       .empty-state.
   1.3 Mouse hover lift on .shift-card / .staff-card.
   1.4 #screen-role-shift — center #role-shift-body's inner wrapper at
       ≤1100px and turn its JS-rendered card stream into the same
       auto-fill grid; tab bar (1st child), passports button and stats
       panel (last child) span the full row; clickable cards get hover.
   1.5 #screen-mentor-squad — #squad-list becomes an auto-fill card grid
       of .staff-card items with hover.
   2   TABLET (640–1023px) — same structure, fixed 2-column grids in a
       centered ≤760px column for every screen above.

   Notes / classes NOT found:
   - There is no `.filter-pills` / `.pills` class in the live DOM: the
     ДДЛ shifts filter pills are an inline-styled flex <div> that is the
     FIRST child rendered INSIDE #shifts-list (ddl.js). It is therefore
     targeted positionally via `#shifts-list > div:first-child` and made
     to span the full grid row, rather than by class.
   - #screen-role-shift has NO `.page-body`/`.list-gap`; its content is a
     single JS-built wrapper `#role-shift-body > div` whose children are
     inline-styled cards (no shared card class). The grid + full-row
     spanners are therefore applied via child-position selectors.
   - DDL challenges render <details> period accordions (not flat cards)
     as the direct children of #challenges-pool-list; the grid applies to
     those <details> blocks, their inner item columns stay intact.
   - `:has()` is used to find the staff search wrapper; it is well
     supported on all desktop/tablet browsers in scope (and only ever
     runs ≥640px, never affecting the mobile/Telegram WebView default).
   ===================================================================== */

/* ===================== CHILD + PROFILE + AI ===================== */
/* ════════════════════════════════════════════════════════════════════════
   _wide-child.css — RESPONSIVE WIDE LAYER for child / profile / ai-chat
   ────────────────────────────────────────────────────────────────────────
   Mobile (<640px) is NEVER touched: every rule below lives inside a
   min-width media query. Desktop = ≥1024px, Tablet = 640–1023px.
   Reuses real DOM classes from index.html + tokens/colors from app.css.
   Child screens stay WARM/AMBER (no recolor); profile/ai stay emerald glass.
   ════════════════════════════════════════════════════════════════════════ */

/* ═══════════════════════════════════════════════════════════════════════
   DESKTOP  ≥1024px
   ═══════════════════════════════════════════════════════════════════════ */
@media (min-width: 1024px) {

  /* ─────────────────────────────────────────────────────────────────────
     1. CHILD HOME — 2-column dashboard
        header full width on top, then body (left) + drawer/notifs (right)
     ───────────────────────────────────────────────────────────────────── */
  #screen-child-home {
    align-items: center;          /* center the whole stack */
  }
  /* header spans the comfortable content width, full bleed feel */
  #screen-child-home .child-header {
    width: 100%;
    max-width: 1080px;
    padding: 32px 32px 22px;
    box-sizing: border-box;
  }
  #screen-child-home .child-profile-row { margin-bottom: 18px; }
  #screen-child-home .cav { width: 64px; height: 64px; font-size: 24px; }
  #screen-child-home .cname { font-size: 22px; }
  #screen-child-home .csquad { font-size: 14px; }
  #screen-child-home .child-stats { gap: 14px; }
  #screen-child-home .cstat { padding: 16px 14px; border-radius: 16px; }
  #screen-child-home .cvl { font-size: 24px; }
  #screen-child-home .clbl { font-size: 11px; }

  /* the two real columns: .child-body (left) + .child-drawer (right) */
  #screen-child-home .child-body,
  #screen-child-home .child-drawer {
    width: 100%;
    max-width: 1080px;
    box-sizing: border-box;
  }
  /* lay body + drawer next to each other using a shared centering wrapper:
     we cannot wrap in JS, so use the screen as a grid context instead */
  #screen-child-home.active {
    display: grid;
    grid-template-columns: 1fr;
    grid-template-areas:
      "header"
      "main";
    align-content: start;
    justify-items: center;
    padding-bottom: 40px;
  }
  #screen-child-home .child-glow,
  #screen-child-home .child-noise { grid-area: 1 / 1 / -1 / -1; }
  #screen-child-home .child-header { grid-area: header; }

  /* body + drawer become a 2-col grid via a contents-level wrapper trick:
     put both into 'main' row by giving each its own column on a sub-grid */
  #screen-child-home .child-body {
    grid-area: main;
    align-self: start;
    display: grid;
    grid-template-columns: 1.45fr 1fr;
    grid-auto-rows: min-content;
    gap: 18px 22px;
    padding: 4px 32px 0;
  }
  /* the notifications drawer is the 2nd visual column — pull it up beside body */
  #screen-child-home .child-drawer {
    grid-area: main;
    align-self: start;
    justify-self: end;
    width: 360px;
    margin-top: 4px;
    border-radius: 20px;            /* full card, not a bottom sheet anymore */
    border: 1px solid rgba(255,255,255,.18);
    padding: 18px 20px 20px;
    box-shadow: 0 14px 44px rgba(234,88,12,.22), inset 0 1px 0 rgba(255,255,255,.14);
  }
  #screen-child-home .child-drawer .handle { display: none; }

  /* give the left column room: body items should NOT stretch under drawer.
     Reserve the right 360px gutter for the body grid. */
  #screen-child-home .child-body {
    padding-right: calc(360px + 22px + 32px);
    grid-template-columns: 1fr 1fr;
  }
  /* left-column hero items span full body width (which excludes drawer gutter) */
  #screen-child-home #child-active-shift,
  #screen-child-home #child-checkin-btn,
  #screen-child-home #child-pretest-banner,
  #screen-child-home .stitle,
  #screen-child-home #child-skills-preview,
  #screen-child-home #child-future-wrap,
  #screen-child-home #child-challenge-remind {
    grid-column: 1 / -1;
  }
  #screen-child-home #child-active-shift { padding: 18px 20px; border-radius: 18px; }
  #screen-child-home .cas-name { font-size: 17px; }
  #screen-child-home #child-checkin-btn { padding: 16px; font-size: 16px; max-width: 420px; }
  /* top-3 skills become a 3-up row in the left column */
  #screen-child-home #child-skills-preview {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    align-items: start;
  }
  #screen-child-home #child-skills-preview .skrow { flex-direction: column; align-items: stretch; text-align: left; }
  #screen-child-home #child-skills-preview .skscore { text-align: left; }

  /* notifications list inside the right card */
  #screen-child-home .cdr-notif-list { gap: 10px; }
  #screen-child-home .cdr-notif-item { padding: 11px 13px; }
  #screen-child-home .cdr-footer { margin-top: 16px; }

  /* hover affordances */
  #screen-child-home #child-active-shift,
  #screen-child-home .stitle,
  #screen-child-home #child-challenge-remind,
  #screen-child-home #child-pretest-banner { transition: transform .15s, box-shadow .15s, filter .15s; }
  #screen-child-home #child-active-shift:hover { transform: translateY(-2px); box-shadow: 0 12px 30px rgba(234,88,12,.4), inset 0 1px 0 rgba(255,255,255,.2); }
  #screen-child-home #child-checkin-btn:hover { filter: brightness(1.06); box-shadow: 0 12px 38px rgba(234,88,12,.6), inset 0 1px 0 rgba(255,255,255,.34); }
  #screen-child-home .cdr-ficon:hover { background: rgba(255,255,255,.16); }
  #screen-child-home .skrow:hover,
  #screen-child-home #child-challenge-remind:hover,
  #screen-child-home #child-pretest-banner:hover { filter: brightness(1.05); }

  /* ─────────────────────────────────────────────────────────────────────
     2. CHILD SHIFT — widen, multi-column lists, side-by-side diary
     ───────────────────────────────────────────────────────────────────── */
  #screen-child-shift { align-items: center; }
  #screen-child-shift .shift-header,
  #screen-child-shift .shift-tabs,
  #screen-child-shift .shift-body {
    width: 100%;
    max-width: 960px;
    box-sizing: border-box;
  }
  #screen-child-shift .shift-header { padding: 22px 24px 12px; }
  #screen-child-shift .shift-hdr-name { font-size: 20px; }
  /* centered, capped tab bar */
  #screen-child-shift .shift-tabs {
    max-width: 620px;
    gap: 8px;
    padding: 0 0 16px;
  }
  #screen-child-shift .shift-tab { padding: 11px 6px; font-size: 13px; }
  #screen-child-shift .shift-body { padding: 6px 24px 40px; }

  /* skills + challenges → multi-column grids */
  #screen-child-shift #all-skills-list,
  #screen-child-shift #challenges-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    align-items: start;
  }

  /* diary: the two textarea blocks side-by-side */
  #screen-child-shift .diary-entry {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0 16px;
    padding: 4px 4px 8px;
  }
  #screen-child-shift .diary-section-label { border-bottom: none; }
  #screen-child-shift .diary-textarea { min-height: 200px; }
  #screen-child-shift [data-panel="diary"] .day-tabs { justify-content: center; }

  /* passport content centered & readable */
  #screen-child-shift #passport-content {
    max-width: 640px;
    margin: 0 auto;
  }

  /* hover */
  #screen-child-shift .shift-tab:not(.active):hover { background: rgba(255,255,255,.12); color: #fff; }
  #screen-child-shift #all-skills-list > *:hover,
  #screen-child-shift #challenges-list > *:hover { filter: brightness(1.05); }

  /* ─────────────────────────────────────────────────────────────────────
     3. CHILD HISTORY — responsive card grid
     ───────────────────────────────────────────────────────────────────── */
  #screen-child-history { align-items: center; }
  #screen-child-history .shift-header,
  #screen-child-history .shift-body {
    width: 100%;
    max-width: 1000px;
    box-sizing: border-box;
  }
  #screen-child-history .shift-header { padding: 22px 24px 12px; }
  #screen-child-history .shift-body { padding: 6px 24px 40px; }
  #screen-child-history #history-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
    align-items: start;
  }
  #screen-child-history #history-list > *:hover { filter: brightness(1.05); transition: filter .15s; }

  /* ─────────────────────────────────────────────────────────────────────
     4. CHILD TEST & CHILD REGISTER — centered comfortable card (~560px)
     ───────────────────────────────────────────────────────────────────── */
  #screen-child-test .page-header,
  #screen-child-register .page-header {
    width: 100%;
    justify-content: flex-start;
  }
  #screen-child-test .page-header h2,
  #screen-child-register .page-header h2 { max-width: 560px; }
  #screen-child-test .page-body,
  #screen-child-register .page-body {
    width: 100%;
    max-width: 560px;
    margin: 0 auto;
    padding-top: 28px;
  }
  /* register form fields a touch larger on desktop */
  #screen-child-register .profile-field input { padding: 13px 15px; }
  #screen-child-register .btn-primary:hover { filter: brightness(1.06); }

  /* ─────────────────────────────────────────────────────────────────────
     5. PROFILE — two-column: identity/avatar left, fields right
        Works for emerald (DDL/staff) and amber (child) via existing tokens.
     ───────────────────────────────────────────────────────────────────── */
  #screen-profile { align-items: center; }
  #screen-profile .page-header {
    width: 100%;
    box-sizing: border-box;
  }
  /* account panel (left) + form (right), settings cards под панелью слева */
  #screen-profile .page-body {
    width: 100%;
    max-width: 1080px;
    margin: 0 auto;
    display: grid !important;
    grid-template-columns: 320px minmax(0, 1fr);
    grid-template-areas:
      "side main"
      "extra main";
    align-content: start;
    align-items: start;
    gap: 18px 30px;
    padding: 30px clamp(24px, 3vw, 40px) calc(32px + var(--safe-bottom));
  }
  #screen-profile #profile-side {
    grid-area: side;
    margin-top: 0 !important;
    gap: 6px;
    padding: 22px 18px;
    border: 1px solid rgba(255,255,255,.10);
    border-radius: 18px;
    background: rgba(255,255,255,.03);
    box-shadow: inset 0 1px 0 rgba(255,255,255,.06);
  }
  #screen-profile #profile-avatar { width: 104px; height: 104px; font-size: 36px; }
  #screen-profile #profile-name-display { font-size: 18px; }
  #screen-profile #profile-extra { grid-area: extra; margin-top: 0 !important; }
  #screen-profile #profile-main { grid-area: main; align-self: start; }
  /* fields → 2 колонки, ФИО на всю ширину */
  #screen-profile #profile-main .profile-fields {
    display: grid !important;
    grid-template-columns: 1fr 1fr;
    gap: 14px 18px;
  }
  #screen-profile #profile-main .profile-fields > .profile-field:first-child { grid-column: 1 / -1; }
  #screen-profile #profile-save {
    width: auto !important;
    align-self: flex-end;
    min-width: 220px;
  }
  #screen-profile #profile-save:hover { filter: brightness(1.06); }
  #screen-profile #profile-photo-btn:hover { text-decoration: underline; }
  #screen-profile .profile-field input:hover { border-color: rgba(255,255,255,.22); }

  /* ─────────────────────────────────────────────────────────────────────
     6. AI CHAT — quick-actions sidebar + chat column, centered max-width
        (emulates preview-ddl-ai). No JS / no DOM change: we re-grid the
        existing #ai-messages welcome block + composer.
     ───────────────────────────────────────────────────────────────────── */
  /* AI chat — FULL-WIDTH two-pane: chat list (left) + active chat (right).
     Fixed viewport height so the composer is always visible (not cut off);
     the messages area scrolls internally.                                  */
  #screen-ai-chat.active {
    display: grid;
    grid-template-columns: 300px minmax(0, 1fr);
    grid-template-rows: auto auto minmax(0, 1fr) auto auto;
    grid-template-areas:
      "side header"
      "side usage"
      "side msgs"
      "side attach"
      "side composer";
    column-gap: 18px; row-gap: 10px;
    align-items: stretch;
    max-width: none; margin: 0;
    height: 100dvh; max-height: 100dvh; overflow: hidden;
    padding: 16px clamp(16px, 3vw, 32px) 20px;
  }
  #screen-ai-chat > .login-glow { opacity: .16; }
  /* chat-list sidebar — persistent on wide (overrides the slide-in panel) */
  #screen-ai-chat #ai-history-sidebar {
    grid-area: side;
    display: flex !important; flex-direction: column;
    position: static !important; inset: auto !important; transform: none !important;
    width: auto !important; max-width: none !important; height: auto !important;
    background: rgba(255,255,255,.035); border: 1px solid rgba(255,255,255,.10);
    border-radius: 20px; padding: 14px; overflow-y: auto;
  }
  /* place the active-chat column pieces by id / :has() */
  #screen-ai-chat > div:has(#btn-ai-history) { grid-area: header; }
  #screen-ai-chat #ai-usage-bar { grid-area: usage; }
  #screen-ai-chat #ai-messages {
    grid-area: msgs; min-height: 0; overflow-y: auto;
    background: rgba(255,255,255,.035); border: 1px solid rgba(255,255,255,.10);
    border-radius: 22px; padding: 22px 24px;
  }
  #screen-ai-chat #ai-attachments-preview { grid-area: attach; }
  #screen-ai-chat > div:has(#ai-input) { grid-area: composer; }
  /* history (burger) toggle is redundant on wide — the list is always shown */
  #screen-ai-chat #btn-ai-history { display: none !important; }
  /* the close ✕ inside the persistent sidebar header is also redundant */
  #screen-ai-chat #ai-history-sidebar > div:first-child button { display: none !important; }
  #screen-ai-chat #ai-welcome {
    max-width: 660px; margin: auto; padding: 24px 16px;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
  }
  #screen-ai-chat #ai-welcome > div:last-child {
    display: grid !important; grid-template-columns: 1fr 1fr; gap: 12px !important; max-width: 600px !important;
  }
  #screen-ai-chat .ai-quick-btn:hover {
    background: rgba(20,232,142,.12) !important; border-color: rgba(20,232,142,.4) !important; transform: translateY(-1px);
  }
  #screen-ai-chat #ai-messages > *:not(#ai-welcome) { max-width: 760px; }
}

/* ═══════════════════════════════════════════════════════════════════════
   TABLET  640–1023px — single-column centered, grids 2-up
   ═══════════════════════════════════════════════════════════════════════ */
@media (min-width: 640px) and (max-width: 1023px) {

  /* CHILD HOME — single centered column (drawer stays a bottom sheet) */
  #screen-child-home { align-items: center; }
  #screen-child-home .child-header,
  #screen-child-home .child-body,
  #screen-child-home .child-drawer {
    width: 100%;
    max-width: 620px;
    box-sizing: border-box;
  }
  #screen-child-home #child-skills-preview {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }

  /* CHILD SHIFT — centered, lists 2-up, diary stacked (room is tight) */
  #screen-child-shift { align-items: center; }
  #screen-child-shift .shift-header,
  #screen-child-shift .shift-tabs,
  #screen-child-shift .shift-body {
    width: 100%;
    max-width: 620px;
    box-sizing: border-box;
  }
  #screen-child-shift #all-skills-list,
  #screen-child-shift #challenges-list {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    align-items: start;
  }

  /* CHILD HISTORY — centered, 2-up cards */
  #screen-child-history { align-items: center; }
  #screen-child-history .shift-header,
  #screen-child-history .shift-body {
    width: 100%;
    max-width: 640px;
    box-sizing: border-box;
  }
  #screen-child-history #history-list {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    align-items: start;
  }

  /* CHILD TEST / REGISTER — centered comfortable column */
  #screen-child-test .page-body,
  #screen-child-register .page-body {
    width: 100%;
    max-width: 520px;
    margin: 0 auto;
  }

  /* PROFILE — single centered column (no split yet) */
  #screen-profile { align-items: center; }
  #screen-profile .page-header,
  #screen-profile .page-body {
    width: 100%;
    max-width: 560px;
    margin-left: auto;
    margin-right: auto;
    box-sizing: border-box;
  }

  /* AI CHAT — centered column, quick actions 2-up */
  #screen-ai-chat { align-items: center; }
  #screen-ai-chat > div,
  #screen-ai-chat #ai-messages {
    width: 100%;
    max-width: 680px;
    margin-left: auto;
    margin-right: auto;
    box-sizing: border-box;
  }
  #screen-ai-chat #ai-welcome > div:last-child {
    display: grid !important;
    grid-template-columns: 1fr 1fr;
    gap: 10px !important;
    max-width: 560px !important;
  }
}

/* ════════════════════════════════════════════════════════════════════════
   SUMMARY
   ─────────────────────────────────────────────────────────────────────────
   Adds a wide-screen layer for the child/profile/ai screens, entirely inside
   min-width media queries so mobile (<640px) is byte-for-byte unchanged.

   Desktop ≥1024:
     • #screen-child-home  → grid dashboard: full-width header, left body
       (active-shift, check-in, top-3 skills as a row) + a 360px notifications
       card on the right (the .child-drawer, de-sheeted into a card).
     • #screen-child-shift → capped width; #all-skills-list & #challenges-list
       become 2-col grids; the two .diary-textarea blocks sit side-by-side;
       passport centered; tab bar centered/capped.
     • #screen-child-history → #history-list auto-fill card grid.
     • #screen-child-test / #screen-child-register → centered ~560px card.
     • #screen-profile → 2-col grid: sticky identity/avatar left, 2-up editable
       fields right, save action bottom-right. Theme-agnostic (emerald/amber
       inherited from app.css tokens — no recolor).
     • #screen-ai-chat → centered ≤1080px; welcome quick-actions as a 2-up
       grid; chat bubbles capped for readability.

   Tablet 640–1023: everything collapses to a single centered column with
   2-up grids for skills/challenges/history/quick-actions.

   Subtle :hover states added throughout (desktop only).

   Reused REAL classes only: child-header, child-profile-row, cav, cname,
   csquad, child-stats, cstat, cvl, clbl, child-body, child-active-shift,
   cas-*, btn-shift, stitle, child-drawer/handle, cdr-notif-list/item,
   cdr-footer/cdr-ficon, shift-header, shift-tabs, shift-tab, shift-body,
   shift-panel, diary-entry, diary-section-label, diary-textarea, day-tabs,
   #all-skills-list, #challenges-list, #passport-content, #history-list,
   page-header, page-body, profile-field, #profile-avatar/#profile-role/
   #profile-save/#profile-created, #ai-messages/#ai-welcome/.ai-quick-btn.
   No warm/amber recolor of child screens; no JS; no DOM changes.
   ════════════════════════════════════════════════════════════════════════ */

/* ════════════════════════════════════════════════════════════════════════
   CHILD REBUILD v2 — overrides the older child-home/child-shift rules above.
   Appended last so it wins by cascade order. Full-width dashboard, balanced
   columns (no voids), all 4 shift tabs fill the screen, passport centered.
   Touches ONLY #screen-child-home / #screen-child-shift — profile & ai-chat
   above are untouched.
   ════════════════════════════════════════════════════════════════════════ */
@media (min-width: 1024px) {
  /* ── CHILD HOME — full-bleed warm dashboard ── */
  #screen-child-home.active {
    display: grid;
    grid-template-columns: minmax(0, 1.62fr) minmax(340px, 0.85fr);
    grid-template-areas:
      "header header"
      "body   drawer";
    align-content: start;
    gap: 18px 26px;
    padding: 26px clamp(28px, 3.4vw, 60px) 48px;
    overflow: visible;
  }
  #screen-child-home.active .child-glow,
  #screen-child-home.active .child-noise { grid-area: 1 / 1 / -1 / -1; }

  #screen-child-home .child-header {
    grid-area: header;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 18px 28px;
    width: 100%;
    margin: 0;
    padding: 22px 28px;
    box-sizing: border-box;
    border-radius: 22px;
    background: linear-gradient(135deg, rgba(255,255,255,.08), rgba(255,255,255,.03));
    border: 1px solid rgba(255,255,255,.12);
    box-shadow: inset 0 1px 0 rgba(255,255,255,.12);
  }
  #screen-child-home .child-profile-row { margin: 0; gap: 16px; }
  #screen-child-home .cav { width: 66px; height: 66px; font-size: 25px; }
  #screen-child-home .cname { font-size: 23px; }
  #screen-child-home .csquad { font-size: 14px; margin-top: 3px; }
  #screen-child-home .child-stats { flex: 0 0 auto; gap: 12px; }
  #screen-child-home .cstat { flex: 0 0 auto; min-width: 98px; padding: 14px 20px; border-radius: 16px; }
  #screen-child-home .cvl { font-size: 24px; }
  #screen-child-home .clbl { font-size: 10px; }

  #screen-child-home .child-body {
    grid-area: body;
    align-self: start;
    flex: none;
    display: flex;
    flex-direction: column;
    gap: 16px;
    width: 100%;
    margin: 0;
    padding: 2px 0 0;
  }
  #screen-child-home #child-active-shift { padding: 22px 24px; border-radius: 20px; }
  #screen-child-home .cas-emoji { font-size: 34px; }
  #screen-child-home .cas-top { gap: 16px; }
  #screen-child-home .cas-name { font-size: 19px; }
  #screen-child-home .cas-meta { font-size: 13px; white-space: normal; }
  #screen-child-home .cas-progress { height: 7px; margin-top: 16px; }
  #screen-child-home .cas-day { font-size: 12px; margin-top: 10px; }
  #screen-child-home #child-checkin-btn {
    width: auto;
    align-self: flex-start;
    min-width: 260px;
    padding: 16px 30px;
    font-size: 16px;
    border-radius: 16px;
  }
  #screen-child-home .stitle { font-size: 12px; margin-top: 6px; }
  #screen-child-home #child-skills-preview {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
  }
  #screen-child-home #child-skills-preview .skrow {
    flex-direction: column;
    align-items: stretch;
    gap: 13px;
    padding: 18px 16px;
    border-radius: 16px;
  }
  #screen-child-home #child-skills-preview .skico { width: 42px; height: 42px; border-radius: 12px; }
  #screen-child-home #child-skills-preview .skico svg { width: 18px; height: 18px; }
  #screen-child-home #child-skills-preview .skinfo { width: 100%; }
  #screen-child-home #child-skills-preview .sknm { font-size: 13px; margin-bottom: 8px; }
  #screen-child-home #child-skills-preview .skbar { height: 7px; }
  #screen-child-home #child-skills-preview .skscore { text-align: left; font-size: 22px; }
  #screen-child-home #child-skills-preview .skscore-max { font-size: 12px; opacity: .6; }

  #screen-child-home .child-drawer {
    grid-area: drawer;
    align-self: stretch;
    display: flex;
    flex-direction: column;
    width: 100%;
    margin: 0;
    padding: 20px 22px;
    border-radius: 22px;
    border: 1px solid rgba(255,255,255,.18);
    box-shadow: 0 18px 50px rgba(234,88,12,.22), inset 0 1px 0 rgba(255,255,255,.14);
  }
  #screen-child-home .child-drawer .handle { display: none; }
  #screen-child-home .cdr-title { font-size: 12px; margin: 0 2px 14px; }
  #screen-child-home #child-notifications { flex: 1 1 auto; }
  #screen-child-home .cdr-notif-list { gap: 10px; }
  #screen-child-home .cdr-notif-item { padding: 12px 14px; border-radius: 12px; }
  #screen-child-home .cdr-notif-item .nt-text { font-size: 13px; }
  #screen-child-home .cdr-footer { margin-top: 18px; padding-top: 16px; }
  #screen-child-home .cdr-ficon { padding: 12px 8px; }
  #screen-child-home .cdr-ficon svg { width: 19px; height: 19px; }
  #screen-child-home .cdr-ficon span { font-size: 11px; }

  #screen-child-home #child-active-shift,
  #screen-child-home .skrow,
  #screen-child-home #child-checkin-btn,
  #screen-child-home .stitle,
  #screen-child-home #child-challenge-remind,
  #screen-child-home #child-pretest-banner,
  #screen-child-home .cdr-ficon { transition: transform .15s, box-shadow .15s, filter .15s, background .2s; }
  #screen-child-home #child-active-shift:hover { transform: translateY(-2px); box-shadow: 0 14px 34px rgba(234,88,12,.42), inset 0 1px 0 rgba(255,255,255,.2); }
  #screen-child-home #child-checkin-btn:hover { filter: brightness(1.06); box-shadow: 0 12px 38px rgba(234,88,12,.6), inset 0 1px 0 rgba(255,255,255,.34); }
  #screen-child-home .skrow:hover,
  #screen-child-home #child-challenge-remind:hover,
  #screen-child-home #child-pretest-banner:hover { transform: translateY(-2px); filter: brightness(1.05); }
  #screen-child-home .cdr-ficon:hover { background: rgba(255,255,255,.16); }

  /* ── CHILD SHIFT — full-width tabs; lists fill the screen ── */
  #screen-child-shift.active { overflow: visible; align-items: stretch; }
  #screen-child-shift .shift-header,
  #screen-child-shift .shift-tabs,
  #screen-child-shift .shift-body {
    width: 100%;
    max-width: none;
    box-sizing: border-box;
    padding-left: clamp(28px, 3.4vw, 60px);
    padding-right: clamp(28px, 3.4vw, 60px);
  }
  #screen-child-shift .shift-header { padding-top: 24px; padding-bottom: 14px; }
  #screen-child-shift .shift-hdr-name { font-size: 21px; }
  #screen-child-shift .shift-hdr-meta { font-size: 13px; }
  #screen-child-shift .shift-tabs {
    max-width: 760px;
    margin: 0 auto;
    gap: 8px;
    padding-bottom: 18px;
  }
  #screen-child-shift .shift-tab { padding: 12px 8px; font-size: 14px; }
  #screen-child-shift .shift-body { padding-bottom: 56px; }
  #screen-child-shift #all-skills-list,
  #screen-child-shift #challenges-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 14px;
    align-items: start;
  }
  #screen-child-shift .diary-entry {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto 1fr;
    grid-auto-flow: column;
    gap: 8px 20px;
  }
  #screen-child-shift .diary-section-label { border-bottom: none; align-self: end; }
  #screen-child-shift .diary-textarea { min-height: 260px; }
  #screen-child-shift [data-panel="diary"] .day-tabs { justify-content: center; flex-wrap: wrap; padding-bottom: 16px; }
  #screen-child-shift .day-chip { padding: 9px 18px; font-size: 13px; border-radius: 99px; }
  #screen-child-shift .day-chip:hover { background: rgba(255,255,255,.14); }
  #screen-child-shift #passport-content { max-width: 760px; margin: 0 auto; }
  #screen-child-shift .shift-tab:not(.active):hover { background: rgba(255,255,255,.12); color: #fff; }
  #screen-child-shift #all-skills-list > *,
  #screen-child-shift #challenges-list > * { transition: transform .15s, filter .15s; }
  #screen-child-shift #all-skills-list > *:hover,
  #screen-child-shift #challenges-list > *:hover { transform: translateY(-2px); filter: brightness(1.06); }
}

@media (min-width: 640px) and (max-width: 1023px) {
  /* CHILD HOME — single centered column (drawer stays a bottom sheet) */
  #screen-child-home .child-header { display: flex; flex-direction: column; }
  #screen-child-home #child-skills-preview {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 10px;
  }
  #screen-child-home #child-skills-preview .skrow { flex-direction: column; align-items: stretch; gap: 10px; }
  #screen-child-home #child-skills-preview .skscore { text-align: left; }
}
