/* phone.css - Content Studio on phones (under 861px) + touch-only bits.
   Loaded LAST, after theme-v2.css. Every layout rule here sits inside the
   phone media query, so desktop and laptop screens are not affected.
   Shell rules: keep the existing 100dvh shell with one inner scroller and put
   the tab bar in normal flow (NOT position:fixed) - see the July 2026 Alcyone
   note in CLAUDE.md about fixed bottom bars + 100vh on phones. */

/* Phone-only pieces are hidden everywhere else. */
.cs-tabs,.rp-mtabs{display:none}

/* ---- "Add photo" (cc.js photoButton, touch devices only) ---- */
.cc-upbtn{position:relative;display:inline-flex;align-items:center;gap:8px;margin-top:10px;min-height:44px;padding:0 16px;border-radius:12px;border:1.5px dashed var(--border);background:var(--card2);color:var(--text);font:600 15px var(--font);cursor:pointer;-webkit-tap-highlight-color:transparent}
.cc-upbtn span{display:inline-flex}
.cc-upbtn svg{width:20px;height:20px}
.cc-upbtn.busy{opacity:.7;pointer-events:none}
.cc-upin{position:absolute;width:1px;height:1px;opacity:0;pointer-events:none;overflow:hidden}
@media (pointer:coarse){
  .cc-attx{width:34px;height:34px;opacity:1}
  .cc-attx svg{width:16px;height:16px}
}

