/* Product shell: 208 px rail + 32 px gutters + fluid canvas, capped at 1600 px.
   Calendar rendering is owned by the React island; these rules touch its frame only. */
:root {
  --surface: #101012;
  --raised: #19191c;
  --hover: #212125;
  --line: #ffffff0d;
  --control: #ffffff21;
  --text: #f5f4f6;
  --muted: #aaa8b1;
  --faint: #84828b;
  --radius: 24px;
  --top-inset: calc(max(env(safe-area-inset-top,0px),var(--tg-safe-area-inset-top,0px)) + var(--app-controls-inset-top,var(--tg-content-safe-area-inset-top,0px)));
  --bottom-inset: calc(max(env(safe-area-inset-bottom,0px),var(--tg-safe-area-inset-bottom,0px)) + var(--tg-content-safe-area-inset-bottom,0px));
  --ease: cubic-bezier(.22,.8,.22,1);
}
body { letter-spacing: -.012em; }
.app-main { max-width: 1600px; margin-left: 208px; padding: calc(24px + var(--top-inset)) 32px 40px; }
.app-rail { width: 208px; padding: calc(36px + var(--top-inset)) 16px 24px; border-color: var(--line); }
.rail-create { min-height: 46px; margin-bottom: 26px; border-radius: 14px; font-size: 12px; }
.bottom-nav { gap: 5px; }
.bottom-nav button { min-height: 48px; border-radius: 13px; font-size: 13px; padding-inline: 14px; gap: 12px; }
.bottom-nav button.active { background: #ffffff09; color: var(--text); }
.bottom-nav button.active::after { box-shadow: none; }
.bottom-nav .icon { width: 19px; height: 19px; }
.rail-calendar { margin-top: 34px; }
.mini-month-heading { margin-bottom: 16px; }
.mini-month-heading button { min-height: 28px; width: 25px; border-radius: 50%; }
.mini-days button { min-height: 28px; border-radius: 50%; }
.mini-days button.selected { box-shadow: none; color: var(--accent-ink); }
.rail-footer { color: var(--faint); font-size: 10px; }
.calendar-layout { gap: 24px; grid-template-columns: minmax(0,1fr) 280px; }
.calendar-workspace { background: transparent; border: 0; border-radius: 0; }
.day-inspector { gap: 20px; }
.selected-events { padding: 22px; min-height: 180px; border: 0; }
.section-heading { margin-bottom: 20px; align-items: center; }
.section-heading h2 { font-size: 16px; font-weight: 550; }
.selected-events h2 { font-size: 17px; letter-spacing: -.03em; }
.section-heading p { margin-top: 5px; font-size: 12px; }
.icon-action { min-height: 36px; width: 36px; border-radius: 50%; background: #ffffff05; }
.event-item { padding: 16px 0; grid-template-columns: 39px minmax(0,1fr) 12px; gap: 12px; }
.event-item > time { font-size: 12px; color: var(--muted); }
.event-item h3 { font-size: 14px; font-weight: 500; line-height: 1.45; }
.event-item p { margin-top: 5px; font-size: 12px; }
.event-item button > span { font-size: 11px; }
.events-empty { padding: 24px 0; gap: 14px; }
.events-empty p { font-size: 13px; line-height: 1.6; }
.next-event { border: 0; padding: 22px; background: #121214; }
.next-event-copy > span { font-size: 11px; color: var(--muted); }
.next-event h2 { font-size: 16px; font-weight: 500; line-height: 1.45; margin-top: 12px; }
.next-event p { font-size: 12px; }
.next-event-date { padding-top: 1px; }
.next-event-date strong { font-size: 34px; letter-spacing: -.06em; }
.next-event-date span { font-size: 11px; }
/* Settings are grouped by purpose, with a single surface per group. */
.settings-tabs { gap: 8px; border: 0; padding: 4px; border-radius: 30px; background: #101012; width: max-content; max-width: 100%; margin-bottom: 28px; }
.settings-tabs button { border: 0; border-radius: 26px; padding: 10px 18px; min-height: 42px; font-size: 13px; color: var(--muted); }
.settings-tabs button.active { background: #ffffff0b; color: var(--text); }
.settings-page { max-width: 1120px; gap: 24px; }
.settings-page > section { border: 0; padding: 26px; }
.settings-page > section > p { font-size: 13px; line-height: 1.7; margin-bottom: 22px; }
.settings-page .section-heading h2 { font-size: 18px; }
.theme-picker { gap: 14px; }
.theme-picker button { background: transparent; border: 1px solid var(--line); min-height: 88px; padding: 18px; border-radius: 18px; gap: 14px; }
.theme-picker button.active { background: #ffffff04; border-color: transparent; }
.theme-swatch { width: 24px; height: 24px; border: 5px solid #ffffff13; background-clip: padding-box; box-shadow: none !important; }
.theme-picker strong { font-size: 14px; font-weight: 500; }
.theme-picker small { font-size: 11px; }
.theme-picker button > span { gap: 5px; }
.section-order-list { gap: 0; }
.section-order-item { padding: 12px 0; gap: 10px; border: 0; border-radius: 0; border-bottom: 1px solid var(--line); }
.section-order-item:last-child { border: 0; }
.section-order-item > button:first-child { min-height: 48px; gap: 13px; }
.section-order-item b { font-size: 14px; }
.section-order-item small,.section-order-item em { font-size: 11px; }
.section-drag-handle { min-height: 44px; width: 36px; border-radius: 12px; }
/* A label and a switch share one generous hit area; selection stays on the control. */
.create-field-options { display:grid; grid-template-columns:1fr; gap:0; margin-bottom:24px; }
.create-field-options label { position:relative; display:flex; flex-direction:row; align-items:center; justify-content:space-between; gap:20px; min-height:52px; padding:10px 0; border-bottom:1px solid var(--line); cursor:pointer; color:var(--text); }
.create-field-options label:last-child { border-bottom:0; }
.create-field-options .create-field-label { display:flex; align-items:center; gap:12px; min-width:0; font-size:14px; }
.create-field-options .icon { width:18px; height:18px; flex:none; color:var(--muted); }
.create-field-options input[type="checkbox"] { position:absolute; right:0; top:50%; transform:translateY(-50%); width:44px; height:26px; min-height:26px; padding:0; margin:0; opacity:0; cursor:pointer; z-index:1; }
.create-field-options .field-switch { position:relative; display:block; flex:none; width:44px; height:26px; border:1px solid var(--control); border-radius:20px; background:#ffffff09; transition:background .22s,border-color .22s; }
.field-switch::before { content:''; position:absolute; left:3px; top:3px; width:18px; height:18px; border-radius:50%; background:var(--muted); transition:transform .24s var(--ease),background .22s; }
.create-field-options input:checked + .field-switch { background:linear-gradient(120deg,var(--accent),color-mix(in srgb,var(--accent) 72%,var(--accent-tip))); border-color:transparent; }
.create-field-options input:checked + .field-switch::before { transform:translateX(18px); background:#fff; }
.create-field-options input:focus-visible + .field-switch { outline:2px solid var(--accent-ink); outline-offset:4px; }
.create-field-options label:has(input:disabled) { opacity:.5; cursor:default; }
.create-field-options input:disabled { cursor:default; }
@media(min-width:700px) {
 .create-field-options { grid-template-columns:repeat(2,minmax(0,1fr)); column-gap:32px; }
}
@media(prefers-reduced-motion:reduce) {
 .create-field-options .field-switch,.field-switch::before { transition:none; }
}
.create-fields-save { width: 100%; }
.account-panel { background: transparent; padding: 10px 2px !important; }
.account-panel h3 { font-size: 15px; font-weight: 500; }
.account-panel > div > span { font-size: 12px; }
.account-panel p { max-width: 70ch; }
.setting-heading { font-size: 13px; margin-bottom: 18px; }
.offset-options,.mini-offsets,.schedule-duration-presets { gap: 9px; }
.offset-options button,.mini-offsets button,.schedule-duration-presets button { min-height: 42px; border-radius: 24px; font-size: 12px; padding-inline: 16px; border-color: var(--line); }
.default-view { margin-top: 32px; }
.default-view > span { font-size: 13px; }
.default-view-options { gap: 10px; margin-top: 14px; }
.default-view-options button { min-height: 78px; border-radius: 15px; border-color: var(--line); font-size: 12px; gap: 9px; }
.default-view-options button.active { background: #ffffff04; }
.settings-actions { margin-top: 30px; }
.guide-link { min-height: 46px; border-radius: 12px; font-size: 13px; border-color: var(--line); }
.google-command { font-size: 12px !important; }
.subscription-panel::before { display: none; }
.subscription-heading h2 { font-size: 32px; font-weight: 500; letter-spacing: -.055em; }
.subscription-heading strong { padding: 7px 12px; border-radius: 20px; font-size: 11px; font-weight: 500; }
.subscription-copy { max-width: 65ch; }
.subscription-features { gap: 16px 24px; margin-block: 24px; }
.subscription-features > span { font-size: 12px; }
.subscription-actions { margin-top: 28px; }
/* Timetable: a soft date rail and a continuous list, rather than nested boxes. */
.schedule-page-actions { margin-bottom:28px; max-width:1120px; justify-content:flex-start; }
.schedule-title-actions { display:grid; grid-template-columns:repeat(4,max-content); gap:10px; width:auto; }
.schedule-title-actions button { white-space:nowrap; border-radius:24px; min-height:44px; font-size:13px; padding:10px 18px; gap:8px; border-color:var(--line); }
.schedule-title-actions button .icon { width:17px; height:17px; flex:none; }
.schedule-board { background:transparent; padding:0; border:0; border-radius:0; }
@media(max-width:600px) {
 .schedule-title-actions { width:100%; grid-template-columns:repeat(2,minmax(0,1fr)); gap:8px 12px; }
 .schedule-title-actions button { width:100%; padding:10px 12px; font-size:12px; min-height:46px; }
 .schedule-title-actions :is(.schedule-parameters-action,.schedule-edit-action) { background:transparent; border-color:transparent; color:var(--muted); }
}
.schedule-layout { gap: 24px; }
.schedule-board-header { margin-bottom: 22px; gap: 12px; }
.schedule-board-header h2 { font-size: 22px; font-weight: 500; letter-spacing: -.04em; margin-top: 7px; }
.schedule-board-header > div > span { font-size: 12px; }
.schedule-week-actions { gap: 2px; }
.schedule-week-actions button { min-height: 36px; padding-inline: 10px; border-radius: 24px; font-size: 12px; }
.schedule-week-strip { gap: 6px; border-bottom: 0; padding-bottom: 8px; }
.schedule-week-strip button { border-radius: 40px; padding: 12px 3px 10px; gap: 8px; min-height: 96px; }
.schedule-week-strip span { font-size: 11px; }
.schedule-week-strip strong { font-size: 23px; font-weight: 450; letter-spacing: -.045em; }
.schedule-week-strip i { min-height: 12px; font-size: 10px; }
.schedule-week-strip button.active { border-color: transparent; background: rgb(var(--accent-rgb) / .11); }
.schedule-day-timeline { gap: 0; margin-top: 18px; }
.schedule-entry-card { background: transparent; border: 0; border-top: 1px solid var(--line); border-radius: 0; padding: 22px 2px; grid-template-columns: 43px 2px minmax(0,1fr) 16px; gap: 18px; }
.schedule-entry-time { gap: 8px; }
.schedule-entry-time b { font-size: 12px; }
.schedule-entry-rail { background: rgb(var(--accent-rgb) / .6); }
.schedule-entry-copy { gap: 8px; }
.schedule-entry-copy strong { font-size: 16px; font-weight: 500; line-height: 1.4; }
.schedule-entry-room,.schedule-entry-copy em { font-size: 12px; }
.schedule-aside { gap: 24px; }
.schedule-tools { padding: 24px; border: 0; }
.schedule-tools h2 { font-size: 16px; }
.schedule-digest-toggle { gap: 12px; }
.schedule-digest-toggle b { font-size: 13px; font-weight: 500; }
.schedule-digest-toggle small { font-size: 12px; line-height: 1.6; }
.schedule-empty { min-height: 220px; gap: 10px; }
.schedule-empty b { font-size: 17px; }
.schedule-empty span { font-size: 13px; }
/* Editors follow the same native control rhythm; contrast supplies elevation. */
:where(.settings-page,.schedule-dialog-card,dialog) :is(input,select,textarea) { border-color: var(--line); border-radius: 13px; background: #ffffff04; min-height: 48px; padding: 12px 14px; }
:where(.settings-page,.schedule-dialog-card,dialog) input[type="checkbox"] { width: 18px; height: 18px; min-height: 18px; padding: 0; border-radius: 5px; }
:where(.settings-page,.schedule-dialog-card,dialog) :is(input,select,textarea):focus { border-color: rgb(var(--accent-rgb) / .55); }
:where(.settings-page,.schedule-dialog-card,dialog) select { padding-right: 32px; }
:where(.settings-page,.schedule-dialog-card,dialog) :is(label > span:first-child,legend) { font-size: 13px; }
:where(.settings-page,.schedule-dialog-card,dialog) :is(.primary-action,.secondary-action,.danger-action) { min-height: 48px; border-radius: 14px; font-size: 13px; }
.time-shell { border-color: var(--line); border-radius: 13px; background: #ffffff04; }
.time-shell select { background: transparent; border: 0; border-radius: 0; }
.time-shell select:first-of-type { border-radius: 13px 0 0 13px; }
.category-picker { gap: 8px; }
.category-picker button { min-height: 38px; border-radius: 24px; padding-inline: 12px; font-size: 12px; }
.category-create-trigger { font-size: 12px; min-height: 36px; }
.category-creator { border-radius: 15px; padding: 18px; background: #ffffff04; }
.disclosure-trigger { padding-block: 18px; font-size: 13px; }
.option-toggle { gap: 12px; }
.option-toggle b { font-size: 13px; font-weight: 500; }
.option-toggle small { font-size: 12px; }
.schedule-dialog-card { border: 0; border-radius: 24px; padding: 28px; gap: 24px; }
.schedule-editor-page { max-width: 780px; }
.view-title h2 { font-size: 22px; font-weight: 500; }
.back-action { min-height: 42px; width: 42px; border-radius: 50%; background: #ffffff06; }
dialog { border: 1px solid #ffffff13; border-radius: 28px; background: #111113; padding: 30px; box-shadow: 0 28px 120px #0009; }
dialog::backdrop { background: #000b; }
dialog h2 { font-weight: 500; }
.dialog-close { min-height: 36px; width: 36px; border-radius: 50%; top: 18px; right: 18px; background: #ffffff07; }
.dialog-category { font-size: 12px; }
.dialog-meta { gap: 16px; }
.dialog-meta > span { font-size: 13px; }
.dialog-actions { gap: 10px; }
.dialog-actions button { min-height: 48px; border-radius: 14px; font-size: 13px; border-color: var(--line); }
.event-editor-dialog { width: min(680px,calc(100vw - 40px)); padding: 28px; }
.event-editor-dialog .view-title { gap: 12px; margin-bottom: 28px; }
.event-editor-dialog .view-title h2 { font-size: 21px; font-weight: 500; }
.event-editor-dialog .simple-mode-action { border: 0; border-radius: 24px; min-height: 40px; padding-inline: 13px; background: #ffffff05; }
.event-editor-dialog .reminder-form { gap: 22px 18px; }
.field-title input { font-size: 24px; font-weight: 450; letter-spacing: -.04em; min-height: 60px; }
.template-row .template-chip { border-radius: 13px; padding: 12px 14px; background: #ffffff03; }
.template-chip b { font-size: 13px; }
.schedule-detail-primary b { font-size: 15px; }
.schedule-detail-primary small,.schedule-detail-meta > div { font-size: 13px; }
.schedule-import-preview { gap: 18px; }
.schedule-import-preview img { border-radius: 14px; }
.schedule-import-entry { border-radius: 18px; border-color: var(--line); padding: 18px; }
.toast-region { border-radius: 30px; padding: 14px 22px; font-size: 13px; background: #252527; border-color: #ffffff12; box-shadow: 0 10px 40px #0006; }
.connection-notice { border-radius: 16px; padding: 14px 18px; font-size: 13px; background: #ffffff04; border: 0; }
@media (hover:hover) {
  :where(.bottom-nav,.settings-page,.schedule-title-actions,.schedule-week-actions,.schedule-week-strip,.day-inspector,.overview-secondary,.schedule-day-timeline,dialog) button:hover { background-color: #ffffff06; }
  .theme-picker button:hover { border-color: #ffffff30; }
  .theme-picker button.active:hover { border-color: transparent; }
  .next-event:hover { background: #171719; }
}
@media (min-width:1600px) {
  .app-main { margin-inline: auto; padding-left: 248px; padding-right: 40px; max-width: 1800px; }
  .calendar-layout { grid-template-columns: minmax(0,1fr) 300px; }
}
@media (max-width:1200px) and (min-width:1001px) {
  .app-main { margin-left: 208px; padding-inline: 24px; }
  .calendar-layout,.schedule-layout { grid-template-columns: minmax(0,1fr); }
  .day-inspector { grid-template-columns: 1fr 1fr; }
  .schedule-aside { grid-template-columns: 1fr 1fr; }
  .theme-picker { grid-template-columns: repeat(2,minmax(0,1fr)); }
}
/* Telegram-sized layouts use a thumb-reachable floating navigation dock. */
@media (max-width:1000px) {
  html { scroll-padding-top: calc(12px + var(--top-inset)); }
  .app-rail { position: static; width: 0; padding: 0; border: 0; }
  .app-rail > :not(.bottom-nav) { display: none; }
  .bottom-nav { position: fixed; inset: auto 16px calc(10px + var(--bottom-inset)); height: 70px; padding: 6px; display: flex; justify-content: center; align-items: stretch; gap: 3px; z-index: 30; border: 1px solid #ffffff12; border-radius: 26px; background: #141416; box-shadow: 0 12px 50px #0009; max-width: 520px; margin-inline: auto; }
  .bottom-nav button { flex: 1; max-width: none; min-width: 0; min-height: 56px; padding: 7px 4px; border-radius: 20px; flex-direction: column; gap: 5px; color: #95939d; font-size: 11px; }
  .bottom-nav button.active { background: #ffffff07; color: var(--text); }
  .bottom-nav button.active .icon { color: var(--accent); }
  .bottom-nav button.active::after { display: none; }
  .bottom-nav .icon { width: 20px; height: 20px; }
  .app-main { margin: 0 auto; padding: calc(12px + var(--top-inset)) 24px calc(112px + var(--bottom-inset)); max-width: 850px; }
  .calendar-layout,.schedule-layout { grid-template-columns: minmax(0,1fr); gap: 26px; }
  .day-inspector { grid-template-columns: 1fr 1fr; gap: 20px; }
  .selected-events { padding: 22px; min-height: 180px; }
  .selected-events .section-heading { padding: 0; margin-bottom: 14px; }
  .selected-events .icon-action { border: 0; width: 38px; min-height: 38px; }
  .next-event { margin: 0; }
  .schedule-aside { grid-template-columns: 1fr 1fr; }
  .settings-page { grid-template-columns: 1fr; gap: 20px; }
  .theme-picker { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .settings-tabs { margin-bottom: 24px; }
  .toast-region { bottom: calc(98px + var(--bottom-inset)); }
}
@media (max-width:600px) {
  .app-main { padding-inline: 20px; }
  .day-inspector { grid-template-columns: minmax(0,1fr); gap: 24px; }
  .selected-events { min-height: 0; background: transparent; border: 0; border-top: 1px solid var(--line); border-radius: 0; padding: 24px 0 0; }
  .selected-events h2 { font-size: 21px; font-weight: 500; }
  .selected-events .section-heading { margin-bottom: 8px; }
  .event-item { grid-template-columns: 44px minmax(0,1fr) 14px; gap: 14px; padding: 18px 0; }
  .event-item > time { font-size: 13px; }
  .event-item h3 { font-size: 15px; }
  .event-item p { font-size: 12px; }
  .event-list .events-empty { padding: 18px 0; min-height: 84px; flex-direction: row; text-align: left; gap: 18px; }
  .event-list .events-empty p { font-size: 13px; max-width: 260px; }
  .next-event { padding: 22px; }
  .next-event h2 { font-size: 17px; }
  .next-event.same-selected-day { display: none; }
  .section-heading { gap: 8px; }
  .section-heading h2 { font-size: 16px; }
  .settings-tabs { width: 100%; gap: 1px; padding: 4px; border-radius: 24px; }
  .settings-tabs button { flex: 1; padding: 9px 8px; font-size: 11px; min-height: 42px; }
  .settings-page > section { padding: 24px 20px; border-radius: 24px; }
  .settings-page .section-heading h2 { font-size: 18px; }
  .settings-page > section > p { font-size: 13px; line-height: 1.65; }
  .theme-picker { gap: 10px; }
  .theme-picker button { min-height: 88px; padding: 16px 12px; gap: 11px; border-radius: 17px; }
  .theme-swatch { width: 22px; height: 22px; }
  .theme-picker strong { font-size: 13px; }
  .theme-picker small { font-size: 10px; }
  .theme-picker button > .icon { width: 12px; height: 12px; }
  .section-order-item em { display: none; }
  .section-order-item small { font-size: 11px; }
  .account-panel { padding: 8px 2px !important; }
  .settings-intro { padding: 0 2px !important; gap: 14px; }
  .settings-intro p { font-size: 12px; }
  .setting-heading { font-size: 12px; }
  .offset-options button,.mini-offsets button,.schedule-duration-presets button { min-height: 40px; padding-inline: 13px; font-size: 12px; }
  .default-view-options { gap: 6px; }
  .default-view-options button { min-height: 76px; font-size: 11px; border-radius: 14px; }
  .settings-actions { gap: 9px; }
  .settings-actions button { flex: 1; padding-inline: 10px; font-size: 12px; }
  .subscription-heading h2 { font-size: 30px; }
  .subscription-actions { flex-direction: column; gap: 10px; }
  .subscription-actions button { width: 100%; }
  .subscription-features { gap: 15px; }
  .subscription-features > span { font-size: 11px; }
  .schedule-page-actions { margin-bottom:28px; }
  .schedule-photo-action b { display: none; }
  .schedule-board-header { flex-wrap: nowrap; gap: 10px; margin-bottom: 22px; }
  .schedule-board-header h2 { font-size: 21px; }
  .schedule-board-header > div > span { font-size: 11px; }
  .schedule-week-actions { flex: none; gap: 0; }
  .schedule-week-actions button { min-height: 36px; padding-inline: 7px; font-size: 11px; }
  .schedule-week-strip { gap: 3px; padding-bottom: 8px; }
  .schedule-week-strip button { min-height: 88px; padding: 10px 2px; gap: 8px; border-radius: 35px; }
  .schedule-week-strip strong { font-size: 23px; }
  .schedule-week-strip span { font-size: 11px; }
  .schedule-day-timeline { margin-top: 16px; }
  .schedule-entry-card { padding:22px 4px; gap:12px; grid-template-columns:44px 2px minmax(0,1fr) 14px; }
  .schedule-entry-copy strong { font-size: 15px; }
  .schedule-entry-copy em,.schedule-entry-room { font-size: 12px; }
  .schedule-aside { grid-template-columns: minmax(0,1fr); gap: 24px; }
  .schedule-tools { padding: 24px 20px; }
  .schedule-empty { min-height: 190px; }
  .schedule-dialog-card { padding: 24px 20px; gap: 22px; }
  .schedule-duration-presets { gap: 6px; }
  .schedule-duration-presets button { flex: 1; font-size: 11px; padding-inline: 8px; }
  .schedule-preferences-range { grid-template-columns: 1fr; }
  :where(.settings-page,.schedule-dialog-card,dialog) :is(input,select,textarea) { font-size: 16px; min-height: 48px; padding: 12px; }
  :where(.settings-page,.schedule-dialog-card,dialog) input[type="checkbox"] { min-height: 18px; }
  .time-shell select { font-size: 16px; }
  dialog { position: fixed; inset: auto 0 0; margin: 0 auto; width: 100%; max-width: 600px; max-height: calc(100dvh - var(--top-inset) - 14px); border-radius: 30px 30px 0 0; border-bottom: 0; padding: 30px 24px calc(26px + var(--bottom-inset)); }
  .event-editor-dialog { width: 100%; padding: 24px 20px calc(26px + var(--bottom-inset)); }
  .event-editor-dialog .view-title { margin-bottom: 26px; gap: 10px; }
  .event-editor-dialog .view-title h2 { font-size: 19px; }
  .event-editor-dialog .simple-mode-action { font-size: 11px; min-height: 38px; padding-inline: 10px; }
  .event-editor-dialog .reminder-form { gap: 21px 14px; }
  .event-editor-dialog .template-strip { padding-top: 24px; }
  .field-title input { font-size: 22px; min-height: 58px; }
  .category-picker button { min-height: 38px; padding-inline: 12px; font-size: 12px; }
  .event-editor-dialog .template-list { grid-template-columns: 1fr; }
  .option-toggle small { font-size: 11px; line-height: 1.65; }
  .cabinet-archive { padding: 28px 24px calc(26px + var(--bottom-inset)); border-radius: 30px 30px 0 0; }
  .success-dialog { padding: 34px 26px calc(26px + var(--bottom-inset)); }
  .schedule-import-dialog { width: 100%; }
  .schedule-import-entry .schedule-import-fields { grid-template-columns: 1fr 1fr; }
  .schedule-import-entry .schedule-import-fields > label:first-child { grid-column: 1/-1; }
  .connection-notice { font-size: 12px; line-height: 1.65; }
}
@media (max-width:370px) {
  .app-main { padding-inline: 16px; }
  .bottom-nav { inset-inline: 12px; }
  .settings-tabs button { padding-inline: 6px; font-size: 10px; }
  .theme-picker button { padding-inline: 11px; gap: 8px; }
  .theme-picker button > .icon { display: none; }
  .event-editor-dialog .view-title h2 { font-size: 17px; }
  .event-editor-dialog .simple-mode-action { font-size: 10px; }
}
@media (prefers-reduced-motion:reduce) {
  .bottom-nav,.settings-tabs,.theme-picker button,.schedule-week-strip button { transition: none; }
}

.schedule-board-header h2 { display:grid; gap:6px; text-transform:none; }
.schedule-board-header h2 > span { text-transform:capitalize; }
.schedule-board-header h2 > small { font-size:14px; line-height:1.4; color:var(--muted); font-weight:400; letter-spacing:-.01em; }

@media(max-width:1000px) {
 .app-main { padding-left:max(20px,var(--tg-safe-area-inset-left,0px),var(--tg-content-safe-area-inset-left,0px)); padding-right:max(20px,var(--tg-safe-area-inset-right,0px),var(--tg-content-safe-area-inset-right,0px)); }
 .bottom-nav { left:max(16px,var(--tg-safe-area-inset-left,0px),var(--tg-content-safe-area-inset-left,0px)); right:max(16px,var(--tg-safe-area-inset-right,0px),var(--tg-content-safe-area-inset-right,0px)); }
}

/* Telegram owns the strip above the app. Keep it clear even while scrolling. */
.screen-reader-only { position:absolute; width:1px; height:1px; padding:0; margin:-1px; overflow:hidden; clip-path:inset(50%); white-space:nowrap; border:0; }
html { touch-action:manipulation; }
.telegram-mini-app body::before { content:''; position:fixed; inset:0 0 auto; height:var(--top-inset); background:var(--ground); z-index:35; pointer-events:none; }
@media(max-width:1000px),(pointer:coarse) {
 /* iOS focuses fields smaller than 16 px by zooming the entire WebView. */
 input:not([type="checkbox"]):not([type="radio"]),textarea,select { font-size:16px !important; }
}

/* A dark ambient field keeps the calendar clear while carrying the theme. */
.app-ambient { position:fixed; inset:0; z-index:0; overflow:hidden; pointer-events:none; contain:strict; }
.app-ambient::before,.app-ambient::after { content:''; position:absolute; inset:-8%; }
.app-ambient::before { background:radial-gradient(ellipse at 88% 18%,rgb(var(--accent-rgb) / .14),transparent 58%),radial-gradient(ellipse at 2% 82%,color-mix(in srgb,var(--accent-tip) 6%,transparent),transparent 52%); }
.app-ambient::after { background:radial-gradient(ellipse at 65% 45%,rgb(var(--accent-rgb) / .065),transparent 55%); animation:ambient-drift 22s ease-in-out infinite alternate; }
.app-shell { position:relative; z-index:1; }
.surface { background:linear-gradient(145deg,color-mix(in srgb,var(--accent) 4%,#101012),#0d0c0f); }
.app-rail { background:linear-gradient(180deg,color-mix(in srgb,var(--accent) 4%,#09090b),var(--ground) 65%); }
.calendar-workspace { background:transparent; }
.calendar-year { color:var(--accent-ink); opacity:.78; }
.bottom-nav button.active { background:linear-gradient(135deg,rgb(var(--accent-rgb) / .19),rgb(var(--accent-rgb) / .035)); }
.bottom-nav button.active .icon { color:var(--accent-ink); filter:drop-shadow(0 0 7px rgb(var(--accent-rgb) / .22)); }
.settings-tabs { width:100%; max-width:760px; background:#ffffff04; border:1px solid rgb(var(--accent-rgb) / .10); }
.settings-tabs button { flex:1; }
.settings-tabs button.active { color:var(--accent-ink); background:linear-gradient(120deg,rgb(var(--accent-rgb) / .22),rgb(var(--accent-rgb) / .055)); animation:accent-wake .4s ease-out; }
.settings-page[data-settings-page="notifications"],.settings-page[data-settings-page="form"] { display:block; max-width:760px; }
.settings-page[data-settings-page="plan"] { grid-template-columns:minmax(230px,.8fr) minmax(0,1.2fr); align-items:start; }
.settings-page[data-settings-page="plan"] > .account-panel { display:flex; flex-direction:column; align-items:stretch; gap:24px; padding:26px !important; background:linear-gradient(145deg,color-mix(in srgb,var(--accent) 6%,#101012),#0d0c0f); }
.profile-heading { display:flex; gap:16px; align-items:center; min-width:0; }
.profile-heading .profile-avatar { display:grid; place-items:center; width:52px; height:52px; flex:none; border-radius:18px; background:linear-gradient(145deg,var(--accent),var(--accent-tip)); color:#1c080c; font-size:24px; font-weight:600; }
.profile-heading > div { min-width:0; }
.profile-heading > div > span { color:var(--muted); font-size:12px; }
.profile-heading h3 { margin-top:5px; font-size:18px; overflow-wrap:anywhere; }
.account-archive { width:100%; justify-content:start; gap:10px; min-height:46px; border:0; border-top:1px solid var(--line); border-radius:0; padding:16px 0 0; color:var(--muted); font-size:13px; }
.account-archive > .icon:last-child { margin-left:auto; width:15px; }
.navigation-settings .default-view { margin-top:24px; padding-top:22px; border-top:1px solid var(--line); }
.settings-panel > #offsetLimitCopy { margin-top:-8px; color:var(--muted); }
.offset-options button.active,.mini-offsets button.active,.default-view-options button.active { background:linear-gradient(135deg,rgb(var(--accent-rgb) / .21),rgb(var(--accent-rgb) / .055)); border-color:rgb(var(--accent-rgb) / .35); color:var(--accent-ink); }
.subscription-heading h2 { background:linear-gradient(100deg,var(--text),var(--accent-tip)); background-clip:text; -webkit-background-clip:text; color:transparent; }
.subscription-heading strong { border:1px solid rgb(var(--accent-rgb) / .25); color:var(--accent-ink); background:rgb(var(--accent-rgb) / .08); }
.subscription-features { gap:12px; margin-top:24px; }
.subscription-features > span { border:0; padding:0; background:none; }
.subscription-features .icon { color:var(--accent-ink); }
.subscription-actions { margin-top:26px; }
.event-item h3 > .icon { color:var(--accent-ink); }
.schedule-entry-rail { background:linear-gradient(var(--accent-tip),var(--accent),rgb(var(--accent-rgb) / .12)); }
@media(max-width:1000px) {
 .bottom-nav { background:linear-gradient(160deg,#1b1319,#111014); border-color:rgb(var(--accent-rgb) / .16); box-shadow:0 12px 50px #0009,0 0 28px rgb(var(--accent-rgb) / .035); }
 .settings-page[data-settings-page="plan"] { grid-template-columns:1fr; }
 .schedule-aside { grid-template-columns:1fr; }
}
@media(max-width:600px) {
 .selected-events { background:transparent; }
 .settings-page[data-settings-page="plan"] > .account-panel { padding:22px 20px !important; }
 .settings-tabs { gap:0; padding:4px; }
 .settings-tabs button { padding-inline:5px; font-size:11px; }
 .profile-heading .profile-avatar { width:46px; height:46px; border-radius:16px; font-size:22px; }
}
@media(max-width:370px) {
 .settings-tabs button { font-size:10px; padding-inline:3px; letter-spacing:-.025em; }
}
@keyframes ambient-drift { from { opacity:.45; transform:translate3d(-3%,2%,0); } to { opacity:1; transform:translate3d(3%,-2%,0); } }
@keyframes accent-wake { from { box-shadow:inset 0 0 0 1px rgb(var(--accent-rgb) / .5); } to { box-shadow:inset 0 0 0 1px transparent; } }
.schedule-layout { grid-template-columns:minmax(0,1fr); max-width:1120px; }
.settings-page[data-settings-page="notifications"] > section + section { margin-top:20px; }
.settings-page[data-settings-page="general"] > section,.settings-page[data-settings-page="plan"] > section { grid-column:auto; }
.settings-page[data-settings-page="general"] .theme-picker { grid-template-columns:repeat(2,minmax(0,1fr)); }
