/* ==========================================================================
   Core Planner: component styles. Design tokens live in theme.css.
   ========================================================================== */

/* ==========================================================================
   Base & reset
   ========================================================================== */

:focus {
  outline: none;
}

/* Keyboard focus ring for buttons and links; mouse focus stays quiet.
   Text fields never get a ring: the caret and, for stand-alone fields, a lighter fill show where you are typing. */
:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--focus);
}

input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  box-shadow: none;
}

::selection {
  background-color: var(--selection);
}

/* The browser scheme comes from the theme (themes/*.css) or the choice in Settings, both set on <html> */
body,
input,
textarea,
button {
  color-scheme: inherit;
}

body {
  background-color: var(--bg-canvas);
  color: var(--text-primary);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  font-feature-settings: "cv02", "cv03", "cv04", "cv11";
  letter-spacing: -0.012em;
  min-height: calc(100vh / var(--z));
  font-size: 14px;
  line-height: 1.5;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scrollbar-gutter: stable;
  overflow-y: scroll;
}

/* Phones draw the whole interface at 85%: it looks tighter and calmer. This is done here, not with the viewport
   tag, because browsers reset the viewport scale when they enter fullscreen. Zoom also shrinks vw / vh lengths and
   the coordinates scripts read, so those are divided by --z (CSS lengths here, uiZoom() in bundle.js). */
@media (max-width: 768px) and (hover: none) {
  html, body { overscroll-behavior-y: none; }
  :root {
    --z: 0.85;
  }

  html {
    zoom: var(--z);
  }
}

::-webkit-scrollbar {
  width: 14px;
  height: 14px;
  background: transparent;
}

::-webkit-scrollbar-track,
::-webkit-scrollbar-corner {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  border-radius: 9999px;
  border: 4px solid transparent;
  background-clip: padding-box;
  min-height: 36px;
  min-width: 36px;
  background-color: var(--scrollbar);
}

/* Scrollbar thumb: always visible, brighter while scrolling or hovered */
.is-scrolling::-webkit-scrollbar-thumb {
  background-color: var(--scrollbar-active);
}

@media (hover: hover) {
  ::-webkit-scrollbar-thumb:hover {
    background-color: var(--scrollbar-active);
  }
}

::-webkit-scrollbar-thumb:active {
  background-color: var(--scrollbar-active);
}

button,
[role="button"],
label {
  touch-action: manipulation;
}

@supports not selector(::-webkit-scrollbar) {
  * {
    scrollbar-width: thin;
    scrollbar-color: var(--scrollbar) transparent;
  }
}

@media (max-width: 768px) {
  html {
    scrollbar-gutter: auto;
    overflow-y: auto;
  }

  ::-webkit-scrollbar {
    width: 6px;
    height: 6px;
  }
}

/* Phones (touch screens): no scrollbars at all. Where there is more to scroll, the edge fades out instead: the lists
   and sheets fade through a mask (fade-top / fade-bottom), the page itself through two strips in the theme's
   background fixed to the top of the screen and above the bottom bar (.page-fade, bundle.js initPageFades) */
@media (max-width: 768px) and (hover: none) {
  * {
    scrollbar-width: none;
  }

  ::-webkit-scrollbar {
    display: none;
    width: 0;
    height: 0;
  }

  .page-fade {
    position: fixed;
    left: 0;
    right: 0;
    height: 36px;
    z-index: 800; /* under the bottom bar (900), sheets and dialogs */
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.15s ease;
  }

  .page-fade.is-top {
    top: 0;
    background: linear-gradient(to bottom, var(--bg-canvas), transparent);
  }

  .page-fade.is-bottom {
    bottom: var(--page-fade-bottom, 0px);
    background: linear-gradient(to top, var(--bg-canvas), transparent);
  }

  .page-fade.is-on {
    opacity: 1;
  }

  .page-fade-switching .page-fade { transition: none; }
}

@media not all and (max-width: 768px) and (hover: none) {
  .page-fade {
    display: none;
  }
}

/* ==========================================================================
   App shell: sidebar, navigation, page header
   ========================================================================== */

.app-layout {
  display: flex;
  min-height: calc(100vh / var(--z));
  background-color: var(--bg-canvas);
}

.app-sidebar {
  border-right: none;
  display: flex;
  flex-direction: column;
  gap: 16px;
  position: sticky;
  top: 0;
  height: calc(100vh / var(--z));
  flex-shrink: 0;
  background-color: var(--bg-surface);
  backdrop-filter: blur(40px) saturate(180%);
  -webkit-backdrop-filter: blur(40px) saturate(180%);
  box-shadow: inset -0.5px 0 0 var(--line-soft);
  padding: 22px 12px;
  width: 244px;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 2px 8px;
}

.brand-logo {
  color: var(--on-accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Inter', var(--font-sans); /* the logo is drawn in Inter everywhere, as on the app icon */
  font-weight: 200;
  font-size: 25px;
  line-height: 1;
  width: 26px;
  height: 26px;
  border-radius: 8px;
  background: var(--blue);
  box-shadow: 0 0 6px color-mix(in srgb, var(--shadow) var(--shadow-strength), transparent);
}

.brand-title {
  font-weight: 600;
  font-size: 14.5px;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}

.sidebar-action {
  padding: 0 4px;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-tab-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  text-align: left;
  letter-spacing: -0.01em;
  font-family: inherit;
  padding: 7px 10px;
  border-radius: 9px;
  font-size: 13.5px;
}

@media (hover: hover) {
  .nav-tab-btn:hover,
    .btn-icon:hover {
    color: var(--text-primary);
    background-color: var(--bg-hover);
  }
}

.nav-tab-btn.active {
  color: var(--text-primary);
  background-color: var(--bg-selected);
}

.nav-counter {
  font-weight: 500;
  border-radius: var(--radius-pill);
  background: none;
  padding: 0;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  color: var(--text-muted);
}

.app-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  background-color: var(--bg-canvas);
  padding: 30px 40px 40px;
}

.view-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
}

.view-title {
  color: var(--text-primary);
  font-family: var(--font-display);
  font-size: 30px;
  font-weight: 700;
  letter-spacing: -0.035em;
  line-height: 1.1;
}

.view-stats-badge {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
}

/* Tasks: status filter as a dropdown beside the title (phones only; larger screens keep the tabs) */
.view-filter {
  display: none;
}

.item-count {
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

@media (hover: hover) {
  .apple-dropdown-item:hover .item-count {
    color: inherit;
    opacity: 0.8;
  }
}

/* The header's drop-down is plain text with an arrow, no fill */
.view-filter .apple-dropdown-btn {
  background: none;
  padding-right: 0;
}

/* Selected filter: title and count side by side, the same way as in the list */
.view-filter .dropdown-selected-label {
  display: inline-flex;
  align-items: center;
  gap: 9px;
}

/* Calendar: the view mode (3 days / week / 2 weeks / month) is the same kind of dropdown */
@media (max-width: 768px) {
  .app-main[data-view="tasks"] .view-stats-badge,
  .app-main[data-view="tasks"] .filter-tabs,
  .app-main[data-view="calendar"] .view-stats-badge,
  .app-main[data-view="calendar"] .calendar-modes {
    display: none;
  }

  .app-main[data-view="tasks"] .view-filter,
  .app-main[data-view="calendar"] .view-filter {
    display: block;
  }

  .app-main[data-view="calendar"] .calendar-nav {
    flex: 1 1 0;
  }

  .app-main[data-view="calendar"] .calendar-bar > .btn-primary {
    flex: 0 0 auto;
  }
}

.nav-label {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.nav-icon {
  color: var(--blue);
  flex-shrink: 0;
  opacity: 0.95;
}

.nav-tab-btn.active .nav-icon {
  color: var(--blue-hover);
}

.nav-tab-btn.active .nav-counter {
  background: none;
  color: var(--text-secondary);
}

.nav-tab-btn.active,
.filter-tab.active,
.apple-dropdown-item.selected,
.btn-pill.active,
.col-modal-palette-dot.active {
  font-weight: 500;
}

/* Kanban and Journal fit the window and scroll their lists internally */
.app-main[data-view="kanban"],
.app-main[data-view="journal"] {
  height: calc(100vh / var(--z));
  min-height: 0;
  overflow: hidden;
}

@media (max-width: 768px) {
  .app-layout {
    flex-direction: column;
    display: block;
  }

  .app-sidebar {
    border-right: none;
    border-bottom: none;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    top: auto;
    width: 100%;
    height: auto;
    z-index: 900;
    flex-direction: row;
    gap: 0;
    padding: 16px 6px calc(6px + var(--safe-bottom)); /* more room above the icons than below: they sit lower in the bar */
    background-color: var(--bg-surface);
    backdrop-filter: blur(30px) saturate(180%);
    -webkit-backdrop-filter: blur(30px) saturate(180%);
    box-shadow: 0 -0.5px 0 var(--line-soft);
  }

  .nav-label {
    gap: 6px;
  }

  .sidebar-brand,
  .sidebar-action {
    display: none;
  }

  .sidebar-nav {
    flex-direction: row;
    gap: 0;
    width: 100%;
    overflow: visible;
  }
}

.filter-tab {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  letter-spacing: -0.01em;
  white-space: nowrap;
  font-family: inherit;
  font-size: 13px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  padding: 0 12px;
  border-radius: calc(var(--capture-r) - 4px);
  flex: 0 0 auto;
}

.filter-tab,
.nav-tab-btn {
  font-weight: 500;
}

@media (max-width: 768px) {
  .nav-tab-btn {
    flex: 1 1 0;
    min-width: 0;
    flex-direction: column;
    justify-content: center;
    gap: 2px;
    padding: 4px 2px;
    border-radius: 8px;
    font-size: 10px;
    letter-spacing: -0.02em;
  }

  /* The bottom bar is icons only (the names are in aria-label and title): the current section is the blue icon */
  .nav-tab-btn .nav-label {
    font-size: 0;
    gap: 0;
  }

  .nav-tab-btn .nav-icon {
    width: 26px;
    height: 26px;
    color: var(--text-secondary);
    opacity: 1;
  }

  .nav-tab-btn.active {
    background: none;
    color: var(--blue);
  }

  .nav-tab-btn.active .nav-icon {
    color: var(--blue);
  }

  .nav-counter {
    display: none;
  }

  .app-main {
    padding: calc(14px + env(safe-area-inset-top)) 16px calc(var(--tabbar-h) + var(--safe-bottom) + 20px);
    min-height: calc(100dvh / var(--z));
  }

  .view-header {
    min-height: 32px; /* the height of the header's drop-down, so every section starts its content at the same place */
    margin-bottom: 14px;
  }

  .view-title {
    font-size: 28px;
  }

  .app-main[data-view="kanban"] {
    height: calc(100dvh / var(--z));
    min-height: 0;
  }

  .app-main[data-view="journal"] {
    height: auto;
    overflow: visible;
  }

  .view-header,
  .filter-bar,
  .inbox-quick-capture,
  .kanban-bar,
  .calendar-bar,
  .journal-bar {
    flex-shrink: 0;
  }
}

/* ==========================================================================
   Buttons
   ========================================================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 13px;
  cursor: pointer;
  border: none;
  letter-spacing: -0.01em;
  font-family: inherit;
  user-select: none;
  min-height: 32px;
  padding: 6px 16px;
  border-radius: 10px;
  font-weight: 500;
}

.btn-primary {
  background-color: var(--blue);
  color: var(--on-accent);
  box-shadow: none;
}

@media (hover: hover) {
  .btn-primary:hover {
    background-color: var(--blue-hover);
    box-shadow: none;
  }
}

.btn-secondary {
  background-color: var(--bg-hover);
  color: var(--text-primary);
}

@media (hover: hover) {
  .btn-secondary:hover {
    background-color: var(--bg-selected);
  }
}

.btn-icon {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 6px;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

@media (hover: hover) {
}

.btn-sm {
  font-size: 12px;
  min-height: 26px;
  padding: 4px 11px;
  border-radius: 8px;
}

.btn,
.btn-icon,
.nav-tab-btn,
.filter-tab,
.apple-dropdown-btn,
.apple-datepicker-trigger,
.dp-day-cell,
.dp-nav-btn,
.task-card,
.inbox-card,
.kanban-card,
.journal-item-card,
.task-status-btn,
.btn-pill,
.apple-dropdown-item {
  transition: background-color 0.12s ease, color 0.12s ease, border-color 0.12s ease;
}

/* ==========================================================================
   Form controls
   ========================================================================== */

.input,
.textarea {
  width: 100%;
  border: none;
  color: var(--text-primary);
  font-size: 13px;
  font-family: inherit;
  letter-spacing: -0.01em;
  outline: none;
  background-color: var(--bg-control);
  border-radius: 10px;
  padding: 8px 12px;
  transition: background-color 0.15s var(--ease-apple), box-shadow 0.15s var(--ease-apple);
}

input[type="datetime-local"],
input[type="date"],
input[type="time"] {
  font-variant-numeric: tabular-nums;
  cursor: pointer;
}

input[type="datetime-local"]::-webkit-calendar-picker-indicator,
input[type="date"]::-webkit-calendar-picker-indicator {
  filter: invert(0.8);
  cursor: pointer;
  opacity: 0.6;
  transition: opacity 0.15s ease;
  margin-right: -2px;
}

@media (hover: hover) {
  input[type="datetime-local"]::-webkit-calendar-picker-indicator:hover,
input[type="date"]::-webkit-calendar-picker-indicator:hover {
    opacity: 1;
  }
}

.input-sm {
  font-size: 12px;
}

.textarea {
  resize: vertical;
  line-height: 1.5;
}

.field-hint {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
}

.required {
  color: var(--red);
}

.input-capture {
  font-size: 14px;
  border: none;
  background-color: var(--bg-surface);
  height: var(--capture-h);
  padding: 0 16px;
}

.journal-title-input {
  border: none;
  color: var(--text-primary);
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.03em;
  padding: 0;
  height: auto;
  background: transparent;
  box-shadow: none;
  border-radius: 0;
}

.journal-textarea {
  border: none;
  flex: 1;
  min-height: 0;
  padding: 0;
  font-size: 15px;
  line-height: 1.6;
  color: var(--text-primary);
  background: transparent;
  box-shadow: none;
  border-radius: 0;
  resize: none;
  overflow-y: auto;
}

.input::placeholder,
.textarea::placeholder {
  color: var(--text-placeholder);
}

.input:focus,
.textarea:focus {
  background-color: var(--bg-control-hover);
  box-shadow: none;
}

input[type="number"] {
  -moz-appearance: textfield;
  appearance: textfield;
}

input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  appearance: none;
  margin: 0;
  display: none;
}

/* ==========================================================================
   Dropdown menus & popovers
   ========================================================================== */

.apple-dropdown {
  position: relative;
  display: inline-block;
}

.apple-dropdown-btn {
  display: inline-flex;
  justify-content: space-between;
  border: none;
  color: var(--text-primary);
  padding: 6px 12px;
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  letter-spacing: -0.01em;
  user-select: none;
  min-height: 32px;
  align-items: center;
  gap: 8px;
}

/* An open dropdown keeps its button colour: the only change is the chevron */
.apple-dropdown.is-open .apple-dropdown-btn {
  box-shadow: none;
}

.dropdown-chevron,
.datepicker-chevron {
  display: inline-flex;
  align-items: center;
  color: var(--text-muted);
}

.apple-dropdown.is-open .dropdown-chevron,
.apple-datepicker.is-open .datepicker-chevron {
  transform: rotate(180deg);
  color: var(--blue);
}

.apple-dropdown-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 175px;
  border: none;
  z-index: 1000;
  opacity: 0;
  transform: translateY(-4px) scale(0.97);
  pointer-events: none;
  padding: 6px;
}

.apple-dropdown.is-open .apple-dropdown-menu,
.apple-datepicker.is-open .apple-datepicker-popover {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.apple-dropdown.w-full,
.apple-dropdown.w-full .apple-dropdown-btn {
  width: 100%;
}

.apple-dropdown.w-full .apple-dropdown-menu,
.apple-dropdown-menu.w-full {
  left: 0;
  right: 0;
  width: 100%;
  min-width: 100%;
}

.apple-dropdown-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-primary);
  cursor: pointer;
  user-select: none;
  /* the highlight follows the menu's corners: its radius is the menu's (14px) minus the menu's padding (6px), and
     the text sits the same 12px from its left and right edges */
  border-radius: 8px;
  min-height: 32px;
  padding: 6px 12px;
}

.apple-dropdown-item.selected {
  color: var(--text-primary);
}

.item-left,
.td-value.has-dot {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.item-dot,
.dropdown-dot {
  display: inline-block;
}

.item-check {
  font-weight: 700;
  color: var(--blue);
  font-size: 0;
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  background-color: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 14 14' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M2.5 7.4 5.6 10.5 11.6 3.5'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 14 14' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M2.5 7.4 5.6 10.5 11.6 3.5'/%3E%3C/svg%3E") center / contain no-repeat;
}

.apple-dropdown-menu {
  box-shadow: var(--shadow-medium);
  border-radius: 14px;
}

@media (hover: hover) {
  .apple-dropdown-item:hover {
    background-color: var(--blue);
    color: var(--on-accent);
  }
}

@media (hover: hover) {
  .apple-dropdown-item:hover .item-check {
    color: var(--on-accent);
  }
}

.apple-dropdown-btn,
.apple-datepicker-trigger {
  background-color: var(--bg-control);
  border-radius: 10px;
}

@media (hover: hover) {
  .apple-dropdown-btn:hover,
.apple-datepicker-trigger:hover {
    background-color: var(--bg-control-hover);
  }
}

.apple-dropdown-menu,
/* Fixed-positioned by the script, so sheets and scrolling parents never clip it */
.apple-datepicker-popover,
.dropdown-chevron,
.datepicker-chevron,
.modal-backdrop,
.modal-panel {
  transition: none;
}

.apple-dropdown-item .item-left {
  gap: 9px;
}

.apple-dropdown-btn > .dropdown-dot {
  margin-right: auto;
}

.apple-dropdown-btn > .dropdown-chevron {
  margin-left: 4px;
}

.apple-dropdown-menu,
.apple-datepicker-popover {
  background-color: var(--bg-popover);
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}

@media (max-width: 768px) {
  .apple-dropdown-btn .dropdown-selected-label {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
  }
}

/* ==========================================================================
   Date picker
   ========================================================================== */

.apple-datepicker {
  position: relative;
  display: block;
  width: 100%;
}

.apple-datepicker-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  border: none;
  color: var(--text-primary);
  padding: 8px 12px;
  font-size: 13px;
  font-family: inherit;
  letter-spacing: -0.01em;
  cursor: pointer;
  user-select: none;
  min-height: 35px;
  text-align: left;
}

