/* day_phone — «День в телефоне». Solid content on the platform's tokens; no glass on this screen (the bells are solid
   accent dots: the chrome already has its three, spec §3.1). Logical properties only (RTL-ready, spec §10), no colour
   mixing functions (old WebViews): translucent fills are rgb(var(--x-rgb) / a). Motion: the platform's springs
   (§8.1); reduced motion → 150 ms crossfades. Every target is ≥ 44 pt. */

/* ---------- the header ---------- */

.dp-head { display: grid; gap: 10px; margin-block-start: 6px; }
.dp-which { justify-self: start; width: min(100%, 260px); }
.dp-headline {
  margin: 0; padding-inline: 4px; font-size: 20px; font-weight: 700; line-height: 1.25; letter-spacing: -.01em;
  font-variant-numeric: tabular-nums; overflow-wrap: anywhere;
}
.dp-states { display: grid; gap: 6px; }
.dp-states:empty { display: none; }
.dp-state {
  display: flex; align-items: flex-start; gap: 8px; margin: 0; padding-block: 10px; padding-inline: 12px;
  border-radius: 12px; background: var(--bg2); color: var(--subtitle); font-size: 14px; line-height: 1.35;
}
.dp-state .ico { flex: none; width: 18px; height: 18px; color: var(--hint); }

/* ---------- the timeline ---------- */

/* Three columns: the hours, the rail (proportional: class blocks, the night, an accent dot at each bell's minute) and
   the label column, where bell rows and class labels are stacked so nothing ever covers a label. */
.dp { --lane: 44px; --rail: 32px; --col: calc(var(--lane) + var(--rail) + 10px); }
.dp-card {
  margin-block-start: 14px; padding-block: 18px 12px; padding-inline: 8px 10px;
  border-radius: 18px; background: var(--bg2);
}
.dp-tl { position: relative; height: var(--h); }
.dp-hour {
  position: absolute; inset-inline: 0; top: var(--y); height: 0;
  border-block-start: .5px solid rgb(var(--text-rgb) / 0.08);
}
.dp-hour span {
  position: absolute; inset-inline-start: 0; top: -8px; width: calc(var(--lane) - 6px);
  font-size: 11px; line-height: 16px; color: var(--hint); font-variant-numeric: tabular-nums;
}

/* Classes: solid grey blocks on the rail; their names beside them. */
.dp-block {
  position: absolute; z-index: 1; inset-inline-start: var(--lane); width: var(--rail); top: var(--y); height: var(--h);
  border-radius: 8px; background: rgb(var(--text-rgb) / 0.14);
}
.dp-block.is-cancelled { background: none; border: 1.5px dashed rgb(var(--text-rgb) / 0.3); }
/* A label sits level with its block's start (model.plan). The now line and the hour lines pass under its words: each
   line of it is cut out of them on the card's own colour, so a class in progress never reads as struck through. */