@media (max-width:860px){
  /* ---- Shell: bottom tab bar instead of the hamburger ---- */
  .cs-menu{display:none !important}
  .cs-top{padding:0 12px;height:52px}
  .cs-top .t{font-size:17px}
  .cs-tabs{display:flex;flex-shrink:0;border-top:1px solid var(--border);background:var(--card);padding:4px 4px calc(4px + env(safe-area-inset-bottom))}
  .cs-tab{flex:1;min-width:0;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:3px;min-height:50px;border:none;background:none;color:var(--text3);font:600 10.5px var(--font);position:relative;border-radius:10px;cursor:pointer;-webkit-tap-highlight-color:transparent}
  .cs-tab>span:not(.at-badge){display:inline-flex}
  .cs-tab svg{width:22px;height:22px}
  .cs-tab.on{color:var(--accent)}
  .cs-tab .at-badge{position:absolute;top:2px;left:calc(50% + 5px);background:#d72545;color:#fff;border-radius:999px;font-size:10px;font-weight:700;line-height:15px;padding:0 5px;display:none}
  .cs-side{width:min(300px,86vw)}

  /* ---- iPhone zooms the page into any field under 16px: never let it ---- */
  input:not([type=checkbox]):not([type=radio]):not([type=range]),select,textarea{font-size:16px !important}

  /* ---- Bigger touch targets ---- */
  .cs-item{padding:11px 10px;font-size:15px}
  .cs-item svg{width:18px;height:18px}
  .cc-opt{min-height:44px;display:flex;align-items:center}
  .btn-sm{min-height:40px}
  .rp-arrow{width:40px;height:40px}
  .rp-btn{padding:11px 16px;font-size:14px}
  .cc-chipq{height:36px}
  .cc-editpage,.rp-editlayout{display:none !important}

  /* ---- Dropdowns slide up from the bottom (sheets) ---- */
  .cc-pop,.ap-pop{position:fixed !important;left:0 !important;right:0 !important;top:auto !important;bottom:0 !important;width:auto !important;min-width:0 !important;max-width:none !important;max-height:75vh !important;max-height:75dvh !important;border-radius:18px 18px 0 0 !important;padding:6px 12px calc(14px + env(safe-area-inset-bottom)) !important;box-shadow:0 0 0 100vmax rgba(0,0,0,.35),0 -8px 30px rgba(0,0,0,.2) !important;animation:csSheetUp .2s ease-out}
  .cc-pop::before,.ap-pop::before{content:"";display:block;width:38px;height:5px;border-radius:3px;background:var(--border);margin:4px auto 8px}
  @keyframes csSheetUp{from{transform:translateY(40px);opacity:.4}to{transform:none;opacity:1}}

  /* ---- Dialogs become sheets too ---- */
  .cs-ov{padding:0 !important;align-items:flex-end !important}
  .cs-dialog{width:100% !important;max-width:none !important;border-radius:18px 18px 0 0 !important;max-height:92dvh;overflow:auto;padding-bottom:calc(18px + env(safe-area-inset-bottom)) !important}
  .ai-ov{padding:0 !important;align-items:flex-end !important}
  .ai-dlg{width:100% !important;border-radius:18px 18px 0 0 !important;max-height:94dvh !important;padding-bottom:calc(16px + env(safe-area-inset-bottom)) !important}

  /* ---- Toasts, Undo bars and the AI pill sit above the tab bar ---- */
  #cs-toasts{bottom:calc(76px + env(safe-area-inset-bottom))}
  .cc-undo,.at-snack{bottom:calc(76px + env(safe-area-inset-bottom)) !important;max-width:calc(100vw - 24px)}
  .ai-float{left:12px;right:12px;bottom:calc(76px + env(safe-area-inset-bottom))}

  /* ---- Demo notice: one line, tap to read it all ---- */
  html[data-ui="v2"] #cc-root .cc-banner{align-items:center;padding:6px 10px;margin-bottom:10px;cursor:pointer}
  #cc-root .cc-banner>div{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;min-width:0}
  #cc-root .cc-banner.open{align-items:flex-start}
  #cc-root .cc-banner.open>div{white-space:normal}

  /* ---- Content toolbar: search + ... + Add on top, view + filters below
     as one full-width row that scrolls sideways ---- */
  html[data-ui="v2"] .cc-bar2{flex-wrap:wrap;row-gap:8px}
  html[data-ui="v2"] .cc-br{order:1;width:100%}
  html[data-ui="v2"] .cc-br .cc-search{flex:1;width:auto;min-width:0;order:0}
  html[data-ui="v2"] .cc-bl{order:2;flex:1 1 100%}

  /* ---- Phase 2: one Filters button instead of a row of filter chips ---- */
  .cc-bl .cc-chipq:not(.cc-viewq):not(.cc-fsheet),.cc-bl .cc-tb{display:none !important}
  html[data-ui="v2"] .cc-bl{-webkit-mask-image:none;mask-image:none}

  /* ---- Cards: two per row ---- */
  .cs-scroll .cc-gallery{grid-template-columns:repeat(2,minmax(0,1fr));gap:10px;height:calc(100dvh - 250px - env(safe-area-inset-bottom))}
  .cc-gallery .cc-cbody{padding:8px 9px 10px}
  .cc-gallery .cc-ctitle{font-size:13.5px;margin-bottom:4px}
  .cc-gallery .cc-cf{font-size:12px}

  /* ---- Calendar: a week as a list of days ---- */
  .cc-calhead .cc-scale,.cc-calhead>.btn:last-child,.cc-calside{display:none !important}
  .cc-calhead .cc-ib{width:40px;height:40px}
  .cc-agenda{padding:4px 0 !important;background:none !important;border:none !important}
  .cc-agday{margin-bottom:16px;gap:8px}
  .cc-agday .cc-agd{display:flex;align-items:center;justify-content:space-between;font-size:12.5px;padding:0 2px}
  .cc-agn{background:var(--card2);color:var(--text2);border-radius:999px;padding:1px 8px;font-size:11.5px}
  .cc-agnone{font-size:13px;color:var(--text3);padding:10px 12px;border:1px dashed var(--border);border-radius:12px}

  /* ---- Post rows (calendar day list + Today) ---- */
  .cc-agcard{display:flex;gap:12px;align-items:center;background:var(--card);border:1px solid var(--border2);border-radius:14px;padding:8px;cursor:pointer;-webkit-tap-highlight-color:transparent}
  .cc-agcard:active{transform:scale(.99)}
  .cc-agcard img,.cc-agph{width:56px;height:70px;border-radius:9px;object-fit:cover;flex-shrink:0;background:var(--card2)}
  .cc-agph{display:flex;align-items:center;justify-content:center;color:var(--text3)}
  .cc-agph svg{width:20px;height:20px}
  .cc-agt{min-width:0;flex:1;display:flex;flex-direction:column;gap:3px}
  .cc-agt1{font-weight:700;font-size:14.5px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
  .cc-agt2{font-size:12.5px;color:var(--text3);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
  .cc-agt3{display:flex;flex-wrap:wrap;align-items:center;gap:6px}
  .td-miss{font-size:11.5px;font-weight:600;color:#d72545}

  /* ---- Today ---- */
  .td{padding:2px 0 24px}
  .td-hello{margin:4px 2px 14px}
  .td-hello h2{font:800 22px var(--title,var(--font));letter-spacing:-.3px}
  .td-hello div{font-size:13.5px;color:var(--text3);margin-top:2px}
  .td-need{display:flex;align-items:center;gap:12px;width:100%;text-align:left;border:none;border-radius:16px;padding:12px 14px;margin-bottom:16px;background:rgba(215,37,69,.1);color:var(--text);cursor:pointer;font-family:var(--font)}
  .td-needn{min-width:40px;height:40px;border-radius:12px;background:#d72545;color:#fff;font:800 18px var(--font);display:flex;align-items:center;justify-content:center;padding:0 8px}
  .td-needt{flex:1;min-width:0;display:flex;flex-direction:column;gap:2px;font-size:12.5px;color:var(--text2)}
  .td-needt b{font-size:15px;color:var(--text)}
  .td-need>span:last-child svg,.td-need svg{width:18px;height:18px;color:var(--text3)}
  .td-sec{margin-bottom:18px;display:flex;flex-direction:column;gap:8px}
  .td-h{display:flex;align-items:baseline;justify-content:space-between;gap:10px;padding:0 2px}
  .td-h h3{font:800 17px var(--title,var(--font))}
  .td-h span{font-size:12.5px;color:var(--text3)}
  .td-day{font-size:12px;font-weight:700;color:var(--text3);text-transform:uppercase;letter-spacing:.3px;margin:6px 2px 0}
  .td-fold{display:flex;flex-direction:column;gap:8px}
  .td-more{align-self:flex-start;min-height:36px;padding:0 14px;border:1px solid var(--border);border-radius:999px;background:var(--card);color:var(--text2);font:600 13px var(--font);cursor:pointer}
  .td-none{font-size:13.5px;color:var(--text3);padding:12px;border:1px dashed var(--border);border-radius:12px}
  .td-notif{display:flex;gap:10px;align-items:flex-start;background:var(--card);border:1px solid var(--border2);border-radius:14px;padding:10px 12px;cursor:pointer}
  .td-nh{font-size:14px;font-weight:600}
  .td-nc{font-size:13px;color:var(--text3);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
  .td-cal{width:100%;min-height:44px;border:1px solid var(--border);border-radius:12px;background:var(--card);color:var(--text);font:600 14.5px var(--font);cursor:pointer;margin-top:4px}
  .td-asof{font-size:11.5px;color:var(--text3);text-align:center;margin-top:10px}

  /* ---- Client approval page (studio/approvals.js) ---- */
  .ap-grid{grid-template-columns:repeat(2,minmax(0,1fr)) !important;gap:10px}
  .ap-sum{padding:12px 14px;gap:10px}
  .ap-sumh{font-size:18px}
  .ap-stats{width:100%}
  .ap-stat{flex:1;flex-direction:column;align-items:center;gap:0;padding:6px 4px;text-align:center;font-size:11.5px}
  .ap-statm{display:none}
  .ap-stabs{flex-wrap:nowrap;overflow-x:auto;scrollbar-width:none;padding:2px}
  .ap-stabs::-webkit-scrollbar{display:none}
  .ap-stab{flex:1 0 auto;min-width:68px;padding:6px 8px}
  .ap-selbar{position:fixed;left:12px;right:12px;bottom:calc(12px + env(safe-area-inset-bottom));width:auto;margin:0}
  .ap-selbar .ap-btn{flex:1}
  .ap-head .ap-notifbtn{order:-1}

  /* ---- Post page ---- */
  .rp-nav{padding:6px 8px;gap:2px;padding-top:max(6px,env(safe-area-inset-top))}
  .rp-back{font-size:0;padding:8px}
  .rp-back svg{width:20px;height:20px}
  .rp-back::after{content:"Back";font:600 15px var(--font);margin-left:2px}
  .rp-pos{display:none}
  .rp-mtabs{display:flex;gap:4px;padding:6px 10px;background:var(--card);border-bottom:1px solid var(--border);flex-shrink:0}
  .rp-mtabs button{flex:1;min-height:38px;border:none;border-radius:10px;background:transparent;color:var(--text2);font:700 14px var(--font);cursor:pointer}
  .rp-mtabs button.on{background:var(--al);color:var(--accent)}
  .rp-page.mconv .rp-scroll{display:none}
  .rp-page:not(.mconv) .rp-body>.rp-conv{display:none}
  .rp-page.mconv .rp-body{overflow:hidden}
  .rp-page.mconv .rp-conv{flex:1;min-height:0;border-top:none}
  .rp-main{padding:0 14px 40px}
  .rp-title{font-size:19px}
  .rp-head{flex-wrap:wrap}
  html[data-ui="v2"] .rp-head{margin:0 -14px 12px;padding:10px 14px}
  /* Photos swipe sideways, big enough to judge */
  .rp-page .cc-atts{flex-wrap:nowrap;overflow-x:auto;scroll-snap-type:x mandatory;-webkit-overflow-scrolling:touch;padding-bottom:6px}
  .rp-page .cc-att{flex:0 0 62%;width:auto;scroll-snap-align:start}
  .rp-page .cc-att img,.rp-page .cc-att .cc-afile{height:auto;aspect-ratio:4/5}
  .rp-page .cc-atts>.cc-note{display:none}
}

/* Client approval post detail in phone mode (approvals.js adds .ap-phone /
   renders these parts only when isPhone()). NOT inside the media query on
   purpose: the layout must follow the same switch as the code, or a
   761-860px window got the phone buttons in a desktop layout (25 Oct 2026). */
.ap-ov.ap-ovphone{padding:0}
.ap-modal.ap-phone{border-radius:0;width:100%}
.ap-phone .ap-mbody{flex-direction:column}
.ap-modal.ap-phone{display:flex;flex-direction:column;height:100%;max-height:none}
.ap-phone .ap-mhead{padding-top:max(8px,env(safe-area-inset-top))}
.ap-phone .ap-mhead .ap-iconbtn{width:40px;height:40px}
.ap-phone .ap-mbody{flex:1;min-height:0;overflow:auto;-webkit-overflow-scrolling:touch}
.ap-phone .ap-mleft{flex:none}
.ap-phone .ap-mright{flex:none;overflow:visible;padding:14px 16px 18px}
.ap-phone .ap-cap{max-height:none}
.ap-phone .ap-media{min-height:0;max-height:none}
.ap-swipe{display:block;position:relative}
.ap-strip{display:flex;overflow-x:auto;scroll-snap-type:x mandatory;-webkit-overflow-scrolling:touch;scrollbar-width:none}
.ap-strip::-webkit-scrollbar{display:none}
.ap-slide{flex:0 0 100%;scroll-snap-align:center;display:flex;align-items:center;justify-content:center;min-height:260px;max-height:62vh}
.ap-slide img{max-width:100%;max-height:62vh;object-fit:contain}
.ap-swipe .ap-n{position:absolute}
.ap-mfoot{flex-shrink:0;border-top:1px solid var(--border);background:var(--card);padding:10px 12px calc(10px + env(safe-area-inset-bottom))}
.ap-mfoot .ap-acts{flex-wrap:nowrap}
.ap-mfoot .ap-btn{flex:1;min-height:48px;font-size:15px}
.ap-nextp{margin-top:8px;width:100%;min-height:44px}
.ap-phone .ap-framewrap{padding:0 0 10px}
.ap-phone .ap-frame{border-radius:0;box-shadow:none;width:100%}
.ap-phone .ap-mleft.framed .ap-swipe{background:#000}
.ap-agenda{display:flex;flex-direction:column;gap:8px;padding:4px 0}
.ap-agd{font-size:12.5px;font-weight:700;color:var(--text3);text-transform:uppercase;letter-spacing:.3px;margin:8px 2px 0}
.ap-agd.today{color:var(--accent)}
.ap-agrow{display:flex;gap:12px;align-items:center;text-align:left;width:100%;background:var(--card);border:1px solid var(--border2);border-radius:14px;padding:8px;cursor:pointer;color:var(--text);font-family:var(--font)}
.ap-agrow img,.ap-agph{width:56px;height:70px;border-radius:9px;object-fit:cover;flex-shrink:0;background:var(--card2);display:flex;align-items:center;justify-content:center;color:var(--text3)}
.ap-agt{min-width:0;flex:1;display:flex;flex-direction:column;gap:3px}
.ap-agt1{font-weight:700;font-size:14.5px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.ap-agt2{font-size:12.5px;color:var(--text3)}