/* Same as a dropdown: opening does not recolour the control, only the chevron turns */
.apple-datepicker.is-open .apple-datepicker-trigger {
  box-shadow: none;
}

.datepicker-trigger-left {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}

.datepicker-icon {
  display: inline-flex;
  align-items: center;
  color: var(--blue);
  opacity: 0.9;
  flex-shrink: 0;
}

.datepicker-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.datepicker-label.is-placeholder {
  color: var(--text-muted);
}

.datepicker-trigger-right {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.datepicker-clear {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background-color: var(--bg-selected);
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1;
  transition: all 0.12s ease;
}

@media (hover: hover) {
  .datepicker-clear:hover {
    background-color: var(--red-soft);
    color: var(--red);
  }
}

.apple-datepicker-popover {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  border: none;
  opacity: 0;
  transform: translateY(-4px) scale(0.97);
  pointer-events: none;
  width: 304px;
  padding: 14px;
  border-radius: 16px;
  box-shadow: var(--shadow-medium);
  z-index: 3000;
}

.apple-datepicker.align-right .apple-datepicker-popover {
  left: auto;
  right: 0;
}

.dp-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.dp-nav-btns {
  display: flex;
  gap: 2px;
}

.dp-nav-btn {
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: none;
  color: var(--blue);
  font-size: 0;
}

@media (hover: hover) {
  .dp-nav-btn:hover {
    background: var(--bg-selected);
    background-color: var(--bg-hover);
    color: var(--blue-hover);
  }
}

.dp-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  text-align: center;
  margin-bottom: 2px;
}

.dp-days-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
}

.dp-day-cell {
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  cursor: pointer;
  font-family: inherit;
  font-variant-numeric: tabular-nums;
  position: relative;
  aspect-ratio: 1;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 400;
  color: var(--text-primary);
}

@media (hover: hover) {
  .dp-day-cell:hover:not(.empty) {
    background-color: var(--bg-selected);
    color: var(--text-primary);
  }
}

.dp-day-cell.is-today::after {
  position: absolute;
  bottom: 2px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background-color: var(--blue);
  content: none;
}

.dp-day-cell.is-selected::after {
  background-color: var(--on-accent);
}

.dp-time-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.dp-time-label {
  font-weight: 500;
  font-size: 14px;
  color: var(--text-secondary);
}

.dp-time-inputs {
  display: flex;
  align-items: center;
  gap: 4px;
}
.dp-time-inputs[hidden] { display: flex; visibility: hidden; } /* the row keeps its height: nothing jumps when the tick is switched */

/* the tick that says whether the time counts (switched off: a goal for the day instead of a moment) */
.dp-time-switch { position: relative; display: inline-flex; margin-right: auto; cursor: pointer; }
.dp-time-switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.dp-time-switch span {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 19px;
  height: 19px;
  border-radius: 6px;
  border: 1.6px solid color-mix(in srgb, var(--text-secondary) 65%, transparent);
  transition: background-color 0.12s ease, border-color 0.12s ease;
}
.dp-time-switch input:checked + span { background-color: var(--blue); border-color: var(--blue); color: var(--on-accent); }
.dp-time-switch input:checked + span::after {
  content: "";
  width: 12px;
  height: 12px;
  background-color: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 14 14' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M2.8 7.4 5.7 10.3 11.2 3.8'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 14 14' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M2.8 7.4 5.7 10.3 11.2 3.8'/%3E%3C/svg%3E") center / contain no-repeat;
}
.dp-time-switch input:focus-visible + span { outline: 2px solid var(--focus); outline-offset: 2px; }

.dp-time-input {
  text-align: center;
  border: none;
  font-variant-numeric: tabular-nums;
  outline: none;
  width: 48px;
  height: 32px;
  border-radius: 8px;
  background-color: var(--bg-control);
  font-size: 15px;
  font-weight: 500;
  color: var(--text-primary);
  padding: 0 4px;
}

.dp-time-sep {
  font-weight: 700;
  font-size: 15px;
  color: var(--text-muted);
}

.dp-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 12px;
  padding-top: 12px;
  border-top: none;
  box-shadow: 0 -0.5px 0 var(--line-soft);
}

.dp-btn-clear {
  background: transparent;
  border: none;
  cursor: pointer;
  transition: all 0.1s ease;
  font-size: 14px;
  font-weight: 500;
  color: var(--red);
  padding: 6px 10px;
  border-radius: 8px;
}

.dp-btn-apply {
  background-color: var(--blue);
  border: none;
  color: var(--on-accent);
  cursor: pointer;
  transition: all 0.1s ease;
  height: 32px;
  padding: 0 18px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 500;
}

@media (hover: hover) {
  .dp-btn-apply:hover {
    background-color: var(--blue-hover);
  }
}

.dp-month-title {
  font-size: 15px;
  font-weight: 400;
  color: var(--text-secondary);
  letter-spacing: -0.016em;
}

.calendar-month-label strong {
  color: var(--text-primary);
  font-weight: 600;
}

.dp-month-title strong,
.sched-start {
  font-weight: 600;
  color: var(--text-primary);
}

.dp-weekday {
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 6px 0;
}

@media (hover: hover) {
  .dp-day-cell:hover:not(.empty):not(.is-selected) {
    background-color: var(--bg-selected);
  }
}

.dp-day-cell.is-today {
  color: var(--text-primary);
  font-weight: inherit;
}

.dp-day-cell.is-selected {
  box-shadow: none;
  background-color: var(--blue);
  color: var(--on-accent);
  font-weight: 600;
}

@media (hover: hover) {
  .dp-day-cell.is-selected:hover:not(.empty) {
    background-color: var(--blue);
    color: var(--on-accent);
    font-weight: 600;
  }
}

.dp-time-section {
  margin-top: 12px;
  padding-top: 12px;
  border-top: none;
  box-shadow: 0 -0.5px 0 var(--line-soft);
}

.dp-time-input:focus {
  box-shadow: none;
  background-color: var(--bg-control-hover);
}

@media (hover: hover) {
  .dp-btn-clear:hover,
    .col-action-btn[data-action="delete-col"]:hover {
    background-color: var(--red-soft);
    color: var(--red);
  }
}

.dp-footer-left {
  display: flex;
  align-items: center;
  gap: 2px;
}

.dp-btn-now {
  border: none;
  background: none;
  padding: 6px 10px;
  border-radius: 8px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  color: var(--blue);
  cursor: pointer;
  transition: background-color 0.12s ease;
}

@media (hover: hover) {
  .dp-btn-now:hover {
    background-color: var(--blue-soft);
  }
}

@media (max-width: 768px) {
  .apple-datepicker-popover {
    width: min(304px, calc(100vw / var(--z) - 48px));
  }
}

/* ==========================================================================
   Badges, priority dots & status labels
   ========================================================================== */

.dot-all {
  background-color: var(--text-muted);
}

.dot-urgent {
  background-color: var(--red);
}

.dot-high {
  background-color: var(--orange);
}

.dot-normal {
  background-color: var(--blue);
}

.dot-low {
  background-color: var(--green);
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-weight: 500;
  border-radius: var(--radius-pill);
  border: none;
  background-color: var(--bg-subtle);
  color: var(--text-secondary);
  letter-spacing: -0.01em;
  padding: 2px 9px;
  font-size: 11.5px;
}

.badge-neutral {
  background-color: var(--bg-subtle);
}

.badge-warning {
  background-color: var(--orange-soft);
  color: var(--orange);
}

.badge-danger {
  background-color: var(--red-soft);
  color: var(--red);
}

.badge-recurrence {
  background-color: var(--blue-soft);
  color: var(--blue);
}

.badge-report {
  background-color: var(--bg-subtle);
  color: var(--text-primary);
}

.priority-dot {
  display: inline-block;
  vertical-align: middle;
  box-shadow: none;
}

.priority-dot.dot-urgent {
  background-color: var(--red);
}

.priority-dot.dot-high {
  background-color: var(--orange);
}

.priority-dot.dot-normal {
  background-color: var(--blue);
}

.priority-dot.dot-low {
  background-color: var(--green);
}

.badge-status {
  font-size: 10.5px;
  font-weight: 500;
  text-transform: uppercase;
  padding: 1px 7px;
  border-radius: var(--radius-pill);
  border: none;
  letter-spacing: 0.02em;
}

.badge-status.badge-color-blue,
.badge-status[data-color="blue"] {
  color: var(--blue);
  background-color: var(--blue-soft);
}

.badge-status.badge-color-cyan,
.badge-status[data-color="cyan"] {
  color: var(--cyan);
  background-color: var(--bg-subtle);
}

.badge-status.badge-color-green,
.badge-status[data-color="green"] {
  color: var(--green);
  background-color: var(--bg-subtle);
}

.badge-status.badge-color-gray,
.badge-status[data-color="gray"] {
  color: var(--gray);
  background-color: var(--bg-subtle);
}

.badge-status.badge-color-orange,
.badge-status[data-color="orange"] {
  color: var(--orange);
  background-color: var(--orange-soft);
}

.badge-status.badge-color-red,
.badge-status[data-color="red"] {
  color: var(--red);
  background-color: var(--red-soft);
}

.badge-status.badge-color-purple,
.badge-status[data-color="purple"] {
  color: var(--purple);
  background-color: var(--bg-subtle);
}

.badge-status.badge-color-pink,
.badge-status[data-color="pink"] {
  color: var(--pink);
  background-color: var(--bg-subtle);
}

.badge-status.badge-color-yellow,
.badge-status[data-color="yellow"] {
  color: var(--yellow);
  background-color: var(--bg-subtle);
}

.badge-status.badge-color-indigo,
.badge-status[data-color="indigo"] {
  color: var(--indigo);
  background-color: var(--bg-subtle);
}

.priority-dot,
.item-dot,
.dropdown-dot {
  width: var(--priority-dot-size);
  height: var(--priority-dot-size);
  min-width: var(--priority-dot-size);
  border-radius: 50%;
  flex: 0 0 var(--priority-dot-size);
}

/* ==========================================================================
   Shared patterns: toolbar, empty state
   ========================================================================== */

.empty-state {
  text-align: center;
  border: none;
  border-radius: var(--radius-lg);
  padding: 72px 20px;
  background-color: transparent;
  box-shadow: none;
}

.empty-state-title {
  margin-bottom: 4px;
  font-size: 17px;
  color: var(--text-muted);
  font-weight: 600;
}

.inbox-quick-capture {
  display: flex;
  gap: 10px;
  margin-bottom: 10px; /* the same as the gap between the bar's buttons, as on a phone */
}

.filter-bar {
  justify-content: space-between;
  display: flex;
  gap: 10px;
  margin-bottom: 10px;
  padding-bottom: 0;
  border: none;
  height: var(--capture-h);
  align-items: stretch;
}

.filter-tabs {
  display: inline-flex;
  border: none;
  flex: 1;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
  height: 100%;
  background-color: var(--bg-surface);
  box-shadow: none;
  align-items: stretch;
  padding: 4px;
  box-sizing: border-box;
  justify-content: space-between;
  gap: 0;
}

@media (hover: hover) {
  .filter-tab:hover {
    color: var(--text-primary);
  }
}

/* The selected tab is marked by its text alone, no filled background */
.filter-tab.active {
  color: var(--text-primary);
  box-shadow: none;
}

.tasks-list,
.inbox-list {
  display: flex;
  flex-direction: column;
  gap: 0;
  background-color: var(--bg-surface);
  border-radius: var(--radius-md);
  box-shadow: var(--ring-hairline);
  overflow: hidden;
}

.tasks-list .empty-state {
  background: transparent;
}

.filter-priority-wrap {
  display: flex;
}

.filter-priority-wrap .apple-dropdown {
  display: flex;
}

.filter-priority-wrap .apple-dropdown-btn {
  padding: 0 16px;
  font-size: 13px;
  height: 100%;
  background-color: var(--bg-surface);
  min-width: 196px;
  justify-content: space-between;
}

.filter-bar > .btn-primary {
  padding: 0 20px;
  height: var(--capture-h);
  min-height: 0;
}

.filter-tabs::-webkit-scrollbar {
  display: none;
}

.inbox-actions .btn-secondary {
  background: none;
  color: var(--blue);
  padding: 3px 9px;
  min-height: 24px;
  font-weight: 500;
}

.inbox-quick-capture > .btn {
  height: var(--capture-h);
  padding: 0 20px;
}

.filter-priority-wrap,
.filter-priority-wrap .apple-dropdown {
  height: 100%;
}

@media (hover: hover) {
  .filter-priority-wrap .apple-dropdown-btn:hover {
    background-color: var(--bg-hover);
  }
}

.filter-priority-wrap .apple-dropdown-menu {
  left: 0;
  right: 0;
  width: 100%;
  min-width: 100%;
  top: calc(100% + 6px);
}

.filter-tab .tab-count {
  display: inline-flex;
  align-items: center;
  font-variant-numeric: tabular-nums;
}

.filter-tab .tab-count::before {
  content: '';
  width: 4px;
  height: 4px;
  border-radius: 50%;
  margin: 0 8px;
  position: relative;
  top: 0.5px;
  background-color: currentColor;
}

@media (hover: hover) {
  .filter-tab:not(.active):hover {
    background-color: var(--bg-hover);
  }
}

.filter-priority-wrap .apple-dropdown-btn,
.filter-bar > .btn-primary {
  box-shadow: none;
}

.input-capture,
.inbox-quick-capture > .btn,
.filter-tabs,
.filter-priority-wrap .apple-dropdown-btn,
.filter-bar > .btn-primary {
  border-radius: var(--capture-r);
}

.calendar-bar {
  margin-bottom: 10px;
}

.calendar-nav {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  padding: 4px;
  box-sizing: border-box;
  background-color: var(--bg-surface);
  border-radius: var(--capture-r);
}

.cal-nav-btn {
  width: 38px;
  border: none;
  background: none;
  color: var(--blue);
  border-radius: calc(var(--capture-r) - 4px);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background-color 0.12s ease;
}

@media (hover: hover) {
  .cal-nav-btn:hover {
    background-color: var(--bg-hover);
  }
}

.calendar-month-label {
  align-self: center;
  margin: 0;
  font-size: 15px;
  font-weight: 400;
  letter-spacing: -0.016em;
  color: var(--text-secondary);
}

.calendar-bar > .btn-primary,
.journal-bar > .btn-primary {
  height: var(--capture-h);
  min-height: 0;
  padding: 0 20px;
  border-radius: var(--capture-r);
}

.calendar-modes {
  display: flex;
  align-items: stretch;
  padding: 4px;
  box-sizing: border-box;
  background-color: var(--bg-surface);
  border-radius: var(--capture-r);
  flex-shrink: 0;
  gap: 2px;
}

.cal-mode-btn {
  border: none;
  background: none;
  padding: 0 14px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  border-radius: calc(var(--capture-r) - 4px);
  cursor: pointer;
  white-space: nowrap;
  transition: background-color 0.12s ease, color 0.12s ease;
}

@media (hover: hover) {
  .cal-mode-btn:hover,
    .btn-pill:not(.active):hover,
    .scale-pill:not(.active):hover {
    background-color: var(--bg-hover);
    color: var(--text-primary);
  }
}

.cal-mode-btn.active {
  color: var(--text-primary);
}

.kanban-bar,
.journal-bar {
  height: var(--capture-h);
  align-items: stretch;
}

.kanban-bar .calendar-modes {
  height: var(--capture-h);
  padding: 0; /* a single button, not a segmented control: it highlights as a whole */
}

.kanban-bar .cal-mode-btn {
  border-radius: var(--capture-r);
}

.unscheduled-task-item .btn {
  width: auto;
  min-height: 24px;
  margin-top: 2px;
  padding: 2px 0;
  background: none;
  color: var(--blue);
  justify-content: flex-start;
  font-size: 12.5px;
}

.kanban-bar .filter-priority-wrap,
.kanban-bar .filter-priority-wrap .apple-dropdown {
  height: 100%;
  display: flex;
}

.kanban-bar .filter-priority-wrap .apple-dropdown-btn {
  height: 100%;
}

@media (max-width: 1100px) {
  .calendar-bar {
    flex-wrap: wrap;
    height: auto;
  }

  .calendar-nav {
    flex-basis: 100%;
    height: var(--capture-h);
  }

  .calendar-modes {
    height: var(--capture-h);
    flex: 1;
  }

  .cal-mode-btn {
    flex: 1;
    padding: 0 8px;
  }
}

@media (max-width: 768px) {
  .filter-bar,
  .inbox-quick-capture,
  .kanban-bar,
  .calendar-bar,
  .journal-bar {
    height: auto;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 10px; /* the same as the gap between the rows of a bar, so bar rows and content are spaced evenly */
    flex-direction: row;
    align-items: stretch;
  }
}

.inbox-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: none;
  padding-top: 0;
  margin-top: 3px;
  min-height: 26px;
}

.kanban-column {
  border: none;
  display: flex;
  flex-direction: column;
  min-height: 0;
  background-color: var(--bg-surface);
  border-radius: var(--radius-md);
  box-shadow: var(--ring-hairline);
  overflow: hidden;
  flex: 1 1 220px;
  min-width: 220px;
  max-width: 380px;
}

.kanban-cards-area {
  display: flex;
  flex-direction: column;
  flex: 1;
  transition: background-color 0.15s ease;
  padding: 0;
  gap: 0;
  min-height: 120px;
  border-radius: 0;
}

.journal-layout {
  border: none;
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  gap: 10px;
  background: none;
  box-shadow: none;
  border-radius: 0;
  overflow: visible;
}

.editor-body {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  gap: 8px;
}

.event-block-inner {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-height: 0;
}

.kcard-title-line {
  align-items: center;
  gap: 8px;
  display: block;
  line-height: 1.35;
}

.journal-list-pane {
  border-right: none;
  width: 300px;
  flex-shrink: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

@media (max-width: 768px) {
  .journal-list-pane {
    box-shadow: none;
    width: 100%;
  }
}

.journal-list-pane,
.journal-editor-pane {
  background-color: var(--bg-surface);
  border-radius: var(--radius-md);
  box-shadow: var(--ring-hairline);
  min-height: 0;
}

.journal-entries-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 6px 0;
}

@media (max-width: 768px) {
  .filter-bar > *,
  .inbox-quick-capture > * {
    min-height: var(--capture-h);
  }

  .filter-tabs {
    flex: 1 1 100%;
    height: var(--capture-h);
    overflow-x: auto;
    justify-content: flex-start;
  }

  .filter-priority-wrap {
    min-width: 0;
    flex: 1 1 130px;
  }
}

