/* Selective V2 page layout. Load after tokens.css and components/bundle.css. Mobile first; 640px and 1024px are bp-md and bp-lg. */

/* the app shell: sidebar beside one page */
.sel-shell{display:flex;flex-direction:column;min-height:100vh}
.sel-shell>.sel-side{display:none}
.sel-shell>.sel-page{flex:1 1 auto}
@media (min-width:1024px){
  .sel-shell{flex-direction:row}
  .sel-shell>.sel-side{display:flex;position:sticky;top:0;height:100vh;overflow-y:auto}
  /* toasts sit at the bottom left of the page, not over the sidebar's Settings and Lock */
  .sel-shell~.sel-toasts{left:calc(var(--sidebar-width,248px) + 24px)}
}

/* the phone shell (below 1024px): a bar on top, and the sidebar opens as a full screen under it.
   The bar holds the mark and the page title with its emerald full stop on the left and the menu button on the right.
   A page about one thing (a bot's chat) puts its letter tile, name and state in the bar instead of the mark and title. */
.sel-pbar{display:none}
@media (max-width:1023.98px){
  .sel-shell{--pbar-h:calc(56px + env(safe-area-inset-top,0px))}
  .sel-pbar{display:flex;align-items:center;gap:12px;position:sticky;top:0;z-index:40;height:var(--pbar-h);box-sizing:border-box;padding:env(safe-area-inset-top,0px) 6px 0 16px;background:var(--paper);border-bottom:1px solid var(--line)}
  .sel-pbar>.sel-logo{flex:none;height:24px;width:auto}
  .sel-pbar-title{flex:1 1 auto;min-width:0;margin:0;font:var(--text-title,700 28px/36px var(--font-sans,"Instrument Sans",system-ui,sans-serif));font-size:22px;line-height:28px;letter-spacing:-.02em;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
  .sel-pbar-title .sel-stop{width:.2em;height:.2em;margin-left:.04em}
  .sel-pbar>.sel-data{flex:none}
  .sel-pbar-end{flex:none;margin-left:auto;display:flex;align-items:center}
  .sel-pbar .sel-iconbtn{width:44px;height:44px}
  /* the page title lives in the bar, so the page's own heading goes; its actions stay */
  .sel-pbar~.sel-page .sel-page-head>div:first-child{display:none}
  .sel-pbar~.sel-page .sel-page-head{justify-content:flex-end;align-items:center}
  .sel-pbar~.sel-page .sel-page-head:not(:has(.sel-page-actions>*)){display:none}
  .sel-pbar~.sel-page .sel-page-head-thing{justify-content:flex-start}
  .sel-pbar~.sel-page .sel-page-head-thing>.sel-who{display:none}
  .sel-pbar~.sel-page .sel-page-head-thing .sel-page-actions{margin-left:auto}
  .sel-pbar~.sel-page .sel-page-head-bar{display:none}
  /* the open menu: the whole sidebar as a screen below the bar, which stays */
  .sel-shell[data-menu]>.sel-side{display:flex;position:fixed;z-index:39;top:var(--pbar-h);left:0;right:0;bottom:0;overflow-y:auto;padding:8px 0 calc(16px + env(safe-area-inset-bottom,0px));background:var(--paper-sunken);overscroll-behavior:contain}
  .sel-shell[data-menu]>.sel-side>.sel-side-logo{display:none}
  .sel-shell[data-menu]>.sel-side .sel-nav{height:56px;padding:0 20px;font-size:17px}
  .sel-shell[data-menu]>.sel-side .sel-nav-sub{height:48px;padding-left:48px;font-size:15px}
  .sel-shell[data-menu]>.sel-side .sel-nav-close{width:44px;height:44px;margin-right:8px}
  .sel-shell[data-menu]>.sel-side>.sel-btn{margin:12px 20px 0}
  html:has(.sel-shell[data-menu]){overflow:hidden}
  /* touch: controls reach 44px, pages keep clear of the home indicator, inputs stay at 16px so the phone does not zoom */
  .sel-pbar~.sel-page{padding-bottom:calc(var(--space-7,48px) + env(safe-area-inset-bottom,0px))}
  .sel-shell .sel-composer-input,.sel-shell .sel-field input,.sel-shell .sel-field textarea,.sel-shell .sel-field select{font-size:16px}
  .sel-shell .sel-action{min-height:32px}
  /* a dialog becomes a sheet from the bottom edge */
  .sel-scrim{align-items:flex-end;padding:0}
  .sel-dialog{max-width:none;max-height:86dvh;padding-bottom:calc(14px + env(safe-area-inset-bottom,0px));border-width:1px 0 0}
}

/* a page: header, then frames 40px apart */
.sel-page{display:flex;flex-direction:column;gap:var(--frame-gap,40px);min-width:0;padding:var(--space-5,24px) var(--space-4,16px) var(--space-7,48px)}
.sel-page-head{display:flex;justify-content:space-between;align-items:flex-end;gap:var(--space-5,24px);flex-wrap:wrap}
.sel-page-head>div:first-child{display:flex;flex-direction:column;min-width:0}
.sel-page-head h1{font:var(--text-display,700 40px/48px var(--font-sans,"Instrument Sans",system-ui,sans-serif));letter-spacing:-.03em}
.sel-page-actions{display:flex;align-items:center;gap:var(--space-3,12px);flex-wrap:wrap}
.sel-page-links{display:flex;align-items:center;gap:20px;margin-right:var(--space-2,8px);font:var(--text-body-small,400 14px/20px var(--font-sans,"Instrument Sans",system-ui,sans-serif));line-height:24px}
.sel-page-links a{display:inline-flex;align-items:center;gap:var(--space-2,8px)}
/* a page about one thing (a bot's chat, a file): back, letter tile, name, state */
.sel-page-head-thing{align-items:center;justify-content:flex-start;gap:20px}
.sel-page-head-thing>.sel-who{display:flex;flex-direction:row;align-items:center;gap:14px;flex:1 1 auto;min-width:0}
.sel-page-head-thing h1{display:flex;align-items:center;gap:12px;font:var(--text-title,700 28px/36px var(--font-sans,"Instrument Sans",system-ui,sans-serif));letter-spacing:-.02em}
@media (min-width:640px){.sel-page{padding:var(--space-6,32px) var(--space-5,24px) var(--space-7,48px)}}
@media (min-width:1024px){.sel-page{padding:var(--space-7,48px)}}

/* grids of frames: 40px between rows, 32px between columns */
.sel-grid{display:grid;grid-template-columns:minmax(0,1fr);gap:var(--frame-gap,40px) var(--space-6,32px);align-items:start}
.sel-stack{display:flex;flex-direction:column;gap:var(--frame-gap,40px);min-width:0}
.sel-stack-tight{gap:20px}
@media (min-width:640px){
  .sel-grid-3{grid-template-columns:repeat(2,minmax(0,1fr))}
}
@media (min-width:1024px){
  .sel-grid{grid-template-columns:repeat(12,minmax(0,1fr))}
  .sel-grid>*{grid-column:span 12}
  .sel-grid>.sel-col-4{grid-column:span 4}.sel-grid>.sel-col-5{grid-column:span 5}.sel-grid>.sel-col-6{grid-column:span 6}
  .sel-grid>.sel-col-7{grid-column:span 7}.sel-grid>.sel-col-8{grid-column:span 8}
  .sel-grid-3{grid-template-columns:repeat(3,minmax(0,1fr))}
  .sel-grid-3>*{grid-column:auto}
  .sel-grid-main{grid-template-columns:minmax(0,2fr) minmax(0,1fr)}
  .sel-grid-main>*{grid-column:auto}
  .sel-grid-main>.sel-wide{grid-column:1/-1}
}
/* frames in one grid row end on the same line, footers at the bottom */
.sel-grid-3{align-items:stretch}
.sel-grid-3>.sel-frame{display:flex;flex-direction:column}
.sel-grid-3>.sel-frame>.sel-frame-body{flex:1 1 auto}

/* a single-task page (one-time link, sign-in): logo on top, one column in the middle, no sidebar */
.sel-solo{min-height:100vh;display:flex;flex-direction:column}
.sel-solo>header{padding:var(--space-5,24px) var(--space-4,16px)}
.sel-solo>main{flex:1 1 auto;display:flex;justify-content:center;padding:var(--space-6,32px) var(--space-4,16px) var(--space-8,64px)}
.sel-solo-col{width:100%;max-width:560px;display:flex;flex-direction:column;gap:var(--frame-gap,40px)}
.sel-solo-col h1{font:var(--text-display,700 40px/48px var(--font-sans,"Instrument Sans",system-ui,sans-serif));letter-spacing:-.03em}
.sel-solo-col>.sel-intro{display:flex;flex-direction:column;gap:var(--space-4,16px)}
.sel-solo-col>.sel-intro p{max-width:60ch;color:var(--ink-muted)}
@media (min-width:1024px){.sel-solo>header{padding:var(--space-6,32px) var(--space-7,48px)}.sel-solo>main{padding-top:56px}}

.sel-measure{max-width:var(--measure,65ch)}
.sel-scroll-x{overflow-x:auto}
