/* Settings and Setup materials from the supplied Adaptive OS source. */
:root {
  --font: 'UN.01 Inter', Inter, 'Segoe UI', sans-serif;
  --type-caption: .6875rem;
  --type-label: .75rem;
  --type-body: .875rem;
  --stroke: .85px;
  --radius-control: 6px;
  --radius-card: 8px;
  --radius-window: 11px;
  --radius-tile: 14px;
  --radius-round: 999px;
  --muted: #595959;
  --glass: rgb(244 244 244 / 85%);
  --rail-glass: color-mix(in srgb, var(--rail) 88%, transparent);
  --control: var(--raised);
  --hover: var(--key);
  --key-hover: rgb(20 20 20 / 16%);
  --action-hover: color-mix(in srgb, var(--ink), var(--surface) 10%);
  --control-hover: color-mix(in srgb, var(--raised), var(--ink) 7%);
  --scrim: rgb(20 20 20 / 24%);
  --duration: 160ms;
  font: 400 100% var(--font);
  font-synthesis: none;
}

:root[data-theme=dark] {
  --muted: #b5b5b5;
  --glass: rgb(27 27 27 / 86%);
  --rail-glass: color-mix(in srgb, var(--rail) 88%, transparent);
  --control: var(--raised);
  --hover: var(--key);
  --key-hover: rgb(255 255 255 / 28%);
  --scrim: rgb(0 0 0 / 48%);
}

body, body.adaptive-shell { font: 400 var(--type-body)/1.45 var(--font); }
button, input, select, textarea { font-family: var(--font); font-synthesis: none; }
#main :is(button, a, input, select, textarea):focus-visible,
:is(.header, .sidebar, .modal, .setup-screen) :is(button, a, input, select, textarea):focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

.adaptive-shell .header, .adaptive-shell .sidebar {
  border-color: var(--line);
  backdrop-filter: blur(var(--blur));
}
body.adaptive-shell .postager-wordmark { font-weight: 500; letter-spacing: -.035em; }
body.adaptive-shell #nav { border-radius: var(--radius-tile); background: var(--control); }
body.adaptive-shell .nav-item {
  position: relative;
  font: 500 var(--type-body)/1.25 var(--font);
  letter-spacing: normal;
  gap: 8px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--ink);
  transition: background-color var(--duration) var(--ease);
}
body.adaptive-shell .nav-item + .nav-item { border-block-start: var(--stroke) solid var(--line); }
body.adaptive-shell .nav-item:first-child { border-radius: var(--radius-tile) var(--radius-tile) 0 0; }
body.adaptive-shell .nav-item:last-child { border-radius: 0 0 var(--radius-tile) var(--radius-tile); }
body.adaptive-shell .nav-item:hover { background: var(--key); }
body.adaptive-shell .nav-item[aria-current] { background: var(--key-hover); }

