@layer flygram-layout {
/* HomePage / AccountListPane / Metrics.qml; палітра app зберігає desktop-еталон. */
.desktop-app {
  color-scheme: dark;
  --bg: var(--desktop-background); --surface: var(--desktop-group-bg); --surface-2: var(--desktop-control-bg);
  --line: var(--desktop-divider); --text: var(--desktop-text-primary); --muted: var(--desktop-text-secondary);
  --soft: var(--desktop-section-label); --app-button: var(--desktop-button-bg); --app-selected: var(--desktop-row-selected);
  --app-hover: var(--desktop-row-hover); --app-border: var(--desktop-group-border);
  --app-indicator: var(--desktop-row-selected-indicator); --app-portrait: var(--desktop-surface);
  --accent: var(--desktop-accent); --accent-ink: var(--desktop-text-primary);
  background: var(--bg); color: var(--text);
}
html[data-app-theme="light"] .desktop-app { color-scheme: light; --surface-2: var(--desktop-row-hover); }
/* Оболонка сайту успадковує спільну тему з кореневого елемента. */
body:not(.portal-mode) .shell > header { background: var(--header-bg); padding-block: 16px; }
body:not(.portal-mode) .shell > footer { background: var(--surface); }
body:not(.portal-mode) main { padding: 32px clamp(20px, 6vw, 72px) 48px; }
body:not(.portal-mode) #proof-panel { display: none; }
body:not(.portal-mode) .header-actions .js-open-auth { display: inline-flex; align-items: center; justify-content: center; }
body:not(.portal-mode) .site-nav { position: static; margin-left: 24px; margin-right: auto; }
.demo-section { container: flygram-demo / inline-size; }
.demo-section, .site-details { width: 100%; max-width: 1180px; margin-inline: auto; }
.desktop-app { display: grid; grid-template-columns: 320px minmax(0, 1fr); width: 100%; height: 700px; min-height: 540px; overflow: hidden; border: 1px solid var(--app-border); border-radius: 18px; box-shadow: 0 12px 44px #27374b0a; scroll-margin-top: 108px; position: relative; isolation: isolate; font: var(--ui-font-14)/1.45 var(--ui-font-family); text-align: left; }
.desktop-app * { box-sizing: border-box; }
.desktop-app [hidden], .desktop-app [popover]:not(:popover-open) { display: none !important; }
.desktop-app button, .desktop-app input, .desktop-app textarea, .desktop-app select { font: inherit; color: inherit; letter-spacing: normal; }
.desktop-app button { cursor: pointer; }
.desktop-app button:disabled { cursor: default; }
.desktop-app [data-demo-gate] { cursor:pointer; }
.desktop-app [data-demo-gate] input:disabled,
.desktop-app [data-demo-gate] textarea:disabled { pointer-events:none; }
.desktop-app button, .desktop-app input, .desktop-app select { margin: 0; box-shadow: none; }
.desktop-app input, .desktop-app select { min-height: 0; }
.desktop-app label { font-weight: var(--ui-weight-regular); color: inherit; }

.desktop-app h1, .desktop-app h2, .desktop-app p { margin: 0; letter-spacing: normal; }
.desktop-app a { color: var(--muted); text-decoration: none; }

.app-icon { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.app-icon-button { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; padding: 8px; border: 0; border-radius: 6px; background: transparent; color: var(--muted); }
.app-icon-button:is(:disabled,[data-demo-gate]) { opacity: .35; }
.app-sidebar { border-right: 1px solid var(--line); display: flex; flex-direction: column; min-width: 0; background: var(--bg); }
.app-sidebar-header { flex: none; display: flex; align-items: center; height: 56px; gap: 8px; padding: 8px; border-bottom: 1px solid var(--line); }
.desktop-app #app-search { height: 36px; width: 100%; min-width: 0; padding: 0 12px; border: 1px solid var(--line); border-radius: var(--ui-radius-control); background: var(--surface-2); font-size: var(--ui-font-13); }
.desktop-app input::placeholder, .desktop-app textarea::placeholder { color: var(--soft); opacity: 1; }
.app-accounts { flex: 1; }
.app-account { display: flex; align-items: center; width: 100%; min-height: 72px; gap: 12px; padding: 12px; border: 0; border-right: 3px solid var(--app-indicator); border-radius: 0; text-align: left; background: var(--app-selected); }
.app-avatar { width: 44px; height: 44px; flex: none; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 50%; background: var(--surface-2); font-size: var(--ui-font-18); font-weight: var(--ui-weight-emphasis); }
.app-account-copy { min-width: 0; flex: 1; }
.app-account-copy strong { display: block; font-size: var(--ui-font-14); font-weight: var(--ui-weight-emphasis); }
.app-account-copy small { display: flex; align-items: center; gap: 6px; font-size: var(--ui-font-11); color: var(--muted); margin-top: 4px; }
.app-account > .app-icon { width: 17px; color: var(--soft); }
.desktop-app[data-available="true"] .app-account > .app-icon { color: var(--desktop-status-account-connected); }
.demo-dot { height: 5px; width: 5px; flex: none; border-radius: 50%; background: var(--soft); }
.desktop-app[data-available="true"] .demo-dot { background: var(--desktop-status-success); }
.app-sidebar-bottom { margin-top: auto; height: 56px; flex: none; display: flex; align-items: center; justify-content: center; gap: 16px; border-top: 1px solid var(--line); }
.app-popover { margin: auto; padding: 24px; border: 1px solid var(--app-border); border-radius: var(--ui-radius-panel); background: var(--surface); color: var(--text); box-shadow: 0 16px 60px #0005; }
.app-empty-search { padding: 24px 12px; color: var(--soft); text-align: center; }
.app-main-pane { min-width: 0; display: flex; flex-direction: column; min-height: 0; }
.app-pane-header { flex: none; height: 56px; display: grid; grid-template-columns: minmax(60px,1fr) minmax(0,auto) minmax(60px,1fr); align-items: center; padding: 0 16px; border-bottom: 1px solid var(--line); gap: 12px; }
.desktop-app #app-pane-title { font-size: var(--ui-font-16); font-weight: var(--ui-weight-emphasis); line-height: 1.25; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.app-header-left, .app-header-actions { display: flex; align-items: center; gap: 8px; }
.app-header-actions { justify-content: end; grid-column: 3; }
.app-back, .app-text-button { background: transparent; border: 0; color: var(--muted); padding: 6px 0; font: inherit; text-align: left; }
.app-back { display: inline-flex; align-items: center; gap: 4px; border-radius: 6px; padding: 6px 8px 6px 0; cursor: pointer; }
.app-text-button { cursor: pointer; }
.app-pane-body { flex: 1; overflow: auto; min-height: 0; }
.app-view { min-height: 100%; }
.app-functions { display: flex; flex-direction: column; gap: 16px; width: min(420px, calc(100% - 48px)); padding: 72px 0 32px; margin: 0 auto; }
.desktop-app .app-function { height: 56px; flex: none; background: var(--app-button); border: 0; border-radius: 28px; color: var(--desktop-button-text); font-size: var(--ui-font-16); font-weight: var(--ui-weight-regular); text-align: center; padding: 0 24px; }

.desktop-app .app-demo-hint { font-size: var(--ui-font-12); line-height: 1.6; color: var(--soft); text-align: center; margin-top: 8px; }
.app-statusbar { display: flex; justify-content: space-between; align-items: center; height: 36px; flex: none; border-top: 1px solid var(--line); padding: 0 16px; font-size: var(--ui-font-11); color: var(--soft); }
.app-demo-label { margin-left: 8px; }
.app-statusbar .app-text-button { font-size: var(--ui-font-11); }
.app-mailing { display: grid; grid-template-columns: minmax(240px,320px) minmax(0,1fr); gap: 24px; padding: 24px; margin: 0; }
.app-chat-picker, .app-mail-settings { min-width: 0; }
.app-section-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; min-height: 24px; }
.desktop-app .app-section-heading h2, .app-message-heading label { font-size: var(--ui-font-14); font-weight: var(--ui-weight-emphasis); }
.app-counter { font-size: var(--ui-font-11); color: var(--soft); white-space: nowrap; }
.app-chat-list { display: flex; flex-direction: column; gap: 1px; }
.app-chat-target { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 10px 12px; border-radius: 6px; background: var(--app-selected); overflow-wrap: anywhere; cursor: pointer; }
.desktop-app input[type="radio"], .desktop-app input[type="checkbox"] { width: 16px; height: 16px; min-width: 16px; padding: 0; accent-color: var(--desktop-checkbox-fill-checked); }
.app-chat-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 210px; gap: 12px; border: 1px solid var(--line); border-radius: var(--ui-radius-control); color: var(--soft); text-align: center; padding: 20px; }
.app-chat-empty .app-icon { width: 30px; height: 30px; stroke-width: 1.2; }
.desktop-app .app-caption { color: var(--soft); font-size: var(--ui-font-12); line-height: 1.6; margin-top: 16px; }
#demo-group-link { display: inline-block; margin-top: 14px; font-size: var(--ui-font-12); }
.app-time-row { display: flex; gap: 24px; }
.app-time-row label { display: flex; align-items: center; gap: 12px; font-size: var(--ui-font-13); color: var(--muted); }
.desktop-app .app-time-row input, .desktop-app .app-timing-settings input { height: 36px; width: 96px; padding: 8px 10px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 6px; color: var(--soft); text-align: center; }
.app-timing-settings { display: grid; gap: 12px; margin-top: 20px; }
.app-timing-settings label { display: flex; align-items: center; justify-content: space-between; gap: 16px; color: var(--muted); font-size: var(--ui-font-13); }
.desktop-app .app-limit-note { margin-top: 12px; }
.app-message-heading { margin-top: 24px; }
.app-message-editor { border: 1px solid var(--app-border); border-radius: var(--ui-radius-control); overflow: hidden; background: var(--surface); }
.desktop-app textarea { display: block; resize: vertical; min-height: 160px; width: 100%; border: 0; border-radius: 0; padding: 14px; background: transparent; color: var(--text); line-height: 1.55; }
.app-editor-options { display: flex; gap: 18px; padding: 10px 12px; border-top: 1px solid var(--line); color: var(--soft); font-size: var(--ui-font-12); }
.app-editor-options label { display: flex; align-items: center; gap: 7px; }
.desktop-app .app-attribution { color: var(--soft); font-size: var(--ui-font-11); line-height: 1.55; margin-top: 10px; }
.app-start { display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 10px; border: 0; background: transparent; border-radius: 6px; font-size: var(--ui-font-12) !important; white-space: nowrap; }
.app-start:disabled { opacity: .4; }
.demo-status { margin-top: 20px; border-top: 1px solid var(--line); padding-top: 16px; font-size: var(--ui-font-12); line-height: 1.65; color: var(--muted); }
.demo-status[data-state="error"] { color: var(--desktop-status-error); }
.demo-status[data-state="sent"] { color: var(--desktop-status-success); }
.demo-result-actions { display: flex; gap: 16px; margin-top: 6px; }
.app-settings-nav { padding: 16px 12px; flex: 1; }
.app-profile { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 72px; padding: 12px; background: var(--surface-2); border: 0; border-radius: var(--ui-radius-panel); text-align: left; margin-bottom: 12px !important; }
.app-profile strong, .app-profile small { display: block; }
.app-profile small { margin-top: 2px; font-size: var(--ui-font-11); color: var(--muted); }
.app-nav-row { display: flex; align-items: center; gap: 12px; min-height: 44px; width: 100%; padding: 8px 12px; margin-bottom: 4px !important; background: none; border: 0; border-radius: var(--ui-radius-control); font-size: var(--ui-font-14); text-align: left; }
.app-nav-row[aria-current="page"] { background: var(--app-selected); }
.app-nav-row .app-icon { color: var(--desktop-status-info); width: 18px; }
.desktop-app .app-settings-page { width: min(640px, calc(100% - 96px)); min-height: auto; margin: 24px auto; }
.desktop-app .app-settings-heading { text-transform: uppercase; font-size: var(--ui-font-13); color: var(--soft); font-weight: var(--ui-weight-emphasis); padding: 0 12px; margin-bottom: 8px; }
.app-settings-group { border: 1px solid var(--app-border); border-radius: var(--ui-radius-panel); background: var(--surface); overflow: hidden; }
.app-setting-row { font-size: var(--ui-font-16); display: grid; grid-template-columns: minmax(145px, 1fr) minmax(0,2fr); align-items: center; min-height: 56px; margin-left: 16px; padding-right: 16px; gap: 12px; position: relative; }
.app-setting-row + .app-setting-row { border-top: 1px solid var(--line); }
.app-setting-row > span:last-child { color: var(--muted); }
.app-setting-control { display: flex; position: relative; align-items: center; min-width: 0; }
.desktop-app .app-setting-control select { appearance: none; width: 100%; height: 55px; border: 0; border-radius: 0; background: transparent; padding: 0 32px 0 0; color: var(--muted); cursor: pointer; }
.desktop-app .app-setting-control select option { background: var(--surface-2); color: var(--text); }
.app-setting-control .app-icon { position: absolute; right: 0; pointer-events: none; width: 18px; }
.app-mobile { display: none; }
body.portal-mode main > .demo-section, body.portal-mode main > .site-details { display: none; }
.site-details { margin-top: 20px; }
.site-details > summary { cursor: pointer; color: var(--muted); font-size: var(--ui-font-14); font-weight: var(--ui-weight-emphasis); padding: 4px 0; }
.site-details[open] > summary { margin-bottom: 32px; }
.site-details .landing-section { scroll-margin-top: 108px; }
/* 40ch тексту + padding input 36px + action/gap 136px + inset/borders 68px. */
#auth-dialog { background: var(--surface); border: 1px solid var(--line); border-radius: var(--ui-radius-panel); font-size: var(--ui-font-18); width: min(calc(40ch + 240px), calc(100% - 32px)); padding: 28px 28px 16px; color: var(--text); }
#auth-dialog::backdrop { background: #0008; backdrop-filter: blur(4px); }
#auth-dialog .form-panel { width: 100%; margin: 24px 0 0; background: transparent; padding: 0; border: 0; font-size: var(--ui-font-16); }
#auth-dialog h2 { margin: 0; font-size: var(--ui-font-22); }
#auth-dialog-title:focus { outline: none; }
#auth-dialog-title[data-i18n="auth.loginTitle"] { text-align: center; }
#auth-dialog .auth-dialog-footer { display: flex; justify-content: center; margin-top: 16px; }
#auth-dialog-close { display: inline-flex; align-items: center; justify-content: center; height: 32px; min-height: 32px; border: 0; border-radius: 0; background: transparent; color: var(--muted); padding: 0 16px; font-size: var(--ui-font-14); line-height: 18px; }
#auth-dialog .auth-field { color: var(--text); }
#auth-dialog input { color: var(--text); background: var(--surface-2); }
#auth-dialog #email, #auth-dialog #email::placeholder { font-weight: var(--ui-weight-regular); }
#auth-dialog #email-shell { min-width: 0; grid-template-columns: minmax(0, 1fr); border: 1px solid var(--line); border-radius: var(--ui-radius-control); background: var(--surface-2); }
#auth-dialog #email-shell.email-ready { grid-template-columns: minmax(0, 1fr) var(--inline-action-width); gap: var(--inline-gap); padding-right: var(--inline-gap); }
#auth-dialog #email { min-width: 0; min-height: 50px; padding: 0 18px; border: 0; background: transparent; text-align: left; }
#auth-dialog #email:not(:focus):placeholder-shown { text-align: center; }
#auth-dialog #email-submit { display: none; position: static; align-self: center; height: 36px; transform: none; }
#auth-dialog #email-shell.email-ready #email-submit { display: grid; }

#auth-dialog .icon-button { color: var(--muted); }
@media (max-width: 600px) {
  #auth-dialog #email-shell.email-ready { grid-template-columns: minmax(0, 1fr); padding: 0; border: 0; background: transparent; }
  #auth-dialog #email-shell.email-ready #email { min-height: 52px; border: 1px solid var(--line); background: var(--surface-2); }
  #auth-dialog #email-submit { width: 100%; min-width: 0; height: 40px; }
  #auth-dialog .primary-action { min-height: 40px; }
}
.desktop-app .app-gate-dialog { margin:auto; width:min(460px,calc(100vw - 32px)); max-height:calc(100dvh - 32px); padding:28px; border:1px solid var(--app-border); border-radius:12px; background:var(--surface); color:var(--text); box-shadow:0 24px 80px #0004; text-align:left; }
.app-gate-dialog::backdrop { background:#0008; backdrop-filter:blur(3px); }
.desktop-app .app-gate-dialog h2 { font-size: var(--ui-font-20); line-height:1.35; font-weight: var(--ui-weight-emphasis); }
.desktop-app .app-gate-dialog p { margin:12px 0 0; color:var(--muted); font-size: var(--ui-font-14); line-height:1.6; }
.app-gate-actions { display:flex; flex-wrap:wrap; justify-content:center; gap:10px; margin-top:24px; }
.desktop-app .app-gate-actions button { min-height:40px; padding:9px 16px; border:1px solid var(--line); border-radius:8px; color:var(--text); background:transparent; font-size: var(--ui-font-14); }
.desktop-app #demo-gate-action { background:var(--accent); color:var(--accent-ink); border-color:transparent; }
.desktop-app .app-other-recipient { display:block; margin-top:12px; font-size: var(--ui-font-13); }
#auth-purpose { color:var(--muted); font-size: var(--ui-font-13); line-height:1.6; margin:12px 0 0; }
@container flygram-demo (min-width: 1760px) { .app-mailing { grid-template-columns: minmax(320px, 1fr) minmax(0, 1fr); } }
@container flygram-demo (max-width: 1100px) {
  .desktop-app { grid-template-columns: 280px minmax(0,1fr); }
  .app-mailing { grid-template-columns: minmax(0,1fr); }
  .app-chat-empty { min-height: 100px; }
}
@media (max-width: 680px) {
  body:not(.portal-mode) main { padding: 24px 16px 32px; }
}
@container flygram-demo (max-width: 680px) {

  .desktop-app { display: block; min-height: 0; height: 680px; border-radius: 14px; }
  .app-main-pane { height: 100%; }
  .app-sidebar { position: absolute; inset: 0 auto 0 0; z-index: 20; width: min(320px, 100%); box-shadow: 12px 0 50px #0008; display: none; }
  .desktop-app[data-sidebar="true"] .app-sidebar { display: flex; }
  .app-mobile { display: inline-flex; }
  .app-pane-header { padding: 0 8px; gap: 6px; grid-template-columns: auto minmax(0,1fr) auto; }
  #app-pane-title { text-align: center; font-size: var(--ui-font-15); }
  .app-back span, .app-header-actions > button:disabled:not(.app-start) { display: none; }
  .app-header-left { gap: 0; }
  .app-functions { padding-top: 48px; }
  .app-mailing { padding: 20px; gap: 20px; }
  .app-start { padding: 0 8px; }
  .app-start span { display: none; }
  .desktop-app .app-settings-page { width: calc(100% - 32px); margin-top: 24px; }
  .app-setting-row { grid-template-columns: minmax(130px,1fr) minmax(0,1fr); gap: 8px; font-size: var(--ui-font-13); margin-left: 12px; padding-right: 12px; }
  .app-time-row { gap: 16px; }
  .app-timing-settings label { font-size: var(--ui-font-12); }
  .app-timing-settings input { flex: none; }
}
/* Відповідність QML-компонентам: painted Button insets, Settings*, Queue*, Chat*. */
.desktop-app .app-function { position: relative; isolation: isolate; background: transparent; }
.desktop-app .app-function::before { content: ''; position: absolute; inset: 6px 0; border-radius: 28px; background: var(--app-button); z-index: -1; }


/* Пункти головного демо відкривають повідомлення, тому виглядають як активні кнопки. */


.desktop-app #app-pane-title { display: flex; align-items: center; justify-content: center; gap: 8px; font-size: var(--ui-font-18); font-weight: var(--ui-weight-emphasis); }
.desktop-app[data-view="home"] #app-pane-title { font-size: var(--ui-font-16); }
#app-pane-title > .app-icon { color: var(--desktop-status-info); width: 17px; height: 17px; }
.app-back { font-size: var(--ui-font-16) !important; padding: 8px 12px; }
#app-settings-save { justify-self: end; grid-column: 3; font-size: var(--ui-font-16); }
#app-settings-save:is(:disabled,[data-demo-gate]) { opacity: .4; }
.app-account-slots { display: flex; align-items: center; gap: 16px; color: var(--muted); }
.app-account-slots .app-icon { width: 17px; height: 17px; }
.app-slot-active { color: var(--desktop-status-info); display: flex; }
.app-account-copy small { font-size: var(--ui-font-12); }
.app-account-copy strong { font-weight: var(--ui-weight-emphasis); }
.app-settings-nav { overflow: auto; }
.app-nav-row { position: relative; height: 48px; padding: 8px; border-radius: var(--ui-radius-panel); gap: 8px; margin-bottom: 12px !important; color: var(--text); }
.app-nav-icon { width: 28px; height: 28px; display: grid; place-items: center; border-radius: 6px; flex: none; }
.app-nav-icon .app-icon { color: #fff; }
.app-nav-row > .app-icon { margin-left: auto; color: var(--muted); }
.app-profile { margin-bottom: 12px !important; }
.app-profile .app-avatar { background: var(--app-selected); border: 0; }
.app-settings-page { padding-bottom: 24px; }
.app-settings-section + .app-settings-section { margin-top: 24px; }
.app-settings-heading { margin-bottom: 8px !important; }
.app-settings-group { overflow: visible; container-type: inline-size; }
.app-setting-row { grid-template-columns: clamp(140px,22%,200px) minmax(0,1fr); gap: 16px; }
.app-info-row { grid-template-columns: auto minmax(0,1fr); }
.app-info-row > span:last-child { text-align: right; }
.desktop-app .app-combo-row { grid-template-columns: minmax(140px,1fr) minmax(0,320px); gap:16px; font-family:"FlyGram Plex",sans-serif; font-size: var(--ui-font-14); line-height:20px; }
.desktop-app .app-combo-row > span { color:var(--desktop-carbon-text-secondary); white-space:normal; }
.app-combo { position:relative; min-width:0; }
.desktop-app .app-combo > button { display:flex; align-items:center; justify-content:space-between; gap:16px; border:0; border-bottom:1px solid var(--desktop-carbon-border-strong); border-radius:0; background:var(--desktop-carbon-field); height:40px; width:100%; padding:0 16px; color:var(--desktop-carbon-text-primary); font-family:inherit; font-size: var(--ui-font-14); font-weight: var(--ui-weight-regular); line-height:20px; text-align:left; }
.desktop-app .app-combo > button:disabled { color:var(--desktop-carbon-disabled-text); border-color:var(--desktop-carbon-border-subtle); }
.app-combo-value { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.app-combo > button .app-icon { width:16px; height:16px; flex:none; }
.app-combo > button[aria-expanded="true"] .app-icon { transform: rotate(180deg); }
.app-combo [role="listbox"] { position:fixed; z-index:40; padding:0; background:var(--desktop-carbon-layer); box-shadow:0 2px 6px #0003; overflow:auto; overscroll-behavior:contain; }
.desktop-app .app-combo [role="option"] { display:flex; align-items:center; justify-content:space-between; gap:16px; height:40px; width:100%; padding:0 16px; border:0; border-radius:0; background:var(--desktop-carbon-layer); text-align:left; color:var(--desktop-carbon-text-primary); font-family:inherit; font-size: var(--ui-font-14); font-weight: var(--ui-weight-regular); line-height:20px; }
.app-combo [role="option"] > span { overflow:hidden; white-space:nowrap; text-overflow:ellipsis; }
.app-combo [role="option"] .app-icon { width:16px; height:16px; flex:none; visibility:hidden; }
.app-combo [role="option"][aria-selected="true"] .app-icon { visibility:visible; }
.desktop-app .app-combo [role="option"][aria-selected="true"] { background:var(--desktop-carbon-selected); }
.app-switch-row { grid-template-columns: minmax(0,1fr) 38px; }
.desktop-app .app-switch-row > input { position: absolute; right: 16px; width: 38px; height: 22px; margin: 0; opacity: 0; }
.app-switch-track { background: var(--desktop-switch-track-off); width: 38px; height: 22px; border-radius: 11px; position: relative; }
.app-switch-track::after { content:''; position:absolute; top:2px; left:2px; width:18px; height:18px; background:var(--desktop-switch-thumb); border-radius:50%; }
.app-restricted { font-size: var(--ui-font-11); line-height: 1.6; color: var(--soft); text-align: center; margin-top: 24px !important; }
.demo-scope-note { margin: 12px 0 0; color: var(--muted); font-size: var(--ui-font-12); line-height: 1.6; }
.app-centered-muted { text-align: center; color: var(--muted); font-size: var(--ui-font-16); margin-top: 20px !important; }
.app-proxy-add { padding: 14px 16px; }
.app-proxy-add button { font-size: var(--ui-font-16); color: var(--text); }
.app-danger button { color: var(--desktop-danger-text); }
.app-account-portrait { width: 96px; height: 96px; margin: 0 auto 24px; display: grid; place-items: center; background: var(--app-portrait); border-radius: 50%; color: var(--text); font-size: var(--ui-font-34); font-weight: var(--ui-weight-emphasis); }
.app-account-name { text-align: center; font-size: var(--ui-font-18); font-weight: var(--ui-weight-emphasis); margin: 0 0 24px; }
.app-session-action { padding: 16px; display: flex; justify-content: center; }
.app-session-button { display: flex; justify-content: center; align-items: center; gap: 8px; min-height: 40px; width: min(360px,100%); padding: 8px 16px; border: 1px solid var(--app-border); border-radius: var(--ui-radius-control); background: var(--app-button); font-size: var(--ui-font-14) !important; }
.app-synchronization { padding: 16px; color: var(--muted); }
.app-add-page { display: flex; align-items: center; justify-content: center; }
.app-add-form { width: min(420px, calc(100% - 100px)); display: flex; flex-direction: column; gap: 20px; }
.desktop-app .app-add-form > input { height: 52px; padding: 0 16px; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--ui-radius-panel); font-size: var(--ui-font-14); }
.app-add-form .app-function { width: 200px; align-self: center; margin-top: 16px; height: 52px; }
.desktop-app .app-mailing, .app-queue-layout { display: grid; grid-template-columns: 320px minmax(0,1fr); gap: 24px; padding: 24px; min-height: 100%; align-items: stretch; }
.app-chat-picker, .app-native-picker { min-width:0; display:flex; flex-direction:column; gap:6px; }
.app-picker-header { height:32px; flex:none; display:flex; align-items:center; gap:12px; }
.desktop-app h3 { margin:0; color:var(--text); font-size: var(--ui-font-13); font-weight: var(--ui-weight-emphasis); line-height:1.4; }
.app-picker-header h3 { margin-right:auto; white-space:nowrap; }
.app-picker-header .app-text-button { font-size: var(--ui-font-13); white-space:nowrap; }
.app-picker-header .app-icon-button { width:32px; height:32px; padding:7px; }
.app-picker-header .app-icon { width:17px; height:17px; }
.app-picker-frame { flex:1; min-height:200px; border:1px solid var(--line); border-radius:8px; overflow:hidden; }
.desktop-app .app-picker-frame > textarea { height:100%; min-height:360px; padding:12px; font-size: var(--ui-font-13); resize:none; }
.app-chat-empty { display:none; }
.desktop-app .app-picker-count { text-align:right; font-size: var(--ui-font-12); color:var(--muted); margin:0; }
.app-chat-target { min-height:40px; border-radius:0; background:transparent; padding:6px 8px; font-size: var(--ui-font-13); }
.app-chat-target input { appearance:none; border:1.5px solid var(--desktop-checkbox-border); border-radius:50%; background:transparent; width:20px !important; height:20px !important; position:relative; }
.app-chat-target input:checked { background:var(--desktop-checkbox-fill-checked); }
.app-chat-target input:checked::after { content:''; position:absolute; width:5px; height:9px; border:solid var(--desktop-checkbox-mark); border-width:0 2px 2px 0; transform:rotate(45deg); left:6px; top:2px; }
.app-chat-kind { font-size: var(--ui-font-11); color:var(--muted); margin-left:auto; }
.app-preview-target { padding:8px 12px; font-size: var(--ui-font-13); }
.app-mail-settings { display:flex; flex-direction:column; min-width:0; }
.app-queue-timing { display:flex; flex-direction:column; gap:22px; }
.app-time-section h3 { min-height:32px; display:flex; align-items:center; margin-bottom:6px; }
.app-clock-row { display:flex; align-items:center; gap:12px; height:40px; }
.app-clock-row > span:first-child:not(.app-time-inputs) { width:64px; flex:none; }
.app-time-inputs { display:flex; align-items:center; gap:8px; width:max-content; height:28px; }
.app-time-inputs > label { display:block; width:60px; height:28px; }
.desktop-app .app-time-inputs input { padding:0; background:transparent; border:0; border-bottom:2px solid var(--line); border-radius:0; height:28px; min-height:0; width:60px; text-align:center; font-size: var(--ui-font-14); }
.app-colon { font-size: var(--ui-font-14); color:var(--text); }
.app-editor-heading { margin:22px 0 8px !important; }
.app-message-editor { flex:1; display:flex; position:relative; min-height:260px; border-color:var(--line); background:var(--bg); }
.desktop-app .app-message-editor textarea { min-height:260px; padding:12px 12px 48px; font-size: var(--ui-font-13); resize:none; }
.app-editor-options { position:absolute; right:12px; bottom:12px; border:0; padding:0; gap:8px; }
.app-editor-options label { display:flex; align-items:center; height:28px; gap:8px; border:1px solid var(--app-border); border-radius:14px; padding:0 12px; font-size: var(--ui-font-12); background:var(--surface-2); }
#demo-counter { text-align:right; margin-top:8px; font-size: var(--ui-font-12); }
.app-start { width:36px; padding:8px; }
.app-subscribe-settings .app-queue-timing { flex-direction:row; flex-wrap:wrap; gap:24px; }
.app-subscribe-settings .app-time-section { min-width:220px; }
.app-group-search { margin-top:24px; }
.app-group-search > h3 { min-height:32px; display:flex; align-items:center; margin-bottom:6px; }
.desktop-app .app-group-search input { border:1px solid var(--line); border-radius:8px; background:var(--surface-2); height:36px; padding:0 12px; font-size: var(--ui-font-13); }
.app-search-results { min-height:240px; border:1px solid var(--line); border-radius:8px; margin-top:8px; display:grid; place-items:center; padding:12px; color:var(--muted); font-size: var(--ui-font-13); text-align:center; }
#app-chat-sidebar { flex:1; min-height:0; overflow:auto; }
.app-chat-row { display:block; width:100%; min-height:64px; padding:12px; text-align:left; background:transparent; border:0; border-bottom:1px solid var(--line); }
.app-chat-screen { display:flex; flex-direction:column; height:100%; min-height:560px; }
.app-chat-empty-state { display:grid; place-items:center; flex:1; min-height:360px; color:var(--muted); }
.app-chat-composer { display:flex; align-items:center; gap:8px; border-top:1px solid var(--line); padding:12px 20px; }
.desktop-app .app-chat-composer textarea { min-height:52px; height:52px; resize:none; }
.app-statistics { padding:24px; display:flex; flex-direction:column; gap:24px; }
.app-stat-totals { display:grid; grid-template-columns:repeat(3,1fr); gap:16px; }
.app-stat-totals > div { height:80px; border:1px solid var(--line); border-radius:8px; background:color-mix(in srgb,var(--text) 4%,transparent); display:flex; flex-direction:column; align-items:center; justify-content:center; gap:4px; }
.app-stat-totals strong { font-size: var(--ui-font-24); }
.app-stat-totals span { font-size: var(--ui-font-12); color:var(--muted); }
.app-result-done { color:var(--desktop-status-success); } .app-result-error { color:var(--desktop-status-error); } .app-result-skipped { color:var(--desktop-status-warning); }
.app-stat-breakdown { display:grid; gap:8px; }
.app-stat-breakdown button { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:16px; border:0; padding:4px 0; background:none; text-align:left; font-size: var(--ui-font-13); }
.app-stat-breakdown button > span:first-child { font-weight: var(--ui-weight-emphasis); }
.app-stat-breakdown b { font-weight: var(--ui-weight-regular); }
.app-batch-row { width:100%; min-height:48px; text-align:left; background:none; border:0; padding:8px; }
.app-result-summary { display:flex; flex-direction:column; gap:12px; }
.app-result-summary strong { font-size: var(--ui-font-20); margin-bottom:8px; }
@container flygram-demo (max-width:1100px) {
  .desktop-app { grid-template-columns:280px minmax(0,1fr); }
  .desktop-app .app-mailing, .app-queue-layout { grid-template-columns:minmax(0,1fr); }
  .app-picker-frame { min-height:200px; }
  .app-mail-settings { min-height:650px; }
  .desktop-app .app-settings-page { width:calc(100% - 48px); }
}
@container flygram-demo (max-width:680px) {
  .desktop-app #app-pane-title { font-size: var(--ui-font-16); }
  .app-back { font-size: var(--ui-font-13) !important; padding:4px; }
  .app-back span { display:inline; }
  .desktop-app[data-view="home"] #app-pane-title { font-size: var(--ui-font-14); }
  .desktop-app .app-settings-page { width:calc(100% - 24px); }
  .app-setting-row { font-size: var(--ui-font-13); gap:8px; grid-template-columns:132px minmax(0,1fr); margin-left:12px; padding-right:12px; }
  .app-switch-row { grid-template-columns:minmax(0,1fr) 38px; }
  .app-info-row { grid-template-columns:auto minmax(0,1fr); }
  .app-mailing, .app-queue-layout, .app-statistics { padding:16px !important; }
  .app-stat-breakdown button { gap:8px; font-size: var(--ui-font-11); }
  #app-settings-save { font-size: var(--ui-font-13); }
  .app-add-form { width:calc(100% - 40px); }
}
@container (max-width:419px) {
  .desktop-app .app-combo-row { grid-template-columns:minmax(0,1fr); gap:8px; padding-top:8px; padding-bottom:8px; }
  .desktop-app .app-combo-row > span { font-size: var(--ui-font-12); line-height:16px; }
}
#demo-delivery-panel { padding:16px 20px; margin-top:16px; background:var(--surface); border:1px solid var(--line); border-radius:12px; }
#demo-delivery-panel[hidden] { display:none; }
#demo-delivery-panel .app-attribution { margin:0; font-size: var(--ui-font-12); color:var(--muted); }
#demo-delivery-panel .demo-status { margin-top:12px; padding-top:12px; }
#demo-delivery-panel .demo-status[data-state="error"] { color:var(--danger); }
#demo-delivery-panel .demo-status[data-state="sent"] { color:var(--success); }
#demo-delivery-panel a { color:var(--desktop-status-link); }

/* SystemNotificationsPopup та QueueStatisticsView. */
.app-popover { position:fixed; inset:auto; margin:0; padding:0; width:min(320px,calc(100vw - 32px)); border-radius:8px; }
.app-popover h3 { padding:16px 16px 8px; border-bottom:1px solid var(--line); font-size: var(--ui-font-16); }
.app-popover p { padding:20px; color:var(--muted); text-align:center; }
.app-queue-statistics { grid-template-columns:40% minmax(0,1fr); padding:16px; gap:16px; }
.app-result-summary { gap:20px; }
.app-result-summary strong { margin:0; }
.app-result-summary .app-result-status { color:var(--muted); font-size: var(--ui-font-13); font-weight: var(--ui-weight-regular); }
@container flygram-demo (max-width:680px) { .app-queue-statistics { grid-template-columns:minmax(0,1fr); } }
.desktop-app .app-account-name { font-size: var(--ui-font-18); margin:0 0 24px; }
.app-nav-row[aria-current="page"], .app-profile[aria-current="page"] { background:var(--app-selected); }
.app-setting-row > span:first-child { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.app-action-row { display:block; }
.app-action-row > button { width:100%; min-height:56px; display:flex; align-items:center; justify-content:space-between; gap:16px; font-size: var(--ui-font-16); }
.app-action-row [data-danger] { color:var(--desktop-danger-text); }
.app-action-row .app-icon { width:18px; height:18px; color:var(--muted); }
.app-proxy-add { padding:0; border:1px solid var(--line); border-radius:12px; background:var(--surface); }
@container flygram-demo (max-width:680px) { .app-action-row > button { font-size: var(--ui-font-13); } }
.app-view:has(> .app-queue-layout) { height:100%; }
.app-group-search-field { position:relative; margin-bottom:6px; }
.desktop-app .app-group-search-field input { padding-right:44px; }
.app-search-send { position:absolute; right:4px; top:3px; width:30px; height:30px; border:0; border-radius:50%; background:color-mix(in srgb,var(--text) 6.7%,transparent); display:grid; place-items:center; }
.app-search-send img { width:20px; height:20px; opacity:.35; }
.app-group-search .app-picker-count { margin-top:6px; }
.app-stats-view { display:flex; flex-direction:column; }
.app-stats-view .app-queue-statistics { min-height:calc(100% - 36px); flex:1; }
.app-elapsed { color:var(--muted); font-size: var(--ui-font-13); }
.app-queue-statusbar { min-height:36px; border-top:1px solid var(--line); padding:8px 24px; color:var(--muted); font-size: var(--ui-font-13); }
.app-switch-row input:checked + .app-switch-track { background:var(--desktop-switch-track-on); }


}
