/* Дополнения к app.css (если нет npm/tailwind rebuild) */
.swatch {
  width: 2.25rem;
  height: 2.25rem;
}
.theme-list-label {
  margin-left: 1rem;
  margin-right: 0.75rem;
}
.mx-1 { margin-inline: 0.25rem; }
.mb-1\.5 { margin-bottom: 0.375rem; }
.mt-5 { margin-top: 1.25rem; }
.pb-5 { padding-bottom: 1.25rem; }
.pb-8 { padding-bottom: 2rem; }
.pb-16 { padding-bottom: 4rem; }
.pb-24 { padding-bottom: 6rem; }
.pt-6 { padding-top: 1.5rem; }
.pt-8 { padding-top: 2rem; }
.h-14 { height: 3.5rem; }
.opacity-70 { opacity: 0.7; }
.capitalize { text-transform: capitalize; }
.grid-cols-7 { grid-template-columns: repeat(7, minmax(0, 1fr)); }
.nav-plus { box-shadow: 0 2px 10px color-mix(in srgb, var(--ink) 14%, transparent); }
.sync-spin { animation: sync-spin 0.9s linear infinite; }
@keyframes sync-spin { to { transform: rotate(360deg); } }
.dnd-handle { touch-action: none; cursor: grab; }
.dnd-dragging { opacity: 0.45; }
.fmt-btn { flex: 0 0 auto; }
.telegraph-page { background: var(--paper); }
.telegraph-body { max-width: 40rem; margin: 0 auto; }
.telegraph-title,
.telegraph-title-input {
  font-family: Georgia, "Iowan Old Style", Palatino, serif;
  font-size: clamp(1.75rem, 5vw, 2.35rem);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.02em;
  margin: 0 0 1rem;
  width: 100%;
  border: 0;
  background: transparent;
  color: var(--ink);
  outline: none;
}
.telegraph-editor {
  min-height: 50vh;
  font-family: Georgia, "Iowan Old Style", Palatino, serif;
  font-size: 1.125rem;
  line-height: 1.65;
  outline: none;
}
.telegraph-editor:empty:before {
  content: attr(data-placeholder);
  color: var(--muted);
}
.note-html h1, .note-html h2, .note-html h3 {
  font-family: Georgia, "Iowan Old Style", Palatino, serif;
  font-weight: 700;
  line-height: 1.25;
  margin: 1.25em 0 0.5em;
}
.note-html h1 { font-size: 1.5em; }
.note-html h2 { font-size: 1.3em; }
.note-html h3 { font-size: 1.15em; }
.note-html p { margin: 0 0 0.85em; }
.note-html img { max-width: 100%; height: auto; display: block; margin: 1em 0; }
.note-html table {
  width: 100%;
  border-collapse: collapse;
  margin: 1em 0;
  font-size: 0.95em;
}
.note-html th, .note-html td {
  border: 1px solid var(--line);
  padding: 0.45rem 0.6rem;
  text-align: left;
}
.note-html a { color: var(--ink); text-decoration: underline; }
.note-html ul,
.note-html ol {
  margin: 0.5em 0 1em;
  padding-left: 1.5rem;
  list-style-position: outside;
}
.note-html ul {
  list-style-type: disc;
}
.note-html ol {
  list-style-type: decimal;
}
.note-html li {
  display: list-item;
  margin: 0.15em 0;
}
.note-html li + li {
  margin-top: 0.2em;
}
.telegraph-content {
  font-family: Georgia, "Iowan Old Style", Palatino, serif;
  font-size: 1.125rem;
  line-height: 1.65;
}
.editor-toolbar { -webkit-overflow-scrolling: touch; }
.app-main > header,
.app-main > .note-topbar,
.telegraph-page > header {
  flex: 0 0 auto !important;
}
.note-topbar {
  padding-top: max(0.85rem, env(safe-area-inset-top));
  padding-bottom: 0.85rem;
}
.min-h-12 {
  min-height: 3rem;
}
.w-12 {
  width: 3rem;
}