.glyph-wrap, body.adaptive-shell .nav-item > .reference-nav-icon {
  display: grid;
  place-items: center;
  flex: 0 0 40px;
  inline-size: 40px;
  block-size: 40px;
  background: var(--key);
  color: var(--ink);
  border-radius: var(--radius-round);
}
.glyph-wrap > svg, body.adaptive-shell .reference-nav-icon > svg {
  display: block;
  width: 22px;
  height: 22px;
  fill: currentColor;
  stroke: none;
}
body.adaptive-shell .nav-item[aria-current] .reference-nav-icon {
  color: var(--raised);
  background: var(--ink);
}
.reference-nav-copy {
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.reference-chevron {
  display: inline-flex;
  flex: none;
  margin-inline-start: auto;
  color: var(--ink);
  opacity: .65;
}
.reference-chevron svg, body.adaptive-shell .nav-item .reference-chevron svg {
  inline-size: 14px;
  block-size: 14px;
}
body.adaptive-shell .add-post {
  font: 500 var(--type-label)/1.2 var(--font);
  border-radius: var(--radius-control);
  box-shadow: none;
}
body.adaptive-shell .add-post .plus-icon { display: grid; place-items: center; }
.add-post .plus-icon:has(svg)::before, .add-post .plus-icon:has(svg)::after { content: none; }
.add-post .plus-icon svg { width: 16px; height: 16px; }

body.adaptive-shell .tab, body.adaptive-shell .tab:nth-child(n) {
  font: 400 var(--type-label)/1.2 var(--font);
  letter-spacing: normal;
  position: relative;
  border-radius: var(--radius-control);
  background: transparent;
}
body.adaptive-shell .tab.active { color: var(--ink); font-weight: 500; }
body.adaptive-shell .tab.active::after {
  content: '';
  position: absolute;
  inset: auto 12px 0;
  block-size: 2px;
  border-radius: var(--radius-round);
  background: var(--ink);
}
body.adaptive-shell .tab:hover { background: var(--key); }
body.adaptive-shell .post {
  background: var(--control);
  border-width: var(--stroke);
  border-radius: var(--radius-card);
}
body.adaptive-shell .post:hover { border-color: var(--muted); }
body.adaptive-shell .post.is-expanded { border-color: var(--ink); }
body.adaptive-shell .post-open .caption {
  display: block;
  font: 400 var(--type-body)/1.45 var(--font);
  letter-spacing: normal;
  -webkit-line-clamp: unset;
}
.post-caption-text { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; overflow: hidden; }
body.adaptive-shell .date-heading { font-size: var(--type-body); font-weight: 500; letter-spacing: normal; }
body.adaptive-shell .special-day { font-size: var(--type-caption); color: var(--muted); }
body.adaptive-shell .post-times { font: 400 var(--type-caption)/1.3 var(--font); font-variant-numeric: tabular-nums; }
body.adaptive-shell .post-times strong { font: inherit; color: var(--muted); }
body.adaptive-shell .post .more { border-radius: var(--radius-control); min-inline-size: 20px; }
body.adaptive-shell .post .more i { background: var(--ink); }
body.adaptive-shell .post .more:hover { background: var(--key); }
body.adaptive-shell .delivery-card, .brand-empty {
  background: var(--control);
  border: var(--stroke) solid var(--line);
  border-radius: var(--radius-card);
}
body.adaptive-shell .delivery-card header strong { font-size: var(--type-label); font-weight: 500; }
body.adaptive-shell .delivery-card :is(header small, p, footer, footer a, footer button, .delivery-state) { font-size: var(--type-caption); }
body.adaptive-shell .delivery-card footer { background: var(--surface); }
body.adaptive-shell .delivery-interactions { color: var(--muted); }
body.adaptive-shell .expansion-title { font-weight: 500; }
body.adaptive-shell .preview-disclaimer { font-size: var(--type-caption); color: var(--muted); }

:is(.plain-button,.editor-actions button,.connection-dialog button.primary,.channel>button,.google-button,.auth-submit,.theme-button) {
  min-block-size: 36px;
  border: var(--stroke) solid var(--line);
  border-radius: var(--radius-control);
  background: var(--control);
  color: var(--ink);
  box-shadow: none;
  font-size: var(--type-label);
  font-weight: 500;
  transition: background-color var(--duration) var(--ease);
}
:is(.plain-button,.editor-actions button,.channel>button,.google-button,.theme-button):enabled:hover {
  background: var(--control-hover);
  border-color: var(--line);
}
:is(.plain-button,.editor-actions button,.channel>button,.google-button,.theme-button):enabled:active { background: var(--selected); }
:is(.plain-button.primary,.editor-actions button[data-save=Published],.connection-dialog button.primary,.auth-submit,.header-signup),
body.adaptive-shell .add-post {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--surface);
  opacity: 1;
}
:is(.plain-button.primary,.editor-actions button[data-save=Published],.connection-dialog button.primary,.auth-submit,.header-signup):enabled:hover,
body.adaptive-shell .add-post:enabled:hover {
  background: var(--action-hover);
  border-color: var(--ink);
  color: var(--surface);
  opacity: 1;
}
:is(.plain-button,.auth-submit,.editor-actions button,.google-button):disabled { opacity: .58; cursor: default; }
.theme-button { inline-size: 36px; color: var(--ink); }
.theme-button svg { width: 16px; height: 16px; }
:is(.input,.simple-form input:not([type=checkbox]),.simple-form select,.channel-search,.schedule-input,
.auth-form input:not([type=checkbox]),.editor textarea) {
  min-block-size: 36px;
  background: var(--control);
  color: var(--ink);
  border: var(--stroke) solid var(--line);
  border-radius: var(--radius-control);
  font-size: var(--type-body);
  box-shadow: none;
}
:is(.input,.simple-form input,.auth-form input,.editor textarea)::placeholder { color: var(--muted); }
:where(button,input,select,textarea) { accent-color: var(--ink); }
:is(.input,.auth-form input)[aria-invalid=true] { border-color: var(--danger); }

