/*
 * GiuliaMeet theme — the single place where the look is customised.
 *
 * Bootstrap 5.3 is used as-is and restyled through its CSS variables (--bs-*),
 * FullCalendar through --fc-*. No Sass build.
 *
 * One accent colour: --app-accent. Everything accent-related is derived from it,
 * so the company can override it with a single inline variable.
 */

/* ------------------------------------------------------------------ tokens */

:root,
[data-bs-theme="light"] {
  --app-accent: #4f46e5;
  --app-on-accent: #ffffff;
  --app-accent-hover: color-mix(in srgb, var(--app-accent) 86%, #000);
  --app-accent-fg: color-mix(in srgb, var(--app-accent) 92%, #000);
  --app-accent-subtle: color-mix(in srgb, var(--app-accent) 9%, var(--app-surface));
  --app-accent-ring: color-mix(in srgb, var(--app-accent) 32%, transparent);

  --app-bg: #f7f7f8;
  --app-surface: #ffffff;
  --app-surface-2: #f1f1f3;
  --app-border: #e5e5e9;
  --app-border-strong: #d2d2d8;
  --app-text: #18181b;
  --app-text-muted: #5f5f6a;
  /* The kanban board (SPEC 15.4): its area, a shade off the page; the columns read as cards. */
  --app-board-bg: color-mix(in srgb, var(--app-border) 50%, var(--app-surface-2));
  --app-board-column: var(--app-bg);
  /* Stage 10.6 (SPEC 15.3, Worksection-like): the width of a column on a desktop and of the
     strip an empty one collapses into. */
  --app-board-column-width: 21.25rem;
  --app-board-strip-width: 2.75rem;
  /* The task window (stage 10.6): the panel «Властивості» and the soft blocks (the
     description, the subtasks, the comments). */
  --app-task-props-width: 17.5rem;
  --app-task-props-bg: color-mix(in srgb, var(--app-surface-2) 45%, var(--app-surface));
  --app-task-soft: color-mix(in srgb, var(--app-surface-2) 55%, var(--app-surface));

  /* Priorities: muted hues; *-fg is readable on *-bg (WCAG AA). */
  --prio-low: #7b8494;
  --prio-normal: #3d74c9;
  --prio-high: #cc7630;
  --prio-critical: #c5474b;
  --prio-mix-fg: #000;
  --prio-fg-ratio: 62%;

  /* Success (all free, accepted): the icon hue and a text colour with >= 4.5:1 contrast. */
  --app-success: #2f8f5b;
  --app-success-fg: #23704a;

  --app-shadow-overlay: 0 10px 30px rgb(15 15 25 / 0.08), 0 2px 8px rgb(15 15 25 / 0.06);
  /* The shade at the bottom of a board column whose cards go on below (stage 10.3). */
  --app-scroll-shade: rgb(15 15 25 / 0.09);
  --app-radius-sm: 0.375rem;
  --app-radius: 0.5rem;
  --app-radius-lg: 0.625rem;
  --app-topbar-height: 56px;
  --app-sidebar-width: 264px;
  --app-transition: 150ms ease;
}

[data-bs-theme="dark"] {
  --app-on-accent: #ffffff;
  --app-accent-hover: color-mix(in srgb, var(--app-accent) 82%, #fff);
  --app-accent-fg: color-mix(in srgb, var(--app-accent) 55%, #fff);
  --app-accent-subtle: color-mix(in srgb, var(--app-accent) 16%, var(--app-surface));
  --app-accent-ring: color-mix(in srgb, var(--app-accent) 55%, transparent);

  --app-bg: #0e0e10;
  --app-surface: #161618;
  --app-surface-2: #1e1e21;
  --app-border: #28282c;
  --app-border-strong: #36363c;
  --app-text: #ececef;
  --app-text-muted: #a1a1ab;
  --app-board-bg: color-mix(in srgb, var(--app-surface) 45%, var(--app-bg));
  --app-board-column: var(--app-surface-2);
  --app-task-props-bg: color-mix(in srgb, var(--app-bg) 40%, var(--app-surface));
  --app-task-soft: color-mix(in srgb, var(--app-surface-2) 70%, var(--app-surface));

  --prio-low: #8b93a3;
  --prio-normal: #5b8fe0;
  --prio-high: #de9150;
  --prio-critical: #e06a6d;
  --prio-mix-fg: #fff;
  --prio-fg-ratio: 55%;

  --app-success: #4cb782;
  --app-success-fg: #7fd1a6;

  --app-shadow-overlay: 0 10px 30px rgb(0 0 0 / 0.45), 0 2px 8px rgb(0 0 0 / 0.35);
  --app-scroll-shade: rgb(0 0 0 / 0.38);
}

/* The native parts of the fields (the date field's calendar icon and picker, plain
   scrollbars) follow the app's theme, not the OS (stage 10.10 A): <meta name="color-scheme"
   content="light dark"> alone lets a dark OS draw them for a dark page — a white icon on a
   white field in the light theme. Bootstrap sets only the dark one; the dark rule stays after
   :root here (the same specificity). */
:root,
[data-bs-theme="light"] {
  color-scheme: light;
}

[data-bs-theme="dark"] {
  color-scheme: dark;
}

/* ------------------------------------------------------- bootstrap mapping */

:root,
[data-bs-theme="light"],
[data-bs-theme="dark"] {
  --bs-body-font-family: "Inter Variable", "Inter", system-ui, -apple-system, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  --bs-body-font-size: 0.875rem;
  --bs-body-line-height: 1.5;
  --bs-body-bg: var(--app-bg);
  --bs-body-color: var(--app-text);
  --bs-emphasis-color: var(--app-text);
  --bs-secondary-color: var(--app-text-muted);
  --bs-tertiary-color: var(--app-text-muted);
  --bs-secondary-bg: var(--app-surface-2);
  --bs-tertiary-bg: var(--app-surface-2);
  --bs-border-color: var(--app-border);
  --bs-border-color-translucent: var(--app-border);
  --bs-heading-color: var(--app-text);
  --bs-primary: var(--app-accent);
  --bs-link-color: var(--app-accent-fg);
  --bs-link-hover-color: var(--app-accent-hover);
  --bs-focus-ring-color: var(--app-accent-ring);
  --bs-border-radius: var(--app-radius);
  --bs-border-radius-sm: var(--app-radius-sm);
  --bs-border-radius-lg: var(--app-radius-lg);
  --bs-border-radius-xl: var(--app-radius-lg);
  --bs-border-radius-xxl: var(--app-radius-lg);
  --bs-box-shadow: var(--app-shadow-overlay);
  --bs-box-shadow-sm: none;
  --bs-box-shadow-lg: var(--app-shadow-overlay);
}

body {
  font-feature-settings: "cv11", "ss03";
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Only three heading levels are used across the app. */
h1, .h1 { font-size: 1.375rem; font-weight: 600; letter-spacing: -0.012em; line-height: 1.3; }
h2, .h2 { font-size: 1.0625rem; font-weight: 600; letter-spacing: -0.006em; line-height: 1.35; }
h3, .h3 { font-size: 0.9375rem; font-weight: 600; line-height: 1.4; }

a {
  color: var(--app-accent-fg);
  text-decoration: none;
  transition: color var(--app-transition);
}
a:hover { color: var(--app-accent-hover); text-decoration: underline; text-underline-offset: 2px; }

.text-muted, .text-body-secondary { color: var(--app-text-muted) !important; }

:focus-visible { outline: 2px solid var(--app-accent-fg); outline-offset: 2px; }
.btn:focus-visible,
.form-control:focus,
.form-select:focus,
.form-check-input:focus {
  outline: 0;
  box-shadow: 0 0 0 3px var(--app-accent-ring);
}

/* ---------------------------------------------------------------- buttons */

.btn {
  --bs-btn-font-weight: 500;
  --bs-btn-font-size: 0.875rem;
  --bs-btn-padding-y: 0.4375rem;
  --bs-btn-padding-x: 0.875rem;
  --bs-btn-border-radius: var(--app-radius);
  transition: color var(--app-transition), background-color var(--app-transition),
    border-color var(--app-transition), box-shadow var(--app-transition);
}
.btn-sm { --bs-btn-padding-y: 0.3125rem; --bs-btn-padding-x: 0.625rem; --bs-btn-font-size: 0.8125rem; }

.btn-primary {
  --bs-btn-color: var(--app-on-accent);
  --bs-btn-bg: var(--app-accent);
  --bs-btn-border-color: var(--app-accent);
  --bs-btn-hover-color: var(--app-on-accent);
  --bs-btn-hover-bg: var(--app-accent-hover);
  --bs-btn-hover-border-color: var(--app-accent-hover);
  --bs-btn-active-color: var(--app-on-accent);
  --bs-btn-active-bg: var(--app-accent-hover);
  --bs-btn-active-border-color: var(--app-accent-hover);
  --bs-btn-disabled-color: var(--app-on-accent);
  --bs-btn-disabled-bg: var(--app-accent);
  --bs-btn-disabled-border-color: var(--app-accent);
}

/* Neutral button: the default for secondary actions. */
.btn-secondary,
.btn-outline-secondary {
  --bs-btn-color: var(--app-text);
  --bs-btn-bg: var(--app-surface);
  --bs-btn-border-color: var(--app-border-strong);
  --bs-btn-hover-color: var(--app-text);
  --bs-btn-hover-bg: var(--app-surface-2);
  --bs-btn-hover-border-color: var(--app-border-strong);
  --bs-btn-active-color: var(--app-text);
  --bs-btn-active-bg: var(--app-surface-2);
  --bs-btn-active-border-color: var(--app-border-strong);
  --bs-btn-disabled-color: var(--app-text-muted);
  --bs-btn-disabled-bg: var(--app-surface);
  --bs-btn-disabled-border-color: var(--app-border);
}

/* Borderless button for toolbars and icon actions. */
.btn-ghost {
  --bs-btn-color: var(--app-text-muted);
  --bs-btn-bg: transparent;
  --bs-btn-border-color: transparent;
  --bs-btn-hover-color: var(--app-text);
  --bs-btn-hover-bg: var(--app-surface-2);
  --bs-btn-hover-border-color: transparent;
  --bs-btn-active-color: var(--app-text);
  --bs-btn-active-bg: var(--app-surface-2);
  --bs-btn-active-border-color: transparent;
  --bs-btn-disabled-bg: transparent;
  --bs-btn-disabled-border-color: transparent;
}
.btn-icon {
  --bs-btn-padding-x: 0;
  --bs-btn-padding-y: 0;
  width: 2.125rem;
  height: 2.125rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
}

.btn-danger {
  --bs-btn-bg: var(--prio-critical);
  --bs-btn-border-color: var(--prio-critical);
  --bs-btn-hover-bg: color-mix(in srgb, var(--prio-critical) 86%, #000);
  --bs-btn-hover-border-color: color-mix(in srgb, var(--prio-critical) 86%, #000);
}

/* ------------------------------------------------------------------ forms */

.form-control,
.form-select {
  font-size: 0.875rem;
  background-color: var(--app-surface);
  border-color: var(--app-border-strong);
  border-radius: var(--app-radius);
  padding: 0.4375rem 0.75rem;
  transition: border-color var(--app-transition), box-shadow var(--app-transition);
}
.form-select { padding-right: 2.25rem; }
.form-control:focus,
.form-select:focus { border-color: var(--app-accent); background-color: var(--app-surface); }
.form-control::placeholder { color: var(--app-text-muted); opacity: 0.8; }
.form-label { font-weight: 500; margin-bottom: 0.375rem; }
.form-text { color: var(--app-text-muted); font-size: 0.8125rem; }
.form-check-input { border-color: var(--app-border-strong); background-color: var(--app-surface); }
.form-check-input:checked { background-color: var(--app-accent); border-color: var(--app-accent); }
/* Bootstrap paints the knob of a focused, unchecked switch light blue: keep it neutral (the
   focus ring already shows the focus, in the accent colour). */
.form-switch .form-check-input:focus:not(:checked) {
  --bs-form-switch-bg: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='3' fill='rgba%280, 0, 0, 0.25%29'/%3e%3c/svg%3e");
}
[data-bs-theme="dark"] .form-switch .form-check-input:focus:not(:checked) {
  --bs-form-switch-bg: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='3' fill='rgba%28255, 255, 255, 0.25%29'/%3e%3c/svg%3e");
}
.invalid-feedback { font-size: 0.8125rem; color: var(--prio-critical); }
.form-control.is-invalid,
.form-select.is-invalid { border-color: var(--prio-critical); }
/* Date fields (stage 10.10 A): Chromium (Chrome, Edge) shows one calendar icon in both themes —
   Bootstrap Icons' «calendar3» in the muted text colour, the accent on hover — on its own
   picker button, so a click still opens the date picker. Firefox draws its own button, which
   follows the theme through color-scheme (the tokens above). */
input[type="date"]::-webkit-calendar-picker-indicator {
  width: 1rem;
  height: 1rem;
  margin-left: 0.375rem;
  padding: 0;
  background: var(--app-text-muted);
  -webkit-mask: var(--app-calendar-icon) center / contain no-repeat;
  mask: var(--app-calendar-icon) center / contain no-repeat;
  opacity: 1;
  cursor: pointer;
  transition: background-color var(--app-transition);
}
input[type="date"]:hover::-webkit-calendar-picker-indicator,
input[type="date"]:focus::-webkit-calendar-picker-indicator { background: var(--app-accent-fg); }
input[type="date"]:disabled::-webkit-calendar-picker-indicator { opacity: 0.5; cursor: default; }
:root {
  --app-calendar-icon: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath d='M14 0H2a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V2a2 2 0 0 0-2-2M1 3.857C1 3.384 1.448 3 2 3h12c.552 0 1 .384 1 .857v10.286c0 .473-.448.857-1 .857H2c-.552 0-1-.384-1-.857z'/%3e%3cpath d='M6.5 7a1 1 0 1 0 0-2 1 1 0 0 0 0 2m3 0a1 1 0 1 0 0-2 1 1 0 0 0 0 2m3 0a1 1 0 1 0 0-2 1 1 0 0 0 0 2m-9 3a1 1 0 1 0 0-2 1 1 0 0 0 0 2m3 0a1 1 0 1 0 0-2 1 1 0 0 0 0 2m3 0a1 1 0 1 0 0-2 1 1 0 0 0 0 2m3 0a1 1 0 1 0 0-2 1 1 0 0 0 0 2m-9 3a1 1 0 1 0 0-2 1 1 0 0 0 0 2m3 0a1 1 0 1 0 0-2 1 1 0 0 0 0 2m3 0a1 1 0 1 0 0-2 1 1 0 0 0 0 2'/%3e%3c/svg%3e");
}

/* ----------------------------------------------------- surfaces & overlays */

.card {
  --bs-card-bg: var(--app-surface);
  --bs-card-border-color: var(--app-border);
  --bs-card-border-radius: var(--app-radius-lg);
  --bs-card-inner-border-radius: calc(var(--app-radius-lg) - 1px);
  --bs-card-cap-bg: transparent;
  --bs-card-spacer-y: 1.25rem;
  --bs-card-spacer-x: 1.25rem;
  box-shadow: none;
}

.dropdown-menu {
  --bs-dropdown-bg: var(--app-surface);
  --bs-dropdown-border-color: var(--app-border);
  --bs-dropdown-border-radius: var(--app-radius-lg);
  --bs-dropdown-inner-border-radius: var(--app-radius);
  --bs-dropdown-box-shadow: var(--app-shadow-overlay);
  --bs-dropdown-padding-x: 0.25rem;
  --bs-dropdown-padding-y: 0.25rem;
  --bs-dropdown-font-size: 0.875rem;
  --bs-dropdown-item-padding-x: 0.625rem;
  --bs-dropdown-item-padding-y: 0.4375rem;
  --bs-dropdown-item-border-radius: var(--app-radius-sm);
  --bs-dropdown-link-color: var(--app-text);
  --bs-dropdown-link-hover-color: var(--app-text);
  --bs-dropdown-link-hover-bg: var(--app-surface-2);
  --bs-dropdown-link-active-color: var(--app-text);
  --bs-dropdown-link-active-bg: var(--app-accent-subtle);
  --bs-dropdown-header-color: var(--app-text-muted);
  --bs-dropdown-divider-bg: var(--app-border);
  box-shadow: var(--bs-dropdown-box-shadow);
}
.dropdown-item { display: flex; align-items: center; gap: 0.625rem; transition: background-color var(--app-transition); }
.dropdown-item .bi { color: var(--app-text-muted); font-size: 1rem; }
.dropdown-item.active .bi,
.dropdown-item:active .bi { color: var(--app-accent-fg); }

.modal {
  --bs-modal-bg: var(--app-surface);
  --bs-modal-border-color: var(--app-border);
  --bs-modal-border-radius: var(--app-radius-lg);
  --bs-modal-inner-border-radius: calc(var(--app-radius-lg) - 1px);
  --bs-modal-box-shadow: var(--app-shadow-overlay);
  --bs-modal-header-border-color: var(--app-border);
  --bs-modal-footer-border-color: var(--app-border);
  --bs-modal-padding: 1.25rem;
}
.modal-content { box-shadow: var(--bs-modal-box-shadow); }
/* Fragments loaded into the meeting modal wrap the header, body and footer (the form, the
   card). On phones the modal is full-screen: the wrapper fills it and only the body scrolls. */
@media (max-width: 575.98px) {
  .modal-fullscreen-sm-down .modal-content > :is(.meeting-form, .meeting-card) {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    min-height: 0;
  }
  .modal-fullscreen-sm-down .modal-content > :is(.meeting-form, .meeting-card) > .modal-body {
    overflow-y: auto;
  }
}
.modal-title { font-size: 1.0625rem; font-weight: 600; }

.toast {
  --bs-toast-bg: var(--app-surface);
  --bs-toast-border-color: var(--app-border);
  --bs-toast-border-radius: var(--app-radius-lg);
  --bs-toast-box-shadow: var(--app-shadow-overlay);
  --bs-toast-header-bg: transparent;
  --bs-toast-header-color: var(--app-text);
  --bs-toast-header-border-color: var(--app-border);
  --bs-toast-color: var(--app-text);
  --bs-toast-max-width: 380px;
  --bs-toast-font-size: 0.875rem;
}
.toast-container { z-index: 1090; }
.app-toasts { top: var(--app-topbar-height); }
.toast-icon { font-size: 1rem; line-height: 1.3; color: var(--app-text-muted); }
.toast-success .toast-icon { color: var(--app-success); }
.toast-info .toast-icon { color: var(--prio-normal); }
.toast-warning .toast-icon { color: var(--prio-high); }
.toast-error .toast-icon { color: var(--prio-critical); }

.offcanvas { --bs-offcanvas-bg: var(--app-surface); --bs-offcanvas-border-color: var(--app-border); }

.table {
  --bs-table-bg: transparent;
  --bs-table-color: var(--app-text);
  --bs-table-border-color: var(--app-border);
  --bs-table-hover-bg: var(--app-surface-2);
  --bs-table-hover-color: var(--app-text);
}
.table > thead th { font-weight: 500; color: var(--app-text-muted); font-size: 0.8125rem; }

/* ------------------------------------------------------------- priorities */

.prio-low { --prio: var(--prio-low); }
.prio-normal { --prio: var(--prio-normal); }
.prio-high { --prio: var(--prio-high); }
.prio-critical { --prio: var(--prio-critical); }
[class*="prio-"] {
  --prio-bg: color-mix(in srgb, var(--prio) 14%, var(--app-surface));
  --prio-fg: color-mix(in srgb, var(--prio) var(--prio-fg-ratio), var(--prio-mix-fg));
}

.badge-priority {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.1875rem 0.5rem;
  border-radius: var(--app-radius-sm);
  font-size: 0.75rem;
  font-weight: 500;
  line-height: 1.4;
  color: var(--prio-fg);
  background: var(--prio-bg);
}
.badge-priority::before {
  content: "";
  width: 0.375rem;
  height: 0.375rem;
  border-radius: 50%;
  background: var(--prio);
}

/* ----------------------------------------------------------------- layout */

html { height: 100%; }
body { display: flex; flex-direction: column; min-height: 100vh; min-height: 100dvh; }

.app-topbar {
  position: sticky;
  top: 0;
  z-index: 1030;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  height: var(--app-topbar-height);
  padding: 0 1rem;
  background: var(--app-surface);
  border-bottom: 1px solid var(--app-border);
}
.app-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.625rem;
  color: var(--app-text);
  font-weight: 600;
  font-size: 0.9375rem;
}
.app-brand:hover { color: var(--app-text); text-decoration: none; }
.app-logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  height: 1.75rem;
  border-radius: var(--app-radius);
  background: var(--app-accent);
  color: var(--app-on-accent);
  font-size: 0.8125rem;
  font-weight: 700;
}
.app-logo-img { height: 1.75rem; width: auto; border-radius: var(--app-radius-sm); }
.app-topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 0.25rem; }

/* The sections «Календар» / «Задачі» right of the logo (SPEC 15.1); on phones two icon
   buttons (their labels hidden; aria-label and title stay). */
.section-switch {
  align-items: center;
  gap: 0.125rem;
  padding: 0.1875rem;
  background: var(--app-surface-2);
  border-radius: var(--app-radius);
}
.section-switch-item {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.25rem 0.75rem;
  border-radius: var(--app-radius-sm);
  color: var(--app-text-muted);
  font-size: 0.875rem;
  font-weight: 500;
  white-space: nowrap;
  transition: background-color var(--app-transition), color var(--app-transition);
}
.section-switch-item:hover { color: var(--app-text); text-decoration: none; }
.section-switch-item:focus-visible { outline: 2px solid var(--app-accent); outline-offset: 1px; }
.section-switch-item[aria-current="page"] {
  background: var(--app-surface);
  color: var(--app-accent-fg);
  box-shadow: 0 0 0 1px var(--app-border), 0 1px 2px rgb(15 15 25 / 0.06);
}
@media (max-width: 767.98px) {
  .section-switch-label { display: none; }
  .section-switch-item { padding: 0.3125rem 0.625rem; }
  .section-switch-item .bi { font-size: 1rem; }
  .app-topbar { gap: 0.5rem; }
}
/* Narrow phones (360 px): the app's name gives way to the switch; the logo stays. */
@media (max-width: 479.98px) {
  .app-topbar.has-sections .app-brand-name { display: none; }
  .app-topbar { padding: 0 0.75rem; }
}
/* Tablets: the topbar's text buttons keep only their icons so the switch fits. */
@media (min-width: 768px) and (max-width: 991.98px) {
  .app-topbar-actions > .btn-ghost.btn-sm { font-size: 0; gap: 0 !important; }
  .app-topbar-actions > .btn-ghost.btn-sm .bi { font-size: 1rem; }
}

.app-shell { flex: 1 1 auto; display: flex; min-height: 0; }

.app-sidebar {
  flex: 0 0 var(--app-sidebar-width);
  width: var(--app-sidebar-width);
  padding: 1.25rem 1rem;
  background: var(--app-surface);
  border-right: 1px solid var(--app-border);
  overflow-y: auto;
}
@media (max-width: 991.98px) {
  /* Below lg the sidebar content lives in an offcanvas; the column itself collapses. */
  .app-sidebar { flex-basis: 0; width: 0; padding: 0; border: 0; overflow: visible; }
  .app-sidebar .offcanvas-lg { --bs-offcanvas-width: min(320px, 85vw); }
}
@media (min-width: 992px) {
  .app-sidebar .offcanvas-lg .offcanvas-body { flex-direction: column; }
}

.app-section-label {
  margin-bottom: 0.5rem;
  color: var(--app-text-muted);
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.02em;
}
.app-sidebar-section + .app-sidebar-section { margin-top: 1.5rem; }

.app-content {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  padding: 1.5rem;
}
@media (max-width: 575.98px) { .app-content { padding: 1rem; } }
/* Room under the last element for the AI assistant's floating button (not the calendar,
   which fills the height). */
.has-assistant:not(.page-calendar) .app-content { padding-bottom: 5.5rem; }

.page-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}
.page-header h1 { margin: 0; }
.page-subtitle { margin: 0.25rem 0 0; color: var(--app-text-muted); }

/* HTMX global loading indicator (thin bar under the top edge). */
.app-progress {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 1100;
  height: 2px;
  overflow: hidden;
  pointer-events: none;
  opacity: 0;
  transition: opacity var(--app-transition);
}
.app-progress::after {
  content: "";
  position: absolute;
  inset: 0;
  width: 40%;
  background: var(--app-accent);
  animation: app-progress 1s ease-in-out infinite;
}
.app-progress.htmx-request { opacity: 1; }
@keyframes app-progress { from { transform: translateX(-100%); } to { transform: translateX(250%); } }

/* ---------------------------------------------------------- empty states */

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 3rem 1.5rem;
}
.empty-state-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 3rem;
  height: 3rem;
  margin-bottom: 1rem;
  border-radius: 50%;
  background: var(--app-surface-2);
  color: var(--app-text-muted);
  font-size: 1.375rem;
}
.empty-state h1, .empty-state h2 { margin-bottom: 0.375rem; }
/* 404 / 403 / 500: one empty state in a card. */
.error-card { width: 100%; max-width: 32rem; margin: 3rem auto 0; }
@media (max-width: 575.98px) { .error-card { margin-top: 1rem; } }

/* Single-column pages (profile, settings, password) and form cards. */
.page-column { width: 100%; max-width: 48rem; margin-inline: auto; }
.page-column-sm { max-width: 28rem; }
.page-column-wide { max-width: 64rem; }
.card-form { max-width: 44rem; }
.empty-state p { max-width: 30rem; margin: 0 auto 1.25rem; color: var(--app-text-muted); }

/* ----------------------------------------------------------------- alerts */

.alert {
  --bs-alert-border-radius: var(--app-radius);
  --bs-alert-padding-x: 0.875rem;
  --bs-alert-padding-y: 0.625rem;
  font-size: 0.875rem;
}
.alert-danger {
  --bs-alert-bg: color-mix(in srgb, var(--prio-critical) 10%, var(--app-surface));
  --bs-alert-border-color: color-mix(in srgb, var(--prio-critical) 30%, var(--app-surface));
  --bs-alert-color: color-mix(in srgb, var(--prio-critical) var(--prio-fg-ratio), var(--prio-mix-fg));
}
/* Warnings (no S3, purge, future meetings) in the high-priority hue. */
.alert-warning {
  --bs-alert-bg: color-mix(in srgb, var(--prio-high) 10%, var(--app-surface));
  --bs-alert-border-color: color-mix(in srgb, var(--prio-high) 30%, var(--app-surface));
  --bs-alert-color: color-mix(in srgb, var(--prio-high) var(--prio-fg-ratio), var(--prio-mix-fg));
  --bs-alert-link-color: var(--bs-alert-color);
}
.text-danger-emphasis { color: color-mix(in srgb, var(--prio-critical) var(--prio-fg-ratio), var(--prio-mix-fg)) !important; }

/* ---------------------------------------------------------------- avatars */

.avatar {
  --avatar-size: 2rem;
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  width: var(--avatar-size);
  height: var(--avatar-size);
  border-radius: 50%;
  object-fit: cover;
  font-size: max(0.625rem, calc(var(--avatar-size) * 0.4));
  font-weight: 600;
  line-height: 1;
  letter-spacing: 0.01em;
  user-select: none;
  background: var(--app-surface-2);
  color: var(--app-text);
}
/* One 256x256 file, shown at 24 / 28 / 32 / 40 / 96 px ({% avatar user size=… %}). */
.avatar-24 { --avatar-size: 1.5rem; }
.avatar-28 { --avatar-size: 1.75rem; }
.avatar-32 { --avatar-size: 2rem; }
.avatar-40 { --avatar-size: 2.5rem; }
.avatar-96 { --avatar-size: 6rem; }

/* Muted hues for initials; background and text are mixed from one hue per slot. Every slot
   keeps text/background >= 4.5:1 (WCAG AA) in both themes (apps/accounts/tests/test_avatars.py). */
.avatar-c0 { --avatar-hue: #6366f1; }
.avatar-c1 { --avatar-hue: #0ea5a4; }
.avatar-c2 { --avatar-hue: #d97706; }
.avatar-c3 { --avatar-hue: #db2777; }
.avatar-c4 { --avatar-hue: #2563eb; }
.avatar-c5 { --avatar-hue: #65a30d; }
.avatar-c6 { --avatar-hue: #9333ea; }
.avatar-c7 { --avatar-hue: #dc2626; }
[class*="avatar-c"] {
  background: color-mix(in srgb, var(--avatar-hue) 16%, var(--app-surface));
  color: color-mix(in srgb, var(--avatar-hue) var(--prio-fg-ratio), var(--prio-mix-fg));
}

.user-menu-toggle {
  display: inline-flex;
  align-items: center;
  padding: 0.125rem;
  border: 0;
  border-radius: 50%;
  background: transparent;
}
.user-menu { min-width: 15rem; }
.user-menu-header { padding: 0.5rem 0.625rem 0.625rem; }
.user-menu-header .name { font-weight: 600; }
.user-menu-header .email { color: var(--app-text-muted); font-size: 0.8125rem; }

/* ------------------------------------------------------------ status badges */

.badge-status {
  display: inline-flex;
  align-items: center;
  padding: 0.1875rem 0.5rem;
  border-radius: var(--app-radius-sm);
  font-size: 0.75rem;
  font-weight: 500;
  background: var(--app-surface-2);
  color: var(--app-text-muted);
}
.badge-status.status-pending { background: var(--app-accent-subtle); color: var(--app-accent-fg); }
.badge-status.badge-private { background: var(--app-accent-subtle); color: var(--app-accent-fg); }
.badge-status.status-accepted {
  background: color-mix(in srgb, var(--app-success) 14%, var(--app-surface));
  color: color-mix(in srgb, var(--app-success) var(--prio-fg-ratio), var(--prio-mix-fg));
}
.badge-status.status-warning {
  background: color-mix(in srgb, var(--prio-high) 16%, var(--app-surface));
  color: color-mix(in srgb, var(--prio-high) var(--prio-fg-ratio), var(--prio-mix-fg));
}
.badge-status.status-revoked {
  background: color-mix(in srgb, var(--prio-critical) 14%, var(--app-surface));
  color: color-mix(in srgb, var(--prio-critical) var(--prio-fg-ratio), var(--prio-mix-fg));
}

/* -------------------------------------------------------------- auth pages */

.auth-page {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
}
.auth-card { width: 100%; max-width: 25rem; }
.auth-card .card-body { padding: 2rem; }
.auth-brand { display: flex; align-items: center; gap: 0.625rem; margin-bottom: 1.5rem; }
.auth-brand .app-logo { width: 2.25rem; height: 2.25rem; font-size: 1rem; }
.auth-card h1 { margin-bottom: 0.25rem; }
.auth-footer { margin-top: 1.25rem; text-align: center; color: var(--app-text-muted); }
@media (max-width: 575.98px) { .auth-card .card-body { padding: 1.5rem; } }

.form-text ul { padding-left: 1.1rem; margin: 0.25rem 0 0; }

/* ------------------------------------------------------------------ panel */

.panel-nav { display: flex; flex-direction: column; gap: 0.125rem; }
.panel-nav a {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.4375rem 0.625rem;
  border-radius: var(--app-radius);
  color: var(--app-text);
  transition: background-color var(--app-transition);
}
.panel-nav a .bi { color: var(--app-text-muted); font-size: 1rem; }
.panel-nav a:hover { background: var(--app-surface-2); text-decoration: none; }
.panel-nav a.active { background: var(--app-accent-subtle); color: var(--app-accent-fg); font-weight: 500; }
.panel-nav a.active .bi { color: var(--app-accent-fg); }
.panel-nav .disabled { color: var(--app-text-muted); pointer-events: none; opacity: 0.6; }

.table-card { overflow: hidden; }
.table-card .table { margin: 0; }
.table-card .table > :not(caption) > * > * { padding: 0.75rem 1rem; }
.table-card .table > tbody > tr:last-child > * { border-bottom: 0; }
.table-responsive { -webkit-overflow-scrolling: touch; }
.min-w-0 { min-width: 0; }
.cell-muted { color: var(--app-text-muted); font-size: 0.8125rem; }
.filter-bar { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; margin-bottom: 1rem; }
.filter-bar .form-control, .filter-bar .form-select { width: auto; min-width: 11rem; }
@media (max-width: 575.98px) { .filter-bar .form-control, .filter-bar .form-select { flex: 1 1 100%; } }

.profile-avatar { display: flex; align-items: center; gap: 1.25rem; flex-wrap: wrap; }
.avatar-editor-image { display: inline-flex; flex: 0 0 auto; }
/* Not .d-inline-flex: its !important would beat x-show while the preview is shown. */
.avatar-editor-current { display: inline-flex; }
/* The file input is visually hidden: its keyboard focus is shown on the "Upload" label. */
.avatar-editor .avatar-file:focus-visible + label { outline: 2px solid var(--app-accent); outline-offset: 2px; }
.dl-grid { display: grid; grid-template-columns: max-content 1fr; gap: 0.5rem 1.5rem; margin: 0; }
.dl-grid dt { font-weight: 400; color: var(--app-text-muted); }
.dl-grid dd { margin: 0; }

[x-cloak] { display: none !important; }
.form-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 1rem; margin-top: 1rem; }
.badge-inherited {
  display: inline-block;
  margin-left: 0.25rem;
  padding: 0 0.375rem;
  border-radius: var(--app-radius-sm);
  background: var(--app-surface-2);
  color: var(--app-text-muted);
  font-size: 0.75rem;
  line-height: 1.5;
  white-space: nowrap;
}

/* Panel (stage 7): overview numbers, bulk bar, user card tabs, role matrix, department tree,
   accent preview, audit log. */
.filter-bar-wrap .filter-search { flex: 1 1 16rem; }
@media (min-width: 1200px) { .filter-bar-wrap .form-select { min-width: 9.5rem; } }
.filter-date { display: inline-flex; align-items: center; gap: 0.375rem; margin: 0; color: var(--app-text-muted); }
.filter-bar .filter-date .form-control { min-width: 0; }
@media (max-width: 575.98px) { .filter-date { flex: 1 1 100%; } .filter-bar .filter-date .form-control { flex: 1 1 auto; } }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr)); gap: 0.75rem; }
.stat-card {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: 1rem 1.125rem;
  border: 1px solid var(--app-border);
  border-radius: var(--app-radius-lg);
  background: var(--app-surface);
  color: var(--app-text);
  transition: border-color var(--app-transition);
}
a.stat-card:hover { border-color: var(--app-border-strong); text-decoration: none; color: var(--app-text); }
.stat-card.is-alert { border-color: color-mix(in srgb, var(--prio-critical) 45%, var(--app-border)); }
.stat-card.is-alert .stat-value { color: color-mix(in srgb, var(--prio-critical) var(--prio-fg-ratio), var(--prio-mix-fg)); }
.stat-label { display: flex; align-items: center; gap: 0.5rem; color: var(--app-text-muted); font-size: 0.8125rem; }
.stat-value { font-size: 1.75rem; font-weight: 600; line-height: 1.2; font-variant-numeric: tabular-nums; }
.stat-of { font-size: 1rem; font-weight: 500; color: var(--app-text-muted); }
.stat-note { color: var(--app-text-muted); font-size: 0.8125rem; }
.stat-meter { height: 0.375rem; border-radius: 999px; background: var(--app-surface-2); overflow: hidden; margin: 0.25rem 0; }
.stat-meter > span { display: block; height: 100%; background: var(--app-accent); }
.stat-meter.is-low > span { background: var(--prio-critical); }

.bulk-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
  padding: 0.5rem 0.75rem;
  border: 1px solid color-mix(in srgb, var(--app-accent) 35%, var(--app-border));
  border-radius: var(--app-radius-lg);
  background: var(--app-accent-subtle);
}
.bulk-bar .form-select { width: auto; min-width: 12rem; }
@media (max-width: 575.98px) {
  .bulk-bar { position: sticky; bottom: 0.5rem; z-index: 5; box-shadow: var(--app-shadow-overlay); }
  .bulk-bar .form-select { flex: 1 1 100%; }
}
.users-table .col-check { width: 2.5rem; padding-right: 0 !important; }
.users-table tr.is-selected > * { background: var(--app-accent-subtle); }
.users-table td { max-width: 16rem; }
.users-table .google-email { max-width: 12rem; margin-top: 0.125rem; }
.user-card-row.is-selected { border-color: color-mix(in srgb, var(--app-accent) 45%, var(--app-border)); }
.sort-link { display: inline-flex; align-items: center; gap: 0.25rem; color: inherit; white-space: nowrap; }
.sort-link .bi { font-size: 0.75rem; color: var(--app-text-muted); opacity: 0.6; }
.sort-link.is-active .bi { opacity: 1; color: var(--app-accent-fg); }
.sort-link:hover { text-decoration: none; color: var(--app-accent-fg); }
.rights-icons { display: inline-flex; gap: 0.25rem; }
.right-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.5rem;
  height: 1.5rem;
  border-radius: var(--app-radius-sm);
  background: var(--app-accent-subtle);
  color: var(--app-accent-fg);
}

.card-tabs { border-bottom: 1px solid var(--app-border); flex-wrap: nowrap; overflow-x: auto; overflow-y: hidden; scrollbar-width: thin; gap: 0.125rem; }
.card-tabs .nav-link {
  border: 0;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  margin-bottom: -1px;
  padding: 0.625rem 0.75rem;
  color: var(--app-text-muted);
  white-space: nowrap;
}
.card-tabs .nav-link:hover { color: var(--app-text); }
.card-tabs .nav-link.active { color: var(--app-accent-fg); border-bottom-color: var(--app-accent); background: transparent; font-weight: 500; }
.user-card .tab-form { max-width: 46rem; }
.user-card .tab-content > .tab-pane { padding-top: 0.5rem; }

.role-matrix { min-width: 40rem; }
.role-matrix .matrix-perm { min-width: 15rem; font-weight: 400; }
/* The permission names stay in view while the roles scroll sideways. */
.role-matrix tbody .matrix-perm, .role-matrix thead .matrix-perm {
  position: sticky;
  left: 0;
  z-index: 1;
  background: var(--app-surface);
}
@media (max-width: 575.98px) {
  .role-matrix .matrix-perm { min-width: 10.5rem; max-width: 10.5rem; }
  .role-matrix .matrix-role { min-width: 7rem; }
}
.role-matrix .matrix-hint { font-size: 0.75rem; max-width: 26rem; }
.role-matrix .matrix-role { text-align: center; vertical-align: top; min-width: 8.5rem; }
.role-matrix .matrix-role-meta { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.375rem; margin-top: 0.25rem; font-weight: 400; }
.role-matrix .matrix-role-actions { display: flex; justify-content: center; gap: 0.125rem; margin-top: 0.25rem; }
.role-matrix .matrix-cell { text-align: center; }
.role-matrix .matrix-cell .form-check-input { width: 1.125rem; height: 1.125rem; float: none; margin: 0; }
.role-matrix .matrix-section th {
  background: var(--app-surface-2);
  color: var(--app-text-muted);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  padding-top: 0.5rem !important;
  padding-bottom: 0.5rem !important;
}

.dept-tree { list-style: none; margin: 0; padding: 0; }
.dept-tree .dept-tree { margin-left: 1.25rem; padding-left: 0.5rem; border-left: 1px solid var(--app-border); }
.dept-tree[hidden] { display: none; }
.dept-row {
  display: grid;
  grid-template-columns: 2rem minmax(0, 1fr) minmax(0, 14rem) 5.5rem;
  align-items: center;
  gap: 0.5rem;
  min-height: 2.75rem;
  padding: 0.25rem;
  border-radius: var(--app-radius);
}
.dept-row:hover { background: var(--app-surface-2); }
.dept-toggle .bi { transition: transform var(--app-transition); display: inline-block; }
.dept-toggle[aria-expanded="true"] .bi { transform: rotate(90deg); }
.dept-toggle-spacer { width: 2rem; }
.dept-title { display: flex; flex-wrap: wrap; align-items: center; gap: 0.25rem 0.5rem; min-width: 0; }
.dept-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dept-warning { flex-shrink: 0; white-space: nowrap; }
.dept-head { display: flex; align-items: center; gap: 0.375rem; min-width: 0; font-size: 0.8125rem; }
.dept-people { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
@media (max-width: 575.98px) {
  .dept-row { grid-template-columns: 2rem minmax(0, 1fr) auto; }
  .dept-head { grid-column: 2 / 4; grid-row: 2; }
}
.people-list { display: flex; flex-direction: column; }
.people-row { display: flex; align-items: center; gap: 0.75rem; padding: 0.5rem; border-radius: var(--app-radius); }
a.people-row:hover { background: var(--app-surface-2); text-decoration: none; }

.accent-preview { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; }
.accent-sample {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
  padding: 0.75rem;
  border-radius: var(--app-radius);
  border: 1px solid var(--app-border);
}
.accent-sample.sample-light { background: #ffffff; color: #18181b; border-color: #e5e5e9; }
.accent-sample.sample-dark { background: #161618; color: #ececef; border-color: #36363c; }
.accent-sample .sample-title { flex: 1 1 100%; font-size: 0.75rem; opacity: 0.75; }
.accent-sample .sample-button {
  padding: 0.25rem 0.625rem;
  border-radius: var(--app-radius-sm);
  background: var(--preview-accent);
  color: var(--preview-on-accent);
  font-weight: 500;
}
.accent-sample.sample-light .sample-link { color: var(--preview-fg-light); text-decoration: underline; }
.accent-sample.sample-dark .sample-link { color: var(--preview-fg-dark); text-decoration: underline; }
.accent-sample .sample-day {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 999px;
  background: var(--preview-accent);
  color: var(--preview-on-accent);
  font-size: 0.8125rem;
  font-weight: 600;
}
@media (max-width: 399.98px) { .accent-preview { grid-template-columns: 1fr; } }
.contrast-list { list-style: none; padding: 0; margin: 0.5rem 0 0; display: flex; flex-direction: column; gap: 0.125rem; font-size: 0.8125rem; color: var(--app-text-muted); }
.contrast-list li { display: flex; flex-wrap: wrap; align-items: center; gap: 0.375rem; }
.contrast-list strong { color: var(--app-text); font-variant-numeric: tabular-nums; }
.contrast-list .is-ok .bi { color: var(--app-success); }
.contrast-list .is-bad { color: color-mix(in srgb, var(--prio-critical) var(--prio-fg-ratio), var(--prio-mix-fg)); }
/* Company settings, Mail: the recipient field grows, the button wraps below on phones. */
.test-email-to { flex: 1 1 16rem; width: auto; min-width: 0; }

.audit-action { white-space: nowrap; }
.audit-action.tone-danger {
  background: color-mix(in srgb, var(--prio-critical) 14%, var(--app-surface));
  color: color-mix(in srgb, var(--prio-critical) var(--prio-fg-ratio), var(--prio-mix-fg));
}
.audit-action.tone-success {
  background: color-mix(in srgb, var(--app-success) 14%, var(--app-surface));
  color: color-mix(in srgb, var(--app-success) var(--prio-fg-ratio), var(--prio-mix-fg));
}
.audit-details { font-size: 0.8125rem; color: var(--app-text-muted); overflow-wrap: anywhere; }
.audit-table td { vertical-align: top; }

/* AI assistant usage on phones: one card per user (the table from md up). */
.usage-card { display: flex; flex-direction: column; gap: 0.5rem; padding: 0.75rem; border: 1px solid var(--app-border); border-radius: var(--app-radius); }
.usage-card.is-total { background: var(--app-surface-2); }
.usage-counts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.375rem 1rem; margin: 0; }
.usage-counts dt { font-weight: 400; color: var(--app-text-muted); font-size: 0.75rem; }
.usage-counts dd { margin: 0; font-variant-numeric: tabular-nums; }

/* Settings: working hours grid (one row per weekday), logo and accent fields. */
.wh-row {
  display: grid;
  grid-template-columns: 10.5rem 1fr;
  align-items: center;
  gap: 0.25rem 1rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--app-border);
}
.wh-row:first-child { padding-top: 0; }
.wh-row:last-child { border-bottom: 0; padding-bottom: 0; }
.wh-day { margin: 0; }
.wh-times { display: flex; align-items: center; gap: 0.5rem; grid-column: 2; grid-row: 1; }
.wh-times .form-control { width: 7.5rem; }
.wh-sep { color: var(--app-text-muted); }
.wh-off-label { grid-column: 2; grid-row: 1; color: var(--app-text-muted); }
.wh-row.is-off .wh-times { display: none; }
.wh-error { grid-column: 1 / -1; margin-top: 0; }
@media (max-width: 575.98px) {
  .wh-row { grid-template-columns: 1fr; }
  .wh-times, .wh-off-label { grid-column: 1; grid-row: auto; }
  .wh-times .form-control { flex: 1 1 0; width: auto; min-width: 0; }
}
.wh-summary { gap: 0.25rem 1rem; }
.logo-field { display: flex; align-items: center; gap: 1rem; }
.logo-preview {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 7.5rem;
  height: 3.5rem;
  padding: 0.5rem;
  border: 1px dashed var(--app-border-strong);
  border-radius: var(--app-radius);
  background: var(--app-surface-2);
}
.logo-preview img { max-width: 100%; max-height: 2.5rem; }
/* File picker: a visually hidden input followed by a button-styled label. */
.file-picker { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; min-width: 0; }
.file-picker input:focus-visible + label { box-shadow: 0 0 0 3px var(--app-accent-ring); }
.file-picker-name { min-width: 0; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.form-control-color { width: 3rem; height: 2.25rem; padding: 0.25rem; }
.accent-value { color: var(--app-text-muted); font-size: 0.8125rem; }

/* Tom Select (searchable selects) aligned with the form controls. */
.ts-wrapper .ts-control { border-color: var(--app-border-strong); border-radius: var(--app-radius); background: var(--app-surface); padding: 0.4375rem 0.75rem; font-size: 0.875rem; }
.ts-wrapper.focus .ts-control { border-color: var(--app-accent); box-shadow: 0 0 0 3px var(--app-accent-ring); }
.ts-dropdown { border-color: var(--app-border); border-radius: var(--app-radius); background: var(--app-surface); color: var(--app-text); box-shadow: var(--app-shadow-overlay); font-size: 0.875rem; }
.ts-dropdown .active { background: var(--app-accent-subtle); color: var(--app-text); }
/* Stage 10.6.1: a list put on the page (the task form's pickers) floats over the modal. */
body > .ts-dropdown { z-index: 1070; margin: 0; }

/* ---------------------------------------------------------- FullCalendar */

.fc {
  --fc-border-color: var(--app-border);
  --fc-page-bg-color: var(--app-surface);
  --fc-neutral-bg-color: var(--app-surface-2);
  --fc-neutral-text-color: var(--app-text-muted);
  --fc-today-bg-color: var(--app-accent-subtle);
  --fc-now-indicator-color: var(--app-accent);
  --fc-highlight-color: var(--app-accent-ring);
  --fc-non-business-color: color-mix(in srgb, var(--app-surface-2) 60%, transparent);
  --fc-event-border-color: transparent;
  --fc-event-selected-overlay-color: color-mix(in srgb, var(--app-text) 8%, transparent);
  --fc-small-font-size: 0.75rem;
  --fc-button-text-color: var(--app-text);
  --fc-button-bg-color: var(--app-surface);
  --fc-button-border-color: var(--app-border-strong);
  --fc-button-hover-bg-color: var(--app-surface-2);
  --fc-button-hover-border-color: var(--app-border-strong);
  --fc-button-active-bg-color: var(--app-surface-2);
  --fc-button-active-border-color: var(--app-border-strong);
  font-size: 0.8125rem;
}

/* The surface draws the outer frame; FullCalendar keeps only the inner grid lines. */
.calendar-surface .fc .fc-scrollgrid { border-width: 0; }
.calendar-surface .fc .fc-scrollgrid-section > * { border-right-width: 0; }
.calendar-surface .fc .fc-scrollgrid-section:last-child > * { border-bottom-width: 0; }

.fc .fc-col-header-cell { background: var(--app-surface); }
.fc .fc-col-header-cell-cushion {
  display: inline-block;
  padding: 0.5rem 0.25rem;
  color: var(--app-text-muted);
  font-size: 0.75rem;
  font-weight: 500;
}
/* Ukrainian weekday names are lower case ("понеділок"): capitalised as headers. */
.fc .fc-col-header-cell-cushion::first-letter { text-transform: uppercase; }
.fc .fc-col-header-cell.fc-day-today .fc-col-header-cell-cushion { color: var(--app-accent-fg); font-weight: 600; }
.fc a.fc-col-header-cell-cushion,
.fc a.fc-daygrid-day-number { color: inherit; text-decoration: none; }
.fc .fc-daygrid-day-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.625rem;
  height: 1.625rem;
  margin: 0.25rem 0.25rem 0;
  padding: 0 0.375rem;
  border-radius: 999px;
  color: var(--app-text);
  font-size: 0.8125rem;
  font-variant-numeric: tabular-nums;
}
.fc .fc-day-today .fc-daygrid-day-number { background: var(--app-accent); color: var(--app-on-accent); font-weight: 600; }
.fc .fc-daygrid-day.fc-day-today { background: transparent; }
.fc .fc-timegrid-col.fc-day-today { background: color-mix(in srgb, var(--app-accent) 4%, transparent); }
.fc .fc-timegrid-slot { height: 1.75rem; }
.fc .fc-timegrid-slot-label-cushion,
.fc .fc-timegrid-axis-cushion { color: var(--app-text-muted); font-size: 0.75rem; font-variant-numeric: tabular-nums; }
.fc .fc-daygrid-more-link { color: var(--app-text-muted); font-size: 0.75rem; font-weight: 500; }
.fc .fc-daygrid-more-link:hover { color: var(--app-text); background: var(--app-surface-2); }
.fc .fc-popover { border-radius: var(--app-radius-lg); box-shadow: var(--app-shadow-overlay); overflow: hidden; }
.fc .fc-popover-header { background: var(--app-surface-2); padding: 0.375rem 0.625rem; font-size: 0.8125rem; font-weight: 500; }
.fc .fc-highlight { background: var(--app-accent-subtle); }

/* Events: compact boxes with a priority stripe on the left. */
.fc .gm-event {
  --fc-event-bg-color: var(--prio-bg);
  --fc-event-text-color: var(--prio-fg);
  background: var(--prio-bg);
  color: var(--prio-fg);
  border: 0;
  border-left: 3px solid var(--prio);
  border-radius: var(--app-radius-sm);
  font-size: 0.75rem;
  line-height: 1.35;
  cursor: pointer;
  transition: background-color var(--app-transition);
}
.fc .gm-event:hover { background: color-mix(in srgb, var(--prio) 22%, var(--app-surface)); }
.fc .gm-event:focus-visible { outline: 2px solid var(--app-accent-fg); outline-offset: 1px; }
.fc .gm-event .fc-event-main { color: inherit; padding: 0; }
.fc .fc-daygrid-event.gm-event { margin: 1px 4px 2px; }
.fc .fc-timegrid-event.gm-event { box-shadow: 0 0 0 1px var(--app-surface); }
.gm-event-body { display: flex; align-items: baseline; gap: 0.375rem; min-width: 0; padding: 0.125rem 0.375rem; overflow: hidden; }
.gm-event-meta { display: inline-flex; flex: 0 0 auto; align-items: baseline; gap: 0.375rem; min-width: 0; }
.gm-event-time { flex: 0 0 auto; font-weight: 600; font-variant-numeric: tabular-nums; }
/* A private meeting: only the lock (its words are visually hidden), the room goes to the title. */
.gm-event-private { display: inline-flex; flex: 0 0 auto; align-items: baseline; }
.gm-event-private .bi { font-size: 0.6875rem; }
.gm-event-title { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gm-event-meet { flex: 0 0 auto; font-size: 0.75rem; }
.fc-timegrid-event .gm-event-body { position: relative; flex-direction: column; align-items: stretch; gap: 0; height: 100%; padding: 0.1875rem 0.375rem; }
.fc-timegrid-event .gm-event-body.has-meet { padding-right: 1.375rem; }
@media (max-width: 575.98px) {
  /* Week columns are too narrow on phones: the card shows the Meet link instead. */
  .fc-timeGridWeek-view .gm-event-meet { display: none; }
  .fc-timeGridWeek-view .gm-event-body.has-meet { padding-right: 0.375rem; }
}
.fc-timegrid-event .gm-event-title { font-weight: 500; white-space: normal; }
.fc-timegrid-event .gm-event-meet { position: absolute; top: 0.25rem; right: 0.375rem; }
.fc-timegrid-event-short .gm-event-body { flex-direction: row; align-items: baseline; gap: 0.375rem; }
.fc-timegrid-event-short .gm-event-title { white-space: nowrap; }
/* Past meetings: grey and dimmed; not draggable (the API marks them read-only). */
.fc .gm-event.is-past { --prio: var(--prio-low); opacity: 0.6; }
.fc .gm-event.is-past:hover { opacity: 0.8; }
.fc .fc-event-mirror.gm-event { opacity: 0.85; }
/* SPEC 5.6: an event follows my own answer. Yes (and my own meetings, and meetings I am not
   invited to): filled; no answer yet: only the outline; maybe: striped; no: pale, struck. */
.fc .gm-event.rsvp-needs-action {
  background: var(--app-surface);
  box-shadow: inset 0 0 0 1px var(--prio), 0 0 0 1px var(--app-surface);
}
.fc .gm-event.rsvp-needs-action:hover { background: color-mix(in srgb, var(--prio) 10%, var(--app-surface)); }
.fc .gm-event.rsvp-tentative {
  background: repeating-linear-gradient(135deg, var(--prio-bg) 0 6px, var(--app-surface) 6px 12px);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--prio) 45%, transparent), 0 0 0 1px var(--app-surface);
}
.fc .gm-event.rsvp-tentative:hover {
  background: repeating-linear-gradient(
    135deg,
    color-mix(in srgb, var(--prio) 22%, var(--app-surface)) 0 6px,
    var(--app-surface) 6px 12px
  );
}
.fc .gm-event.rsvp-declined {
  background: var(--app-surface);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--prio) 35%, transparent), 0 0 0 1px var(--app-surface);
  opacity: 0.6;
}
.fc .gm-event.rsvp-declined:hover { opacity: 0.8; }
.fc .gm-event.rsvp-declined .gm-event-title { text-decoration: line-through; }

/* ------------------------------------------------------------ calendar page */

.calendar-shell { flex: 0 0 auto; height: calc(100dvh - var(--app-topbar-height)); min-height: 32rem; }
.calendar-main { min-height: 0; padding: 1rem 1.25rem 1.25rem; }
@media (max-width: 575.98px) { .calendar-main { padding: 0.75rem; } }

.cal-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1rem;
  margin-bottom: 0.75rem;
}
.cal-toolbar-nav,
.cal-toolbar-actions { display: flex; align-items: center; gap: 0.5rem; min-width: 0; }
.cal-title { margin: 0 0 0 0.25rem; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-title::first-letter { text-transform: uppercase; }
@media (max-width: 575.98px) {
  .cal-toolbar-nav,
  .cal-toolbar-actions { flex: 1 1 100%; }
  .cal-toolbar-actions { justify-content: space-between; }
}

.calendar-surface {
  flex: 1 1 auto;
  min-height: 0;
  background: var(--app-surface);
  border: 1px solid var(--app-border);
  border-radius: var(--app-radius-lg);
  overflow: hidden;
}
#calendar { height: 100%; }

/* Segmented control: view switch, "All / Mine". */
.segmented {
  display: inline-flex;
  gap: 2px;
  padding: 2px;
  border: 1px solid var(--app-border);
  border-radius: var(--app-radius);
  background: var(--app-surface-2);
}
.segmented-option {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.25rem 0.75rem;
  border: 0;
  border-radius: calc(var(--app-radius) - 2px);
  background: transparent;
  color: var(--app-text-muted);
  font-size: 0.8125rem;
  font-weight: 500;
  line-height: 1.5;
  cursor: pointer;
  transition: color var(--app-transition), background-color var(--app-transition);
}
.segmented-option:hover { color: var(--app-text); }
.segmented-option.active,
.btn-check:checked + .segmented-option {
  background: var(--app-surface);
  color: var(--app-text);
  box-shadow: 0 0 0 1px var(--app-border-strong);
}
.segmented-option:focus-visible,
.btn-check:focus-visible + .segmented-option { outline: 0; box-shadow: 0 0 0 3px var(--app-accent-ring); }

/* Sidebar filters: checkboxes (meeting scope and priority); nothing checked = all. */
.calendar-filters fieldset { min-width: 0; margin: 0; padding: 0; border: 0; }
.calendar-filters legend { float: none; width: auto; }
.filter-check { display: flex; align-items: center; gap: 0.5rem; padding: 0.3125rem 0; }
.filter-check .form-check-input { float: none; flex: 0 0 auto; margin: 0; }
.filter-check .form-check-label { display: inline-flex; align-items: center; gap: 0.5rem; cursor: pointer; }
.prio-dot { flex: 0 0 auto; width: 0.5rem; height: 0.5rem; border-radius: 50%; background: var(--prio); }
.sidebar-note { padding-top: 1.25rem; border-top: 1px solid var(--app-border); }

/* Quick meeting (SPEC 5.7): the button under the time zone and its toast. */
.quick-meet-button { display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem; }
.quick-meet-button.is-busy { cursor: progress; }
.quick-meet-hint { margin-top: 0.5rem; }
.quick-meet-toast .quick-meet-title { margin-bottom: 0.5rem; font-weight: 500; }
.quick-meet-toast .quick-meet-link { margin-bottom: 0.5rem; font-family: var(--bs-font-monospace); font-size: 0.75rem; user-select: all; }
.quick-meet-toast .quick-meet-connect { display: inline-block; margin-top: 0.25rem; }
.quick-meet-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; }

