/* Shared, quiet utility shell. Page owners load this after feature styles. */
html[data-ui="comfortable"] body{
  font-size:var(--fs-base);
  line-height:1.6;
}

html[data-ui="comfortable"][data-layout="pc"]{ padding:0; }

/* Reserve the PC rail once for the entire page, including its header. */
html[data-ui="comfortable"][data-layout="pc"] body{
  padding-left:var(--app-nav-inset-left, 116px);
}

/* Field pages previously reserved the rail inside main alone. */
html[data-ui="comfortable"][data-layout="pc"] body:has(#viewSwitch) > main{
  padding-left:0;
}

html[data-ui="comfortable"] body > header,
html[data-ui="comfortable"] body > .home-hero,
html[data-ui="comfortable"] body > .hero{
  display:grid;
  grid-template-columns:minmax(0, 1fr) auto;
  grid-template-rows:auto auto;
  grid-template-areas:"title info" "description description";
  align-items:start;
  column-gap:24px;
  row-gap:4px;
  padding:20px max(16px, calc((100% - min(1120px, var(--content-max, 1120px))) / 2 + 16px)) 18px;
  border-bottom:2px solid var(--moon);
  text-align:left;
}

html[data-ui="comfortable"] body > header h1,
html[data-ui="comfortable"] body > .home-hero h1,
html[data-ui="comfortable"] body > .hero h1{
  grid-area:title;
  min-width:0;
  margin:0;
  color:var(--on-dark);
  font-size:22px;
  font-weight:700;
  line-height:1.4;
  letter-spacing:0;
}

html[data-ui="comfortable"] body > .home-hero h1{ font-size:24px; }

html[data-ui="comfortable"] body > .home-hero p,
html[data-ui="comfortable"] body > header .sub,
html[data-ui="comfortable"] body > .hero p{
  grid-area:description;
  min-width:0;
  margin:0;
  color:var(--moon-soft);
  font-size:var(--fs-sm);
  line-height:1.5;
}

html[data-ui="comfortable"] body > header .app-version,
html[data-ui="comfortable"] body > .home-hero .app-version,
html[data-ui="comfortable"] body > .hero .app-version,
html[data-ui="comfortable"] body > header .build-time,
html[data-ui="comfortable"] body > .home-hero .build-time,
html[data-ui="comfortable"] body > .hero .build-time,
html[data-ui="comfortable"] body > header .cloud-sync-last-sync,
html[data-ui="comfortable"] body > .home-hero .cloud-sync-last-sync,
html[data-ui="comfortable"] body > .hero .cloud-sync-last-sync{
  position:static;
  grid-area:info;
  align-self:start;
  justify-self:end;
  margin:0;
  color:var(--moon-soft);
  font-size:12px;
  line-height:1.35;
  opacity:1;
  text-align:right;
  white-space:nowrap;
}

html[data-ui="comfortable"] body > header .app-version,
html[data-ui="comfortable"] body > .home-hero .app-version,
html[data-ui="comfortable"] body > .hero .app-version{
  color:var(--moon);
}

html[data-ui="comfortable"] body > header .build-time,
html[data-ui="comfortable"] body > .home-hero .build-time,
html[data-ui="comfortable"] body > .hero .build-time{ margin-block-start:18px; }

html[data-ui="comfortable"] body > header .cloud-sync-last-sync,
html[data-ui="comfortable"] body > .home-hero .cloud-sync-last-sync,
html[data-ui="comfortable"] body > .hero .cloud-sync-last-sync{ margin-block-start:36px; }

html[data-ui="comfortable"][data-header-field] body > header,
html[data-ui="comfortable"][data-header-field] body > .home-hero,
html[data-ui="comfortable"][data-header-field] body > .hero{
  isolation:isolate;
  background-image:
    linear-gradient(100deg, var(--header-bg) 0%, var(--header-bg) 28%, rgba(27,34,69,.45) 60%, rgba(27,34,69,.1) 100%),
    var(--header-field-img, none);
}

/* Keep the field image visible; shade only the upper-right information area. */
html[data-ui="comfortable"][data-header-field] body > header::before,
html[data-ui="comfortable"][data-header-field] body > .home-hero::before,
html[data-ui="comfortable"][data-header-field] body > .hero::before{
  content:"";
  grid-area:info;
  align-self:stretch;
  justify-self:stretch;
  min-width:0;
  min-height:0;
  margin:-6px -8px;
  border-radius:12px;
  background:rgba(12,18,40,.4);
  filter:blur(8px);
  pointer-events:none;
  z-index:0;
}

