/* Integration with the existing source106 Office template. */
.lt-login-theme { position: absolute; top: 16px; right: 16px; z-index: 5; }
body:has(#app-view:not([hidden])) > .lt-login-theme { display: none; }
.lt-login-theme .lt-theme-toggle { color: var(--lt-ink); background: var(--lt-card); border-color: var(--lt-line); }
.topbar > div { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
#app-view :is(.page,.panel,.panel-body,.card,.workday-card,.workspace,form,label,fieldset) { min-width: 0; }
#app-view :is(p,dd,dt,label,li,.list-row,.workday-card) { overflow-wrap: anywhere; }
#app-view :is(strong,span,a,h1,h2,h3,h4) { overflow-wrap: anywhere; }
.lt-office .agent-card .eyebrow { color: var(--lt-gold-light); }
dialog { max-width: calc(100% - 24px); max-height: calc(100dvh - 32px); overflow: auto; }
dialog > .panel-head, dialog > form > .panel-head {
  position: sticky; top: -30px; z-index: 3; background: var(--lt-card);
  padding-block: 12px; margin-top: -12px; border-bottom: 1px solid var(--lt-line);
}
@media(max-width:620px) { .topbar > div { gap: 8px; } }
@media(max-width:620px) { dialog > .panel-head, dialog > form > .panel-head { top: -24px; } }

/* Alias canonical dark selectors to the real wrapper; retain native Telegram handling. */
/* Office: every formerly cream panel, input, card and message gets a dark surface. */
html[data-theme="dark"] .lt-office .lt-office-previewbar { background: #09291e; color: var(--lt-muted-dark); border-color: var(--lt-line); }
html[data-theme="dark"] .lt-office .lt-office-previewbar a { color: var(--lt-gold-ink); }
html[data-theme="dark"] .lt-office .topbar { color: var(--lt-muted-dark); background: linear-gradient(100deg,#0a2b20,#123a2b); border-color: var(--lt-line); }
html[data-theme="dark"] .topbar .lt-theme-toggle { color: var(--lt-gold-light); border-color: var(--lt-line); background: rgba(var(--lt-gold-rgb),.06); }
html[data-theme="dark"] .topbar .lt-theme-toggle:hover { color: #ffdf9f; background: rgba(var(--lt-gold-rgb),.14); }
html[data-theme="dark"] .lt-office :is(.panel,.task-card,.documents details,.material-card) {
  color: var(--lt-ink); background: linear-gradient(150deg,#1b4735,#103528 68%,#0b2a21);
  border-color: var(--lt-line); box-shadow: 0 10px 24px rgba(0,9,6,.23);
}
html[data-theme="dark"] .lt-office .modules-panel>.module-actions>.secondary { color: var(--lt-ink); background: linear-gradient(145deg,#23503a,#113729); border-color: rgba(var(--lt-gold-rgb),.34); box-shadow: inset 0 1px 0 rgba(255,242,202,.08); }
html[data-theme="dark"] .lt-office :is(.stats,.workday-summary) { background: linear-gradient(90deg,rgba(35,77,53,.52),rgba(13,49,35,.60)); border-color: var(--lt-line); }
html[data-theme="dark"] .lt-office :is(.workday-stat,.column-title>span,.pill,.bubble,.quick-actions button) { background: #204333; color: var(--lt-ink); border-color: var(--lt-line); }
html[data-theme="dark"] .lt-office .bubble.user { background: #2a4c39; }
html[data-theme="dark"] .lt-office .task-card { background: linear-gradient(150deg,#194633,#0d2f24); }
html[data-theme="dark"] .lt-office .agent-card { background: radial-gradient(circle at 80% 0%,#265e43,transparent 52%),linear-gradient(140deg,#144432,#031e17); }
html[data-theme="dark"] .lt-office :is(#notice,.warning) { color: #f4dab0; background: #394a2a; border-color: #9d854b; }
html[data-theme="dark"] .lt-office :is(#document-source,.planning-forecast,.application-details p) { color: var(--lt-ink); background: #183d2e; border-color: var(--lt-line); }
html[data-theme="dark"] .lt-office :is(button,.secondary,a.secondary):not(.primary):not(.lt-theme-toggle):hover { background-color: #26523e; border-color: rgba(var(--lt-gold-rgb),.53); }
html[data-theme="dark"] .lt-office #overview .page-head>.primary { color: var(--lt-gold-light); background: transparent; }
html[data-theme="dark"] .lt-office .text-button { color: var(--lt-gold-ink); background: transparent; }
html[data-theme="dark"] .lt-office .text-button:hover { background: rgba(var(--lt-gold-rgb),.09); }
html[data-theme="dark"] .lt-office :is(input,select,textarea) { background: #0b2e23; border-color: rgba(var(--lt-gold-rgb),.41); color: var(--lt-ink); }
html[data-theme="dark"] .lt-office input::placeholder,html[data-theme="dark"] .lt-office textarea::placeholder { color: #b7c8ba; }
html[data-theme="dark"] .lt-office :is(button,input,select,textarea):disabled { color: #a7b8a8; background: #203a2e; border-color: #47634f; }