.page-heading { margin-block-end: 16px; }
.page-heading h1, .section-title, .auth-content h1, .setup-body h1 {
  margin: 0;
  font: 500 clamp(1.25rem,3vw,1.65rem)/1.2 var(--font);
  letter-spacing: -.035em;
}
.page-heading p { margin-block-start: 4px; font-size: var(--type-label); line-height: 1.5; }
.surface-group, .channels, .connection-requirements, .account-options, .preview,
.metric-summary, .assistant-list > div, .mcp-endpoint {
  border-width: var(--stroke);
  border-radius: var(--radius-card);
  background: var(--control);
}
.group-heading, .settings-layout .custom-days > strong {
  font-size: var(--type-body);
  font-weight: 500;
}
.group-heading { margin: 0; padding: 12px; background: var(--surface); border-bottom-width: var(--stroke); }
.settings-layout { gap: 16px; max-width: 850px; grid-template-columns: minmax(0, 1fr) 240px; }
body.adaptive-home .settings-layout { grid-template-columns: 1fr; }
.settings-layout #settingsForm { gap: 12px; }
.settings-layout #settingsForm > .surface-group > .group-heading {
  border-radius: calc(var(--radius-card) - var(--stroke)) calc(var(--radius-card) - var(--stroke)) 0 0;
}
.settings-row {
  grid-template-columns: 40px minmax(0, 1fr) minmax(0, 42%);
  min-block-size: 55px;
  gap: 12px;
  padding: 8px 12px;
  border-bottom-width: var(--stroke);
}
.settings-row .row-copy strong, .settings-shortcut, .channel .channel-copy h2 {
  font-size: var(--type-body);
  font-weight: 500;
}
.settings-row .row-copy small, .channel .channel-copy p {
  margin-top: 3px;
  font-size: var(--type-label);
  line-height: 1.45;
}
.settings-row :is(input, select) { min-inline-size: 0; }
.settings-layout .custom-days {
  border-width: var(--stroke);
  border-radius: var(--radius-card);
  padding: 12px;
}
.settings-layout .custom-days p { font-size: var(--type-label); }
.settings-layout .settings-aside { gap: 12px; }
.settings-aside .surface-group { padding: 0; }
.settings-appearance { padding: 12px; }
.settings-shortcut {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  min-block-size: 55px;
  gap: 8px;
  padding: 7px 12px;
  border-bottom-width: var(--stroke);
}
.settings-shortcut:hover { background: var(--key); }
.settings-shortcut .glyph-wrap, .modal-head .glyph-wrap { width: 34px; height: 34px; }
.settings-shortcut .glyph-wrap svg, .modal-head .glyph-wrap svg { width: 18px; height: 18px; }
.appearance-switch { margin: 0; border-radius: var(--radius-control); }
.appearance-switch button { display: flex; align-items: center; justify-content: center; gap: 5px; min-height: 30px; font-size: var(--type-label); }
.appearance-switch button svg { width: 14px; height: 14px; }
.appearance-switch button.active { box-shadow: none; font-weight: 500; }

