/* ==========================================================================
   Delta-1 — additive UI layer.
   Scoped by prefixes only: a1-d1-*, a1-proj-*, a1-onb-*, a1-tma-*, a1-sheet-*.
   It never redefines a shared Avatar One component; it consumes the accepted
   tokens (--bg, --surface, --border, --text, --text-2, --radius, --font) and
   stays inside the Telegram safe-area variables owned by app.css.
   ========================================================================== */

/* --------------------------------------------------------------------------
   /tg/ outside Telegram
   -------------------------------------------------------------------------- */

.a1-tg-outside {
  min-height: 100vh;
  min-height: 100dvh;
  box-sizing: border-box;
  display: grid;
  place-content: center;
  gap: 14px;
  padding: calc(env(safe-area-inset-top, 0px) + 32px) 24px calc(env(safe-area-inset-bottom, 0px) + 32px);
  background: var(--bg, #000);
  color: var(--text, #fff);
  text-align: center;
  font: 400 16px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
.a1-tg-outside h1 { margin: 0; font-size: 26px; line-height: 1.15; font-weight: 500; }
.a1-tg-outside p { max-width: 340px; margin: 0 auto; color: var(--text-2, #9a9a9a); }
.a1-tg-outside a {
  justify-self: center;
  margin-top: 6px;
  padding: 11px 18px;
  border: 1px solid var(--border, #333);
  border-radius: 999px;
  color: var(--text, #fff);
  text-decoration: none;
  font-weight: 500;
}

/* --------------------------------------------------------------------------
   Telegram Mini App shell: one extra row under the shared view
   -------------------------------------------------------------------------- */

.a1-tma-nav { display: none; }

html.is-tma #app {
  display: flex;
  flex-direction: column;
}
html.is-tma .view-root {
  flex: 1 1 0%;
  min-height: 0;
  height: auto;
  overflow: hidden;
  /* The bottom bar owns the Home Indicator strip; content above it must not
     reserve the same inset a second time. */
  --safe-bottom: 0px;
}
html.is-tma .composer {
  padding-bottom: 5px;
}
/* The shared composer keeps its mode pills on one clipped row; on a 390 px
   Mini App that row is wider than the field (the last pill is cut off).
   Give the bar a second line inside the field instead of clipping controls. */
html.is-tma .pi-bar {
  height: auto;
  min-height: 48px;
  flex-wrap: wrap;
  align-content: center;
  padding: 6px 8px;
}
html.is-tma .pi-input { flex: 1 1 120px; }
html.is-tma .pi-live {
  height: 30px;
  padding: 0 9px;
  font-size: 12px;
  white-space: nowrap;
}
html.is-tma .a1-tma-nav {
  position: relative;
  z-index: 20;
  flex: 0 0 auto;
  display: flex;
  align-items: stretch;
  justify-content: space-around;
  gap: 2px;
  box-sizing: border-box;
  padding: 6px 6px var(--safe-bottom-device, 0px);
  border-top: 1px solid var(--border);
  background: var(--bg);
  color: var(--text-2);
}
html.is-tma.is-keyboard-open .a1-tma-nav { display: none; }
html.is-tma .a1-tma-nav.is-hidden { display: none; }
/* Shared toasts sit over the column; the bottom bar is a new row, so lift them above it. */
html.is-tma .app-toasts { bottom: calc(var(--safe-bottom-device, 0px) + 68px) !important; }
html.is-tma.is-keyboard-open .app-toasts { bottom: calc(var(--safe-bottom-device, 0px) + 12px) !important; }
html.is-tma .a1-tma-nav__item {
  position: relative;
  display: flex;
  flex: 1 1 0;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  min-width: 0;
  min-height: 48px;
  padding: 4px 2px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--text-2);
  font: 500 11px/1.1 var(--font);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
html.is-tma .a1-tma-nav__item svg { width: 22px; height: 22px; }
html.is-tma .a1-tma-nav__item.is-active { color: var(--text); }
html.is-tma .a1-tma-nav__item > svg,
html.is-tma .a1-tma-nav__label {
  position: relative;
  z-index: 1;
}
html.is-tma .a1-tma-nav__item.is-active::before {
  content: "";
  position: absolute;
  top: 2px;
  left: 50%;
  width: 28px;
  height: 28px;
  border-radius: 10px;
  background: var(--surface-2);
  transform: translateX(-50%);
  z-index: 0;
}
html.is-tma .a1-tma-nav__item:active { background: var(--surface-2); }
html.is-tma .a1-tma-nav__label {
  display: block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
html.is-tma .a1-tma-nav__badge {
  position: absolute;
  top: 8px;
  left: calc(50% + 8px);
  width: 7px;
  height: 7px;
  border: 1.5px solid var(--bg);
  border-radius: 50%;
  background: var(--accent, #fff);
}

@media (min-width: 1024px) {
  html.is-tma #app { display: grid; }
  html.is-tma .a1-tma-nav { display: none; }
  html.is-tma .view-root { --safe-bottom: var(--safe-bottom-device); }
}

/* --------------------------------------------------------------------------
   Shared Delta-1 primitives
   -------------------------------------------------------------------------- */

.a1-d1-page {
  box-sizing: border-box;
  height: 100%;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: calc(var(--safe-top) + 24px) calc(var(--safe-right) + 24px) calc(var(--safe-bottom) + 32px) calc(var(--safe-left) + 24px);
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
}
.a1-d1-kicker {
  margin: 0 0 6px;
  color: var(--text-2);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.a1-d1-muted { color: var(--text-2); font-size: 14px; line-height: 1.45; }
.a1-d1-error { margin: 8px 0 0; color: var(--danger-text, #ff6c6a); font-size: 14px; line-height: 1.4; }
.a1-d1-hint { display: block; margin-top: 5px; color: var(--text-2); font-size: 12px; line-height: 1.35; }
.a1-d1-primary,
.a1-d1-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 40px;
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: 999px;
  font: 500 14px/1 var(--font);
  cursor: pointer;
  white-space: nowrap;
}
.a1-d1-primary { background: var(--text); color: var(--bg); }
.a1-d1-primary:disabled { opacity: 0.45; cursor: default; }
.a1-d1-secondary { border-color: var(--border); background: transparent; color: var(--text); }
.a1-d1-secondary:hover { background: var(--surface-2); }
.a1-d1-primary svg, .a1-d1-secondary svg { width: 17px; height: 17px; }
.a1-d1-icon-btn {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--text-2);
  cursor: pointer;
}
.a1-d1-icon-btn:hover { background: var(--surface-2); color: var(--text); }
.a1-d1-icon-btn svg { width: 17px; height: 17px; }
.a1-d1-danger { color: var(--danger-text, #ff6c6a); }
.a1-d1-chip {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 2px 9px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text-2);
  font-size: 11px;
  line-height: 1.2;
  font-weight: 500;
  white-space: nowrap;
}
.a1-d1-chip--active { background: color-mix(in oklab, var(--text) 12%, transparent); color: var(--text); }
.a1-d1-chip--done { background: color-mix(in oklab, #57c46a 16%, transparent); color: #8ee19b; }
.a1-d1-chip--paused { background: color-mix(in oklab, #e6b84f 16%, transparent); color: #e7c46b; }
.a1-d1-chip--task-todo { background: var(--surface-2); }
.a1-d1-chip--task-doing { background: color-mix(in oklab, #5aa7ff 16%, transparent); color: #8bc4ff; }
.a1-d1-chip--task-waiting { background: color-mix(in oklab, #e6b84f 16%, transparent); color: #e7c46b; }
.a1-d1-chip--task-done { background: color-mix(in oklab, #57c46a 16%, transparent); color: #8ee19b; }
.a1-d1-chip--assignee { background: transparent; border: 1px solid var(--border); }
.a1-d1-avatar {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 36px;
  height: 36px;
  overflow: hidden;
  border-radius: 50%;
  background: var(--surface-3);
  color: var(--text-2);
  font-size: 12px;
  font-weight: 600;
}
.a1-d1-avatar--sm { width: 30px; height: 30px; font-size: 11px; }
.a1-d1-avatar img { width: 100%; height: 100%; object-fit: cover; }

.a1-d1-input,
.a1-d1-textarea,
.a1-d1-select {
  box-sizing: border-box;
  width: 100%;
  min-height: 42px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  font: 400 16px/1.4 var(--font);
  outline: none;
}
.a1-d1-input:focus,
.a1-d1-textarea:focus,
.a1-d1-select:focus { border-color: var(--text-2); }
.a1-d1-textarea { min-height: 84px; resize: vertical; }
.a1-d1-select { appearance: none; }

/* --------------------------------------------------------------------------
   Projects — list
   -------------------------------------------------------------------------- */

.a1-projects { max-width: 1180px; margin: 0 auto; }
.a1-proj-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 22px;
}
.a1-proj-head__titles { min-width: 0; }
.a1-proj-title { margin: 0 0 8px; font-size: clamp(28px, 4vw, 38px); line-height: 1.06; font-weight: 500; letter-spacing: -0.02em; }
.a1-proj-sub { max-width: 680px; margin: 0; color: var(--text-2); font-size: 14px; line-height: 1.5; }
.a1-proj-stats { display: flex; flex-wrap: wrap; gap: 10px; margin: 18px 0 20px; }
.a1-proj-stat {
  display: flex;
  align-items: baseline;
  gap: 7px;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
}
.a1-proj-stat__value { font-size: 18px; font-weight: 600; }
.a1-proj-stat__label { color: var(--text-2); font-size: 12px; }
.a1-proj-tabs {
  display: flex;
  gap: 4px;
  margin: 0 0 18px;
  padding: 3px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  overflow-x: auto;
  scrollbar-width: none;
}
.a1-proj-tabs::-webkit-scrollbar { display: none; }
.a1-proj-tab {
  flex: none;
  min-height: 34px;
  padding: 0 13px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--text-2);
  font: 500 13px/1 var(--font);
  cursor: pointer;
  white-space: nowrap;
}
.a1-proj-tab:hover { color: var(--text); }
.a1-proj-tab.is-active { background: var(--surface-3); color: var(--text); }
.a1-proj-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(285px, 1fr)); gap: 12px; }
.a1-proj-card {
  display: flex;
  flex-direction: column;
  gap: 11px;
  box-sizing: border-box;
  min-height: 208px;
  padding: 17px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  transition: background 0.14s ease, border-color 0.14s ease, transform 0.14s ease;
}
.a1-proj-card:hover { background: var(--surface-2); border-color: var(--border); }
.a1-proj-card:focus-visible { outline: 2px solid var(--text-2); outline-offset: 2px; }
.a1-proj-card:active { transform: scale(0.995); }
.a1-proj-card--done { opacity: 0.78; }
.a1-proj-card__top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.a1-proj-card__title { margin: 0; font-size: 17px; line-height: 1.25; font-weight: 600; letter-spacing: -0.01em; }
.a1-proj-card__status { flex: none; }
.a1-proj-card__goal {
  display: -webkit-box;
  margin: -3px 0 0;
  overflow: hidden;
  color: var(--text-2);
  font-size: 13px;
  line-height: 1.4;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}
.a1-proj-card__progress {
  position: relative;
  height: 5px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--surface-3);
}
.a1-proj-card__fill {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--text);
  transition: width 0.35s cubic-bezier(0.2, 0.7, 0.2, 1);
}
.a1-proj-card__meta { display: flex; flex-wrap: wrap; gap: 4px 12px; color: var(--text-2); font-size: 12px; }
.a1-proj-card__foot {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 10px;
  margin-top: auto;
  padding-top: 9px;
  border-top: 1px solid var(--border);
}
.a1-proj-card__next-label { display: block; color: var(--text-2); font-size: 10px; text-transform: uppercase; letter-spacing: 0.04em; }
.a1-proj-card__next { display: block; margin-top: 3px; font-size: 12px; line-height: 1.3; }
.a1-proj-card__updated { flex: none; color: var(--text-2); font-size: 11px; }
.a1-proj-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 52px 24px;
  border: 1px dashed var(--border);
  border-radius: 18px;
  text-align: center;
}
.a1-proj-empty__mark { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 14px; background: var(--surface-2); color: var(--text-2); font-size: 20px; }
.a1-proj-empty__mark svg { width: 22px; height: 22px; }
.a1-proj-empty__title { margin: 2px 0 0; font-size: 20px; font-weight: 500; }
.a1-proj-empty__text { max-width: 420px; margin: 0 0 6px; color: var(--text-2); font-size: 14px; line-height: 1.45; }
.a1-proj-loading { display: grid; place-items: center; min-height: 220px; }

/* --------------------------------------------------------------------------
   Projects — detail
   -------------------------------------------------------------------------- */

.a1-proj-detail { max-width: 960px; margin: 0 auto; }
.a1-proj-back {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  min-height: 34px;
  margin: 0 0 14px -8px;
  padding: 0 8px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text-2);
  font: 500 13px/1 var(--font);
  cursor: pointer;
}
.a1-proj-back:hover { background: var(--surface-2); color: var(--text); }
.a1-proj-back svg { width: 17px; height: 17px; }
.a1-proj-detail__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 18px; }
.a1-proj-detail__titles { min-width: 0; }
.a1-proj-detail__title { margin: 0 0 7px; font-size: clamp(25px, 4vw, 34px); line-height: 1.08; font-weight: 500; letter-spacing: -0.02em; }
.a1-proj-detail__goal { max-width: 680px; margin: 0; color: var(--text-2); font-size: 14px; line-height: 1.5; }
.a1-proj-detail__progress { display: flex; align-items: center; gap: 14px; margin-top: 14px; }
.a1-proj-detail__progress-text { display: flex; flex-direction: column; gap: 2px; flex: none; }
.a1-proj-detail__progress-text strong { font-size: 14px; font-weight: 600; }
.a1-proj-detail__progress-text span { color: var(--text-2); font-size: 11px; }
.a1-proj-detail__track { flex: 1 1 auto; min-width: 90px; }
.a1-proj-detail__actions { display: flex; align-items: center; gap: 6px; flex: none; }
.a1-proj-detail__tabs { margin-bottom: 14px; }
.a1-proj-detail__body { padding-bottom: 20px; }
.a1-proj-section {
  display: flex;
  flex-direction: column;
  gap: 13px;
  padding: 17px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface);
}
.a1-proj-section__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; }
.a1-proj-section__title { margin: 0; font-size: 17px; line-height: 1.25; font-weight: 600; }
.a1-proj-section__hint { margin: 4px 0 0; max-width: 620px; color: var(--text-2); font-size: 12.5px; line-height: 1.4; }
.a1-proj-next {
  display: flex;
  flex-direction: column;
  gap: 7px;
  padding: 15px;
  border-radius: 12px;
  background: var(--surface-2);
}
.a1-proj-next__label { color: var(--text-2); font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; }
.a1-proj-next__title { font-size: 17px; line-height: 1.25; font-weight: 500; }
.a1-proj-next__actions { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 3px; }
.a1-proj-overview-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.a1-proj-activity { display: flex; flex-direction: column; gap: 0; }
.a1-proj-activity__title { margin: 4px 0 8px; color: var(--text-2); font-size: 12px; font-weight: 500; text-transform: uppercase; letter-spacing: 0.04em; }
.a1-proj-activity__row { display: flex; align-items: center; gap: 9px; padding: 9px 0; border-top: 1px solid var(--border); font-size: 13px; }
.a1-proj-activity__dot { flex: none; width: 5px; height: 5px; border-radius: 50%; background: var(--text-2); }
.a1-proj-activity__text { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.a1-proj-activity__text span { color: var(--text-2); }
.a1-proj-activity__time { flex: none; color: var(--text-2); font-size: 11px; }
.a1-proj-add { display: flex; gap: 8px; }
.a1-proj-add .a1-d1-input { flex: 1 1 auto; }
.a1-proj-empty-line { padding: 12px 0 2px; }
.a1-proj-tasks { display: flex; flex-direction: column; gap: 6px; }
.a1-proj-task {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 4px;
  border-top: 1px solid var(--border);
}
.a1-proj-task:first-child { border-top: 0; }
.a1-proj-task.is-done .a1-proj-task__title { color: var(--text-2); text-decoration: line-through; }
.a1-proj-check {
  flex: none;
  display: grid;
  place-items: center;
  width: 25px;
  height: 25px;
  margin-top: 1px;
  padding: 0;
  border: 1.5px solid var(--border);
  border-radius: 50%;
  background: transparent;
  color: var(--bg);
  cursor: pointer;
}
.a1-proj-check.is-checked { border-color: var(--text); background: var(--text); }
.a1-proj-check svg { width: 14px; height: 14px; }
.a1-proj-task__text { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 5px; }
.a1-proj-task__title { font-size: 14px; line-height: 1.35; font-weight: 500; overflow-wrap: anywhere; }
.a1-proj-task__meta { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; }
.a1-proj-task__note { color: var(--text-2); font-size: 12px; }
.a1-proj-task__actions { display: flex; align-items: center; gap: 1px; flex: none; }
.a1-proj-assign {
  min-height: 27px;
  padding: 0 8px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: transparent;
  color: var(--text-2);
  font: 500 10px/1 var(--font);
  cursor: pointer;
}
.a1-proj-assign:hover { color: var(--text); }
.a1-proj-mandates, .a1-proj-materials, .a1-proj-results { display: flex; flex-direction: column; gap: 6px; }
.a1-proj-mandate, .a1-proj-material, .a1-proj-result {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 4px;
  border-top: 1px solid var(--border);
}
.a1-proj-mandate:first-child, .a1-proj-material:first-child, .a1-proj-result:first-child { border-top: 0; }
.a1-proj-mandate.is-decision { border-left: 2px solid var(--accent, #fff); padding-left: 9px; }
.a1-proj-mandate.is-done { opacity: 0.75; }
.a1-proj-mandate__text, .a1-proj-material__text, .a1-proj-result__text { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.a1-proj-mandate__title, .a1-proj-material__title { font-size: 13.5px; line-height: 1.3; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.a1-proj-mandate__meta, .a1-proj-material__meta { display: flex; flex-wrap: wrap; gap: 4px 9px; color: var(--text-2); font-size: 11.5px; }
.a1-proj-mandate__actions, .a1-proj-material__actions { display: flex; align-items: center; gap: 2px; flex: none; }
.a1-proj-link {
  min-height: 30px;
  padding: 0 8px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--text-2);
  font: 500 12px/1 var(--font);
  cursor: pointer;
}
.a1-proj-link:hover { background: var(--surface-2); color: var(--text); }
.a1-proj-material__mark, .a1-d1-file-mark {
  flex: none;
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: var(--surface-2);
  color: var(--text-2);
  font-size: 10px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.a1-proj-result__mark { flex: none; display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--surface-2); color: var(--text); font-size: 12px; }
.a1-proj-result__time { flex: none; color: var(--text-2); font-size: 11px; }
.a1-proj-result--quiet { color: var(--text-2); }
.a1-proj-result--quiet .a1-proj-result__text { font-size: 13px; }
.a1-proj-subhead { margin: 8px 0 0; color: var(--text-2); font-size: 12px; font-weight: 500; text-transform: uppercase; letter-spacing: 0.04em; }

/* --------------------------------------------------------------------------
   Sheets / pickers
   -------------------------------------------------------------------------- */

.a1-d1-sheet {
  position: fixed;
  z-index: 320;
  inset: 0;
  display: grid;
  place-items: center;
  box-sizing: border-box;
  padding: 18px;
  background: rgba(0, 0, 0, 0.52);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
}
.a1-d1-sheet__card {
  display: flex;
  flex-direction: column;
  width: min(540px, 100%);
  max-height: min(86vh, 760px);
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--bg);
  color: var(--text);
  box-shadow: 0 22px 70px rgba(0, 0, 0, 0.4);
}
.a1-d1-sheet__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 18px 10px; }
.a1-d1-sheet__title { margin: 0; font-size: 18px; line-height: 1.2; font-weight: 600; }
.a1-d1-sheet__body { min-height: 0; overflow-y: auto; padding: 6px 18px 14px; }
.a1-d1-sheet__foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 18px calc(14px + var(--safe-bottom-device, 0px)); border-top: 1px solid var(--border); }
.a1-d1-form { display: flex; flex-direction: column; gap: 14px; }
.a1-d1-form__foot { display: flex; justify-content: flex-end; gap: 8px; }
.a1-d1-field { display: flex; flex-direction: column; gap: 6px; }
.a1-d1-label { color: var(--text-2); font-size: 12px; font-weight: 500; }
.a1-d1-picker { display: flex; flex-direction: column; gap: 4px; }
.a1-d1-pick-row {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  box-sizing: border-box;
  padding: 10px 8px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}
.a1-d1-pick-row:hover { background: var(--surface-2); }
.a1-d1-pick-row:disabled { opacity: 0.5; cursor: default; }
.a1-d1-pick-row__text { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.a1-d1-pick-row__text strong { font-size: 13.5px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.a1-d1-pick-row__meta { color: var(--text-2); font-size: 11.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.a1-d1-pick-row__plus { flex: none; color: var(--text-2); font-size: 18px; line-height: 1; }
.a1-d1-upload-row { display: flex; align-items: center; gap: 10px; padding: 6px 0 10px; border-bottom: 1px solid var(--border); margin-bottom: 4px; }

/* --------------------------------------------------------------------------
   Onboarding
   -------------------------------------------------------------------------- */

.a1-onb {
  position: fixed;
  z-index: 400;
  inset: 0;
  display: grid;
  place-items: center;
  box-sizing: border-box;
  padding: max(14px, env(safe-area-inset-top, 0px)) 14px max(14px, env(safe-area-inset-bottom, 0px));
  background: color-mix(in oklab, var(--bg) 86%, transparent);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}
.a1-onb__card {
  display: flex;
  flex-direction: column;
  width: min(620px, 100%);
  max-height: min(92vh, 860px);
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 22px;
  background: var(--bg);
  color: var(--text);
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.45);
}
.a1-onb__top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 18px 10px; }
.a1-onb__brand { display: inline-flex; align-items: center; gap: 7px; color: var(--text-2); font: 500 12px/1 var(--font); letter-spacing: 0.02em; }
.a1-onb__dot { width: 6px; height: 6px; border-radius: 50%; background: var(--text-2); }
.a1-onb__skip {
  min-height: 32px;
  padding: 0 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text-2);
  font: 500 13px/1 var(--font);
  cursor: pointer;
}
.a1-onb__skip:hover { background: var(--surface-2); color: var(--text); }
.a1-onb__progress { flex: none; height: 2px; margin: 0 18px; overflow: hidden; border-radius: 999px; background: var(--surface-3); }
.a1-onb__progress-fill { display: block; height: 100%; border-radius: inherit; background: var(--text); transition: width 0.35s cubic-bezier(0.2, 0.7, 0.2, 1); }
.a1-onb__content { min-height: 0; overflow-y: auto; padding: 20px 22px 16px; }
.a1-onb__count { margin-bottom: 8px; color: var(--text-2); font-size: 11px; letter-spacing: 0.02em; }
.a1-onb__title { margin: 0 0 9px; font-size: clamp(24px, 4vw, 32px); line-height: 1.08; font-weight: 500; letter-spacing: -0.02em; }
.a1-onb__text { max-width: 560px; margin: 0 0 18px; color: var(--text-2); font-size: 14px; line-height: 1.5; }
.a1-onb__cards { display: flex; flex-direction: column; gap: 8px; }
.a1-onb__cards--three { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.a1-onb__mini { display: flex; flex-direction: column; gap: 4px; padding: 12px; border-radius: 12px; background: var(--surface); border: 1px solid var(--border); }
.a1-onb__mini strong { font-size: 13px; font-weight: 600; }
.a1-onb__mini span { color: var(--text-2); font-size: 12px; line-height: 1.35; }
.a1-onb__step-card { display: flex; gap: 11px; padding: 13px; border-radius: 12px; background: var(--surface); border: 1px solid var(--border); }
.a1-onb__step-num { flex: none; display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--surface-3); color: var(--text); font-size: 11px; font-weight: 600; }
.a1-onb__step-card strong { display: block; font-size: 13.5px; font-weight: 600; }
.a1-onb__step-card p { margin: 3px 0 0; color: var(--text-2); font-size: 12px; line-height: 1.4; }
.a1-onb__note { margin: 14px 0 0; color: var(--text-2); font-size: 12px; line-height: 1.45; }
.a1-onb__prompts { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.a1-onb__prompt {
  min-height: 30px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: transparent;
  color: var(--text-2);
  font: 500 11.5px/1 var(--font);
  cursor: pointer;
}
.a1-onb__prompt:hover { color: var(--text); background: var(--surface-2); }
.a1-onb__textarea { min-height: 88px; }
.a1-onb__rows { display: flex; flex-direction: column; gap: 6px; }
.a1-onb__row { display: flex; align-items: center; gap: 10px; padding: 11px 12px; border-radius: 12px; background: var(--surface); border: 1px solid var(--border); }
.a1-onb__row-mark { flex: none; display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--surface-3); color: var(--text-2); font-size: 11px; }
.a1-onb__row strong { display: block; font-size: 13px; font-weight: 600; }
.a1-onb__row p { margin: 2px 0 0; color: var(--text-2); font-size: 12px; line-height: 1.35; }
.a1-onb__row > div { flex: 1 1 auto; min-width: 0; }
.a1-onb__foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 18px calc(14px + env(safe-area-inset-bottom, 0px)); border-top: 1px solid var(--border); }
.a1-onb__dots { display: flex; gap: 5px; flex: none; }
.a1-onb__dots .a1-onb__dot { width: 5px; height: 5px; background: var(--surface-3); }
.a1-onb__dots .a1-onb__dot.is-active { background: var(--text); }
.a1-onb__actions { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; justify-content: flex-end; }
.a1-onb__back, .a1-onb__skip-step {
  min-height: 40px;
  padding: 0 13px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--text-2);
  font: 500 13px/1 var(--font);
  cursor: pointer;
}
.a1-onb__back:hover, .a1-onb__skip-step:hover { background: var(--surface-2); color: var(--text); }

/* --------------------------------------------------------------------------
   Telegram account connection (inside the Mini App)
   -------------------------------------------------------------------------- */

.a1-tg-connect { max-width: 560px; margin: 0 auto; }
.a1-tg-connect__card { display: flex; flex-direction: column; gap: 12px; padding: 20px; border: 1px solid var(--border); border-radius: 18px; background: var(--surface); }
.a1-tg-connect__title { margin: 0; font-size: 27px; line-height: 1.1; font-weight: 500; letter-spacing: -0.02em; }
.a1-tg-connect__text { margin: 0 0 4px; color: var(--text-2); font-size: 14px; line-height: 1.5; }
.a1-tg-connect__done { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; }
.a1-tg-connect__done[hidden],
.a1-tg-connect .a1-d1-form[hidden],
.a1-tg-connect .a1-d1-field[hidden] { display: none !important; }
.a1-tg-connect__mark { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; background: var(--surface-3); color: var(--text); font-size: 17px; }
.a1-tg-connect__done h2 { margin: 0; font-size: 20px; font-weight: 600; }
.a1-tg-connect__done p { margin: 0 0 6px; }

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */

@media (max-width: 720px) {
  .a1-d1-page {
    padding: calc(var(--safe-top) + 16px) calc(var(--safe-right) + 14px) calc(var(--safe-bottom) + 22px) calc(var(--safe-left) + 14px);
  }
  .a1-proj-head { flex-direction: column; gap: 14px; }
  .a1-proj-head > .a1-d1-primary { align-self: stretch; }
  .a1-proj-title { font-size: 30px; }
  .a1-proj-grid { grid-template-columns: 1fr; }
  .a1-proj-card { min-height: 0; }
  .a1-proj-stats { gap: 6px; }
  .a1-proj-stat { flex: 1 1 calc(50% - 6px); padding: 9px 11px; }
  .a1-proj-detail__head { flex-direction: column; gap: 12px; }
  .a1-proj-detail__actions { align-self: stretch; justify-content: flex-end; }
  .a1-proj-detail__progress { flex-direction: column; align-items: stretch; gap: 7px; }
  .a1-proj-section { padding: 14px; border-radius: 14px; }
  .a1-proj-section__head { flex-direction: column; gap: 9px; }
  .a1-proj-section__head > .a1-d1-secondary { align-self: flex-start; }
  .a1-proj-overview-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .a1-proj-task__actions { flex-wrap: wrap; justify-content: flex-end; max-width: 108px; }
  .a1-onb__card { max-height: 94dvh; border-radius: 18px; }
  .a1-onb__content { padding: 16px 16px 12px; }
  .a1-onb__cards--three { grid-template-columns: 1fr; }
  .a1-onb__foot { align-items: flex-end; }
  .a1-onb__actions { flex-direction: column-reverse; align-items: stretch; }
  .a1-onb__actions > button { width: 100%; }
  .a1-onb__dots { align-self: flex-end; }
  .a1-d1-sheet { padding: 0; align-items: end; }
  .a1-d1-sheet__card { width: 100%; max-height: 88dvh; border-radius: 18px 18px 0 0; border-bottom: 0; }
  .a1-d1-sheet__foot { padding-bottom: calc(14px + env(safe-area-inset-bottom, 0px)); }
}

@media (max-width: 380px) {
  .a1-proj-card__foot { align-items: flex-start; flex-direction: column; }
  .a1-proj-mandate, .a1-proj-material { align-items: flex-start; }
  .a1-proj-mandate__actions, .a1-proj-material__actions { flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
  .a1-proj-card, .a1-proj-card__fill, .a1-onb__progress-fill { transition: none; }
}

/* --------------------------------------------------------------------------
   Invitations (5.7) — account-menu submenu + scoped sheet
   -------------------------------------------------------------------------- */

.a1-invite-menu-label {
  margin: 6px 8px 3px;
  padding: 0 2px;
  color: var(--text-2);
  font: 500 10px/1.2 var(--font);
  letter-spacing: .06em;
  text-transform: uppercase;
}
.a1-invite-menu-item {
  display: flex !important;
  align-items: center;
  gap: 8px;
  padding-left: 20px !important;
  color: var(--text-2) !important;
}
.a1-invite-menu-item:hover { color: var(--text) !important; }
.a1-invite-menu-item__icon {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 18px;
  height: 18px;
}
.a1-invite-menu-item__icon svg { width: 16px; height: 16px; }
.a1-invite-menu-item > span:last-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.a1-invite-sheet .a1-invite-card { width: min(620px, 100%); }
.a1-invite-card { display: flex; flex-direction: column; min-height: 0; }
.a1-invite-tabs {
  display: flex;
  gap: 3px;
  margin: 0 18px;
  padding: 3px;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: var(--surface);
  overflow-x: auto;
  scrollbar-width: none;
}
.a1-invite-tabs::-webkit-scrollbar { display: none; }
.a1-invite-tab {
  flex: none;
  min-height: 34px;
  padding: 0 12px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text-2);
  font: 500 12.5px/1 var(--font);
  cursor: pointer;
  white-space: nowrap;
}
.a1-invite-tab.is-active { background: var(--surface-3); color: var(--text); }
.a1-invite-body { display: flex; flex-direction: column; gap: 12px; padding-top: 14px; }
.a1-invite-intro { margin: 0; color: var(--text-2); font-size: 13px; line-height: 1.45; }
.a1-invite-hint { margin: 0; color: var(--text-2); font-size: 12px; line-height: 1.4; }
.a1-invite-modes { display: flex; gap: 5px; padding: 3px; border-radius: 11px; background: var(--surface); border: 1px solid var(--border); }
.a1-invite-mode {
  flex: 1 1 0;
  min-height: 34px;
  padding: 0 8px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text-2);
  font: 500 12px/1.15 var(--font);
  cursor: pointer;
}
.a1-invite-mode.is-active { background: var(--surface-3); color: var(--text); }
.a1-invite-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; }
.a1-invite-inline-link {
  min-height: 32px;
  padding: 0 8px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--text-2);
  font: 500 12px/1 var(--font);
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}
.a1-invite-inline-link:hover { color: var(--text); }
.a1-invite-result { display: flex; flex-direction: column; gap: 8px; }
.a1-invite-result__title { margin: 0; font-size: 14px; font-weight: 600; }
.a1-invite-link-row { display: flex; align-items: center; gap: 7px; }
.a1-invite-link-input { flex: 1 1 auto; min-width: 0; font-size: 13px !important; }
.a1-invite-search { flex: none; }
.a1-invite-people { display: flex; flex-direction: column; gap: 2px; max-height: 230px; overflow-y: auto; }
.a1-invite-person {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  box-sizing: border-box;
  padding: 8px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}
.a1-invite-person:hover { background: var(--surface-2); }
.a1-invite-person__text { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.a1-invite-person__text strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; font-weight: 500; }
.a1-invite-person__meta { color: var(--text-2); font-size: 11.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.a1-invite-confirm { display: flex; flex-direction: column; gap: 9px; padding: 12px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); }
.a1-invite-recipient { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.a1-invite-recipient > div { display: flex; flex-direction: column; gap: 2px; }
.a1-invite-preview-text {
  margin: 0;
  padding: 10px;
  max-height: 180px;
  overflow-y: auto;
  border-radius: 9px;
  background: var(--bg);
  color: var(--text-2);
  font: 400 12px/1.45 var(--font);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.a1-invite-list { display: flex; flex-direction: column; gap: 0; }
.a1-invite-item { padding: 11px 0; border-top: 1px solid var(--border); }
.a1-invite-item:first-child { border-top: 0; }
.a1-invite-item__top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.a1-invite-item__title { min-width: 0; font-size: 13.5px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.a1-invite-item__meta { margin: 4px 0 0; color: var(--text-2); font-size: 11.5px; line-height: 1.4; }
.a1-invite-item__actions { display: flex; flex-wrap: wrap; gap: 2px; margin-top: 4px; }
.a1-invite-status { flex: none; display: inline-flex; align-items: center; min-height: 22px; padding: 2px 8px; border-radius: 999px; background: var(--surface-2); color: var(--text-2); font-size: 10.5px; font-weight: 500; }
.a1-invite-status.is-active { background: color-mix(in oklab, #5aa7ff 15%, transparent); color: #8bc4ff; }
.a1-invite-status.is-sent { background: color-mix(in oklab, #e6b84f 15%, transparent); color: #e7c46b; }
.a1-invite-status.is-accepted { background: color-mix(in oklab, #57c46a 15%, transparent); color: #8ee19b; }
.a1-invite-status.is-expired, .a1-invite-status.is-revoked { background: var(--surface-2); color: var(--text-2); }
.a1-invite-revoke { color: var(--danger-text) !important; }
.a1-invite-empty { margin: 0; padding: 18px 0; color: var(--text-2); font-size: 13px; text-align: center; }
@media (max-width: 520px) {
  .a1-invite-tabs { margin: 0 14px; }
  .a1-invite-body { padding-top: 12px; }
  .a1-invite-link-row { flex-direction: column; align-items: stretch; }
  .a1-invite-actions > .a1-d1-primary, .a1-invite-actions > .a1-d1-secondary { flex: 1 1 auto; }
}


/* 5.7: the accepted sign-in shell still contains visible stubs for Google,
   Apple and password recovery, none of which work. Hiding them (rather than
   mutating the shared auth DOM at runtime) keeps the e-mail login intact and
   prevents a MutationObserver from racing the auth overlay's own rendering. */
.auth-providers,
.auth-unavailable,
.auth-divider,
.auth-forgot { display: none !important; }

/* Onboarding is where a registration's temporary e-mail-local-part name can
   be replaced. One field inside the existing first step, no extra screen. */
.a1-onb__name { display: flex; flex-direction: column; gap: 6px; margin-top: 14px; }
.a1-onb__name-label { color: var(--text-2); font-size: 11px; font-weight: 500; }
.a1-onb__name-hint { color: var(--text-2); font-size: 10.5px; line-height: 1.35; }
.a1-onb__name .a1-d1-input { min-height: 44px; }

/* 5.5 — archive state, notes and task editing */
.a1-d1-chip--archived { background: color-mix(in oklab, var(--text) 7%, transparent); color: var(--text-2); }
.a1-proj-card--archived { opacity: .68; }
.a1-proj-card--archived:hover { opacity: .9; }
.a1-proj-archive { white-space: nowrap; }

.a1-proj-note-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 11px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-2);
}
.a1-proj-note-form .a1-d1-textarea { min-height: 72px; resize: vertical; }
.a1-proj-note-form .a1-d1-primary { align-self: flex-start; }
.a1-proj-notes { display: flex; flex-direction: column; gap: 7px; }
.a1-proj-note {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 11px 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
}
.a1-proj-note__head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.a1-proj-note__title { min-width: 0; color: var(--text); font-size: 13.5px; font-weight: 500; line-height: 1.3; overflow-wrap: anywhere; }
.a1-proj-note__date { flex: none; color: var(--text-2); font-size: 10.5px; }
.a1-proj-note__text { margin: 0; color: var(--text-2); font-size: 12.5px; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; }
.a1-proj-note__actions { display: flex; gap: 1px; justify-content: flex-end; margin: -2px -4px -4px 0; }
@media (max-width: 520px) {
  .a1-proj-note-form .a1-d1-primary { align-self: stretch; }
  .a1-proj-note__head { flex-direction: column; gap: 3px; }
}