/* смартфон: date/time не должны вылезать вправо */
input[type="date"],
input[type="time"] {
  box-sizing: border-box;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  display: block;
}

input[type="date"]::-webkit-datetime-edit,
input[type="time"]::-webkit-datetime-edit {
  min-width: 0;
  max-width: 100%;
}

input[type="date"]::-webkit-date-and-time-value,
input[type="time"]::-webkit-date-and-time-value {
  text-align: left;
  min-width: 0;
}

.min-w-0 { min-width: 0; }
.max-w-full { max-width: 100%; }
.-mr-2 { margin-right: -0.5rem; }
.-ml-2 { margin-left: -0.5rem; }
.pb-0\.5 { padding-bottom: 0.125rem; }

.phone-sheet {
  overflow-x: hidden;
  overflow-y: auto;
}
.pt-safe {
  padding-top: env(safe-area-inset-top);
}

.pt-5 {
  padding-top: 1.25rem;
}

.pb-10 {
  padding-bottom: 2.5rem;
}

.h-10 {
  height: 2.5rem;
}

.w-10 {
  width: 2.5rem;
}

.gap-0\.5 {
  gap: 0.125rem;
}

.object-cover {
  object-fit: cover;
}
.h-16 { height: 4rem; }
.w-16 { width: 4rem; }
.rounded-full { border-radius: 9999px; }
.avatar-btn {
  margin-right: 0.75rem;
}
.pl-1 { padding-left: 0.25rem; }