.channels-heading, .channel-toolbar, .channels, .channel-footnote { max-width: 44rem; }
.channel-toolbar { gap: 12px; margin-block: 8px 12px; }
.channel-total, .channel-filters button, .channel-search input { font-size: var(--type-label); }
.channels .channel {
  min-height: 55px;
  gap: 12px;
  padding: 8px 12px;
  border-bottom-width: var(--stroke);
}
.channels .channel .social { inline-size: 36px; block-size: 36px; min-inline-size: 36px; }
.channels .channel .social > span { font-size: 24px; }
.channels .channel > button { min-inline-size: 76px; margin: 0; }
.channel-filters button:hover { background: var(--key); }
.channel-filters button.active { background: var(--selected); color: var(--ink); font-weight: 500; }

.modal-backdrop { background: var(--scrim); }
.modal {
  border: var(--stroke) solid var(--line);
  border-radius: var(--radius-window);
  backdrop-filter: blur(var(--blur));
}
.modal-head { border-bottom-width: var(--stroke); padding: 8px 16px; }
.modal-head h2 { font-size: var(--type-body); font-weight: 500; letter-spacing: normal; }
.modal-head button, body.adaptive-shell .post-menu, .account-menu {
  border-width: var(--stroke);
  border-radius: var(--radius-control);
}
.modal-head button:hover, .account-menu button:hover { background: var(--key); }
.modal-head button { width: 32px; height: 32px; }
.modal-head button svg { width: 16px; height: 16px; }
.composer { gap: 16px; padding: 16px; }
.editor textarea { padding: 12px; }
.account-option { border-bottom-width: var(--stroke); }
.account-option :is(span,small) { overflow-wrap: anywhere; }
.account-option input:checked { background: var(--ink); }
.preview-head, .preview-footer { font-size: var(--type-caption); }
.preview-head { padding: 12px; }
.preview-caption { font-size: var(--type-body); padding: 12px; }
.preview-caption:empty { display: none; }
.real-metrics th, .real-metrics td { padding: 12px; }
.real-metrics th, .metric-summary label { font-size: var(--type-label); }
.metric-summary strong { font-variant-numeric: tabular-nums; }
.assistant-list h2 { font-weight: 500; }
.assistant-list p { font-size: var(--type-label); }

.auth-shell { border-width: var(--stroke); border-radius: var(--radius-window); }
.auth-left {
  isolation: isolate;
  position: relative;
  background: var(--glass);
  backdrop-filter: none;
}
.auth-eyebrow { display: none; }
.auth-content h1 { margin: 0; }
.auth-subtitle { margin-block: 8px 16px; }
.auth-form > label, .auth-options, .auth-switch { font-size: var(--type-label); }
.auth-form input:not([type=checkbox]) { min-height: 36px; }
.auth-action-page { padding: 24px; border-radius: var(--radius-window); }
.auth-art { padding: 0; }
.auth-mode .auth-shell { --setup-artwork: url('assets/adaptive-setup.jpg'); }

