/* =====================================================================
   ÉPURÉ (1/2) — tablets and computers, every screen
   Applies from 720px wide up (the 720–767px left rail, and the .desk layout from 768px), except short
   landscape-phone screens, which keep the phone layout; a window 960px wide or more is always a tablet /
   computer. Nothing above this block changes, so phones look exactly as before. The desk layout's own
   chrome (toolbar, course navigator, breadcrumb, Galerie, Notes) is sized in part 2/2 at the end of the file.
   Palette  whites #F5F5F7 · blue #3B45D6 · grays #6C6C70 · 1px #E5E5E7 borders, no shadows
   Sizing   icons 16 · buttons 28×28 · toolbars 40 · sidebar 180–200 · text 12–13 · gaps 4–8 · radius 6
   Colours come from the tokens, so the dark theme keeps working. The camera viewfinder, the radial menus
   and the Quick Capture trigger are used by thumb: they keep their phone-size controls.
   ===================================================================== */
@media (min-width:720px) and (min-height:521px),(min-width:960px){

  /* ---------- Tokens ---------- */
  :root{
    --bg:#F5F5F7;--surface:#F5F5F7;--ink:#1D1D1F;--muted:#6C6C70;--line:#E5E5E7;
    --accent:#3B45D6;--accent-on-surface:#3B45D6;--accent-soft:#E6F1FF;--hover:rgba(29,29,31,.05);
    /* The pastel tones fold into the palette: blue tint with blue text (the red of "delete" stays). */
    --lavender:#E6F1FF;--lavender-fg:var(--accent-on-surface);--mint:#E6F1FF;--mint-fg:var(--accent-on-surface);
    --peach:#E6F1FF;--peach-fg:var(--accent-on-surface);--yellow:#E6F1FF;--yellow-fg:var(--accent-on-surface);--sky:#E6F1FF;--sky-fg:var(--accent-on-surface);
    --s1:4px;--s2:6px;--s3:8px;--s4:12px;--s5:14px;--s6:16px;--s8:24px;
    --r-chip:6px;--r-btn:6px;--r-md:6px;--r-lg:6px;--r-nav:6px;
    --shadow-sm:0 0 0 0 transparent;--shadow-md:0 0 0 0 transparent;--shadow-lg:0 6px 20px rgba(0,0,0,.12);
    --rail-w:200px;
  }
  @media (max-width:767px){:root{--rail-w:180px}}
  /* More specific than the dark theme's own tokens, so the order of the two blocks doesn't matter. */
  html:root[data-theme="dark"]{--hover:rgba(255,255,255,.06);--shadow-sm:0 0 0 0 transparent;--shadow-md:0 0 0 0 transparent;--shadow-lg:0 6px 20px rgba(0,0,0,.5)}
  /* The camera is an instrument, not a page: its spacing and radii stay at phone values. */
  .camera{--s1:4px;--s2:8px;--s3:12px;--s4:16px;--s5:20px;--s6:24px;--s8:32px;--r-chip:14px;--r-btn:18px;--r-md:22px;--r-lg:28px}

  /* ---------- Base ---------- */
  body{font-size:13px}
  :focus-visible{outline:2px solid var(--accent-on-surface);outline-offset:1px}
  .tone-neutral{--tone-bg:var(--line);--tone-fg:var(--muted)}
  /* Icons: 16px everywhere except the camera, the radial menus and the Quick Capture orb. */
  .app-shell:not(.capture-active) .ico,.sheet .ico,.pe .ico,.desk-menu .ico{width:16px;height:16px}
  .app-shell .qc-trigger .qc-trigger-orb .ico{width:26px;height:26px}

  /* ---------- Navigation: left sidebar (720–767px; from 768px the .desk layout replaces it) ---------- */
  .bottom-nav{width:var(--rail-w);justify-content:flex-start;align-items:stretch;gap:2px;padding:calc(var(--s4) + env(safe-area-inset-top)) var(--s3) calc(var(--s4) + env(safe-area-inset-bottom));background:var(--bg);border-color:var(--line)}
  .nav-item{flex-direction:row;justify-content:flex-start;gap:var(--s3);width:100%;height:32px;min-height:32px;padding:0 var(--s3);border-radius:6px}
  .nav-item:active{transform:none}
  .nav-icon{width:16px;height:16px}
  .nav-item small{font-size:13px;font-weight:500;letter-spacing:0}
  .nav-item.active{background:var(--accent-soft)}
  .nav-item.active small{font-weight:600}
  .nav-item.nav-capture,.nav-item.nav-capture.active{order:-1;justify-content:center;gap:var(--s2);margin-bottom:var(--s3);background:var(--accent);color:#fff}
  .nav-capture .capture-orb{width:16px;height:16px;margin:0;border-radius:0;background:none;box-shadow:none}
  .nav-capture:hover .capture-orb{box-shadow:none}
  .main{padding-top:calc(var(--s4) + env(safe-area-inset-top))}

  /* ---------- Page chrome ---------- */
  .page-header{min-height:40px}
  .page-header-large{font-size:18px;letter-spacing:-.02em}
  .page-header-title{font-size:13px;font-weight:600;letter-spacing:0}
  .wordmark{font-size:16px;letter-spacing:-.04em}
  .wordmark.large{font-size:20px}
  .wordmark i{width:5px;height:5px;right:-6px;top:3px}
  .icon-btn,.icon-btn.flat{width:28px;height:28px;border-radius:6px}
  .icon-btn{background:var(--surface);border:1px solid var(--line)}
  .icon-btn.flat{background:transparent;border-color:transparent}
  .icon-btn:active{transform:none}
  .icon-btn-badge{top:-5px;right:-5px;min-width:16px;height:16px;padding:0 4px;border-radius:8px;border:2px solid var(--bg);background:var(--accent);font-size:11px;line-height:12px}
  .avatar-btn{width:28px;height:28px;background:var(--accent);box-shadow:none;font-size:12px}
  .sync-dot{width:8px;height:8px;right:-1px;bottom:-1px;border-width:1.5px}

  /* ---------- Type ---------- */
  .greeting,.lead{font-size:13px}
  .hero-title,.detail-hero .hero-title{font-size:18px;line-height:1.2;letter-spacing:-.02em}
  .eyebrow,.hero-label{font-size:12px;letter-spacing:.08em}
  .meta-line,.small{font-size:12px}
  .section-title{font-size:13px;letter-spacing:-.01em}
  .section-title .count{min-width:20px;height:18px;margin-left:var(--s1);padding:0 6px;border-radius:6px;font-size:12px;vertical-align:1px}
  .link-btn{min-height:28px;margin:-4px -2px;padding:0 var(--s2);font-size:12px}
  .field-note,.legal-links{font-size:12px}
  .legal-links a{min-height:28px}

  /* ---------- Controls ---------- */
  .search-bar{height:32px;padding:0 var(--s3);gap:var(--s2);border:1px solid var(--line);border-radius:6px;background:var(--surface)}
  .search-bar input{font-size:13px}
  .search-bar:focus-within{border-color:var(--accent-on-surface);box-shadow:0 0 0 3px rgba(59,69,214,.14)}
  .chips{gap:var(--s2)}
  .chip{height:28px;padding:0 var(--s4);border-radius:6px;font-size:12px}
  .action-btn{min-height:28px;padding:0 var(--s4);gap:var(--s2);border-radius:6px;font-size:13px;font-weight:600;letter-spacing:0}
  .action-btn:active{transform:none;opacity:.85}
  .action-btn.primary,.action-btn.capture{background:var(--accent);box-shadow:none}
  .action-btn.ghost,.google-btn{border:1px solid var(--line);box-shadow:none}
  .action-row{gap:var(--s3)}
  .button-stack{gap:var(--s2)}
  .hero-cta{height:28px;padding:0 var(--s4);border-radius:6px;font-size:13px;box-shadow:none}
  .hero-cta:active{transform:none;opacity:.85}
  .seg,.view-toggle-btn{height:28px;min-height:28px;border-radius:6px;font-size:12px}
  .segmented{gap:var(--s2)}
  .session-view-toggle{gap:var(--s1);padding:var(--s1);border:1px solid var(--line);border-radius:6px;background:var(--surface)}
  .view-toggle-btn{gap:var(--s2)}
  .view-toggle-btn.active{background:var(--accent);box-shadow:none}
  .session-notebook-help{margin:0;font-size:12px}
  .seg.lot-b{background:var(--line);color:var(--ink)}
  .thumb.group-b{border-color:var(--muted)}
  .thumb.group-b .group-tag{color:var(--muted)}

  /* ---------- Forms ---------- */
  .form-card{gap:var(--s3);padding:var(--s4)}
  .field{gap:var(--s1)}
  .field label{font-size:12px}
  .field input,.field select,.field textarea{height:32px;padding:0 var(--s3);border:1px solid var(--line);border-radius:6px;background-color:var(--surface);font-size:13px}
  .field textarea{height:auto;min-height:64px;padding:var(--s2) var(--s3)}
  .field select{background-size:16px 16px;background-position:right 8px center;padding-right:28px}
  .field input:focus,.field select:focus{box-shadow:0 0 0 3px rgba(59,69,214,.14)}
  .field-row{gap:var(--s3)}
  .toggle-card,.check-card{padding:var(--s3) var(--s4);gap:var(--s3)}
  .check-card:has(input:checked){border-color:var(--accent-on-surface);box-shadow:none}
  .switch{width:36px;height:20px;border-radius:10px}
  .switch::after{top:2px;left:2px;width:16px;height:16px}
  .switch:checked::after{transform:translateX(16px)}
  .check-mark{width:20px;height:20px;border-width:1.5px}
  .check-mark .ico{width:12px;height:12px}
  .ocr-text{min-height:120px;padding:var(--s3);border-radius:6px;font-size:13px}
  .qr-result{padding:var(--s3);border-radius:6px;font-size:13px}

  /* ---------- Surfaces: flat, 1px borders, 6px radius ---------- */
  .list-card,.course-card,.collection-card,.folder-card,.category-card,.stat-card,.detail-hero,.storage-card,.inbox-card,.empty-state,.form-card,.toggle-card,.check-card,.collapse-card,.profile-card,.hero-card{border:1px solid var(--line)}
  .category-card,.stat-card,.collection-card,.folder-card,.detail-hero{background:var(--surface)}
  .hero-card,.profile-card{background:var(--accent-soft)}
  .hero-card::before{display:none}
  .hero-card{gap:var(--s3);padding:var(--s4)}
  .hero-card-copy{gap:var(--s1)}
  .hero-card h2{font-size:15px;letter-spacing:-.02em}
  .hero-card p{font-size:12px;color:var(--muted)}
  .hero-art{width:72px}
  .qc-trigger{width:96px;gap:var(--s2)}
  .qc-trigger-orb{background:var(--accent);box-shadow:0 0 0 4px var(--bg)}
  .qc-trigger-orb::before{border:1px dashed rgba(59,69,214,.55)}
  .qc-trigger small{font-size:12px;color:var(--muted)}
  .qc-bubble{padding:var(--s3) var(--s4);border-radius:6px;font-size:13px}
  .qc-bubble-btn{height:28px;border-radius:6px;font-size:12px}
  .icon-badge{border-radius:6px}
  .icon-badge.sm{width:24px;height:24px}
  .icon-badge.md{width:28px;height:28px}
  .icon-badge.lg{width:32px;height:32px}
  .category-card .icon-badge,.stat-card .icon-badge,.collection-card .icon-badge,.detail-hero .icon-badge{width:28px;height:28px;border-radius:6px;background:var(--accent-soft)}
  .stat-grid.four .icon-badge{width:24px;height:24px;border-radius:6px}
  .stat-grid.four .icon-badge .ico{width:16px;height:16px}
  .tag{height:20px;padding:0 var(--s3);border-radius:6px;font-size:12px}
  .tags{gap:var(--s1)}
  .badge{height:20px;border-radius:6px;font-size:12px}
  .progress{height:4px;border-radius:2px;background:var(--line)}
  .category-card .progress{background:var(--line)}
  .notice{padding:var(--s3) var(--s4);gap:var(--s3);font-size:12px}
  .empty-state{gap:var(--s2);padding:var(--s6) var(--s5)}
  .empty-state strong{margin-top:var(--s1);font-size:13px}
  .empty-state p{font-size:12px}
  .success-hero{padding:var(--s2) 0}

  /* Lists and cards */
  .list-stack,.card-stack{gap:var(--s2)}
  .list-card{min-height:40px;gap:var(--s3);padding:var(--s2) var(--s3)}
  .list-card-copy{gap:1px}
  .list-card-copy strong,.category-card strong,.collection-card strong,.folder-card strong,.course-card-copy strong,.storage-copy strong{font-size:13px;letter-spacing:0}
  .list-card-copy small,.category-card small,.collection-card small,.folder-card small,.course-card-copy small,.storage-copy small,.stat-card small,.files-image-session-head,.files-image-session-head small{font-size:12px}
  .file-card{padding:0 var(--s2) 0 0}
  .file-open{min-height:40px;gap:var(--s3);padding:var(--s2) var(--s3)}
  .category-grid,.collection-grid,.folder-grid,.stat-grid{gap:var(--s3)}
  .category-card{gap:2px;padding:var(--s3) var(--s4)}
  .category-card .icon-badge{margin-bottom:var(--s1)}
  .course-card{gap:var(--s3);padding:var(--s4)}
  .course-card-progress b,.course-card-foot>small{font-size:12px}
  .stat-card{padding:var(--s3)}
  .stat-card strong,.stat-grid.four strong{font-size:16px}
  .stat-grid.four small{font-size:12px}
  .collection-card{min-height:72px;padding:var(--s3)}
  .collection-card strong{margin-top:var(--s3)}
  .folder-card{padding:var(--s3)}
  .detail-hero,.storage-card,.inbox-card,.profile-card{padding:var(--s4)}
  .collapse-card summary{min-height:40px;padding:var(--s2) var(--s4) var(--s2) var(--s3)}
  .collapse-body{padding:0 var(--s4) var(--s4)}
  .profile-avatar{width:48px;height:48px;font-size:18px;box-shadow:0 0 0 3px var(--bg)}
  .profile-avatar-camera{width:20px;height:20px;border-width:2px}
  .profile-card strong{font-size:15px}
  .profile-card small{font-size:12px}
  .admin-avatar{width:32px;height:32px}
  .inbox-preview{grid-template-columns:repeat(4,minmax(0,88px));gap:var(--s1)}
  .inbox-preview img,.inbox-preview span{border-radius:6px}
  .onboarding .hero-title{font-size:20px}
  .onboarding-art{width:96px}
  .feature-row{gap:var(--s3)}

  /* ---------- Photo grids ---------- */
  .thumbs{grid-template-columns:repeat(auto-fill,minmax(112px,1fr));gap:var(--s2)}
  .thumbs.compact,.image-grid{grid-template-columns:repeat(auto-fill,minmax(88px,1fr));gap:var(--s2)}
  .thumb,.image-tile{border-radius:6px}
  .thumb{border-width:2px}
  .thumb .num{left:4px;top:4px;min-width:20px;height:20px;padding:0 var(--s2);border-radius:10px;font-size:12px;line-height:20px}
  .thumb .check{right:4px;top:4px;width:20px;height:20px;font-size:12px}
  .thumb .group-tag{right:4px;bottom:4px;padding:2px var(--s2);border-radius:6px;font-size:12px}
  .reorder-handle{width:28px;height:28px}
  .reorder-handle .grip{width:22px;height:22px}
  .reorder-handle .grip::before,.reorder-handle .grip::after{width:4px;height:4px;margin-left:-2px}
  .reorder-handle .grip::before{top:calc(50% - 5px)}
  .reorder-handle .grip::after{top:calc(50% + 1px)}
  .course-managed{padding-bottom:36px}
  .pdf-order-thumb .pdf-order-hint{width:24px;height:20px;border-radius:6px}
  .reorder-hint{font-size:12px}
  .files-image-heading .ico{width:16px;height:16px}

  /* ---------- Notebook (the old session view) ---------- */
  .notebook-block{border-radius:6px}
  .ink-toolbar{gap:var(--s2);padding:var(--s2);border:1px solid var(--line);border-radius:6px;background:var(--surface);box-shadow:var(--shadow-lg);backdrop-filter:none;-webkit-backdrop-filter:none}
  .ink-tool{width:28px;height:28px;border-radius:6px}
  .ink-tool.active{background:var(--accent);color:#fff}
  .ink-tool.ink-size.active{background:var(--hover);color:var(--ink)}
  .ink-sep{height:16px}
  .ink-swatch{width:16px;height:16px}

  /* ---------- Sheets, messages ---------- */
  .sheet{align-items:center;background:rgba(0,0,0,.28)}
  .sheet-card{max-width:400px;max-height:80dvh;padding:var(--s4);border:1px solid var(--line);border-radius:6px}
  .sheet-handle{display:none}
  .sheet-title{margin:0 0 var(--s1);font-size:15px;letter-spacing:-.01em}
  .sheet-sub{margin:0 0 var(--s3);font-size:12px}
  .sheet-list{gap:2px}
  .sheet-row{min-height:32px;gap:var(--s3);padding:0 var(--s3);border-radius:6px;font-size:13px}
  .sheet-row:active{background:var(--hover)}
  .sheet-actions{gap:var(--s2);margin-top:var(--s3)}
  .toast,.undo-bar,.offline-banner{border-radius:6px;font-size:13px}
  .toast{bottom:var(--s6);max-width:min(88%,480px);padding:var(--s3) var(--s4)}
  .offline-banner{padding:var(--s2) var(--s4);font-size:12px}
  .undo-bar{gap:var(--s4);padding:var(--s2) var(--s2) var(--s2) var(--s4);background:var(--ink)}
  .undo-bar button{min-height:28px;padding:0 var(--s4);border-radius:6px}
  /* The messages sit over the page, beside the sidebar (not over the middle of the whole window). */
  body:has(.app-shell:not(.hidden-chrome):not(.desk-side-closed)) :is(.toast,.offline-banner){left:calc(50% + var(--rail-w)/2)}
  body:has(.app-shell:not(.hidden-chrome):not(.desk-side-closed)){--float-shift:calc(var(--rail-w)/2)}

  /* ---------- Viewers and editors: toolbars 40px, buttons 28px ---------- */
  .viewer-topbar,.pdf-viewer .page-header,.srv-top,.pe-top{min-height:40px}
  .viewer-topbar,.pdf-viewer .page-header,.srv-top{padding-top:calc(var(--s1) + env(safe-area-inset-top));padding-bottom:var(--s1)}
  /* The photo fits its stage (a percentage max-height doesn't resolve in an auto-sized grid row, so tall photos overflowed and were cropped). */
  .viewer-stage{grid-template:minmax(0,1fr)/minmax(0,1fr)}
  .viewer-stage img{min-width:0;min-height:0}
  /* Sign-in and set-up: a centred column instead of full-width fields and buttons. */
  .onboarding{max-width:440px;margin-left:auto;margin-right:auto}
  .media-viewer .glass-btn,.viewer-arrow,.pe-icon-btn,.srv-icon{width:28px;height:28px;border-radius:6px}
  .viewer-heading b,.viewer-title strong,.srv-title b{font-size:13px}
  .viewer-heading span,.viewer-title small,.srv-title small,.pe-counter,.pe-note{font-size:12px}
  .viewer-dock{gap:var(--s2);margin:var(--s3) var(--s4) calc(var(--s4) + env(safe-area-inset-bottom));padding:var(--s2);border:1px solid var(--line)}
  .viewer-dock.dark{border-color:rgba(255,255,255,.12)}
  .dock-btn{min-height:44px;gap:2px;border-radius:6px;font-size:12px}
  .dock-btn small{font-size:12px}
  .pdf-frame-wrap{border:1px solid var(--line);margin:0 var(--s4)}
  .pdf-pages{background:var(--line)}
  .pdf-page canvas{border-radius:2px}
  .pdf-fallback{border-radius:6px}
  .pe-text-btn,.srv-text-btn{min-width:28px;min-height:28px;padding:0 var(--s3);border-radius:6px;font-size:13px}
  .pe-done,.srv-done{min-height:28px;padding:0 var(--s4);border-radius:6px;font-size:13px}
  .pe-tools{padding:var(--s1);border-radius:6px}
  .pe-tools button{min-width:56px;min-height:40px;border-radius:6px}
  .pe-tools button small,.srv-bar-btn small{font-size:12px}
  .pe-chip,.pe-pill-btn{min-height:28px;padding:0 var(--s4);border-radius:6px;font-size:12px}
  .srv-bar-btn{min-width:48px;min-height:40px;border-radius:6px}

  /* ---------- Touch screens: text fields stay 16px so iPad Safari doesn't zoom in on focus ---------- */
  @media (pointer:coarse){
    .field input,.field select,.field textarea,.search-bar input,.ocr-text{font-size:16px}
    /* Finger: the 28px buttons keep their look, an invisible layer makes the touch target 40px tall
       (6px above and below, 2px each side: the gaps between buttons are 4px or more, so neighbours never overlap). */
    .chip,.link-btn,.ink-tool,.srv-icon,.srv-text-btn,.srv-done,.pe-icon-btn,.pe-text-btn,.pe-done,.pe-chip,.pe-pill-btn,.media-viewer .glass-btn{position:relative}
    .avatar-btn{overflow:visible}
    .avatar-btn .avatar-image{border-radius:50%}
    .icon-btn::after,.avatar-btn::after,.chip::after,.link-btn::after,.ink-tool::after,.reorder-handle::after,.srv-icon::after,.srv-text-btn::after,.srv-done::after,.pe-icon-btn::after,.pe-text-btn::after,.pe-done::after,.pe-chip::after,.pe-pill-btn::after,.media-viewer .glass-btn::after,.viewer-arrow::after{content:"";position:absolute;inset:-6px -2px}
    .icon-btn::after,.media-viewer .glass-btn::after{inset:-7px -3px}   /* these have a 1px border: the offset starts inside it */
    .chips{margin-top:-4px;margin-bottom:-4px;padding-top:6px;padding-bottom:8px}   /* room for the layer inside the scrolling row, same layout height */
  }

  /* ---------- Hover (mouse only) ---------- */
  @media (hover:hover){
    .nav-item:not(.nav-capture):not(.active):hover,.icon-btn:hover,.chip:not(.active):hover,.list-card:hover,.course-card:hover,.category-card:hover,.collection-card:hover,.folder-card:hover,.sheet-row:hover,.link-btn:hover{background-image:linear-gradient(var(--hover),var(--hover))}
    .action-btn:hover,.hero-cta:hover{opacity:.9}
  }
}

