/* Parallel ↔ Marmos UI bridge.
   The vendored Marmos stylesheets read --ds-* tokens; here they take Parallel's
   own palette (theme + accent), so the shared blocks look native in every
   Parallel theme. Parallel-specific placement of the shared blocks follows. */
/* Хомяк runs on the stand's own tokens: <html data-style=depth data-palette=violet
   data-tone=graphite>. The app's legacy variables now read the Marmos tokens, so
   the old components and the new blocks share one palette (saturated violet
   accent with white text, exactly as on the test stand). */
:root[data-style] {
  --bg: var(--ds-bg);
  --surface: var(--ds-surface-1);
  --surface-2: var(--ds-surface-2);
  --field: var(--ds-surface-2);
  --hover: var(--ds-surface-3);
  --border: var(--ds-border);
  --line: var(--ds-border);
  --text: var(--ds-text);
  --muted: var(--ds-text-muted);
  --faint: var(--ds-text-disabled);
  --accent: var(--ds-accent);
  --accent-dim: var(--ds-accent-soft);
  --on-accent: var(--ds-on-accent);
  --green: var(--ds-success);
  --green-dim: var(--ds-success-soft);
  --red: var(--ds-danger);
  --red-dim: var(--ds-danger-soft);
  --danger: var(--ds-danger-text);
  --orange: var(--ds-warning);
  --ds-font: inherit;
}
/* Accent used as *text* reads better in the lighter accent ink. */
:root[data-style] :is(a, .text-btn, .cloud-source, .ds-agenda__tag, .task-meta .accent, .pill) { color: var(--ds-accent-text); }

/* ---------- Day summary under the date ---------- */
.date-weekday .day-summary { color: var(--muted); }

/* ---------- Lesson: live progress and countdown ---------- */
.lesson { position: relative; }
.lesson-status.live { display: inline-flex; align-items: center; gap: 6px; color: var(--accent); }
.lesson-status.live::before {
  content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--red);
  box-shadow: 0 0 0 0 var(--red); animation: ds-pulse 2s cubic-bezier(.2, 0, 0, 1) infinite;
}
.lesson .ds-lesson__bar { position: absolute; inset: auto 0 0 0; height: 3px; background: color-mix(in srgb, var(--accent) 16%, transparent); pointer-events: none; }
.lesson .ds-lesson__bar::after { content: ""; position: absolute; inset: 0 auto 0 0; width: calc(var(--p) * 100%); background: var(--accent); border-radius: 0 3px 3px 0; }
.lesson.live { border-color: color-mix(in srgb, var(--accent) 55%, var(--border)); background: color-mix(in srgb, var(--accent-dim) 45%, var(--surface)); }

/* ---------- Breaks between lessons, sized by length ---------- */
.lesson-list > .ds-break { margin-block: -3px; padding-inline: 18px; }
.lesson-list > .ds-break::before { left: 30px; }
.lesson-list > .ds-break .ds-break__label { background: var(--bg); margin-left: 26px; }
.lesson-list > .ds-break.ds-break--now > .ds-break__label { left: 66px; }
.lesson-list > .ds-break .ds-agenda__pill { background: var(--red); color: #fff; }

/* ---------- Task filters: one gliding highlight ---------- */
.filters { position: relative; isolation: isolate; }
.filters > .ds-indicator { border-radius: 9px; background: var(--accent-dim); }
.filters.has-indicator > .filter.active { background: transparent; }
.filters > .filter { position: relative; z-index: 1; transition: color .22s cubic-bezier(.2, 0, 0, 1); }

/* ---------- Task rows inside swipe wrappers ---------- */
/* Rows stay transparent at rest (the panel's own surface shows); opaque only mid-swipe. */
.ds-swipe + .ds-swipe > .task-row::before {
  content: ""; position: absolute; height: 1px; left: 22px; right: 22px; top: 0;
  background: color-mix(in srgb, var(--border) 45%, transparent);
}
.ds-swipe > .ds-swipe__bg { font-size: 13px; }
.ds-swipe:is([data-dir], .is-dragging) > .ds-swipe__content { background: var(--surface); }

/* ---------- Search hits ---------- */
.task-title .ds-hit { padding: 0 1px; border-radius: 3px; background: color-mix(in srgb, var(--orange) 38%, transparent); color: inherit; }

/* ---------- Long-press menu uses Parallel surfaces ---------- */
.ds-menu { background: var(--surface); color: var(--text); font-size: 14px; }
.ds-menu__item .icon { width: 18px; height: 18px; }
.ds-pressing { transform: scale(.985); transition: transform .45s cubic-bezier(.2, 0, 0, 1); }
.ds-lifted { box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 45%, transparent); }