/* Full-height Setup uses the original 37vw illustration split and scrollable canvas. */
.setup-screen {
  --setup-content-width: 670px;
  --setup-content-gutter: clamp(20px, 4vw, 48px);
  inset: 0;
  grid-template-columns: clamp(272px, 37vw, 590px) minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr);
  border: 0;
  border-radius: 0;
  background: var(--surface);
  backdrop-filter: none;
}
.setup-illustration {
  display: block;
  min-height: 0;
  overflow: hidden;
  background: var(--rail);
  border-inline-end: var(--stroke) solid var(--line);
}
.setup-illustration img { display: block; width: 100%; height: 100%; object-fit: cover; }
.setup-pane {
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  background: var(--surface);
}
@media (prefers-reduced-transparency: no-preference) and (forced-colors: none) {
  @supports (backdrop-filter: blur(1px)) {
    .setup-pane { --setup-footer-surface: transparent; position: relative; isolation: isolate; }
    :is(.setup-pane,.auth-left)::before, :is(.setup-pane,.auth-left)::after {
      content: '';
      position: absolute;
      inset: 0;
      pointer-events: none;
    }
    :is(.setup-pane,.auth-left)::before { z-index: -2; background: center / cover no-repeat var(--setup-artwork); }
    :is(.setup-pane,.auth-left)::after { z-index: -1; background: var(--glass); backdrop-filter: blur(var(--blur)); }
  }
}
.setup-body {
  display: grid;
  align-content: start;
  gap: 16px;
  width: min(100%, var(--setup-content-width));
  max-width: none;
  min-height: 0;
  margin: 0 auto;
  padding: clamp(26px, 7dvh, 68px) var(--setup-content-gutter) 16px;
  overflow: auto;
  scrollbar-width: thin;
  overscroll-behavior: contain;
}
.setup-heading, .setup-stage { display: grid; gap: 12px; min-inline-size: 0; }
.setup-heading p { margin: 0; color: var(--muted); font-size: var(--type-label); line-height: 1.5; }
.setup-topbar { padding: 0; font-size: var(--type-label); color: var(--muted); }
.setup-topbar strong { font: inherit; }
.setup-heading-body { display: flex; align-items: center; gap: 12px; }
.setup-progress {
  display: grid;
  grid-template-columns: minmax(0,1fr) auto;
  align-items: center;
  gap: 9px;
  margin: 0;
  color: var(--muted);
  font-size: var(--type-caption);
}
.setup-progress > span { height: auto; background: none; }
.setup-track { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 3px; }
.setup-track span { block-size: 3px; border-radius: var(--radius-round); background: var(--line); }
.setup-track span.done { background: var(--ink); }
.setup-heading .setup-back {
  display: grid;
  place-items: center;
  flex: none;
  padding: 0;
  min-block-size: 44px;
  inline-size: 44px;
}
.setup-back svg { width: 16px; height: 16px; }
.setup-options, .setup-summary {
  overflow: hidden;
  border: var(--stroke) solid var(--line);
  border-radius: var(--radius-card);
  background: var(--control);
}
.setup-option {
  display: grid;
  grid-template-columns: auto minmax(0,1fr) auto;
  min-height: 55px;
  align-items: center;
  gap: 12px;
  margin: 0;
  padding: 8px 12px;
  background: transparent;
  border: 0;
  border-radius: 0;
}
.setup-option + .setup-option, .setup-summary > div + div { border-block-start: var(--stroke) solid var(--line); }
.setup-option:hover { background: var(--key); }
.setup-option .glyph-wrap { inline-size: 40px; block-size: 40px; }
.setup-option .social { inline-size: 40px; block-size: 40px; }
.setup-option .social > span { font-size: 26px; }
.setup-option-copy { min-width: 0; overflow-wrap: anywhere; }
.setup-option strong { font-size: var(--type-body); font-weight: 500; }
.setup-option small { margin-top: 3px; font-size: var(--type-label); line-height: 1.45; }
.setup-stage .settings-note { margin: 0; }
.setup-brand-form { padding: 12px; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; }
.setup-brand-form > :is(label:first-child,.error) { grid-column: 1 / -1; }
.setup-brand-form label { min-width: 0; gap: 4px; font-size: var(--type-label); }
.setup-brand-form .error:empty { display: none; }
.setup-summary { margin: 0; padding: 0; gap: 0; }
.setup-summary > div { padding: 12px; align-items: center; font-size: var(--type-body); }
.setup-summary dt { color: var(--muted); font-size: var(--type-label); }
.setup-summary dd { margin: 0; font-weight: 500; overflow-wrap: anywhere; text-align: end; }
.setup-footer {
  justify-content: end;
  margin-inline: auto;
  inline-size: min(100%, var(--setup-content-width));
  gap: 8px;
  padding: 12px var(--setup-content-gutter);
  border-top-width: var(--stroke);
  background: var(--setup-footer-surface, var(--surface));
}
.setup-screen .plain-button, .setup-brand-form .input { border-radius: calc(var(--radius-control) + 3px); }
.setup-stage .plain-button { display: inline-flex; align-items: center; gap: 8px; }
.setup-stage .plain-button svg { inline-size: 14px; block-size: 14px; }
.setup-link { color: var(--ink); min-height: 36px; padding: 4px 6px; border-radius: var(--radius-control); text-decoration: underline; font-size: var(--type-label); }
.setup-link:hover { background: var(--key); }

