/* CONE SUPREME — layout refinement layer, November 2026.
   Keep colors, type, controls and component surfaces in cone-ds.css.
   This file only adjusts the app shell, page rhythm and responsive layout. */

/* App shell: a stable navigation rail with a flexible, overflow-safe work area. */
html { scroll-behavior: smooth; }
body { background-color: var(--ds-bg); }
::selection { background: var(--ds-accent-soft); color: var(--ds-text); }

.shell {
  grid-template-columns: 248px minmax(0, 1fr);
  min-width: 0;
  background:
    radial-gradient(ellipse 55% 42% at 90% 0%, rgba(255, 122, 26, .055), transparent 70%),
    var(--ds-bg);
}

/* The second grid child contains the top bar and routed page; constrain it against long content. */
.shell > :not(.side) { min-width: 0; }
.side {
  min-width: 0;
  padding: 18px 12px;
  background: rgba(13, 13, 16, .94);
  border-right: 1px solid var(--ds-line);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}
.side .brand { padding: 7px 10px 16px; margin-bottom: 8px; }
aside .os-nav { display: grid; gap: 4px; min-width: 0; }
aside .os-nav-sec > a {
  min-height: 44px;
  min-width: 0;
  padding: 8px 11px;
  border: 1px solid transparent;
  border-radius: 11px;
  transition: background-color .16s, border-color .16s, color .16s, transform .16s;
}
aside .os-nav-sec > a:hover {
  background: rgba(255, 255, 255, .045);
  border-color: var(--ds-line);
  transform: translateX(2px);
}
aside .os-nav-sec > a[aria-current="page"] {
  background: linear-gradient(100deg, rgba(255, 122, 26, .16), rgba(255, 122, 26, .045));
  border-color: rgba(255, 122, 26, .2);
  box-shadow: inset 3px 0 0 var(--ds-accent);
}
main.view { min-width: 0; }
.view-head { min-width: 0; }
.view-head > * { min-width: 0; }

/* Public home: preserve the landing page's structure while giving it a focused CONE backdrop. */
body.home {
  background:
    radial-gradient(ellipse 55% 34% at 80% 0%, rgba(255, 122, 26, .095), transparent 72%),
    var(--ds-bg);
}
.site-header {
  min-height: 68px;
  background: rgba(9, 9, 11, .88);
  border-bottom: 1px solid var(--ds-line);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}
.site-header .brand { color: var(--ds-text); }
.site-header .brand small { color: var(--ds-accent-2); }
.main-nav a { font-size: 13px; }
.hero { padding-block: clamp(52px, 7vw, 100px); }
body.home .hero h1 { max-width: 12ch; font-size: clamp(42px, 6vw, 78px); }
body.home .hero .lead { max-width: 58ch; line-height: 1.7; }
.try-card { border-radius: 22px; border-color: var(--ds-line-2); }
.goal, .lp-labs a, .lp-biz-grid a {
  border-color: var(--ds-line-2);
  border-radius: 16px;
  background: linear-gradient(145deg, var(--ds-surface-2), var(--ds-surface));
}
.goal:hover, .lp-labs a:hover, .lp-biz-grid a:hover {
  border-color: var(--ds-accent-line);
  box-shadow: var(--ds-shadow-2);
}
.band { padding-block: clamp(54px, 7vw, 88px); }
.site-footer { border-top-color: var(--ds-line); }

/* Tablet: keep the full navigation rail, but give the content its own minimum width. */
@media (min-width: 821px) and (max-width: 1100px) {
  .shell { grid-template-columns: 208px minmax(0, 1fr); }
  .side { display: flex; padding: 16px 10px; }
  .side .brand { padding-inline: 6px; }
  main.view { padding-inline: 22px; }
}

