.chat-header-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.chat-header-action {
  position: relative;
  min-height: 39px;
  color: var(--ink);
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 99px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 13px;
  font-size: 10px;
  font-weight: 800;
  line-height: 1;
  transition: background 0.18s, border-color 0.18s, transform 0.18s;
}

.chat-header-action:hover {
  background: #fff;
  border-color: #1a16224d;
  transform: translateY(-1px);
}

.chat-header-action-icon {
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  color: var(--violet);
  display: grid;
  place-items: center;
  line-height: 0;
}

.chat-header-action-icon svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
  display: block;
}

.chat-header-action-icon circle {
  fill: var(--white);
}

.message-note-status {
  color: #827b87;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 7px 0 0 10px;
  font-size: 8px;
  line-height: 1;
}

.message-note-status > span {
  width: 6px;
  height: 6px;
  background: #6748cf52;
  border-radius: 50%;
}

.message-note-status small {
  color: inherit;
  letter-spacing: 0;
  text-transform: none;
  font-size: inherit;
  font-weight: 650;
}

.chat-notes-modal {
  width: min(570px, 100%);
  max-height: min(760px, calc(100dvh - 44px));
  background: var(--paper);
  border-radius: 25px;
  padding: 27px;
  overflow-y: auto;
  box-shadow: 0 30px 100px #08050f47;
}

.chat-notes-modal > header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
}

.chat-notes-modal > header small {
  color: var(--violet);
  letter-spacing: 0.13em;
  text-transform: uppercase;
  font-size: 8px;
  font-weight: 900;
}

.chat-notes-modal h2 {
  margin: 4px 0 0;
  font-family: var(--serif);
  font-size: 32px;
  font-style: italic;
  font-weight: 400;
  line-height: 1;
}

.chat-notes-modal > header button {
  width: 36px;
  height: 36px;
  flex: none;
  color: var(--ink);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 50%;
  display: grid;
  place-items: center;
  padding: 0;
  line-height: 0;
}

.chat-settings-modal > header button {
  display: grid;
  place-items: center;
  padding: 0;
  line-height: 0;
}

.chat-settings-modal > header button svg,
.chat-notes-modal > header button svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
  display: block;
}

.chat-notes-intro {
  max-width: 470px;
  color: var(--muted);
  margin: 13px 0 23px;
  font-size: 11px;
  line-height: 1.55;
}

.chat-notes-list {
  display: grid;
  gap: 9px;
}

.chat-note-item {
  min-width: 0;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 16px;
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr) 34px;
  align-items: start;
  gap: 12px;
  padding: 13px;
}

.chat-note-number {
  width: 32px;
  height: 32px;
  color: var(--violet);
  background: #6748cf12;
  border: 1px solid #6748cf1f;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-family: var(--serif);
  font-size: 10px;
  font-style: italic;
  line-height: 1;
}

.chat-note-item p {
  min-width: 0;
  color: var(--ink);
  margin: 0;
  font-family: var(--serif);
  overflow-wrap: anywhere;
  font-size: 13px;
  line-height: 1.45;
}

.chat-note-delete {
  grid-column: 3;
  grid-row: 1;
  justify-self: end;
  width: 34px;
  height: 34px;
  color: var(--muted);
  background: #eeebe44f;
  border: 1px solid var(--line);
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  padding: 0;
  transition: color 0.16s, background 0.16s, border-color 0.16s, width 0.16s;
}

.chat-note-delete svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.65;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: 0 0 15px;
}

.chat-note-delete strong {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
  font-size: 9px;
  font-weight: 800;
}

.chat-note-delete:hover {
  color: #9e3c36;
  background: #ff7a6412;
  border-color: #ff7a6438;
}

.chat-note-delete.is-confirming {
  grid-column: 2 / 4;
  grid-row: 2;
  width: auto;
  height: 34px;
  color: #fff;
  background: #9e3c36;
  border-color: #9e3c36;
  border-radius: 99px;
  gap: 7px;
  padding: 0 12px;
}

.chat-note-delete.is-confirming strong {
  position: static;
  width: auto;
  height: auto;
  margin: 0;
  overflow: visible;
  clip: auto;
}

.chat-note-delete.is-confirming:hover {
  color: #fff;
  background: #84312d;
  border-color: #84312d;
}

.chat-note-delete:disabled {
  cursor: wait;
  opacity: 0.5;
}

.chat-notes-empty {
  min-height: 210px;
  background: #eeebe47a;
  border: 1px dashed #1a162229;
  border-radius: 18px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 28px;
  text-align: center;
}

.chat-notes-empty > span {
  width: 35px;
  height: 35px;
  color: var(--violet);
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 50%;
  display: grid;
  place-items: center;
  margin-bottom: 13px;
  font-family: var(--serif);
  font-size: 16px;
  line-height: 1;
}

.chat-notes-empty strong {
  font-family: var(--serif);
  font-size: 19px;
  font-style: italic;
  font-weight: 400;
}

.chat-notes-empty p {
  max-width: 330px;
  color: var(--muted);
  margin: 8px 0 0;
  font-size: 10px;
  line-height: 1.55;
}

.chat-toast.is-quiet {
  color: var(--muted);
  background: #fffef9f2;
  border-color: var(--line);
  padding: 10px 14px;
  font-size: 9px;
  font-weight: 750;
  box-shadow: 0 10px 34px #08050f1a;
}

@media (width <= 820px) {
  .chat-menu-button {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
  }

  .chat-menu-button span {
    margin: 0;
  }
}

@media (width <= 560px) {
  .chat-header-actions {
    gap: 6px;
  }

  .chat-header-action {
    width: 39px;
    height: 39px;
    min-height: 39px;
    border-radius: 50%;
    gap: 0;
    padding: 0;
  }

  .chat-header-action-label {
    display: none;
  }

  .chat-notes-modal {
    width: 100%;
    max-height: calc(100dvh - var(--tg-content-safe-area-inset-top, env(safe-area-inset-top, 0px)) - 10px);
    border-radius: 24px 24px 0 0;
    padding: 24px 18px calc(18px + var(--tg-content-safe-area-inset-bottom, env(safe-area-inset-bottom, 0px)));
  }

  .chat-notes-modal h2 {
    font-size: 29px;
  }

  .chat-note-item {
    grid-template-columns: 30px minmax(0, 1fr) 32px;
    gap: 10px;
    padding: 12px;
  }

  .chat-note-number {
    width: 30px;
    height: 30px;
  }

  .chat-note-delete {
    width: 32px;
    height: 32px;
  }

  .chat-note-delete.is-confirming {
    width: auto;
    height: 32px;
    padding-inline: 11px;
  }
}