html[data-ui="comfortable"][data-header-field] body > :is(header, .home-hero, .hero) > :is(.app-version, .build-time, .cloud-sync-last-sync){
  z-index:1;
  text-shadow:0 1px 2px rgba(0,0,0,.8);
}

/* Keep standard tools readable without constraining chart and table wrappers. */
html[data-ui="comfortable"] body > main,
html[data-ui="comfortable"] body > .standalone-panel > main,
html[data-ui="comfortable"] body > .tab-panel > main{
  width:100%;
  max-width:min(1120px, var(--content-max, 1120px));
  margin-inline:auto;
}

/* Page destinations use equal-width buttons in one scrollable row. */
html[data-ui="comfortable"] .tab-bar{
  display:flex;
  flex-wrap:nowrap;
  align-items:stretch;
  gap:8px;
  min-height:100px;
  padding:10px 12px;
  overflow-x:auto;
  overflow-y:hidden;
  background:var(--paper);
  border-bottom:1px solid var(--line);
}

html[data-ui="comfortable"] .tab-bar .tab-btn,
html[data-ui="comfortable"] .tab-bar .tab-btn.active{
  position:relative;
  box-sizing:border-box;
  flex:none;
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  gap:4px;
  width:96px;
  min-width:96px;
  max-width:96px;
  min-height:80px;
  margin:0;
  padding:6px 4px;
  border:1px solid var(--line);
  border-radius:12px;
  background:var(--paper);
  box-shadow:none;
  color:var(--ink-soft);
  font-size:var(--fs-xs);
  font-weight:700;
  line-height:1.25;
  text-align:center;
  white-space:normal;
  text-decoration:none;
  transition:color .14s ease, background-color .14s ease;
}

html[data-ui="comfortable"] .tab-bar .tab-btn::before,
html[data-ui="comfortable"] .tab-bar .tab-btn::after{
  content:none;
  box-shadow:none;
}

html[data-ui="comfortable"] .tab-bar .tab-btn.active{
  padding:4px 2px;
  border:3px solid var(--selected-strong-border);
  background:var(--selected-soft-bg);
  color:var(--selected-soft-ink);
}

html[data-ui="comfortable"] .tab-bar .tab-btn:hover{
  background:var(--paper-dim);
}

html[data-ui="comfortable"] #tabBar.tab-bar .tab-btn > :is(.tab-icon, .bn-icon, .ui-icon, .nav-mewtwo-icon),
html[data-ui="comfortable"] #tabBar.tab-bar .tab-btn .tab-icon .ui-icon,
html[data-ui="comfortable"] #tabBar.tab-bar .tab-btn .nav-mewtwo-icon img{
  width:22px;
  height:22px;
  flex:none;
}

html[data-ui="comfortable"] .tab-bar .tab-btn .tab-label{
  display:flex;
  align-items:center;
  justify-content:center;
  min-height:2.5em;
  max-width:100%;
  white-space:normal;
  overflow-wrap:anywhere;
  text-wrap:balance;
}

/* Review 07: simplify corners/shadows; keep legacy label sizing, glass,
   selection colors, and icon/press motion in bottomNav.css. */
html[data-ui="comfortable"] .app-bottom-nav{
  border-radius:16px;
  box-shadow:0 4px 14px color-mix(in srgb, var(--ink) 14%, transparent);
}

html[data-ui="comfortable"] .app-bottom-nav::before{ background:none; }

html[data-ui="comfortable"] .app-bottom-nav .bn-item{
  text-shadow:none;
}

html[data-ui="comfortable"] .app-bottom-nav .bn-icon{ filter:none; }

html[data-ui="comfortable"] .app-bottom-nav .bn-label{
  text-shadow:none;
}

html[data-ui="comfortable"] .app-bottom-nav .bn-item.is-active{
  box-shadow:none;
}

/* Settings controls wrap in both the centered panel and the narrow PC rail. */
html[data-ui="comfortable"] .settings-panel,
html[data-ui="comfortable"] .settings-panel :where(button, a, label, p, small, input, select){
  font-size:var(--fs-xs);
}