@media (min-width: 901px) {
  body.adaptive-shell .post .socials:not(:has(.destination:nth-child(6))) .social {
    width: 18px;
    height: 18px;
    min-width: 18px;
  }
}
@media (max-width: 1020px) {
  .settings-layout { grid-template-columns: 1fr; }
  .settings-layout .settings-aside { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 210px), 1fr)); align-items: start; }
}
@media (max-width: 900px) {
  body.adaptive-shell .nav-item { gap: 8px; padding-inline: 7px; }
  body.adaptive-shell .nav-item > .reference-nav-icon { flex-basis: 30px; inline-size: 30px; block-size: 30px; }
  body.adaptive-shell .nav-item .reference-nav-icon svg { inline-size: 18px; block-size: 18px; }
  body.adaptive-shell .nav-item .reference-chevron svg { inline-size: 11px; block-size: 11px; }
  .reference-nav-copy { font-size: var(--type-label); }
  body.adaptive-shell .post-open .caption { font-size: var(--type-label); }
  body.adaptive-shell .post-times { font-size: 10px; }
  .composer .preview { display: block; }
}
@media (max-width: 850px) {
  .setup-screen {
    --setup-content-gutter: clamp(16px, 4vw, 28px);
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: clamp(144px, 23dvh, 230px) minmax(0, 1fr);
  }
  .setup-illustration { border-inline-end: 0; border-block-end: var(--stroke) solid var(--line); }
  .setup-illustration img { object-position: center 40%; }
  .setup-screen[data-step=connections] .setup-illustration img { object-position: center 33%; }
  .setup-screen[data-step=ready] .setup-illustration img { object-position: center 36%; }
  .setup-body { padding-block-start: 16px; gap: 12px; }
  .setup-footer button, .setup-stage .plain-button, .setup-brand-form .input { min-block-size: 44px; }
  .setup-footer .primary { flex: 1; }
  .auth-left { --setup-artwork: none; }
}
@media (max-width: 760px) {
  .settings-row { grid-template-columns: 34px minmax(0, 1fr); gap: 8px; }
  .settings-row .glyph-wrap { inline-size: 34px; block-size: 34px; }
  .settings-row .glyph-wrap svg { inline-size: 18px; block-size: 18px; }
  .settings-row > label :is(input, select) { grid-column: 2; }
  .channels .channel-copy { flex-basis: calc(100% - 52px); }
  .channels .channel > button { margin-inline-start: 48px; }
}
@media (max-width: 650px) {
  body.adaptive-shell .post-open .caption { font-size: var(--type-caption); }
  body.adaptive-shell .post-times { font-size: 9px; }
}
@media (max-width: 440px) {
  body.adaptive-shell .nav-item .reference-chevron { display: none; }
  .setup-brand-form { grid-template-columns: minmax(0, 1fr); }
  .settings-row > label :is(input, select), .channel-search input { font-size: var(--type-label); }
}
@media (max-width: 850px) and (max-height: 590px) {
  .setup-screen { grid-template-rows: 86px minmax(0, 1fr); }
}
@media (min-width: 540px) and (max-width: 850px) and (max-height: 460px) {
  .setup-screen { grid-template-columns: min(27vw, 220px) minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); }
  .setup-illustration { border-inline-end: var(--stroke) solid var(--line); border-block-end: 0; }
}
@media (prefers-reduced-transparency: reduce) {
  :root, :root[data-theme=dark] { --glass: var(--surface); --rail-glass: var(--rail); --blur: 0px; }
}
@media (forced-colors: active) {
  .nav-item[aria-current], .tab.active { outline: 2px solid Highlight; outline-offset: -2px; }
}