.editor-header-controls .apple-dropdown-btn {
  min-width: 150px;
}

@media (max-width: 768px) {
  .filter-priority-wrap .apple-dropdown,
  .filter-priority-wrap .apple-dropdown-btn {
    width: 100%;
    min-width: 0;
  }

  .filter-bar > .btn-primary,
  .journal-bar > .btn-primary {
    height: var(--capture-h);
  }

  .inbox-quick-capture:not(.kanban-bar):not(.journal-bar) {
    flex-wrap: nowrap;
  }

  .journal-bar .input-capture {
    flex: 1 1 100%;
  }

  .calendar-nav {
    flex: 1 1 100%;
  }

  .calendar-modes {
    flex: 1 1 0;
    min-width: 0;
  }

  .cal-mode-btn {
    flex: 1;
    padding: 0 6px;
    font-size: 12.5px;
  }

  .calendar-bar > .btn-primary {
    flex: 0 0 auto;
  }

  .filter-priority-wrap,
  .filter-priority-wrap .apple-dropdown {
    height: var(--capture-h);
  }
}

.editor-header-controls .apple-datepicker-trigger,
.editor-header-controls .apple-dropdown-btn {
  min-height: 32px;
  height: 32px;
  padding: 0 12px;
  border-radius: 8px;
  font-size: 13px;
}

@media (max-width: 768px) {
  .filter-priority-wrap .apple-dropdown-btn {
    height: 100%;
    padding: 0 12px;
    gap: 6px;
  }

  .calendar-modes,
  .calendar-nav {
    height: var(--capture-h);
  }

  .kanban-bar .calendar-modes {
    flex: 0 0 auto;
  }

  .kanban-bar .cal-mode-btn {
    white-space: nowrap;
    padding: 0 10px;
    font-size: 12.5px;
  }

  .kanban-bar .filter-priority-wrap,
  .kanban-bar .filter-priority-wrap .apple-dropdown,
  .journal-bar .filter-priority-wrap,
  .journal-bar .filter-priority-wrap .apple-dropdown {
    height: var(--capture-h);
  }

  .kanban-bar .filter-priority-wrap .apple-dropdown-btn,
  .journal-bar .filter-priority-wrap .apple-dropdown-btn {
    height: 100%;
  }

  .kanban-bar .filter-priority-wrap,
    .journal-bar .filter-priority-wrap {
    flex: 1 1 0;
    min-width: 100px;
  }

  .journal-bar > .btn-primary {
    padding: 0 14px;
    flex: 0 0 auto;
  }
}

/* ==========================================================================
   Inbox
   ========================================================================== */

.inbox-card {
  border: none;
  background: transparent;
  border-radius: 0;
  box-shadow: none;
  position: relative;
  padding: 13px 16px;
}

@media (hover: hover) {
  .inbox-card:hover,
    .task-card:hover {
    box-shadow: none;
    background-color: var(--bg-hover);
  }
}

.inbox-content {
  word-break: break-word;
  white-space: pre-wrap;
  color: var(--text-primary);
  font-size: 15px;
  letter-spacing: -0.016em;
  line-height: 1.4;
}

.inbox-time {
  color: var(--text-muted);
  font-size: 12.5px;
}

.inbox-actions {
  display: flex;
  align-items: center;
  opacity: 0;
  gap: 2px;
}

.inbox-list .empty-state {
  background: transparent;
}

.inbox-card + .inbox-card::before,
.unscheduled-task-item::before,
.td-row + .td-row::before,
.td-report + .td-report::before {
  content: '';
  position: absolute;
  top: 0;
  left: 16px;
  right: 16px;
  height: 0.5px;
  background-color: var(--line);
}

.inbox-card:focus-within .inbox-actions {
  opacity: 1;
}

@media (hover: hover) {
  .inbox-card:hover .inbox-actions {
    opacity: 1;
  }
}

@media (hover: hover) {
  .inbox-actions .btn-secondary:hover {
    background-color: var(--blue-soft);
  }
}

.inbox-actions .btn-icon {
  font-size: 16px;
}

@media (hover: hover) {
  .inbox-actions .btn-icon:hover {
    color: var(--red);
    background-color: var(--red-soft);
  }
}

.col-header-actions {
  display: flex;
  gap: 4px;
  opacity: 0;
}

@media (hover: none) {
  .inbox-actions,
  .col-header-actions {
    opacity: 1;
  }
}

@media (max-width: 768px) {
  .inbox-card {
    padding: 12px;
  }

  .inbox-content {
    font-size: 16px;
  }

  .inbox-actions {
    flex-wrap: wrap;
    justify-content: flex-end;
  }
}

/* ==========================================================================
   Tasks list
   ========================================================================== */

.task-card {
  border: none;
  background: transparent;
  border-radius: 0;
  box-shadow: none;
  position: relative;
}

.task-card.is-child { margin-left: 30px; }
.task-card.is-child .task-main { padding-left: 16px; }
.task-card.is-child::after {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  border-left: 2px solid var(--line);
  pointer-events: none;
}
.kanban-card.is-child { margin-left: 20px; border-left: 2px solid var(--line); }

@media (hover: hover) {
}

.task-main {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  padding: 14px 14px 10px; /* the last line carries its own leading below the letters: less padding there keeps the text visually centred */
}

.task-left {
  display: flex;
  align-items: flex-start;
  flex: 1;
  gap: 12px;
}

.task-status-btn {
  width: 19px;
  height: 19px;
  border-radius: 50%;
  border: 1.6px solid var(--line);
  background: transparent;
  color: var(--on-accent);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  margin-top: 1px;
  flex-shrink: 0;
}

@media (hover: hover) {
  .task-status-btn:hover {
    border-color: var(--blue);
    background-color: var(--blue-soft);
  }
}

.task-status-btn.checked {
  background-color: var(--blue);
  border-color: var(--blue);
  color: var(--on-accent);
}

/* The tick is drawn (not a text glyph), so it looks the same on every device */
.task-status-btn.checked::after {
  content: "";
  width: 12px;
  height: 12px;
  background-color: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 14 14' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M2.8 7.4 5.7 10.3 11.2 3.8'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 14 14' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M2.8 7.4 5.7 10.3 11.2 3.8'/%3E%3C/svg%3E") center / contain no-repeat;
}

.task-body {
  flex: 1;
}

.task-title-line {
  align-items: center;
  margin-bottom: 0;
  gap: 8px;
  display: block;
  line-height: 1.35;
}

.task-title {
  color: var(--text-primary);
  font-size: 15px;
  font-weight: 400;
  letter-spacing: -0.016em;
  line-height: 1.35;
}

.task-description {
  word-break: break-word;
  line-height: 1.45;
  font-size: 13px;
  color: var(--text-secondary);
  margin: 1px 0 0;
}

.task-badges {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0;
  margin-top: 3px;
  row-gap: 2px;
}

.task-card.is-overdue .task-title {
  color: var(--text-primary);
}

.task-card + .task-card::before {
  content: '';
  position: absolute;
  top: 0;
  right: 14px;
  height: 0.5px;
  background-color: var(--line);
  left: 48px;
}

/* A done task is the whole row in grey (ball, title, details, hashtags), not struck through */
.task-card.is-done,
.kanban-card.is-done,
.cal-agenda-item.is-done {
  opacity: 0.45;
}

/* #база: its own group (in the task tabs above the list, in a calendar day under the day's tasks), with no head (the
   #база hashtag says what it is) */
.cal-agenda-base { margin-top: 10px; }
.base-block { margin-bottom: 10px; } /* the same as from the bar above to the list *//* the gap only parts the base from ordinary tasks: with none of them beside it there is nothing to part it from */
.cal-agenda-head + .cal-agenda-base { margin-top: 0; }
.base-block:last-child { margin-bottom: 0; }
.base-list {
  overflow: hidden;
  background-color: var(--bg-surface);
  border-radius: var(--radius-md);
  box-shadow: var(--ring-hairline);
}
.base-head {
  display: flex;
  align-items: baseline;
  gap: 6px;
  padding: 0 4px 8px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
}
.base-name { font-weight: 600; color: var(--text-primary); }
.base-count { font-variant-numeric: tabular-nums; }


.task-card .task-status-btn,
.kcard-row .task-status-btn {
  width: 22px;
  height: 22px;
  margin-top: 0;
  font-size: 12px;
}

.task-badges .badge {
  background: none;
  padding: 0;
  border-radius: 0;
  font-size: 12.5px;
  font-weight: 400;
  color: var(--text-muted);
  letter-spacing: -0.005em;
}

.task-badges .badge-warning {
  color: var(--orange);
  background: none;
}

.task-badges .badge-danger {
  color: var(--red);
  background: none;
}

/* «на день» task whose day went by unticked: missed, not overdue — grey, never red */
.badge-missed {
  background-color: var(--bg-subtle);
  color: var(--text-muted);
}

.task-badges .badge-missed {
  background: none;
}

.task-card.is-missed .task-title {
  color: var(--text-secondary);
}

/* a day of an «на день» task that went by unticked: the whole row (its «пропущено» and dividing line too) is faded
   like a done one, with a small «пропущено» in the theme's red right after the title */
.cal-agenda-item.is-missed {
  opacity: 0.45;
}

.cal-agenda-item.is-missed .cal-agenda-title {
  flex: 0 1 auto;
}

.cal-agenda-missed {
  flex: none;
  margin-right: auto;
  line-height: 20px;
  font-size: 12px;
  font-weight: 500;
  color: var(--red);
}

.td-value.is-missed {
  color: var(--text-muted);
}

.task-badges .badge-recurrence,
.task-badges .badge-report {
  color: var(--text-muted);
  background: none;
}

.task-card .badge-status {
  font-size: 11px;
  text-transform: none;
  letter-spacing: 0;
  font-weight: 500;
  padding: 1px 8px;
}

.task-badges .badge-status {
  background: none;
  padding: 0;
  border-radius: 0;
  font-size: 12.5px;
  font-weight: 500;
  text-transform: none;
  letter-spacing: -0.005em;
}

.task-badges .badge-status.badge-color-blue {
  color: var(--blue);
}

.task-badges .badge-status.badge-color-cyan {
  color: var(--cyan);
}

.task-badges .badge-status.badge-color-green {
  color: var(--green);
}

.task-badges .badge-status.badge-color-gray {
  color: var(--gray);
}

.task-badges .badge-status.badge-color-orange {
  color: var(--orange);
}

.task-badges .badge-status.badge-color-red {
  color: var(--red);
}

.task-badges .badge-status.badge-color-purple {
  color: var(--purple);
}

.task-badges .badge-status.badge-color-pink {
  color: var(--pink);
}

.task-badges .badge-status.badge-color-yellow {
  color: var(--yellow);
}

.task-badges .badge-status.badge-color-indigo {
  color: var(--indigo);
}

.modal-container.active {
  display: block;
}

.schedule-event-block .event-time-range {
  display: block;
  font-size: 12px;
  font-weight: 400;
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
  line-height: 1.3;
}

