/* Owner concept + Stitch references, adapted to native TARVI. No remote assets. */
body.chats-real-v1 { --text-primary:var(--text); --text-secondary:var(--muted); --bg-card:var(--panel-solid); }
body.chats-real-v1 .app-shell { grid-template-columns:88px 304px minmax(0,1fr); }
body.chats-real-v1 .app-shell.wide-workspace { grid-template-columns:88px minmax(0,1fr); }
body.chats-real-v1 .app-shell.wide-workspace>.list-panel { display:none; }
body.chats-real-v1 .rail-item { min-height:58px; padding:9px 3px; gap:5px; }
body.chats-real-v1 .rail-label { font-size:12px; line-height:1.25; white-space:normal; }
.nav-rail [hidden],.mobile-nav [hidden] { display:none!important; }
body.chats-real-v1 .favorites-entry { margin:8px 12px; min-height:44px; }
body.chats-real-v1 .activity-page { font-size:15px; line-height:1.5; max-width:900px; padding:24px; }
body.chats-real-v1 .activity-page h2 { font-size:clamp(24px,2.3vw,30px); line-height:1.2; margin:0 0 8px; }
body.chats-real-v1 .activity-page header p { margin:0; }
.ui-page-heading { display:flex; align-items:flex-start; justify-content:space-between; gap:16px; margin-bottom:20px; }
.ui-page-heading>div { min-width:0; }
.ui-page-heading p { max-width:58ch; color:var(--muted); }
.ui-page-heading button { flex-shrink:0; }
body.chats-real-v1 .activity-page button.ui-primary { background:var(--teal); color:#102724; border-color:transparent; font-weight:650; }
body.chats-real-v1 .activity-page button:disabled,body.chats-real-v1 .activity-page button[aria-disabled=true] { opacity:.48; cursor:not-allowed; }
body.chats-real-v1 .activity-page button:focus-visible,body.chats-real-v1 .activity-page summary:focus-visible,
.story-viewer button:focus-visible { outline:2px solid var(--teal); outline-offset:3px; }
body.chats-real-v1 .activity-page button { margin:0; min-height:44px; }
.circle-tabs { display:grid; grid-template-columns:1fr 1fr; gap:4px; padding:4px; border:1px solid var(--line); border-radius:12px; }
.circle-tabs button { border-color:transparent; background:transparent; }
.circle-tabs [aria-pressed=true] { color:var(--teal); border-bottom:2px solid var(--teal); background:var(--panel-2); }
.circle-tools { display:flex; flex-wrap:wrap; align-items:center; margin-block:12px 18px; }
.circle-tools>label { margin-left:auto; display:flex!important; align-items:center; gap:8px; font-size:13px; }
#circlePrototype .circle-tools select { min-width:140px; width:auto; }
.ui-explanation { color:var(--muted); font-size:13px; margin-block:12px; }
.ui-explanation p { max-width:75ch; }
.ui-empty { padding:28px 18px; border:1px dashed var(--line); border-radius:14px; margin:18px 0; color:var(--muted); }
.ui-empty h3 { color:var(--text); }
.ui-inset,.ui-pending { padding:14px; border:1px solid var(--line); border-radius:12px; background:var(--panel-2); margin-block:12px; }
.ui-pending { border-left:3px solid var(--warning); }
.channel-heading-actions { display:flex; gap:8px; flex-wrap:wrap; justify-content:flex-end; }
.channel-heading>div>button { padding-left:0; border:0; background:transparent; color:var(--muted); margin-bottom:10px!important; }
#channelWorkspace { padding-bottom:20px; }
#channelWorkspace .channel-summary { white-space:pre-wrap; overflow-wrap:anywhere; }
.channel-utilities { display:flex; flex-wrap:wrap; align-items:flex-start; gap:12px; margin-block:8px 20px; }
.channel-utilities>details { flex:1; min-width:200px; border:1px solid var(--line); border-radius:10px; padding-inline:14px; }
.channel-utilities>details:not([open]) { min-width:140px; }
.channel-utilities>details[open] { flex-basis:100%; }
#channelWorkspace summary { padding:10px 0; }
#channelWorkspace .channel-id { user-select:all; color:var(--muted); }
.channel-index-actions { display:grid; gap:12px; }
.channel-index-actions>details { padding-inline:16px; border:1px solid var(--line); border-radius:12px; }
#channelWorkspace input[type=checkbox],#storyGrid input[type=checkbox] { width:20px!important; min-height:20px!important; height:20px; margin:0; flex:none; accent-color:var(--teal); }
.ui-check { display:flex!important; align-items:center; gap:10px!important; min-height:44px; padding-block:6px; cursor:pointer; }
.ui-form-next { display:flex; flex-wrap:wrap; gap:10px; align-items:center; margin-top:18px; border-top:1px solid var(--line); padding-top:16px; }
.ui-form-next>.ui-primary { min-width:180px; }
.ui-visibility-notice { border-left:3px solid var(--teal); padding:12px 14px; background:var(--panel-2); }
.ui-visibility-notice h4 { margin:0; }
.ui-file-choice { padding:14px; border:1px dashed var(--line); border-radius:12px; }
.ui-file-choice input { border:0!important; padding:8px 0!important; background:transparent!important; min-width:0; max-width:100%; }
.ui-file-choice input::file-selector-button { border:1px solid var(--line); border-radius:8px; background:var(--panel-2); color:var(--text); min-height:44px; padding:8px 12px; margin-right:10px; font:inherit; }
.ui-file-name { overflow-wrap:anywhere; color:var(--muted); }
.channel-post-top { display:flex; flex-wrap:wrap; align-items:center; justify-content:space-between; gap:8px; }
.channel-post-top>h3 { margin:0!important; }
.channel-post-menu { min-width:44px; }
.channel-post-menu>summary { width:44px; min-height:44px; text-align:center; list-style:none; border-radius:8px; cursor:pointer; }
.channel-post-menu>summary::-webkit-details-marker { display:none; }
.channel-post-menu[open] { flex-basis:100%; padding:8px; border:1px solid var(--line); border-radius:10px; background:var(--panel-2); }
.channel-post-menu[open]>summary { margin-left:auto; }
.channel-post-menu[open]>div { display:flex; gap:8px; flex-wrap:wrap; }
.channel-post-menu[open]>div>details { flex-basis:100%; }
.channel-post-menu button { min-height:44px; }
body.chats-real-v1.stories-feature-v1 .stories-hero { display:none; }
#storyGrid .story-editor { display:grid; gap:12px; }
#storyGrid .story-editor textarea { box-sizing:border-box; margin:0; }
#storyGrid .story-audience { display:block; border:1px solid var(--line); border-radius:12px; }
.story-audience legend { font-weight:650; padding-inline:6px; }
.story-audience-summary { color:var(--text); margin-top:0; overflow-wrap:anywhere; }
.story-viewer,.channel-viewer { width:min(720px,calc(100vw - 24px)); max-height:calc(100dvh - 24px); padding:16px; }
.story-viewer header { position:sticky; top:-16px; padding:8px 0 12px; background:var(--bg-card); z-index:1; }
.story-viewer h2 { font-size:20px; margin:0 0 10px; }
.story-viewer-controls { display:flex; flex-wrap:wrap; gap:8px; }
.story-viewer button { min-height:44px; padding:8px 14px; font:inherit; background:var(--panel-2); color:var(--text); border:1px solid var(--line); border-radius:9px; }
.story-viewer button[hidden] { display:none!important; }
/* Daily entry: the real login is a single surface, not an authenticated sidebar. */
body.chats-login-only .favorites-entry,body.chats-login-only #dailySearchNote { display:none!important; }
body.chats-login-only .list-header { display:none; }
body.chats-login-only .list-panel { background:transparent; }
body.chats-login-only .app-shell { box-sizing:border-box; padding:max(24px,env(safe-area-inset-top)) 20px max(24px,env(safe-area-inset-bottom)); }
.chats-real-login { gap:16px; }
.chats-real-login .auth-heading { text-align:center; }
.auth-heading img { display:block; margin:0 auto 16px; }
.auth-heading h2 { margin:0; font-size:clamp(24px,5vw,30px); }
.auth-heading p { margin:8px 0 0; color:var(--accent-cyan,#58d2c8); }
.auth-profile-description,.auth-invitation,.auth-security { margin:0; line-height:1.5; }
.auth-profile-description { color:var(--text-muted,#b7c0cb); }
.chats-real-login label { display:grid; gap:7px; }
.chats-real-login input { min-width:0; width:100%; box-sizing:border-box; min-height:48px; font-size:16px; }
.auth-password { display:flex; gap:8px; align-items:stretch; }
.auth-password input { flex:1; width:0; }
.auth-password button { flex:none; min-height:48px; padding:8px 12px; font:inherit; }
.auth-status:empty { display:none; }
.auth-invitation a { display:inline-flex; align-items:center; min-height:44px; }
.auth-security { padding-top:14px; border-top:1px solid var(--line); color:var(--text-muted,#b7c0cb); font-size:13px; }
.chat-list-item { display:grid; position:relative; grid-template-columns:minmax(0,1fr) auto; align-items:center; }
.chat-list-item>.chat-row { min-width:0; }
.chat-row-menu { position:relative; margin-inline-end:6px; }
.chat-row-menu summary { list-style:none; min-width:44px; min-height:44px; display:grid; place-items:center; border:1px solid transparent; border-radius:10px; cursor:pointer; font-size:24px; }
.chat-row-menu summary::-webkit-details-marker { display:none; }
.chat-row-menu[open] summary { border-color:var(--line); background:var(--panel-2); }
.chat-row-menu[open] { z-index:4; }
.chat-row-menu-actions { position:absolute; right:0; top:100%; min-width:180px; max-width:calc(100vw - 40px); padding:6px; border:1px solid var(--line); border-radius:12px; background:var(--bg-card,#17202a); box-shadow:0 8px 20px #0006; }
.chat-row-menu-actions button { display:block; width:100%; padding:10px 12px; min-height:44px; font:inherit; text-align:left; border:0; background:transparent; color:var(--text); }
.chat-row-menu-actions button:hover,.chat-row-menu-actions button:focus-visible { background:var(--panel-2); }
.chat-row-menu:last-child { flex:none; }
.chat-invitations { margin:4px 12px 12px; }
.chat-invitations>summary { padding:12px 0; min-height:44px; cursor:pointer; line-height:1.5; }
.chat-invitations>summary span { color:var(--accent-cyan,#58d2c8); font-size:13px; }
.chat-list-alert { margin:10px 12px; padding:12px; border:1px solid var(--line); border-radius:10px; }
#chatOrganizationSettings { grid-column:1/-1; }
#chatOrganizationSettings>summary { min-height:44px; display:list-item; cursor:pointer; font-weight:650; }
.feed-media-open { width:100%; display:flex; align-items:center; gap:16px; padding:18px!important; text-align:left; border:1px solid var(--line); border-radius:12px; background:var(--panel-2); color:var(--text); }
.feed-media-open small { display:block; margin-top:5px; font-size:12px; color:var(--text-muted,#b7c0cb); }
.feed-media-symbol { display:grid; place-items:center; width:64px; min-height:64px; border-radius:10px; font-size:25px; color:var(--accent-cyan,#58d2c8); background:var(--bg-card); flex:none; }
.channel-feed-text { white-space:pre-wrap; line-height:1.6; overflow-wrap:anywhere; }
.story-viewer-nav { display:flex; flex-wrap:wrap; gap:8px; align-items:center; }
.story-viewer-meta { color:var(--text-muted,#b7c0cb); margin:0 0 12px; }
.story-viewer [data-story-player] { min-height:80px; }
.story-viewer [data-story-player] img,.story-viewer [data-story-player] video { display:block; margin:auto; width:100%; object-fit:contain; }
@media(max-width:720px) {
 body.chats-login-only .app-shell { min-height:100dvh; height:auto!important; padding-inline:16px; }
 body.chats-login-only .chats-real-login { padding:8px 0; }
 .chat-list-item { display:flex; }
 .chat-list-item>.chat-row { flex:1; }
 .story-viewer { padding:12px; }
 .story-viewer-nav button { flex:1 1 auto; }
}
.story-viewer img,.story-viewer video { max-height:65dvh; object-fit:contain; }
@media(max-width:720px) {
  body.chats-real-v1 .app-shell,body.chats-real-v1 .app-shell.wide-workspace { display:block; }
  body.chats-real-v1 .activity-page { padding:18px 14px; }
  body.chats-real-v1 .workspace.mobile-static { bottom:calc(72px + env(safe-area-inset-bottom,0px)); }
  body.chats-real-v1.stories-feature-v1 .mobile-nav,body.chats-real-v1 .mobile-nav { height:calc(72px + env(safe-area-inset-bottom,0px)); grid-auto-flow:column; grid-auto-columns:minmax(0,1fr); grid-template-columns:none; gap:0; padding:4px 2px calc(4px + env(safe-area-inset-bottom,0px)); overflow:visible; }
  body.chats-real-v1 .mobile-nav button { min-width:0; min-height:56px; font-size:12px; line-height:14px; padding:4px 2px; gap:4px; white-space:normal; }
  body.chats-real-v1 .mobile-nav button>span { font-size:22px; }
  .ui-page-heading { flex-wrap:wrap; gap:12px; }
  .ui-page-heading>.ui-primary { width:100%; }
  .channel-heading-actions { width:100%; justify-content:flex-start; }
  .channel-heading-actions>button { flex:1; }
  .circle-tabs button { font-size:14px; padding:10px 8px; }
  .circle-tools { gap:8px; }
  .circle-tools>button { font-size:14px; flex:1 1 90px; padding-inline:8px; }
  body.chats-real-v1 #circlePrototype .circle-tools>label { flex:1 0 100%; width:100%; margin-left:0; }
  #circlePrototype .circle-tools select { flex:1; min-width:0; }
  .ui-form-next { flex-direction:column; align-items:stretch; }
  .ui-form-next>button { width:100%; }
  .channel-utilities { gap:8px; }
  .channel-utilities>details:not([open]) { min-width:120px; }
}

/* Verified local derivatives: reserve geometry before lazy image arrival. */
.feed-media-open { display:block; padding:0!important; overflow:hidden; }
.channel-preview-frame { display:grid; position:relative; width:100%; aspect-ratio:16/9; overflow:hidden; background:var(--panel-2,#111a24); place-items:center; }
@media (min-width:721px) { .channel-preview-frame { max-height:360px; } }
.channel-preview-frame img { position:absolute; inset:0; width:100%; height:100%; object-fit:contain; }
.channel-preview-frame [hidden] { display:none!important; }
[data-preview-state] { padding:16px; color:var(--muted); text-align:center; }
[data-preview-play] { z-index:1; border-radius:50%; padding:14px 18px; background:#111c; color:white; font-size:24px; }
[data-preview-duration] { position:absolute; right:10px; bottom:10px; background:#111d; color:white; border-radius:5px; padding:3px 7px; }
[data-preview-label] { display:block; padding:12px 14px; font-weight:600; }
