/* SurveyTrack — tablet & landscape layout
   Phones keep the original single-column layout (nothing here applies under 600px).
   - 600–899px wide (tablet portrait): the same layout in a wider, centred column.
   - 900px and up (tablet landscape / small laptop): side navigation rail, full-width content,
     two-column lists, and detail/forms shown as centred dialogs instead of bottom sheets.
   Loaded AFTER each page's own <style>, so these rules override the phone defaults. */

/* ================= Tablet portrait ================= */
@media (min-width:600px) and (max-width:899px){
  #app{max-width:720px}
  .bottom-nav{max-width:720px}
  .sheet{max-width:640px}
  .view{padding-left:24px;padding-right:24px}
  .empty-card{max-width:420px}
  .card{max-width:420px}
}

/* ================= Tablet landscape ================= */
@media (min-width:900px){
  :root{--rail-w:96px}

  /* ---- page frame: content sits to the right of the nav rail ---- */
  #app{max-width:none;margin:0;padding-left:var(--rail-w)}
  .topbar{padding-left:28px;padding-right:28px}
  .view{width:100%;max-width:1240px;margin:0 auto;padding:26px 32px 48px}

  /* ---- bottom nav becomes a left rail ---- */
  .bottom-nav{
    top:0;bottom:0;left:0;right:auto;width:var(--rail-w);max-width:none;margin:0;
    flex-direction:column;justify-content:flex-start;align-items:stretch;
    border-top:0;border-right:1px solid var(--gray-2);
    box-shadow:2px 0 14px rgba(14,42,71,.06);
    padding:12px 0 calc(12px + env(safe-area-inset-bottom,0px));
    padding-top:calc(12px + env(safe-area-inset-top,0px));
    overflow-y:auto;
  }
  .nav-btn{flex:none;padding:14px 6px 12px;gap:5px;font-size:11.5px;position:relative}
  .nav-btn svg{width:24px;height:24px}
  .nav-btn.active::before{content:'';position:absolute;left:0;top:10px;bottom:10px;width:4px;border-radius:0 4px 4px 0;background:var(--gold)}

  /* the docked "+" button sits inline in the rail instead of floating above a bottom bar */
  .nav-spacer{flex:none;display:flex;justify-content:center;padding:10px 0}
  .fab{position:static;transform:none;left:auto;top:auto;border-width:0;width:56px;height:56px}
  .fab:active{transform:scale(.93)}
  .nav-fab-slot{flex:none;padding:10px 4px}
  .nav-fab{margin-top:0;border-width:0}

  /* the Add menu opens to the right of the rail */
  .fab-menu{left:calc(var(--rail-w) + 16px);bottom:auto;top:150px;transform:none;align-items:flex-start}

  /* ---- lists: two columns (three on wide screens) ---- */
  #lotsWrap,#qrListWrap,#staffList,#payWrap{
    display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px;align-items:stretch;
  }
  #lotsWrap>*,#qrListWrap>*,#staffList>*,#payWrap>*{margin-bottom:0}
  #lotsWrap>.empty,#qrListWrap>.empty,#staffList>.empty,#payWrap>.empty{grid-column:1/-1}
  .day-group{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px;align-items:stretch;margin-bottom:10px}
  .day-group>h4{grid-column:1/-1;margin:18px 0 0}
  .day-group>.sw-wrap,.day-group>.sched-card{margin-bottom:0}
  .day-group:first-child>h4{margin-top:0}
  .sw-hint{margin-bottom:6px}
  .search-row,.status-filter-row{max-width:640px}
  .lot-card:hover,.sched-card:hover,.qr-list-item:hover{border-color:var(--gold)}

  /* ---- dashboard hero + tiles use the extra width ---- */
  .hero-card{min-height:170px;padding:24px 28px}
  .hero-name{font-size:26px}
  .hero-mascot{height:190px}
  .stat-grid{gap:12px}
  .stat-card{padding:14px 8px 12px}
  .stat-card .num{font-size:24px}
  .stat-card .lbl{font-size:11.5px}

  /* the case-file page used to widen the phone column to 1040px; with the rail it uses the full width instead */
  html body.cf-wide #app{max-width:none}
  html body.cf-wide .bottom-nav{max-width:none}

  /* ---- "More" / settings: centred, readable width ---- */
  #view-more,#view-staff{max-width:760px}

  /* ---- detail sheets & forms become centred dialogs ---- */
  .sheet{
    left:50%;right:auto;top:50%;bottom:auto;margin:0;
    width:min(760px,calc(100vw - 180px));max-width:none;max-height:88vh;
    border-radius:22px;padding-bottom:26px;
    transform:translate(-50%,-47%) scale(.98);opacity:0;visibility:hidden;pointer-events:none;
    transition:transform .22s cubic-bezier(.2,.8,.2,1),opacity .18s ease,visibility 0s linear .22s;
    box-shadow:0 24px 70px rgba(8,22,39,.4);
  }
  .sheet.active{transform:translate(-50%,-50%);opacity:1;visibility:visible;pointer-events:auto;transition-delay:0s}
  .sheet-handle{display:none}
  .sheet-head{padding:22px 26px 16px}
  .sheet-body{padding:20px 26px}
  .field-row{gap:14px}
  .st-dlg{max-width:480px}

  /* ---- login ---- */
  .card{max-width:420px;padding:36px 32px 32px}

  /* ---- public client status page (opened from the QR code) ---- */
  #app .public-wrap{max-width:none}
  .public-card{max-width:640px;margin:6px auto 24px;padding:30px 32px}
  .public-head{padding-top:40px}
  .public-prop{font-size:24px}
  .empty-card{max-width:440px}
}

/* wide tablets / small laptops: three-column lists */
@media (min-width:1280px){
  #lotsWrap,#qrListWrap,#staffList,#payWrap{grid-template-columns:repeat(3,minmax(0,1fr))}
  .day-group{grid-template-columns:repeat(3,minmax(0,1fr))}
}

/* the status page is not inside a role app: no rail padding there */
@media (min-width:600px){
  #app:has(> .public-wrap){max-width:none;padding-left:0}
}

/* keep landscape phones usable: bottom bar stays, but tighter */
@media (max-height:480px) and (max-width:899px){
  .nav-btn{padding-top:6px;padding-bottom:5px}
  .view{padding-bottom:78px}
}