/* ------------------------------------------------------------ meeting form */

.meeting-form .form-label { font-size: 0.8125rem; }
/* A <legend> used as a field label looks like the other labels. */
legend.form-label { float: none; width: auto; font-size: 0.875rem; font-weight: 500; }
.meeting-form legend.form-label { font-size: 0.8125rem; }
/* Shown by Alpine (x-show): no !important display, unlike .d-block. */
.invalid-feedback.is-visible { display: block; }
.next-day { margin-top: 0.25rem; }
.organizer-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
  margin-bottom: 0.5rem;
  color: var(--app-text-muted);
  font-size: 0.8125rem;
}
.organizer-row .fw-medium { color: var(--app-text); }
.person-option { display: flex; align-items: center; gap: 0.625rem; min-width: 0; }
.person-name { font-weight: 500; }
.person-meta { color: var(--app-text-muted); font-size: 0.75rem; }
.person-chip { display: inline-flex; align-items: center; gap: 0.375rem; }
/* External guests (SPEC 5.5): an envelope instead of an avatar, a dashed outline and the
   mark "external" (picker options, chips, the meeting card). */
.avatar-guest { border: 1px dashed var(--app-border-strong); background: var(--app-surface-2); color: var(--app-text-muted); }
.avatar-guest .bi { font-size: 0.875em; }
.badge-guest {
  display: inline-flex;
  align-items: center;
  margin-left: 0.25rem;
  padding: 0 0.375rem;
  border: 1px solid var(--app-border-strong);
  border-radius: 999px;
  color: var(--app-text-muted);
  font-size: 0.6875rem;
  font-weight: 500;
  line-height: 1.125rem;
  vertical-align: middle;
  white-space: nowrap;
}
.person-chip.is-guest .badge-guest { margin-left: 0; }
.ts-wrapper.multi .ts-control > .item.is-guest { border-style: dashed; }
.ts-dropdown .create.is-guest::before { content: "\f32f"; margin-right: 0.375rem; font-family: "bootstrap-icons"; }
.new-guests {
  margin-top: 0.5rem;
  padding: 0.5rem 0.625rem;
  border: 1px dashed var(--app-border-strong);
  border-radius: var(--app-radius);
}
.new-guests-title { margin-bottom: 0.375rem; color: var(--app-text-muted); font-size: 0.75rem; font-weight: 500; }
.new-guest-row { display: flex; flex-wrap: wrap; align-items: center; gap: 0.375rem 0.5rem; }
.new-guest-row + .new-guest-row { margin-top: 0.375rem; }
.new-guest-email { flex: 1 1 10rem; min-width: 0; font-size: 0.8125rem; overflow-wrap: anywhere; }
.new-guest-row .form-control { flex: 1 1 9rem; width: auto; min-width: 0; }
@media (max-width: 575.98px) { .new-guest-email { flex-basis: 100%; } }
.ts-wrapper.multi .ts-control { gap: 0.25rem; padding: 0.3125rem 0.5rem; min-height: 2.375rem; }
.ts-wrapper.multi .ts-control > .item {
  display: inline-flex;
  align-items: center;
  margin: 0;
  padding: 0.0625rem 0.25rem 0.0625rem 0.125rem;
  border: 1px solid var(--app-border);
  border-radius: 999px;
  background: var(--app-surface-2);
  color: var(--app-text);
  font-size: 0.8125rem;
}
.ts-wrapper.multi .ts-control > .item.active { border-color: var(--app-accent); background: var(--app-accent-subtle); color: var(--app-text); }
.ts-wrapper.plugin-remove_button:not(.rtl) .item .remove {
  margin-left: 0.125rem;
  padding: 0 0.3125rem;
  border: 0;
  border-radius: 999px;
  color: var(--app-text-muted);
}
.ts-wrapper.plugin-remove_button .item .remove:hover { background: transparent; color: var(--prio-critical); }
.participants-select.is-invalid + .ts-wrapper .ts-control { border-color: var(--prio-critical); }
.ts-wrapper .ts-control input { color: var(--app-text); }
.ts-dropdown .option { padding: 0.375rem 0.625rem; }
/* User picker (static/js/user-picker.js): groups by department, indented by depth. */
.ts-dropdown .ts-dropdown-content { max-height: 20rem; }
.ts-dropdown .optgroup { --depth: 0; }
.ts-dropdown .optgroup::before { margin: 0.25rem 0; border-color: var(--app-border); }
.ts-dropdown .optgroup-header {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 0.5rem 0.625rem 0.25rem calc(0.625rem + var(--depth) * 0.875rem);
  background: var(--app-surface);
  color: var(--app-text);
  font-size: 0.75rem;
  font-weight: 600;
}
.ts-dropdown .optgroup-parents { color: var(--app-text-muted); font-weight: 400; }
.ts-dropdown .optgroup .option { padding-left: calc(0.625rem + var(--depth) * 0.875rem); }
.ts-dropdown .create,
.ts-dropdown .no-results { padding: 0.5rem 0.625rem; color: var(--app-text-muted); }
/* Stage 10.8: the task form's pickers list everyone at once; the chosen responsible person is
   marked with a check (only these lists have .is-browse). */