/* ---------- Pull to refresh on the page scroller ---------- */
.ptr-indicator {
  position: absolute; left: 50%; top: 6px; z-index: 30; display: grid; place-items: center;
  width: 36px; height: 36px; margin-left: -18px; border-radius: 50%;
  background: var(--surface); color: var(--muted); box-shadow: 0 8px 22px -8px #0007;
  opacity: 0; transform: translateY(calc(var(--pull, 0px) - 44px)) rotate(var(--turn, 0deg));
  pointer-events: none;
}
.ptr-indicator.is-visible { opacity: 1; }
.ptr-indicator.is-armed, .ptr-indicator.is-loading { color: var(--accent); }
.ptr-indicator.is-loading .icon { animation: ds-spin .7s linear infinite; }
.ptr-indicator:not(.is-dragging) { transition: transform .22s cubic-bezier(.2, 0, 0, 1), opacity .22s; }
@media (prefers-reduced-motion: reduce) { .lesson-status.live::before, .ptr-indicator.is-loading .icon { animation: none; } }

/* =====================================================================
   Marmos "Depth" style (as on the test stand), layered on Parallel's layout.
   Dark: ambient accent light, layered surfaces with a top highlight, floating
   glass tab bar, lifted primary actions. Light: clean white surfaces and soft
   neutral shadows, no gradients.
   ===================================================================== */
:root:not([data-theme=light]) #app.app-ready .shell {
  background:
    radial-gradient(120% 55% at 50% -12%, color-mix(in srgb, var(--accent) 16%, transparent), transparent 62%) no-repeat,
    var(--bg);
}
:root:not([data-theme=light]) #app.app-ready .topbar { background: transparent; }
:root:not([data-theme=light]) :is(.lesson, .panel, .weekstrip, .segmented) {
  background: linear-gradient(180deg, color-mix(in srgb, var(--surface-2) 70%, var(--surface)), var(--surface));
  border-color: color-mix(in srgb, var(--text) 7%, transparent);
  box-shadow: inset 0 1px 0 color-mix(in srgb, var(--text) 6%, transparent), 0 10px 30px -18px #000;
}
:root:not([data-theme=light]) .lesson.next {
  background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 12%, var(--surface-2)), var(--surface));
}
:root:not([data-theme=light]) .lesson.live {
  background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 16%, var(--surface-2)), var(--surface));
  box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--accent) 50%, transparent), 0 14px 34px -16px var(--accent);
}
:root:not([data-theme=light]) :is(.btn.primary, .fab) {
  background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 86%, white), var(--accent));
  box-shadow: inset 0 1px 0 #ffffff40, 0 8px 22px -10px var(--accent);
}
:root[data-theme=light] :is(.lesson, .panel, .weekstrip, .segmented) {
  border-color: transparent;
  box-shadow: 0 1px 2px #1d14300d, 0 8px 24px -12px #1d143026;
}
:root[data-theme=light] .lesson.live { box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--accent) 45%, transparent), 0 8px 24px -12px #1d143033; }
:root[data-theme=light] :is(.btn.primary, .fab) { box-shadow: 0 6px 16px -8px var(--accent); }

/* The "День / Неделя" highlight is filled with the accent, like the stand. */
.segment-highlight { background: var(--accent); box-shadow: 0 6px 16px -8px var(--accent); }
.segmented button.active { color: var(--on-accent); }