.schedule-event-block .event-meta-line {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 0; /* the same 1px step as between the title and the time */
  font-size: 12px;
  line-height: 1.3;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.schedule-event-block .event-desc-snippet {
  margin-top: 4px;
  font-size: 12px;
  color: var(--text-muted);
  white-space: normal;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.kcard-meta .badge {
  font-size: 12px;
  display: block;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.kanban-card.is-drag-source {
  display: none;
}

.kcard-title-line .kcard-title {
  display: inline;
}

.kcard-title-line .priority-dot,
.task-title-line .priority-dot {
  display: inline-block;
  vertical-align: middle;
  position: relative;
  top: -1px;
}

.task-title-line .task-title {
  display: inline;
}

/* The last word of a title and its priority dot never separate across lines */
.title-last-word {
  white-space: nowrap;
}

.title-last-word .priority-dot {
  margin-left: 7px;
}

.task-title-line .priority-dot,
.kcard-title-line .priority-dot {
  margin-left: 7px;
}

.task-card,
.unscheduled-task-item {
  cursor: pointer;
}

.kanban-card + .kanban-card::before {
  content: '';
  position: absolute;
  top: 0;
  right: 14px;
  height: 0.5px;
  background-color: var(--line);
  left: 14px;
}

.kanban-card.kanban-drag-ghost::before {
  content: none;
}

@media (hover: hover) {
  .task-card:hover::before,
.task-card:hover + .task-card::before,
.inbox-card:hover::before,
.inbox-card:hover + .inbox-card::before,
.kanban-card:hover::before,
.kanban-card:hover + .kanban-card::before,
.unscheduled-task-item:hover::before,
.unscheduled-task-item:hover + .unscheduled-task-item::before,
.td-row.te-option:hover::before,
.td-row.te-option:hover + .td-row::before {
    content: none;
  }
}

@media (max-width: 768px) {
  .task-main {
    padding: 12px 12px 10px;
  }

  .task-card + .task-card::before {
    left: 46px;
    right: 12px;
  }

  .task-title {
    font-size: 16px;
  }
}

/* ==========================================================================
   Calendar
   ========================================================================== */

.cal-weekend {
  color: var(--text-muted);
  opacity: 0.7;
}

.dp-day-cell.other-month {
  color: var(--text-muted);
  opacity: 0.55;
}

/* The calendar is an agenda on every screen: a list of days, and for a month a compact grid tinted by how busy
   each day is, with the tasks of the selected day next to it (below it on a phone). */
/* On a wide window the month grid and the navigation bar above it have the same width (--cal-col), and the tasks of
   the chosen day sit beside the grid. On a narrower one everything is one column as wide as the bar. */
.app-main[data-view="calendar"] {
  --cal-col: 520px;
}

@media (min-width: 1280px) {
  /* The bar is laid out exactly like the one on «Расписание»: the date switcher takes the free width, the view
     modes, the tag filter and «Сегодня» sit together at the right, all 10px apart */
  .cal-phone.is-month {
    display: grid;
    grid-template-columns: var(--cal-col) minmax(0, 1fr);
    gap: 10px; /* blocks side by side are 10px apart, like the bar's buttons */
    align-items: start;
  }

  .cal-phone.is-month .cal-mini {
    margin-bottom: 0;
  }
}
.cal-mini {
  margin-bottom: 0;
}

@media (max-width: 1024px) {
  .cal-phone.is-month {
    display: block;
    max-width: 520px;
  }

  .cal-phone.is-month .cal-mini {
    margin-bottom: 10px;
  }
}

@media (max-width: 768px) {
  .cal-phone,
  .cal-phone.is-month {
    max-width: none;
  }
}
.cal-mini {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 0;
  padding: 8px 6px 10px;
  margin-bottom: 10px;
  background-color: var(--bg-surface);
  border-radius: var(--radius-md);
  box-shadow: var(--ring-hairline);
}

.cal-mini-wd {
  padding: 4px 0 6px;
  text-align: center;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
}

.cal-mini-wd.is-today {
  color: var(--blue);
  font-weight: 700;
}

.cal-mini-day {
  --tint: var(--blue);
  --tint-amount: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 1;
  margin: 2px;
  border: none;
  border-radius: 12px;
  background: none;
  position: relative;
  color: var(--text-primary);
  font-family: inherit;
  cursor: pointer;
}

/* The day's colour is the priority colour itself, shown at a strength that follows the number of tasks */
.cal-mini-day::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background-color: var(--tint);
  opacity: var(--tint-amount);
}

.cal-mini-num {
  position: relative;
  font-size: 16px;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.cal-mini-day.prio-urgent { --tint: var(--red); }
.cal-mini-day.prio-high { --tint: var(--orange); }
.cal-mini-day.prio-low { --tint: var(--green); }

.cal-mini-day.load-1 { --tint-amount: var(--heat-1); }
.cal-mini-day.load-2 { --tint-amount: var(--heat-2); }
.cal-mini-day.load-3 { --tint-amount: var(--heat-3); }
.cal-mini-day.load-4 { --tint-amount: var(--heat-4); }

.cal-mini-day.other-month {
  color: var(--text-muted);
}

.cal-mini-day.is-today {
  color: var(--text-primary);
  font-weight: inherit;
}

/* The chosen day is outlined, so its tint (the load) stays readable */
.cal-mini-day.is-selected {
  box-shadow: inset 0 0 0 1.5px var(--text-secondary);
}
.cal-agenda-day {
  margin-bottom: 18px;
}

.cal-agenda-head {
  display: flex;
  align-items: center;
  padding: 0 4px 8px 0; /* the date starts right at the card's edge below */
}

.cal-agenda-head > .cal-agenda-add {
  margin-left: auto;
}

.cal-agenda-head > .cal-agenda-empty + .cal-agenda-add {
  margin-left: 0;
}

.cal-agenda-date,
.te-kicker {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
}

.cal-agenda-date b {
  margin-right: 6px;
  font-weight: 600;
  color: var(--text-primary);
}

.cal-agenda-day.is-today .cal-agenda-date b {
  color: var(--blue);
}

.cal-agenda-now {
  margin-left: 8px;
  color: var(--text-muted);
}

.cal-agenda-add {
  width: 28px;
  height: 28px;
  border: none;
  background: none;
  color: var(--text-secondary);
  font-size: 22px;
  font-weight: 300;
  line-height: 1;
  cursor: pointer;
}

.cal-agenda-list {
  overflow: hidden;
  background-color: var(--bg-surface);
  border-radius: var(--radius-md);
  box-shadow: var(--ring-hairline);
}

.cal-agenda-item {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  cursor: pointer;
}

.cal-agenda-item + .cal-agenda-item::before {
  content: '';
  position: absolute;
  top: 0;
  left: 14px;
  right: 14px;
  height: 0.5px;
  background-color: var(--line);
}

.cal-agenda-time {
  flex: none;
  width: 52px; /* fits "На день" / "До дня" on one line (a task without a time) */
  white-space: nowrap;
  line-height: 20px; /* the height of the title's first line, so nothing is taller than the text and the row is padded evenly */
  font-size: 13px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.cal-agenda-title .priority-dot {
  margin-left: 7px;
}

.cal-agenda-title {
  flex: 1;
  min-width: 0;
  font-size: 15px;
  line-height: 20px;
  letter-spacing: -0.012em;
  color: var(--text-primary);
  overflow-wrap: anywhere;
}

.cal-agenda-recur {
  flex: none;
  display: inline-flex;
  align-items: center;
  height: 20px;
  color: var(--text-muted);
}

.cal-agenda-item.is-overdue .cal-agenda-time {
  color: var(--orange);
}

.cal-agenda-day.is-empty {
  margin-bottom: 8px;
}

.cal-agenda-day.is-empty .cal-agenda-head {
  padding-bottom: 0;
}

.cal-agenda-empty {
  margin: 0 10px 0 auto;
  font-size: 13px;
  color: var(--text-muted);
}

/* ==========================================================================
   Schedule
   ========================================================================== */

.schedule-layout {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 10px;
  align-items: flex-start;
}

.schedule-timeline-container {
  border: none;
  display: flex;
  position: relative;
  background: none;
  box-shadow: none;
  border-radius: 0;
  overflow: visible;
  gap: 12px;
}

.timeline-hours-col {
  border-right: none;
  position: relative;
  background: none;
  width: 44px;
  flex-shrink: 0;
  box-shadow: none;
}

.timeline-hour-slot {
  position: absolute;
  left: 0;
  width: 100%;
  display: flex;
  height: 0;
  padding-top: 0;
  justify-content: flex-end;
}

.timeline-canvas {
  flex: 1;
  position: relative;
  background-color: var(--bg-surface);
  border-radius: var(--radius-md);
  box-shadow: var(--ring-hairline);
  overflow: hidden;
}

.canvas-grid-line {
  position: absolute;
  left: 0;
  right: 0;
  pointer-events: none;
  border-bottom: 0.5px solid var(--line-soft);
}

.canvas-grid-half-line {
  position: absolute;
  left: 0;
  right: 0;
  pointer-events: none;
  border-bottom: 0.5px dashed var(--line-soft);
}

.schedule-event-block {
  position: absolute;
  border: none;
  overflow: hidden;
  cursor: pointer;
  transition: all 0.15s ease;
  z-index: 10;
  backdrop-filter: none;
  left: 6px;
  right: 6px;
  margin: 0 1px; /* a hairline between events that sit side by side */
  padding: 7px 10px 8px;
  border-radius: 8px;
  background-color: var(--event-block);
  color: var(--text-primary);
  box-shadow: none;
}

@media (hover: hover) {
  .schedule-event-block:hover {
    box-shadow: none;
    background-color: var(--event-block-hover);
  }
}

.event-time-range {
  font-variant-numeric: tabular-nums;
  color: var(--text-secondary);
  font-weight: 500;
}

.event-dur {
  font-weight: normal;
  color: var(--text-muted);
}

.event-title {
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 500;
  font-size: 13.5px;
}

.event-meta-line {
  font-size: 11.5px;
  color: var(--text-secondary);
  margin-top: 2px;
}

.event-desc-snippet {
  font-size: 11.5px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.schedule-sidebar {
  border: none;
  background-color: var(--bg-surface);
  border-radius: var(--radius-md);
  box-shadow: var(--ring-hairline);
  padding: 0;
  overflow: hidden;
}

.unscheduled-tasks-list {
  display: flex;
  flex-direction: column;
  margin-top: 0;
  gap: 0;
}

.unscheduled-task-item {
  border: none;
  transition: all 0.12s ease;
  background: transparent;
  box-shadow: none;
  border-radius: 0;
  padding: 11px 16px;
  position: relative;
}

.u-task-title {
  color: var(--text-primary);
  font-size: 14px;
  font-weight: 400;
  letter-spacing: -0.012em;
}

.u-task-meta {
  color: var(--text-muted);
  font-size: 12.5px;
  margin-top: 2px;
}

.hour-label {
  color: var(--text-muted);
  transform: translateY(-50%);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

/* Current-time line in today's schedule */
.timeline-now {
  position: absolute;
  left: 0;
  right: 0;
  height: 0;
  border-top: 1.5px solid var(--blue);
  z-index: 20;
  pointer-events: none;
}

.sidebar-header {
  padding: 14px 16px 10px;
}

.sidebar-header h3 {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  letter-spacing: 0;
}

@media (hover: hover) {
  .unscheduled-task-item:hover {
    background-color: var(--bg-hover);
  }
}

@media (hover: hover) {
  .unscheduled-task-item .btn:hover {
    background: none;
    color: var(--blue-hover);
  }
}

.schedule-sidebar > .unscheduled-tasks-list > .text-muted {
  padding: 8px 16px 16px;
}

.timeline-hour-slot:first-child .hour-label {
  transform: translateY(-2px);
}

.event-title-row {
  display: flex;
  align-items: center;
  justify-content: flex-start; /* the importance dot sits right after the title text */
  gap: 7px;
}

.schedule-event-block .event-title {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -0.012em;
  line-height: 1.3;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.schedule-event-block .event-dur::before {
  content: '·';
  margin: 0 5px;
}

.schedule-event-block .event-dur {
  font-weight: 400;
  color: var(--text-secondary);
}

.schedule-event-block .event-meta-line svg {
  flex-shrink: 0;
  opacity: 0.9;
}

.schedule-event-block.is-compact {
  padding: 4px 10px;
}

.schedule-event-block.is-compact .event-block-inner {
  flex-direction: row;
  align-items: center;
  gap: 8px;
  position: relative;
}

.schedule-event-block.is-compact .event-title-row {
  min-width: 0;
  flex: 0 1 auto;
}

.schedule-event-block.is-compact .event-time-range {
  white-space: nowrap;
  flex-shrink: 0;
}

.schedule-event-block.is-compact .event-dur,
.schedule-event-block.is-compact .event-meta-line,
.schedule-event-block.is-compact .event-desc-snippet {
  display: none;
}

.timeline-canvas > .canvas-grid-line:first-child {
  border-bottom: none;
}

@media (max-width: 1024px) {
  .schedule-layout {
    grid-template-columns: 1fr;
  }
}

/* Phone: the hour grid is too cramped (events overlap, half the day is empty),
   so the day is a list of event cards in time order with a "now" line between them */
.sched-agenda {
  display: none;
}

@media (max-width: 768px) {
  .schedule-layout {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .schedule-timeline-container {
    display: none;
  }

  .sched-agenda {
    display: flex;
    flex-direction: column;
    gap: 8px;
  }
}

/* Neutral cards like every other list: importance is only the dot after the title */
.sched-item {
  display: flex;
  gap: 14px;
  padding: 12px 14px 10px;
  border-radius: var(--radius-md);
  background-color: var(--bg-surface);
  cursor: pointer;
}

.sched-item.is-past {
  opacity: 0.5;
}

.sched-item.is-live .sched-start {
  color: var(--blue);
}

.sched-times {
  flex: none;
  display: flex;
  flex-direction: column;
  gap: 3px;
  width: 42px;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.sched-end {
  color: var(--text-muted);
}

.sched-body,
.kcard-body {
  flex: 1;
  min-width: 0;
}

.sched-title {
  font-size: 15px;
  font-weight: 500;
  line-height: 1.3;
  letter-spacing: -0.012em;
  color: var(--text-primary);
  overflow-wrap: anywhere;
}

.sched-title .priority-dot {
  margin-left: 7px;
}

.sched-sub {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 12px;
  margin-top: 3px;
  font-size: 13px;
  color: var(--text-secondary);
}

.sched-loc {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
}

.sched-loc svg {
  flex: none;
}

.sched-desc {
  margin-top: 3px;
  font-size: 13px;
  line-height: 1.4;
  color: var(--text-muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.sched-now {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--blue);
  font-variant-numeric: tabular-nums;
}

.sched-now::after {
  content: '';
  flex: 1;
  height: 1.5px;
  background-color: var(--blue);
}

/* Events from calendar links: same cards, with a small calendar glyph; all-day ones sit in a strip above the day */
.ext-glyph {
  flex: none;
  vertical-align: -1px;
  color: var(--text-muted);
}

.ext-source {
  display: inline-flex;
  align-items: center;
  margin-right: 6px;
}

.sched-ext-note {
  margin: 0 4px 12px;
  font-size: 12.5px;
  line-height: 1.4;
  color: var(--orange);
}

.sched-allday {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}

.sched-allday-item {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  max-width: 100%;
  padding: 7px 12px;
  border: none;
  border-radius: 10px;
  background-color: var(--bg-surface);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
}

.sched-allday-item span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#sched-refresh.is-loading svg {
  opacity: 0.4;
}

.sched-empty {
  padding: 14px 0;
  text-align: center;
  font-size: 14px;
  color: var(--text-muted);
}

/* ==========================================================================
   Kanban
   ========================================================================== */

.kanban-board {
  display: flex;
  overflow-x: auto;
  scrollbar-gutter: stable;
  gap: 10px;
  margin: -2px -40px 0; /* the 2px top padding (room for the cards' outline) is not part of the gap above */
  padding: 2px 40px 16px;
  scroll-padding: 0 40px;
  scroll-snap-type: x proximity;
  overscroll-behavior-x: contain;
  flex: 1 1 auto;
  margin-bottom: -40px;
  padding-bottom: 8px;
  align-items: flex-start;
}

.col-color-dot {
  border-radius: 50%;
  display: inline-block;
  cursor: pointer;
  transition: transform 0.15s ease, opacity 0.15s ease;
  vertical-align: middle;
  width: 8px;
  height: 8px;
  flex-shrink: 0;
}

.col-color-dot.dot-cyan {
  background-color: var(--cyan);
}

.col-color-dot.dot-blue {
  background-color: var(--blue);
}

.col-color-dot.dot-green {
  background-color: var(--green);
}

.col-color-dot.dot-orange {
  background-color: var(--orange);
}

.col-color-dot.dot-red {
  background-color: var(--red);
}

.col-color-dot.dot-purple {
  background-color: var(--purple);
}

.col-color-dot.dot-pink {
  background-color: var(--pink);
}

.col-color-dot.dot-yellow {
  background-color: var(--yellow);
}

.col-color-dot.dot-indigo {
  background-color: var(--indigo);
}

.col-color-dot.dot-gray {
  background-color: var(--gray);
}

/* The selected dot: a ring drawn as the dot's own outline, so it is always exactly round and centred on it */
.col-modal-palette-dot.active {
  outline: 2px solid var(--text-primary);
  outline-offset: 3px;
}

.kanban-col-header {
  border-bottom: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 10px 10px 14px;
  box-shadow: 0 0.5px 0 var(--line-soft);
}

.col-title-wrap,
.jcard-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.col-title {
  color: var(--text-primary);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.012em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.kanban-cards-area.drag-over {
  border: none;
  border-radius: 0 0 var(--radius-md) var(--radius-md);
  background-color: transparent;
  box-shadow: none;
}

.kanban-empty-dropzone {
  text-align: center;
  border: none;
  margin: 10px;
  padding: 20px 12px;
  border-radius: 10px;
  background-color: var(--bg-subtle);
  color: var(--text-muted);
  font-size: 12.5px;
}

.kanban-card {
  cursor: grab;
  border: none;
  background: transparent;
  border-radius: 0;
  box-shadow: none;
  padding: 0;
  position: relative;
  flex-shrink: 0;
  touch-action: none;
  user-select: none;
}

@media (hover: hover) {
  .col-color-dot:hover,
.col-modal-palette-dot:hover {
    transform: none;
  }
}

/* The dot sits in front of every detail but the first, and the row clips what sticks out on the left: a detail that starts a new
   line loses its dot, so a line never ends with a dot hanging in the air */
.task-badges:not(.kcard-meta) {
  overflow: hidden;
  column-gap: 18px;
}

.task-badges:not(.kcard-meta) .badge {
  position: relative;
}

.task-badges:not(.kcard-meta) .badge:not(:first-child)::before {
  content: '';
  position: absolute;
  top: 50%;
  left: -11px;
  width: 4px;
  height: 4px;
  margin-top: -2px;
  border-radius: 50%;
  background-color: var(--text-muted); /* the same grey as the plain details (recurrence, report), whatever colour the detail before it has */
}

.kanban-column:focus-within .col-header-actions {
  opacity: 1;
}

@media (hover: hover) {
  .kanban-column:hover .col-header-actions {
    opacity: 1;
  }
}

.col-action-btn {
  width: 22px;
  height: 22px;
  border: none;
  padding: 0;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background-color: var(--bg-control);
  color: var(--text-secondary);
  cursor: pointer;
  flex-shrink: 0;
  transition: background-color 0.12s ease, color 0.12s ease;
}

@media (hover: hover) {
  .col-action-btn:hover,
    .td-close:hover {
    background-color: var(--bg-control-hover);
    color: var(--text-primary);
  }
}

@media (hover: hover) {
}

@media (hover: hover) {
  .kanban-card:hover {
    background-color: var(--bg-hover);
    box-shadow: none;
  }
}

.kcard-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 10px 10px 14px;
}

.kcard-title {
  font-size: 14px;
  font-weight: 400;
  letter-spacing: -0.012em;
  line-height: 1.35;
  color: var(--text-primary);
}

.kcard-desc {
  font-size: 12.5px;
  color: var(--text-secondary);
  margin: 1px 0 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.kcard-meta {
  margin-top: 3px;
  column-gap: 10px;
  row-gap: 2px;
  flex-direction: column;
  align-items: flex-start;
}

.kanban-board > .kanban-column {
  scroll-snap-align: start;
}

/* End-of-row spacer: only on phones, where the last column is centred by snapping. On a computer it would take
   room from the columns and make the board scroll sideways although every column fits. */
.kanban-board::after {
  content: '';
  display: none;
}

.kcard-title,
.kcard-desc {
  hyphens: manual;
  -webkit-hyphens: manual;
  overflow-wrap: break-word;
  word-break: normal;
}

.kcard-meta .badge svg {
  vertical-align: -1px;
}

.app-main[data-view="kanban"] .kanban-board {
  flex: 1 1 auto;
  min-height: 0;
  align-items: flex-start;
}

.app-main[data-view="kanban"] .kanban-column {
  max-height: 100%;
  display: flex;
  flex-direction: column;
}

.app-main[data-view="kanban"] .kanban-col-header {
  flex-shrink: 0;
}

.app-main[data-view="kanban"] .kanban-cards-area {
  flex: 0 1 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior-y: contain; /* only the vertical axis: a sideways swipe must reach the board */
}

.kanban-cards-area:has(.kanban-drop-placeholder) .kanban-empty-dropzone {
  display: none;
}

/* The floating copy that follows the pointer while a card is dragged */
.kanban-card.kanban-drag-ghost {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 5000;
  margin: 0;
  box-sizing: border-box;
  pointer-events: none;
  cursor: grabbing;
  background-color: var(--bg-hover);
  border-radius: 12px;
  box-shadow: var(--shadow-medium);
  will-change: transform; /* the card is positioned with transform: text is drawn once, not re-laid-out while moving */
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

/* While a card is dragged the whole page shows the grabbing cursor */
body.is-kanban-dragging,
body.is-kanban-dragging * {
  cursor: grabbing !important;
  user-select: none;
}

@media (hover: hover) {
  body.is-kanban-dragging .kanban-card:hover {
    background-color: transparent;
  }
}

/* The pointer passes over cards and columns while dragging: that is not hovering, so neither the hairlines vanish
   nor the column's "+" / "x" buttons appear */
@media (hover: hover) {
  body.is-kanban-dragging .kanban-card:hover::before,
  body.is-kanban-dragging .kanban-card:hover + .kanban-card::before {
    content: '';
  }

  body.is-kanban-dragging .kanban-card.kanban-drag-ghost::before {
    content: none;
  }

  body.is-kanban-dragging .kanban-column:hover:not(:focus-within) .col-header-actions {
    opacity: 0;
  }
}

/* Columns must not snap back while the board is scrolled by dragging a card to its edge */
body.is-kanban-dragging .kanban-board {
  scroll-snap-type: none;
}

/* Landing slot while dragging; same height as the card so nothing below shifts */
.kanban-drop-placeholder {
  flex: none; /* a column that is short on height must not squeeze the slot (and pull the cards below up) */
  margin: 0;
  background: none;
  box-shadow: none;
  border-radius: 0;
  position: relative;
}

.kanban-drop-placeholder::after {
  content: '';
  position: absolute;
  inset: 4px 8px;
  border-radius: 10px;
  background-color: var(--blue-soft);
  box-shadow: inset 0 0 0 1.5px var(--focus);
}

/* At the end of a column the slot's gap to the column's bottom edge equals its gap to the sides (8px); the slot's own
   height stays the same, so nothing moves */
.kanban-drop-placeholder:last-child::after {
  bottom: 8px;
}

@media (hover: none) {
  .kanban-card {
    touch-action: auto;
    cursor: default;
  }
}

@media (max-width: 768px) {
  .kanban-board {
    gap: 10px; /* like the bar's buttons */
    margin: -2px -16px 0;
    padding: 2px 16px 8px;
    scroll-padding: 0 16px;
    scroll-snap-type: x mandatory;
  }

  .kanban-column,
  .app-main[data-view="kanban"] .kanban-column {
    flex: 0 0 calc(84vw / var(--z));
    min-width: calc(84vw / var(--z));
    max-width: calc(84vw / var(--z));
    scroll-snap-align: center;
  }

  .kanban-board::after {
    display: block;
    flex: 0 0 4px;
  }
}

/* ==========================================================================
   Journal
   ========================================================================== */

.journal-item-card {
  border: none;
  position: relative;
  margin: 0 6px;
  padding: 10px 12px 8px;
  border-radius: 8px;
  cursor: pointer;
}

.editor-header-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.editor-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
  gap: 12px;
}

.w-40 {
  width: 150px;
}

.journal-title-input:focus {
  border: none;
}

.journal-textarea:focus {
  border: none;
  /* the text fades at its edges while it is read, not while it is typed: the line being written stays sharp */
  -webkit-mask-image: none !important;
  mask-image: none !important;
}

.editor-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: none;
  margin-top: 12px;
  padding: 12px 0 14px;
  box-shadow: 0 -0.5px 0 var(--line-soft);
}

.journal-title-input:focus,
.journal-textarea:focus {
  box-shadow: none;
  background: transparent;
}

.journal-item-card + .journal-item-card::before {
  content: '';
  position: absolute;
  left: 12px;
  right: 12px;
  height: 0.5px;
  background-color: var(--line);
  top: -1px;
}

.journal-item-card.is-active::before {
  content: none;
}

@media (hover: hover) {
  .journal-item-card:hover {
    background-color: var(--bg-hover);
  }
}

.journal-item-card.is-active {
  background-color: var(--bg-control-hover);
}

.journal-item-card.is-active .jcard-title {
  color: var(--text-primary);
}

.journal-item-card.is-active .jcard-snippet,
.journal-item-card.is-active .jcard-date {
  color: var(--text-secondary);
  opacity: 1;
}

.jcard-title {
  flex: 0 1 auto;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.012em;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.jcard-sub {
  display: flex;
  gap: 8px;
  margin-top: 2px;
  font-size: 12.5px;
  min-width: 0;
}

.jcard-date {
  flex-shrink: 0;
  color: var(--text-secondary);
  font-size: 12.5px;
}

.jcard-snippet {
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin: 0;
  font-size: 12.5px;
}

.journal-list-empty,
.journal-editor-empty {
  padding: 40px 16px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13.5px;
}

.journal-editor-empty {
  margin: auto;
}

.journal-editor-pane {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  padding: 18px 28px 0;
}

.editor-header-controls .apple-datepicker {
  width: auto;
}

.editor-save-status,
.te-opt-desc {
  font-size: 12.5px;
  color: var(--text-muted);
}

.editor-char-count {
  font-size: 12.5px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.journal-delete-btn {
  border: none;
  background: none;
  padding: 4px 10px;
  border-radius: 8px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  color: var(--red);
  cursor: pointer;
  transition: background-color 0.12s ease;
}

@media (hover: hover) {
  .journal-delete-btn:hover {
    background-color: var(--red-soft);
  }
}

.journal-title-input::placeholder,
.journal-textarea::placeholder,
.te-title::placeholder,
.te-desc::placeholder,
.te-note::placeholder {
  color: var(--text-placeholder);
  opacity: 1;
}

.journal-item-card.is-active + .journal-item-card::before {
  content: none;
}

@media (hover: hover) {
  .journal-item-card:hover::before,
.journal-item-card:hover + .journal-item-card::before {
    content: none;
  }
}

@media (max-width: 768px) {
  .journal-layout {
    flex-direction: column;
    gap: 10px;
  }

  .journal-editor-pane {
    display: none;
    min-height: calc(62dvh / var(--z));
    padding: 14px 16px 0;
  }

  input,
  textarea,
  .input,
  .textarea {
    font-size: 16px;
  }

  .journal-title-input {
    font-size: 24px;
  }

  .journal-textarea {
    min-height: calc(38dvh / var(--z));
    font-size: 16px;
  }

  .editor-header {
    flex-wrap: wrap;
  }

  .editor-header-controls {
    flex-wrap: wrap;
  }

  /* An entry opens as a bottom sheet over the list, like a task: swipe it down, tap the dimmed list or press the cross to close it */
  .app-main[data-journal-edit="1"] .journal-editor-pane {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1200;
    display: flex;
    min-height: calc(70dvh / var(--z));
    max-height: calc(92dvh / var(--z));
    padding: 48px 16px calc(12px + var(--safe-bottom));
    overflow-y: auto;
    border-radius: 20px 20px 0 0;
    background-color: var(--bg-sheet);
    box-shadow: var(--shadow-large);
  }

  .app-main[data-journal-edit="1"] .journal-editor-pane::before {
    content: '';
    position: absolute;
    top: 6px;
    left: 50%;
    width: 36px;
    height: 5px;
    margin-left: -18px;
    border-radius: 3px;
    background-color: var(--text-muted);
  }

  .app-main[data-journal-edit="1"] .journal-sheet-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 1150;
    background-color: color-mix(in srgb, var(--shadow) var(--scrim-strength), transparent);
    opacity: var(--dim, 1);
  }

  .journal-sheet-backdrop.is-settling {
    transition: opacity 0.22s ease;
  }

  .journal-entries-list {
    overflow: visible;
    gap: 0;
    padding: 0;
  }

  .journal-item-card {
    margin: 0;
    padding: 13px 16px;
    border-radius: 0;
  }

  .journal-item-card + .journal-item-card::before {
    left: 16px;
    right: 16px;
  }

  .journal-item-card.is-active {
    background-color: transparent;
  }

  .journal-item-card.is-active + .journal-item-card::before,
  .journal-item-card + .journal-item-card.is-active::before {
    content: ''; /* the card is not filled on a phone, so the lines above and below it stay */
  }

  .jcard-title {
    font-size: 16px;
  }

  .jcard-sub,
  .jcard-date,
  .jcard-snippet {
    font-size: 13px;
  }

  .jcard-sub {
    margin-top: 3px;
  }

  /* A sheet is closed by swiping it down (or the free zone above it), so no cross on a phone */
  .app-main[data-view="journal"] .journal-back,
  .modal-panel .td-close {
    display: none;
  }
}

.journal-back {
  display: none;
  align-items: center;
  gap: 6px;
  align-self: flex-start;
  margin: 0 0 12px -6px;
  padding: 6px 8px;
  border: none;
  background: none;
  color: var(--blue);
  font-family: inherit;
  font-size: 15px;
  cursor: pointer;
}

/* ==========================================================================
   Sheets: task window, task editor, report, event, column
   ========================================================================== */

.column-palette-picker {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  padding: 4px 0;
}

.col-modal-palette-dot {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  transition: transform 0.15s ease;
  position: relative;
}

.modal-container {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1000;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

/* The dimming and the blur live on a layer of their own so that both fade together when a sheet is swiped away */
.modal-backdrop::before {
  content: '';
  position: absolute;
  inset: 0;
  background-color: color-mix(in srgb, var(--shadow) var(--scrim-strength), transparent);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  opacity: var(--dim, 1);
}

.modal-backdrop.is-settling::before {
  transition: opacity 0.22s ease;
}

.modal-panel {
  position: relative; /* above the dimming layer */
  border: none;
  max-width: 540px;
  width: 100%;
  max-height: calc(90vh / var(--z));
  overflow-y: auto;
  border-radius: 20px;
  box-shadow: var(--shadow-large);
  background-color: var(--bg-sheet);
}

/* Weekday picker: seven round buttons spread across the row; a chosen day is a soft blue disc with blue text */
.weekday-pills {
  display: flex;
  justify-content: space-between;
  gap: 4px;
  margin-top: 0;
}

.btn-pill {
  flex: none;
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background-color: transparent;
  border: none;
  color: var(--text-secondary);
  padding: 0;
  border-radius: 50%;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
}

/* Only where there is a real pointer: on a touchscreen "hover" sticks after a tap and would leave the day lit white */
@media (hover: hover) {
}

.btn-pill.active,
.scale-pill.active {
  background-color: var(--blue-soft);
  color: var(--blue);
  font-weight: 600;
}

.photo-dropzone {
  border-radius: var(--radius-md);
  padding: 24px;
  text-align: center;
  cursor: pointer;
  background-color: var(--bg-subtle);
  transition: all 0.15s ease;
  border: 1px dashed var(--line);
}

.photo-dropzone.drag-active {
  background-color: var(--blue-soft);
}

.file-hidden {
  display: none;
}

.photo-preview-container img {
  max-width: 100%;
  max-height: 220px;
  border-radius: var(--radius-sm);
  display: block;
  margin: 0 auto 10px auto;
}

.btn-remove-photo {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 12px;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.modal-panel.task-detail {
  max-width: 460px;
  padding: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.td-topbar {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 14px 0 20px;
}

.td-status {
  font-size: 12px;
  font-weight: 500;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  text-transform: none;
  letter-spacing: 0;
}

.td-close {
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background-color: var(--bg-control);
  color: var(--text-secondary);
  cursor: pointer;
  transition: background-color 0.12s ease, color 0.12s ease;
}

@media (hover: hover) {
}

.td-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 12px 20px 8px;
}

/* Scrolling inside a block (kanban columns, journal list and text, sheets) shows no scrollbar: wheel, touchpad and
   drag still scroll, rows highlight edge to edge, and the edge of the area fades out wherever more content lies
   beyond it (classes fade-top / fade-bottom are set by script) */
.td-body,
.journal-textarea,
.app-main[data-view="kanban"] .kanban-cards-area,
.journal-entries-list {
  scrollbar-width: none;
}

.td-body::-webkit-scrollbar,
.journal-textarea::-webkit-scrollbar,
.app-main[data-view="kanban"] .kanban-cards-area::-webkit-scrollbar,
.journal-entries-list::-webkit-scrollbar {
  display: none;
}

.td-body.fade-bottom,
.journal-textarea.fade-bottom,
.kanban-cards-area.fade-bottom,
.journal-entries-list.fade-bottom {
  -webkit-mask-image: linear-gradient(to bottom, #000 calc(100% - 36px), transparent);
  mask-image: linear-gradient(to bottom, #000 calc(100% - 36px), transparent);
}

.td-body.fade-top,
.journal-textarea.fade-top,
.kanban-cards-area.fade-top,
.journal-entries-list.fade-top {
  -webkit-mask-image: linear-gradient(to bottom, transparent, #000 36px);
  mask-image: linear-gradient(to bottom, transparent, #000 36px);
}

.td-body.fade-top.fade-bottom,
.journal-textarea.fade-top.fade-bottom,
.kanban-cards-area.fade-top.fade-bottom,
.journal-entries-list.fade-top.fade-bottom {
  -webkit-mask-image: linear-gradient(to bottom, transparent, #000 36px, #000 calc(100% - 36px), transparent);
  mask-image: linear-gradient(to bottom, transparent, #000 36px, #000 calc(100% - 36px), transparent);
}

.td-title {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.2;
  color: var(--text-primary);
  margin: 4px 0 0;
  word-break: normal;
  overflow-wrap: break-word;
}

.td-title .priority-dot {
  vertical-align: middle;
  position: relative;
  top: -1px;
}

.td-desc {
  margin: 10px 0 0;
  font-size: 15px;
  line-height: 1.5;
  color: var(--text-secondary);
  white-space: pre-wrap;
  overflow-wrap: break-word;
}

.td-group {
  margin-top: 18px;
  background-color: var(--bg-field);
  border-radius: 12px;
  overflow: hidden;
}

.td-row,
.td-report {
  position: relative;
  padding: 12px 16px;
}

.td-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.td-label {
  font-size: 14px;
  color: var(--text-secondary);
  flex-shrink: 0;
}

.td-value {
  font-size: 14px;
  color: var(--text-primary);
  text-align: right;
  min-width: 0;
  overflow-wrap: break-word;
}

.td-value.is-danger {
  color: var(--red);
}

.td-value.is-warning {
  color: var(--orange);
}

.td-section-title {
  margin: 22px 16px 6px;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.td-section-title + .td-group {
  margin-top: 0;
}

.td-report-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.td-report-note {
  margin-top: 4px;
  font-size: 14px;
  color: var(--text-primary);
  overflow-wrap: break-word;
}

.td-report-photo {
  display: block;
  margin-top: 8px;
  max-width: 100%;
  max-height: 180px;
  border-radius: 8px;
}

.td-actions {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 20px 18px;
  box-shadow: none;
}

.td-actions .btn {
  min-height: 38px;
  padding: 0 18px;
  border-radius: 10px;
  font-size: 14px;
}

.td-actions .btn-primary {
  flex: 1;
}

.td-delete {
  margin-left: auto;
  border: none;
  background: none;
  padding: 8px 10px;
  border-radius: 8px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  color: var(--red);
  cursor: pointer;
  transition: background-color 0.12s ease;
}

@media (hover: hover) {
  .td-delete:hover {
    background-color: var(--red-soft);
  }
}

@media (max-width: 768px) {
  .modal-panel.task-detail {
    max-width: none;
  }
}

.modal-panel.task-edit {
  max-width: 480px;
  max-height: calc(92vh / var(--z));
}

.te-form {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.te-title {
  display: block;
  width: 100%;
  border: none;
  padding: 0;
  background: transparent;
  box-shadow: none;
  border-radius: 0;
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.2;
  color: var(--text-primary);
  margin-top: 4px;
  font-family: var(--font-display);
  min-height: 32px;
  word-break: normal;
  overflow-wrap: break-word;
}

.te-desc {
  display: block;
  width: 100%;
  border: none;
  padding: 0;
  margin-top: 8px;
  background: transparent;
  box-shadow: none;
  border-radius: 0;
  font-size: 15px;
  line-height: 1.5;
  color: var(--text-secondary);
  font-family: var(--font-sans);
  min-height: 24px;
}

/* Rows highlight on hover: the group clips them to its rounded corners (its lists and pickers are fixed, so unaffected) */
.td-group.te-group {
  overflow: hidden;
}

.te-group > .td-row:first-child {
  border-radius: 12px 12px 0 0;
}

.te-group > .td-row:last-child {
  border-radius: 0 0 12px 12px;
}

.te-group > .td-row:only-child {
  border-radius: 12px;
}

.td-row.is-stacked {
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
}

.te-control {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  min-width: 0;
}

.te-group .apple-dropdown-btn,
.te-group .apple-datepicker-trigger {
  background: none;
  min-height: 0;
  height: auto;
  padding: 0;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 400;
  color: var(--text-primary);
  width: auto;
}

.te-group .apple-datepicker {
  width: auto;
}

.te-group .datepicker-label.is-placeholder {
  color: var(--text-muted);
}

.te-group .datepicker-icon {
  display: none;
}

.te-group .apple-dropdown-menu {
  left: auto;
  right: 0;
  width: auto;
  min-width: 220px;
}

/* Lists and pickers in a sheet are drawn fixed (placed by script when opened). A fixed box adds nothing to the
   sheet's scroll height, so a closed list no longer makes an empty scrollable strip at the bottom */
.modal-panel .apple-dropdown-menu,
.modal-panel .apple-datepicker-popover {
  position: fixed;
}

.te-number,
.te-unit {
  border: none;
  background: var(--bg-control);
  color: var(--text-primary);
  border-radius: 8px;
  height: 30px;
  padding: 0 10px;
  font-family: inherit;
  font-size: 14px;
}

.te-number {
  text-align: right;
  width: 76px;
}

.te-unit {
  width: 88px;
  text-align: left;
}

.te-number::placeholder,
.te-unit::placeholder {
  color: var(--text-placeholder);
}

.te-pair {
  gap: 8px;
}

.te-option {
  cursor: pointer;
}

.te-opt-text {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.te-opt-title {
  font-size: 15px;
  color: var(--text-primary);
}

.te-option input[type="radio"] {
  appearance: none;
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  margin: 0;
  flex-shrink: 0;
  border: none;
  background: transparent;
  cursor: pointer;
}

.te-option input[type="radio"]:checked {
  background-color: var(--blue);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 14 14' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M2.5 7.4 5.6 10.5 11.6 3.5'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 14 14' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M2.5 7.4 5.6 10.5 11.6 3.5'/%3E%3C/svg%3E") center / contain no-repeat;
}

@media (hover: hover) {
  .te-option:hover {
    background-color: var(--bg-selected);
  }
}

.task-edit .td-actions .btn-secondary {
  flex: 0 0 auto;
}

.te-title,
.te-desc {
  resize: none;
  overflow: hidden;
}

.te-group .datepicker-chevron {
  display: none;
}

.te-text {
  border: none;
  background: transparent;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 14px;
  text-align: right;
  width: 100%;
  padding: 0;
}

.te-text::placeholder {
  color: var(--text-placeholder);
}

.td-row > .te-control {
  flex: 1;
}

/* Settings sheet */
.scale-pills {
  display: flex;
  gap: 4px;
}

.scale-pill {
  flex: 1;
  height: 34px;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
}

@media (hover: hover) {
}

.settings-links {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.settings-link-row {
  gap: 10px;
}

.settings-link-input {
  flex: 1;
  min-width: 0;
  text-align: left;
  font-size: 14px;
  text-overflow: ellipsis;
}

/* the only link row while it is empty: there is nothing to remove yet, so no cross (it looked as if something was typed) */
.settings-link-item:has(input.settings-link-input:placeholder-shown) .settings-link-remove { visibility: hidden; } /* an empty row has nothing to remove: it is left out when saved */
.settings-links > .settings-link-item + .settings-link-item { margin-top: 0; } /* the gap of the list alone */

.settings-link-remove {
  flex: none;
  width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 50%;
  background: none; /* the cross alone, no circle */
  color: var(--text-muted);
  cursor: pointer;
}

.settings-add-link {
  display: block;
  margin: 10px 16px 0;
  padding: 0;
  border: none;
  background: none;
  color: var(--blue);
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
}

.settings-hint {
  margin: 8px 16px 0;
  font-size: 12px;
  line-height: 1.4;
  color: var(--text-muted);
}

.settings-error {
  margin: 10px 16px 0;
  font-size: 13px;
  line-height: 1.4;
  color: var(--red);
  overflow-wrap: anywhere;
}

.settings-error:empty {
  display: none;
}

.settings-account {
  color: var(--text-primary);
}

.settings-logout {
  margin-left: auto;
  padding: 4px 0;
  border: none;
  background: none;
  color: var(--red);
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
}

/* On a phone the account row leaves the bottom bar (Settings holds it), and the gear of Settings stands after the section's title */
.header-settings {
  display: none;
}

@media (max-width: 768px) {
  .auth-logout {
    display: none !important; /* its own inline style sets display: flex */
  }

  /* out of the line, so that it does not make the title (and everything under it) taller than in the other sections */
  .view-title:has(.header-settings) {
    position: relative;
  }

  .header-settings {
    position: absolute;
    top: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    margin: -16px 0 0 6px;
    padding: 0;
    border: none;
    background: none;
    color: var(--text-secondary);
    cursor: pointer;
  }
}

.te-number.te-big {
  font-size: 20px;
  font-weight: 600;
  height: 40px;
  width: 110px;
  border-radius: 10px;
}

.te-unit-text {
  font-size: 15px;
  color: var(--text-secondary);
}

label.td-row {
  cursor: text;
}

.te-confirm {
  justify-content: flex-start;
  gap: 12px;
}

.te-check {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background-color: var(--blue);
  color: var(--on-accent);
  flex-shrink: 0;
}

.te-note {
  width: 100%;
  border: none;
  padding: 0;
  background: transparent;
  box-shadow: none;
  border-radius: 0;
  font-family: inherit;
  font-size: 15px;
  line-height: 1.45;
  color: var(--text-primary);
  resize: none;
}

.task-edit .photo-dropzone {
  margin-top: 18px;
  padding: 26px 16px;
  border: none;
  border-radius: 12px;
  background-color: var(--bg-field);
  color: var(--text-secondary);
  text-align: center;
  cursor: pointer;
  box-shadow: none;
}

@media (hover: hover) {
  .task-edit .photo-dropzone:hover {
    background-color: var(--bg-control);
  }
}

.task-edit .photo-dropzone.drag-active {
  background-color: var(--blue-soft);
  box-shadow: inset 0 0 0 1.5px var(--focus);
}

.task-edit .dropzone-placeholder p {
  margin: 6px 0 0;
  font-size: 15px;
  font-weight: 500;
  color: var(--blue);
}

.task-edit .dropzone-placeholder .field-hint {
  display: block;
  margin-top: 2px;
  font-size: 12.5px;
  color: var(--text-muted);
}

.task-edit .dropzone-placeholder svg {
  color: var(--blue);
}

.task-edit .photo-preview-container img {
  max-height: 240px;
  border-radius: 10px;
}

.task-edit .btn-remove-photo {
  margin-top: 8px;
  color: var(--blue);
  font-size: 14px;
}

/* eighteen colours: two full rows of nine, whatever the width */
.task-edit .column-palette-picker {
  display: grid;
  grid-template-columns: repeat(9, 26px);
  justify-content: space-between;
  gap: 16px 4px;
  padding: 8px 5px 8px; /* room for the selection ring, which sticks out 5px */
}

.task-edit .col-modal-palette-dot {
  width: 26px;
  height: 26px;
}

.task-edit .td-title + .td-group,
.task-edit .td-title + .photo-dropzone {
  margin-top: 16px;
}

.te-group .apple-dropdown.is-open .apple-dropdown-btn,
.te-group .apple-datepicker.is-open .apple-datepicker-trigger {
  background: none;
  box-shadow: none;
  color: var(--text-primary);
}

@media (hover: hover) {
  .te-group .apple-dropdown-btn:hover,
.te-group .apple-datepicker-trigger:hover {
    background: none;
    box-shadow: none;
    color: var(--text-primary);
  }
}

.te-group .apple-dropdown.is-open .dropdown-chevron,
.te-group .apple-datepicker.is-open .datepicker-chevron {
  color: var(--text-muted);
}

.te-group .datepicker-clear {
  width: 10px;
  height: 10px;
  margin: 0;
  background: none;
  border-radius: 0;
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

@media (hover: hover) {
  .te-group .datepicker-clear:hover {
    background: none;
    color: var(--text-primary);
  }
}

.te-group .datepicker-trigger-right {
  gap: 0;
}

.te-group .apple-dropdown-btn {
  gap: 8px;
}

.te-group .apple-dropdown-btn > .dropdown-chevron {
  margin-left: 0;
}

.te-group .apple-datepicker-trigger {
  gap: 8px;
}

@media (max-width: 768px) {
  .modal-backdrop {
    align-items: flex-end;
    padding: 0;
  }

  .modal-panel {
    max-width: none;
    width: 100%;
    max-height: calc(92dvh / var(--z));
    border-radius: 20px 20px 0 0;
    padding-bottom: var(--safe-bottom);
    overscroll-behavior: contain; /* swiping the sheet down must not pull the page to refresh */
  }

  /* Grab handle: the sheet can be swiped down to close */
  .td-topbar {
    position: relative;
  }

  .td-topbar::before {
    content: '';
    position: absolute;
    top: 6px;
    left: 50%;
    width: 36px;
    height: 5px;
    margin-left: -18px;
    border-radius: 3px;
    background-color: var(--text-muted);
  }

  .td-title {
    font-size: 24px;
  }

  .modal-panel.task-edit {
    max-width: none;
    max-height: calc(94dvh / var(--z));
  }

  .te-title {
    font-size: 24px;
  }
}

/* ==========================================================================
   Global behaviour: selection, touch, press and motion policy
   ========================================================================== */

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  animation: none;
}

/* Text selection is off everywhere except in fields where the user types */
html,
body,
body * {
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
}

input,
textarea,
input *,
textarea * {
  -webkit-user-select: text;
  user-select: text;
}

img {
  -webkit-user-drag: none;
}

/* Honour the system "reduce motion" setting */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms;
    transition-duration: 0.01ms !important;
  }
}

/* ==========================================================================
   Utilities
   ========================================================================== */

/* Utility: must win over any display set by components or inline styles */
.hidden {
  display: none !important;
}

.w-full {
  width: 100%;
}

.mt-1 {
  margin-top: 4px;
}

.text-muted {
  color: var(--text-muted);
}

.text-sm {
  font-size: 12px;
}

.p-3 {
  padding: 12px;
}



/* Phone: the bottom bar steps aside while the keyboard is open */
@media (max-width: 768px) and (hover: none) {
  body.is-typing .app-sidebar { display: none; }
}

/* Phone sheet: the drag from its top bar is ours alone (the browser must not start scrolling), and nothing inside chains the pull to the page */
@media (max-width: 768px) {
  .modal-panel .td-topbar {
    touch-action: none;
  }

  .modal-panel .td-body {
    overscroll-behavior-y: contain;
  }
}

/* Settings: colours */
.color-row {
  gap: 10px;
}

.color-label {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.color-name {
  font-size: 15px;
  color: var(--text-primary);
}

.color-reset {
  display: none;
  flex: none;
  width: 24px;
  height: 24px;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 50%;
  background-color: var(--bg-control);
  color: var(--text-secondary);
  cursor: pointer;
}

.color-row.is-changed .color-reset {
  display: inline-flex;
}

.color-swatch {
  position: relative;
  flex: none;
  width: 32px;
  height: 32px;
  border-radius: 9px;
  overflow: hidden;
  box-shadow: 0 0 0 1px var(--line);
  cursor: pointer;
}

.color-swatch input {
  position: absolute;
  inset: -6px;
  width: calc(100% + 12px);
  height: calc(100% + 12px);
  padding: 0;
  border: none;
  background: none;
  cursor: pointer;
}

/* On a light scheme the native date icon is dark already: no inversion */
:root[data-scheme="light"] input[type="datetime-local"]::-webkit-calendar-picker-indicator,
:root[data-scheme="light"] input[type="date"]::-webkit-calendar-picker-indicator {
  filter: none;
}

.number-field {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex: none;
  color: var(--text-secondary);
}

.number-field input {
  width: 56px;
  padding: 6px 8px;
  border: none;
  border-radius: 8px;
  background-color: var(--bg-control);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 14px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* Hashtags: plain text in the tag's own colour, no fill and no outline */
.tag-list {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 4px 10px;
  vertical-align: middle;
}

.task-tags,
.event-tags {
  display: flex;
  margin-top: 3px; /* the rows of a card are 3px apart everywhere */
}

.tag-chip {
  --tag: var(--blue);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 0;
  border: none;
  background: none;
  color: var(--tag);
  font-family: inherit;
  font-size: 11.5px;
  font-weight: 500;
  line-height: 1.5;
  white-space: nowrap;
}

.cal-agenda-title .tag-list {
  margin-left: 8px;
}

.sched-tags {
  margin-top: 3px;
}

.tag-chip.is-removable,
.tag-chip.is-suggest {
  cursor: pointer;
}

/* #база, the system tag: always the first suggestion of a task, drawn a little stronger */
.tag-chip.is-suggest.is-system {
  font-weight: 600;
}

.tag-x {
  font-size: 13px;
  line-height: 1;
  opacity: 0.7;
}

.tag-row {
  align-items: stretch;
  gap: 8px;
}

.tag-field {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 12px;
}

.tag-chips {
  display: contents;
}

.tag-input {
  flex: 1 1 90px;
  min-width: 90px;
  border: none;
  background: none;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 14px;
  outline: none;
}

.tag-input::placeholder {
  color: var(--text-placeholder);
}

.tag-suggest {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
}

.tag-suggest:empty {
  display: none;
}

.tag-dot {
  --tag: var(--blue);
  width: 8px;
  height: 8px;
  flex: none;
  border-radius: 50%;
  background-color: var(--tag);
  margin-right: 6px;
}

.tag-filter .dropdown-selected-label {
  display: inline-flex;
  align-items: center;
}

.tag-filter .item-left {
  display: inline-flex;
  align-items: center;
}

/* The tag filter matches the other buttons of the bar */
.tag-filter {
  display: flex;
  flex: none;
  height: var(--capture-h);
}

.tag-filter .apple-dropdown-btn {
  height: 100%;
  padding: 0 16px;
  font-size: 13px;
  background-color: var(--bg-surface);
  border-radius: var(--capture-r);
}

.journal-tags {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 0 0 12px;
}

.jcard-tags:not(:empty) {
  margin-top: 5px;
}

/* In the task window the hashtags are flush with the right edge like the other values, also when they wrap onto a second line */
.td-value:has(.tag-list) {
  flex: 1;
  display: flex;
  justify-content: flex-end;
}

.td-value .tag-list {
  justify-content: flex-end;
}

/* In the journal the known tags are offered only while a tag is being typed */
.journal-tags .tag-suggest {
  display: none;
}

.journal-tags:focus-within .tag-suggest:not(:empty) {
  display: flex;
}

/* Years in the calendar's title: full on a computer, two digits on a phone */
.y-short {
  display: none;
}

@media (max-width: 768px) {
  .y-full {
    display: none;
  }

  .y-short {
    display: inline;
  }
}

.journal-sheet-backdrop {
  display: none;
}

/* A phone sheet owns every touch outside of its own scrolling: the page behind must not move */
@media (max-width: 768px) {
  .modal-backdrop,
  .journal-sheet-backdrop {
    touch-action: none;
  }
}

/* Phone: the Settings sheet leaves the top fifth of the screen free, so it is clear that it is a sheet laid over the app */
@media (max-width: 768px) {
  .modal-panel.settings-sheet {
    max-height: calc(80dvh / var(--z));
  }
}

/* the column's header opens it for editing */
.kanban-col-header {
  cursor: pointer;
}

.cal-mini-blank {
  aspect-ratio: 1;
  margin: 2px;
}

/* Sort drop-down next to the importance filter; and the tick "Сделанное" (shown with the Today filter) */
.filter-sort-wrap .apple-dropdown-btn {
  min-width: 0;
}

/* "На сегодня +": the filter that also shows what is done today */
.label-plus {
  margin-left: 5px;
}

.label-check {
  display: inline-block;
  vertical-align: -2px;
  margin-left: 3.5px;
  width: 13px;
  height: 13px;
  background-color: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 14 14' fill='none' stroke='black' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M2.5 7.4 5.6 10.5 11.6 3.5'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 14 14' fill='none' stroke='black' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M2.5 7.4 5.6 10.5 11.6 3.5'/%3E%3C/svg%3E") center / contain no-repeat;
}

.check-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: var(--capture-h);
  padding: 0 14px;
  border-radius: var(--capture-r);
  background-color: var(--bg-surface);
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  user-select: none;
}

.check-toggle input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.check-box {
  position: relative;
  flex: none;
  width: 18px;
  height: 18px;
  border-radius: 6px;
  background-color: var(--bg-control);
}

.check-toggle input:checked + .check-box {
  background-color: var(--blue);
}

.check-toggle input:checked + .check-box::after {
  content: '';
  position: absolute;
  left: 6px;
  top: 3px;
  width: 4px;
  height: 8px;
  border: solid var(--on-accent);
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

/* The buttons of every pop-up window (the sheets of a task, an event, a report, a column, the settings, the focus
   set-up; the small dialogs; the date picker) follow one order whatever their order in the markup.
   Computer, as in desktop dialogs: the critical one (Удалить) on the left, then the neutral ones, the main (blue) one on
   the right. Phone, the other way round: the main one first on the left, the neutral ones after it, the critical one
   last on the right. */
.td-actions .td-delete, .ui-dialog-actions .ui-dialog-danger { order: 1; }
.td-actions .btn-secondary, .ui-dialog-actions .btn-secondary { order: 2; }
.td-actions .btn-primary, .ui-dialog-actions .btn-primary { order: 3; }
.td-actions .td-delete { margin-left: 0; margin-right: auto; }
.ui-dialog-actions.focus-ask .btn { order: 0; } /* a column of answers: the main one stays on top */
@media (max-width: 768px) {
  .td-actions .btn-primary, .ui-dialog-actions .btn-primary { order: 1; }
  .td-actions .btn-secondary, .ui-dialog-actions .btn-secondary { order: 2; }
  .td-actions .td-delete, .ui-dialog-actions .ui-dialog-danger { order: 3; }
  .td-actions .td-delete { margin-left: auto; margin-right: 0; }
  .ui-dialog-actions.focus-ask .btn { order: 0; }
  /* the date picker: Готово on the left, then Сейчас / Сегодня, Сбросить on the right */
  .dp-footer, .dp-footer-left { flex-direction: row-reverse; }
}

/* Phone: the sort drop-down sits in the header next to "Активные" (same plain-text style); the filter-row copy is hidden */
.view-sort { display: none; }
@media (max-width: 768px) and (hover: none) {
  .app-main[data-view="tasks"] .view-filter { display: flex; align-items: center; gap: 10px; }
  .app-main[data-view="tasks"] .view-sort { display: block; }
  .filter-sort-wrap { display: none; }
}
/* Status pill: in the task window every colour gets its own tint (the list badges stay without a fill) */
.td-status.badge-color-cyan,
.td-status[data-color="cyan"] {
  background-color: color-mix(in srgb, var(--cyan) 16%, transparent);
}
.td-status.badge-color-green,
.td-status[data-color="green"] {
  background-color: color-mix(in srgb, var(--green) 16%, transparent);
}
.td-status.badge-color-gray,
.td-status[data-color="gray"] {
  background-color: color-mix(in srgb, var(--gray) 16%, transparent);
}
.td-status.badge-color-purple,
.td-status[data-color="purple"] {
  background-color: color-mix(in srgb, var(--purple) 16%, transparent);
}
.td-status.badge-color-pink,
.td-status[data-color="pink"] {
  background-color: color-mix(in srgb, var(--pink) 16%, transparent);
}
.td-status.badge-color-yellow,
.td-status[data-color="yellow"] {
  background-color: color-mix(in srgb, var(--yellow) 16%, transparent);
}
.td-status.badge-color-indigo,
.td-status[data-color="indigo"] {
  background-color: color-mix(in srgb, var(--indigo) 16%, transparent);
}


/* Sort direction arrow (up: ascending, down: descending) */
.sort-arrow {
  display: inline-flex;
  align-items: center;
  margin-left: 9px;
  color: var(--text-muted);
  vertical-align: -1px;
}
/* next to the text the same way as the count ("Активные 13"): the gap comes from the flex container */
.apple-dropdown-item .sort-arrow,
.view-filter .sort-arrow { margin-left: 0; }
/* in the list the arrow shows what a click on the item does: switches to the opposite direction */
@media (hover: hover) {
  .apple-dropdown-item:hover .sort-arrow { color: inherit; opacity: 0.8; }
}

/* Repeat icon next to "Повторяющиеся" in the kanban kind filter */
.kind-icon {
  margin-left: 6px;
  vertical-align: -1px;
  flex: none;
}

/* Phone, Kanban: the kind filter (all / one-off / repeating) sits in the header in place of the task counter,
   as plain text with an arrow like "Активные"; the block in the filter bar is hidden */
@media (max-width: 768px) {
  .app-main[data-view="kanban"] .view-stats-badge,
  .app-main[data-view="kanban"] .kind-wrap {
    display: none;
  }
  .app-main[data-view="kanban"] .view-filter {
    display: block;
  }
}

/* The kanban kind filter shows the count next to the name, the way "Активные 13" does */
.kind-dd .dropdown-selected-label {
  display: inline-flex;
  align-items: center;
  gap: 9px;
}

/* Computer: in the kanban bar «Хэштеги» comes before «Новая колонка»; in the calendar bar «Сегодня» comes before
   «Хэштеги» and is a plain grey button like «Новая колонка» (highlighted as a whole under the pointer, no inset) */
@media (min-width: 769px) {
  .kanban-bar > .tag-filter { order: 1; }
  .kanban-bar > .calendar-modes { order: 2; }

  .calendar-bar > #cal-today { order: 1; }
  .app-main[data-view="calendar"] .calendar-bar > .tag-filter { order: 2; }

  .calendar-bar > #cal-today {
    height: var(--capture-h);
    padding: 0 14px;
    border-radius: var(--capture-r);
    background-color: var(--bg-surface);
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    box-shadow: none;
  }
}

@media (min-width: 769px) and (hover: hover) {
  .calendar-bar > #cal-today:hover {
    background-color: var(--bg-hover);
    color: var(--text-primary);
  }
}

/* «Расписание»: «Сегодня» (and the refresh button) are whole buttons, not segments in a box: no inset, the
   highlight under the pointer fills the button, the same as «Новая колонка» in the kanban */
.calendar-modes.sched-actions {
  padding: 0;
  gap: 10px;
  background: none;
}

.sched-actions .cal-mode-btn {
  height: var(--capture-h);
  border-radius: var(--capture-r);
  background-color: var(--bg-surface);
}

@media (hover: hover) {
  .sched-actions .cal-mode-btn:hover {
    background-color: var(--bg-hover);
    color: var(--text-primary);
  }
}

@media (max-width: 768px) {
  .calendar-modes.sched-actions { gap: 10px; } /* the bar's own gap on a phone */
}

/* the refresh button is a square as high as the bar, never stretched */
.sched-actions #sched-refresh {
  flex: 0 0 var(--capture-h);
  width: var(--capture-h);
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* «Сегодня» (calendar and schedule) and the refresh button: normal text colour, not the dimmed one
   (on a phone «Сегодня» in the calendar is the blue button and keeps its own text colour) */
.sched-actions .cal-mode-btn {
  color: var(--text-primary);
}

@media (min-width: 769px) {
  .calendar-bar > #cal-today {
    color: var(--text-primary);
  }
}
/* «Новая колонка» in the kanban bar: normal text colour too */
.kanban-bar .cal-mode-btn {
  color: var(--text-primary);
}

/* Phone too: «Сегодня» in the calendar is the same plain grey button with normal text as on a computer */
@media (max-width: 768px) {
  .calendar-bar > #cal-today {
    height: var(--capture-h);
    padding: 0 14px;
    border-radius: var(--capture-r);
    background-color: var(--bg-surface);
    color: var(--text-primary);
    font-size: 13px;
    font-weight: 500;
    box-shadow: none;
  }
}

/* Tasks: the status filter (Активные / На сегодня / …) is a drop-down block in the filter bar on a computer, the
   same kind as «Хэштеги»; on a phone it stays in the header. The row of tabs is not used any more. */
.status-wrap { display: none; }
.status-dd .dropdown-selected-label {
  display: inline-flex;
  align-items: center;
  gap: 9px;
}

@media (min-width: 769px) {
  .app-main[data-view="tasks"] .filter-tabs {
    display: none;
  }

  .app-main[data-view="tasks"] .status-wrap {
    display: block;
  }

  /* the status block takes the free width, like the first block on the other pages */
  .app-main[data-view="tasks"] .filter-bar > .status-wrap {
    flex: 1 1 auto;
  }

  .app-main[data-view="tasks"] .status-wrap .apple-dropdown,
  .app-main[data-view="tasks"] .status-wrap .apple-dropdown-btn {
    width: 100%;
  }
}
/* A list opened from a narrow block (e.g. «Порядок») is at least as wide as the block, but never narrower than its
   longest item: items stay on one line */
.filter-priority-wrap .apple-dropdown-menu {
  right: auto;
  width: max-content;
  min-width: 100%;
}

.filter-priority-wrap .apple-dropdown-item {
  white-space: nowrap;
}

/* Computer: the status block shows no count after «На сегодня + ✓» (the phone header keeps it) */
.status-wrap .count-after-check { display: none; }

/* Small confirm/alert dialog in the app's style (uiConfirm / uiAlert in bundle.js), above any sheet */
.ui-dialog {
  position: fixed;
  inset: 0;
  z-index: 6000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background-color: color-mix(in srgb, var(--shadow) var(--scrim-strength), transparent);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  opacity: 0;
  transition: opacity 0.16s ease;
}
.ui-dialog.is-open { opacity: 1; }
.ui-dialog-card {
  width: 100%;
  max-width: 340px;
  padding: 20px;
  border-radius: 20px;
  background-color: var(--bg-sheet);
  box-shadow: var(--shadow-large);
  transform: scale(0.96);
  transition: transform 0.16s ease;
}
.ui-dialog.is-open .ui-dialog-card { transform: none; }
.ui-dialog-title {
  font-size: 16px;
  font-weight: 600;
  line-height: 1.35;
  color: var(--text-primary);
  overflow-wrap: anywhere;
}
.ui-dialog-text {
  margin-top: 6px;
  font-size: 14px;
  line-height: 1.4;
  color: var(--text-secondary);
  overflow-wrap: anywhere;
}
.ui-dialog-actions {
  display: flex;
  gap: 8px;
  margin-top: 18px;
}
.ui-dialog-actions .btn {
  flex: 1;
  min-height: 40px;
  border-radius: 10px;
  font-size: 14px;
}
.ui-dialog-danger {
  background-color: var(--red-soft);
  color: var(--red);
}
@media (hover: hover) {
  .ui-dialog-danger:hover { background-color: color-mix(in srgb, var(--red) 28%, transparent); }
}
/* Focus: the set-up window */
.fs-quick { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
.fs-chip {
  min-width: 40px; height: 30px; padding: 0 10px; border-radius: 999px; border: 1px solid var(--border, rgba(255, 255, 255, 0.12));
  background: transparent; color: var(--text-secondary); font: inherit; font-size: 13px; font-weight: 500; cursor: pointer;
}
.fs-chip.is-on { background: var(--fs-c); border-color: transparent; color: var(--fs-on); }
.focus-setup .te-text[type="number"] { text-align: right; -moz-appearance: textfield; }
.focus-setup .te-text[type="number"]::-webkit-outer-spin-button, .focus-setup .te-text[type="number"]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.ui-dialog .btn:focus { outline: none; }
.ui-dialog .btn:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
/* Form check note (themedValidation in bundle.js) instead of the browser's bubble */
.ui-invalid-tip {
  position: fixed;
  z-index: 6500;
  max-width: 260px;
  padding: 8px 12px;
  border-radius: 10px;
  background-color: var(--bg-popover);
  box-shadow: var(--shadow-large);
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 500;
  line-height: 1.35;
  pointer-events: none;
  animation: ui-tip-in 0.14s ease;
}
@keyframes ui-tip-in { from { opacity: 0; transform: translateY(-3px); } }
.is-invalid,
.is-invalid:focus,
.is-invalid:focus-visible {
  outline: none !important;
  caret-color: var(--red);
}
.is-invalid::placeholder { color: color-mix(in srgb, var(--red) 70%, transparent) !important; }
.is-invalid:not(:placeholder-shown) { color: var(--red) !important; }
/* «Хэштеги» in the task and event windows: the field sits on the label's line, right-aligned like «Место»;
   the known tags to tap stay on the line below */
.tag-line {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 22px;
}
.tag-line .td-label { flex: none; }
.tag-line .tag-field {
  flex: 1;
  min-width: 0;
  justify-content: flex-end;
}
.tag-line .tag-input {
  flex: 0 1 80px;
  min-width: 64px;
  text-align: right;
}/* the block under the «Хэштеги» line: chosen tags (with ×) first, then the known ones to tap, in one flowing row */
.tag-pick {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
}
.tag-pick .tag-suggest { display: contents; }
.tag-pick:has(.tag-chips:empty):has(.tag-suggest:empty) { display: none; }
.tag-line .tag-input { flex: 1 1 auto; }

/* Filters with several chosen values: «Критическая +1»; holding an option on a phone must not select its text */
/* «+2» after the dot of the first choice: always shown in full, the word before it is shortened instead */
.multi-more {
  flex: none;
  margin-left: 6px;
  color: var(--text-secondary);
  font-weight: 500;
  white-space: nowrap;
}
.apple-dropdown-btn > .dropdown-dot:has(+ .multi-more) { margin-right: 0; }
.apple-dropdown-btn > .multi-more { margin-right: auto; }
.apple-dropdown-btn:has(> .multi-more) { min-width: 0; }
.apple-dropdown-btn:has(> .multi-more) > .dropdown-selected-label {
  flex: 0 1 auto;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.apple-dropdown-btn > .dropdown-dot,
.apple-dropdown-btn > .dropdown-chevron { flex-shrink: 0; }
/* hashtags: the label is a dot and the name; only the name is shortened */
.tag-filter .dropdown-selected-label { min-width: 0; }
.tag-filter .label-text {
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tag-filter .dropdown-selected-label .tag-dot { flex-shrink: 0; }
.apple-dropdown[data-multi] .apple-dropdown-item {
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

/* Height to keep clear at the bottom of the screen: the safe-area inset in a browser; in the Android app the page sets it
   to the height of the transparent system navigation bar drawn over the page (cpSetBottomInset in index.html) */
:root { --safe-bottom: env(safe-area-inset-bottom, 0px); }
/* Phone sheets keep their buttons above the system navigation bar. «.modal-panel.task-detail { padding: 0 }» used to
   win over the sheet's bottom padding, so the task, event and report sheets reached under the bar */
@media (max-width: 768px) {
  .modal-panel,
  .modal-panel.task-detail {
    padding-bottom: var(--safe-bottom);
  }
}

/* Windows app: the window's top strip (32px, the window buttons) is part of the top spacing. It is already more than
   the page's own top padding (22px sidebar, 30px content), so the page starts right under it */
@media (min-width: 769px) {
  html.is-desktop-app .app-sidebar { padding-top: 0; }
  html.is-desktop-app .app-main { padding-top: 0; }
}

.ui-dialog-actions.focus-ask .btn { order: 0; } /* a column of answers: the main one stays on top */
@media (max-width: 768px) {
  .td-actions .btn-primary, .ui-dialog-actions .btn-primary { order: 1; }
  .td-actions .btn-secondary, .ui-dialog-actions .btn-secondary { order: 2; }
  .td-actions .td-delete, .ui-dialog-actions .ui-dialog-danger { order: 3; }
  .td-actions .td-delete { margin-left: auto; margin-right: 0; }
  .ui-dialog-actions.focus-ask .btn { order: 0; }
  /* the date picker: Готово on the left, then Сейчас / Сегодня, Сбросить on the right */
  .dp-footer, .dp-footer-left { flex-direction: row-reverse; }
}

/* Phone: the sort drop-down sits in the header next to "Активные" (same plain-text style); the filter-row copy is hidden */
.view-sort { display: none; }
@media (max-width: 768px) and (hover: none) {
  .app-main[data-view="tasks"] .view-filter { display: flex; align-items: center; gap: 10px; }
  .app-main[data-view="tasks"] .view-sort { display: block; }
  .filter-sort-wrap { display: none; }
}
/* Status pill: in the task window every colour gets its own tint (the list badges stay without a fill) */
.td-status.badge-color-cyan,
.td-status[data-color="cyan"] {
  background-color: color-mix(in srgb, var(--cyan) 16%, transparent);
}
.td-status.badge-color-green,
.td-status[data-color="green"] {
  background-color: color-mix(in srgb, var(--green) 16%, transparent);
}
.td-status.badge-color-gray,
.td-status[data-color="gray"] {
  background-color: color-mix(in srgb, var(--gray) 16%, transparent);
}
.td-status.badge-color-purple,
.td-status[data-color="purple"] {
  background-color: color-mix(in srgb, var(--purple) 16%, transparent);
}
.td-status.badge-color-pink,
.td-status[data-color="pink"] {
  background-color: color-mix(in srgb, var(--pink) 16%, transparent);
}
.td-status.badge-color-yellow,
.td-status[data-color="yellow"] {
  background-color: color-mix(in srgb, var(--yellow) 16%, transparent);
}
.td-status.badge-color-indigo,
.td-status[data-color="indigo"] {
  background-color: color-mix(in srgb, var(--indigo) 16%, transparent);
}


/* Sort direction arrow (up: ascending, down: descending) */
.sort-arrow {
  display: inline-flex;
  align-items: center;
  margin-left: 9px;
  color: var(--text-muted);
  vertical-align: -1px;
}
/* next to the text the same way as the count ("Активные 13"): the gap comes from the flex container */
.apple-dropdown-item .sort-arrow,
.view-filter .sort-arrow { margin-left: 0; }
/* in the list the arrow shows what a click on the item does: switches to the opposite direction */
@media (hover: hover) {
  .apple-dropdown-item:hover .sort-arrow { color: inherit; opacity: 0.8; }
}

/* Repeat icon next to "Повторяющиеся" in the kanban kind filter */
.kind-icon {
  margin-left: 6px;
  vertical-align: -1px;
  flex: none;
}

/* Phone, Kanban: the kind filter (all / one-off / repeating) sits in the header in place of the task counter,
   as plain text with an arrow like "Активные"; the block in the filter bar is hidden */
@media (max-width: 768px) {
  .app-main[data-view="kanban"] .view-stats-badge,
  .app-main[data-view="kanban"] .kind-wrap {
    display: none;
  }
  .app-main[data-view="kanban"] .view-filter {
    display: block;
  }
}

/* The kanban kind filter shows the count next to the name, the way "Активные 13" does */
.kind-dd .dropdown-selected-label {
  display: inline-flex;
  align-items: center;
  gap: 9px;
}

/* Computer: in the kanban bar «Хэштеги» comes before «Новая колонка»; in the calendar bar «Сегодня» comes before
   «Хэштеги» and is a plain grey button like «Новая колонка» (highlighted as a whole under the pointer, no inset) */
@media (min-width: 769px) {
  .kanban-bar > .tag-filter { order: 1; }
  .kanban-bar > .calendar-modes { order: 2; }

  .calendar-bar > #cal-today { order: 1; }
  .app-main[data-view="calendar"] .calendar-bar > .tag-filter { order: 2; }

  .calendar-bar > #cal-today {
    height: var(--capture-h);
    padding: 0 14px;
    border-radius: var(--capture-r);
    background-color: var(--bg-surface);
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    box-shadow: none;
  }
}

@media (min-width: 769px) and (hover: hover) {
  .calendar-bar > #cal-today:hover {
    background-color: var(--bg-hover);
    color: var(--text-primary);
  }
}

/* «Расписание»: «Сегодня» (and the refresh button) are whole buttons, not segments in a box: no inset, the
   highlight under the pointer fills the button, the same as «Новая колонка» in the kanban */
.calendar-modes.sched-actions {
  padding: 0;
  gap: 10px;
  background: none;
}

.sched-actions .cal-mode-btn {
  height: var(--capture-h);
  border-radius: var(--capture-r);
  background-color: var(--bg-surface);
}

@media (hover: hover) {
  .sched-actions .cal-mode-btn:hover {
    background-color: var(--bg-hover);
    color: var(--text-primary);
  }
}

@media (max-width: 768px) {
  .calendar-modes.sched-actions { gap: 10px; } /* the bar's own gap on a phone */
}

/* the refresh button is a square as high as the bar, never stretched */
.sched-actions #sched-refresh {
  flex: 0 0 var(--capture-h);
  width: var(--capture-h);
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* «Сегодня» (calendar and schedule) and the refresh button: normal text colour, not the dimmed one
   (on a phone «Сегодня» in the calendar is the blue button and keeps its own text colour) */
.sched-actions .cal-mode-btn {
  color: var(--text-primary);
}

@media (min-width: 769px) {
  .calendar-bar > #cal-today {
    color: var(--text-primary);
  }
}
/* «Новая колонка» in the kanban bar: normal text colour too */
.kanban-bar .cal-mode-btn {
  color: var(--text-primary);
}

/* Phone too: «Сегодня» in the calendar is the same plain grey button with normal text as on a computer */
@media (max-width: 768px) {
  .calendar-bar > #cal-today {
    height: var(--capture-h);
    padding: 0 14px;
    border-radius: var(--capture-r);
    background-color: var(--bg-surface);
    color: var(--text-primary);
    font-size: 13px;
    font-weight: 500;
    box-shadow: none;
  }
}

/* Tasks: the status filter (Активные / На сегодня / …) is a drop-down block in the filter bar on a computer, the
   same kind as «Хэштеги»; on a phone it stays in the header. The row of tabs is not used any more. */
.status-wrap { display: none; }
.status-dd .dropdown-selected-label {
  display: inline-flex;
  align-items: center;
  gap: 9px;
}

@media (min-width: 769px) {
  .app-main[data-view="tasks"] .filter-tabs {
    display: none;
  }

  .app-main[data-view="tasks"] .status-wrap {
    display: block;
  }

  /* the status block takes the free width, like the first block on the other pages */
  .app-main[data-view="tasks"] .filter-bar > .status-wrap {
    flex: 1 1 auto;
  }

  .app-main[data-view="tasks"] .status-wrap .apple-dropdown,
  .app-main[data-view="tasks"] .status-wrap .apple-dropdown-btn {
    width: 100%;
  }
}
/* A list opened from a narrow block (e.g. «Порядок») is at least as wide as the block, but never narrower than its
   longest item: items stay on one line */
.filter-priority-wrap .apple-dropdown-menu {
  right: auto;
  width: max-content;
  min-width: 100%;
}

.filter-priority-wrap .apple-dropdown-item {
  white-space: nowrap;
}

/* Computer: the status block shows no count after «На сегодня + ✓» (the phone header keeps it) */
.status-wrap .count-after-check { display: none; }

/* Small confirm/alert dialog in the app's style (uiConfirm / uiAlert in bundle.js), above any sheet */
.ui-dialog {
  position: fixed;
  inset: 0;
  z-index: 6000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background-color: color-mix(in srgb, var(--shadow) var(--scrim-strength), transparent);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  opacity: 0;
  transition: opacity 0.16s ease;
}
.ui-dialog.is-open { opacity: 1; }
.ui-dialog-card {
  width: 100%;
  max-width: 340px;
  padding: 20px;
  border-radius: 20px;
  background-color: var(--bg-sheet);
  box-shadow: var(--shadow-large);
  transform: scale(0.96);
  transition: transform 0.16s ease;
}
.ui-dialog.is-open .ui-dialog-card { transform: none; }
.ui-dialog-title {
  font-size: 16px;
  font-weight: 600;
  line-height: 1.35;
  color: var(--text-primary);
  overflow-wrap: anywhere;
}
.ui-dialog-text {
  margin-top: 6px;
  font-size: 14px;
  line-height: 1.4;
  color: var(--text-secondary);
  overflow-wrap: anywhere;
}
.ui-dialog-actions {
  display: flex;
  gap: 8px;
  margin-top: 18px;
}
.ui-dialog-actions .btn {
  flex: 1;
  min-height: 40px;
  border-radius: 10px;
  font-size: 14px;
}
.ui-dialog-danger {
  background-color: var(--red-soft);
  color: var(--red);
}
@media (hover: hover) {
  .ui-dialog-danger:hover { background-color: color-mix(in srgb, var(--red) 28%, transparent); }
}
/* Focus: the set-up window */
.fs-quick { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
.fs-chip {
  min-width: 40px; height: 30px; padding: 0 10px; border-radius: 999px; border: 1px solid var(--border, rgba(255, 255, 255, 0.12));
  background: transparent; color: var(--text-secondary); font: inherit; font-size: 13px; font-weight: 500; cursor: pointer;
}
.fs-chip.is-on { background: var(--fs-c); border-color: transparent; color: var(--fs-on); }
.focus-setup .te-text[type="number"] { text-align: right; -moz-appearance: textfield; }
.focus-setup .te-text[type="number"]::-webkit-outer-spin-button, .focus-setup .te-text[type="number"]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.ui-dialog .btn:focus { outline: none; }
.ui-dialog .btn:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
/* Form check note (themedValidation in bundle.js) instead of the browser's bubble */
.ui-invalid-tip {
  position: fixed;
  z-index: 6500;
  max-width: 260px;
  padding: 8px 12px;
  border-radius: 10px;
  background-color: var(--bg-popover);
  box-shadow: var(--shadow-large);
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 500;
  line-height: 1.35;
  pointer-events: none;
  animation: ui-tip-in 0.14s ease;
}
@keyframes ui-tip-in { from { opacity: 0; transform: translateY(-3px); } }
.is-invalid,
.is-invalid:focus,
.is-invalid:focus-visible {
  outline: none !important;
  caret-color: var(--red);
}
.is-invalid::placeholder { color: color-mix(in srgb, var(--red) 70%, transparent) !important; }
.is-invalid:not(:placeholder-shown) { color: var(--red) !important; }
/* «Хэштеги» in the task and event windows: the field sits on the label's line, right-aligned like «Место»;
   the known tags to tap stay on the line below */
.tag-line {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 22px;
}
.tag-line .td-label { flex: none; }
.tag-line .tag-field {
  flex: 1;
  min-width: 0;
  justify-content: flex-end;
}
.tag-line .tag-input {
  flex: 0 1 80px;
  min-width: 64px;
  text-align: right;
}/* the block under the «Хэштеги» line: chosen tags (with ×) first, then the known ones to tap, in one flowing row */
.tag-pick {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
}
.tag-pick .tag-suggest { display: contents; }
.tag-pick:has(.tag-chips:empty):has(.tag-suggest:empty) { display: none; }
.tag-line .tag-input { flex: 1 1 auto; }

/* Filters with several chosen values: «Критическая +1»; holding an option on a phone must not select its text */
/* «+2» after the dot of the first choice: always shown in full, the word before it is shortened instead */
.multi-more {
  flex: none;
  margin-left: 6px;
  color: var(--text-secondary);
  font-weight: 500;
  white-space: nowrap;
}
.apple-dropdown-btn > .dropdown-dot:has(+ .multi-more) { margin-right: 0; }
.apple-dropdown-btn > .multi-more { margin-right: auto; }
.apple-dropdown-btn:has(> .multi-more) { min-width: 0; }
.apple-dropdown-btn:has(> .multi-more) > .dropdown-selected-label {
  flex: 0 1 auto;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.apple-dropdown-btn > .dropdown-dot,
.apple-dropdown-btn > .dropdown-chevron { flex-shrink: 0; }
/* hashtags: the label is a dot and the name; only the name is shortened */
.tag-filter .dropdown-selected-label { min-width: 0; }
.tag-filter .label-text {
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tag-filter .dropdown-selected-label .tag-dot { flex-shrink: 0; }
.apple-dropdown[data-multi] .apple-dropdown-item {
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

/* Height to keep clear at the bottom of the screen: the safe-area inset in a browser; in the Android app the page sets it
   to the height of the transparent system navigation bar drawn over the page (cpSetBottomInset in index.html) */
:root { --safe-bottom: env(safe-area-inset-bottom, 0px); }
/* Phone sheets keep their buttons above the system navigation bar. «.modal-panel.task-detail { padding: 0 }» used to
   win over the sheet's bottom padding, so the task, event and report sheets reached under the bar */
@media (max-width: 768px) {
  .modal-panel,
  .modal-panel.task-detail {
    padding-bottom: var(--safe-bottom);
  }
}

/* Windows app: the window's top strip (32px, the window buttons) is part of the top spacing. It is already more than
   the page's own top padding (22px sidebar, 30px content), so the page starts right under it */
@media (min-width: 769px) {
  html.is-desktop-app .app-sidebar { padding-top: 0; }
  html.is-desktop-app .app-main { padding-top: 0; }
}

/* ---- Focus: a crystal grows on the theme's background while you work (FocusMode in bundle.js) ---- */
.sidebar-focus { margin-top: 8px; }
/* Focus covers the whole window: the page under it does not scroll and shows no scrollbar (nor a gap left for one) */
/* While the focus page is up the page behind it has no scrollbar. A class set by FocusMode.mount() instead of
   html:has(> body > .focus-screen): on a long page that selector took up to 130 ms to match, and the dark screen came late */
html.focus-on {
  overflow: hidden;
  scrollbar-gutter: auto;
}
/* from «Фокус» to the menu: the same 8px as between the two buttons (the sidebar's own gap is 16) */
.sidebar-action + .sidebar-nav { margin-top: -8px; }
.td-actions .td-focus { padding: 0; width: 38px; flex: none; }

.focus-screen {
  position: fixed;
  inset: 0;
  z-index: 1900;
  background: var(--bg-canvas);
  color: var(--text-primary);
  font-family: var(--font-sans);
  opacity: 0;
  transition: opacity 0.3s ease;
  -webkit-user-select: none;
  user-select: none;
  --focus-c: var(--blue);
  --focus-on: #fff;
}
.focus-screen.is-open { opacity: 1; }
/* the grid: plain rounded cells in the middle of the screen, sized and placed in whole device pixels by FocusMode.build() */
.focus-stage { position: absolute; }
.focus-grid { display: grid; }
.focus-cell { position: relative; overflow: hidden; border-radius: 28%; background: color-mix(in srgb, var(--text-primary) 8%, var(--bg-canvas)); }
.focus-cell svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.focus-cell rect { fill: var(--focus-c); }
.focus-ui {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: calc(30px + env(safe-area-inset-top, 0px)) 20px calc(26px + var(--safe-bottom, 0px));
  pointer-events: none;
}
.focus-ui > * { pointer-events: auto; }
.focus-head { text-align: center; max-width: 560px; min-height: 20px; }
.focus-kicker { font-size: 12px; font-weight: 600; letter-spacing: 0.16em; text-transform: uppercase; color: color-mix(in srgb, var(--text-primary) 42%, transparent); }
.focus-title {
  margin-top: 8px;
  font-size: 17px;
  font-weight: 500;
  line-height: 1.35;
  color: color-mix(in srgb, var(--text-primary) 86%, transparent);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.focus-foot { display: flex; flex-direction: column; align-items: center; gap: 14px; width: 100%; max-width: 400px; }
.focus-hint { font-size: 13px; line-height: 1.45; color: color-mix(in srgb, var(--text-primary) 50%, transparent); text-align: center; max-width: 300px; }
.focus-minutes { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 6px; }
.focus-chip {
  min-width: 46px;
  height: 34px;
  padding: 0 10px;
  border-radius: 17px;
  border: 1px solid color-mix(in srgb, var(--text-primary) 14%, transparent);
  background: color-mix(in srgb, var(--text-primary) 4%, transparent);
  color: color-mix(in srgb, var(--text-primary) 82%, transparent);
  font: 500 14px var(--font-sans);
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  transition: background-color 0.15s, color 0.15s, border-color 0.15s;
}
.focus-chip.is-on { background: var(--focus-c); border-color: transparent; color: var(--focus-on); }
.focus-unit { margin-left: 2px; font-size: 13px; color: color-mix(in srgb, var(--text-primary) 42%, transparent); }
.focus-colors { display: flex; justify-content: center; flex-wrap: wrap; gap: 10px; }
.focus-swatch {
  width: 22px;
  height: 22px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: var(--sw);
  cursor: pointer;
  box-shadow: 0 0 0 2px var(--bg-canvas), 0 0 0 3px transparent;
  transition: box-shadow 0.15s;
}
.focus-swatch.is-on { box-shadow: 0 0 0 2px var(--bg-canvas), 0 0 0 4px var(--sw); }
.focus-foot .btn { width: auto; min-width: 168px; max-width: 100%; min-height: 40px; padding: 0 28px; border-radius: 10px; font-size: 14px; }
.focus-foot .btn-secondary { background: color-mix(in srgb, var(--text-primary) 8%, transparent); color: var(--text-primary); }
.btn.focus-go { background: var(--focus-c); color: var(--focus-on); }
@media (hover: hover) { .btn.focus-go:hover { filter: brightness(1.1); } }
.focus-link {
  padding: 8px 14px;
  border: none;
  border-radius: 8px;
  background: none;
  color: color-mix(in srgb, var(--text-primary) 50%, transparent);
  font: 500 14px var(--font-sans);
  cursor: pointer;
  transition: background-color 0.12s ease, color 0.12s ease;
}
@media (hover: hover) { .focus-link:hover { color: color-mix(in srgb, var(--text-primary) 92%, transparent); background-color: color-mix(in srgb, var(--text-primary) 8%, transparent); } }
.focus-actions { display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: 6px; }
.focus-time {
  font: 200 58px/1 'Inter', var(--font-sans);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.01em;
  color: color-mix(in srgb, var(--text-primary) 92%, transparent);
}
.focus-done { font-size: 22px; font-weight: 600; }
.focus-sub { font-size: 14px; color: color-mix(in srgb, var(--text-primary) 55%, transparent); text-align: center; }
.focus-x {
  position: absolute;
  top: calc(16px + env(safe-area-inset-top, 0px));
  right: 16px;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 50%;
  background: none;
  -webkit-tap-highlight-color: transparent;
  color: color-mix(in srgb, var(--text-primary) 50%, transparent);
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
}
@media (hover: hover) { .focus-x:hover { color: color-mix(in srgb, var(--text-primary) 92%, transparent); } }

/* the shelf: every finished crystal */
.focus-shelf {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  padding: calc(26px + env(safe-area-inset-top, 0px)) 20px calc(16px + var(--safe-bottom, 0px));
  background: color-mix(in srgb, var(--bg-canvas) 90%, transparent);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}
.focus-shelf-head { position: relative; text-align: center; margin-bottom: 20px; }
.focus-shelf-title { font-size: 20px; font-weight: 600; }
.focus-shelf-sub { margin-top: 4px; font-size: 13px; color: color-mix(in srgb, var(--text-primary) 50%, transparent); }
.focus-shelf-head .focus-x { top: -8px; right: 0; }
.focus-shelf-grid {
  flex: 1;
  width: 100%;
  max-width: 920px;
  margin: 0 auto;
  overflow-y: auto;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(132px, 1fr));
  align-content: start;
  gap: 16px;
}
.focus-gem { text-align: center; min-width: 0; }
.focus-mini { display: grid; grid-template-columns: repeat(var(--n), 1fr); gap: 3%; box-sizing: border-box; width: 100%; aspect-ratio: 1; padding: 10%; border-radius: 14px; background: color-mix(in srgb, var(--text-primary) 3.5%, transparent); align-content: center; }
.focus-mini i { display: block; aspect-ratio: 1; border-radius: 28%; background: var(--c); }
.focus-gem-meta { margin-top: 6px; font-size: 12px; color: color-mix(in srgb, var(--text-primary) 55%, transparent); }
.focus-gem-title { font-size: 12px; color: color-mix(in srgb, var(--text-primary) 82%, transparent); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.focus-shelf-empty { margin: 48px auto; max-width: 280px; font-size: 14px; line-height: 1.5; color: color-mix(in srgb, var(--text-primary) 50%, transparent); text-align: center; }
@media (max-width: 768px) {
  .focus-shelf-grid { grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 12px; }
  .focus-time { font-size: 52px; }
}
.ui-dialog-actions.focus-ask { flex-direction: column; }

/* the buttons after the title (Focus in the Inbox, Settings in the Journal): their middle is at the height of the middle of the letters (the box is centred on the whole line, which puts it lower) */
@media (max-width: 768px) {
  .header-settings { margin-top: -13.5px; }
}


/* Download of the apps: only on the site (api.js / bundle.js never mount these in the Windows or the Android app).
   Computer: a small icon at the end of the brand line of the sidebar. Phone: in the Journal after the gear of Settings. */
.brand-download {
  margin-left: auto;
  width: 26px;
  height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  color: var(--text-secondary);
  text-decoration: none;
}
@media (hover: hover) { .brand-download:hover { color: var(--text-primary); background-color: var(--bg-selected); } }
@media (max-width: 768px) {
  .header-download { margin-left: 34px; text-decoration: none; }
  .header-download svg { width: 22px; height: 22px; } /* the same size to the eye as the gear (its drawing is smaller inside its box) */
}
body:has(.auth-screen) .brand-download, body:has(.auth-screen) .header-download { display: none !important; } /* never on the sign-in page */

/* Whole-pixel heights in the task list: with fractional line heights the cards sit on fractions of a pixel and the ticks of
   neighbouring tasks are drawn a little differently (one looks bolder than the other) */
.task-card .task-title { line-height: 20px; }
.task-card .task-description { line-height: 18px; }
.task-card .task-badges .badge { line-height: 18px; }
@media (max-width: 768px) {
  .task-card .task-title { line-height: 22px; }
}
.task-card .tag-chip { line-height: 17px; }
.base-head { line-height: 20px; }

/* Settings: a button as a row of a group (reset colours, add a link), and the two-way choice on the line of its label */
.settings-row-btn {
  width: 100%;
  border: none;
  background: none;
  text-align: left;
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  color: var(--blue);
  cursor: pointer;
}
@media (hover: hover) { .settings-row-btn:hover { background-color: var(--bg-selected); } }
.settings-add-group { margin-top: 10px; }
.scale-pills.is-inline { flex: none; width: 170px; padding: 2px; border-radius: 12px; background-color: var(--bg-control); }
.scale-pills.is-inline .scale-pill { height: 30px; }@media (max-width: 768px) {
  /* on a phone the two-way choice goes under its label, over the whole width */
  .td-row:has(> .scale-pills.is-inline) { flex-wrap: wrap; row-gap: 10px; }
  .td-row > .scale-pills.is-inline { width: 100%; }
}
@media (hover: hover) { .settings-link-remove:hover { color: var(--text-primary); } }

.td-section-title + .settings-links > .settings-link-item:first-child { margin-top: 0; } /* as under the other section titles */

/* Extra column colours (the palette has 18): fixed mid-tones that work on every theme */
:root {
  --amber: #ffc233;
  --lime: #a6e04a;
  --mint: #4fe3b1;
  --teal: #19b5a5;
  --sky: #4db8ff;
  --violet: #8a63ff;
  --magenta: #e248d0;
  --brown: #b98562;
}
.badge-status.badge-color-amber, .badge-status[data-color="amber"] { color: var(--amber); background-color: var(--bg-subtle); }
.task-badges .badge-status.badge-color-amber { color: var(--amber); }
.col-color-dot.dot-amber { background-color: var(--amber); }
.td-status.badge-color-amber, .td-status[data-color="amber"] { background-color: color-mix(in srgb, var(--amber) 16%, transparent); }
.badge-status.badge-color-lime, .badge-status[data-color="lime"] { color: var(--lime); background-color: var(--bg-subtle); }
.task-badges .badge-status.badge-color-lime { color: var(--lime); }
.col-color-dot.dot-lime { background-color: var(--lime); }
.td-status.badge-color-lime, .td-status[data-color="lime"] { background-color: color-mix(in srgb, var(--lime) 16%, transparent); }
.badge-status.badge-color-mint, .badge-status[data-color="mint"] { color: var(--mint); background-color: var(--bg-subtle); }
.task-badges .badge-status.badge-color-mint { color: var(--mint); }
.col-color-dot.dot-mint { background-color: var(--mint); }
.td-status.badge-color-mint, .td-status[data-color="mint"] { background-color: color-mix(in srgb, var(--mint) 16%, transparent); }
.badge-status.badge-color-teal, .badge-status[data-color="teal"] { color: var(--teal); background-color: var(--bg-subtle); }
.task-badges .badge-status.badge-color-teal { color: var(--teal); }
.col-color-dot.dot-teal { background-color: var(--teal); }
.td-status.badge-color-teal, .td-status[data-color="teal"] { background-color: color-mix(in srgb, var(--teal) 16%, transparent); }
.badge-status.badge-color-sky, .badge-status[data-color="sky"] { color: var(--sky); background-color: var(--bg-subtle); }
.task-badges .badge-status.badge-color-sky { color: var(--sky); }
.col-color-dot.dot-sky { background-color: var(--sky); }
.td-status.badge-color-sky, .td-status[data-color="sky"] { background-color: color-mix(in srgb, var(--sky) 16%, transparent); }
.badge-status.badge-color-violet, .badge-status[data-color="violet"] { color: var(--violet); background-color: var(--bg-subtle); }
.task-badges .badge-status.badge-color-violet { color: var(--violet); }
.col-color-dot.dot-violet { background-color: var(--violet); }
.td-status.badge-color-violet, .td-status[data-color="violet"] { background-color: color-mix(in srgb, var(--violet) 16%, transparent); }
.badge-status.badge-color-magenta, .badge-status[data-color="magenta"] { color: var(--magenta); background-color: var(--bg-subtle); }
.task-badges .badge-status.badge-color-magenta { color: var(--magenta); }
.col-color-dot.dot-magenta { background-color: var(--magenta); }
.td-status.badge-color-magenta, .td-status[data-color="magenta"] { background-color: color-mix(in srgb, var(--magenta) 16%, transparent); }
.badge-status.badge-color-brown, .badge-status[data-color="brown"] { color: var(--brown); background-color: var(--bg-subtle); }
.task-badges .badge-status.badge-color-brown { color: var(--brown); }
.col-color-dot.dot-brown { background-color: var(--brown); }
.td-status.badge-color-brown, .td-status[data-color="brown"] { background-color: color-mix(in srgb, var(--brown) 16%, transparent); }

/* Keep API controls hidden until they are needed. */
#integration-revoke[hidden], #integration-token[hidden], #integration-copy[hidden] { display: none !important; }

/* A full-screen cover or sheet must also cover the page's native scrollbar. */
html:has(#boot-loader:not(.is-hidden)),
html:has(#kt-update),
html:has(#modal-root .modal-backdrop) {
  overflow: hidden;
}
html:has(#boot-loader:not(.is-hidden))::-webkit-scrollbar,
html:has(#kt-update)::-webkit-scrollbar,
html:has(#modal-root .modal-backdrop)::-webkit-scrollbar { display: none; }
.integration-copy {
  flex: none; padding: 0; border: 0; background: transparent;
  color: var(--blue); font: inherit; font-size: 12px; cursor: pointer;
}
.integration-actions a { text-decoration: none; }
.integration-status:empty { display: none; }
#integration-token[hidden], #integration-copy[hidden], #integration-revoke[hidden] { display: none !important; }
.integration-actions .settings-row-btn { box-sizing: border-box; line-height: normal; }
.ext-detail-value { overflow-wrap: anywhere; min-width: 0; }
.td-desc a, .ext-detail-value a { color: var(--accent, #6b9cff); overflow-wrap: anywhere; }
.journal-math-preview { flex: 1; min-height: 0; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.6; }
.journal-math-preview[hidden], .journal-textarea[hidden] { display: none; }
.journal-math-preview .katex-display { overflow-x: auto; overflow-y: hidden; }
.journal-api-title { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.journal-api-date { cursor: default; white-space: nowrap; }
.journal-math-preview { white-space: normal; }
.journal-math-preview > :first-child { margin-top: 0; }
.journal-math-preview h1, .journal-math-preview h2, .journal-math-preview h3, .journal-math-preview h4 { line-height: 1.3; margin: 1em 0 .45em; }
.journal-math-preview h1 { font-size: 1.4em; }
.journal-math-preview h2 { font-size: 1.25em; }
.journal-math-preview h3, .journal-math-preview h4 { font-size: 1.1em; }
.journal-math-preview p, .journal-math-preview ul, .journal-math-preview ol, .journal-math-preview blockquote { margin: .6em 0; }
.journal-math-preview ul, .journal-math-preview ol { padding-left: 1.5em; }
.journal-math-preview table { display: block; max-width: 100%; overflow-x: auto; border-collapse: collapse; margin: .8em 0; }
.journal-math-preview th, .journal-math-preview td { border: 1px solid var(--border, #333); padding: .4em .65em; text-align: left; }
.journal-math-preview pre { overflow-x: auto; white-space: pre; }
.journal-math-preview a { color: var(--accent, #6b9cff); }
.subtask-row { justify-content: flex-start; gap: 12px; cursor: pointer; }
.subtask-row input { flex: none; }
.subtask-row span { overflow-wrap: anywhere; }

/* Linked subtasks are regular tasks; these rows only make their relation clear in
   the task sheet and keep the button visually identical to the surrounding rows. */
.td-task-link {
  width: 100%;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.td-task-link:hover .td-value { text-decoration: underline; }