.ts-dropdown.is-browse .person-option.selected::after {
  content: "\f272"; /* bi-check2 */
  margin-left: auto;
  color: var(--app-accent);
  font-family: "bootstrap-icons";
  font-size: 1.125rem;
}
.ts-dropdown.is-browse .person-option.selected .person-name { color: var(--app-accent); }
.dept-menu { max-height: 16rem; min-width: 15rem; max-width: min(26rem, calc(100vw - 2rem)); overflow-y: auto; }
.dept-menu .dropdown-item { padding-left: calc(0.625rem + var(--depth, 0) * 1rem); }
/* The parents of a department (SPEC 2: from the organization), like the picker's group headers. */
.dept-menu .dept-parents { color: var(--app-text-muted); }
.dept-menu .dropdown-item:active .dept-parents { color: inherit; }
.dept-count { color: var(--app-text-muted); font-size: 0.75rem; font-variant-numeric: tabular-nums; }
.local-times {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  margin: 0.5rem 0 0;
  padding: 0.5rem 0.75rem;
  list-style: none;
  border-radius: var(--app-radius);
  background: var(--app-surface-2);
  color: var(--app-text-muted);
  font-size: 0.8125rem;
}
.local-times li { display: flex; align-items: baseline; gap: 0.5rem; }
.local-times .fw-medium { color: var(--app-text); }

/* Availability (SPEC 6): status line, common free slots, conflicts toast. The status region
   stays in the DOM (live region); only its lines are toggled. */
.availability-status { color: var(--app-text-muted); font-size: 0.8125rem; }
.availability-line { display: flex; align-items: baseline; gap: 0.5rem; margin: 0.5rem 0 0; line-height: 1.4; }
.availability-line > span:last-child { min-width: 0; }
.availability-line .bi { flex: 0 0 auto; font-size: 0.875rem; }
.availability-line .spinner-border {
  --bs-spinner-width: 0.875rem;
  --bs-spinner-height: 0.875rem;
  --bs-spinner-border-width: 0.125rem;
  flex: 0 0 auto;
  align-self: center;
}
.availability-line.is-free { color: var(--app-success-fg); font-weight: 500; }
.availability-line.is-free .bi { color: var(--app-success); }
.availability-line.is-conflicts { color: var(--app-text); }
.availability-line.is-conflicts .bi { color: var(--prio-high); }
.availability-details {
  padding: 0;
  border: 0;
  background: none;
  color: var(--app-accent-fg);
  font: inherit;
  font-weight: 500;
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}
.availability-details:hover { color: var(--app-accent-hover); }
.common-slots { margin-top: 0.5rem; }
.common-slots-label { margin-bottom: 0.375rem; color: var(--app-text-muted); font-size: 0.75rem; font-weight: 500; }
.common-slots-list { display: flex; flex-wrap: wrap; gap: 0.375rem; transition: opacity var(--app-transition); }
.common-slots[aria-busy="true"] .common-slots-list { opacity: 0.6; }
.common-slots-empty { color: var(--app-text-muted); font-size: 0.8125rem; }
.slot-chip {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  padding: 0.25rem 0.625rem;
  border: 1px solid var(--app-border-strong);
  border-radius: var(--app-radius);
  background: var(--app-surface);
  color: var(--app-text);
  font-size: 0.8125rem;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  line-height: 1.5;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color var(--app-transition), border-color var(--app-transition), color var(--app-transition);
}
.slot-chip:hover { background: var(--app-surface-2); }
.slot-chip.active { border-color: var(--app-accent); background: var(--app-accent-subtle); color: var(--app-accent-fg); }
.slot-chip:focus-visible { outline: 0; box-shadow: 0 0 0 3px var(--app-accent-ring); }

.availability-toast { --bs-toast-max-width: 400px; }
.availability-toast-title { margin: 0 0 0.5rem; font-weight: 600; }
.availability-people {
  display: grid;
  gap: 0.75rem;
  max-height: min(55vh, 24rem);
  margin: 0;
  padding: 0;
  overflow-y: auto;
  list-style: none;
}
.availability-person { --avatar-gap: 0.5rem; min-width: 0; }
.availability-person-head { display: flex; align-items: center; gap: var(--avatar-gap); min-width: 0; font-weight: 500; }
.availability-person-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* Conflicts and free time are indented under the name (avatar-24 + gap). */
.availability-conflicts { margin: 0.25rem 0 0; padding: 0 0 0 calc(1.5rem + var(--avatar-gap)); list-style: none; }
.availability-conflict { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 0.25rem; }
.availability-conflict::before {
  content: "";
  flex: 0 0 auto;
  align-self: center;
  width: 0.4375rem;
  height: 0.4375rem;
  margin-right: 0.125rem;
  border-radius: 50%;
  background: var(--prio-critical);
}
.availability-conflict[data-type="outside_working_hours"]::before { background: var(--prio-high); }
.availability-time { font-weight: 500; font-variant-numeric: tabular-nums; }
.availability-free {
  margin: 0.25rem 0 0;
  padding-left: calc(1.5rem + var(--avatar-gap));
  color: var(--app-text-muted);
  font-size: 0.8125rem;
  font-variant-numeric: tabular-nums;
}
.prio-picker { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.prio-option {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.3125rem 0.75rem;
  border: 1px solid var(--app-border-strong);
  border-radius: var(--app-radius);
  background: var(--app-surface);
  color: var(--app-text);
  font-size: 0.8125rem;
  font-weight: 500;
  cursor: pointer;
  transition: background-color var(--app-transition), border-color var(--app-transition);
}
.prio-option:hover { background: var(--app-surface-2); }
.btn-check:checked + .prio-option { border-color: var(--prio); background: var(--prio-bg); color: var(--prio-fg); }
.btn-check:focus-visible + .prio-option { box-shadow: 0 0 0 3px var(--app-accent-ring); }
.meeting-switches {
  display: grid;
  gap: 0.75rem;
  padding: 0.875rem 1rem;
  border: 1px solid var(--app-border);
  border-radius: var(--app-radius);
}
.meeting-switches .form-check-input:disabled ~ .form-check-label { opacity: 0.6; }
@media (min-width: 768px) { .meeting-switches { grid-template-columns: 1fr 1fr; gap: 1.5rem; } }

/* ------------------------------------------------------------ meeting card */

.meeting-facts { display: grid; gap: 0.625rem; margin: 0 0 1rem; padding: 0; list-style: none; }
.meeting-facts li { display: flex; align-items: flex-start; gap: 0.75rem; }
.meeting-facts .bi { flex: 0 0 auto; color: var(--app-text-muted); font-size: 1rem; line-height: 1.3; }
/* SPEC 4: «Приєднатися до Google Meet» under the time, the full width of the card; the copy
   button beside it; the manual-copy field (shown only when the clipboard refuses) below. */
.meeting-facts li.meeting-join { flex-wrap: wrap; align-items: stretch; gap: 0.5rem; margin: 0.125rem 0; }
.meeting-join .bi { color: inherit; line-height: 1; }
.meeting-join-button {
  display: inline-flex;
  flex: 1 1 0;
  align-items: center;
  justify-content: center;
  min-width: 0;
  min-height: 2.5rem;
  font-weight: 600;
}
.meeting-join .meeting-join-copy { width: 2.5rem; height: auto; min-height: 2.5rem; flex: 0 0 auto; }
.meeting-join-link { flex: 1 1 100%; }
@media (max-width: 575.98px) {
  .meeting-join-button { min-height: 2.75rem; }
  .meeting-join .meeting-join-copy { width: 2.75rem; min-height: 2.75rem; }
}
.meeting-description {
  margin-bottom: 1rem;
  padding: 0.75rem 1rem;
  border-radius: var(--app-radius);
  background: var(--app-surface-2);
  overflow-wrap: anywhere;
}
.meeting-section-title { margin-bottom: 0.5rem; color: var(--app-text-muted); font-size: 0.75rem; font-weight: 500; }
.participant-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(13rem, 1fr));
  gap: 0.625rem 1rem;
  margin: 0;
  padding: 0;
  list-style: none;
}
.participant-list li { display: flex; align-items: center; gap: 0.625rem; min-width: 0; }
.participant-list + .meeting-section-title { margin-top: 1rem; }