/* Floating glass tab bar on phones; the selected tab sits in a filled pill. */
@media (max-width: 760px) {
  #app.app-ready .shell { padding-bottom: calc(92px + var(--safe-bottom)); }
  #app.app-ready .bottomnav {
    left: 12px; right: 12px; bottom: calc(12px + var(--safe-bottom));
    min-height: 0; padding: 4px; gap: 8px; border-radius: 24px;
    border: 1px solid color-mix(in srgb, var(--text) 9%, transparent);
    background: color-mix(in srgb, var(--surface) 78%, transparent);
    backdrop-filter: blur(20px) saturate(1.5); -webkit-backdrop-filter: blur(20px) saturate(1.5);
    box-shadow: 0 16px 40px -12px #000a;
  }
  :root[data-theme=light] #app.app-ready .bottomnav {
    background: color-mix(in srgb, var(--surface) 88%, transparent); box-shadow: 0 10px 30px -12px #1d143040;
  }
  .nav-highlight {
    top: 4px; left: 4px; height: calc(100% - 8px); width: calc((100% - 8px - 16px) / 3);
    border-radius: 20px; background: var(--accent); box-shadow: 0 6px 18px -8px var(--accent);
  }
  .bottomnav button.active { color: var(--on-accent); }
}

/* Хомяк keeps its tab bar in the page flow (#main-nav is position:relative);
   lift it into the same floating glass bar as Parallel. */
@media (max-width: 760px) {
  #app.app-ready .shell { padding-bottom: calc(88px + var(--safe-bottom)); }
  #app.app-ready #main-nav {
    position: absolute; inset: auto 12px calc(12px + var(--safe-bottom)) 12px; width: auto;
    min-height: 0; padding: 4px; z-index: 30;
  }
}

/* =====================================================================
   Stand layout blocks (2026-10-06): brand tile, large day title with summary,
   "Идёт сейчас" card, proportional day timeline, task progress ring.
   ===================================================================== */
