/* Quiet workspace. Component behavior remains in style.css. */
:root {
  --bg: #f6f5f3;
  --surface: #fff;
  --surface-soft: #f9f8f6;
  --sidebar: #eeedea;
  --inset: #efeeeb;
  --hover: #e7e6e2;
  --text: #252422;
  --muted: #6e6b66;
  --subtle: #79756f;
  --line: #e3e1dc;
  --line-strong: #c9c6bf;
  --accent: #35332f;
  --accent-hover: #111;
  --accent-soft: #e8e6e1;
  --accent-line: #c9c6bf;
  --on-accent: #fff;
  --button-bg: #252422;
  --button-text: #fff;
  --button-hover: #44413c;
  --shadow-soft: none;
}

:root[data-theme="dark"] {
  --bg: #1b1b1b;
  --surface: #212121;
  --surface-soft: #252525;
  --sidebar: #1d1d1d;
  --inset: #242424;
  --hover: #2d2d2d;
  --text: #eceaeb;
  --muted: #a3a3a3;
  --subtle: #939393;
  --line: #303030;
  --line-strong: #414141;
  --accent: #dedcdd;
  --accent-hover: #efedee;
  --accent-soft: #2b2b2b;
  --accent-line: #454545;
  --on-accent: #1b1b1b;
  --button-bg: #dedcdd;
  --button-text: #1b1b1b;
  --button-hover: #efedee;
  --success: #a6c7b1;
  --success-soft: #232c26;
  --warning: #d8bb87;
  --warning-soft: #302b22;
  --danger: #e8a5a5;
  --danger-soft: #322727;
  --scrollbar: #494949;
  --backdrop: #0009;
  --shadow: 0 20px 64px #0005;
  --shadow-soft: none;
}

body { background: var(--bg); -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font-family: inherit; }
h1 { font-size: clamp(30px, 3vw, 40px); font-weight: 500; letter-spacing: -1.6px; }
h2, h3 { font-weight: 500; }
.sidebar { width: 228px; padding: 32px 18px 22px; gap: 44px; }

.sidebar nav { gap: 12px; }
.sidebar .nav { border-radius: 9px; font-weight: 400; font-size: 13px; }
.nav-group.has-current > summary { color: var(--text); }
.nav.active { color: var(--text); background: var(--accent-soft); }
.nav-children { margin: 8px 0 6px 23px; gap: 6px; }
.nav-children .nav { font-size: 12px; }
.sidebar-footer { border-top: 1px solid var(--line); padding-top: 18px; }
.profile-avatar { background: var(--inset); color: var(--text); border: 1px solid var(--line-strong); }
.profile-info small { display: none; }
.profile-nav { margin-bottom: 12px; }
.shell { margin-left: 228px; }
.topbar { height: 78px; padding: 0 48px; max-width: none; margin-bottom: 0; background: var(--bg); }
.topbar #pageTitle { font-size: 12px; color: var(--muted); }
.topbar-actions { gap: 24px; }
.topbar #today { font-size: 11px; color: var(--subtle); }
.theme-toggle { height: 34px; width: 34px; justify-content: center; padding: 0; border-color: transparent; background: transparent; }
#themeLabel { display: none; }
.shell main { max-width: 1440px; padding: 48px 48px 100px; }
.page-head, .stats-heading { margin-bottom: 36px; }
.page-head p, .stats-heading p { font-size: 13px; margin-top: 12px; }
.page-eyebrow { display: block; margin-bottom: 16px; color: var(--subtle); font-size: 10px; font-weight: 500; letter-spacing: 1.6px; line-height: 1.5; }
.primary, .secondary { min-height: 42px; height: 42px; border-radius: 9px; font-size: 12px; padding: 0 18px; }
.primary { background: var(--button-bg); color: var(--button-text); border-color: var(--button-bg); }
.primary:hover { background: var(--button-hover); border-color: var(--button-hover); }
.secondary { background: transparent; border-color: var(--line-strong); color: var(--text); }
.secondary:hover { background: var(--hover); }
input, textarea, select { border: 1px solid var(--line); background: var(--inset); border-radius: 9px; font-size: 13px; }
label { font-size: 12px; font-weight: 400; }
input[type="checkbox"] { accent-color: var(--accent); }
.segmented { padding: 4px; border-radius: 10px; border-color: var(--line); background: var(--bg); gap: 2px; }
.segmented button { font-weight: 400; font-size: 12px; height: 36px; }
.segmented button.selected { background: var(--hover); color: var(--text); box-shadow: none; }
.collector,
.news-card,
.tg-mini-chart,
.tg-metric,
.settings-fold,
.notification-item { background: var(--surface); border-color: var(--line); box-shadow: none; }
.collector { padding: 30px; border-radius: 16px; }

.history { margin: 24px 0; border: 1px solid var(--line); border-radius: 12px; background: transparent; }
.history > summary { padding: 16px 20px; font-size: 12px; }
.feed-header { margin-top: 36px; margin-bottom: 20px; }
.feed-header h2 { font-size: 24px; font-weight: 400; letter-spacing: -.7px; }
.top-placeholder { padding: 14px 0; border: 0; border-radius: 0; background: transparent; font-size: 13px; }
.news-card { border-radius: 14px; padding: 26px; }
.news-card h3 { font-size: 19px; line-height: 1.55; letter-spacing: -.4px; }
.article-meta { font-size: 10px; gap: 12px; margin-bottom: 16px; }

.article-actions { gap: 8px; margin-top: 20px; }
.article-actions > a, .ai-button { font-size: 11px; height: 34px; padding: 0 12px; background: transparent; border-color: var(--line); border-radius: 7px; }
.source-tag { border-radius: 4px; font-size: 9px; letter-spacing: .5px; }
.source-tag.web, .source-tag.telegram { background: var(--inset); color: var(--muted); }

.tg-chart-grid { gap: 20px; margin-top: 28px; }
.tg-mini-chart { border-radius: 16px; padding: 24px 24px 20px; }
.tg-mini-heading h2 { font-size: 13px; color: var(--muted); font-weight: 400; }
.tg-mini-heading { gap: 10px; }
.tg-mini-heading strong { font-size: 34px; font-weight: 400; letter-spacing: -1px; }
.tg-mini-delta { font-size: 11px; min-height: 18px; margin: 8px 0 20px; }
.tg-mini-plot { min-height: 214px; }
.tg-mini-plot svg { display: block; width: 100%; height: 214px; max-height: none; overflow: visible; }
.tg-mini-plot svg text { font-family: inherit; font-weight: 400; }
.tg-mini-empty { height: 214px; }
.tg-chart-tooltip { padding: 9px 12px; border-radius: 8px; background: var(--surface); font-size: 11px; }
.tg-chart-note { font-size: 11px; line-height: 1.8; margin-top: 16px; color: var(--muted); }
.tg-chart-note:empty { display: none; }
.tg-controls { gap: 20px; }
.tg-controls > span { font-size: 11px; }
.workspace-disclosure { border-top: 1px solid var(--line); margin-top: 20px; }
.workspace-disclosure > summary { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 22px 0; cursor: pointer; list-style: none; font-size: 13px; color: var(--text); }
.workspace-disclosure > summary::-webkit-details-marker { display: none; }
.workspace-disclosure > summary::after { content: '+'; font-size: 18px; font-weight: 400; color: var(--muted); }
.workspace-disclosure[open] > summary::after { content: '−'; }
.workspace-disclosure > summary:hover { color: var(--muted); }
.tg-detail-section { padding: 0; background: transparent; }
.tg-detail-section[open] { padding-bottom: 22px; }
#settingsPage .settings-grid { max-width: 1000px; gap: 12px; }
.settings-fold { border-radius: 14px; }
.settings-fold > summary { padding: 24px 26px; min-height: 76px; }
.settings-fold > summary > span:first-child { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 24px; }
.settings-fold summary strong { font-weight: 400; font-size: 14px; }
.settings-fold summary small { font-size: 11px; color: var(--muted); }
.settings-fold[open] > summary { background: var(--surface-soft); }
#settingsPage .settings-fold > .settings-card { padding: 30px; }
.settings-card p, .settings-card small { font-size: 12px; }
.bot-heading .page-eyebrow { margin-bottom: 10px; }
.bot-heading h3 { font-size: 24px; font-weight: 400; letter-spacing: -.5px; }