/* SPEC 5.6: answers to invitations in the card. The words next to each icon carry the
   meaning (never the colour alone). */
.rsvp-summary,
.rsvp-paused { margin-bottom: 0.75rem; color: var(--app-text-muted); font-size: 0.8125rem; }
.rsvp-paused .bi { color: var(--prio-high); }
.avatar-rsvp { position: relative; display: inline-flex; flex: 0 0 auto; }
.rsvp-badge {
  position: absolute;
  right: -0.3125rem;
  bottom: -0.3125rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 0.9375rem;
  height: 0.9375rem;
  border-radius: 50%;
  background: var(--app-surface);
  box-shadow: 0 0 0 1.5px var(--app-surface);
  color: var(--app-text-muted);
  font-size: 0.8125rem;
  line-height: 1;
}
.rsvp-badge .bi { line-height: 1; }
.rsvp-badge.is-accepted { color: var(--app-success); }
.rsvp-badge.is-declined { color: var(--prio-critical); }
.rsvp-badge.is-tentative { color: var(--prio-high); }
.meeting-rsvp { padding: 0.75rem var(--bs-modal-padding); border-top: 1px solid var(--app-border); }
.meeting-rsvp-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.5rem 1rem; }
.meeting-rsvp-label { font-weight: 500; }
.rsvp-buttons { display: inline-flex; gap: 0.375rem; }
.rsvp-button {
  --bs-btn-color: var(--app-text);
  --bs-btn-bg: var(--app-surface);
  --bs-btn-border-color: var(--app-border-strong);
  --bs-btn-hover-color: var(--app-text);
  --bs-btn-hover-bg: var(--app-surface-2);
  --bs-btn-hover-border-color: var(--app-border-strong);
  --bs-btn-active-color: var(--app-accent-fg);
  --bs-btn-active-bg: var(--app-accent-subtle);
  --bs-btn-active-border-color: var(--app-accent-fg);
  --bs-btn-disabled-color: var(--app-text-muted);
  --bs-btn-disabled-bg: var(--app-surface);
  --bs-btn-disabled-border-color: var(--app-border);
  min-width: 4.5rem;
}
.rsvp-button.active { font-weight: 600; }
.meeting-rsvp-note { margin: 0.5rem 0 0; color: var(--app-text-muted); font-size: 0.8125rem; }
@media (max-width: 575.98px) {
  .rsvp-buttons { display: grid; grid-template-columns: repeat(3, 1fr); width: 100%; }
}

/* ------------------------------------------------------------ motion / a11y */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

/* ---------------------------------------------------------- Google (SPEC 7) */

/* The permanent banner under the top bar while Google is not connected. */
.google-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.875rem;
  padding: 0.5rem 1rem;
  background: var(--app-accent-subtle);
  border-bottom: 1px solid color-mix(in srgb, var(--app-accent) 22%, var(--app-surface));
  font-size: 0.875rem;
}
.google-banner.is-reconnect {
  background: color-mix(in srgb, var(--prio-high) 12%, var(--app-surface));
  border-bottom-color: color-mix(in srgb, var(--prio-high) 30%, var(--app-surface));
}
.google-banner-icon { flex: 0 0 auto; color: var(--app-accent-fg); font-size: 1rem; }
.google-banner.is-reconnect .google-banner-icon { color: var(--prio-high); }
.google-banner-text { flex: 1 1 16rem; margin: 0; min-width: 0; }
.google-banner-actions { display: flex; align-items: center; gap: 0.375rem; margin-left: auto; }
.google-banner-actions form { margin: 0; }

/* ------------------------------------------- browser notifications (SPEC 4.1) */

/* The calendar's one-time hint while the browser was never asked for the permission. */
.notify-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.875rem;
  margin-bottom: 0.75rem;
  padding: 0.5rem 0.75rem 0.5rem 1rem;
  background: var(--app-accent-subtle);
  border: 1px solid color-mix(in srgb, var(--app-accent) 22%, var(--app-surface));
  border-radius: var(--app-radius-lg);
  font-size: 0.875rem;
}
.notify-banner[hidden] { display: none; }
.notify-banner-icon { flex: 0 0 auto; color: var(--app-accent-fg); font-size: 1rem; }
.notify-banner-text { flex: 1 1 16rem; margin: 0; min-width: 0; }
.notify-banner-actions { display: flex; align-items: center; gap: 0.5rem; margin-left: auto; }
.notify-banner-actions .btn-close { width: 0.75rem; height: 0.75rem; padding: 0.375rem; }

/* Settings page: the browser's permission and the test button. */
.notify-state { display: flex; align-items: baseline; gap: 0.5rem; margin-bottom: 0.5rem; }
.notify-state .bi { flex: 0 0 auto; color: var(--app-text-muted); }
.notify-state.is-on .bi { color: var(--app-success); }
.notify-state.is-off .bi { color: var(--prio-high); }
.notify-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.notify-actions:not(:has(> :not([hidden]))) { display: none; }

/* The edit form: the meeting changed meanwhile (the fields stay as they are). */
.form-stale-note {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
  margin-bottom: 1rem;
  padding: 0.5rem 0.75rem;
  background: color-mix(in srgb, var(--prio-high) 12%, var(--app-surface));
  border: 1px solid color-mix(in srgb, var(--prio-high) 35%, var(--app-surface));
  border-radius: var(--app-radius);
  font-size: 0.875rem;
}
.form-stale-note[hidden] { display: none; }
.form-stale-note .bi { color: var(--prio-high); }
.form-stale-note span { flex: 1 1 12rem; min-width: 0; }

/* The calendar fills the height left under the top bar (and the banner, if any). */
.page-calendar { height: 100vh; height: 100dvh; }
.page-calendar .calendar-shell { flex: 1 1 0; height: auto; }

.menu-dot {
  width: 0.5rem;
  height: 0.5rem;
  margin-left: auto;
  border-radius: 50%;
  background: var(--prio-high);
}

.google-card h2 { display: flex; align-items: center; }
.google-note,
.google-question {
  padding: 0.75rem 0.875rem;
  border-radius: var(--app-radius);
  background: var(--app-surface-2);
}
.google-note { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 0.75rem; }
.google-note .bi { color: var(--prio-high); }
.google-note form { margin: 0; }
.google-question { border: 1px solid color-mix(in srgb, var(--app-accent) 30%, var(--app-surface)); background: var(--app-accent-subtle); }
.google-steps summary { cursor: pointer; font-weight: 500; }
.google-steps ol { margin: 0.625rem 0 0.5rem; padding-left: 1.25rem; }
.google-steps li + li { margin-top: 0.25rem; }
/* «Як підключити» of «Підключені AI-асистенти» (SPEC 16.5, stage 11.2). */
.mcp-howto-title { font-size: 0.875rem; font-weight: 600; margin: 1rem 0 0; }
.mcp-command {
  display: flex; align-items: center; gap: 0.25rem; margin-top: 0.5rem;
  padding: 0.25rem 0.25rem 0.25rem 0.75rem; border: 1px solid var(--app-border);
  border-radius: var(--app-radius); background: var(--app-surface-2);
}
.mcp-command code { flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; color: var(--app-text); font-size: 0.8125rem; }
/* The MCP call log's filters (stage 11.2): one row from 1200 px; they wrap below. */
@media (min-width: 1200px) {
  .mcp-log-filters { flex-wrap: nowrap; }
  /* As wide as the chosen label, not the longest option (Chromium; elsewhere they shrink). */
  .mcp-log-filters .form-select { flex: 0 1 auto; width: auto; min-width: 0; max-width: 16rem; field-sizing: content; }
  .mcp-log-filters .filter-date, .mcp-log-filters .btn { flex: none; }
}

.google-required { display: flex; gap: 0.875rem; align-items: flex-start; }
.google-required-icon {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  background: var(--app-accent-subtle);
  color: var(--app-accent-fg);
  font-size: 1.125rem;
}

/* Sync state in the meeting card. */
.meeting-facts .sync-state.is-synced .bi { color: var(--app-success); }
.meeting-facts .sync-state.is-pending .bi { color: var(--prio-normal); }
.meeting-facts .sync-state.is-error .bi { color: var(--prio-high); }
.sync-error { margin-top: 0.125rem; color: var(--app-text-muted); font-size: 0.8125rem; overflow-wrap: anywhere; }
.meeting-facts .sync-retry { padding: 0; margin-top: 0.25rem; font-size: 0.8125rem; }
.meeting-facts .sync-retry .bi { color: inherit; font-size: inherit; }

.availability-line.is-google { color: var(--app-text-muted); }

/* SPEC 5.1.1: under "Meeting protocol": the public bot busy, an older conflict, the
   executive's bot busy (filled by the HTMX check of the form). */
.protocol-status:empty { display: none; }
.protocol-note { display: flex; align-items: baseline; gap: 0.5rem; margin: 0.25rem 0 0; font-size: 0.875em; line-height: 1.4; }
.protocol-note .bi { flex: 0 0 auto; font-size: 0.875rem; }
.protocol-note > span { min-width: 0; }
.protocol-note.is-busy,
.protocol-note.is-executive { color: var(--app-text); }
.protocol-note.is-busy .bi,
.protocol-note.is-executive .bi { color: var(--prio-high); }
.protocol-note.is-existing { color: var(--app-text-muted); }

/* ------------------------------------------------------ public pages (7.6) */

.public-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.25rem 1rem;
  margin-top: 1.25rem;
  color: var(--app-text-muted);
  font-size: 0.8125rem;
}
.public-footer-links { display: flex; gap: 0.5rem; }
.public-footer a { color: var(--app-text-muted); }
.public-footer a:hover { color: var(--app-text); }
.public-footer-languages { display: flex; gap: 0.25rem; margin: 0; }
.public-footer-languages .btn { padding: 0 0.25rem; color: var(--app-text-muted); font-size: inherit; text-decoration: none; }
.public-footer-languages .btn.active { color: var(--app-text); font-weight: 500; }
.auth-page { flex-direction: column; }

.legal-page { max-width: 46rem; }
.legal-text { padding: 2rem; line-height: 1.6; }
.legal-text h1 { margin-bottom: 0.25rem; }
.legal-text h2 { margin: 1.5rem 0 0.5rem; font-size: 1rem; }
.legal-text ul { padding-left: 1.25rem; }
.legal-text li + li { margin-top: 0.375rem; }
.legal-updated { color: var(--app-text-muted); font-size: 0.8125rem; }
.legal-table { margin: 0.5rem 0 1rem; font-size: 0.875rem; line-height: 1.5; }
.legal-table th { white-space: nowrap; }
.legal-table td:first-child { white-space: nowrap; }
.legal-table td { vertical-align: top; }
@media (max-width: 575.98px) {
  /* Phones: one card per scope instead of a wide table. */
  .legal-table thead { display: none; }
  .legal-table tr { display: block; padding: 0.5rem 0; border-bottom: 1px solid var(--app-border); }
  .legal-table td { display: block; padding: 0.125rem 0; border: 0; white-space: normal; }
}
@media (max-width: 575.98px) { .legal-text { padding: 1.25rem; } }

/* --------------------------------------------- public home page (12А.1) */

.landing { max-width: 56rem; padding: 1.5rem 0 0.5rem; }
.landing-hero { max-width: 40rem; margin: 0 auto 2rem; text-align: center; }
.landing-logo { width: 3rem; height: 3rem; margin-bottom: 1rem; font-size: 1.25rem; border-radius: 10px; }
.landing-hero h1 { font-size: 1.75rem; margin-bottom: 0.75rem; }
.landing-lead { color: var(--app-text-muted); font-size: 1rem; line-height: 1.6; margin-bottom: 1.5rem; }
.landing-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.5rem; }
.landing-note { margin: 1rem 0 0; color: var(--app-text-muted); font-size: 0.8125rem; }
.landing-features { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; margin-bottom: 1rem; }
.landing-feature .card-body { padding: 1.25rem; }
.landing-feature .bi { display: inline-flex; margin-bottom: 0.625rem; color: var(--app-accent-fg); font-size: 1.25rem; }
.landing-feature h2 { margin-bottom: 0.375rem; font-size: 1rem; }
.landing-feature p { margin: 0; color: var(--app-text-muted); line-height: 1.55; }
.landing-google .card-body { padding: 1.25rem 1.5rem; line-height: 1.6; }
.landing-google h2 { font-size: 1rem; margin-bottom: 0.5rem; }
.landing-google ul { padding-left: 1.25rem; margin-bottom: 0.75rem; }
.landing-google li + li { margin-top: 0.25rem; }
@media (max-width: 767.98px) {
  .landing { padding-top: 0.5rem; }
  .landing-features { grid-template-columns: minmax(0, 1fr); }
  .landing-hero h1 { font-size: 1.5rem; }
}

/* ------------------------------------------------ recurring meetings (5.4) */

.badge-recurring { background: var(--app-accent-subtle); color: var(--app-accent-fg); }
.fc .gm-event-repeat-icon { flex: 0 0 auto; font-size: 0.6875rem; }
.gm-event-repeat { display: none; color: inherit; font-size: 0.6875rem; opacity: 0.8; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fc-timegrid-event:not(.fc-timegrid-event-short) .gm-event-repeat { display: block; }

/* The "Custom…" dialog is drawn over the meeting form, inside the same modal. */
.recurrence-overlay {
  position: absolute;
  inset: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  border-radius: inherit;
  background: rgb(0 0 0 / 0.4);
}
.recurrence-dialog {
  display: flex;
  flex-direction: column;
  width: min(100%, 26rem);
  max-height: 100%;
  border: 1px solid var(--app-border);
  border-radius: var(--app-radius-lg);
  background: var(--app-surface);
  box-shadow: var(--app-shadow-overlay);
}
.recurrence-dialog-header,
.recurrence-dialog-footer { display: flex; align-items: center; gap: 0.5rem; padding: 0.875rem 1rem; }
.recurrence-dialog-header { justify-content: space-between; border-bottom: 1px solid var(--app-border); }
.recurrence-dialog-footer { justify-content: flex-end; border-top: 1px solid var(--app-border); }
.recurrence-dialog-body { display: grid; gap: 1rem; padding: 1rem; overflow-y: auto; }
.recurrence-every { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; }
.recurrence-every .form-control { width: 4.5rem; }
.recurrence-every .form-select { width: auto; min-width: 8rem; }
.recurrence-section { min-width: 0; margin: 0; padding: 0; border: 0; }
.recurrence-section legend { float: none; width: auto; margin-bottom: 0.375rem; }
.recurrence-section .form-check + .form-check { margin-top: 0.375rem; }
.recurrence-end-row { display: flex; flex-wrap: wrap; align-items: center; gap: 0.25rem 0.5rem; }
.recurrence-end-row .form-check-label { min-width: 3.5rem; }
.recurrence-end-row input[type="date"] { width: auto; }
.recurrence-end-row input[type="number"] { width: 4.5rem; }
.recurrence-unit { color: var(--app-text-muted); font-size: 0.875rem; }
.weekday-picker { display: flex; flex-wrap: wrap; gap: 0.375rem; }
.weekday-toggle {
  min-width: 2.375rem;
  height: 2.125rem;
  padding: 0 0.5rem;
  border: 1px solid var(--app-border-strong);
  border-radius: 999px;
  background: var(--app-surface);
  color: var(--app-text);
  font-size: 0.8125rem;
  font-weight: 500;
  cursor: pointer;
  transition: background-color var(--app-transition), border-color var(--app-transition), color var(--app-transition);
}
.weekday-toggle:hover { background: var(--app-surface-2); }
.weekday-toggle.active { border-color: var(--app-accent); background: var(--app-accent); color: var(--app-on-accent); }
.weekday-toggle:focus-visible { outline: 0; box-shadow: 0 0 0 3px var(--app-accent-ring); }
.recurrence-preview {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  margin: 0;
  padding: 0.5rem 0.75rem;
  border-radius: var(--app-radius);
  background: var(--app-surface-2);
  font-size: 0.8125rem;
}
.recurrence-preview .bi { color: var(--app-text-muted); }

/* "This meeting / This and following / All meetings". */
.scope-options { display: grid; gap: 0.5rem; }
.scope-option {
  display: flex;
  align-items: flex-start;
  gap: 0.625rem;
  padding: 0.625rem 0.75rem;
  border: 1px solid var(--app-border);
  border-radius: var(--app-radius);
  cursor: pointer;
  transition: background-color var(--app-transition), border-color var(--app-transition);
}
.scope-option:hover { background: var(--app-surface-2); }
.scope-option:has(input:checked) { border-color: var(--app-accent); background: var(--app-accent-subtle); }
.scope-option:has(input:disabled) { cursor: not-allowed; opacity: 0.65; }
.scope-option:has(input:disabled):hover { background: transparent; }
.scope-option .form-check-input { flex: 0 0 auto; margin: 0.1875rem 0 0; }
.scope-option-text { display: flex; flex-direction: column; gap: 0.125rem; min-width: 0; }
.scope-option-label { font-weight: 500; }
.scope-option-hint { color: var(--app-text-muted); font-size: 0.75rem; line-height: 1.4; }
.scope-option-hint:empty { display: none; }
.scope-confirm { display: flex; gap: 0.75rem; align-items: flex-start; }
.scope-confirm .bi { flex: 0 0 auto; color: var(--prio-critical); font-size: 1.125rem; line-height: 1.3; }

/* ------------------------------------------------------------ AI assistant */

/* The floating button (SPEC 7А.2): bottom right, above the page, below modals. */
.assistant-fab {
  position: fixed;
  right: 1.25rem;
  bottom: 1.25rem;
  z-index: 1030;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 3.25rem;
  height: 3.25rem;
  border: 0;
  border-radius: 50%;
  background: var(--app-accent);
  color: var(--app-on-accent);
  font-size: 1.375rem;
  box-shadow: var(--app-shadow-overlay);
  transition: background-color var(--app-transition), transform var(--app-transition);
}
.assistant-fab:hover { background: var(--app-accent-hover); }
.assistant-fab:focus-visible { outline: 0; box-shadow: 0 0 0 3px var(--app-accent-ring), var(--app-shadow-overlay); }
@media (max-width: 575.98px) { .assistant-fab { right: 1rem; bottom: 1rem; } }

.assistant-panel { --bs-offcanvas-width: 420px; }
@media (max-width: 575.98px) { .assistant-panel { --bs-offcanvas-width: 100vw; } }
.assistant-header { gap: 0.5rem; border-bottom: 1px solid var(--app-border); padding: 0.75rem 1rem; }
.assistant-header .offcanvas-title { display: flex; align-items: center; font-size: 1rem; font-weight: 600; }
.assistant-header .offcanvas-title .bi { color: var(--app-accent-fg); }
.assistant-header .btn-close { margin: 0; }

.assistant-log { display: flex; flex-direction: column; gap: 0.75rem; padding: 1rem; }

.assistant-empty { margin: auto 0; text-align: center; padding: 1rem 0.5rem; }
.assistant-empty-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 3rem;
  height: 3rem;
  margin-bottom: 0.75rem;
  border-radius: 50%;
  background: var(--app-accent-subtle);
  color: var(--app-accent-fg);
  font-size: 1.375rem;
}
.assistant-empty-title { font-size: 1.0625rem; font-weight: 600; margin-bottom: 0.375rem; }
.assistant-empty-text { color: var(--app-text-muted); margin: 0 auto 1rem; max-width: 22rem; }
.assistant-examples { display: grid; gap: 0.5rem; text-align: left; }
.assistant-example {
  display: flex;
  align-items: flex-start;
  gap: 0.625rem;
  width: 100%;
  padding: 0.625rem 0.75rem;
  border: 1px solid var(--app-border);
  border-radius: var(--app-radius);
  background: var(--app-surface);
  color: var(--app-text);
  text-align: left;
  transition: background-color var(--app-transition), border-color var(--app-transition);
}
.assistant-example:hover { background: var(--app-surface-2); border-color: var(--app-border-strong); }
.assistant-example:focus-visible { outline: 0; box-shadow: 0 0 0 3px var(--app-accent-ring); }
.assistant-example .bi { flex: 0 0 auto; color: var(--app-text-muted); margin-top: 0.125rem; }

.assistant-row { display: flex; flex-direction: column; align-items: flex-start; gap: 0.5rem; }
.assistant-row.is-user { align-items: flex-end; }
.assistant-bubble {
  max-width: 88%;
  padding: 0.5rem 0.75rem;
  border-radius: var(--app-radius-lg);
  background: var(--app-surface-2);
  overflow-wrap: anywhere;
}
.assistant-text { white-space: pre-wrap; }
.assistant-row.is-user .assistant-bubble { background: var(--app-accent-subtle); border-bottom-right-radius: var(--app-radius-sm); }
.assistant-row.is-assistant .assistant-bubble { border-bottom-left-radius: var(--app-radius-sm); }
.assistant-row.is-error .assistant-bubble { background: transparent; border: 1px solid var(--app-border); color: var(--prio-critical); }
.assistant-bubble.is-failed { opacity: 0.6; }

.assistant-typing { display: inline-flex; gap: 0.25rem; padding: 0.75rem; }
.assistant-typing span {
  width: 0.375rem;
  height: 0.375rem;
  border-radius: 50%;
  background: var(--app-text-muted);
  animation: assistant-dot 1.2s infinite ease-in-out;
}
.assistant-typing span:nth-child(2) { animation-delay: 0.15s; }
.assistant-typing span:nth-child(3) { animation-delay: 0.3s; }
@keyframes assistant-dot { 0%, 80%, 100% { opacity: 0.25; } 40% { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .assistant-typing span { animation: none; opacity: 0.6; } }

/* The meeting draft card: "Open in form" opens the normal meeting form. */
.assistant-draft {
  width: 88%;
  padding: 0.75rem;
  border: 1px solid var(--app-border);
  border-left: 3px solid var(--app-accent);
  border-radius: var(--app-radius);
  background: var(--app-surface);
}
.assistant-draft-head { display: flex; align-items: center; gap: 0.375rem; color: var(--app-text-muted); font-size: 0.75rem; }
.assistant-draft-head .bi-calendar-plus { color: var(--app-accent-fg); }
.assistant-draft-flag { margin-left: auto; }
.assistant-draft-title { font-weight: 600; margin: 0.25rem 0 0.5rem; overflow-wrap: anywhere; }
.assistant-draft-facts {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.25rem 0.75rem;
  margin: 0 0 0.75rem;
  font-size: 0.8125rem;
}
.assistant-draft-facts dt { color: var(--app-text-muted); font-weight: 400; }
.assistant-draft-facts dd { margin: 0; display: flex; align-items: center; gap: 0.375rem; min-width: 0; overflow-wrap: anywhere; }
.assistant-draft-note { margin: 0.5rem 0 0; color: var(--app-text-muted); font-size: 0.75rem; }

.assistant-footer { padding: 0.75rem 1rem 1rem; border-top: 1px solid var(--app-border); }
.assistant-google-note { margin: 0 0 0.5rem; color: var(--app-text-muted); font-size: 0.8125rem; }
.assistant-form { display: flex; align-items: flex-end; gap: 0.375rem; }
.assistant-input { resize: none; min-height: 2.375rem; max-height: 10rem; line-height: 1.45; }
.assistant-mic.is-listening { color: var(--prio-critical); background: var(--app-surface-2); }
.assistant-send { flex: 0 0 auto; width: 2.375rem; height: 2.375rem; }
.assistant-status { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.375rem; margin: 0.5rem 0 0; font-size: 0.75rem; }
.assistant-status.is-muted { color: var(--app-text-muted); }
.assistant-processor { margin: 0.5rem 0 0; color: var(--app-text-muted); font-size: 0.75rem; }
.assistant-processor a { color: inherit; text-decoration: underline; }
.assistant-rec-dot { width: 0.5rem; height: 0.5rem; border-radius: 50%; background: var(--prio-critical); align-self: center; }
.assistant-interim { color: var(--app-text-muted); }

/* ------------------------------------------------------------ company structure (SPEC 4.2) */

.structure-main { min-height: 0; padding: 1rem 1.25rem 1.25rem; }
@media (max-width: 575.98px) { .structure-main { padding: 0.75rem; } }
/* Wide screens: the page is one column of the window's height (top bar, toolbar, chart) and
   never scrolls; the chart takes the rest with the same margin below as the calendar (not the
   larger room other pages keep for the assistant's button: it floats over the chart's corner,
   as on the calendar). Phones scroll the page (the nested list). */
@media (min-width: 992px) {
  .page-structure { height: 100vh; height: 100dvh; overflow: hidden; }
  .page-structure .structure-main,
  .has-assistant.page-structure .structure-main { flex: 1 1 0; padding-bottom: 1.25rem; }
}
.structure-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem 1rem; margin-bottom: 1rem; }
.structure-title { margin: 0; font-size: 1.25rem; }
.structure-search { position: relative; flex: 1 1 16rem; max-width: 28rem; min-width: 0; }
.structure-search > .bi-search { position: absolute; top: 50%; left: 0.75rem; transform: translateY(-50%); color: var(--app-text-muted); pointer-events: none; }
.structure-search .form-control { padding-left: 2.25rem; }
.structure-results {
  position: absolute;
  z-index: 1030;
  top: calc(100% + 0.25rem);
  left: 0;
  right: 0;
  max-height: 22rem;
  margin: 0;
  padding: 0.25rem;
  overflow: auto;
  list-style: none;
  background: var(--app-surface);
  border: 1px solid var(--app-border);
  border-radius: var(--app-radius);
  box-shadow: var(--app-shadow-overlay);
}
.structure-results[hidden] { display: none; }
.structure-option { display: flex; align-items: center; gap: 0.625rem; padding: 0.375rem 0.5rem; border-radius: var(--app-radius-sm); cursor: pointer; }
.structure-option:hover, .structure-option.is-active { background: var(--app-surface-2); }
.structure-option-icon { display: inline-flex; align-items: center; justify-content: center; flex: 0 0 2rem; height: 2rem; border-radius: 50%; background: var(--app-accent-subtle); color: var(--app-accent-fg); }
.structure-option-text { display: flex; flex-direction: column; min-width: 0; }
.structure-option-name { font-weight: 500; overflow-wrap: anywhere; }
.structure-option-meta { font-size: 0.8125rem; color: var(--app-text-muted); overflow-wrap: anywhere; }
.structure-nothing { padding: 0.5rem; color: var(--app-text-muted); }
.structure-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; margin-left: auto; }
.structure-zoom-level { min-width: 4.25rem; }