.chat-nav-badge,
.chat-badge {
  display: inline-grid;
  place-items: center;
  min-width: 1.15rem;
  height: 1.15rem;
  padding: 0 0.3rem;
  border-radius: 9999px;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 0.65rem;
  font-weight: 600;
  line-height: 1;
}
.chat-nav-badge {
  position: absolute;
  top: 0.15rem;
  right: calc(50% - 1.35rem);
}
.chat-room {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  background: var(--paper);
  overflow: hidden !important;
}
.app-main.chat-room > * {
  flex: 0 0 auto;
  width: 100%;
}
.app-main.chat-room > .chat-room-scroll {
  flex: 1 1 auto;
  min-height: 0;
}
.chat-room-top {
  min-height: 3.25rem;
}
.chat-room-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 0.75rem 0.85rem 1rem;
  -webkit-overflow-scrolling: touch;
}
.chat-day {
  display: flex;
  justify-content: center;
  margin: 0.75rem 0;
}
.chat-day span {
  font-size: 0.75rem;
  color: var(--muted);
  background: var(--card);
  border-radius: 9999px;
  padding: 0.2rem 0.65rem;
}
.chat-system {
  text-align: center;
  font-size: 0.8rem;
  color: var(--muted);
  margin: 0.55rem 1.5rem;
  line-height: 1.35;
}
.chat-row {
  display: flex;
  flex-direction: column;
  margin: 0.35rem 0;
  max-width: 82%;
}
.chat-row.is-mine {
  align-self: flex-end;
  margin-left: auto;
  align-items: flex-end;
}
.chat-row.is-other {
  align-self: flex-start;
  align-items: flex-start;
}
.chat-author {
  font-size: 0.75rem;
  color: var(--muted);
  margin: 0 0.35rem 0.15rem;
}
.chat-bubble {
  border-radius: 1.1rem;
  padding: 0.55rem 0.75rem 0.35rem;
  background: var(--card);
  max-width: 100%;
}
.chat-row.is-mine .chat-bubble {
  background: color-mix(in srgb, var(--accent) 22%, var(--paper));
  border-bottom-right-radius: 0.35rem;
}
.chat-row.is-other .chat-bubble {
  border-bottom-left-radius: 0.35rem;
}
.chat-text {
  font-size: 0.98rem;
  line-height: 1.4;
  word-break: break-word;
  margin: 0;
}
.chat-meta {
  display: block;
  text-align: right;
  font-size: 0.65rem;
  color: var(--muted);
  margin-top: 0.2rem;
}
.chat-composer {
  flex-shrink: 0;
}
.chat-composer-row {
  display: flex;
  align-items: flex-end;
  gap: 0.7rem;
}
.chat-btn-circle {
  display: grid;
  place-items: center;
  width: 2.75rem;
  height: 2.75rem;
  flex-shrink: 0;
  border-radius: 9999px;
  background: color-mix(in srgb, var(--ink) 8%, transparent);
  color: inherit;
  padding: 0;
  border: 0;
}
.chat-btn-circle.chat-btn-accent {
  background: var(--accent);
  color: var(--accent-ink);
}
.chat-input {
  flex: 1;
  min-width: 0;
  min-height: 2.75rem;
  max-height: 7rem;
  height: 2.75rem;
  resize: none;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 1.25rem;
  background: var(--paper);
  color: var(--ink);
  padding: 0.7rem 0.95rem;
  font-size: 1rem;
  line-height: 1.35;
  outline: none;
  field-sizing: content;
}
.chat-bubble-media {
  padding: 0.35rem;
  overflow: hidden;
}
.chat-image-link {
  display: block;
  margin: 0 0 0.25rem;
  padding: 0;
  border: 0;
  background: none;
  cursor: zoom-in;
  text-align: left;
}
.chat-image {
  display: block;
  max-width: min(100%, 16rem);
  max-height: 18rem;
  width: auto;
  height: auto;
  border-radius: 0.85rem;
  object-fit: cover;
}
.chat-bubble-media .chat-text {
  padding: 0.25rem 0.45rem 0;
}
.chat-file {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.35rem 0.45rem;
  text-decoration: none;
  color: inherit;
  min-width: 11rem;
}
.chat-file-icon {
  display: grid;
  place-items: center;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 0.75rem;
  background: color-mix(in srgb, var(--ink) 8%, transparent);
  flex-shrink: 0;
}
.chat-lightbox {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, 0.88);
  padding: 1rem;
}
.chat-lightbox img {
  max-width: min(100%, 56rem);
  max-height: min(92dvh, 56rem);
  width: auto;
  height: auto;
  border-radius: 0.5rem;
  object-fit: contain;
}
.chat-lightbox-close {
  position: absolute;
  top: max(0.75rem, env(safe-area-inset-top));
  right: max(0.75rem, env(safe-area-inset-right));
  width: 2.75rem;
  height: 2.75rem;
  display: grid;
  place-items: center;
  color: #fff;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 9999px;
}
.chat-voice {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  grid-template-rows: auto auto;
  column-gap: 0.55rem;
  row-gap: 0.1rem;
  align-items: center;
  min-width: 13.5rem;
  max-width: 17rem;
  padding: 0.1rem 0.15rem 0.05rem;
}
.chat-voice-play {
  grid-row: 1 / 3;
  align-self: center;
  width: 2.5rem;
  height: 2.5rem;
  display: grid;
  place-items: center;
  border-radius: 9999px;
  background: color-mix(in srgb, var(--accent) 42%, var(--paper));
  color: var(--ink);
  padding: 0;
  border: 0;
  flex-shrink: 0;
}
.chat-row.is-mine .chat-voice-play {
  background: color-mix(in srgb, var(--accent) 55%, var(--paper));
}
.chat-voice-main {
  grid-column: 2;
  grid-row: 1;
  min-width: 0;
}
.chat-voice-wave {
  display: flex;
  align-items: center;
  gap: 1.5px;
  height: 1.7rem;
  width: 100%;
  min-width: 0;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  touch-action: none;
}
.chat-voice-wave i {
  display: block;
  width: 2.5px;
  border-radius: 9999px;
  background: color-mix(in srgb, var(--ink) 28%, transparent);
  flex: 1 1 0;
  min-width: 2px;
  max-width: 3px;
  pointer-events: none;
  transition: background 0.05s linear;
}
.chat-voice-wave i.is-played {
  background: var(--accent);
}
.chat-voice-meta {
  grid-column: 2;
  grid-row: 2;
  display: flex;
  align-items: center;
  gap: 0.45rem;
  min-height: 0.95rem;
}
.chat-voice-dur {
  font-size: 0.7rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  line-height: 1;
}
.chat-voice-speed {
  grid-column: 3;
  grid-row: 1 / 3;
  align-self: center;
  min-width: 2.35rem;
  height: 1.55rem;
  padding: 0 0.4rem;
  border-radius: 9999px;
  border: 0;
  background: color-mix(in srgb, var(--ink) 8%, transparent);
  color: var(--ink);
  font-size: 0.72rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}