/* Phone: the app's existing bottom tab bar is the navigation; the page fills the width. */
@media (max-width: 820px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .side { display: none; }
  main.view {
    min-width: 0;
    padding: 20px 16px calc(112px + env(safe-area-inset-bottom));
  }
  .topbar { min-width: 0; gap: 10px; }
  .topbar > * { min-width: 0; }
  .chat { grid-template-columns: minmax(0, 1fr); min-width: 0; }
  .thread, .convs-wrap { min-width: 0; }
  .log, .msg { overflow-wrap: anywhere; }
  .composer { gap: 7px; }
  .composer textarea { min-width: 0; }
  .site-header { min-height: 64px; }
  .hero { padding-block: 44px 54px; }
  body.home .hero h1 { font-size: clamp(39px, 10vw, 58px); }
}
@media (max-width: 480px) {
  main.view { padding-inline: 13px; }
  .view-head { gap: 10px; }
  .quick { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .quick a { min-width: 0; }
  .quick small { white-space: normal; text-align: center; }
  .os-tool-grid { grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 1fr)); }
  .form-row { grid-template-columns: minmax(0, 1fr); }
  .money-table { display: block; overflow-x: auto; max-width: 100%; }
}
@media (hover: none) {
  aside .os-nav-sec > a:hover { transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  aside .os-nav-sec > a { transition: none; }
}

/* ---------- mobile-first usability pass ---------- */
/* Keep routed screens and long labels inside the viewport on narrow devices. */
.shell, .shell > :not(.side), .view, .view > *, .view .card,
.view .os-section, .view .os-grid, .view .grid { min-width: 0; }
.view :where(h1,h2,h3,p,a,button,label,small,strong,code) { overflow-wrap: anywhere; }
.view :where(img,video,canvas,svg) { max-width: 100%; }
.view :where(input,select,textarea) { max-width: 100%; }

/* Tablet and phone navigation: five predictable destinations, generous touch targets,
   a visible active state, and room for the iOS home indicator. */
@media (max-width: 820px) {
  html, body { max-width: 100%; overflow-x: clip; }
  .shell { width: 100%; min-height: 100dvh; }
  .shell > :not(.side) { width: 100%; }
  .topbar {
    min-height: 58px;
    padding: 7px 12px;
    padding-top: max(7px, env(safe-area-inset-top));
  }
  .topbar .top-title { flex: 1 1 auto; min-width: 0; }
  .topbar .topbar-actions { flex: 0 0 auto; gap: 2px; }
  .topbar .icon-btn { width: 42px; height: 42px; min-width: 42px; }
  .topbar .top-xp { display: none; }
  main.view {
    width: 100%;
    max-width: none;
    margin: 0;
    padding: 18px 16px calc(104px + env(safe-area-inset-bottom));
  }
  .os-tabbar {
    min-height: 62px;
    padding: 5px 8px calc(5px + env(safe-area-inset-bottom));
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    align-items: stretch;
    gap: 4px;
  }
  .os-tabbar a {
    min-width: 0;
    min-height: 48px;
    padding: 5px 2px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    border: 1px solid transparent;
    border-radius: 12px;
    font-size: 10px;
    line-height: 1.1;
    white-space: nowrap;
    -webkit-tap-highlight-color: transparent;
  }
  .os-tabbar a .ico { display: grid; place-items: center; width: 22px; height: 22px; font-size: 19px; }
  .os-tabbar a[aria-current="page"] {
    color: var(--ds-accent-2);
    background: var(--ds-accent-soft);
    border-color: var(--ds-accent-line);
    box-shadow: none;
  }
  .os-tabbar a[aria-current="page"] .ico { color: var(--ds-accent-2); }
  .view .view-head { align-items: flex-start; }
  .view .view-head h1 { font-size: clamp(23px, 6vw, 30px); line-height: 1.15; }
  .view .os-section-head { align-items: flex-start; }
  .view .os-grid, .view .grid { grid-template-columns: minmax(0, 1fr); }
  .view .chat { min-height: calc(100dvh - 190px); }
  .view .composer textarea { font-size: 16px; }
  .view :where(button,.btn,a.btn,input,select) { touch-action: manipulation; }
}

/* Small phones: avoid tiny form controls, squeezed cards and horizontal page scrolling. */
@media (max-width: 480px) {
  main.view { padding-inline: 13px; }
  .topbar { padding-inline: 9px; }
  .topbar .top-title { font-size: 14px; }
  .topbar .topbar-actions { gap: 0; }
  .topbar .icon-btn { width: 40px; height: 40px; min-width: 40px; }
  .os-tabbar { gap: 2px; padding-inline: 5px; }
  .os-tabbar a { font-size: 9px; border-radius: 10px; }
  .os-tabbar a .ico { width: 20px; height: 20px; }
  .view .card { padding: clamp(12px, 3.5vw, 16px); }
  .view .form-row { grid-template-columns: minmax(0, 1fr); }
  .view :where(input:not([type=checkbox]):not([type=radio]),select,textarea) {
    min-height: 44px;
    font-size: 16px;
  }
  .view :where(button,.btn) { min-height: 44px; }
  .view .money-table { display: block; width: 100%; overflow-x: auto; overscroll-behavior-x: contain; }
  .view .os-tool-grid { grid-template-columns: minmax(0, 1fr); }
  .view .quick { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .view .hm-quick { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .view .hm-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .view .hm-hero { grid-template-columns: minmax(0, 1fr); }
  .view .hm-hero-text { padding-right: 76px; }
  .view .hm-hero-art { width: 68px; right: 6px; }
  .view .log { gap: 10px; }
  .view .msg { max-width: 100%; padding: 11px 12px; }
  .view .composer-dock { padding-bottom: 4px; }
}

/* Wider screens regain a little breathing room without stretching text lines too far. */
@media (min-width: 821px) {
  .view { padding-top: clamp(22px, 2.5vw, 34px); }
  .view .os-section { scroll-margin-top: 88px; }
}

/* Tools & Labs: give the directory a real desktop browse rail and a clean single-column
   phone flow. The existing renderer remains the source of every tool and readiness state. */
.lp-layout {
  display: grid;
  grid-template-columns: minmax(230px, 280px) minmax(0, 1fr);
  align-items: start;
  gap: 20px;
  min-width: 0;
}
.lp-panel, .lp-main { min-width: 0; }
.lp-panel {
  position: sticky;
  top: 18px;
  display: grid;
  gap: 14px;
  padding: 16px;
  border: 1px solid var(--ds-line);
  border-radius: var(--ds-r-xl);
  background: linear-gradient(160deg, var(--ds-surface-2), var(--ds-surface));
}
.lp-panel .view-head { margin: 0; }
.lp-panel .view-head h1 { font-size: clamp(22px, 2vw, 28px); }
.os-lp-bar { display: grid; gap: 12px; margin: 0; }
.os-lp-bar .chips {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  max-height: 220px;
  overflow: auto;
  overscroll-behavior: contain;
}
.lp-list { display: grid; gap: 5px; }
.lp-list-row {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  min-width: 0;
  padding: 8px;
  border: 1px solid transparent;
  border-radius: 11px;
  color: var(--ds-text);
  text-decoration: none;
}
.lp-list-row:hover, .lp-list-row:focus-visible {
  border-color: var(--ds-accent-line);
  background: var(--ds-accent-soft);
  outline: none;
}
.lp-list-ico { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; background: var(--ds-accent-soft); color: var(--ds-accent-2); }
.lp-list-row .grow { display: grid; min-width: 0; gap: 2px; }
.lp-list-row small { color: var(--ds-text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lp-main { gap: 14px; }
.lp-main > #lp-count { margin: 0; }
.lp-main .lab-group { scroll-margin-top: 20px; }
.lp-main .lab-group > .sec-title { margin: 8px 0 0; }
.lp-main .os-tool-grid { grid-template-columns: repeat(auto-fill, minmax(min(100%, 235px), 1fr)); }
.lp-main .os-tool { min-width: 0; background: linear-gradient(155deg, var(--ds-surface-2), var(--ds-surface)); border-color: var(--ds-line); }
.lp-main .os-tool h3, .lp-main .os-tool p { overflow-wrap: anywhere; }
.lp-main .lab-preview { width: 100%; aspect-ratio: 8 / 5; object-fit: cover; border-radius: 10px; background: var(--ds-bg-2); }
@media (max-width: 820px) {
  .lp-layout { grid-template-columns: minmax(0, 1fr); gap: 14px; }
  .lp-panel { position: static; gap: 10px; padding: 13px; }
  .lp-panel .view-head { margin: 0; }
  .os-lp-bar { gap: 9px; }
  .os-lp-bar .chips { flex-wrap: nowrap; max-height: none; overflow-x: auto; overflow-y: hidden; padding: 2px 1px 7px; scrollbar-width: thin; }
  .os-lp-bar .chip { flex: 0 0 auto; }
  .lp-list { display: none; }
  .lp-main { gap: 12px; }
  .lp-main .os-tool-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
  .lp-main .os-tool { padding: 12px; }
  .lp-main .os-tool-ico { width: 36px; height: 36px; }
}
@media (max-width: 480px) {
  .lp-panel { padding: 11px; border-radius: 14px; }
  .lp-main .os-tool-grid { grid-template-columns: minmax(0, 1fr); }
  .lp-main .os-tool { gap: 7px; }
  .lp-main .lab-preview { aspect-ratio: 16 / 9; }
}

/* Home command center polish: keep the primary actions and attention items easy to scan
   without changing any of the underlying mission, task, or agent behavior. */
.hm-layout, .hm-main, .hm-rail { min-width: 0; }
.hm-main > *, .hm-rail > * { min-width: 0; }
.hm-main .os-section, .hm-rail .os-section { border-color: var(--ds-line); }
.hm-hero { overflow: hidden; }
.hm-hero .hm-hero-text, .hm-hero .hm-hero-ask { min-width: 0; }
.hm-hero .hm-hello { line-height: 1.12; text-wrap: balance; }
.hm-hero .hm-mode-line { max-width: 58ch; }
.hm-hero .hm-ask-bar, .hm-hero form { min-width: 0; }
.hm-hero .hm-chips { max-width: 100%; }
.hm-hero .hm-chip { min-height: 38px; }
.hm-quick-card { min-width: 0; }
.hm-qa6 { min-width: 0; min-height: 76px; }
.hm-qa6:focus-visible, .hm-chip:focus-visible,
.hm-intel-tabs button:focus-visible, #home-today input:focus-visible {
  outline: 2px solid var(--ds-accent-2);
  outline-offset: 3px;
}
#home-today .os-row { min-height: 54px; }
#home-today .os-row-main.os-check { min-height: 44px; }
.hm-intel-tabs { display: flex; gap: 7px; max-width: 100%; overflow-x: auto; overscroll-behavior-x: contain; }
.hm-intel-tabs button { flex: 0 0 auto; min-height: 40px; }
.hm-brief-list li, .hm-activity li { min-width: 0; }
.hm-brief-list li > a, .hm-activity li > * { min-width: 0; }
@media (max-width: 820px) {
  .hm-hero { gap: 12px; }
  .hm-hero .hm-hero-text { padding-right: 78px; }
  .hm-hero .hm-hero-ask { width: 100%; }
  .hm-hero .hm-chips { display: flex; flex-wrap: nowrap; overflow-x: auto; overflow-y: hidden; padding: 2px 2px 8px; scrollbar-width: thin; overscroll-behavior-x: contain; }
  .hm-hero .hm-chip { flex: 0 0 auto; }
  .hm-quick-card { padding: 13px; }
  .hm-qa6 { min-height: 72px; }
  .hm-rail { gap: 12px; }
  .hm-intel-tabs { padding-bottom: 3px; }
}
@media (max-width: 480px) {
  .hm-hero .hm-hero-text { padding-right: 66px; }
  .hm-hero .hm-hello { font-size: clamp(1.45rem, 7vw, 1.9rem); }
  .hm-hero .hm-date { gap: 6px; flex-wrap: wrap; }
  .hm-quick-card { padding: 11px; }
  .hm-layout .hm-quick.hm-quick6 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hm-qa6 { min-height: 68px; }
  #home-today .os-row { padding-block: 8px; }
  .hm-banner { gap: 10px; }
}