.bot-status-pill { font-size: 11px; font-weight: 400; padding: 7px 10px; border-radius: 20px; }
.bot-status-pill::before { content: ''; display: inline-block; width: 5px; height: 5px; margin-right: 7px; border-radius: 50%; background: currentColor; vertical-align: 1px; }
.bot-metrics { gap: 0; margin: 30px 0 34px; padding: 24px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.bot-metrics > div { background: transparent; border: 0; border-right: 1px solid var(--line); border-radius: 0; padding: 4px 24px; }
.bot-metrics > div:first-child { padding-left: 0; }
.bot-metrics > div:last-child { border-right: 0; }
.bot-metrics dt { font-size: 11px; }
.bot-metrics dd { font-size: 36px; font-weight: 400; letter-spacing: -1px; margin-top: 12px; }
.bot-chart-heading { margin: 0 0 20px; }
.bot-chart-heading h3 { font-size: 14px; font-weight: 400; }
.bot-legend { font-size: 10px; gap: 16px; }
.bot-legend span::before { width: 6px; height: 6px; }
.bot-chart { border: 0; margin-bottom: 24px; min-height: 180px; padding-bottom: 0; }
.bot-bar-pair { border-color: var(--line); gap: 4px; }
.bot-bar-pair span { max-width: 22px; }
.bot-chart-value, .bot-chart-column { font-size: 10px; }
.bot-chart-value { color: var(--muted); }
.bot-diagnostics { margin-top: 24px; }
.bot-note { font-size: 12px; margin-bottom: 8px; }
.bot-source-row { padding: 18px 0; font-size: 12px; }
.bot-source-name strong { font-weight: 400; }
.bot-source-name small { font-size: 11px; }

.bot-control form { margin-top: 0; padding-top: 0; border-top: 0; }
.bot-input-grid { margin-top: 24px; }
.bot-input-grid textarea { background: var(--bg); }
.bot-source-controls { padding-top: 4px; }
.bot-actions { margin-top: 26px; gap: 10px; }
.bot-control #botMessage:not(:empty) { margin-top: 16px; }

#assistantWidget { display: none; }
.assistant-launcher { background: var(--surface); color: var(--text); border-color: var(--line-strong); padding: 13px; box-shadow: 0 6px 24px #0002; }
.assistant-launcher > span { display: none; }
.assistant-launcher:hover { background: var(--hover); }
.assistant-launcher svg { width: 21px; height: 21px; }
dialog, .assistant-panel { border-color: var(--line-strong); }

/* Local sign-in screen. All decoration stays inside the panel. */
.login-page { display: flex; min-height: 100dvh; padding: 0; align-items: center; justify-content: center; background: #1b1b1b; color: #eceaeb; color-scheme: dark; }
.login-page .login-frame { position: relative; isolation: isolate; display: flex; align-items: center; justify-content: center; width: 100%; min-height: 100dvh; padding: 76px 24px; border: 0; border-radius: 0; overflow: hidden; background: #1b1b1b; }
.login-frame::before { content: ''; z-index: -1; position: absolute; inset: 0; pointer-events: none; background: radial-gradient(ellipse 40% 48% at 94% 5%, #ffffff12 0%, #ffffff06 46%, transparent 78%), radial-gradient(ellipse 35% 42% at 2% 100%, #ffffff12 0%, #ffffff05 52%, transparent 82%); }
.login-page .login-card { display: flex; flex-direction: column; align-items: center; width: 300px; max-width: 100%; margin: 0; padding: 0; border: 0; border-radius: 0; box-shadow: none; background: transparent; }
.login-intro { margin: 0 -32px; padding: 0; text-align: center; }
.login-card h1 { margin: 0; font-size: 27px; line-height: 1.3; font-weight: 500; letter-spacing: -.8px; }
.login-card .login-intro p { margin: 10px 0 0; color: #a3a3a3; font-size: 13px; line-height: 1.5; }
.login-card form { width: 100%; margin-top: 38px; display: grid; gap: 12px; }
.login-card label { display: block; margin: 0; }
.login-field-label { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.login-card input { width: 100%; height: 41px; border: 1px solid #303030; border-radius: 12px; background: #212121; color: #eceaeb; padding: 0 13px; font-size: 12px; transition: border-color 160ms, background 160ms; box-shadow: 0 1px 2px #00000008; }
.login-card input::placeholder { color: #858585; opacity: 1; }
.login-card input:hover { border-color: #ffffff1c; }
.login-card input:focus { border-color: #ffffff60; outline: 2px solid #ffffff14; outline-offset: 2px; background: #ffffff03; }
.login-card .primary { position: relative; display: grid; place-items: center; width: 100%; justify-self: center; height: 41px; padding: 0 20px; margin-top: 2px; border: 1px solid #ffffffb3; border-radius: 13px; background: #dedcdd; color: #1b1b1b; font-size: 13px; font-weight: 500; box-shadow: 0 1px 2px #00000018; overflow: hidden; transition: width 350ms cubic-bezier(.22,1,.36,1), transform 140ms ease, box-shadow 180ms, background 180ms; }
.login-card .primary:hover { background: #efedee; box-shadow: 0 3px 16px #ffffff12; }
.login-card .primary:active { transform: scale(.96); }
.login-card .primary:focus-visible { outline: 2px solid #fff; outline-offset: 4px; }
.login-card .primary:disabled { opacity: 1; cursor: wait; }
.login-button-text { transition: opacity 140ms, transform 200ms; }
.login-button-dots { position: absolute; display: flex; align-items: center; gap: 5px; opacity: 0; }
.login-button-dots i { width: 4px; height: 4px; border-radius: 50%; background: #686868; }
.login-button-check { position: absolute; width: 19px; height: 19px; margin-right: 65px; fill: none; stroke: #179c60; stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; opacity: 0; }
.login-button-success { position: absolute; margin-left: 20px; opacity: 0; }
.login-card .primary.is-loading { width: 80%; }
.login-card .primary.is-loading .login-button-text, .login-card .primary.is-success .login-button-text { opacity: 0; transform: translateY(-10px); }
.login-card .primary.is-loading .login-button-dots { opacity: 1; transition: opacity 180ms 130ms; }
.login-card .primary.is-loading .login-button-dots i { animation: login-dot 850ms ease-in-out infinite; }
.login-card .primary.is-loading .login-button-dots i:nth-child(2) { animation-delay: 100ms; }
.login-card .primary.is-loading .login-button-dots i:nth-child(3) { animation-delay: 200ms; }
.login-card .primary.is-success .login-button-check, .login-card .primary.is-success .login-button-success { opacity: 1; animation: login-check-in 350ms ease both; }
.login-card .primary.is-pressed { animation: login-press 420ms cubic-bezier(.2,.8,.3,1); }
.login-card [role="alert"] { margin: 0; color: #eda9a9; font-size: 12px; line-height: 1.5; text-align: center; }
.login-card [role="alert"]:empty { display: none; }
@keyframes login-dot { 0%, 60%, 100% { transform: translateY(0); opacity: .5; } 30% { transform: translateY(-4px); opacity: 1; } }
@keyframes login-press { 0% { transform: scale(1); } 32% { transform: scale(.95); } 70% { transform: scale(1.025); } 100% { transform: scale(1); } }
@keyframes login-check-in { from { transform: scale(.6); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .login-page *, .login-page *::before { animation: none !important; transition: none !important; } }

@media (min-width: 1600px) {
  .shell main { padding-top: 60px; padding-left: 64px; padding-right: 64px; }
}
@media (max-width: 1100px) {
  .sidebar { width: 204px; padding-left: 12px; padding-right: 12px; }
  .shell { margin-left: 204px; }
  .shell main { padding: 36px 30px 90px; }
  .topbar { padding: 0 30px; }
  .tg-chart-grid { grid-template-columns: 1fr; }

  .bot-metrics > div { padding-left: 16px; padding-right: 16px; }

}
@media (max-width: 750px) {
  .sidebar { position: static; display: grid; grid-template-columns: 1fr auto; width: 100%; padding: 18px 20px 12px; gap: 14px; }

  .sidebar nav { display: flex; grid-column: 1 / -1; grid-row: 2; width: 100%; gap: 6px; margin: 0; }
  .sidebar .nav, .sidebar nav > #tasksNav { font-size: 12px; }
  .sidebar-footer { grid-column: 2; grid-row: 1; width: auto; border: 0; padding: 0; margin: 0; gap: 4px; }
  .sidebar-footer .profile-nav { margin-bottom: 0; padding: 0; width: 34px; flex: 0 0 34px; justify-content: center; }
  .sidebar-footer .profile-info, .sidebar-footer .profile-chevron { display: none; }
  .sidebar-footer #settingsNav, .sidebar-footer #notificationsNav { width: 34px; height: 34px; padding: 0; justify-content: center; font-size: 0; gap: 0; }
  .sidebar-footer #settingsNav > span:not(.notification-badge), .sidebar-footer #notificationsNav > span:not(.notification-badge) { font-size: 0; }
  .shell { margin-left: 0; }
  .shell main { padding: 32px 22px 84px; }
  .topbar { height: 54px; padding: 0 22px; }
  .topbar #pageTitle { display: block; font-size: 11px; }
  .topbar #today { display: none; }
  .topbar-actions { width: auto; margin-left: auto; }
  .page-head, .stats-heading { margin-bottom: 28px; }
  .page-eyebrow { font-size: 9px; margin-bottom: 12px; letter-spacing: 1.3px; }
  h1 { font-size: 30px; letter-spacing: -1.2px; }
  .collector { padding: 22px; }

  .settings-fold > summary { padding: 20px; min-height: 72px; }
  .settings-fold > summary > span:first-child { display: grid; gap: 6px; }
  #settingsPage .settings-fold > .settings-card { padding: 22px; }
  .bot-heading { align-items: center; gap: 12px; }
  .bot-heading > button { width: auto; height: 36px; min-height: 36px; padding: 0 12px; }
  .bot-heading h3 { font-size: 21px; }
  .bot-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); row-gap: 24px; padding: 24px 0; margin: 24px 0 28px; }
  .bot-metrics > div { padding: 0 16px; }
  .bot-metrics > div:nth-child(2) { border-right: 0; }
  .bot-metrics > div:nth-child(3) { padding-left: 0; }
  .bot-metrics dd { font-size: 30px; margin-top: 8px; }
  .bot-input-grid { grid-template-columns: 1fr; }
  .bot-legend { font-size: 9px; gap: 10px; }
  .workspace-disclosure > summary { font-size: 12px; padding: 20px 0; }
  .bot-chart-heading h3 { font-size: 12px; }

  .bot-source-row { grid-template-columns: minmax(0, 1fr) auto; }
  .bot-source-name { grid-column: 1 / -1; }
  .tg-mini-chart { padding: 22px 18px 16px; }
  .tg-mini-heading { flex-direction: column; align-items: flex-start; }
  .news-card { padding: 22px; }
  .news-card h3 { font-size: 17px; }
  input, select, textarea { font-size: 16px; }
  .login-page { padding: 0; }
  .login-page .login-frame { min-height: 100dvh; padding: 60px 28px; }
  .login-card h1 { font-size: 25px; }
  .login-card input { font-size: 16px; }
  .login-intro { margin-left: -12px; margin-right: -12px; }
}
@media (max-width: 380px) {
  .sidebar { padding: 18px 14px; }
  .shell main { padding-left: 16px; padding-right: 16px; }
  #settingsPage .settings-fold > .settings-card { padding: 18px; }
  .collector { padding: 18px; }
  .segmented button { padding: 0 5px; font-size: 10px; }
  .bot-legend { gap: 8px; }
  .login-page { padding: 0; }
  .login-page .login-frame { min-height: 100dvh; padding: 48px 24px; }
}

/* Compact news workspace: scoped to news so other pages keep their layout. */
body:has(.news-main) {
  --news-dock-gap: max(12px, env(safe-area-inset-bottom));
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
}
.shell:has(.news-main), .shell main.news-main, #newsPage { display: flex; flex: 1; flex-direction: column; }
.shell main.news-main { width: 100%; padding-bottom: var(--news-dock-gap); }
#newsPage .news-page-head { position: relative; margin-bottom: 20px; }
#newsPage .news-intro { text-align: center; }
#newsPage .news-intro h1 { margin: 0; font-size: clamp(26px, 2.5vw, 34px); line-height: 1.2; letter-spacing: -1px; }
#newsPage .news-intro time { display: block; margin-top: 8px; color: var(--subtle); font-size: 13px; }
@media (min-width: 751px) {
  #newsPage { --news-title-center: calc(var(--workspace-sidebar-inset) + 33px); }
  :root[data-sidebar-collapsed="true"] #newsPage { --news-title-center: calc(var(--workspace-sidebar-inset) + 23px); }
  #newsPage .news-page-head:has(.news-intro:not([hidden])) { position: static; min-height: 54px; }
  #newsPage .news-intro {
    position: absolute;
    top: var(--news-title-center);
    left: 50%;
    width: max-content;
    transform: translate(-50%, -50%);
    transition: left 680ms cubic-bezier(.22,1,.36,1);
  }
  :root:not([data-sidebar-collapsed="true"]) #workspaceMain:not([data-search-focus="true"]) .news-intro {
    left: calc(50% + (var(--workspace-sidebar-width) + var(--workspace-sidebar-inset)) / 2);
  }
  #newsPage .news-intro time { position: absolute; top: 100%; inset-inline: 0; }
  #newsPage:has(.ai-activity:not([hidden])) .news-intro { top: 106px; }
}
@media (max-width: 750px) {
  #newsPage .news-page-head:has(.news-intro:not([hidden])) {
    display: grid;
    grid-template-columns: minmax(30px, 1fr) auto minmax(30px, 1fr);
    align-items: start;
  }
  #newsPage .news-intro { grid-column: 2; }
  #newsPage .news-header-tools { grid-column: 3; }
}

#newsPage #historyStatus { display: block; font-size: 12px; color: var(--muted); margin-bottom: 12px; }
#newsPage .news-dock {
  position: sticky;
  z-index: 30;
  bottom: var(--news-dock-gap);
  align-self: center;
  width: min(94%, 1040px);
  margin-top: auto;
}
#newsPage .news-dock-panel.is-sliding { overflow: clip; }
#newsPage .news-dock-toggle {
  display: flex; align-items: center; gap: 6px; min-height: 30px; margin: 0 auto 6px; padding: 0 12px;
  border: 1px solid var(--line-strong); border-radius: 999px; background: var(--surface); color: var(--muted); font-size: 12px;
}
#newsPage .news-dock-toggle:hover { background: var(--hover); color: var(--text); }
#newsPage .news-dock-toggle svg { width: 15px; height: 15px; }
#newsPage .news-dock-toggle[aria-expanded="false"] svg { transform: rotate(180deg); }
#newsPage .news-collector {
  padding: clamp(12px, 1.5vw, 18px);
  border: 1px solid var(--line-strong);
  border-radius: 24px;
  background: var(--surface);
  box-shadow: 0 -6px 20px #0002;
}
#newsPage .top-section { margin-bottom: 16px; }
#newsPage .news-search-row #query { width: 100%; height: 38px; margin: 0; padding: 0; border: 0; border-radius: 0; background: transparent; font-size: 16px; }
#newsPage .news-search-row #query::placeholder { color: var(--subtle); }
#newsPage .news-search-row #query:focus { outline: 0; box-shadow: none; }

#newsPage .news-filter-toolbar { position: relative; display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px; margin-top: 8px; }
#newsPage .news-filter-actions { display: flex; flex: 1; justify-content: space-between; align-items: center; gap: 8px; min-width: max-content; }
#newsPage .news-periods { --period-index: 1; position: relative; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 2px; padding: 3px; border-radius: 999px; background: var(--surface-soft); }
#newsPage .news-periods:has([data-period="day"][aria-pressed="true"]) { --period-index: 0; }
#newsPage .news-periods:has([data-period="month"][aria-pressed="true"]) { --period-index: 2; }
#newsPage .news-periods::before {
  content: '';
  position: absolute;
  inset: 3px auto 3px 3px;
  width: calc((100% - 10px) / 3);
  border-radius: 999px;
  background: var(--button-bg);
  pointer-events: none;
  transform: translateX(calc(var(--period-index) * (100% + 2px)));
  transition: transform 480ms cubic-bezier(.25,.65,.25,1);
}
#newsPage .news-periods button { position: relative; min-height: 30px; padding: 0 11px; border: 0; border-radius: 999px; background: transparent; color: var(--muted); font-size: 13px; transition: color 300ms ease; }
#newsPage .news-periods button[aria-pressed="true"] { color: var(--button-text); }
@media (hover: hover) {
  #newsPage .news-periods button[aria-pressed="false"]:hover:not(:disabled) { color: var(--text); }
}
@media (prefers-reduced-motion: reduce) {
  #newsPage .news-periods::before, #newsPage .news-periods button { transition: none; }
}
#newsPage .news-filter-chips { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; padding-inline-start: 12px; border-inline-start: 1px solid var(--line-strong); }
#newsPage .news-filter-chip, #newsPage .news-filter-menu > summary { display: inline-flex; align-items: center; gap: 7px; min-height: 34px; padding: 0 11px; border: 1px solid transparent; border-radius: 9px; background: var(--hover); color: var(--text); font-size: 12px; white-space: nowrap; }
#newsPage .news-filter-chip { cursor: default; }
#newsPage .news-filter-menu { position: relative; }
#newsPage .news-filter-menu > summary { list-style: none; cursor: pointer; border-color: var(--line-strong); background: var(--surface-soft); }
#newsPage .news-filter-menu > summary::-webkit-details-marker { display: none; }
#newsPage .news-filter-menu > summary:hover, #newsPage .news-filter-menu[open] > summary { background: var(--hover); }
#newsPage .news-filter-menu > summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
#newsPage .news-filter-menu > summary[aria-disabled="true"] { opacity: .45; cursor: default; }
#newsPage .news-filter-menu > summary svg { width: 16px; height: 16px; flex-shrink: 0; }
#newsPage .news-filter-options { position: absolute; z-index: 25; inset: auto 0 calc(100% + 8px) auto; display: grid; gap: 12px; width: 240px; padding: 14px; border: 1px solid var(--line-strong); border-radius: 12px; background: var(--surface); box-shadow: var(--shadow); }
#newsPage .news-filter-options label { display: grid; gap: 6px; margin: 0; }
#newsPage .news-filter-options select { width: 100%; min-width: 0; height: 36px; margin: 0; padding: 0 10px; }
#newsPage .feed-header { margin: 0 0 8px; padding-bottom: 12px; border-bottom: 1px solid var(--line); gap: 12px; flex-wrap: wrap; align-items: flex-start; }
#newsPage .news-results-heading { min-width: 0; flex: 1; }
#newsPage .news-results-title { display: flex; align-items: center; flex-wrap: wrap; gap: 12px 22px; min-height: 38px; }
#newsPage .feed-header h2 { font-size: 22px; line-height: 1.3; margin: 0; }

#newsPage .top-grid { grid-template-columns: minmax(0, 1fr); gap: 16px; }
#newsPage .top-group-head { font-size: 13px; padding: 8px 0; }
#newsPage .news-card { display: grid; grid-template-columns: 34px minmax(0, 1fr); gap: 18px; margin-top: 10px; padding: 18px 20px; border: 1px solid var(--line-strong); border-radius: 10px; }
#newsPage .article-number { display: flex; justify-content: center; align-items: flex-start; border-right: 1px solid var(--line-strong); padding: 3px 14px 0 0; font-size: 18px; font-weight: 500; color: var(--muted); }
#newsPage .news-card h3 { margin: 0 0 6px; font-size: 17px; line-height: 1.45; overflow-wrap: anywhere; }
#newsPage .article-meta { gap: 8px; margin-bottom: 0; font-size: 11px; }
#newsPage .rank-label { display: none; }

#newsPage .article-actions { gap: 6px; margin-top: 10px; flex-wrap: wrap; }
#newsPage .article-actions > a, #newsPage .ai-button { height: 30px; padding: 0 10px; }
@media (max-width: 700px) {
  #newsPage .news-dock { width: 100%; }
  #newsPage .news-filter-options select { font-size: 16px; }
  #newsPage .news-filter-chips { padding-inline-start: 0; border: 0; }
  #newsPage .news-filter-menu { position: static; }
  #newsPage .news-filter-options { inset: auto auto calc(100% + 8px) 0; width: min(240px, 100%); }
  #newsPage .feed-header { flex-direction: column; }
  #newsPage .news-results-title { gap: 12px; }
  #newsPage .feed-header h2 { font-size: 20px; }
  #newsPage .news-card { grid-template-columns: 24px minmax(0, 1fr); padding: 16px 12px; gap: 12px; }
  #newsPage .article-number { padding-right: 8px; font-size: 15px; }
  #newsPage .news-card h3 { font-size: 16px; }
}

/* Keep page controls in the upper-right corner. */
.shell main.news-main { padding-top: 20px; }
#newsPage .news-header-tools { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
#newsPage .topbar-actions { order: -1; display: flex; align-items: center; gap: 16px; }
#newsPage .theme-toggle { width: 30px; height: 30px; }
#newsPage #today { display: none; }

@media (max-width: 700px) {
  .shell main.news-main { padding-top: 16px; }
  #newsPage .topbar-actions { gap: 8px; margin: 0; }
}

/* Neutral graphite also covers overlays and editor preview surfaces. */
:root[data-theme="dark"] dialog::backdrop { background: var(--backdrop); }
:root[data-theme="dark"] .telegram-screen { background: var(--bg); scrollbar-color: var(--scrollbar) transparent; }
:root[data-theme="dark"] .telegram-message { background: var(--surface); color: var(--text); }
:root[data-theme="dark"] .telegram-avatar { background: var(--hover); color: var(--text); }

:root[data-theme="dark"] .phone-camera { background: var(--bg); border-color: var(--line); }

#newsPage .collection-warnings:empty { display: none; }
#newsPage .collection-warnings { margin-top: 12px; padding: 0; color: var(--warning); font-size: 12px; line-height: 1.6; }

/* A floating activity notch, driven by real selection/check requests. */
.ai-activity { --activity-ink: #101010; --pixel-color: #e7bb91; position: fixed; top: 0; left: calc(50% + 114px); transform: translateX(-50%); z-index: 60; width: 326px; max-width: calc(100vw - 36px); padding: 13px 24px 16px; border: 1px solid #ffffff0a; border-top: 0; border-radius: 0 0 24px 24px; background: var(--activity-ink); color: #efedee; box-shadow: 0 12px 28px #0003; pointer-events: none; transform-origin: center top; will-change: transform, opacity; }
.ai-activity::before, .ai-activity::after { content: ''; position: absolute; top: 0; width: 20px; height: 20px; }
.ai-activity::before { right: calc(100% - 1px); background: radial-gradient(circle at 0 100%, transparent 19px, var(--activity-ink) 20px); }
.ai-activity::after { left: calc(100% - 1px); background: radial-gradient(circle at 100% 100%, transparent 19px, var(--activity-ink) 20px); }
.ai-activity:disabled { opacity: 1; }
.ai-activity:not(:disabled) { cursor: pointer; pointer-events: auto; }
.ai-activity:not(:disabled):hover, .ai-activity:focus-visible {
  --activity-ink: #242126;
  border-color: #f2c4dc38;
  box-shadow: 0 14px 32px #0006, inset 0 -1px 0 #f2c4dc20;
}
.ai-activity:not(:disabled):active { box-shadow: inset 0 2px 12px #0007; }

.ai-activity-line { display: flex; align-items: center; justify-content: center; gap: 11px; min-height: 24px; font-size: 15px; line-height: 1.4; }
.ai-activity-pixels { display: grid; grid-template-columns: repeat(2, 6px); grid-template-rows: repeat(2, 6px); gap: 2px; color: var(--pixel-color); filter: drop-shadow(0 0 5px currentColor); animation: ai-pixel-hue 5s ease-in-out infinite; }
.ai-activity-pixels i { background: currentColor; animation: ai-pixel-light 1.6s ease-in-out infinite; }
.ai-activity-pixels i:nth-child(2) { animation-delay: -.4s; }
.ai-activity-pixels i:nth-child(3) { animation-delay: -1.2s; }
.ai-activity-pixels i:nth-child(4) { animation-delay: -.8s; }
.ai-activity[data-phase="checking"] { --pixel-color: #9ecfe7; }
@keyframes ai-pixel-light { 0%, 100% { opacity: .25; transform: scale(.65); } 40%, 60% { opacity: 1; transform: scale(1); } }
@keyframes ai-pixel-hue { 0%, 100% { color: var(--pixel-color); } 50% { color: #d39dad; } }
@keyframes ai-activity-enter { from { opacity: 0; transform: translate(-50%, -100%); } to { opacity: 1; transform: translate(-50%, 0); } }
@media (max-width: 1100px) and (min-width: 751px) { .ai-activity { left: calc(50% + 102px); } }
@media (max-width: 750px) { .ai-activity { left: 50%; width: 280px; padding: 10px 18px 13px; } .ai-activity-line { font-size: 14px; } }
@media (prefers-reduced-motion: reduce) { .ai-activity, .ai-activity-pixels, .ai-activity-pixels i { animation: none; } }
.shell main.news-main:has(.ai-activity:not([hidden])) { padding-top: 104px; }
@media (max-width: 750px) {
  .shell main.news-main:has(.ai-activity:not([hidden])) { padding-top: 16px; }
  .ai-activity { position: relative; top: auto; margin-top: -16px; margin-bottom: 22px; }
}

/* Match the sign-in button and soften the notch/layout transitions. */
.shell main.news-main { transition: padding-top 620ms cubic-bezier(.22,1,.36,1); }
#newsPage #collectBtn { position: relative; display: grid; place-items: center; flex: 0 0 36px; width: 36px; height: 36px; min-height: 36px; padding: 0; border-radius: 50%; overflow: hidden; transition: transform 140ms ease, background 180ms; }
#newsPage #collectBtn:active { transform: scale(.96); }
.collect-button-arrow, .collect-button-success { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.collect-button-arrow { transition: opacity 180ms, transform 240ms ease; }
.collect-button-dots { position: absolute; display: flex; gap: 3px; opacity: 0; }
.collect-button-dots i { width: 3px; height: 3px; border-radius: 50%; background: currentColor; }
.collect-button-success { position: absolute; stroke: #179c60; opacity: 0; }
#newsPage #collectBtn:disabled { opacity: 1; cursor: wait; }
#newsPage #collectBtn.is-loading .collect-button-arrow, #newsPage #collectBtn.is-success .collect-button-arrow { opacity: 0; transform: translateY(-10px); }
#newsPage #collectBtn.is-loading .collect-button-dots { opacity: 1; transition: opacity 180ms 130ms; }
#newsPage #collectBtn.is-loading .collect-button-dots i { animation: login-dot 850ms ease-in-out infinite; }
#newsPage #collectBtn.is-loading .collect-button-dots i:nth-child(2) { animation-delay: 100ms; }
#newsPage #collectBtn.is-loading .collect-button-dots i:nth-child(3) { animation-delay: 200ms; }
#newsPage #collectBtn.is-pressed { animation: login-press 420ms cubic-bezier(.2,.8,.3,1); }
#newsPage #collectBtn.is-success { animation: collect-success 550ms ease both; }
#newsPage #collectBtn.is-success .collect-button-success { opacity: 1; animation: login-check-in 350ms ease both; }
@keyframes collect-success { from { transform: scale(.97); } to { transform: scale(1); } }
@media (prefers-reduced-motion: reduce) {
  .shell main.news-main, #newsPage #collectBtn, #newsPage #collectBtn * { transition: none; animation: none; }
}

/* The activity notch has one label, with a brief completion state. */
.ai-activity { padding-top: 17px; padding-bottom: 18px; }
.ai-activity-check { display: none; width: 19px; height: 19px; fill: none; stroke: #a6c7b1; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.ai-activity[data-phase="done"] .ai-activity-pixels { display: none; }
.ai-activity[data-phase="done"] .ai-activity-check { display: block; }
.shell main.news-main:has(.ai-activity:not([hidden])) { padding-top: 84px; }
@media (max-width: 750px) { .shell main.news-main:has(.ai-activity:not([hidden])) { padding-top: 16px; } }

/* Search focus: slide navigation away and expand the news workspace. */
@media (min-width: 751px) {
  .sidebar { transition: transform 680ms cubic-bezier(.22,1,.36,1), opacity 480ms ease; }
  .shell { transition: margin-left 680ms cubic-bezier(.22,1,.36,1); }
  .ai-activity { transition: left 680ms cubic-bezier(.22,1,.36,1), background 160ms, border-color 160ms, box-shadow 160ms; }
  body:has(#workspaceMain[data-search-focus="true"]) .sidebar { transform: translateX(calc(-100% - var(--workspace-sidebar-inset))); opacity: 0; pointer-events: none; }
  .shell:has(#workspaceMain[data-search-focus="true"]) { margin-left: 0; }
  .shell:has(#workspaceMain[data-search-focus="true"]) main.news-main { max-width: none; }
  #workspaceMain[data-search-focus="true"] .ai-activity { left: 50%; }
  #newsPage:has(.news-intro:not([hidden])) .ai-activity { left: 50%; }
}
@media (prefers-reduced-motion: reduce) { .sidebar, .shell, .ai-activity { transition: none; } }

/* News reads as an editorial list, without boxed cards. */
#newsPage .top-grid { gap: 24px; }
#newsPage .top-group-head { padding: 12px 0; color: var(--muted); font-size: 12px; }
#newsPage .news-card { grid-template-columns: 38px minmax(0, 1fr); gap: 20px; margin: 0; padding: 22px 0; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; background: transparent; box-shadow: none; }
#newsPage .top-group:last-child > .news-card:last-child { border-bottom: 0; padding-bottom: 0; }
#newsPage .article-number { display: block; border: 0; padding: 2px 0 0; font-size: 25px; line-height: 1.2; font-weight: 400; letter-spacing: -1px; color: var(--subtle); opacity: .65; transition: color 200ms, opacity 200ms; }
#newsPage .news-card h3 { margin: 0 0 8px; font-size: 19px; line-height: 1.5; font-weight: 500; letter-spacing: -.35px; }
#newsPage .news-card:focus-within .article-number, #newsPage .news-card:hover .article-number { color: var(--text); opacity: 1; }
#newsPage .article-meta { gap: 10px; font-size: 11px; }
#newsPage .source-tag { background: transparent; padding: 0; font-size: 9px; letter-spacing: .7px; }

#newsPage .article-actions { margin-top: 10px; gap: 18px; }
#newsPage .article-actions > a, #newsPage .article-actions .ai-button { border: 0; border-radius: 0; background: transparent; padding: 0; height: 30px; color: var(--muted); font-size: 11px; box-shadow: none; }
#newsPage .article-actions > a:hover, #newsPage .article-actions .ai-button:hover { color: var(--text); background: transparent; text-decoration: underline; text-underline-offset: 4px; }
#newsPage .telegram-delivery-button {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}
#newsPage .telegram-delivery-button[data-delivery="sending"]::before {
  content: "";
  width: 12px;
  height: 12px;
  border: 1px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: telegram-delivery-spin .8s linear infinite;
}
#newsPage .telegram-delivery-button[data-delivery="delivered"] {
  color: var(--success, var(--text));
  opacity: 1;
  animation: telegram-delivery-pop .35s ease-out;
}
#newsPage .telegram-delivery-button[data-delivery="delivered"]::before { content: "✓"; }
.telegram-delivery-status {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  overflow-wrap: anywhere;
}
.telegram-delivery-status code { color: var(--text); user-select: all; }
@keyframes telegram-delivery-spin { to { transform: rotate(360deg); } }
@keyframes telegram-delivery-pop {
  0% { transform: scale(.94); }
  55% { transform: scale(1.06); }
  100% { transform: scale(1); }
}
@media (prefers-reduced-motion: reduce) {
  #newsPage .telegram-delivery-button[data-delivery="sending"]::before,
  #newsPage .telegram-delivery-button[data-delivery="delivered"] { animation: none; }
}
@media (max-width: 700px) {
  #newsPage .news-card { grid-template-columns: 26px minmax(0, 1fr); gap: 14px; padding: 20px 0; }
  #newsPage .article-number { font-size: 20px; }
  #newsPage .news-card h3 { font-size: 17px; }
  #newsPage .article-actions { gap: 14px; }
  #newsPage .article-actions > a, #newsPage .article-actions .ai-button { height: 34px; }
}
@media (prefers-reduced-motion: reduce) { #newsPage .article-number { transition: none; } }

/* Keep secondary result actions in one quiet disclosure. */
#newsPage .feed-header { flex-direction: row; align-items: center; }
#newsPage .evaluation-summary { color: var(--subtle); font-size: 11px; line-height: 1.6; white-space: nowrap; font-variant-numeric: tabular-nums; }
#newsPage .news-results-menu { position: relative; flex-shrink: 0; }
#newsPage .news-results-menu > summary { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 8px; color: var(--muted); font-size: 25px; line-height: 1; cursor: pointer; list-style: none; transition: color 160ms, background 160ms; }
#newsPage .news-results-menu > summary::-webkit-details-marker { display: none; }
#newsPage .news-results-menu > summary:hover, #newsPage .news-results-menu[open] > summary { background: var(--hover); color: var(--text); }
#newsPage .news-results-menu > summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
#newsPage .news-results-options { position: absolute; right: 0; top: calc(100% + 8px); z-index: 20; display: grid; gap: 4px; width: 210px; padding: 6px; border: 1px solid var(--line-strong); border-radius: 10px; background: var(--surface); box-shadow: var(--shadow); }
#newsPage .news-results-options > button { min-height: 38px; height: auto; width: 100%; margin: 0; padding: 9px 12px; border: 0; border-radius: 6px; background: transparent; color: var(--text); font-size: 12px; line-height: 1.5; text-align: left; }
#newsPage .news-results-options > button:hover { background: var(--hover); }

/* One icon column, with an optional compact desktop navigation rail. */
.sidebar-tools { display: none; }
@media (min-width: 751px) {
  :root { --workspace-sidebar-width: 220px; --workspace-sidebar-inset: 16px; }
  .sidebar { inset: var(--workspace-sidebar-inset) auto var(--workspace-sidebar-inset) var(--workspace-sidebar-inset); width: var(--workspace-sidebar-width); padding: 16px; gap: 16px; background: transparent; border: 1px solid transparent; isolation: isolate; transition: width 680ms cubic-bezier(.22,1,.36,1), padding 680ms cubic-bezier(.22,1,.36,1), transform 680ms cubic-bezier(.22,1,.36,1), opacity 480ms ease; }
  .sidebar-tools { display: flex; align-items: center; height: 32px; flex: 0 0 32px; padding-left: 8px; }
  .sidebar-toggle { width: 32px; height: 32px; padding: 6px; display: grid; place-items: center; border: 0; border-radius: 8px; background: transparent; color: var(--muted); }
  .sidebar-toggle:hover { color: var(--text); background: var(--hover); }
  .sidebar-toggle svg { width: 20px; height: 20px; transition: transform 680ms cubic-bezier(.22,1,.36,1); }
  .sidebar nav { gap: 8px; flex-shrink: 0; }
  .sidebar .nav { padding: 0 14px; gap: 13px; }
  .sidebar .nav > svg { width: 20px; height: 20px; }
  .sidebar .nav > span, .sidebar .profile-info, .sidebar .profile-chevron { white-space: nowrap; opacity: 1; transition: opacity 220ms ease, transform 400ms cubic-bezier(.22,1,.36,1); }
  .sidebar .nav-children { margin: 4px 0 8px; padding: 0; border: 0; }
  .sidebar .nav-children .nav { height: 42px; }
  .sidebar .profile-nav { padding: 8px; gap: 12px; margin-bottom: 8px; }
  .sidebar .profile-avatar { width: 32px; height: 32px; border-radius: 11px; }
  .sidebar-footer { flex-shrink: 0; }
  .shell { margin-left: calc(var(--workspace-sidebar-width) + var(--workspace-sidebar-inset)); }
  .shell main.news-main { padding-inline: clamp(24px, 3vw, 44px); }
  .ai-activity { left: calc(50% + (var(--workspace-sidebar-width) + var(--workspace-sidebar-inset)) / 2); }
  :root[data-sidebar-collapsed="true"] { --workspace-sidebar-width: 68px; }
  :root[data-sidebar-collapsed="true"] .sidebar-tools { padding-left: 8px; }
  :root[data-sidebar-collapsed="true"] .sidebar .nav { position: relative; padding-left: 14px; gap: 0; }
  :root[data-sidebar-collapsed="true"] .sidebar .nav > span:not(.notification-badge),
  :root[data-sidebar-collapsed="true"] .sidebar .profile-info,
  :root[data-sidebar-collapsed="true"] .sidebar .profile-chevron { opacity: 0; transform: translateX(-8px); pointer-events: none; width: 0; overflow: hidden; }
  :root[data-sidebar-collapsed="true"] .sidebar .nav-chevron { margin-left: 0; }
  :root[data-sidebar-collapsed="true"] .sidebar .profile-nav { gap: 0; }
  :root[data-sidebar-collapsed="true"] .sidebar .notification-badge { position: absolute; top: 5px; right: 4px; min-width: 15px; height: 15px; padding: 0 3px; font-size: 9px; }
  /* Search focus takes precedence over the user's compact/expanded preference. */
  .shell:has(#workspaceMain[data-search-focus="true"]) { margin-left: 0; }
  #workspaceMain[data-search-focus="true"] .ai-activity { left: 50%; }
}
@media (max-width: 1100px) and (min-width: 751px) { :root:not([data-sidebar-collapsed="true"]) { --workspace-sidebar-width: 204px; } }
@media (prefers-reduced-motion: reduce) {
  #newsPage .news-intro,
  .sidebar, .shell, .ai-activity, .sidebar .nav > span, .sidebar .profile-info, .sidebar .profile-chevron, .sidebar-toggle svg { transition: none; }
}

/* Compact groups open beside the rail, preserving both destinations. */
.sidebar-flyout { position: fixed; z-index: 80; width: 220px; padding: 8px; border: 1px solid var(--line-strong); border-radius: 14px; background: var(--surface); box-shadow: 0 16px 48px #0003; transform-origin: left top; }
.sidebar-flyout-title { padding: 8px 12px 10px; color: var(--subtle); font-size: 11px; }
.sidebar-flyout .nav { height: 44px; gap: 12px; padding: 0 12px; font-size: 13px; border-radius: 8px; }
.sidebar-flyout .nav svg { width: 20px; height: 20px; }
.sidebar-flyout .nav.active { color: var(--text); }
@media (min-width: 751px) {
  .sidebar { overflow: visible; }
  .sidebar nav { min-height: 0; overflow-y: auto; flex-shrink: 1; scrollbar-width: thin; }
  .sidebar-tools, :root[data-sidebar-collapsed="true"] .sidebar-tools { position: static; width: 100%; height: 32px; flex: 0 0 32px; padding: 0; justify-content: flex-end; }
  .sidebar-toggle { width: 32px; height: 32px; padding: 6px; border: 0; border-radius: 8px; background: transparent; box-shadow: none; transition: width 680ms cubic-bezier(.22,1,.36,1), height 680ms cubic-bezier(.22,1,.36,1), border-radius 680ms cubic-bezier(.22,1,.36,1), background 160ms; }
  .sidebar-toggle svg { width: 15px; height: 15px; }
  :root[data-sidebar-collapsed="true"] .sidebar { padding: 0 12px 12px; gap: 8px; }
  .sidebar::before {
    content: '';
    position: absolute;
    inset: 0;
    z-index: -1;
    background: var(--surface-soft);
    border: 1px solid var(--line-strong);
    border-radius: 20px;
    transition: top 680ms cubic-bezier(.22,1,.36,1), border-radius 680ms cubic-bezier(.22,1,.36,1), background 320ms ease;
  }
  :root[data-sidebar-collapsed="true"] .sidebar::before { top: 56px; background: var(--accent-soft); border-radius: 26px; }
  :root[data-sidebar-collapsed="true"] .sidebar-tools { height: 44px; flex-basis: 44px; justify-content: center; }
  :root[data-sidebar-collapsed="true"] .sidebar-toggle { width: 44px; height: 44px; padding: 0; border: 1px solid var(--line-strong); border-radius: 50%; background: var(--surface-soft); color: var(--text); }
  :root[data-sidebar-collapsed="true"] .sidebar-toggle:hover { background: var(--hover); }
  :root[data-sidebar-collapsed="true"] .sidebar-toggle .sidebar-chevron { width: 20px; height: 20px; transform: rotate(180deg); }
  :root[data-sidebar-collapsed="true"] .sidebar nav { margin-top: 8px; gap: inherit; }
  :root[data-sidebar-collapsed="true"] .sidebar .nav { justify-content: center; height: 42px; padding: 0; border-radius: 13px; }
  :root[data-sidebar-collapsed="true"] .sidebar .nav:focus-visible { outline-offset: -2px; }
  :root[data-sidebar-collapsed="true"] .sidebar-footer { display: contents; }
  :root[data-sidebar-collapsed="true"] .sidebar-footer .nav { flex: 0 0 42px; margin: 0; gap: 0; }
  :root[data-sidebar-collapsed="true"] .sidebar-footer #notificationsNav { margin-top: 0; gap: 0; }
  :root[data-sidebar-collapsed="true"] .sidebar .profile-nav { flex-shrink: 0; justify-content: center; margin: auto 0 0; padding: 3px; }
  :root[data-sidebar-collapsed="true"] .sidebar .profile-avatar { border-radius: 50%; }
  :root[data-sidebar-collapsed="true"] .sidebar .nav-children { display: none; }
}
@media (max-width: 750px) { .sidebar-flyout { display: none; } }
@media (prefers-reduced-motion: reduce) { .sidebar::before, .sidebar-toggle { transition: none; } }

.sidebar-menu-label { color: var(--subtle); font-size: 12px; font-weight: 500; white-space: nowrap; margin-right: auto; padding-left: 14px; transition: opacity 220ms ease; }
@media (min-width: 751px) {
  :root[data-sidebar-collapsed="true"] .sidebar-menu-label { opacity: 0; width: 0; padding: 0; margin: 0; overflow: hidden; }
}
@media (prefers-reduced-motion: reduce) { .sidebar-menu-label { transition: none; } }

/* Hover uses a muted layer. Only the current sidebar destination has a light fill. */
:is(.sidebar, .sidebar-flyout) .nav,
.sidebar .profile-nav {
  position: relative;
  isolation: isolate;
  background: transparent;
  transition: color 260ms ease;
}
:is(.sidebar, .sidebar-flyout) .nav::before,
.sidebar .profile-nav::before,
.sidebar .nav::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: inherit;
  pointer-events: none;
  opacity: 0;
  transform: scale(.96);
}
:is(.sidebar, .sidebar-flyout) .nav::before,
.sidebar .profile-nav::before {
  background: var(--line-strong);
  transition: opacity 320ms ease, transform 420ms cubic-bezier(.25,.65,.25,1);
}
.sidebar .nav::after { background: var(--button-bg); }
.sidebar .nav.active { color: var(--button-text); }
.sidebar .nav.active::after {
  opacity: 1;
  transform: scale(1);
  transition: opacity 360ms ease-out, transform 480ms cubic-bezier(.25,.65,.25,1);
}
.sidebar-flyout .nav.active::before { opacity: 1; transform: scale(1); }
@media (min-width: 751px) {
  :root[data-sidebar-collapsed="true"] .sidebar .nav-group.has-current > summary { color: var(--button-text); }
  :root[data-sidebar-collapsed="true"] .sidebar .nav-group.has-current > summary::after {
    opacity: 1;
    transform: scale(1);
    transition: opacity 360ms ease-out, transform 480ms cubic-bezier(.25,.65,.25,1);
  }
}
@media (hover: hover) {
  :is(.sidebar, .sidebar-flyout) .nav:hover,
  .sidebar .profile-nav:hover { background: transparent; }
  :is(.sidebar, .sidebar-flyout) .nav:hover:not(:disabled)::before,
  .sidebar .profile-nav:hover::before { opacity: .75; transform: scale(1); }
}
@media (prefers-reduced-motion: reduce) {
  :is(.sidebar, .sidebar-flyout) .nav,
  .sidebar .profile-nav,
  :is(.sidebar, .sidebar-flyout) .nav::before,
  .sidebar .profile-nav::before,
  .sidebar .nav::after,
  .sidebar .nav.active::after,
  :root[data-sidebar-collapsed="true"] .sidebar .nav-group.has-current > summary::after { transition: none; }
}
#tasksPage {
  --person-lesha: #f49b61;
  --person-lera: #a5a2f2;
  --person-both: #8ec6ba;
  --person-none: var(--muted);
  --person-other: #d7c27a;
}

.task-head, .task-head-actions, .task-calendar-header, .task-calendar-controls, .task-calendar-legend {
  display: flex;
  align-items: center;
  gap: 12px;
}

.task-head { justify-content: space-between; flex-wrap: wrap; margin-bottom: 16px; }
.task-head h1 { margin: 0; }
.task-person-switch { display: inline-flex; padding: 3px; border: 1px solid var(--line); border-radius: 10px; }
.task-person-switch button { min-height: 32px; padding: 4px 14px; border: 0; border-radius: 7px; background: transparent; color: var(--muted); }
.task-person-switch button[aria-pressed="true"] { background: var(--hover); color: var(--text); }

.task-calendar {
  padding: clamp(12px, 2vw, 20px);
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
}

.task-calendar-header { flex-wrap: wrap; margin-bottom: 12px; }
.task-calendar-header h2 { margin: 0; font-size: clamp(18px, 2.4vw, 24px); text-transform: capitalize; }
.task-calendar-legend { flex: 1; flex-wrap: wrap; gap: 6px 16px; color: var(--muted); font-size: 12px; }
.task-calendar-controls button { min-height: 34px; padding: 4px 12px; }

.task-legend-item { display: inline-flex; align-items: center; gap: 6px; }
.task-legend-item::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: var(--chip-color); }

.task-calendar-week, .task-calendar-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.task-calendar-week { padding-bottom: 6px; color: var(--muted); font-size: 12px; text-align: center; }
.task-calendar-grid { gap: 1px; overflow: hidden; border: 1px solid var(--line); border-radius: 10px; background: var(--line); }

.task-day {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
  min-height: clamp(88px, calc((100vh - 300px) / 6), 150px);
  padding: 5px;
  background: var(--surface);
  cursor: pointer;
}

.task-day.is-gap { background: var(--surface-soft); cursor: default; }
.task-day.is-past { background: color-mix(in srgb, var(--surface) 92%, var(--bg)); }
.task-day:not(.is-gap):hover { background: color-mix(in srgb, var(--text) 4%, var(--surface)); }
.task-day-head { display: flex; align-items: center; justify-content: space-between; min-height: 24px; }
.task-day-number { display: grid; place-items: center; min-width: 24px; height: 24px; border-radius: 12px; font-size: 13px; font-variant-numeric: tabular-nums; }
.task-day.is-past .task-day-number { color: var(--muted); }
.task-day.is-today .task-day-number { background: var(--accent); color: var(--on-accent); font-weight: 700; }
.task-day-add { width: 24px; height: 24px; padding: 0; border: 0; border-radius: 6px; background: transparent; color: var(--muted); opacity: 0; }
.task-day:hover .task-day-add, .task-day-add:focus-visible { opacity: 1; }
.task-day-add:hover { background: var(--hover); color: var(--text); }
.task-day-more { align-self: flex-start; padding: 0 4px; border: 0; background: transparent; color: var(--muted); font-size: 11px; }

[data-person="lesha"] { --chip-color: var(--person-lesha); }
[data-person="lera"] { --chip-color: var(--person-lera); }
[data-person="both"] { --chip-color: var(--person-both); }
[data-person="none"] { --chip-color: var(--person-none); }
[data-person="other"] { --chip-color: var(--person-other); }

.task-chip {
  display: flex;
  align-items: center;
  gap: 4px;
  width: 100%;
  min-width: 0;
  min-height: 22px;
  padding: 2px 6px;
  border: 0;
  border-left: 3px solid var(--chip-color);
  border-radius: 5px;
  background: color-mix(in srgb, var(--chip-color) 18%, transparent);
  color: var(--text);
  font-size: 12px;
  text-align: left;
}

.task-chip:hover { background: color-mix(in srgb, var(--chip-color) 30%, transparent); }
.task-chip-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.task-chip-time { flex: none; color: var(--muted); font-variant-numeric: tabular-nums; }
.task-chip-priority { flex: none; color: var(--danger); font-weight: 700; }
.task-chip.is-done { opacity: .55; }
.task-chip.is-done .task-chip-title { text-decoration: line-through; }
.task-chip.is-overdue { box-shadow: inset 0 0 0 1px var(--danger); }

.task-undated { margin-top: 16px; }
.task-undated h2 { display: flex; align-items: center; gap: 8px; margin: 0 0 10px; font-size: 15px; }
.task-undated h2 span { color: var(--muted); font-weight: 400; }
.task-chip-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 6px; }
.task-chip-list .task-chip { min-height: 30px; font-size: 13px; }

@media (max-width: 750px) {
  .task-calendar-week { font-size: 11px; }
  .task-day { min-height: 64px; padding: 3px; }
  .task-chip { padding: 1px 3px; font-size: 10px; }
  .task-chip-time, .task-chip-priority { display: none; }
  .task-day-add { display: none; }
}

.settings-group { margin: 18px 0 2px; color: var(--muted); font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; }
.settings-group:first-child { margin-top: 0; }
.settings-subhead { margin: 8px 0 0; font-size: 14px; }
#settingsPage .settings-card > fieldset, #settingsPage .settings-card form > fieldset { display: grid; gap: 12px; min-width: 0; margin: 0; padding: 0; border: 0; }
#settingsPage .bot-note { margin: 0; }
#settingsPage .settings-card label:not(.checkbox) { display: grid; gap: 6px; min-width: 0; font-size: 13px; color: var(--muted); }
#settingsPage .settings-card label:not(.checkbox) :is(input, textarea, select) { width: 100%; max-width: none; box-sizing: border-box; color: var(--text); }
#settingsPage .bot-input-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; }
#settingsPage .bot-source-controls { display: flex; flex-wrap: wrap; gap: 8px 20px; }
#settingsPage .ai-settings-actions, #settingsPage .dialog-footer { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin: 0; }
#settingsPage .key-info:empty, #settingsPage [role="status"]:empty { display: none; }