.chat-voice.is-playing .chat-voice-speed {
  background: color-mix(in srgb, var(--accent) 28%, transparent);
}
.chat-video-note-wrap {
  position: relative;
  width: 11.5rem;
  height: 11.5rem;
  margin: 0 0 0.15rem;
}
.chat-video-note {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  background: #111;
  display: block;
}
.chat-video-note-play {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #fff;
  pointer-events: none;
  background: radial-gradient(circle, rgba(0,0,0,0.35) 0%, transparent 65%);
  border-radius: 50%;
  opacity: 1;
  transition: opacity 0.15s ease;
}
.chat-video-note-wrap.is-playing .chat-video-note-play {
  opacity: 0;
}
.chat-bubble-round {
  padding: 0.25rem;
  background: transparent !important;
}
.chat-composer .chat-btn-send { display: none; }
.chat-composer.has-text .chat-btn-media { display: none; }
.chat-composer.has-text .chat-btn-send { display: grid; }
.chat-rec-bar {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  width: 100%;
  min-height: 2.75rem;
  padding: 0.35rem 0.25rem;
}
.chat-rec-dot {
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 9999px;
  background: #e11d48;
  animation: chat-rec-pulse 1s ease infinite;
}
@keyframes chat-rec-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}
.chat-rec-timer {
  flex: 1;
  font-variant-numeric: tabular-nums;
  font-size: 0.95rem;
}
.chat-rec-preview {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: grid;
  place-items: end center;
  background: rgba(0, 0, 0, 0.72);
  padding: 1.25rem 1.25rem max(1.5rem, env(safe-area-inset-bottom));
}
.chat-rec-circle {
  width: min(72vw, 18rem);
  height: min(72vw, 18rem);
  border-radius: 50%;
  overflow: hidden;
  background: #000;
  margin-bottom: 1.25rem;
  box-shadow: 0 0 0 3px rgba(255,255,255,0.25);
}
.chat-rec-circle video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scaleX(-1);
}
.chat-rec-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.25rem;
  width: 100%;
  color: #fff;
}
.chat-rec-actions button {
  display: grid;
  place-items: center;
  width: 3.25rem;
  height: 3.25rem;
  border-radius: 9999px;
  background: rgba(255,255,255,0.15);
  color: #fff;
}
.chat-rec-actions .is-send {
  background: var(--accent);
  color: var(--accent-ink);
  width: 3.75rem;
  height: 3.75rem;
}

/* ПК: шире телефонной рамки, высота как раньше */
@media (min-width: 768px) {
  body {
    align-items: center;
    padding: 1.5rem;
  }

  #app {
    width: min(920px, calc(100vw - 3rem));
    max-width: none;
    height: min(880px, calc(100dvh - 3rem));
    max-height: calc(100dvh - 3rem);
    border-radius: 1.5rem;
  }

  .app-auth {
    padding-top: 1.5rem;
    padding-left: 1.75rem;
    padding-right: 1.75rem;
  }
}

@media (min-width: 1100px) {
  #app {
    width: min(1040px, calc(100vw - 4rem));
  }
}