html[data-ui="comfortable"] .settings-panel select,
html[data-ui="comfortable"] .settings-panel input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="button"]):not([type="submit"]):not([type="reset"]):not([type="color"]):not([type="file"]):not([type="image"]),
html[data-ui="comfortable"] .settings-panel textarea{ font-size:16px; }

html[data-ui="comfortable"] .settings-title{ font-size:var(--fs-md); }

html[data-ui="comfortable"] .settings-title-row{
  flex-wrap:nowrap;
  align-items:center;
}

html[data-ui="comfortable"] .settings-title-actions{
  display:flex;
  flex:0 0 auto;
  width:auto;
  min-width:0;
  margin-left:auto;
  justify-content:flex-end;
  gap:6px;
}

html[data-ui="comfortable"] .settings-language-control{
  display:flex;
  flex-direction:column;
  align-items:stretch;
  min-width:0;
  white-space:normal;
  gap:3px;
}

html[data-ui="comfortable"] .settings-title-language{
  width:100%;
  max-width:none;
  min-width:0;
}

html[data-ui="comfortable"] .settings-close-btn{
  width:40px;
  height:40px;
}

html[data-ui="comfortable"] .settings-panel .settings-row:has(#themeSeg){
  align-items:stretch;
  flex-direction:column;
  gap:8px;
}

html[data-ui="comfortable"] .settings-panel #themeSeg{
  display:grid;
  grid-template-columns:repeat(3, minmax(0, 1fr));
  width:100%;
}

html[data-ui="comfortable"] .settings-panel #themeSeg button{
  min-width:0;
  padding-inline:4px;
  white-space:nowrap;
}

html[data-ui="comfortable"] .settings-row-label,
html[data-ui="comfortable"] .settings-row-link,
html[data-ui="comfortable"] .settings-text-link,
html[data-ui="comfortable"] .settings-row-action{
  font-size:var(--fs-xs);
}

html[data-ui="comfortable"] .settings-title{
  font-size:var(--fs-md);
}

@media (max-width:600px){
  html[data-ui="comfortable"] body > header,
  html[data-ui="comfortable"] body > .home-hero,
  html[data-ui="comfortable"] body > .hero{
    grid-template-columns:minmax(0, 1fr) auto;
    grid-template-rows:auto auto auto;
    grid-template-areas:". info" "title title" "description description";
    column-gap:12px;
    row-gap:3px;
    padding:16px;
  }

  html[data-ui="comfortable"] body > header h1,
  html[data-ui="comfortable"] body > .home-hero h1,
  html[data-ui="comfortable"] body > .hero h1{
    font-size:21px !important;
    line-height:1.4;
    white-space:normal;
    overflow-wrap:anywhere;
  }

  html[data-ui="comfortable"] body > .home-hero h1{ font-size:22px !important; }

  html[data-ui="comfortable"] body > header .app-version,
  html[data-ui="comfortable"] body > .home-hero .app-version,
  html[data-ui="comfortable"] body > .hero .app-version,
  html[data-ui="comfortable"] body > header .build-time,
  html[data-ui="comfortable"] body > .home-hero .build-time,
  html[data-ui="comfortable"] body > .hero .build-time{
    justify-self:end;
    text-align:right;
  }

  html[data-ui="comfortable"] body > header .build-time,
  html[data-ui="comfortable"] body > .home-hero .build-time,
  html[data-ui="comfortable"] body > .hero .build-time{
    justify-self:end;
    font-size:12px;
  }

  html[data-ui="comfortable"] body > header .cloud-sync-last-sync,
  html[data-ui="comfortable"] body > .home-hero .cloud-sync-last-sync,
  html[data-ui="comfortable"] body > .hero .cloud-sync-last-sync{
    justify-self:end;
    text-align:right;
  }

}

@media (prefers-reduced-motion:reduce){
  html[data-ui="comfortable"] .tab-bar .tab-btn{ transition:none; }
}

@supports (height:100dvh){
  html[data-ui="comfortable"] .settings-panel.is-side{
    max-height:calc(100dvh - 32px);
  }

  html[data-ui="comfortable"] .settings-panel.is-side.open{
    transform:translateY(clamp(
      calc(16px - var(--settings-panel-anchor-y, 50vh)),
      -50%,
      calc(100dvh - var(--settings-panel-anchor-y, 50vh) - 100% - 16px)
    )) scale(1);
  }
}
