.calls-page, .settings-page {
  display: grid;
  height: 100dvh;
  grid-template-rows: auto minmax(0, 1fr);
}

/* Shared settings and profile language, matched to the mobile reference system. */
.ios-settings-form,
.ios-profile {
  --ios-component-card: var(--surface);
  --ios-component-line: var(--line);
  --ios-component-label: var(--text);
  --ios-component-secondary: var(--muted);
  --ios-component-accent: var(--accent-text);
}
.ios-settings-form { display: grid; gap: 24px; }
.ios-settings-section { display: grid; gap: 8px; scroll-margin-top: 82px; }
.ios-settings-section > h2 {
  padding-inline: 16px;
  color: var(--ios-component-secondary);
  font-size: 13px;
  font-weight: 400;
  letter-spacing: .02em;
  text-transform: uppercase;
}
.ios-settings-card {
  overflow: hidden;
  border: 1px solid var(--ios-component-line);
  border-radius: 20px;
  background: var(--ios-component-card);
}
.ios-setting-row {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 56px;
  padding: 10px 16px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--ios-component-label);
  font-size: 16px;
  font-weight: 400;
  line-height: 1.25;
  text-align: start;
}
.ios-setting-row + .ios-setting-row::before {
  position: absolute;
  inset: 0 16px auto;
  border-top: 1px solid var(--ios-component-line);
  content: '';
}
.ios-setting-row:has(.ios-setting-tile) + .ios-setting-row:has(.ios-setting-tile)::before { inset-inline-start: 58px; }
:is(a,button).ios-setting-row:is(:hover,:active) { background: color-mix(in srgb, var(--ios-component-label) 7%, transparent); }
:is(a,button).ios-setting-row:focus-visible { outline-offset: -3px; }
.ios-setting-row > :is(svg,.app-icon):last-child { flex: none; color: #636366; }
.ios-setting-copy { display: grid; flex: 1; min-width: 0; gap: 2px; }
.ios-setting-label { min-width: 0; overflow-wrap: anywhere; }
.ios-setting-detail { color: var(--ios-component-secondary); font-size: 13px; line-height: 1.25; }
.ios-setting-value { flex: none; max-width: 45%; color: var(--ios-component-secondary); text-align: end; overflow-wrap: anywhere; }
.ios-setting-row.is-danger,
.ios-inline-danger { color: #ff453a; }
.ios-setting-tile {
  display: grid;
  place-items: center;
  flex: 0 0 30px;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: #409cff;
  color: #fff;
}
.ios-setting-tile[data-tone="green"] { background: #34c759; }
.ios-setting-tile[data-tone="orange"] { background: #ff9f0a; }
.ios-setting-tile[data-tone="purple"] { background: #655be8; }
.ios-setting-tile[data-tone="red"] { background: #ff453a; }
.ios-setting-tile[data-tone="gray"] { background: #636366; }
.ios-toggle-row { cursor: pointer; }
.ios-toggle-row input,
.ios-radio-row input {
  position: absolute;
  inset-inline-end: 16px;
  z-index: 1;
  margin: 0;
  opacity: 0;
  cursor: pointer;
  pointer-events: auto;
}
.ios-toggle-row input { width: 51px; height: 31px; }
.ios-radio-row input { width: 24px; height: 24px; }
.ios-switch {
  position: relative;
  flex: 0 0 51px;
  width: 51px;
  height: 31px;
  border-radius: 999px;
  background: #39393d;
  box-shadow: inset 0 0 0 1px rgb(255 255 255 / .035);
  transition: background-color .18s ease;
}
.ios-switch::after {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 27px;
  height: 27px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 5px rgb(0 0 0 / .28);
  content: '';
  transition: translate .18s cubic-bezier(.2,.8,.2,1);
}
.ios-toggle-row input:checked + .ios-switch { background: #34c759; }
.ios-toggle-row input:checked + .ios-switch::after { translate: 20px 0; }
.ios-toggle-row input:focus-visible + .ios-switch,
.ios-radio-row input:focus-visible + .ios-radio-check { outline:none; }
.ios-select-row { cursor: pointer; }
.ios-select-row > .ios-setting-label { flex: 1; }
.ios-setting-select { display: flex; align-items: center; flex: none; min-width: 0; color: var(--ios-component-secondary); }
.ios-setting-select select {
  appearance: none;
  width: auto;
  max-width: min(45vw, 240px);
  min-height: 38px;
  padding: 0 7px 0 4px;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: end;
  text-align-last: end;
}
.ios-setting-select > :is(svg,.app-icon) { color: #636366; }
.ios-radio-row { cursor: pointer; }
.ios-radio-row > .ios-setting-label { flex: 1; }
.ios-radio-check {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border: 1px solid #636366;
  border-radius: 50%;
  color: transparent;
}
.ios-radio-row input:checked + .ios-radio-check { border-color: #409cff; background: #409cff; color: #fff; }
.ios-settings-note { padding-inline: 16px; color: var(--ios-component-secondary); font-size: 13px; line-height: 1.35; }
.ios-settings-empty { display: grid; justify-items: center; gap: 8px; padding: 24px 16px; color: var(--ios-component-secondary); text-align: center; }
.ios-person-row .avatar { width: 38px; height: 38px; }
.ios-person-row .ios-setting-label { flex: 1; }
.ios-inline-danger { min-height: 38px; padding: 6px 0 6px 12px; border: 0; background: transparent; }
.ios-field-row {
  position: relative;
  display: grid;
  gap: 4px;
  padding: 10px 16px;
  color: var(--ios-component-secondary);
  font-size: 13px;
}
.ios-field-row + .ios-field-row { border-top: 1px solid var(--ios-component-line); }
.ios-field-row :is(input,textarea) {
  width: 100%;
  min-height: 28px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--ios-component-label);
  font-size: 16px;
  resize: vertical;
}
.ios-field-row textarea { min-height: 64px; line-height: 1.35; }
.ios-field-row :is(input,textarea):focus { outline: 0; }
.ios-field-row:focus-within { box-shadow:none; }
.ios-save-button {
  width: 100%;
  min-height: 50px;
  padding: 10px 20px;
  border: 0;
  border-radius: 16px;
  background: #409cff;
  color: #fff;
  font-size: 17px;
  font-weight: 600;
}
.ios-passcode-form { display: grid; }
.ios-passcode-form .field { gap: 4px; padding: 10px 16px; color: var(--ios-component-secondary); font-size: 13px; }
.ios-passcode-form .field + .field { border-top: 1px solid var(--ios-component-line); }
.ios-passcode-form .field input {
  min-height: 30px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--ios-component-label);
  font-size: 16px;
}
.ios-passcode-form .ios-save-button { width: calc(100% - 24px); margin: 12px; }
.ios-passcode-form > .error { padding: 0 16px 12px; }
.ios-edit-profile-photo { display: grid; justify-items: center; }
.ios-edit-profile-photo .ios-profile-photo { gap: 10px; color: var(--ios-component-accent); }
.ios-edit-profile-photo .avatar { width: 96px; height: 96px; font-size: 31px; }

.ios-profile { display: grid; gap: 24px; }
.ios-profile-nav { display: none; }
.ios-profile-hero { display: grid; justify-items: center; gap: 3px; padding-top: 8px; text-align: center; }
.ios-profile-photo { display: grid; justify-items: center; padding: 0; border: 0; background: transparent; }
.ios-profile-hero .avatar { width: 104px; height: 104px; margin-bottom: 11px; font-size: 34px; }
.ios-profile-hero h1 { font-size: 28px; font-weight: 600; letter-spacing: -.02em; }
.ios-profile-hero p { color: var(--ios-component-secondary); font-size: 16px; }
.ios-profile-info { overflow: hidden; border: 1px solid var(--ios-component-line); border-radius: 22px; background: var(--ios-component-card); }
.ios-profile-info > div { position: relative; display: grid; gap: 2px; min-height: 62px; padding: 10px 16px; }
.ios-profile-info > div + div::before { position: absolute; inset: 0 16px auto; border-top: 1px solid var(--ios-component-line); content: ''; }
.ios-profile-info span { font-size: 13px; }
.ios-profile-info strong { padding-inline-end: 42px; color: var(--ios-component-accent); font-size: 17px; overflow-wrap: anywhere; }
.ios-profile-info-action { position: absolute; right: 8px; bottom: 5px; color: var(--ios-component-accent); }
.ios-profile-story-tabs { display: flex; justify-content: center; align-items: center; gap: 16px; }
.ios-profile-story-tabs a,
.ios-profile-story-tabs button { min-height: 42px; padding: 8px 18px; border: 1px solid var(--ios-component-line); border-radius: 999px; background: var(--ios-component-card); color: var(--ios-component-label); font-size: 15px; }
.ios-profile-story-tabs button { border-color: transparent; background: transparent; }
.ios-profile-story-state { display: grid; justify-items: center; gap: 10px; padding: 0 24px 8px; text-align: center; }
.ios-profile-story-state > .app-icon {
  display: grid;
  place-items: center;
  width: 92px;
  height: 92px;
  border-radius: 26px;
  background: linear-gradient(145deg,#52b8ff,#5c55eb 58%,#cf56d9);
  color: #fff;
  box-shadow: inset 0 1px 0 rgb(255 255 255 / .35), 0 10px 28px rgb(79 90 238 / .25);
}
.ios-profile-story-state h2 { font-size: 20px; font-weight: 600; }
.ios-profile-story-state p { max-width: 310px; color: var(--ios-component-secondary); font-size: 15px; line-height: 1.35; }
.ios-profile-story-state .primary { width: min(100%, 310px); min-height: 50px; border-radius: 16px; background: #409cff; font-size: 17px; font-weight: 600; }

@media (max-width: 760px) {
  [data-phone-app] {
    --settings-background: #000;
    --settings-panel: #1c1c1e;
  }
  [data-phone-app][data-theme="Light"] {
    --settings-background: #f2f2f7;
    --settings-panel: #fff;
  }
  [data-phone-app] .settings-detail-page,
  [data-phone-app] .profile-page {
    width: 100%;
    min-height: 100dvh;
    padding: 0 16px max(24px,env(safe-area-inset-bottom));
    background: var(--settings-background);
    color: var(--ios-label);
    font-family: -apple-system,BlinkMacSystemFont,system-ui,sans-serif;
  }
  [data-phone-app] .settings-detail-page .page-heading {
    position: sticky;
    top: 0;
    z-index: 4;
    min-height: calc(70px + env(safe-area-inset-top));
    margin: 0 -16px 18px;
    padding: max(12px,env(safe-area-inset-top)) 16px 8px;
    border: 0;
    background: color-mix(in srgb,var(--settings-background) 92%,transparent);
  }
  [data-phone-app] .settings-detail-page .page-heading > .flow:first-child { width: 100%; }
  [data-phone-app] .settings-detail-page .page-heading h1 {
    position: absolute;
    left: 50%;
    max-width: calc(100% - 124px);
    translate: -50% 0;
    font-size: 18px;
    font-weight: 600;
    letter-spacing: -.01em;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  [data-phone-app] .settings-detail-page .page-heading .back {
    display: grid;
    place-items: center;
    width: 44px;
    min-height: 44px;
    margin: 0;
    border: 1px solid #3a3a3c;
    border-radius: 50%;
    background: var(--settings-panel);
    color: var(--ios-label);
  }
  [data-phone-app] .settings-detail-page .page-content { display: block; }
  [data-phone-app] .ios-settings-form,
  [data-phone-app] .ios-profile {
    --ios-component-card: var(--settings-panel);
    --ios-component-line: rgba(84,84,88,.45);
    --ios-component-label: var(--ios-label);
    --ios-component-secondary: var(--ios-secondary);
    --ios-component-accent: var(--ios-accent);
  }
  [data-phone-app] .ios-settings-card { border: 0; border-radius: 22px; }
  [data-phone-app] .ios-setting-row { min-height: 56px; font-size: 17px; }
  [data-phone-app] .ios-settings-section > h2 { padding-inline: 16px; color: var(--ios-secondary); font-size: 13px; }
  [data-phone-app] .ios-settings-note { color: var(--ios-secondary); font-size: 13px; }
  [data-phone-app] .ios-save-button { background: #409cff; }
  [data-phone-app] .profile-page > .page-heading { display: none; }
  [data-phone-app] .profile-page > .page-content { display: block; margin: 0; }
  [data-phone-app] .ios-profile { padding-top: 0; }
  [data-phone-app] .ios-profile-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: calc(66px + env(safe-area-inset-top));
    padding-top: env(safe-area-inset-top);
  }
  [data-phone-app] .ios-round-button,
  [data-phone-app] .ios-profile-nav :is(.icon-button,.ios-profile-edit) {
    display: grid;
    place-items: center;
    min-width: 44px;
    height: 44px;
    padding: 0 12px;
    border: 1px solid #3a3a3c;
    border-radius: 999px;
    background: var(--settings-panel);
    color: var(--ios-label);
  }
  [data-phone-app] .ios-round-button { width: 44px; padding: 0; }
  [data-phone-app] .ios-profile-nav-actions { display: flex; align-items: center; gap: 8px; }
  [data-phone-app] .ios-profile-hero { margin-top: -20px; }
  [data-phone-app] .ios-profile-info { border: 0; }
  [data-phone-app] .ios-profile .ios-settings-section { margin-top: 6px; }
  [data-phone-app] .profile-edit-page .ios-settings-form { gap: 24px; }
  [data-phone-app] .settings-phone { gap: 20px; }
  [data-phone-app] .settings-panel { border-radius: 22px; }
  [data-phone-app] .settings-panel > .settings-row { min-height: 54px; padding-block: 10px; }
  [data-phone-app] .settings-phone > .settings-signout {
    width: 100%;
    min-height: 54px;
    margin-bottom: max(24px,env(safe-area-inset-bottom));
    border: 0;
    border-radius: 22px;
    background: var(--settings-panel);
    color: #ff453a;
    font-size: 17px;
  }
}

@media (prefers-color-scheme: light) and (max-width: 760px) {
  [data-phone-app][data-theme="System"] {
    --settings-background: #f2f2f7;
    --settings-panel: #fff;
  }
}

@media (prefers-reduced-motion: reduce) {
  .ios-switch,
  .ios-switch::after { transition: none; }
}
:is(.calls-scroll, .settings-page > .page-content) {
  align-content: start;
  margin-inline-end: calc(-1 * var(--scrollbar-size));
  padding-inline-end: var(--scrollbar-size);
  overflow-y: auto;
  overscroll-behavior-y: contain;
  scrollbar-gutter: stable;
  --scrolling-thumb: transparent;
}
:is(.calls-scroll, .settings-page > .page-content)[data-scrolling] { --scrolling-thumb: var(--scrollbar-thumb); }
.utility-shell .calls-page > .calls-scroll {
  min-width: 0;
  margin-inline-end: 0;
  padding-inline-end: 12px;
  grid-template-columns: minmax(0,1fr);
  row-gap: 0;
  overflow-x: hidden;
  scrollbar-gutter: stable;
}
.calls-scroll .call-history-section { min-width:0; max-width:100%; }
@media (forced-colors: none) {
  @supports selector(::-webkit-scrollbar) {
    :is(.calls-scroll, .settings-page > .page-content)::-webkit-scrollbar-thumb { background: var(--scrolling-thumb); }
  }
  @supports not selector(::-webkit-scrollbar) {
    :is(.calls-scroll, .settings-page > .page-content) { scrollbar-color: var(--scrolling-thumb) transparent; }
  }
}

.calls-header {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}
.calls-header h1 { grid-column: 1 / -1; margin: 0 0 6px; }
.calls-header [data-action="call-history-edit"] { grid-column: 1; grid-row: 2; justify-self: start; }
.calls-header .tabs { grid-column: 2; grid-row: 2; }
.calls-header [data-action="new-call"] { grid-column: 3; grid-row: 2; justify-self: end; color: var(--accent-text); }
.calls-header .calls-delete-all { grid-column:3; grid-row:2; justify-self:end; white-space:nowrap; padding-inline:10px; }
.calls-page.calls-editing .calls-header .calls-edit-control {
  width:44px; min-width:44px; height:44px; padding:0; border-radius:50%;
  border-color:#4097ff; background:#4097ff; color:#fff;
}
.calls-new-call-row {
  display:flex; align-items:center; gap:16px; width:100%; min-height:54px;
  padding:4px 4px; border:0; border-bottom:1px solid var(--line);
  border-radius:0; background:none; color:var(--accent-text); font-size:17px; text-align:start;
}
[data-phone-app] .calls-new-call-row { color:var(--ios-accent); border-color:var(--ios-border); }
[data-phone-app] .calls-header .calls-delete-all {
  min-height:44px; border:1px solid var(--ios-border); background:var(--ios-header);
  color:var(--ios-label); font-size:17px; font-weight:500; border-radius:999px;
}
.calls-page .call-remove-control {
  display:grid; place-items:center; flex:0 0 32px; width:32px; min-height:44px;
  padding:0; border:0; background:none;
}
.call-remove-face { display:grid; place-items:center; width:22px; height:22px; border-radius:50%; background:#ff453a; color:#fff; }
.calls-editing .call-history-link:disabled { opacity:1; cursor:default; }
.call-history-section h2 {
  margin: 10px 13px 5px;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}
.call-history { margin: 0; padding: 0; list-style: none; }
.call-history-row { position: relative; display: flex; align-items: center; gap: 2px; }
.call-history-row + .call-history-row::before {
  content: '';
  position: absolute;
  inset: 0 0 auto 71px;
  border-top: 1px solid var(--line);
  pointer-events: none;
}
.call-history-link {
  display: grid;
  grid-template-columns: 15px 40px minmax(0,1fr) auto;
  align-items: center;
  gap: 8px;
  min-height: 55px;
  min-width: 0;
  flex: 1;
  color: inherit;
}
.call-history-link .avatar { width: 40px; height: 40px; }
.call-history-copy { display: grid; min-width: 0; }
.call-history-copy > * { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.call-history-copy strong { font-size: 16px; }
.call-history-copy .call-history-detail { display:flex; align-items:center; gap:5px; min-width:0; }
.call-history-detail > .app-icon { flex:none; }
.call-history-detail > span { min-width:0; white-space:normal; overflow-wrap:anywhere; }
.call-history-row.is-missed .call-history-copy strong { color: var(--danger); }
.call-history-link :is(time, .call-direction, .call-history-copy > span) { color: var(--muted); }
.call-history-link time { font-size: 13px; white-space: nowrap; }
.call-history-row > .icon-button { color: var(--accent-text); width: 44px; }
.call-history-row > [data-action="call-history-remove"] { color: var(--danger); }

[data-phone-app] .utility-shell .calls-page {
  padding-inline: 12px calc(12px + var(--scrollbar-size));
}
[data-phone-app] .utility-shell:has(.ios-dock) > :is(.calls-page, .settings-page) { padding-bottom: 0; }
[data-phone-app] :is(.calls-scroll, .settings-page > .page-content) {
  padding-bottom: calc(86px + var(--ios-dock-bottom));
  scroll-padding-bottom: calc(86px + var(--ios-dock-bottom));
}
[data-phone-app] .calls-header {
  position: relative;
  z-index: 3;
  padding-top: max(10px, env(safe-area-inset-top));
  background: var(--ios-list);
}
[data-phone-app] .calls-header h1 {
  position: absolute;
  width: 1px;
  height: 1px;
  clip-path: inset(50%);
}
[data-phone-app] .calls-header > :is(button, .tabs) { grid-row: 1; }
[data-phone-app] .calls-header [data-action="new-call"] { width: 44px; height: 44px; }
[data-phone-app] .calls-header .tabs .pill { padding-inline: 14px; font-size: 14px; }
[data-phone-app] .calls-header .tabs .pill { color: var(--ios-label); }
[data-phone-app] .calls-header [data-action="new-call"] { color: var(--ios-accent); }

.action-list {
  overflow: hidden;
  background: color-mix(in srgb, var(--surface) 91%, var(--text));
  border-radius: 12px;
}
.action-row {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 48px;
  padding: 9px 13px;
  border: 0;
  background: transparent;
  color: inherit;
  font-size: 14px;
  text-align: start;
}
.action-row + .action-row { border-top: 1px solid var(--line); }
.action-row > span { min-width: 0; overflow-wrap: anywhere; }
.action-row > :is(svg,.app-icon) { color: var(--accent-text); }
.action-row.danger > :is(svg,.app-icon) { color: inherit; }
.action-row:is(:hover,:active) { background: var(--hover); }
.action-row:focus-visible { outline-offset: -3px; border-radius: 6px; }
.action-row[aria-pressed="true"]::after {
  content: '';
  flex: none;
  width: 6px;
  height: 11px;
  margin-inline-start: auto;
  border: solid var(--accent-text);
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}
.action-row[data-chat-theme] > :is(svg,.app-icon) {
  padding: 3px;
  border-radius: 6px;
  background: var(--chat-tint, var(--bg));
}

:root {
  --action-fill: color-mix(in srgb, var(--accent) 76%, #000);
  --panel-radius: 18px;
  --control-radius: 12px;
  --touch-target: 44px;
  --scrollbar-size: 4px;
  --scrollbar-thumb: color-mix(in srgb, var(--muted) 65%, transparent);
  -webkit-tap-highlight-color: transparent;
}

@media (forced-colors: none) {
  @supports selector(::-webkit-scrollbar) {
    ::-webkit-scrollbar { width: var(--scrollbar-size); height: var(--scrollbar-size); }
    ::-webkit-scrollbar-track,
    ::-webkit-scrollbar-corner { background: transparent; border: 0; }
    ::-webkit-scrollbar-thumb {
      background: var(--scrollbar-thumb);
      border: 0;
      border-radius: 999px;
    }
  }
  @supports not selector(::-webkit-scrollbar) {
    * {
      scrollbar-width: thin;
      scrollbar-color: var(--scrollbar-thumb) transparent;
    }
  }
}

@media (prefers-reduced-motion: no-preference) {
  :is(.primary, .secondary, .text-button, .icon-button, .folder-tab, .ios-glass) {
    transition: scale 100ms cubic-bezier(.2,.78,.22,1), background-color 100ms ease, color 100ms ease;
  }
  :is(button, a):is(.primary, .secondary, .text-button, .icon-button, .folder-tab, .ios-glass):active:not(:disabled) {
    scale: .96;
  }
}

:is(.primary, .secondary, .text-button, .icon-button):active:not(:disabled) { filter: brightness(.92); }
.primary:hover:not(:disabled) { background: color-mix(in srgb, var(--action-fill) 86%, var(--text)); }

:is(.icon-button, .chat-rows a, .folder-tab, .table-wrap, .admin-sections a):focus-visible {
  outline-offset: -3px;
}

@media (any-pointer: coarse) {
  :is(.icon-button, .menu-link, .item-link, .settings-button):active:not(:disabled) {
    background-color: var(--hover);
  }
}

.search-field:focus-within, .phone-box:focus-within {
  outline:none;
}

.search-field input:focus, .phone-box input:focus {
  outline: none;
}

.composer-field:has(textarea[name="text"]:focus-visible) { outline:none; }
.composer-field textarea[name="text"]:focus-visible { outline: none; }


.primary,
.chat-list .folder-badge.has-unmuted,
.chat-rows .item-link:not(.box) .unread {
  background: var(--action-fill);
}

.auth:not(.admin-auth) {
  background: radial-gradient(ellipse at 50% 0%, color-mix(in srgb, var(--accent) 12%, transparent), transparent 65%), var(--bg);
}

.auth:not(.admin-auth) .auth-panel {
  width: min(100%, 450px);
  padding: clamp(19px, 5vw, 32px);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 26px;
  box-shadow: 0 14px 48px var(--bubble-shadow);
}

.auth-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 19px;
  font-size: 15px;
}

.auth-brand .logo { width: 64px; margin: 0; }

.auth-panel h1 { letter-spacing: -.03em; }
.auth-panel .intro { margin: 8px 0 20px; }
.auth-panel .stack { gap: 13px; }
.auth-panel .primary { border-radius: var(--control-radius); text-transform: none; }
.auth-panel .auth-links { border-top: 1px solid var(--line); padding-top: 10px; }
.auth-options, .auth-alternatives {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0 10px;
}
.auth-options { justify-content: space-between; }
.auth-alternatives { justify-content: center; }
.auth-options .text-button { padding-inline: 0; }
.auth-panel .legal { margin-top: 12px; }
.auth-apk-download { display:flex; align-items:center; justify-content:center; gap:12px; min-height:64px; margin-top:16px; padding:12px 16px; border:1px solid var(--line); border-radius:16px; color:var(--accent-text); text-decoration:none; background:var(--surface); }
.auth-apk-download > span { display:grid; gap:3px; min-width:0; }
.auth-apk-download strong { font-size:14px; line-height:1.4; }
.auth-apk-download small { color:var(--muted); font-size:12px; line-height:1.4; }
.auth-apk-download:is(:active,:focus-visible) { background:var(--hover); }
.auth-language { align-items: center; }
.auth-language .text-button:disabled { opacity: 1; color: var(--muted); }

.inbox-empty { padding-inline: 20px; }
.inbox-empty .placeholder-icon, .chat-panel .conversation-placeholder .placeholder-icon {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  color: var(--accent-text);
  background: color-mix(in srgb, var(--accent) 14%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--accent) 26%, var(--line));
  border-radius: var(--panel-radius);
}
.conversation-placeholder { display: grid; justify-items: center; gap: 8px; }
.chat-row-time, .message time, .metric strong { font-variant-numeric: tabular-nums; }

.utility-shell .page-content { gap: 16px; }
.utility-shell .settings-page { width: min(100%, 880px); }

.utility-shell:has(> .settings-page) .sidebar-foot .icon-button[data-action="logout"] {
  display: none;
}
.settings-signout {
  width: 100%;
  min-height: 48px;
  padding: 10px 16px;
  border-radius: 999px;
  font-size: 15px;
  font-weight: 400;
  box-shadow: inset 0 1px 0 rgb(255 255 255 / .22);
}

.utility-shell .icon-button[data-action="logout"] {
  width: var(--touch-target);
  height: var(--touch-target);
  padding: 0;
  border-radius: 50%;
}
.utility-shell :is(.icon-button, .settings-signout)[data-action="logout"] {
  border: 1px solid color-mix(in srgb, var(--text) 16%, transparent);
  background-color: var(--glass-surface);
  color: var(--danger);
  -webkit-backdrop-filter: var(--glass-filter);
  backdrop-filter: var(--glass-filter);
}
.utility-shell :is(.icon-button, .settings-signout)[data-action="logout"]:hover {
  background-color: color-mix(in srgb, var(--glass-surface) 90%, var(--danger));
}
.utility-shell .icon-button[data-action="logout"] :is(svg,.app-icon) {
  color: inherit;
  stroke-width: 1.5;
}
.sidebar-foot:has(.icon-button[data-action="logout"]) {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.sidebar-foot:has(.icon-button[data-action="logout"]) > a {
  min-width: 0;
  margin-bottom: 0;
  overflow-wrap: anywhere;
}

.utility-shell .page-content :is(.box, .shortcut-list) {
  border-radius: var(--panel-radius);
}
.utility-shell .side-link.active {
  background: color-mix(in srgb, var(--accent) 16%, var(--surface));
  color: var(--text);
}
.utility-shell .page-content .shortcut-list > :not(:last-child) {
  border-bottom: 1px solid var(--line);
}
.utility-shell .page-content .shortcut-list .item { padding-inline: 12px; }
.utility-shell .shortcut-list :is(a,button) .item { min-height: 56px; }
.utility-shell .shortcut-list .item > :is(svg,.app-icon):first-child { color: var(--accent-text); }
.utility-shell .page-content :is(.primary, .secondary) { border-radius: var(--control-radius); }
.utility-shell .page-content .item-copy { line-height: 1.35; }
.utility-shell .page-content .box h2 { letter-spacing: -.015em; }
.settings-page .page-content { gap: 20px; }
.settings-desktop { display: grid; gap: 20px; }
.settings-phone { display: none; }

[data-phone-app] {
  --settings-background: #000;
  --settings-panel: #1c1c1c;
}
[data-phone-app][data-theme="Light"] {
  --settings-background: #f2f2f7;
  --settings-panel: #fff;
}
@media (prefers-color-scheme: light) {
  [data-phone-app][data-theme="System"] {
    --settings-background: #f2f2f7;
    --settings-panel: #fff;
  }
}
[data-phone-app] .utility-shell > .settings-page {
  grid-template-rows: minmax(0, 1fr);
  padding-inline: 0;
  background: var(--settings-background);
}
[data-phone-app] .settings-page > .page-heading,
[data-phone-app] .settings-desktop { display: none; }
[data-phone-app] .settings-page > .page-content {
  margin: 0;
  padding-inline: 0;
  scrollbar-width: none;
  scrollbar-gutter: auto;
}
[data-phone-app] .settings-phone {
  display: grid;
  gap: 24px;
  padding-inline: 16px;
  font-family: -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
}
.settings-identity {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 4px;
  padding-block: calc(max(16px, env(safe-area-inset-top)) + 18px) 15px;
  min-width: 0;
  text-align: center;
}
.settings-identity .avatar {
  width: 100px;
  height: 100px;
  margin-bottom: 7px;
  font-size: 33px;
}
.settings-profile-copy { min-width:0; }
.settings-profile-photo { display:grid; padding:0; border:0; border-radius:50%; background:transparent; }
.settings-identity h1 {
  margin: 0;
  font-size: clamp(23px, 7vw, 28px);
  line-height: 1.13;
  overflow-wrap: anywhere;
}
.settings-identity p {
  margin: 0;
  color: var(--ios-secondary);
  font-size: 16px;
  overflow-wrap: anywhere;
}
.settings-profile-toolbar {
  position: absolute;
  inset: max(20px, env(safe-area-inset-top)) 0 auto;
  width: 100%;
  display: flex;
  gap: 10px;
}
.settings-profile-toolbar :is(.icon-button, .settings-edit) {
  height: 44px;
  border: 1px solid var(--ios-border);
  border-radius: 999px;
  background-color: var(--settings-panel);
  color: var(--ios-label);
}
.settings-profile-toolbar .icon-button { width:44px; }
.settings-profile-toolbar [data-action="toggle-settings-search"] { margin-inline-start:auto; }
.settings-edit {
  display: grid;
  place-items: center;
  padding-inline: 13px;
  font-size: 16px;
}
#settings-search .search-field {
  display:flex; align-items:center; gap:8px; min-height:46px; padding-inline:12px;
  background:var(--settings-panel); border:1px solid var(--ios-border); border-radius:14px;
}
#settings-search input { min-width:0; border:0; background:none; }
.settings-no-results { color:var(--ios-secondary); }
.settings-panel {
  overflow: hidden;
  border-radius: 26px;
  background: var(--settings-panel);
}
.settings-panel > .settings-row {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 15px;
  width: 100%;
  min-height: 52px;
  padding: 9px 16px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--ios-label);
  text-align: start;
  font-size: 17px;
  font-weight: 400;
}
.settings-row + .settings-row::before {
  position: absolute;
  inset: 0 16px auto 59px;
  border-top: 1px solid var(--ios-border);
  content: '';
}
.settings-panel > .settings-row:is(:active, :focus-visible) {
  background: var(--ios-highlight);
  outline-offset: -3px;
}
.settings-panel > .settings-row-action { color: var(--ios-accent); }
.settings-row-title { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.settings-row-detail { color: var(--ios-secondary); font-size: 15px; text-align: end; }
.settings-row > :is(svg,.app-icon):last-child { flex: none; color: var(--ios-secondary); opacity: .6; }
.settings-row .avatar, .settings-row-icon {
  display: inline-grid;
  place-items: center;
  flex: 0 0 30px;
  width: 30px;
  height: 30px;
}
.settings-row-icon {
  --settings-tile: #257cd6;
  border-radius: 8px;
  background: var(--settings-tile);
  color: #fff;
}
.settings-row-icon:is([data-icon="Profile"], [data-icon="Notifications"]) { --settings-tile: #e34d49; }
.settings-row-icon[data-icon="Calls"] { --settings-tile: #248e45; }
.settings-row-icon[data-icon="devices"] { --settings-tile: #a96308; }
.settings-row-icon[data-icon="folder"] { --settings-tile: #1687ad; }
.settings-row-icon[data-icon="shield-check"] { --settings-tile: #7959bf; }
.settings-row-action .settings-row-icon { background: transparent; color: inherit; }
.settings-row-badge {
  min-width: 24px;
  padding: 1px 6px;
  border-radius: 999px;
  background: #2477cc;
  color: #fff;
  text-align: center;
  font-size: 14px;
}
.settings-qr-image { width: min(100%, 230px); height: auto; margin-inline: auto; border-radius: 12px; }
.settings-qr-preview { width: 100%; max-height: 38dvh; border-radius: 16px; background: #111; }
.profile-qr-scan { align-self:center; font-size:13px; min-height:32px; }
.settings-group { display: grid; gap: 8px; }
.settings-group h2 { padding-inline: 4px; font-size: 14px; color: var(--muted); }
.settings-group .shortcut-list { padding: 0; overflow: hidden; }
.settings-group .shortcut-list > :is(.item-link, .settings-button) {
  border-radius: 0;
  outline-offset: -3px;
}
.settings-group .shortcut-list > :is(.item-link, .settings-button):is(:hover, :focus-visible, :active) {
  background-color: color-mix(in srgb, var(--accent) 28%, var(--surface));
}
.settings-page .settings-group .shortcut-list .item { padding-inline: 18px; }
.settings-icon {
  --settings-icon-tint: #75adff;
  display: inline-grid;
  place-items: center;
  flex: 0 0 34px;
  height: 34px;
  border: 1px solid rgb(255 255 255 / .28);
  border-bottom-color: rgb(8 14 25 / .42);
  border-radius: 10px;
  background-color: var(--settings-icon-tint);
  color: #18243a;
}
.settings-icon:is([data-icon="sun"], [data-icon="auction"]) { --settings-icon-tint: #ffc068; }
.settings-icon:is([data-icon="globe"], [data-icon="shield-check"]) { --settings-icon-tint: #69dcc3; }
.settings-icon:is([data-icon="Profile"], [data-icon="Bots"]) { --settings-icon-tint: #b69afd; }
.settings-icon:is([data-icon="group"], [data-icon="reply"]) { --settings-icon-tint: #ff96bd; }
.settings-icon:is([data-icon="devices"], [data-icon="People"]) { --settings-icon-tint: #83cde9; }

.settings-icon, .utility-shell .icon-button[data-action="logout"] {
  background-image:
    radial-gradient(ellipse 58% 31% at 27% -2%, rgb(255 255 255 / .82), transparent 100%),
    radial-gradient(ellipse 52% 26% at 76% 106%, rgb(181 230 255 / .64), transparent 100%),
    linear-gradient(152deg, rgb(255 255 255 / .1) 5%, transparent 46%, rgb(10 15 28 / .3) 100%);
  background-clip: padding-box;
  box-shadow:
    inset 0 1px 0 rgb(255 255 255 / .6),
    inset 1px 0 0 rgb(255 255 255 / .17),
    inset -1px -1px 0 rgb(170 219 255 / .22),
    0 1px 1px rgb(9 15 28 / .3),
    0 4px 8px -3px rgb(8 14 25 / .45);
}
.settings-icon > :is(svg,.app-icon) { filter: drop-shadow(0 1px 1px rgb(255 255 255 / .3)); }

@supports ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  @media not (prefers-reduced-transparency: reduce) {
    :root:not([data-phone-app]) .settings-icon {
      background-color: color-mix(in srgb, var(--settings-icon-tint) 88%, transparent);
      -webkit-backdrop-filter: blur(6px) saturate(130%);
      backdrop-filter: blur(6px) saturate(130%);
    }
  }
}
#dialog .dialog-header h2 { letter-spacing: -.02em; }
#dialog .story-preview :is(img, video) {
  display: block;
  width: 100%;
  max-height: 32dvh;
  object-fit: contain;
  border-radius: var(--control-radius);
  background: var(--bg);
}
#toast { overflow-wrap: anywhere; }

.admin-shell, .admin-auth { --action-fill: var(--accent); }
.admin-shell .admin-nav {
  position: sticky;
  top: 12px;
  align-self: start;
  max-height: calc(100dvh - 24px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.admin-brand { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.admin-brand h1 { display: flex; align-items: center; gap: 8px; font-size: 15px; }
.admin-brand .logo { width: 34px; height: 34px; border-radius: 0; }
.admin-brand .admin-nav-toggle { display: none; }
.admin-sections { overflow-y: auto; padding-bottom: 10px; }
.admin-shell .admin-nav a { margin-inline: 8px; }
.admin-shell .admin-nav a.active { background: #bbd7ff25; }
.admin-main { width: min(100%, 1360px); justify-self: center; }
.admin-heading { padding-bottom: 16px; border-bottom: 1px solid #24395526; }
.admin-heading h2 { font-size: clamp(22px, 2vw, 29px); letter-spacing: -.025em; }
.admin-heading .flow { gap: 6px; }
.admin-heading .flow > span { overflow-wrap: anywhere; }
.admin-shell { font-size: 14px; }
.admin-shell :is(th,td) { padding-block: 12px; }
.admin-shell tbody tr:nth-child(even) { background: color-mix(in srgb, var(--bg) 45%, var(--surface)); }
.admin-shell tbody tr:focus-within { background: var(--selected); }
.admin-filter {
  align-items: end;
  padding: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--panel-radius);
}
.admin-filter .field { flex: 1 1 140px; }
.admin-filter .primary { align-self: end; }
.admin-filter .toggle { align-self: center; }
.admin-shell .metric strong { font-size: 26px; letter-spacing: -.025em; }
.admin-shell th { color: #344963; font-size: 12px; }
.admin-shell tbody tr:hover { background: #edf4ff; }
.admin-shell td > a { text-decoration: underline; text-underline-offset: 3px; }

@media (min-width: 761px) {
  .utility-shell .page { padding-top: 34px; }
  .utility-shell .page-heading h1 { font-size: 26px; letter-spacing: -.025em; }
}

@media (max-width: 760px) {
  .admin-shell { align-content: start; }
  .auth { align-items: safe center; padding: 14px 12px max(20px, env(safe-area-inset-bottom)); }
  .auth-panel :is(.text-button, .toggle),
  .utility-shell .page :is(.primary, .secondary, .toggle, .icon-button),
  #dialog :is(.primary, .secondary, .text-button, .menu-link, .icon-button) {
    min-height: var(--touch-target);
  }
  :is(.utility-shell .page, #dialog) .icon-button { min-width: var(--touch-target); }
  [data-phone-app] { --action-fill: #176bb9; }
  [data-phone-app] .utility-shell .shortcut-list .item > :is(svg,.app-icon):first-child { color: var(--ios-accent); }
  [data-phone-app] .chat-list .folder-tab { min-height: var(--touch-target); }
  [data-phone-app] .conversation .composer-field .icon-button {
    width: var(--touch-target);
    height: var(--touch-target);
  }
  [data-phone-app] .inbox-empty .placeholder-icon {
    color: var(--ios-accent);
    background: var(--ios-input);
    border-color: var(--ios-border);
  }

  .admin-shell .admin-nav {
    position: static;
    max-height: none;
    padding: 0;
    align-items: stretch;
    flex-wrap: nowrap;
  }
  .admin-brand { padding-inline: 10px; }
  .admin-brand h1 { width: auto; padding-inline: 0; }
  .admin-brand .admin-nav-toggle { display: inline-flex; width: 44px; height: 44px; }
  .admin-brand .admin-nav-toggle[aria-expanded="true"] { background: #ffffff25; }
  .admin-sections { display: none; }
  .admin-nav:has(.admin-nav-toggle[aria-expanded="true"]) .admin-sections {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(142px, 1fr));
    align-items: start;
    gap: 2px 0;
    max-height: 60dvh;
    border-top: 1px solid #ffffff25;
  }
  .admin-shell .admin-nav p { display: block; }
  .admin-shell .admin-nav a { display: flex; align-items: center; min-height: var(--touch-target); }
  .admin-heading { gap: 6px; margin-bottom: 14px; padding-bottom: 10px; }
  .admin-filter .field:has(> input[name="q"]) { flex-basis: 100%; }
  .admin-shell :is(.primary, .secondary, .text-button, .field input, select, .toggle) {
    min-height: var(--touch-target);
  }
  .admin-shell .table-wrap {
    overscroll-behavior-x: contain;
  }
}

/* Final mobile settings overrides sit after the legacy utility rules. */
@media (max-width: 760px) {
  [data-phone-app] { --settings-panel: #1c1c1e; }
  .settings-page > .page-heading,
  .settings-page .settings-desktop { display: none; }
  .settings-page .settings-phone { display: grid; }
  [data-phone-app] .settings-phone { gap: 20px; }
  [data-phone-app] .settings-panel { border-radius: 22px; }
  [data-phone-app] .settings-panel > .settings-row { min-height: 54px; padding-block: 10px; }
  [data-phone-app] .settings-phone > .settings-signout {
    width: 100%;
    min-height: 54px;
    margin-bottom: max(24px,env(safe-area-inset-bottom));
    border: 0;
    border-radius: 22px;
    background: var(--settings-panel);
    color: #ff453a;
    font-size: 17px;
  }
}
/* Group management follows the existing settings surfaces and control tokens. */
.group-invite-link code { overflow-wrap:anywhere; white-space:normal; }
.group-management fieldset { min-width:0; }
.group-management textarea { min-height:120px; }
.group-invite-symbol { color:var(--accent); align-self:center; }
.group-invitation .auth-panel { text-align:center; }
.group-invitation .auth-panel h1 { overflow-wrap:anywhere; }
.group-request-list .item, .friend-requests .item { flex-wrap:wrap; gap:10px; }
.friend-requests h2 { font-size:17px; }
.admin-profile-card { min-width:180px; display:flex; flex-direction:column; gap:8px; align-items:flex-start; }
.saved-contact-card { min-width:180px; display:flex; flex-direction:column; gap:8px; align-items:flex-start; }
.saved-contact-card strong { overflow-wrap:anywhere; }
.contact-share-picker { max-height:65dvh; overflow:auto; }
.contact-share-preview { align-items:center; text-align:center; }
.contact-share-preview > .flow { width:100%; }
.workspace-header > .conversation-list-tools { grid-column:1 / -1; display:flex; align-items:center; justify-content:space-between; gap:6px; min-width:0; width:100%; margin-top:8px; }
.conversation-filter-options { display:flex; align-items:center; gap:2px; min-width:0; }
.conversation-list-tools .conversation-filter { border:0; border-radius:5px; background:transparent; color:var(--muted); padding:7px 8px; min-height:32px; font-size:13px; white-space:nowrap; }
.conversation-list-tools .conversation-filter[aria-pressed="true"] { color:#20a472; background:#20a4721c; font-weight:600; }
.conversation-list-tools .conversation-read-all { display:flex; align-items:center; gap:4px; border:0; padding:7px 0 7px 4px; min-height:32px; background:transparent; color:var(--muted); font-size:12px; white-space:nowrap; }
[data-phone-app] .workspace-header.search-open > .conversation-list-tools { display:none; }

/* Dedicated Settings > Folders screen, sized from the supplied mobile reference. */
.utility-shell > .folder-settings-page {
  --folder-background:#1c1c1e;
  --folder-card:#2c2c2e;
  --folder-muted:#8e8e93;
  --folder-text:#fff;
  --folder-accent:#0a84ff;
  display:flex; flex-direction:column; height:100dvh; min-height:0;
  padding:0; color:var(--folder-text); background:var(--folder-background);
  font-family:-apple-system,BlinkMacSystemFont,system-ui,sans-serif;
}
:root[data-theme="Light"] .utility-shell > .folder-settings-page {
  --folder-background:#f2f2f7; --folder-card:#fff; --folder-text:#000; --folder-accent:#007aff;
}
.folder-settings-header {
  display:grid; grid-template-columns:56px minmax(0,1fr) 56px; align-items:center;
  gap:12px; padding:calc(env(safe-area-inset-top) + 10px) 16px 10px;
  flex-shrink:0;
}
.folder-settings-header h1 { margin:0; text-align:center; font-size:17px; line-height:24px; font-weight:600; letter-spacing:-.3px; }
.folder-settings-header .folder-settings-control {
  display:flex; align-items:center; justify-content:center; justify-self:start;
  min-width:44px; height:44px; padding:0 11px; border:1px solid #ffffff1a;
  border-radius:999px; background:#ffffff03; color:var(--folder-text);
  font-size:17px; font-weight:400; text-decoration:none;
  box-shadow:inset 0 1px 1px #ffffff06;
}
.folder-settings-header .folder-settings-control:last-child { justify-self:end; }
.folder-settings-header .folder-settings-control:first-child { width:44px; padding:0; }
.folder-settings-header .folder-settings-control:last-child { min-width:56px; }
.folder-settings-content { flex:1; overflow-y:auto; min-height:0; padding:24px 16px max(24px,env(safe-area-inset-bottom)); scrollbar-width:none; }
.folder-settings-content::-webkit-scrollbar { display:none; }
.folder-settings-intro { display:flex; flex-direction:column; align-items:center; text-align:center; }
.folder-settings-intro img { display:block; width:114px; height:114px; margin:-10px 0 -16px; object-fit:contain; }
.folder-settings-intro p { max-width:320px; margin:16px auto 0; color:var(--folder-muted); font-size:14px; line-height:16px; }
.folder-settings-section { margin-top:28px; }
.folder-settings-section h2 { margin:0 15px 6px; color:var(--folder-muted); font-size:13px; line-height:18px; text-transform:uppercase; font-weight:400; }
.folder-settings-card { background:var(--folder-card); border-radius:26px; overflow:hidden; }
.folder-settings-card .folder-settings-create,
.folder-settings-card .folder-settings-all { display:flex; align-items:center; min-height:53px; width:100%; padding:12px 16px; margin:0; border:0; border-radius:0; background:transparent; color:var(--folder-text); font-size:17px; line-height:24px; text-align:start; position:relative; }
.folder-settings-card .folder-settings-create { color:var(--folder-accent); }
.folder-settings-create::after,
.folder-settings-all:has(+ ul)::after,
.folder-settings-row:not(:last-child)::after { content:''; position:absolute; bottom:0; left:16px; right:16px; height:.5px; background:#ffffff13; }
.folder-settings-help { margin:7px 15px 0; color:var(--folder-muted); font-size:13px; line-height:16px; }
.folder-settings-tags { margin-top:24px; }
.folder-settings-tags-row { display:flex; align-items:center; justify-content:space-between; min-height:53px; padding:10px 16px; gap:12px; font-size:17px; }
.folder-settings-switch { display:flex; align-items:center; width:51px; height:31px; flex:none; padding:2px; border:0; border-radius:999px; background:#3a3a3c; cursor:pointer; transition:background-color .16s ease; }
.folder-settings-switch > span { display:block; width:27px; height:27px; border-radius:50%; background:white; box-shadow:0 1px 3px #0004; transition:transform .16s ease; }
.folder-settings-switch[aria-checked="true"] { background:#34c759; }
.folder-settings-switch[aria-checked="true"] > span { transform:translateX(20px); }
.chat-row-info > .chat-folder-tags { grid-column:1 / -1; grid-row:3; display:flex; flex-wrap:wrap; gap:4px; min-width:0; margin-top:3px; }
.chat-folder-tag { display:block; max-width:150px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; padding:2px 6px; border-radius:5px; background:color-mix(in srgb,var(--accent-text) 16%,transparent); color:var(--accent-text); font-size:11px; line-height:14px; font-weight:500; }
@media(prefers-reduced-motion:reduce) { .folder-settings-switch,.folder-settings-switch > span { transition:none; } }
.folder-settings-card .folder-manager-list { margin:0; padding:0; list-style:none; }
.folder-settings-card .folder-settings-row { display:flex; align-items:center; min-height:53px; gap:0; border-radius:0; position:relative; padding-inline:8px; }
.folder-settings-card .folder-settings-name { display:flex; flex:1; min-width:0; padding:12px 8px; min-height:53px; align-items:center; border:0; background:transparent; color:var(--folder-text); font-size:17px; text-align:start; }
.folder-settings-name span { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.folder-settings-card .folder-settings-row .icon-button { color:var(--folder-muted); min-width:30px; width:30px; height:36px; }
.folder-settings-card .folder-settings-row [data-action="delete-folder"] { background:#ff453a; border:0; border-radius:50%; min-width:22px; width:22px; height:22px; color:white; margin-inline:2px 6px; }
.folder-settings-row[draggable="false"] { cursor:default; }
@media(min-width:761px) {
  .utility-shell > .folder-settings-page { max-width:650px; }
  .folder-settings-header { padding-top:26px; }
  .folder-settings-content { padding-inline:24px; }
}
@media(prefers-color-scheme:light) {
  :root[data-theme="System"] .utility-shell > .folder-settings-page { --folder-background:#f2f2f7; --folder-card:#fff; --folder-text:#000; --folder-accent:#007aff; }
}

/* New Group member selection follows the supplied phone layout. */
.utility-shell > .new-group-page {
  --group-bg:#000; --group-fill:#1c1c1e; --group-line:#38383a; --group-ink:#fff; --group-muted:#8e8e93;
  display:flex; flex-direction:column; position:relative; height:100dvh; min-height:0;
  padding:0; background:var(--group-bg); color:var(--group-ink);
  font-family:-apple-system,BlinkMacSystemFont,system-ui,sans-serif;
}
.new-group-page::before { content:''; position:absolute; top:env(safe-area-inset-top); left:26px; right:26px; height:12px; border-radius:100% 100% 0 0; background:var(--group-fill); opacity:.65; pointer-events:none; }
.new-group-form { height:100%; min-height:0; display:flex; flex-direction:column; position:relative; }
.new-group-header { display:grid; grid-template-columns:62px minmax(0,1fr) 62px; align-items:center; gap:12px; padding:calc(env(safe-area-inset-top) + 28px) 16px 16px; flex:none; }
.new-group-header h1 { font-size:18px; line-height:24px; font-weight:600; margin:0; text-align:center; letter-spacing:-.3px; }
.new-group-header p { color:var(--group-muted); text-align:center; font-size:13px; line-height:17px; margin:0; }
.new-group-header :is(.new-group-back,.new-group-next) { display:flex; align-items:center; justify-content:center; height:44px; padding:0; border:1px solid var(--group-line); background:var(--group-fill); border-radius:999px; color:var(--group-ink); }
.new-group-header .new-group-back { width:44px; }
.new-group-header .new-group-next { width:62px; font-size:17px; font-weight:600; }
.new-group-search { flex:none; margin:0 16px; }
.new-group-search input { width:100%; height:44px; padding:0 16px; background:var(--group-fill); border:1px solid var(--group-line); border-radius:999px; color:var(--group-ink); font-size:15px; }
.new-group-search input::placeholder { color:#6b6b70; opacity:1; }
.new-group-people { overflow-y:auto; flex:1; min-height:0; padding:0 23px 24px 16px; scrollbar-width:none; scroll-behavior:smooth; }
.new-group-people::-webkit-scrollbar { display:none; }
.new-group-section { scroll-margin-top:10px; }
.new-group-section h2 { color:var(--group-muted); font-size:13px; line-height:18px; font-weight:400; margin:14px 0 12px; }
.new-group-person { display:flex; position:relative; align-items:center; gap:14px; min-height:54px; padding:0; margin:0 0 8px; cursor:pointer; }
.new-group-person input { position:absolute; width:22px; height:22px; top:16px; left:0; margin:0; opacity:0; }
.new-group-check { display:flex; align-items:center; justify-content:center; width:22px; height:22px; border:1.5px solid var(--group-line); border-radius:50%; flex:none; color:white; }
.new-group-check .app-icon { visibility:hidden; }
.new-group-person input:checked + .new-group-check { background:#0a84ff; border-color:#0a84ff; }
.new-group-person input:checked + .new-group-check .app-icon { visibility:visible; }
.new-group-person input:focus-visible + .new-group-check { outline:none; }
.new-group-person .avatar { width:40px; height:40px; font-size:22px; flex:none; }
.new-group-person-copy { display:flex; flex-direction:column; gap:2px; min-width:0; }
.new-group-person-copy strong { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; font-size:17px; line-height:21px; font-weight:600; }
.new-group-person-copy > span { color:var(--group-muted); font-size:13px; line-height:17px; }
.new-group-index { position:absolute; right:5px; top:60%; transform:translateY(-50%); display:flex; flex-direction:column; align-items:center; gap:2px; max-height:50%; overflow-y:auto; scrollbar-width:none; }
.new-group-index a { display:flex; align-items:center; justify-content:center; color:#0a84ff; font-size:11px; font-weight:600; line-height:14px; min-width:14px; text-decoration:none; }
.new-group-empty { color:var(--group-muted); font-size:14px; margin:24px 0; text-align:center; }
.new-group-details { padding:12px 16px max(24px,env(safe-area-inset-bottom)); display:grid; gap:18px; overflow-y:auto; }
.new-group-details :is(input,textarea) { background:var(--group-fill); color:var(--group-ink); border-color:var(--group-line); border-radius:16px; }
.new-group-details textarea { min-height:100px; }
.new-group-person[hidden],.new-group-section[hidden],.new-group-index a[hidden],.new-group-empty[hidden] { display:none; }
:root[data-theme="Light"] .new-group-page { --group-bg:#fff; --group-fill:#f2f2f7; --group-line:#d1d1d6; --group-ink:#000; }
@media(prefers-color-scheme:light) { :root[data-theme="System"] .new-group-page { --group-bg:#fff; --group-fill:#f2f2f7; --group-line:#d1d1d6; --group-ink:#000; } }
@media(min-width:761px) { .utility-shell > .new-group-page { max-width:650px; } }

/* Shared control and reading-size contract; keep these rules in foundation. */
:root { --control-height:36px; --reading-scale:1; --reading-base:14px; --reading-detail:13px; --focus-ink:#767676; }
:root[data-phone-app] { --reading-base:17px; --reading-detail:14px; }
:root[data-text-size="Small"] { --reading-scale:.9; }
:root[data-text-size="Large"] { --reading-scale:1.2; }
:root :is(button,a,input,textarea,select,[tabindex]):focus-visible { outline:none; }
:root :is(.ios-toggle-row,.ios-radio-row):has(input:focus-visible) { background:var(--hover); }
:root[data-text-size]:not([data-text-size="Standard"]) .message > p { font-size:calc(var(--reading-base) * var(--reading-scale)); }
:root[data-text-size]:not([data-text-size="Standard"]) .composer textarea[name="text"] { font-size:calc(var(--reading-base) * var(--reading-scale)); }
:root[data-text-size]:not([data-text-size="Standard"]) :is(.ios-setting-label,.settings-row-title,.ios-contact-copy strong,.chat-row-info > strong,.call-history-copy strong) { font-size:calc(var(--reading-base) * var(--reading-scale)); }
:root[data-text-size]:not([data-text-size="Standard"]) :is(.ios-setting-detail,.ios-settings-note,.settings-row-detail,.call-history-detail,.ios-contact-copy > span,.chat-preview) { font-size:calc(var(--reading-detail) * var(--reading-scale)); }
.history-start,.list-more { display:block; margin:12px auto; min-height:var(--control-height); }
.member-directory { min-width:0; }
.member-directory .search-field { margin:12px 0; }
.member-directory .item { flex-wrap:wrap; }
.contact-profile-hero > .compact { max-width:320px; margin-inline:auto; font-size:12px; }
.group-members-results { max-height:50dvh; overflow:auto; }
.managed-members-results,.invite-candidates-results { max-height:55dvh; overflow:auto; }
.managed-members-results .item { align-items:flex-start; flex-wrap:wrap; gap:10px; }
.managed-members-results .item-actions { flex-wrap:wrap; }
.invite-candidates-results > label { cursor:pointer; }
.conversation-list-tools { flex-wrap:wrap; }
@media(max-width:380px) { .conversation-list-tools .conversation-filter { padding-inline:5px; font-size:12px; } }

.settings-page .android-download-card,
.settings-page .settings-panel > .android-download-card {
  display:grid; grid-template-columns:52px minmax(0,1fr) 40px;
  align-items:center; gap:14px; width:100%; min-height:116px;
  padding:18px; border:0; border-radius:inherit; background:transparent;
  color:var(--text); text-align:start; text-decoration:none;
}
.android-download-icon { display:block; width:52px; height:52px; border-radius:14px; object-fit:contain; }
.android-download-copy { display:grid; min-width:0; gap:4px; }
.android-download-label { color:var(--accent-text); font-size:12px; font-weight:600; line-height:1.35; }
.android-download-copy strong { font-size:17px; font-weight:600; line-height:1.3; overflow-wrap:anywhere; }
.android-download-meta { color:var(--muted); font-size:12px; line-height:1.5; }
.android-download-action { display:grid; place-items:center; width:40px; height:40px; border-radius:50%; background:var(--hover); color:var(--accent-text); }
.settings-page .android-download-card:is(:active,:focus-visible) { background:var(--hover); }