/* The chart: blocks joined by lines (the classic CSS tree: the lines are borders of
   pseudo-elements of every child and of the list of children). */
.org-viewport {
  flex: 1 1 0;
  min-height: 0;
  overflow: auto;
  background: var(--app-surface);
  border: 1px solid var(--app-border);
  border-radius: var(--app-radius-lg);
  cursor: grab;
}
.org-viewport.is-panning { cursor: grabbing; user-select: none; }
/* The tree starts at the top (a small gap); a narrower row of organizations stays in the
   middle. static/js/structure.js zooms the row (CSS zoom) and keeps the card in view. */
.org-canvas { display: block; width: max-content; min-width: 100%; padding: 1rem 1.5rem 1.5rem; }
.org-roots { display: flex; align-items: flex-start; gap: 2rem; width: max-content; margin: 0 auto; padding: 0; list-style: none; }
.org-node { position: relative; display: flex; flex-direction: column; align-items: center; list-style: none; }
.org-children { position: relative; display: none; justify-content: center; align-items: flex-start; margin: 0; padding: 1.25rem 0 0; list-style: none; }
.org-node.is-open > .org-children { display: flex; }
.org-children::before { content: ""; position: absolute; top: 0; left: 50%; height: 1.25rem; border-left: 1px solid var(--app-border-strong); }
.org-children > .org-node { padding: 1.25rem 0.5rem 0; }
.org-children > .org-node::before,
.org-children > .org-node::after { content: ""; position: absolute; top: 0; right: 50%; width: 50%; height: 1.25rem; border-top: 1px solid var(--app-border-strong); }
.org-children > .org-node::after { right: auto; left: 50%; border-left: 1px solid var(--app-border-strong); }
.org-children > .org-node:only-child { padding-top: 0; }
.org-children > .org-node:only-child::before,
.org-children > .org-node:only-child::after { display: none; }
.org-children > .org-node:first-child::before,
.org-children > .org-node:last-child::after { border: 0; }
.org-children > .org-node:last-child::before { border-right: 1px solid var(--app-border-strong); border-top-right-radius: var(--app-radius-sm); }
.org-children > .org-node:first-child::after { border-top-left-radius: var(--app-radius-sm); }

.org-dept {
  width: 15.5rem;
  overflow: hidden;
  text-align: left;
  background: var(--app-surface);
  border: 1px solid var(--app-border-strong);
  border-radius: var(--app-radius-lg);
}
.org-roots > .org-node > .org-dept { border-width: 2px; }
.org-dept.is-none { border-style: dashed; }
.org-dept-header {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  width: 100%;
  padding: 0.625rem 0.75rem;
  color: var(--app-text);
  font-weight: 600;
  text-align: left;
  background: var(--app-surface-2);
  border: 0;
  border-bottom: 1px solid var(--app-border);
}
.org-dept-header:hover { background: color-mix(in srgb, var(--app-surface-2) 70%, var(--app-border)); }
.org-dept-name { flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; }
.org-chevron, .acc-chevron { font-size: 0.75rem; color: var(--app-text-muted); transition: transform var(--app-transition); }
.org-node.is-open > .org-dept .org-chevron, .acc-dept[open] > summary .acc-chevron { transform: rotate(90deg); }
.org-count { display: inline-flex; flex: 0 0 auto; align-items: center; gap: 0.25rem; font-size: 0.8125rem; font-weight: 500; color: var(--app-text-muted); }
.org-head { margin: 0.5rem; padding: 0.125rem; background: var(--app-accent-subtle); border: 1px solid var(--app-accent); border-radius: var(--app-radius); }
.org-head-label { display: block; font-size: 0.6875rem; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--app-accent-fg); }
.org-nohead, .org-empty { margin: 0.5rem 0.75rem; font-size: 0.8125rem; color: var(--app-text-muted); }
.org-body { display: none; padding: 0 0.5rem 0.5rem; }
.org-node.is-open > .org-dept > .org-body { display: block; }
.org-person {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.3125rem 0.375rem;
  color: var(--app-text);
  text-align: left;
  background: none;
  border: 0;
  border-radius: var(--app-radius-sm);
}
.org-person:hover { background: var(--app-surface-2); }
.org-person-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.org-person-name { font-size: 0.875rem; font-weight: 500; overflow-wrap: anywhere; }
.org-person-pos { font-size: 0.75rem; color: var(--app-text-muted); overflow-wrap: anywhere; }
.org-head .org-person:hover { background: color-mix(in srgb, var(--app-accent-subtle) 70%, var(--app-surface)); }
.is-found { outline: 2px solid var(--app-accent); outline-offset: 2px; animation: structure-found 3s ease; }
@keyframes structure-found { 0%, 60% { box-shadow: 0 0 0 6px var(--app-accent-ring); } 100% { box-shadow: 0 0 0 0 transparent; } }

/* Phones: the same data as a nested list. */
.structure-list { min-width: 0; }
.acc-dept { margin-bottom: 0.5rem; background: var(--app-surface); border: 1px solid var(--app-border); border-radius: var(--app-radius); }
.acc-dept.is-none { border-style: dashed; }
.acc-summary { display: flex; align-items: center; gap: 0.5rem; padding: 0.625rem 0.75rem; font-weight: 600; cursor: pointer; list-style: none; }
.acc-summary::-webkit-details-marker { display: none; }
.acc-name { flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; }
.acc-body { padding: 0 0.5rem 0.5rem 0.75rem; }
.acc-body > .acc-dept { margin: 0.5rem 0 0; }
.acc-person.is-head { margin-bottom: 0.25rem; background: var(--app-accent-subtle); border: 1px solid var(--app-accent); }

/* The person's card. */
.person-card-head { display: flex; align-items: center; gap: 1rem; min-width: 0; }
.person-card-title { min-width: 0; }
.person-card-title .modal-title { overflow-wrap: anywhere; }
.person-card-position { margin: 0.25rem 0 0; color: var(--app-text-muted); }
.person-card-details dd { min-width: 0; overflow-wrap: anywhere; }
.person-card-phone { display: inline-flex; align-items: center; gap: 0.25rem; }
.person-card-manager { text-align: left; }
.person-card-plan { display: flex; flex-direction: column; align-items: flex-end; gap: 0.25rem; }
@media (max-width: 575.98px) { .person-card-head .avatar-96 { --avatar-size: 4rem; } }

/* ------------------------------------------------------- projects (SPEC 15) */

/* 12 muted project colours (apps.tasks.models.ProjectColor): one hue per key, mixed with the
   theme's tokens like the avatar slots, so the code chip stays readable (>= 4.5:1) in both
   themes (apps/tasks/tests/test_models.py). */