.dp-class {
  position: absolute; z-index: 3; top: 0; inset-inline-start: var(--col); inset-inline-end: 0; height: 36px;
  display: flex; flex-direction: column; justify-content: center; align-items: flex-start; min-width: 0;
  transform: translateY(var(--top, 0px));
  transition: transform var(--spring-micro-dur, 250ms) var(--spring-micro, ease);
}
.dp-class-name, .dp-class-sub {
  max-width: 100%; padding-inline-end: 6px; background: var(--bg2);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.dp-class-name { font-size: 14px; font-weight: 600; line-height: 1.25; color: var(--subtitle); }
.dp-class-sub { font-size: 12px; line-height: 1.3; color: var(--hint); font-variant-numeric: tabular-nums; }
.dp-class.is-cancelled .dp-class-name { text-decoration: line-through; }
.dp-class.is-new { animation: dp-land var(--spring-micro-dur, 250ms) var(--spring-micro, ease) both; }

/* The exact minute of each bell: a solid accent dot on the rail (its row may sit a little lower when bells crowd). */
.dp-tick {
  position: absolute; z-index: 2; top: var(--y); inset-inline-start: calc(var(--lane) + var(--rail) / 2 - 5px);
  width: 10px; height: 10px; margin-block-start: -5px; border-radius: 50%; background: var(--accent);
  box-shadow: 0 0 0 2px var(--bg2);
}
.dp-tick.is-if { background: var(--bg2); box-shadow: inset 0 0 0 2px var(--accent), 0 0 0 2px var(--bg2); }
.dp-tick.is-past { background: var(--hint); box-shadow: 0 0 0 2px var(--bg2); }
/* Two bells of one minute: where labels need room the rail stretches (model.plan), and the lower bell's dot is joined
   to the minute's mark by a thin line, so both read as the same moment. */
.dp-join {
  position: absolute; z-index: 2; top: var(--y); height: var(--h); inset-inline-start: calc(var(--lane) + var(--rail) / 2 - 1px);
  width: 2px; border-radius: 1px; background: var(--accent);
}
.dp-join.is-past { background: var(--hint); }

/* Quiet hours: a night fill across the day; its edges drag (pointer), the fill opens the sheet with two steppers.
   Half an hour of night is a 24 px band: it keeps that look, and its button reaches a 44 pt touch (spec §10) through a
   transparent ::after that grows past the band's edges by what is missing (none once the band is 44 px or more). */
.dp-night {
  position: absolute; z-index: 0; inset-inline-start: var(--lane); inset-inline-end: 0; top: var(--y); height: var(--h);
  border-radius: 10px; background-color: rgb(var(--text-rgb) / 0.1);
  background-image: repeating-linear-gradient(135deg, rgb(var(--text-rgb) / 0.05) 0 6px, transparent 6px 12px);
  transition: opacity .15s ease;
}
.dp-night-btn {
  position: relative; display: flex; align-items: flex-start; gap: 6px; width: 100%; height: 100%; min-height: 22px;
  padding-block: 4px; padding-inline: calc(var(--rail) + 10px) 10px; border: 0; border-radius: inherit; background: none;
  color: var(--subtitle); font: inherit; font-size: 12px; line-height: 16px; text-align: start; cursor: pointer;
}
.dp-night-btn::after {
  content: ""; position: absolute; inset-inline: 0; inset-block: min(0px, calc((var(--h) - 44px) / 2));
}
.dp-night-btn .ico { flex: none; width: 15px; height: 15px; }
.dp-night-btn span { min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.dp-tl.is-quiet-drag .dp-night { opacity: 0; }
.dp-ghosts { position: absolute; inset: 0; z-index: 0; pointer-events: none; }
.dp-ghost {
  position: absolute; inset-inline-start: var(--lane); inset-inline-end: 0; top: var(--y); height: var(--h);
  border-radius: 10px; background: rgb(var(--accent-rgb) / 0.16);
}
.dp-edge {
  position: absolute; z-index: 4; inset-inline-end: 0; top: var(--y); width: 72px; height: 44px; margin-block-start: -22px;
  display: flex; align-items: center; justify-content: flex-end; gap: 6px; padding-inline-end: 6px;
  touch-action: pan-y; cursor: ns-resize; -webkit-user-select: none; user-select: none;   /* lifted first: drag() */
}
.dp-edge-time { font-size: 11px; color: var(--subtitle); font-variant-numeric: tabular-nums; }
.dp-edge-bar { width: 26px; height: 5px; border-radius: 3px; background: rgb(var(--text-rgb) / 0.4); }
.dp-edge.is-dragging .dp-edge-bar, .dp-edge.is-lifted .dp-edge-bar { background: var(--accent); }
.dp-edge.is-dragging .dp-edge-time { color: var(--text); font-weight: 600; }

/* Now (today only): a thin accent line. */
.dp-now {
  position: absolute; z-index: 2; inset-inline-start: calc(var(--lane) - 4px); inset-inline-end: 0; top: var(--y);
  height: 2px; margin-block-start: -1px; border-radius: 1px; background: var(--accent); pointer-events: none;
}
.dp-now::before {
  content: ""; position: absolute; inset-inline-start: -2px; top: -3px; width: 8px; height: 8px; border-radius: 50%;
  background: var(--accent);
}

/* Bells: a solid row in the label column (the rail's dot marks the exact minute); they glide on the micro spring
   when the day changes. A conditional one («если что-то изменится») is an outline: it may not come at all. */
.dp-bell {
  position: absolute; z-index: 3; top: 0; inset-inline-start: var(--col); max-width: calc(100% - var(--col)); height: 48px;
  transform: translate(var(--dx, 0px), var(--top, 0px));
  transition: transform var(--spring-micro-dur, 250ms) var(--spring-micro, ease), opacity .2s ease;
}
.dp-bell-btn {
  position: relative; display: flex; align-items: center; gap: 8px; max-width: 100%; height: 100%;
  padding-block: 4px; padding-inline: 10px; border: 0; border-radius: 14px;
  background: var(--bg); color: var(--text); font: inherit; text-align: start; cursor: pointer;
  box-shadow: 0 1px 3px rgb(0 0 0 / 0.1);
  transition: scale var(--spring-micro-dur, 250ms) var(--spring-micro, ease), box-shadow .2s ease;
}
:root[data-scheme="dark"] .dp-bell-btn { background: var(--thumb-dark); }
.dp-bell-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.dp-ico { display: inline-grid; vertical-align: -2px; margin-inline-end: 3px; color: var(--accent); }
.dp-ico .ico { width: 14px; height: 14px; stroke-width: 2.2; }
.dp-bell.is-if .dp-bell-btn { background: none; box-shadow: inset 0 0 0 1.5px rgb(var(--accent-rgb) / 0.45); }
.dp-bell.is-past .dp-ico { color: var(--hint); }
.dp-bell.is-past .dp-bell-title, .dp-bell.is-past .dp-bell-sub { color: var(--hint); }
.dp-bell-text { display: flex; flex-direction: column; min-width: 0; }
.dp-bell-title, .dp-bell-sub { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dp-bell-title { font-size: 14px; font-weight: 600; line-height: 1.3; }
.dp-bell-sub { font-size: 12px; line-height: 1.3; color: var(--hint); }
.dp-time { font-variant-numeric: tabular-nums; }
/* The evening bell moves only once lifted (a long-press, or a press on its grip): the row itself keeps the page's
   vertical scroll, so a thumb scrolling past never moves a setting. The grip is a 44 px target that drags at once. */
.dp-grip {
  flex: none; display: grid; place-items: center; min-width: 44px; min-height: 44px; margin-block: -4px;
  margin-inline: -6px -10px; color: var(--hint); touch-action: none; cursor: grab;
}
.dp-grip .ico { width: 16px; height: 16px; stroke-width: 2.2; }
.dp-bell.is-drag { touch-action: pan-y; }
.dp-bell.is-swipe { touch-action: pan-y; }
.dp-bell.is-dragging, .dp-bell.is-swiping, .dp-bell.is-lifted { z-index: 5; transition: none; }
.dp-bell.is-lifted .dp-bell-btn, .dp-bell.is-dragging .dp-bell-btn {
  scale: 1.03; box-shadow: 0 6px 18px rgb(0 0 0 / 0.18); cursor: grabbing;
}
.dp-bell.is-gone { opacity: 0; pointer-events: none; }
.dp-bell.is-new { animation: dp-land var(--spring-micro-dur, 250ms) var(--spring-micro, ease) both; }
@keyframes dp-land { from { opacity: 0; scale: .92; } }

/* ---------- the mini-week ---------- */

.dp-days { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.dp-day {
  min-width: 0; min-height: 44px; padding: 0; border: 0; border-radius: 12px; background: var(--bg2); color: var(--text);
  font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; overflow: hidden; text-overflow: ellipsis;
  transition: background-color .2s ease, color .2s ease;
}
.dp-day[aria-pressed="true"] { background: var(--accent); color: var(--accent-text); }
.dp-day:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- the settings under it ---------- */

.dp-row { padding-block: 0; padding-inline-end: 16px; }
.dp-row-main {
  display: flex; flex: 1; min-width: 0; align-items: center; gap: 12px; min-height: 48px; padding-block: 10px;
  padding-inline: 0 8px; border: 0; background: none; color: inherit; font: inherit; text-align: start; cursor: pointer;
}
.dp-row-label { padding-inline-start: 16px; cursor: pointer; }
.dp-row-label .row-main { padding-block: 10px; }
.dp-switch {
  appearance: none; -webkit-appearance: none; flex: none; position: relative; width: 51px; height: 31px; margin: 0;
  border-radius: 16px; background: rgb(var(--text-rgb) / 0.16); cursor: pointer; transition: background .2s ease;
}
/* The switch looks 51 × 31 and takes a 44 pt touch (spec §10): a transparent hit area, inside the row's 48. */
.dp-switch::before { content: ""; position: absolute; inset: -7px -6px; }
.dp-switch::after {
  content: ""; position: absolute; top: 2px; inset-inline-start: 2px; width: 27px; height: 27px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 3px rgb(0 0 0 / 0.25);
  transition: transform var(--spring-micro-dur, 250ms) var(--spring-micro, ease);
}
.dp-switch:checked { background: var(--accent); }
.dp-switch:checked::after { transform: translateX(20px); }
[dir="rtl"] .dp-switch:checked::after { transform: translateX(-20px); }
.dp-switch:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.dp-more { margin-block-start: 30px; }
.dp-more > .group-title h2 { font-size: 20px; font-weight: 700; color: var(--text); }
.dp-more .sections > .feature-section:first-child .group:first-child { margin-block-start: 4px; }

/* ---------- sheets ---------- */

.dp-sheet { display: grid; gap: 10px; }
.dp-sheet-sub { margin: 0 4px; font-size: 15px; color: var(--subtitle); }
.dp-says { margin: 6px 4px 0; font-size: 13px; font-weight: 600; color: var(--section-header); }
.dp-preview { padding-block: 12px; padding-inline: 14px; border-radius: 14px; background: rgb(var(--text-rgb) / 0.06); }
.dp-preview .skeleton-list { margin: 0; }
.dp-preview .row-item { margin-block-start: 6px; padding-inline: 0; }
.dp-msg { font-size: 15px; line-height: 1.4; overflow-wrap: anywhere; }
.dp-msg p, .dp-msg h3, .dp-msg ul, .dp-msg ol, .dp-msg table, .dp-msg details { margin-block: 0 6px; }
.dp-msg h3 { font-size: 16px; }
.dp-msg table { border-collapse: collapse; font-size: 13px; }
.dp-msg td { padding-block: 2px; padding-inline: 0 8px; }
.dp-note { margin: 0; font-size: 14px; line-height: 1.4; color: var(--subtitle); }
.dp-ctl { display: grid; gap: 8px; }
.dp-ctl-group { display: grid; gap: 8px; }
.dp-ctl-label { margin: 6px 4px 0; font-size: 13px; color: var(--hint); }
.dp-ctl-switch, .dp-ctl-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 48px; padding-inline: 4px;
  font-size: 16px;
}
.dp-ctl-switch { cursor: pointer; }
.dp-foot { margin: 0 4px; font-size: 13px; line-height: 1.35; color: var(--hint); }
.dp-hint { margin: 0 4px; font-size: 14px; color: var(--subtitle); }
.dp-info { display: flex; align-items: center; gap: 8px; margin: 0 4px; font-size: 15px; }
.dp-info .ico { flex: none; width: 18px; height: 18px; color: var(--accent); }

/* The undo in «Убрано · Вернуть»: the toast host lets taps through, this button takes them (a 44 pt target). */
.toasts .dp-undo {
  pointer-events: auto; padding-block: 12px; padding-inline: 6px; margin-block: -12px; border: 0; background: none;
  color: inherit; font: inherit; font-weight: 700; cursor: pointer;
}
.toasts .dp-undo-sep { opacity: .6; }

/* ---------- 320 px ---------- */

@media (max-width: 359px) {
  .dp { --lane: 40px; --rail: 28px; }
  .dp-headline { font-size: 18px; }
  .dp-edge { width: 60px; }
  .dp-day { font-size: 13px; }
}

/* ---------- accessibility ---------- */

@media (prefers-reduced-motion: reduce) {
  .dp-bell, .dp-bell-btn, .dp-class, .dp-switch::after, .dp-day, .dp-night { transition: opacity .15s ease; }
  .dp-bell.is-new, .dp-class.is-new { animation: dp-fade .15s ease both; }
  .dp-bell.is-dragging .dp-bell-btn { scale: 1; }
}
@keyframes dp-fade { from { opacity: 0; } }
@media (prefers-contrast: more) {
  .dp-block, .dp-night { box-shadow: inset 0 0 0 1px rgb(var(--text-rgb) / 0.45); }
  .dp-bell-btn { box-shadow: inset 0 0 0 1px var(--text); }
  .dp-bell-sub, .dp-class-name, .dp-class-sub, .dp-state, .dp-foot, .dp-note, .dp-hour span { color: var(--text); }
  .dp-switch, .dp-day { box-shadow: inset 0 0 0 1px var(--text); }
}