.page-heading { align-items: center; gap: 12px; }
.hm-mark {
  display: grid; place-items: center; flex: none; width: 44px; height: 44px; border-radius: 14px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--ds-accent) 82%, white), var(--ds-accent));
  color: var(--ds-on-accent); font-weight: 720; font-size: 19px;
  box-shadow: inset 0 1px 0 #ffffff40, 0 8px 20px -10px var(--ds-accent);
}
.hm-heading { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.hm-heading .ds-eyebrow { font-size: 10.5px; }
.hm-heading h1 { font-size: 21px; }

/* Large titles */
.ds-large-title { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.ds-large-title h2 { font-size: 28px; line-height: 1.15; font-weight: 720; letter-spacing: -.6px; }
.ds-large-title .ds-meta { color: var(--muted); font-size: 13px; }
.calendar-head { align-items: flex-end; flex-wrap: wrap; row-gap: 12px; }
.hm-day-title { flex: 1 1 14rem; }
.hm-greet { margin: 4px 0 14px; }

/* Week strip: dots instead of numbers, like the stand */
.day-dots { display: flex; justify-content: center; gap: 3px; height: 6px; margin-top: 4px; font-size: 0; }
.day-dots > i { width: 5px; height: 5px; border-radius: 50%; background: currentColor; opacity: .55; }
.day-chip.active .day-dots > i { opacity: 1; }

/* Section heads inside the day */
.hm-section { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 22px 2px 10px; }
.hm-section h3 { font-size: 17px; font-weight: 650; letter-spacing: -.2px; }
.ds-badge--accent { background: var(--ds-accent-soft); color: var(--ds-accent-text); }

/* "Идёт сейчас / Дальше" */
.hm-next { margin-top: 16px; }
.hm-next .ds-next__top { flex-wrap: nowrap; }
.hm-next__count { margin-left: auto; white-space: nowrap; color: var(--ds-text-muted); font-weight: 500; }
.hm-next__count b { color: var(--ds-text); font-size: 15px; font-weight: 720; font-variant-numeric: tabular-nums; }
.hm-next .ds-next__title { font-size: 19px; }
.hm-next .icon { width: 16px; height: 16px; }
.hm-next__bar { height: 4px; border-radius: 999px; background: color-mix(in srgb, var(--ds-accent) 22%, transparent); overflow: hidden; }
.hm-next__bar::after { content: ""; display: block; height: 100%; width: calc(var(--p) * 100%); border-radius: inherit; background: var(--ds-accent); }

/* Timeline cards are <details>: summary is the card face, description expands below */
details.hm-card > summary { display: flex; flex-direction: column; gap: 2px; list-style: none; cursor: pointer; }
details.hm-card > summary::-webkit-details-marker { display: none; }
details.ds-agenda__card { text-align: left; color: var(--ds-text); }
details.hm-card[open] { justify-content: flex-start; }
details.hm-card .cloud-event-detail { display: grid; gap: 4px; margin-top: 8px; padding: 8px 0 2px; border-top: 1px solid color-mix(in srgb, var(--ds-text) 8%, transparent); font-size: 13px; color: var(--ds-text-2); }
details.hm-card .cloud-event-detail .muted { color: var(--ds-text-muted); font-size: 12px; }
.ds-agenda__allday-item > summary { flex-direction: row; align-items: center; gap: 8px; }
.ds-agenda__allday-item:not([open]) .ds-agenda__allday-title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; flex: 1; }
.ds-agenda__allday-item > summary .ds-meta { flex: none; color: var(--ds-text-muted); font-size: 12px; }

/* Task progress ring card */
.hm-summary-card { padding: 18px 20px; margin-bottom: 14px; }
.hm-summary-card:empty { display: none; }
.hm-summary__text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.hm-summary__text strong { font-size: 16px; font-weight: 650; }
.hm-summary__text .ds-meta { color: var(--muted); font-size: 13px; }
details.ds-agenda__allday-item { display: block; }
details.ds-agenda__allday-item::before { display: none; }
details.ds-agenda__allday-item > summary::before { content: ""; flex: none; width: 6px; height: 6px; border-radius: 50%; background: var(--cat, var(--ds-accent)); }
/* Neutralise the app's generic details>summary look (12px muted, "+" marker) inside timeline cards. */
details.hm-card > summary { justify-content: flex-start; align-items: stretch; padding: 0; font-size: inherit; color: inherit; text-align: left; min-width: 0; }
details.hm-card > summary::after { content: none; }
details.ds-agenda__allday-item > summary { align-items: center; }
details.hm-card { min-width: 0; }
details.ds-agenda__allday-item.hm-card > summary { flex-direction: row; align-items: center; gap: 8px; }
details.ds-agenda__allday-item.hm-card .ds-agenda__allday-title { flex: 1; min-width: 0; }
.tasks-panel { border-radius: 20px; overflow: hidden; }
/* Model card on the limits page, like the stand's "Ваш помощник" card */
#limits .model { margin-top: 14px; padding: 16px 20px; border: 0; border-radius: 20px; background: var(--ds-surface-1); box-shadow: 0 1px 2px #1d14300d, 0 8px 24px -12px #1d143026; }
:root:not([data-theme=light]) #limits .model { background: linear-gradient(180deg, color-mix(in srgb, var(--surface-2) 70%, var(--surface)), var(--surface)); box-shadow: inset 0 1px 0 color-mix(in srgb, var(--text) 6%, transparent), 0 10px 30px -18px #000; }
#limits .model::before { content: "Ваш помощник"; display: block; margin-bottom: 6px; font-size: 11px; font-weight: 620; letter-spacing: .08em; text-transform: uppercase; color: var(--ds-text-muted); }

/* 2026-10-07: product header removed (refresh lives in pull-to-refresh);
   content now owns the top safe area. */
#app.app-ready .page-content { padding-top: calc(16px + var(--safe-top)); }