.project-c-slate { --project-hue: #64748b; }
.project-c-red { --project-hue: #dc2626; }
.project-c-orange { --project-hue: #ea580c; }
.project-c-amber { --project-hue: #d97706; }
.project-c-lime { --project-hue: #65a30d; }
.project-c-green { --project-hue: #16a34a; }
.project-c-teal { --project-hue: #0d9488; }
.project-c-cyan { --project-hue: #0891b2; }
.project-c-blue { --project-hue: #2563eb; }
.project-c-indigo { --project-hue: #4f46e5; }
.project-c-violet { --project-hue: #7c3aed; }
.project-c-pink { --project-hue: #db2777; }

.project-code {
  display: inline-flex;
  align-items: center;
  padding: 0.125rem 0.5rem;
  border-radius: var(--app-radius-sm);
  background: color-mix(in srgb, var(--project-hue) 16%, var(--app-surface));
  color: color-mix(in srgb, var(--project-hue) var(--prio-fg-ratio), var(--prio-mix-fg));
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  font-variant-numeric: tabular-nums;
}
.tab-count {
  display: inline-block;
  min-width: 1.25rem;
  margin-left: 0.25rem;
  padding: 0 0.375rem;
  border-radius: 999px;
  background: var(--app-surface-2);
  color: var(--app-text-muted);
  font-size: 0.75rem;
  font-weight: 500;
  text-align: center;
}

/* The second level of «Задачі» (SPEC 15.1, stage 10.4): «Мої задачі · Проєкти» in the title
   row — the current one is the page's title, the other a quiet link of the same size. */
.section-nav { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 0.625rem; }
.section-nav-item {
  position: relative;
  color: var(--app-text-muted);
  font-size: 1.375rem;
  font-weight: 600;
  letter-spacing: -0.012em;
  line-height: 1.3;
  text-decoration: none;
}
.section-nav-item:hover { color: var(--app-text); text-decoration: none; }
.section-nav-item:focus-visible { outline: 2px solid var(--app-accent); outline-offset: 2px; border-radius: var(--app-radius-sm); }
.section-nav-item.is-active { color: var(--app-text); }
.section-nav-item.is-active::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: -0.25rem;
  left: 0;
  height: 3px;
  border-radius: 3px;
  background: var(--app-accent);
}
.section-nav-title { margin: 0; font: inherit; color: inherit; }
.section-nav-dot { color: var(--app-text-muted); font-size: 1.375rem; }
.section-nav + .page-subtitle { margin-top: 0.5rem; }
/* The title row of «Мої задачі» and «Проєкти» (stage 10.5): the same height on both pages, so
   nothing below moves when switching. The page's action («Новий проєкт») sits at the right of
   the switch's row instead of taking a row of its own; on phones only its «+». */
.section-header { position: relative; display: block; }
.section-header > div { min-width: 0; }
.section-header:has(.section-header-action) .section-nav { padding-right: 11rem; }
.section-header-action { position: absolute; top: 0; right: 0; display: inline-flex; align-items: center; gap: 0.375rem; }
@media (max-width: 575.98px) {
  .section-header:has(.section-header-action) .section-nav { padding-right: 3rem; }
  .section-header-action { padding-inline: 0.625rem; }
  .section-header-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
}

/* «Мої задачі» (SPEC 15.4): the row of «Проєкти» (.projects-bar: the tabs, the project filter,
   the search), groups by deadline, a row per task (a grid across the whole width on wide
   screens — the title the widest, the rest in proportion; two lines on phones). */
.my-tasks-group + .my-tasks-group { margin-top: 1.25rem; }
.my-tasks-group-title { display: flex; align-items: center; gap: 0.25rem; margin: 0 0 0.5rem; font-size: 0.9375rem; font-weight: 600; }
.my-tasks-group-title.is-overdue { color: color-mix(in srgb, var(--prio-critical) var(--prio-fg-ratio), var(--prio-mix-fg)); }
.my-tasks-rows { margin: 0; border: 1px solid var(--app-border); border-radius: var(--app-radius-lg); background: var(--app-surface); overflow: hidden; }
.my-task + .my-task { border-top: 1px solid var(--app-border); }
.my-task-link {
  display: grid;
  /* number | title | project | responsible (stage 10.8) | column | priority | deadline */
  grid-template-columns:
    minmax(5.5rem, 0.6fr) minmax(0, 4fr) minmax(5.5rem, 0.9fr) minmax(9rem, 1.6fr)
    minmax(7rem, 1.2fr) minmax(7rem, 0.9fr) minmax(7.5rem, 0.9fr);
  align-items: center;
  gap: 0.25rem 0.75rem;
  padding: 0.5rem 0.875rem;
  color: var(--app-text);
  font-size: 0.875rem;
  text-decoration: none;
}
.my-task-link:hover { background: var(--app-surface-2); color: var(--app-text); text-decoration: none; }
.my-task-link:focus-visible { outline: 2px solid var(--app-accent); outline-offset: -2px; }
.my-task-key { justify-self: start; }
.my-task-main { display: flex; flex-direction: column; min-width: 0; }
.my-task-title { overflow: hidden; font-weight: 500; text-overflow: ellipsis; white-space: nowrap; }
.my-task.is-subtask .my-task-title .bi { color: var(--app-text-muted); }
.my-task-parent { overflow: hidden; color: var(--app-text-muted); font-size: 0.75rem; text-overflow: ellipsis; white-space: nowrap; }
.my-task-project { display: inline-flex; align-items: center; gap: 0.375rem; min-width: 0; }
.my-task-responsible { display: inline-flex; align-items: center; gap: 0.375rem; min-width: 0; }
.my-task-responsible .avatar { flex: none; }
.my-task-person { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.my-task-mark { flex: none; }
.my-task-column { overflow: hidden; color: var(--app-text-muted); text-overflow: ellipsis; white-space: nowrap; }
.my-task-priority { display: inline-flex; align-items: center; gap: 0.375rem; color: var(--app-text-muted); white-space: nowrap; }
.my-task-deadline { white-space: nowrap; }
/* Phones: the number, the title and the responsible person's avatar on the first line; the
   project, the column, the priority and the deadline (on the right) on the second. */
@media (max-width: 767.98px) {
  .my-task-link { grid-template-columns: auto auto minmax(0, 1fr) auto; gap: 0.25rem 0.625rem; padding: 0.625rem 0.75rem; }
  .my-task-key { grid-area: 1 / 1; }
  .my-task-main { grid-area: 1 / 2 / 2 / 4; }
  .my-task-responsible { grid-area: 1 / 4; justify-self: end; }
  .my-task-person, .my-task-mark { display: none; }
  /* The mark itself is in the title: a ring of its colour around the avatar. */
  .my-task-responsible.has-mark .avatar { box-shadow: 0 0 0 2px color-mix(in srgb, var(--prio-high) var(--prio-fg-ratio), var(--prio-mix-fg)); }
  .my-task-project { grid-area: 2 / 1; }
  .my-task-column { grid-area: 2 / 2; max-width: 8rem; }
  .my-task-priority { grid-area: 2 / 3; justify-self: start; }
  .my-task-deadline { grid-area: 2 / 4; }
  .my-task-project, .my-task-column, .my-task-priority, .my-task-deadline { font-size: 0.75rem; }
}

/* «Проєкти» (SPEC 15.2) and «Мої задачі» (SPEC 15.4, the same row and sizes, stage 10.5): the
   whole page width; the row of the tabs carries the filter (role / project) and the search on
   the right (the board's light filter and search box). */
.projects-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem 0.75rem;
  margin-bottom: 1rem;
  border-bottom: 1px solid var(--app-border);
}
.projects-bar .projects-tabs { flex: 0 1 auto; min-width: 0; border-bottom: 0; }
.projects-tools {
  display: flex;
  flex: 1 1 22rem;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.25rem 0.375rem;
  min-width: 0;
  padding: 0.25rem 0;
}
.projects-tools .projects-search { order: 3; margin: 0; flex: 0 1 18rem; }
/* Phones: the filters on a line, the search on the whole next one — the same place and width
   on «Проєкти» and «Мої задачі», however wide their filters are. */
@media (max-width: 575.98px) {
  .projects-tools { flex-basis: 100%; justify-content: flex-start; }
  .projects-tools .projects-search { flex: 1 1 100%; }
}

/* A grid of cards (~300 px at least) with the colour as the left edge. */
.project-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(18.75rem, 100%), 1fr)); gap: 0.75rem; }
.project-card {
  position: relative;
  overflow: hidden;
  color: var(--app-text);
  border-left: 0;
  transition: border-color var(--app-transition), box-shadow var(--app-transition);
}
.project-card::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 4px; background: var(--project-hue); }
.project-card:hover { color: var(--app-text); text-decoration: none; border-color: var(--app-border-strong); box-shadow: var(--app-shadow-overlay); }
.project-card:focus-visible { outline: 2px solid var(--app-accent); outline-offset: 2px; }
.project-card .card-body { display: flex; flex-direction: column; gap: 0.5rem; padding: 1rem 1rem 1rem 1.25rem; }
.project-card-title { margin: 0; font-size: 1rem; font-weight: 600; overflow-wrap: anywhere; }
.project-card-text {
  margin: 0;
  color: var(--app-text-muted);
  font-size: 0.875rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.project-card-footer { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; margin-top: auto; padding-top: 0.25rem; font-size: 0.8125rem; color: var(--app-text-muted); }
.project-card-head { display: inline-flex; align-items: center; gap: 0.5rem; min-width: 0; }
.project-deadline { display: inline-flex; align-items: center; gap: 0.25rem; white-space: nowrap; }
.project-deadline.is-overdue { color: color-mix(in srgb, var(--prio-critical) var(--prio-fg-ratio), var(--prio-mix-fg)); font-weight: 500; }

/* The page of a project: a compact header on every tab (SPEC 15.4, stage 10.2.1) —
   «← Проєкти»; the colour, the code, the name, the settings, the short description in one row
   (the description gives way first, then the name: both end in «…»); the team on the right. */
.page-project .app-content { padding-top: 0.5rem; }
.project-back { margin: 0; font-size: 0.75rem; line-height: 1.4; }
.project-back .cell-muted { font-size: inherit; }
.project-header { display: flex; align-items: center; gap: 0.75rem; min-height: 1.75rem; margin: 0.125rem 0; }
.project-header-main { display: flex; flex: 1 1 auto; align-items: center; gap: 0.5rem; min-width: 0; }
.project-dot { flex: 0 0 auto; width: 0.625rem; height: 0.625rem; border-radius: 50%; background: var(--project-hue); }
.project-header .project-code { flex: 0 0 auto; }
.project-title {
  flex: 0 1 auto;
  min-width: 0;
  margin: 0;
  font-size: 1.125rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.project-header .badge-status { flex: 0 0 auto; }
.project-settings { flex: 0 0 auto; margin-left: -0.25rem; }
.project-settings .btn-icon { width: 1.75rem; height: 1.75rem; }
.project-summary {
  flex: 1 1 0;
  min-width: 0;
  margin: 0 0 0 0.25rem;
  color: var(--app-text-muted);
  font-size: 0.8125rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.project-header-side { display: flex; flex: 0 0 auto; align-items: center; gap: 0.625rem; }
.project-access { display: inline-flex; align-items: center; gap: 0.25rem; }
.project-tabs { margin-bottom: 1rem; }
.project-tabs .nav-link { padding: 0.3125rem 0.75rem; }
/* The board is the tabs' panel: it starts right under them. */
.project-tabs.is-board { margin-bottom: 0; }
@media (max-width: 575.98px) {
  /* Phones: the description goes under the name; three faces of the team, «Для всіх» as an icon. */
  .project-header-main { flex-wrap: wrap; row-gap: 0.125rem; }
  .project-title { flex: 1 1 0; }
  .project-summary { flex-basis: 100%; margin-left: 1.125rem; }
  .project-header-side .avatar-stack > :nth-child(n + 4) { display: none; }
  .project-access-text { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .project-others { display: none; }
}
.avatar-stack { display: inline-flex; align-items: center; padding-left: 0.375rem; }
.avatar-stack > .avatar { margin-left: -0.375rem; box-shadow: 0 0 0 2px var(--app-bg); }
.avatar-more { background: var(--app-surface-2); color: var(--app-text-muted); font-size: 0.75rem; }
.project-overview { overflow-wrap: anywhere; }
.project-overview p:last-child { margin-bottom: 0; }
.project-facts dt { color: var(--app-text-muted); font-size: 0.8125rem; font-weight: 500; }
.project-facts dd { margin: 0.125rem 0 0.75rem; min-width: 0; overflow-wrap: anywhere; }
.project-facts dd:last-child { margin-bottom: 0; }
.member-list { display: flex; flex-direction: column; gap: 0.625rem; }
.member-list li { display: flex; align-items: center; gap: 0.625rem; min-width: 0; }

/* The form: the colour as round swatches (radio buttons). */
.color-swatches { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.color-swatch { position: relative; display: inline-flex; cursor: pointer; }
.color-swatch-input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.color-swatch-dot {
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 50%;
  background: var(--project-hue);
  box-shadow: inset 0 0 0 1px rgb(0 0 0 / 0.08);
  transition: box-shadow var(--app-transition);
}
.color-swatch-input:checked + .color-swatch-dot { box-shadow: 0 0 0 2px var(--app-surface), 0 0 0 4px var(--project-hue); }
.color-swatch-input:focus-visible + .color-swatch-dot { outline: 2px solid var(--app-accent); outline-offset: 4px; }
/* «Доступ для всіх співробітників» (SPEC 15.2): the warning shown when an open project is closed. */
.access-warning { display: flex; gap: 0.5rem; }
.access-warning[hidden] { display: none; }

/* -------------------------------------------------- the kanban board (SPEC 15.3, 15.4) */

/* The page of a project fills the width on every tab (the header never moves). */
.page-column-full { max-width: none; }

/* «Огляд»: the text keeps a readable line length, the facts and the people on the right. */
.project-overview-grid { display: grid; gap: 1rem; align-items: start; }
@media (min-width: 992px) { .project-overview-grid { grid-template-columns: minmax(0, 1fr) 22rem; } }
@media (min-width: 1400px) { .project-overview-grid { grid-template-columns: minmax(0, 1fr) 26rem; } }
.project-overview-grid .project-overview { max-width: 75ch; }
.project-side, .project-main { display: flex; flex-direction: column; gap: 1rem; min-width: 0; }
/* The full «Огляд» (SPEC 15.7, stage 10.4): the tasks by column, the upcoming deadlines, the
   recent activity (the history's lines with the task's link), the recent files. */
.overview-counts li { display: flex; align-items: center; gap: 0.5rem; padding: 0.25rem 0; font-size: 0.875rem; }
.overview-counts li + li { border-top: 1px solid var(--app-border); }
.overview-count { margin-left: auto; font-weight: 600; font-variant-numeric: tabular-nums; }
.overview-overdue {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  margin-top: 0.625rem;
  color: color-mix(in srgb, var(--prio-critical) var(--prio-fg-ratio), var(--prio-mix-fg));
  font-size: 0.875rem;
  font-weight: 500;
}
.overview-upcoming li { display: flex; align-items: center; gap: 0.5rem; padding: 0.3125rem 0; font-size: 0.875rem; }
.overview-upcoming li + li { border-top: 1px solid var(--app-border); }
.overview-upcoming a { display: flex; flex: 1 1 auto; align-items: center; gap: 0.5rem; min-width: 0; color: var(--app-text); }
.overview-upcoming .task-deadline { font-size: 0.75rem; }
.activity-list { display: flex; flex-direction: column; gap: 0.625rem; }
.activity-list .feed-event { padding-left: 0; }
.activity-task { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Thin, unobtrusive scrollbars (the board's columns and its sideways scroll, long menus):
   6 px, no arrows, a transparent track, the thumb in the border colour, darker on hover.
   Chromium and Safari take the ::-webkit-scrollbar rules (they would ignore them next to
   scrollbar-width), Firefox the standard properties. */
.thin-scroll::-webkit-scrollbar { width: 6px; height: 6px; }
.thin-scroll::-webkit-scrollbar-track,
.thin-scroll::-webkit-scrollbar-corner { background: transparent; }
.thin-scroll::-webkit-scrollbar-button { display: none; width: 0; height: 0; }
.thin-scroll::-webkit-scrollbar-thumb { background: var(--app-border-strong); border-radius: 999px; }
.thin-scroll:hover::-webkit-scrollbar-thumb { background: color-mix(in srgb, var(--app-text-muted) 45%, var(--app-border-strong)); }
@supports not selector(::-webkit-scrollbar) {
  .thin-scroll { scrollbar-width: thin; scrollbar-color: var(--app-border-strong) transparent; }
  .thin-scroll:hover { scrollbar-color: color-mix(in srgb, var(--app-text-muted) 45%, var(--app-border-strong)) transparent; }
}

/* The tab «Задачі» on wide screens: the page fits the window and the columns take the rest
   of it — each as tall as its cards, at most down to the bottom, then its cards scroll inside.
   The area keeps 380 px for the columns (contain: size: their cards never stretch the page);
   a lower window scrolls the page instead. The sideways scrollbar is the area's very bottom
   (stage 10.4); the AI assistant's button keeps its usual place, so the bar's track ends left
   of it (Chromium, Safari; in Firefox the button covers only the track's right end) and the
   row of columns ends with an empty tail as wide as the button, so the last column can always
   be scrolled out from under it. */
@media (min-width: 768px) {
  body.page-board { height: 100vh; height: 100dvh; }
  .page-board .app-content,
  .has-assistant.page-board .app-content { flex: 1 1 auto; padding-bottom: 0.75rem; }
  .page-board .page-column { display: flex; flex-direction: column; flex: 1 1 auto; }
  .page-board .board { flex: 1 1 auto; padding-bottom: 0.25rem; }
  .page-board .board-columns { flex: 1 1 0; min-height: 23.75rem; contain: size; }
  .has-assistant.page-board .board-columns::-webkit-scrollbar-track { margin-right: 4.5rem; }
  .has-assistant.page-board .board-columns::after { content: ""; flex: 0 0 3.875rem; align-self: stretch; }
  /* Dragging the empty background scrolls the board sideways (static/js/board.js). */
  .page-board .board-columns.is-panning { cursor: grabbing; user-select: none; }
}
.board {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  min-width: 0;
  padding: 0.375rem 0.5rem 0.5rem;
  background: var(--app-board-bg);
  border-radius: 0 0 var(--app-radius-lg) var(--app-radius-lg);
}
.board.is-busy { cursor: progress; }

/* The toolbar: light filters with ▾ on the left, the search and «Нова задача» on the right. */
.board-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 0.25rem 0.375rem; min-width: 0; }
.board-filters { display: flex; flex-wrap: wrap; align-items: center; gap: 0.25rem 0.375rem; min-width: 0; }
.board-filters.collapse.show { display: flex; }
.board-filter { min-width: 0; }
.board-filter-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  max-width: 15rem;
  --bs-btn-color: var(--app-text-muted);
  --bs-btn-hover-bg: color-mix(in srgb, var(--app-text) 6%, transparent);
  --bs-btn-active-bg: color-mix(in srgb, var(--app-text) 8%, transparent);
}
.board-filter.is-counted .board-filter-toggle { --bs-btn-color: var(--app-text); font-weight: 600; }
.board-filter-toggle .tab-count { margin-left: 0; background: var(--app-surface); }
.board-filter-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.board-filter-caret { font-size: 0.625rem; opacity: 0.75; }
/* A filter that narrows the board shows its value in the accent. */
.board-filter.is-active .board-filter-toggle {
  --bs-btn-color: var(--app-accent-fg);
  --bs-btn-bg: var(--app-accent-subtle);
  --bs-btn-hover-color: var(--app-accent-fg);
  --bs-btn-hover-bg: color-mix(in srgb, var(--app-accent) 16%, var(--app-surface));
  --bs-btn-active-color: var(--app-accent-fg);
  --bs-btn-active-bg: color-mix(in srgb, var(--app-accent) 16%, var(--app-surface));
}
.board-filter-menu { min-width: 13rem; max-width: min(20rem, calc(100vw - 2rem)); max-height: min(22rem, 60vh); overflow-y: auto; }
.board-filter-menu .dropdown-item { gap: 0.5rem; }
.board-filter-menu .dropdown-item .avatar { margin: -0.125rem 0; }
.filter-dot { display: inline-block; width: 0.375rem; height: 0.375rem; border-radius: 50%; background: var(--app-accent); }
.board-filters-toggle, .board-reset { display: inline-flex; align-items: center; gap: 0.375rem; }
.board-filters-toggle.is-active { --bs-btn-color: var(--app-accent-fg); }
.board-search { position: relative; flex: 0 1 16rem; min-width: 10rem; margin: 0 0 0 auto; }
.board-search .board-search-input { height: 2rem; padding: 0.25rem 1.875rem; font-size: 0.8125rem; background-color: var(--app-surface); }
.board-search-input::-webkit-search-cancel-button { -webkit-appearance: none; appearance: none; }
.board-search-icon {
  position: absolute;
  top: 50%;
  left: 0.625rem;
  transform: translateY(-50%);
  color: var(--app-text-muted);
  font-size: 0.8125rem;
  pointer-events: none;
}
.board-search-clear {
  position: absolute;
  top: 50%;
  right: 0.25rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.5rem;
  height: 1.5rem;
  transform: translateY(-50%);
  border-radius: var(--app-radius-sm);
  color: var(--app-text-muted);
  font-size: 0.75rem;
}
.board-search-clear:hover { background: var(--app-surface-2); color: var(--app-text); text-decoration: none; }
.board-search-clear[hidden] { display: none; }
.board-new-task { flex: 0 0 auto; }
/* Phones: the scope, «Фільтри» (the rest in its panel), «Скинути»; the search and «Нова
   задача» in the row below. */
@media (max-width: 767.98px) {
  .board-filters { order: 4; flex-basis: 100%; }
  .board-search { order: 5; flex: 1 1 10rem; margin-left: 0; }
  .board-new-task { order: 6; }
}

.board-columns {
  display: flex;
  align-items: flex-start;
  gap: 0.625rem;
  min-width: 0;
  overflow-x: auto;
  overflow-y: hidden;
  padding-bottom: 0.375rem;
}
.board-column {
  flex: 0 0 var(--app-board-column-width);
  width: var(--app-board-column-width);
  display: flex;
  flex-direction: column;
  max-height: 100%;
  min-height: 0;
  background: var(--app-board-column);
  border: 1px solid var(--app-border);
  border-radius: var(--app-radius-lg);
  transition: flex-basis var(--app-transition), width var(--app-transition);
}
/* The header: the colour's square before the name, a thin line of it underneath (stage 10.6). */
.board-column-head {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  margin-bottom: 0.375rem;
  padding: 0.5rem 0.5rem 0.375rem 0.75rem;
  border-bottom: 2px solid color-mix(in srgb, var(--project-hue) 75%, transparent);
}
.column-swatch {
  display: inline-block;
  flex: 0 0 auto;
  width: 0.75rem;
  height: 0.75rem;
  border-radius: 0.1875rem;
  background: var(--project-hue);
  vertical-align: -0.0625rem;
}
.column-dot { display: inline-block; width: 0.5rem; height: 0.5rem; margin-right: 0.375rem; border-radius: 50%; background: var(--project-hue); vertical-align: 0.0625rem; }
.column-colors { margin: 0; padding: 0; border: 0; }
.column-colors legend { float: none; margin-bottom: 0.375rem; font-size: inherit; }
/* A column without a shown task: a narrow strip (the square, the name written vertically, the
   counter); a click or a card dragged over it opens it (.is-open, static/js/board.js). Only on
   wide screens: phones show one column at a time with its tab. */
.board-column-strip { display: none; }
@media (min-width: 768px) {
  .board-column.is-collapsed:not(.is-open) {
    flex: 0 0 var(--app-board-strip-width);
    width: var(--app-board-strip-width);
    height: 12.5rem;
  }
  .board-column.is-collapsed:not(.is-open) > :not(.board-column-strip) { display: none; }
  .board-column.is-collapsed:not(.is-open)::after { display: none; }
  .board-column.is-collapsed:not(.is-open) > .board-column-strip {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.625rem;
    width: 100%;
    height: 100%;
    min-height: 0;
    padding: 0.75rem 0 0.625rem;
    border: 0;
    border-radius: inherit;
    background: transparent;
    color: var(--app-text);
    cursor: pointer;
    transition: background-color var(--app-transition);
  }
  .board-column-strip:hover { background: color-mix(in srgb, var(--app-text) 5%, transparent); }
  .board-column-strip:focus-visible { outline: 2px solid var(--app-accent); outline-offset: -2px; }
  .board-column-strip-name {
    flex: 0 1 auto;
    min-height: 0;
    overflow: hidden;
    font-size: 0.8125rem;
    font-weight: 600;
    text-overflow: ellipsis;
    white-space: nowrap;
    writing-mode: vertical-rl;
  }
  .board-column-strip .tab-count { margin: 0; }
  /* An open strip (a click, a dragged card): a full column again, a shade lifted. */
  .board-column.is-collapsed.is-open { box-shadow: var(--app-shadow-overlay); }
}
.board-column-title {
  flex: 0 1 auto;
  margin: 0;
  min-width: 0;
  overflow: hidden;
  font-size: 0.875rem;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.board-column-actions { display: flex; align-items: center; gap: 0.125rem; margin-left: auto; }
/* A column whose cards go on below the visible part: a faint shade at its bottom edge, gone
   when scrolled to the end (static/js/board.js sets data-more). */
.board-column { position: relative; }
.board-column::after {
  content: "";
  position: absolute;
  right: 1px;
  bottom: 1px;
  left: 1px;
  height: 1.75rem;
  border-radius: 0 0 var(--app-radius-lg) var(--app-radius-lg);
  background: linear-gradient(to bottom, transparent, var(--app-scroll-shade));
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--app-transition);
}
.board-column[data-more]::after { opacity: 1; }
.board-column-handle { color: var(--app-text-muted); cursor: grab; margin-left: -0.375rem; }
.board-column.is-closed .board-column-title { color: var(--app-text-muted); }
/* The column's head stays; only its cards scroll. */
.board-column-body {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  flex: 0 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 0.125rem 0.5rem 0.5rem;
}
/* An empty column keeps a drop zone. */
.board-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 6rem;
  margin: 0;
  padding: 0.5rem;
  border: 1px dashed var(--app-border-strong);
  border-radius: var(--app-radius);
  color: var(--app-text-muted);
  font-size: 0.8125rem;
  text-align: center;
}
/* A new column (stage 10.6): a narrow «+» tile after the last column; a click turns it into a
   small card (the name, the colour, «Додати»). */
/* Positioned: its hidden label never escapes the scrolling row (a page-wide sideways scroll). */
.board-add-tile { position: relative; flex: 0 0 auto; align-self: flex-start; }
.board-add-tile-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.375rem;
  width: var(--app-board-strip-width);
  height: var(--app-board-strip-width);
  padding: 0;
  border: 1px dashed var(--app-border-strong);
  border-radius: var(--app-radius-lg);
  background: var(--app-board-column);
  color: var(--app-text-muted);
  font-size: 1rem;
  transition: color var(--app-transition), border-color var(--app-transition);
}
.board-add-tile-button:hover { border-color: var(--app-accent); color: var(--app-accent-fg); }
.board-add-tile-button:focus-visible { outline: 2px solid var(--app-accent); outline-offset: 2px; }
.board-add-tile-text { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.board-add-tile.is-open .board-add-tile-button { display: none; }
.board-add-column-card {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  width: 16.5rem;
  padding: 0.75rem;
  border: 1px solid var(--app-border);
  border-radius: var(--app-radius-lg);
  background: var(--app-surface);
  box-shadow: var(--app-shadow-overlay);
}
.board-add-column-card[hidden] { display: none; }
.board-add-column-card .form-label { margin-bottom: 0; }
.column-menu { width: 17rem; padding: 0.75rem; }
.column-menu .dropdown-divider { margin: 0.75rem -0.75rem; }

/* Phones: one column at a time with the tabs above (SPEC 15.4); no dragging. */
.board-tabs { display: none; }
@media (max-width: 767.98px) {
  .board-tabs { display: flex; }
  .board-tabs .nav-link { white-space: nowrap; }
  .board { padding: 0.375rem; }
  .board-columns { display: block; overflow: visible; padding-bottom: 0; }
  .board-column { width: auto; max-height: none; }
  .board-column:not(.is-active) { display: none; }
  .board-column-body { overflow: visible; }
  .board-column-handle { display: none; }
  /* The tab above names the column and counts its tasks: the head keeps only its buttons. */
  .board-column-head { justify-content: flex-end; min-height: 0; padding-top: 0.25rem; border-bottom: 0; }
  .board-column-head > .column-swatch { display: none; }
  .board-column-head > .board-column-title,
  .board-column-head > .tab-count { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .board-column-head:not(:has(.board-column-actions > *)) { display: none; }
  .board-column::after { display: none; }
  .board-add-tile { margin-top: 0.75rem; }
  .board-add-tile-button { width: 100%; height: auto; padding: 0.5rem; font-size: 0.875rem; }
  .board-add-tile-text { position: static; width: auto; height: auto; overflow: visible; clip: auto; }
  .board-add-column-card { width: 100%; box-shadow: none; }
}

/* A card: the priority stripe on the left, like the calendar's events. */
.task-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
  padding: 0.5rem 0.625rem 0.625rem 0.875rem;
  background: var(--app-surface);
  border: 1px solid var(--app-border);
  border-radius: var(--app-radius);
  cursor: pointer;
  transition: border-color var(--app-transition), box-shadow var(--app-transition);
}
.task-card::before {
  content: "";
  position: absolute;
  inset: 0.5rem auto 0.5rem 0.3125rem;
  width: 3px;
  border-radius: 2px;
  background: var(--prio);
}
.task-card:hover { border-color: var(--app-border-strong); }
.task-card:focus-within { border-color: var(--app-accent); }
/* «Закриті»: inactive — the column's background, a grey stripe, a check mark, muted labels and
   face; the title stays readable (the muted text colour: AA in both themes). Hover and focus
   bring the colours back; the stripe stays grey. */
.task-card.is-closed { background: transparent; }
.task-card.is-closed::before { background: color-mix(in srgb, var(--app-text-muted) 40%, var(--app-border)); }
.task-card.is-closed .task-card-title { color: var(--app-text-muted); }
.task-card.is-closed :is(.task-labels, .task-responsible, .task-mark) { opacity: 0.6; filter: grayscale(1); transition: opacity var(--app-transition), filter var(--app-transition); }
.task-card.is-closed:is(:hover, :focus-within) .task-card-title { color: var(--app-text); }
.task-card.is-closed:is(:hover, :focus-within) :is(.task-labels, .task-responsible, .task-mark) { opacity: 1; filter: none; }
.task-closed-mark { color: var(--app-success-fg); font-size: 0.875rem; line-height: 1; }
.task-closed-date { white-space: nowrap; }
.task-card.is-ghost { opacity: 0.4; }
.task-card.is-chosen { box-shadow: var(--app-shadow-overlay); }
.task-card-head { display: flex; align-items: center; gap: 0.375rem; min-height: 1.5rem; }
.task-key {
  color: var(--app-text-muted);
  font-size: 0.75rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.01em;
  white-space: nowrap;
}
/* «⋯» shows on hover and focus (touch screens: always); its place is kept. */
.task-card-menu { position: relative; z-index: 2; margin-left: auto; margin-right: -0.375rem; opacity: 0; transition: opacity var(--app-transition); }
.task-card:is(:hover, :focus-within) .task-card-menu { opacity: 1; }
@media (hover: none) { .task-card-menu { opacity: 1; } }
.task-card-menu .btn-icon { width: 1.75rem; height: 1.5rem; }
.task-card-title {
  color: var(--app-text);
  font-weight: 500;
  line-height: 1.35;
  overflow-wrap: anywhere;
}
.task-card-title:hover { color: var(--app-text); text-decoration: none; }
.task-card-title:focus-visible { outline: none; }
.task-card-title:focus-visible::after { outline: 2px solid var(--app-accent); outline-offset: 2px; border-radius: var(--app-radius); }
/* The foot (stage 10.10.1): the meta on the left wraps item by item (each item whole: the
   deadline, «Закрито …», «0/2», «3 год 30 хв»); the avatar in its own column on the right never
   shrinks and sits by the meta's last line; the responsible person's mark takes a line of its
   own under them, right under the avatar (never cut short, never pushing the avatar out). */
.task-card-foot {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  column-gap: 0.5rem;
  row-gap: 0.25rem;
  color: var(--app-text-muted);
  font-size: 0.75rem;
}
.task-card-meta { grid-column: 1; display: flex; flex-wrap: wrap; align-items: center; gap: 0.125rem 0.625rem; min-width: 0; }
.task-card-meta .task-counters { display: contents; }
.task-card-foot > .task-responsible { grid-row: 1; grid-column: 2; align-self: end; flex: none; margin-left: 0; }
.task-card-foot > .task-mark { grid-row: 2; grid-column: 1 / -1; justify-self: end; }
.task-deadline { display: inline-flex; align-items: center; gap: 0.25rem; white-space: nowrap; }
.task-deadline.is-overdue { color: color-mix(in srgb, var(--prio-critical) var(--prio-fg-ratio), var(--prio-mix-fg)); font-weight: 500; }
.task-responsible { display: inline-flex; align-items: center; gap: 0.375rem; margin-left: auto; min-width: 0; }
.task-mark {
  padding: 0.0625rem 0.375rem;
  border-radius: var(--app-radius-sm);
  background: color-mix(in srgb, var(--prio-high) 16%, var(--app-surface));
  color: color-mix(in srgb, var(--prio-high) var(--prio-fg-ratio), var(--prio-mix-fg));
  font-size: 0.6875rem;
  font-weight: 500;
  white-space: nowrap;
}

/* Labels (SPEC 15.5): the projects' 12 colours, the same mix as the project code chip. */
.task-labels { display: flex; flex-wrap: wrap; gap: 0.25rem; }
.task-label {
  display: inline-flex;
  align-items: center;
  padding: 0.0625rem 0.4375rem;
  border-radius: var(--app-radius-sm);
  background: color-mix(in srgb, var(--project-hue) 16%, var(--app-surface));
  color: color-mix(in srgb, var(--project-hue) var(--prio-fg-ratio), var(--prio-mix-fg));
  font-size: 0.75rem;
  font-weight: 500;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

/* The task window (stage 10.6, after the Stitch mock-up): the head (a row of chips and the
   title) and the foot stay, the body scrolls; on the left the sections, on the right the panel
   «Властивості» (sticky on wide screens; above the description and folding on narrow ones).
   The task form has the same frame. */
.task-modal .modal-content > :is(.task-window, .task-form) {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-height: 0;
}
.task-modal .modal-content > :is(.task-window, .task-form) > .modal-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; }
/* Stage 10.6.1: on wide screens the window, a new task and the edit form are all as tall as
   the screen (less 1.5 rem above and below); the head and the foot stay, the body scrolls. */
@media (min-width: 576px) {
  .task-modal { --bs-modal-margin: 1.5rem; }
  .task-modal .modal-dialog-scrollable .modal-content { height: 100%; }
}
.task-window-head { align-items: flex-start; gap: 1rem; padding: 1.25rem 1.75rem 1rem; }
.task-window-headline { display: flex; flex: 1 1 auto; flex-direction: column; gap: 0.625rem; min-width: 0; }
.task-window-head .btn-close { flex: 0 0 auto; margin: -0.125rem -0.375rem 0 0; }
.task-chips { display: flex; flex-wrap: wrap; align-items: center; gap: 0.375rem 0.5rem; min-width: 0; }
.task-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  max-width: 100%;
  padding: 0.1875rem 0.5rem;
  border: 1px solid var(--app-border);
  border-radius: var(--app-radius-sm);
  background: var(--app-surface-2);
  color: var(--app-text);
  font-size: 0.75rem;
  font-weight: 500;
  line-height: 1.4;
  text-decoration: none;
}
a.task-chip:hover { border-color: var(--app-border-strong); color: var(--app-text); text-decoration: none; }
a.task-chip:focus-visible { outline: 2px solid var(--app-accent); outline-offset: 2px; }
.task-chip :is(.project-dot, .column-dot) { width: 0.4375rem; height: 0.4375rem; margin: 0; }
.task-chip-name { max-width: 14rem; color: var(--app-text-muted); font-weight: 400; }
.task-chip .project-code { padding: 0; background: none; color: inherit; font-weight: 600; }
.task-chip-sep { color: var(--app-text-muted); font-size: 0.75rem; }
.task-chips .task-key { font-size: 0.75rem; }
.task-window-title { margin: 0; font-size: 1.3125rem; font-weight: 600; line-height: 1.3; letter-spacing: -0.01em; }
.task-window-body { padding: 0; }
/* At least the body's height: «Властивості» reach the foot when the content is short. */
.task-window-grid { display: grid; grid-template-columns: minmax(0, 1fr); min-height: 100%; }
.task-window-main { display: flex; flex-direction: column; gap: 1.75rem; min-width: 0; padding: 1.5rem 1.75rem 1.75rem; }
.task-section-head { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; min-height: 1.5rem; margin-bottom: 0.625rem; }
.task-section-head .tab-count { margin-left: 0; }
.task-section-title { margin: 0; color: var(--app-text-muted); font-size: 0.6875rem; font-weight: 600; letter-spacing: 0.07em; text-transform: uppercase; }
.task-section-action { margin-left: auto; padding: 0; font-size: 0.8125rem; text-decoration: none; }
.task-section-action:hover { text-decoration: underline; }
.task-description {
  padding: 0.875rem 1rem;
  border: 1px solid var(--app-border);
  border-radius: var(--app-radius);
  background: var(--app-task-soft);
  overflow-wrap: anywhere;
}
.task-description p:last-child { margin-bottom: 0; }
.task-delete-confirm { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; }
.task-delete-confirm[hidden] { display: none; }
.task-form-main { gap: 0; }
.task-form-files .file-list:empty { display: none; }
.task-form-main .richtext-input { min-height: 14rem; }

/* «Властивості»: rows «icon + label» | value; a value of who may work is a button (the form
   with the focus on its field). */
.task-props { min-width: 0; order: -1; background: var(--app-task-props-bg); }
.task-props-inner { padding: 1.25rem 1.5rem; }
.task-props-head { display: flex; align-items: center; gap: 0.5rem; min-height: 1.5rem; margin-bottom: 0.625rem; }
.task-props-toggle { margin-left: auto; padding: 0; font-size: 0.8125rem; text-decoration: none; }
.task-props-list { display: flex; flex-direction: column; gap: 0.125rem; margin: 0; }
.task-prop { display: grid; grid-template-columns: minmax(7.25rem, auto) minmax(0, 1fr); align-items: center; gap: 0.5rem; min-height: 2.25rem; }
.task-prop dt { display: flex; align-items: center; gap: 0.5rem; color: var(--app-text-muted); font-size: 0.8125rem; font-weight: 400; white-space: nowrap; }
.task-prop dt .bi { width: 1rem; font-size: 0.9375rem; text-align: center; }
.task-prop.is-overdue dt .bi { color: color-mix(in srgb, var(--prio-critical) var(--prio-fg-ratio), var(--prio-mix-fg)); }
.task-prop dd { display: flex; justify-content: flex-end; min-width: 0; margin: 0; }
.task-prop-value {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.375rem;
  min-width: 0;
  max-width: 100%;
  margin-right: -0.375rem;
  padding: 0.25rem 0.375rem;
  border: 0;
  border-radius: var(--app-radius-sm);
  background: transparent;
  color: var(--app-text);
  font: inherit;
  font-size: 0.8125rem;
  text-align: right;
  transition: background-color var(--app-transition);
}
button.task-prop-value { cursor: pointer; }
button.task-prop-value:hover { background: color-mix(in srgb, var(--app-text) 7%, transparent); }
button.task-prop-value:focus-visible { outline: 2px solid var(--app-accent); outline-offset: 1px; }
.task-prop-value .task-labels { justify-content: flex-end; }
.task-prop-text { display: inline-flex; align-items: center; gap: 0.375rem; font-size: 0.8125rem; }
.task-prop-text .column-dot { margin: 0; }
.task-prop-column { position: relative; display: inline-flex; align-items: center; min-width: 0; max-width: 100%; }
.task-prop-column .column-dot { position: absolute; left: 0.625rem; margin: 0; pointer-events: none; }
.task-prop-column .form-select {
  width: auto;
  max-width: 12rem;
  min-height: 0;
  padding: 0.1875rem 1.75rem 0.1875rem 1.5rem;
  border-radius: var(--app-radius-sm);
  background-position: right 0.5rem center;
  font-size: 0.8125rem;
  font-weight: 500;
  text-overflow: ellipsis;
}
.task-deadline-chip { padding: 0.0625rem 0.5rem; border: 1px solid var(--app-border); border-radius: var(--app-radius-sm); }
.task-deadline-chip.is-overdue {
  border-color: color-mix(in srgb, var(--prio-critical) 45%, transparent);
  background: color-mix(in srgb, var(--prio-critical) 10%, var(--app-surface));
}
.task-watcher-stack { display: inline-flex; align-items: center; padding-left: 0.375rem; }
.task-watcher, .task-watcher-stack > .avatar-more { display: inline-flex; margin-left: -0.375rem; border-radius: 50%; box-shadow: 0 0 0 2px var(--app-task-props-bg); }
.task-watcher[data-deactivated] { opacity: 0.55; }
.task-props .task-watch { width: 100%; margin-top: 0.875rem; }
.task-props-meta { display: flex; flex-direction: column; gap: 0.25rem; margin: 1.25rem 0 0; padding-top: 0.875rem; border-top: 1px solid var(--app-border); color: var(--app-text-muted); font-size: 0.75rem; }
.task-props-meta > div { display: flex; flex-wrap: wrap; gap: 0.25rem; }
.task-props-meta dt { font-weight: 400; }
.task-props-meta dd { margin: 0; color: var(--app-text); }
.task-form-props .form-label { color: var(--app-text-muted); font-size: 0.8125rem; }
/* Stage 10.10 A (SPEC 15.4): the sections under «Властивості» in the right panel (the spent
   time, then the files: stage 10.10.1) — a line above, a small head like the panel's; they
   never fold. The author and the dates (.task-props-meta) close the panel. */
.task-side-section { margin-top: 1.25rem; padding-top: 1rem; border-top: 1px solid var(--app-border); }
.task-side-head { display: flex; align-items: center; gap: 0.5rem; min-height: 1.5rem; margin-bottom: 0.5rem; }
.task-side-head .tab-count { margin-left: 0; }
.task-side-section .file-list { margin-bottom: 0.5rem; }
/* The spent time (stage 10.10 C, SPEC 15.10): the total (a button showing the entries), the
   entries, «+ Додати час» and the small form (the duration and the date side by side). */
.task-time-total {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  margin: 0 0 0.375rem;
  padding: 0.375rem 0.5rem;
  border: 1px solid var(--app-border);
  border-radius: var(--app-radius);
  background: var(--app-surface);
  color: var(--app-text);
  font-size: 0.8125rem;
  text-align: left;
}
button.task-time-total:hover { background: color-mix(in srgb, var(--app-text) 5%, var(--app-surface)); }
button.task-time-total:focus-visible { outline: 2px solid var(--app-accent); outline-offset: 1px; }
.task-time-total.is-static { border-style: dashed; }
.task-time-total .bi-clock-history { color: var(--app-text-muted); }
.task-time-total .tab-count { margin-left: auto; }
.task-time-caret { color: var(--app-text-muted); font-size: 0.75rem; transition: transform var(--app-transition); }
.task-time-total[aria-expanded="true"] .task-time-caret { transform: rotate(180deg); }
.task-time-list { display: flex; flex-direction: column; gap: 0.25rem; margin: 0 0 0.5rem; }
.task-time-entry { padding: 0.375rem 0.25rem 0.375rem 0.5rem; border-radius: var(--app-radius-sm); background: var(--app-task-soft); }
.task-time-row { display: flex; align-items: flex-start; gap: 0.5rem; }
.task-time-row .avatar { margin-top: 0.125rem; }
.task-time-main { flex: 1 1 auto; min-width: 0; }
.task-time-line { display: flex; align-items: baseline; gap: 0.5rem; font-size: 0.8125rem; }
.task-time-who { min-width: 0; }
.task-time-minutes { margin-left: auto; font-weight: 600; white-space: nowrap; }
.task-time-meta { color: var(--app-text-muted); font-size: 0.75rem; overflow-wrap: anywhere; }
.task-time-actions { display: flex; flex: 0 0 auto; gap: 0.125rem; }
.task-time-actions .btn-icon { height: 1.75rem; }
.task-time-actions .btn-icon:not(.is-armed) { width: 1.75rem; font-size: 0.875rem; }
.task-time-add { padding-inline: 0.25rem; color: var(--app-accent-fg); }
.task-time-form { margin-top: 0.25rem; padding: 0.625rem; border: 1px solid var(--app-border); border-radius: var(--app-radius); background: var(--app-surface); }
.task-time-form[hidden] { display: none; }
.task-time-fields { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr); gap: 0.5rem; }
.task-time-pair .form-label { margin-bottom: 0.125rem; color: var(--app-text-muted); font-size: 0.75rem; font-weight: 500; }
.task-time-pair-wide, .task-time-buttons { grid-column: 1 / -1; }
.task-time-buttons { display: flex; justify-content: flex-end; gap: 0.375rem; }
.task-counter-time { white-space: nowrap; }
/* A file dragged over the window or the form (stage 10.10 A): a dashed frame with the hint
   over all of it; the drop zone of the panel lights up too (static/js/board.js). */
:is(.task-window, .task-form).is-file-over { position: relative; }
:is(.task-window, .task-form).is-file-over::after {
  content: attr(data-drop-files);
  position: absolute;
  inset: 0.5rem;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  border: 2px dashed var(--app-accent);
  border-radius: var(--app-radius-lg);
  background: color-mix(in srgb, var(--app-accent-subtle) 88%, transparent);
  color: var(--app-accent-fg);
  font-weight: 600;
  text-align: center;
  pointer-events: none;
}
@media (min-width: 992px) {
  .task-window-grid { grid-template-columns: minmax(0, 1fr) var(--app-task-props-width); }
  .task-props { order: 0; border-left: 1px solid var(--app-border); }
  /* Sticky, and taller than the window's body (many files, the spent time) it scrolls by
     itself: 100cqh is the body's height (stage 10.10 A). */
  .task-window-body { container-type: size; }
  .task-props-inner { position: sticky; top: 0; max-height: 100cqh; overflow-y: auto; }
  .task-props-toggle { display: none; }
}
@media (min-width: 1200px) {
  .task-window-grid { --app-task-props-width: 21.25rem; }
}
@media (max-width: 991.98px) {
  .task-props { margin: 1rem 1.25rem 0; border: 1px solid var(--app-border); border-radius: var(--app-radius-lg); }
  .task-props-inner { padding: 0.875rem 1rem; }
  .task-props.is-folded .task-props-head { margin-bottom: 0; }
  /* The author and the dates (at the panel's bottom since stage 10.10.1) fold with them. */
  .task-props.is-folded :is(.task-props-body, .task-props-meta) { display: none; }
  .task-window-main { padding: 1.25rem; }
  /* Stage 10.8: in the form (new and edit) the title and the description come first, then
     «Властивості»; the window keeps them above the description. */
  .task-form-props { order: 0; margin: 0 1.25rem 1.25rem; }
}
@media (max-width: 575.98px) {
  .task-window-head { padding: 1rem 1.25rem 0.875rem; }
  .task-window-title { font-size: 1.125rem; }
}
.task-window-foot { gap: 0.25rem; padding: 0.75rem 1.5rem; }
/* Phones: the foot in one row (the meeting button is its icon there). */
@media (max-width: 575.98px) {
  .task-window-foot { flex-wrap: nowrap; padding: 0.5rem 0.75rem; }
  .task-window-foot > * { margin: 0; }
  .task-window-foot .btn { padding: 0.375rem 0.625rem; font-size: 0.875rem; white-space: nowrap; }
  .task-window-foot .task-delete-confirm { flex-wrap: nowrap; }
}
.task-delete-button {
  --bs-btn-color: color-mix(in srgb, var(--prio-critical) var(--prio-fg-ratio), var(--prio-mix-fg));
  --bs-btn-hover-color: color-mix(in srgb, var(--prio-critical) var(--prio-fg-ratio), var(--prio-mix-fg));
  --bs-btn-hover-bg: color-mix(in srgb, var(--prio-critical) 10%, transparent);
  --bs-btn-active-bg: color-mix(in srgb, var(--prio-critical) 14%, transparent);
}

/* The card's counters (stage 10.3): the subtasks «2/5», the comments, the files. */
.task-counters { display: inline-flex; align-items: center; gap: 0.625rem; }
.task-counter { display: inline-flex; align-items: center; gap: 0.25rem; white-space: nowrap; font-variant-numeric: tabular-nums; }
.task-counter.is-complete { color: color-mix(in srgb, var(--prio-low) var(--prio-fg-ratio), var(--prio-mix-fg)); }

/* Formatted text (SPEC 15.6): the overview, the description, comments, «Перегляд». */
.formatted-text { overflow-wrap: anywhere; }
.formatted-text > :last-child { margin-bottom: 0; }
.formatted-text p, .formatted-text ul, .formatted-text ol, .formatted-text blockquote, .formatted-text pre { margin-bottom: 0.625rem; }
.formatted-text ul, .formatted-text ol { padding-left: 1.375rem; }
.formatted-text blockquote { padding: 0.125rem 0 0.125rem 0.75rem; border-left: 3px solid var(--app-border-strong); color: var(--app-text-muted); }
.formatted-text code { padding: 0.0625rem 0.3125rem; border-radius: var(--app-radius-sm); background: var(--app-surface-2); color: var(--app-text); font-size: 0.85em; }
.formatted-text pre { padding: 0.625rem 0.75rem; border: 1px solid var(--app-border); border-radius: var(--app-radius); background: var(--app-surface-2); overflow-x: auto; }
.formatted-text pre code { padding: 0; background: transparent; font-size: 0.8125rem; }
.formatted-text a { overflow-wrap: anywhere; }
/* Images in the formatted text (SPEC 15.6, stage 10.6): a preview at most 360 px high (a
   click opens the light viewer); a file gone since says so; an image dragged over the editor
   lights it up. */
.formatted-text .text-image {
  display: inline-block;
  max-width: 100%;
  margin: 0.25rem 0;
  border-radius: var(--app-radius);
  line-height: 0;
  vertical-align: top;
  cursor: zoom-in;
}
.formatted-text .text-image img {
  display: block;
  max-width: 100%;
  max-height: 22.5rem;
  width: auto;
  height: auto;
  border: 1px solid var(--app-border);
  border-radius: var(--app-radius);
  background: var(--app-surface-2);
}
.formatted-text .text-image:focus-visible { outline: 2px solid var(--app-accent); outline-offset: 2px; }
.text-image-gone {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.625rem;
  border: 1px dashed var(--app-border-strong);
  border-radius: var(--app-radius-sm);
  color: var(--app-text-muted);
  font-size: 0.8125rem;
  font-style: italic;
}
.richtext.is-drop .richtext-box { border-color: var(--app-accent); background: var(--app-accent-subtle); }

/* The light viewer of an image (static/js/richtext.js): the whole screen, dark around. */
.image-viewer {
  width: 100vw;
  max-width: none;
  height: 100vh;
  height: 100dvh;
  max-height: none;
  margin: 0;
  padding: 3.5rem 1.5rem 1.5rem;
  border: 0;
  background: transparent;
  color: #fff;
}
.image-viewer[open] { display: flex; align-items: center; justify-content: center; }
.image-viewer::backdrop { background: rgb(10 10 14 / 0.82); }
.image-viewer-img {
  max-width: 100%;
  max-height: 100%;
  border-radius: var(--app-radius);
  background: #fff;
  box-shadow: 0 10px 40px rgb(0 0 0 / 0.5);
  object-fit: contain;
}
.image-viewer-bar { position: fixed; top: 0.75rem; right: 0.75rem; display: flex; align-items: center; gap: 0.5rem; }
.image-viewer-open,
.image-viewer-close {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  min-height: 2.25rem;
  padding: 0.375rem 0.75rem;
  border: 1px solid rgb(255 255 255 / 0.25);
  border-radius: var(--app-radius);
  background: rgb(255 255 255 / 0.1);
  color: #fff;
  font-size: 0.8125rem;
  text-decoration: none;
}
.image-viewer-close { width: 2.25rem; justify-content: center; padding: 0; font-size: 1rem; }
.image-viewer-open:hover, .image-viewer-close:hover { background: rgb(255 255 255 / 0.2); color: #fff; text-decoration: none; }
.image-viewer-open:focus-visible, .image-viewer-close:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.mention { padding: 0 0.1875rem; border-radius: var(--app-radius-sm); background: var(--app-accent-subtle); color: var(--app-accent-fg); font-weight: 500; }

/* The editor (stage 10.7): the toolbar above a visual editor that looks like the saved text
   (.formatted-text); the textarea with Markdown without the script, until the library is
   loaded and in «Markdown». The toolbar only once the script is there. */
.richtext-box { position: relative; border: 1px solid var(--app-border-strong); border-radius: var(--app-radius); background: var(--app-surface); }
.richtext-box:focus-within { border-color: var(--app-accent); box-shadow: 0 0 0 0.2rem color-mix(in srgb, var(--app-accent) 20%, transparent); }
.richtext.is-invalid .richtext-box { border-color: var(--bs-form-invalid-border-color); }
.richtext:not(.is-ready) .richtext-toolbar { display: none; }
.richtext-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 0.125rem; padding: 0.25rem; border-bottom: 1px solid var(--app-border); }
.richtext-button { min-width: 2rem; padding-inline: 0.5rem; --bs-btn-color: var(--app-text-muted); }
.richtext-button[aria-pressed="true"], .richtext-source-toggle[aria-pressed="true"] { --bs-btn-color: var(--app-accent-fg); --bs-btn-bg: var(--app-accent-subtle); --bs-btn-hover-bg: var(--app-accent-subtle); }
.richtext-sep { width: 1px; height: 1.25rem; margin: 0 0.25rem; background: var(--app-border); }
.richtext-source-toggle { margin-left: auto; --bs-btn-color: var(--app-text-muted); }
@media (max-width: 575.98px) {
  /* Phones: the toolbar on one row; «Markdown» only its icon (the name stays for readers). */
  .richtext-source-toggle .bi { margin: 0 !important; }
  .richtext-source-toggle span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .richtext-button { min-width: 1.875rem; padding-inline: 0.375rem; }
}
.richtext-box .richtext-input { border: 0; border-radius: 0 0 var(--app-radius) var(--app-radius); box-shadow: none; resize: vertical; }
.richtext-box .richtext-input:focus { box-shadow: none; }
.richtext.is-source .richtext-input { font-family: var(--bs-font-monospace); font-size: 0.8125rem; }
.richtext-editor { padding: 0.5rem 0.75rem; color: var(--app-text); font-size: 0.9375rem; line-height: 1.55; outline: 0; white-space: pre-wrap; word-wrap: break-word; }
.richtext-editor:focus-visible { outline: 0; }
.richtext-editor li > p { margin-bottom: 0.125rem; }
.richtext-editor pre { white-space: pre; }
.richtext-editor a { color: var(--app-accent-fg); text-decoration: underline; cursor: text; }
.richtext-editor .richtext-autolink { color: var(--app-accent-fg); text-decoration: underline; }
.richtext-editor p.is-editor-empty:first-child::before { content: attr(data-placeholder); float: left; height: 0; color: var(--app-text-muted); pointer-events: none; }
.richtext-editor .richtext-image { display: inline-block; max-width: 100%; vertical-align: bottom; }
.richtext-editor .richtext-image img { display: block; max-width: min(100%, 28rem); max-height: 18rem; border: 1px solid var(--app-border); border-radius: var(--app-radius); background: var(--app-surface-2); }
.richtext-editor .richtext-image.ProseMirror-selectednode img { outline: 2px solid var(--app-accent); outline-offset: 2px; }
.richtext-editor .richtext-image-alt { padding: 0 0.3125rem; border: 1px dashed var(--app-border-strong); border-radius: var(--app-radius-sm); color: var(--app-text-muted); font-size: 0.85em; }
.richtext-editor .ProseMirror-selectednode { outline: 2px solid var(--app-accent); outline-offset: 1px; }
.richtext-uploading { display: inline-block; padding: 0 0.375rem; border-radius: var(--app-radius-sm); background: var(--app-accent-subtle); color: var(--app-accent-fg); font-size: 0.8125rem; }
.richtext-editor .ProseMirror-gapcursor { display: none; pointer-events: none; position: absolute; }
.richtext-editor .ProseMirror-gapcursor::after { content: ""; display: block; position: absolute; top: -2px; width: 20px; border-top: 1px solid var(--app-text); }
.richtext-editor.ProseMirror-focused .ProseMirror-gapcursor { display: block; }
.task-form-main .richtext-editor { min-height: 14rem !important; }
/* The link panel (Ctrl+K) under the toolbar. */
.richtext-link { display: flex; flex-direction: column; gap: 0.375rem; padding: 0.5rem; border-bottom: 1px solid var(--app-border); background: var(--app-surface-2); }
.richtext-link[hidden] { display: none; }
.richtext-link-row { display: flex; flex-wrap: wrap; align-items: center; gap: 0.375rem; }
.richtext-link-row[hidden] { display: none; }
.richtext-link-row .form-control { flex: 1 1 12rem; width: auto; min-width: 0; }
.richtext-link-error { color: var(--prio-critical); font-size: 0.8125rem; }
.mention-menu { top: auto; bottom: calc(100% + 0.25rem); left: 0.5rem; min-width: 14rem; max-width: min(20rem, calc(100vw - 2rem)); max-height: 16rem; overflow-y: auto; }
.mention-menu .dropdown-item { display: flex; align-items: center; gap: 0.5rem; }

/* Subtasks (SPEC 15.4): a check, the title, the deadline and the person; edit in place. */
.subtask-list { display: flex; flex-direction: column; gap: 0.25rem; margin: 0 0 0.375rem; }
.subtask { border: 1px solid transparent; border-radius: var(--app-radius); background: var(--app-task-soft); transition: border-color var(--app-transition); }
.subtask:hover, .subtask:focus-within { border-color: var(--app-border); }
.subtask.is-done { background: transparent; }
.subtask-view { display: flex; align-items: center; gap: 0.5rem; min-height: 2.5rem; padding: 0.25rem 0.375rem 0.25rem 0.25rem; }
.subtask-actions { display: inline-flex; gap: 0.125rem; opacity: 0; transition: opacity var(--app-transition); }
.subtask:is(:hover, :focus-within) .subtask-actions { opacity: 1; }
@media (hover: none) { .subtask-actions { opacity: 1; } }
.subtask-deadline-chip { padding: 0 0.375rem; border: 1px solid var(--app-border); border-radius: var(--app-radius-sm); background: var(--app-surface); }
.subtask-deadline-chip.is-overdue { border-color: color-mix(in srgb, var(--prio-critical) 45%, transparent); background: color-mix(in srgb, var(--prio-critical) 10%, var(--app-surface)); }
.subtask-progress { display: inline-block; width: 6rem; height: 0.375rem; overflow: hidden; border-radius: 999px; background: var(--app-surface-2); }
.subtask-progress > span { display: block; height: 100%; border-radius: inherit; background: var(--app-accent); transition: width var(--app-transition); }
.subtask-view[hidden], .subtask-form[hidden] { display: none; }
.subtask-handle { color: var(--app-text-muted); cursor: grab; }
.subtask-check { display: inline-flex; margin: 0; }
.subtask-check .form-check-input { margin: 0; cursor: pointer; }
.subtask-title { flex: 1 1 auto; min-width: 0; }
.subtask.is-done .subtask-title { color: var(--app-text-muted); text-decoration: line-through; }
.subtask-meta { display: inline-flex; align-items: center; gap: 0.375rem; color: var(--app-text-muted); font-size: 0.75rem; }
.subtask-meta .task-responsible { margin-left: 0; }
.subtask-form { display: flex; flex-wrap: wrap; align-items: center; gap: 0.375rem; padding: 0.375rem; }
/* Adding: a dashed row «+ Нова підзадача…»; the responsible person, the deadline and the button
   show once the title has the focus or text. */
/* Stage 10.6.1: one stable row [title | responsible | deadline | «Додати»], all of one
   height; two rows on narrow screens; folded back with an empty title. */
.subtask-add {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) 12.5rem 9.5rem auto;
  align-items: center;
  gap: 0.375rem;
  min-height: 2.625rem;
  padding: 0.25rem 0.375rem 0.25rem 0.625rem;
  border: 1px dashed var(--app-border-strong);
  border-radius: var(--app-radius);
  transition: border-color var(--app-transition);
}
.subtask-add .subtask-fields { display: contents; }
.subtask-add :is(.subtask-title-input, .subtask-responsible, .subtask-deadline) { width: 100%; min-width: 0; height: 2rem; margin: 0; }
.subtask-add .subtask-form-actions { margin: 0; }
.subtask-add .subtask-form-actions .btn { height: 2rem; white-space: nowrap; }
.subtask-add:focus-within { border-style: solid; border-color: var(--app-accent); }
.subtask-add-icon { color: var(--app-text-muted); }
.subtask-add .subtask-title-input { border-color: transparent; background: transparent; box-shadow: none; }
.subtask-add:not(:focus-within):has(.subtask-title-input:placeholder-shown) :is(.subtask-responsible, .subtask-deadline, .subtask-form-actions) { display: none; }
.subtask-add:not(:focus-within):has(.subtask-title-input:placeholder-shown) .subtask-title-input { grid-column: 2 / -1; }
@media (max-width: 767.98px) {
  .subtask-add { grid-template-columns: auto minmax(0, 1fr) 8.5rem auto; }
  .subtask-add .subtask-title-input { grid-column: 2 / -1; }
  .subtask-add .subtask-responsible { grid-column: 1 / 3; }
}
.subtask-fields { display: flex; flex: 1 1 20rem; flex-wrap: wrap; gap: 0.375rem; min-width: 0; }
.subtask-fields .subtask-title-input { flex: 1 1 12rem; min-width: 0; }
.subtask-fields .subtask-responsible { flex: 0 1 13rem; width: auto; min-width: 9.5rem; }
.subtask-fields .subtask-deadline { flex: 0 0 9.5rem; width: 9.5rem; }
.subtask-form-actions, .comment-form-actions { display: flex; gap: 0.375rem; margin-left: auto; }
.comment-form-actions { justify-content: flex-end; margin-top: 0.5rem; }
.subtask.is-ghost { opacity: 0.4; }
/* Phones: the title takes the row, the deadline, the person and the buttons go below it. */
@media (max-width: 575.98px) {
  .subtask-view { flex-wrap: wrap; row-gap: 0; }
  .subtask-title { flex: 1 1 calc(100% - 3.5rem); }
  .subtask-meta { flex: 1 1 100%; justify-content: flex-end; }
}
[data-two-step].is-armed { width: auto; padding-inline: 0.5rem; --bs-btn-color: var(--bs-danger-text-emphasis); --bs-btn-bg: var(--bs-danger-bg-subtle); font-size: 0.75rem; font-weight: 600; }

/* The activity (SPEC 15.4): the comments and the history in one list; the switch hides a kind. */
.feed-switch { margin-left: auto; }
.feed-switch .btn { --bs-btn-color: var(--app-text-muted); --bs-btn-active-color: var(--app-accent-fg); --bs-btn-active-bg: var(--app-accent-subtle); }
.feed-count { font-variant-numeric: tabular-nums; }
.feed-list { display: flex; flex-direction: column; gap: 0.75rem; margin: 0 0 0.75rem; }
.feed[data-feed-mode="comments"] [data-feed-item="event"],
.feed[data-feed-mode="history"] [data-feed-item="comment"] { display: none; }
.feed:not([data-feed-mode="comments"]) [data-feed-empty="comments"] { display: none; }
.feed-more { margin: 0 0 0.5rem; font-size: 0.8125rem; }
.feed-comment { display: flex; align-items: flex-start; gap: 0.625rem; }
.feed-comment-main { flex: 1 1 auto; min-width: 0; }
.feed-comment-box { padding: 0.625rem 0.75rem; border: 1px solid var(--app-border); border-radius: var(--app-radius); background: var(--app-task-soft); }
.feed-comment-head { display: flex; flex-wrap: wrap; align-items: center; gap: 0.25rem 0.5rem; margin-bottom: 0.25rem; }
.feed-comment-author { font-weight: 600; font-size: 0.875rem; }
.feed-time, .feed-edited { color: var(--app-text-muted); font-size: 0.75rem; }
.feed-edited { font-style: italic; }
.feed-comment-actions { display: inline-flex; gap: 0.125rem; margin-left: auto; }
.feed-comment-body[hidden], .comment-form[hidden] { display: none; }
.feed-event { display: flex; align-items: flex-start; gap: 0.625rem; padding-left: 0.6875rem; color: var(--app-text-muted); font-size: 0.8125rem; }
.feed-event-dot { flex: 0 0 auto; width: 0.5rem; height: 0.5rem; margin-top: 0.4375rem; margin-right: 0.6875rem; border-radius: 50%; background: var(--app-border-strong); }
.feed-event-body { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.125rem 0.375rem; min-width: 0; overflow-wrap: anywhere; }
.feed-event-who { color: var(--app-text); font-weight: 500; }
.feed-arrow { color: var(--app-text-muted); }
.feed-change { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 0.25rem; }
.feed-old { text-decoration: line-through; }
.feed-new { color: var(--app-text); }
.feed-items { display: inline-flex; flex-wrap: wrap; gap: 0.25rem; }
.feed-item { padding: 0 0.375rem; border-radius: var(--app-radius-sm); background: var(--app-surface-2); }
.comment-new { margin-top: 0.25rem; }
/* «Відповісти» (stage 10.4): the quote of the original above a reply (plain text, two lines
   at most; a click scrolls to the original and highlights it), the bar above the editor. */
.comment-quote {
  display: flex;
  flex-direction: column;
  gap: 0.0625rem;
  margin: 0 0 0.375rem;
  padding: 0.25rem 0.5rem;
  border-left: 3px solid color-mix(in srgb, var(--app-accent) 55%, var(--app-border-strong));
  border-radius: 0 var(--app-radius-sm) var(--app-radius-sm) 0;
  background: color-mix(in srgb, var(--app-surface-2) 70%, var(--app-surface));
  color: var(--app-text-muted);
  font-size: 0.8125rem;
  text-decoration: none;
}
a.comment-quote:hover { border-left-color: var(--app-accent); color: var(--app-text); text-decoration: none; }
a.comment-quote:focus-visible { outline: 2px solid var(--app-accent); outline-offset: 1px; }
.comment-quote.is-gone { font-style: italic; }
.comment-quote-author { color: var(--app-text); font-weight: 600; font-size: 0.75rem; }
.comment-quote-text {
  display: -webkit-box;
  overflow: hidden;
  white-space: pre-line;
  overflow-wrap: anywhere;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.feed-comment-box { transition: box-shadow var(--app-transition), border-color var(--app-transition); }
.feed-comment.is-highlighted .feed-comment-box { border-color: var(--app-accent); box-shadow: 0 0 0 3px var(--app-accent-ring); }
.comment-reply-bar {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  min-width: 0;
  margin-bottom: 0.375rem;
  padding: 0.125rem 0.125rem 0.125rem 0.625rem;
  border-radius: var(--app-radius);
  background: var(--app-accent-subtle);
  color: var(--app-accent-fg);
  font-size: 0.8125rem;
}
.comment-reply-bar[hidden] { display: none; }
.comment-attach { display: inline-flex; align-items: center; gap: 0.25rem; --bs-btn-color: var(--app-text-muted); }
/* The new comment's editor (stage 10.6): one frame — the toolbar, the text, a bottom bar with
   «Прикріпити» on the left and «Коментувати» on the right. */
.comment-composer { margin-top: 0.875rem; border: 1px solid var(--app-border-strong); border-radius: var(--app-radius); background: var(--app-surface); transition: border-color var(--app-transition), box-shadow var(--app-transition); }
.comment-composer:focus-within { border-color: var(--app-accent); box-shadow: 0 0 0 0.2rem color-mix(in srgb, var(--app-accent) 20%, transparent); }
.comment-composer .richtext-box, .comment-composer .richtext-box:focus-within { border: 0; background: transparent; box-shadow: none; }
.comment-composer .comment-reply-bar { margin: 0.5rem 0.5rem 0; }
.comment-composer .comment-form-actions { align-items: center; margin: 0; padding: 0.375rem 0.5rem; border-top: 1px solid var(--app-border); }
.comment-attached { flex: 1 1 auto; min-width: 0; align-self: center; }

/* Files (SPEC 15.6): a preview (the server's thumbnail) or an icon, the name, the details. */
.file-list { display: flex; flex-direction: column; gap: 0.375rem; margin: 0 0 0.5rem; }
.file-list-compact { margin: 0.5rem 0 0; }
.file-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0.5rem; }
@media (min-width: 768px) { .file-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.file-grid .file-item { padding: 0.5rem 0.375rem 0.5rem 0.5rem; }
.file-grid .file-name { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; overflow-wrap: normal; }
.file-grid .file-meta { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-download { color: var(--app-text-muted); }
/* The right panel's list (stage 10.10 A): one column, the name cut short (the whole of it, who
   and when in its hint), the size; «Завантажити» / «Видалити» on hover or focus (always on a
   touch screen; «Видалити?» stays while it waits for the second click). */
.file-list-side { gap: 0.25rem; }
.file-side { gap: 0.5rem; padding: 0.3125rem 0.25rem 0.3125rem 0.3125rem; }
.file-side .file-thumb { width: 2rem; height: 2rem; font-size: 1rem; }
.file-side .file-name { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; overflow-wrap: normal; font-size: 0.8125rem; }
.file-side .file-meta { white-space: nowrap; }
.file-actions { display: flex; flex: 0 0 auto; align-items: center; gap: 0.125rem; }
.file-actions .btn-icon { height: 1.75rem; }
.file-actions .btn-icon:not(.is-armed) { width: 1.75rem; font-size: 0.875rem; }
@media (hover: hover) {
  .file-side .file-actions { opacity: 0; transition: opacity var(--app-transition); }
  .file-side:hover .file-actions,
  .file-side:focus-within .file-actions,
  .file-side .file-actions:has(.is-armed) { opacity: 1; }
}
.file-chips { flex-direction: row; flex-wrap: wrap; }
.file-chip { display: inline-flex; max-width: 100%; padding: 0.25rem 0.5rem 0.25rem 0.25rem; gap: 0.5rem; }
.file-chip .file-thumb { width: 1.75rem; height: 1.75rem; font-size: 1rem; }
.file-chip .file-main { flex-direction: row; align-items: baseline; gap: 0.375rem; }
.file-chip .file-name { font-size: 0.8125rem; }
.file-item { display: flex; align-items: center; gap: 0.625rem; min-width: 0; padding: 0.375rem; border: 1px solid var(--app-border); border-radius: var(--app-radius); background: var(--app-surface); }
.file-thumb {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  overflow: hidden;
  border-radius: var(--app-radius-sm);
  background: var(--app-surface-2);
  color: var(--app-text-muted);
  font-size: 1.25rem;
}
.file-thumb img { width: 100%; height: 100%; object-fit: cover; }
.file-main { display: flex; flex: 1 1 auto; flex-direction: column; min-width: 0; }
.file-name { color: var(--app-text); font-weight: 500; }
.file-meta { color: var(--app-text-muted); font-size: 0.75rem; }
.file-delete { margin: 0; }
.file-drop { margin: 0; }
.file-drop-label {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin: 0;
  padding: 0.75rem;
  border: 1px dashed var(--app-border-strong);
  border-radius: var(--app-radius);
  color: var(--app-text-muted);
  font-size: 0.8125rem;
  text-align: center;
  cursor: pointer;
  transition: border-color var(--app-transition), background-color var(--app-transition);
}
.file-drop-label:hover, .file-drop.is-over .file-drop-label { border-color: var(--app-accent); background: var(--app-accent-subtle); color: var(--app-accent-fg); }
.file-drop-label:focus-within { outline: 2px solid var(--app-accent); outline-offset: 2px; }
/* The bottom of «Закриті» (stage 10.10 B): «50 / N» and «Показати ще» (a spinner while the
   next portion loads). */
.board-more {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  margin-top: 0.25rem;
  padding: 0.375rem 0.25rem 0.125rem;
  color: var(--app-text-muted);
  font-size: 0.8125rem;
}
.board-more-count { font-variant-numeric: tabular-nums; }
.board-more-button { display: inline-flex; align-items: center; gap: 0.375rem; }
.board-more .spinner-border { display: none; width: 0.875rem; height: 0.875rem; border-width: 0.15em; }
.board-more.is-loading .spinner-border { display: inline-block; }
/* The right panel's zone (stage 10.10 A): one short line. */
.file-drop-compact .file-drop-label { gap: 0.375rem; padding: 0.4375rem 0.5rem; font-size: 0.75rem; }
.file-drop-compact .file-drop-label .bi { font-size: 0.9375rem; }

/* The «Файли» tab: the type filter and the upload on one row, the table (cards on phones). */
.files-toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.5rem; margin: 0.75rem 0; }
.files-kinds { display: flex; flex-wrap: wrap; gap: 0.25rem; }
.files-kind { display: inline-flex; align-items: center; gap: 0.25rem; --bs-btn-color: var(--app-text-muted); }
.files-kind.is-active { --bs-btn-color: var(--app-accent-fg); --bs-btn-bg: var(--app-accent-subtle); --bs-btn-hover-color: var(--app-accent-fg); --bs-btn-hover-bg: var(--app-accent-subtle); }
.files-kind .tab-count { margin-left: 0; }
.files-upload { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; margin: 0; }
.files-upload label { cursor: pointer; }
.files-upload label:focus-within { outline: 2px solid var(--app-accent); outline-offset: 2px; }
.files-table { --bs-table-bg: transparent; }
.files-table th, .files-table td { vertical-align: middle; }
.files-table th { color: var(--app-text-muted); font-size: 0.8125rem; font-weight: 500; white-space: nowrap; }
.files-sort { color: inherit; }
.files-sort.is-active { color: var(--app-text); }
.files-col-thumb { width: 3.5rem; }
.files-col-date, .files-col-size { white-space: nowrap; }
.files-col-actions { width: 3rem; text-align: right; }
.files-col-name { min-width: 12rem; }
.files-mobile-meta { display: none; }
@media (max-width: 767.98px) {
  .files-table thead { display: none; }
  .files-table tr { display: grid; grid-template-columns: 3rem minmax(0, 1fr) auto; gap: 0 0.625rem; padding: 0.5rem 0.75rem; border-bottom: 1px solid var(--app-border); }
  .files-table td { display: block; padding: 0; border: 0; }
  .files-table .files-col-thumb { grid-row: span 2; width: auto; }
  .files-table .files-col-name { grid-column: 2; min-width: 0; }
  .files-table .files-col-actions { grid-column: 3; grid-row: 1 / span 2; width: auto; }
  .files-table .files-col-place { grid-column: 2; font-size: 0.8125rem; }
  .files-table .files-col-who, .files-table .files-col-date, .files-table .files-col-size { display: none; }
  .files-mobile-meta { display: block; color: var(--app-text-muted); font-size: 0.75rem; }
}

/* The forms of the module: «*» after a required field's label (no hint line, stage 10.4). */
.required-mark { margin-left: 0.125rem; color: color-mix(in srgb, var(--prio-critical) var(--prio-fg-ratio), var(--prio-mix-fg)); }

/* The task form: the priority as a list with its colour (the same height as the responsible
   person's picker next to it). */
.prio-pick { display: flex; align-items: center; gap: 0.5rem; }
.prio-pick::before { content: ""; flex: 0 0 auto; width: 0.5rem; height: 0.5rem; border-radius: 50%; background: var(--prio); }
.ts-wrapper.priority-select .ts-control { cursor: pointer; }
/* The labels (SPEC 15.5, stage 10.7 A): a list like the priority — a dot of the label's colour
   and its name in the list; in the field the labels' own coloured chips with «×». */
.label-pick { display: flex; align-items: center; gap: 0.5rem; }
.label-pick::before { content: ""; flex: 0 0 auto; width: 0.5rem; height: 0.5rem; border-radius: 50%; background: var(--project-hue); }
.ts-wrapper.labels-select.multi .ts-control > .item.task-label {
  padding: 0.0625rem 0.125rem 0.0625rem 0.4375rem;
  border: 1px solid transparent;
  border-radius: var(--app-radius-sm);
  background: color-mix(in srgb, var(--project-hue) 16%, var(--app-surface));
  color: color-mix(in srgb, var(--project-hue) var(--prio-fg-ratio), var(--prio-mix-fg));
  font-size: 0.75rem;
}
.ts-wrapper.labels-select.multi .ts-control > .item.task-label.active { border-color: var(--project-hue); }
.ts-wrapper.labels-select.plugin-remove_button .item.task-label .remove { color: inherit; opacity: 0.75; }
.ts-wrapper.labels-select.plugin-remove_button .item.task-label .remove:hover { opacity: 1; }
.labels-select.is-invalid + .ts-wrapper .ts-control { border-color: var(--prio-critical); }
.label-choices-empty { color: var(--app-text-muted); font-size: 0.8125rem; }

/* The labels page. */
.label-list > li + li { border-top: 1px solid var(--app-border); }
.label-row { display: flex; align-items: center; gap: 0.5rem; padding: 0.625rem 1rem; }
.label-row > .label-form { flex: 1 1 auto; min-width: 0; }
.label-form-row { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 0.75rem; }
.label-form-row > .flex-grow-1 { min-width: 10rem; }
.label-preview { min-width: 5rem; justify-content: center; }
.label-colors { margin: 0; }
.color-swatches-sm { gap: 0.375rem; }
.color-swatches-sm .color-swatch-dot { width: 1.25rem; height: 1.25rem; }

/* The projects' cards (SPEC 15.2): open / overdue tasks and «закрито N з M». */
.project-card-stats { display: flex; flex-wrap: wrap; gap: 0.25rem 0.75rem; color: var(--app-text-muted); font-size: 0.8125rem; }
.project-card-stats .is-overdue { color: color-mix(in srgb, var(--prio-critical) var(--prio-fg-ratio), var(--prio-mix-fg)); font-weight: 500; }
.project-progress { display: flex; flex-direction: column; gap: 0.25rem; font-size: 0.75rem; color: var(--app-text-muted); }
.project-progress-bar { height: 0.25rem; border-radius: 999px; background: var(--app-surface-2); overflow: hidden; }
.project-progress-bar > span { display: block; height: 100%; border-radius: inherit; background: var(--project-hue); }

/* «Запланувати зустріч» (SPEC 15.2, stage 10.4): the project's header and the task window's
   footer; only the icon on phones. The window on «Мої задачі» names its project (a link to
   the task on the board). */
.project-meeting, .task-meeting { display: inline-flex; align-items: center; gap: 0.375rem; white-space: nowrap; }
@media (max-width: 767.98px) {
  .project-meeting-text, .task-meeting-text { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
}

/* ------------------------------------------------------------ the bell (SPEC 15.8) */

/* Left of the theme switch: the icon with the count of unread notifications (99+); the panel
   below it (the last 50, unread first), on phones the whole screen. */
.bell-toggle { position: relative; }
.bell-count {
  position: absolute;
  top: 0.0625rem;
  right: -0.125rem;
  min-width: 1.125rem;
  height: 1.125rem;
  padding: 0 0.3125rem;
  border-radius: 999px;
  background: var(--app-accent);
  color: var(--app-on-accent);
  font-size: 0.6875rem;
  font-weight: 600;
  line-height: 1.125rem;
  text-align: center;
  font-variant-numeric: tabular-nums;
  box-shadow: 0 0 0 2px var(--app-surface);
}
.bell-count[hidden] { display: none; }
.bell-panel {
  width: 25rem;
  max-width: calc(100vw - 1.5rem);
  padding: 0;
  overflow: hidden;
}
.bell-head { display: flex; align-items: center; gap: 0.25rem; padding: 0.625rem 0.75rem 0.5rem 1rem; border-bottom: 1px solid var(--app-border); }
.bell-title { flex: 1 1 auto; margin: 0; font-size: 0.9375rem; font-weight: 600; }
.bell-read-all { display: inline-flex; align-items: center; gap: 0.375rem; font-size: 0.8125rem; }
.bell-read-all[hidden] { display: none; }
.bell-close { display: none; }
.bell-list { max-height: min(32rem, calc(100vh - 10rem)); overflow-y: auto; }
.bell-loading { margin: 0; padding: 1.25rem 1rem; font-size: 0.875rem; }
.bell-items { margin: 0; }
.bell-items li + li { border-top: 1px solid var(--app-border); }
.bell-item {
  position: relative;
  display: flex;
  gap: 0.75rem;
  padding: 0.625rem 2rem 0.625rem 1rem;
  color: var(--app-text);
  font-size: 0.8125rem;
  line-height: 1.4;
  text-decoration: none;
}
.bell-item:hover { background: var(--app-surface-2); color: var(--app-text); text-decoration: none; }
.bell-item:focus-visible { outline: 2px solid var(--app-accent); outline-offset: -2px; }
.bell-item.is-unread { background: var(--app-accent-subtle); }
.bell-item.is-unread:hover { background: color-mix(in srgb, var(--app-accent) 14%, var(--app-surface)); }
.bell-item-icon {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 50%;
  background: var(--app-surface-2);
  color: var(--app-text-muted);
  font-size: 0.875rem;
}
.bell-item.is-unread .bell-item-icon { background: var(--app-surface); color: var(--app-accent-fg); }
.bell-item-main { display: flex; flex: 1 1 auto; flex-direction: column; gap: 0.125rem; min-width: 0; }
.bell-item-target { display: flex; align-items: center; gap: 0.375rem; min-width: 0; font-weight: 600; }
.bell-item-project { display: inline-flex; flex: 0 0 auto; }
.bell-item-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bell-item-line { color: var(--app-text); }
.bell-item-who { font-weight: 500; }
.bell-item-extra {
  display: -webkit-box;
  overflow: hidden;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  padding-left: 0.5rem;
  border-left: 2px solid var(--app-border-strong);
  color: var(--app-text-muted);
}
.bell-item-time { color: var(--app-text-muted); font-size: 0.75rem; }
.bell-item-dot {
  position: absolute;
  top: 1rem;
  right: 0.875rem;
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: var(--app-accent);
}
.bell-empty .empty-state { padding: 2rem 1.25rem; }
.bell-foot { padding: 0.5rem 1rem; border-top: 1px solid var(--app-border); font-size: 0.8125rem; }
.bell-foot a { display: inline-flex; align-items: center; gap: 0.375rem; }
.bell-page .bell-list, .bell-page { max-height: none; }
/* Phones: the panel is the whole screen under nothing (its own header with «×»). */
@media (max-width: 575.98px) {
  .bell-panel.show {
    position: fixed !important;
    inset: 0 !important;
    z-index: 1060;
    display: flex;
    flex-direction: column;
    width: 100vw;
    max-width: none;
    height: 100vh;
    height: 100dvh;
    margin: 0 !important;
    border: 0;
    border-radius: 0;
    transform: none !important;
  }
  .bell-panel .bell-list { flex: 1 1 auto; max-height: none; }
  .bell-close { display: inline-flex; }
  body.bell-is-open { overflow: hidden; }
  body.bell-is-open .assistant-fab { display: none; }
}

/* The table «подія × канал» of the settings (SPEC 15.8): a row per event; on phones the
   event above its three channels. */
.notify-table { width: 100%; margin: 0 0 1rem; border-collapse: collapse; font-size: 0.875rem; }
.notify-table th { padding: 0 0.5rem 0.5rem; color: var(--app-text-muted); font-size: 0.75rem; font-weight: 600; text-align: center; white-space: nowrap; }
.notify-table th:first-child { padding-left: 0; text-align: left; }
.notify-table td { padding: 0.5rem; border-top: 1px solid var(--app-border); vertical-align: middle; text-align: center; }
.notify-table td:first-child { padding-left: 0; text-align: left; }
.notify-table .form-switch { display: inline-flex; justify-content: center; min-height: 0; margin: 0; padding-left: 2.5em; }
.notify-table .form-select { min-width: 13.5rem; }
.notify-cell-label { display: none; }
.notify-none { color: var(--app-text-muted); }
@media (max-width: 575.98px) {
  .notify-table thead { display: none; }
  .notify-table tr { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 0.375rem 1.25rem; padding: 0.75rem 0; border-top: 1px solid var(--app-border); }
  .notify-table td { display: flex; align-items: center; gap: 0.5rem; padding: 0; border: 0; text-align: left; white-space: nowrap; }
  .notify-table td:first-child { grid-column: 1 / -1; font-weight: 500; white-space: normal; }
  .notify-table td:last-child { grid-column: 1 / -1; }
  .notify-cell-label { display: inline; color: var(--app-text-muted); font-size: 0.75rem; }
  .notify-table td:last-child .notify-cell-label { min-width: 3rem; }
  .notify-table .form-select { flex: 1 1 auto; min-width: 0; }
}
