:root {
  --portal-shadow: 0 16px 42px rgba(34, 28, 31, 0.1);
  --portal-soft-accent: #faedf1;
  --portal-soft-green: #edf7f2;
}

body { background: #edf0f2; }

.portal-access-panel { background: rgba(255, 255, 255, 0.98); }
.portal-access-copy h1 { line-height: 1.08; }
.portal-button { border-radius: 14px; box-shadow: 0 8px 22px rgba(41, 35, 38, 0.12); }
.portal-button:focus-visible,
.portal-icon-button:focus-visible,
.portal-send-button:focus-visible,
.portal-sticker-picker button:focus-visible,
.portal-upload-remove:focus-visible {
  outline: 3px solid rgba(41, 121, 255, 0.32);
  outline-offset: 2px;
}
.portal-identity { border-radius: 8px; background: #f8f9fa; }

.portal-topbar {
  position: relative;
  z-index: 5;
  box-shadow: 0 1px 0 rgba(33, 29, 32, 0.04);
}

.portal-chat {
  border-color: #d7dadd;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.55);
}

.portal-chat-header { background: rgba(255, 255, 255, 0.96); }
.portal-photographer-avatar { box-shadow: 0 0 0 3px #fff, 0 0 0 4px #d9dddf; }
.portal-message-list { background: #f2f4f5; }

.portal-message {
  border-radius: 18px 18px 18px 6px;
  box-shadow: 0 4px 14px rgba(34, 28, 31, 0.05);
}
.portal-message--own { border-radius: 18px 18px 6px 18px; }
.portal-message--sticker {
  padding: 5px;
  border: 0;
  background: transparent;
  box-shadow: none;
}
.portal-message--sticker .portal-message-meta { padding: 0 5px; }
.portal-sticker {
  width: 92px;
  height: 92px;
  border-radius: 28px;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.72);
  box-shadow: 0 8px 22px rgba(34, 28, 31, 0.08);
  font-family: "Segoe UI Emoji", "Apple Color Emoji", sans-serif;
  font-size: 58px;
  line-height: 1;
}

.portal-media-preview img { border-radius: 12px; }
.portal-file { border-radius: 12px; }

.portal-compose {
  position: relative;
  padding: 13px 16px 15px;
  box-shadow: 0 -8px 24px rgba(34, 28, 31, 0.04);
}
.portal-compose-row { align-items: center; }
.portal-compose textarea {
  min-height: 46px;
  padding: 12px 16px;
  border-radius: 23px;
  background: #f3f5f6;
}
.portal-icon-button,
.portal-send-button {
  transition: border-color 160ms ease, background 160ms ease, transform 160ms ease;
}
.portal-icon-button:hover,
.portal-send-button:hover { transform: translateY(-1px); }
.portal-attach-button,
.portal-sticker-button { font-size: 23px; line-height: 1; }
.portal-sticker-button { font-size: 20px; }

.portal-upload-queue {
  max-height: 230px;
  margin: 0 0 12px;
  padding: 10px;
  border: 1px solid #dfe2e4;
  border-radius: 8px;
  overflow-y: auto;
  background: #f7f8f9;
}
.portal-upload-summary {
  margin: 0 2px 7px;
  color: var(--portal-muted);
  font-size: 12px;
  font-weight: 700;
}
.portal-upload-item {
  min-height: 58px;
  padding: 5px;
  border-radius: 8px;
  grid-template-columns: 48px minmax(0, 1fr) minmax(86px, 120px) 30px;
  gap: 10px;
  background: #fff;
}
.portal-upload-item + .portal-upload-item { margin-top: 6px; }
.portal-upload-preview {
  width: 48px;
  height: 48px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: #e9edef;
  color: #5e676c;
  font-size: 10px;
  font-weight: 800;
}
.portal-upload-preview img { width: 100%; height: 100%; object-fit: cover; }
.portal-upload-copy { min-width: 0; display: grid; gap: 3px; }
.portal-upload-item progress { height: 7px; }
.portal-upload-remove {
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #eef0f1;
  color: #5f585c;
  cursor: pointer;
  font-size: 20px;
  line-height: 1;
}
.portal-upload-item--uploading { background: #f6f8ff; }
.portal-upload-item--ready { background: var(--portal-soft-green); }
.portal-upload-item--error { background: #fff1f2; }

.portal-sticker-picker {
  position: absolute;
  z-index: 20;
  left: 66px;
  bottom: calc(100% - 6px);
  width: min(318px, calc(100vw - 28px));
  padding: 12px;
  border: 1px solid #d7dade;
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--portal-shadow);
}
.portal-sticker-picker > strong { display: block; margin: 0 2px 9px; font-size: 12px; }
.portal-sticker-picker > div { display: grid; grid-template-columns: repeat(6, 1fr); gap: 5px; }
.portal-sticker-picker button {
  aspect-ratio: 1;
  border: 0;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: #f4f5f6;
  cursor: pointer;
  font-family: "Segoe UI Emoji", "Apple Color Emoji", sans-serif;
  font-size: 25px;
}
.portal-sticker-picker button:hover { background: var(--portal-soft-accent); }
.portal-compose--dragging { box-shadow: inset 0 0 0 3px rgba(41, 121, 255, 0.32); }

@media (max-width: 760px) {
  .portal-access-panel { padding-inline: 18px; }
  .portal-access-copy h1 { font-size: 36px; }
  .portal-compose { padding: 9px 8px max(10px, env(safe-area-inset-bottom)); }
  .portal-compose-row { gap: 6px; }
  .portal-icon-button,
  .portal-send-button { width: 40px; height: 40px; flex-basis: 40px; }
  .portal-compose textarea { min-height: 42px; padding: 10px 13px; }
  .portal-sticker-picker { left: 8px; bottom: calc(100% - 3px); }
  .portal-upload-item { grid-template-columns: 44px minmax(0, 1fr) 28px; }
  .portal-upload-preview { width: 44px; height: 44px; }
  .portal-upload-item progress { grid-column: 2 / 4; width: 100%; }
  .portal-upload-remove { grid-column: 3; grid-row: 1; }
  .portal-message { max-width: 90%; }
  .portal-sticker { width: 82px; height: 82px; font-size: 52px; }
}

@media (prefers-reduced-motion: reduce) {
  .portal-icon-button,
  .portal-send-button { transition: none; }
}

/* Compact messenger composer */
.portal-upload-queue[hidden],
.portal-sticker-picker[hidden],
.portal-compose-error[hidden] { display: none !important; }

.portal-compose {
  padding: 10px 14px max(10px, env(safe-area-inset-bottom));
  background: #fff;
  box-shadow: 0 -1px 0 #dfe3e8, 0 -8px 22px rgba(34, 28, 31, 0.035);
}
.portal-compose-row { min-height: 44px; gap: 2px; }
.portal-compose textarea,
.portal-compose textarea:focus {
  min-height: 44px;
  padding: 11px 10px;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}
.portal-icon-button,
.portal-send-button {
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  border: 0;
  background: transparent;
}
.portal-icon-button:hover,
.portal-send-button:hover { transform: none; background: #eef3f8; }
.portal-attach-button { color: #7d8790; font-size: 30px; font-weight: 300; }
.portal-sticker-button { font-size: 21px; }
.portal-sticker-button > span { width: 100%; height: 100%; display: grid; place-items: center; line-height: 1; }
.portal-send-button { color: #447bba; }
.portal-send-icon {
  width: 22px;
  height: 22px;
  display: block;
  background: currentColor;
  -webkit-mask: url("/client/icons/send.svg") center / contain no-repeat;
  mask: url("/client/icons/send.svg") center / contain no-repeat;
}

.portal-upload-queue {
  max-height: 104px;
  margin: 0;
  padding: 2px 4px 10px;
  border: 0;
  border-bottom: 1px solid #e3e7eb;
  border-radius: 0;
  display: flex;
  gap: 9px;
  overflow-x: auto;
  overflow-y: hidden;
  background: transparent;
  scrollbar-width: thin;
}
.portal-upload-summary { display: none; }
.portal-upload-item,
.portal-upload-item--selected {
  position: relative;
  width: 78px;
  height: 78px;
  min-height: 78px;
  padding: 0;
  border-radius: 10px;
  display: block;
  flex: 0 0 78px;
  overflow: visible;
  background: #e9edf1;
  box-shadow: inset 0 0 0 1px rgba(35, 45, 55, 0.1);
}
.portal-upload-item + .portal-upload-item { margin-top: 0; }
.portal-upload-preview {
  width: 78px;
  height: 78px;
  border-radius: 10px;
  font-size: 12px;
}
.portal-upload-preview img { width: 100%; height: 100%; object-fit: cover; }
.portal-upload-copy {
  position: absolute;
  right: 5px;
  bottom: 5px;
  left: 5px;
  z-index: 2;
  display: block;
  color: #fff;
  pointer-events: none;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
}
.portal-upload-copy strong { display: none; }
.portal-upload-copy small { display: block; overflow: hidden; color: inherit; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.portal-upload-item progress {
  position: absolute;
  right: 5px;
  bottom: 4px;
  left: 5px;
  z-index: 3;
  width: calc(100% - 10px);
  height: 4px;
}
.portal-upload-item progress[hidden] { display: none !important; }
.portal-upload-remove {
  position: absolute;
  top: -6px;
  right: -6px;
  z-index: 4;
  width: 24px;
  height: 24px;
  background: rgba(73, 82, 90, 0.9);
  color: #fff;
  font-size: 17px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.18);
}
.portal-upload-item--uploading { box-shadow: inset 0 0 0 2px #447bba; }
.portal-upload-item--ready { box-shadow: inset 0 0 0 2px #2d8160; }
.portal-upload-item--error { box-shadow: inset 0 0 0 2px #bd4052; }

@media (max-width: 760px) {
  .portal-compose { padding: 7px 7px max(7px, env(safe-area-inset-bottom)); }
  .portal-compose-row { gap: 0; }
  .portal-icon-button,
  .portal-send-button { width: 40px; height: 40px; flex-basis: 40px; }
  .portal-compose textarea { min-height: 40px; padding: 9px 7px; }
  .portal-upload-queue { margin: 0; padding: 3px 6px 9px; }
  .portal-upload-item,
  .portal-upload-item--selected,
  .portal-upload-preview { width: 72px; height: 72px; min-height: 72px; flex-basis: 72px; }
}
/* Messenger composer controls and voice messages */
.portal-compose-row {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) 42px 42px;
  align-items: center;
  gap: 2px;
  min-height: 42px;
}
.portal-compose textarea,
.portal-compose textarea:focus {
  grid-column: 2;
  align-self: center;
  box-sizing: border-box;
  width: 100%;
  min-height: 42px;
  margin: 0;
  padding: 11px 9px;
  line-height: 20px;
}
.portal-attach-button { grid-column: 1; }
.portal-sticker-button { grid-column: 3; }
.portal-send-button { grid-column: 4; }
.portal-icon-button,
.portal-send-button {
  align-self: center;
  justify-self: center;
}
.portal-attach-icon,
.portal-send-icon,
.portal-mic-icon,
.portal-stop-icon {
  width: 22px;
  height: 22px;
  display: block;
  background: currentColor;
}
.portal-attach-icon {
  -webkit-mask: url("/client/icons/paperclip.svg") center / contain no-repeat;
  mask: url("/client/icons/paperclip.svg") center / contain no-repeat;
}
.portal-mic-icon {
  -webkit-mask: url("/client/icons/mic.svg") center / contain no-repeat;
  mask: url("/client/icons/mic.svg") center / contain no-repeat;
}
.portal-stop-icon {
  -webkit-mask: url("/client/icons/square.svg") center / 17px 17px no-repeat;
  mask: url("/client/icons/square.svg") center / 17px 17px no-repeat;
}
.portal-send-button .portal-send-icon,
.portal-send-button .portal-mic-icon,
.portal-send-button .portal-stop-icon { display: none; }
.portal-send-button[data-mode="send"] .portal-send-icon,
.portal-send-button[data-mode="voice"] .portal-mic-icon,
.portal-send-button[data-mode="stop"] .portal-stop-icon { display: block; }
.portal-send-button[data-mode="voice"] { color: #788592; }
.portal-send-button[data-mode="send"] { color: #447bba; }
.portal-send-button[data-mode="stop"] { color: #c43c50; background: #fff0f2; }
.portal-sticker-button { color: #f0a01e; }
.portal-sticker-button > span {
  height: 42px;
  display: grid;
  place-items: center;
  line-height: 1;
}
.portal-sticker-picker {
  right: 48px;
  left: auto;
}
.portal-recording[hidden] { display: none !important; }
.portal-recording {
  grid-column: 2;
  min-width: 0;
  height: 42px;
  padding: 0 7px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: #4d5862;
  font-size: 13px;
}
.portal-recording-dot {
  width: 8px;
  height: 8px;
  flex: 0 0 8px;
  border-radius: 50%;
  background: #d43d50;
  animation: portal-recording-pulse 1.2s ease-in-out infinite;
}
.portal-recording time { color: #707b85; font-variant-numeric: tabular-nums; }
.portal-recording button {
  width: 30px;
  height: 30px;
  margin-left: auto;
  border: 0;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: transparent;
  color: #7d8790;
  cursor: pointer;
  font-size: 21px;
}
.portal-recording button:hover { background: #edf1f4; color: #303942; }
.portal-compose--recording textarea { display: none; }
.portal-voice-preview {
  width: min(320px, calc(100vw - 120px));
  min-width: min(240px, calc(100vw - 120px));
  padding: 3px 0;
}
.portal-voice-preview audio {
  width: 100%;
  height: 40px;
  display: block;
}
.portal-video-preview video {
  width: min(420px, 100%);
  max-height: 420px;
  display: block;
  border-radius: 8px;
  background: #111;
}
@keyframes portal-recording-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.42; transform: scale(0.82); }
}

@media (max-width: 720px) {
  .portal-compose-row { grid-template-columns: 40px minmax(0, 1fr) 40px 40px; gap: 0; }
  .portal-compose textarea,
  .portal-compose textarea:focus { min-height: 40px; padding: 10px 7px; }
  .portal-sticker-button > span { height: 40px; }
  .portal-sticker-picker { right: 42px; left: auto; }
  .portal-recording { height: 40px; padding-inline: 5px; gap: 6px; }
  .portal-recording strong { display: none; }
  .portal-voice-preview { width: min(290px, calc(100vw - 94px)); min-width: 210px; }
}

@media (prefers-reduced-motion: reduce) {
  .portal-recording-dot { animation: none; }
}
.portal-voice-preview {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 34px;
  align-items: center;
  gap: 4px;
}
.portal-voice-download {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #edf3f8;
  color: #447bba;
  text-decoration: none;
  font-size: 19px;
}
.portal-voice-download:hover { background: #e2ebf3; }

/* Access and sign-in screens */
.portal-auth-actions {
  display: grid;
  gap: 10px;
}

.portal-auth-actions + .portal-back-link {
  margin-top: 18px;
}

@media (min-width: 761px) {
  .portal-access {
    height: 100dvh;
    min-height: 0;
    grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
    overflow: hidden;
    background: #fffaf8;
  }

  .portal-access-panel {
    width: 100%;
    max-width: 680px;
    min-height: 0;
    height: 100%;
    margin-inline: auto;
    padding: clamp(32px, 4.5vw, 68px);
    overflow-y: auto;
    background: #fffaf8;
  }

  .portal-access-copy {
    margin: clamp(96px, 15vh, 150px) 0 26px;
  }

  .portal-access-copy h1 {
    max-width: 520px;
    font-size: 48px;
    line-height: 1.06;
  }

  .portal-access-copy p:last-child {
    max-width: 480px;
    font-size: 17px;
    line-height: 1.55;
  }

  .portal-access-photo {
    min-width: 0;
    min-height: 0;
    height: auto;
    margin: clamp(18px, 2vw, 30px) clamp(18px, 2vw, 30px) clamp(18px, 2vw, 30px) 0;
    border-radius: 8px;
  }

  .portal-access-photo img {
    object-position: center 42%;
  }
}

@media (max-width: 760px) {
  .portal-access {
    min-height: 100dvh;
    grid-template-columns: 1fr;
    grid-template-rows: minmax(210px, 34dvh) auto;
    background: #fffaf8;
  }

  .portal-access-photo {
    grid-column: 1;
    grid-row: 1;
    display: block;
    min-height: 210px;
    height: 34dvh;
  }

  .portal-access-photo img {
    object-position: center 36%;
  }

  .portal-access-panel {
    position: relative;
    z-index: 1;
    grid-column: 1;
    grid-row: 2;
    width: 100%;
    min-height: calc(66dvh + 24px);
    margin-top: -24px;
    padding: 22px 20px max(32px, env(safe-area-inset-bottom));
    border-radius: 24px 24px 0 0;
    background: #fffaf8;
  }

  .portal-access-copy {
    margin: 38px 0 22px;
  }

  .portal-access-copy h1 {
    max-width: 520px;
    font-size: 36px;
    line-height: 1.08;
  }

  .portal-access-copy p:last-child {
    font-size: 16px;
    line-height: 1.5;
  }

  .portal-brand img {
    width: 40px;
    height: 40px;
  }
}

@media (max-width: 380px) {
  .portal-access-copy h1 { font-size: 32px; }
}
/* Telegram-style attachment confirmation */
body.portal-attachment-dialog-open { overflow: hidden; }
.portal-attachment-dialog[hidden],
.portal-attachment-mode[hidden],
.portal-attachment-emoji[hidden],
.portal-attachment-error[hidden] { display: none !important; }
.portal-attachment-dialog {
  position: fixed;
  z-index: 1200;
  inset: 0;
  padding: 24px;
  display: grid;
  place-items: center;
  font-family: inherit;
}
.portal-attachment-backdrop {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  background: rgba(24, 29, 34, 0.52);
  cursor: default;
}
.portal-attachment-panel {
  position: relative;
  z-index: 1;
  box-sizing: border-box;
  width: min(520px, 100%);
  max-width: 100vw;
  max-height: min(820px, calc(100dvh - 48px));
  border: 1px solid #dce1e6;
  border-radius: 8px;
  display: grid;
  grid-template-rows: auto minmax(0, auto) auto auto auto auto auto;
  overflow: hidden;
  background: #fff;
  color: #1f2933;
  box-shadow: 0 24px 64px rgba(18, 24, 30, 0.24);
}
.portal-attachment-header {
  min-height: 58px;
  padding: 10px 12px 10px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.portal-attachment-header h2 {
  min-width: 0;
  margin: 0;
  overflow: hidden;
  color: #18222c;
  font-family: inherit;
  font-size: 18px;
  font-weight: 650;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.portal-attachment-close {
  width: 38px;
  height: 38px;
  margin-left: auto;
  border: 0;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: transparent;
  color: #687581;
  cursor: pointer;
  font-size: 25px;
  line-height: 1;
}
.portal-attachment-close:hover { background: #eef2f5; color: #26323d; }
.portal-attachment-preview {
  min-height: 0;
  padding: 0 20px;
  overflow: auto;
}
.portal-attachment-dialog .portal-upload-queue {
  width: 100%;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  display: grid;
  gap: 10px;
  overflow: visible;
  background: transparent;
}
.portal-attachment-dialog .portal-upload-item,
.portal-attachment-dialog .portal-upload-item--selected {
  position: relative;
  width: 100%;
  height: 68px;
  min-height: 68px;
  padding: 8px;
  border: 1px solid #e0e5e9;
  border-radius: 8px;
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr) 34px;
  align-items: center;
  gap: 10px;
  overflow: hidden;
  background: #f7f9fa;
  box-shadow: none;
}
.portal-attachment-dialog .portal-upload-preview {
  width: 52px;
  height: 52px;
  min-height: 52px;
  border-radius: 6px;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: #e8edf1;
  color: #64727e;
  font-size: 11px;
  font-weight: 700;
}
.portal-attachment-dialog .portal-upload-preview img,
.portal-attachment-dialog .portal-upload-preview video {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}
.portal-attachment-dialog .portal-upload-copy {
  position: static;
  min-width: 0;
  display: grid;
  gap: 4px;
  color: #202b35;
  pointer-events: none;
  text-shadow: none;
}
.portal-attachment-dialog .portal-upload-copy strong {
  display: block;
  overflow: hidden;
  font-size: 13px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.portal-attachment-dialog .portal-upload-copy small { color: #71808d; font-size: 11px; }
.portal-attachment-dialog .portal-upload-remove {
  position: static;
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 50%;
  display: grid;
  place-items: center;
  justify-self: end;
  background: transparent;
  color: #77838e;
  cursor: pointer;
  font-size: 21px;
  box-shadow: none;
}
.portal-attachment-dialog .portal-upload-remove:hover { background: #e8edf1; color: #303b45; }
.portal-attachment-dialog .portal-upload-item progress {
  position: absolute;
  right: 8px;
  bottom: 3px;
  left: 8px;
  z-index: 3;
  width: calc(100% - 16px);
  height: 4px;
}
.portal-attachment-dialog .portal-upload-item--hero {
  width: 100%;
  height: min(470px, 54dvh);
  min-height: 300px;
  padding: 0;
  border: 0;
  display: block;
  overflow: hidden;
  background: #edf1f4;
}
.portal-attachment-dialog .portal-upload-item--hero .portal-upload-preview {
  width: 100%;
  height: 100%;
  border-radius: 8px;
  background: #edf1f4;
}
.portal-attachment-dialog .portal-upload-item--hero .portal-upload-preview img,
.portal-attachment-dialog .portal-upload-item--hero .portal-upload-preview video { object-fit: contain; }
.portal-attachment-dialog .portal-upload-item--hero .portal-upload-copy { display: none; }
.portal-attachment-dialog .portal-upload-item--hero .portal-upload-remove {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 4;
  background: rgba(35, 44, 52, 0.78);
  color: #fff;
}
.portal-attachment-dialog .portal-upload-queue--multiple {
  grid-template-columns: repeat(auto-fill, minmax(132px, 1fr));
}
.portal-attachment-dialog .portal-upload-queue--multiple .portal-upload-item {
  height: 164px;
  min-height: 164px;
  padding: 7px;
  grid-template-columns: minmax(0, 1fr) 28px;
  grid-template-rows: 108px auto;
  gap: 5px;
}
.portal-attachment-dialog .portal-upload-queue--multiple .portal-upload-preview {
  grid-column: 1 / -1;
  width: 100%;
  height: 108px;
}
.portal-attachment-dialog .portal-upload-queue--multiple .portal-upload-copy { grid-column: 1; }
.portal-attachment-dialog .portal-upload-queue--multiple .portal-upload-remove { grid-column: 2; grid-row: 2; width: 28px; height: 28px; }
.portal-attachment-summary {
  min-height: 28px;
  padding: 8px 20px 4px;
  color: #72808c;
  font-size: 12px;
}
.portal-attachment-mode {
  min-height: 48px;
  margin: 0 20px;
  border-top: 1px solid #e5e9ec;
  border-bottom: 1px solid #e5e9ec;
  display: flex;
  align-items: center;
  gap: 11px;
  color: #24303a;
  cursor: pointer;
  font-size: 14px;
}
.portal-attachment-mode input { width: 20px; height: 20px; margin: 0; accent-color: #3d83c5; }
.portal-attachment-caption {
  position: relative;
  margin: 4px 20px 0;
  border-bottom: 2px solid #dce2e7;
}
.portal-attachment-caption:focus-within { border-bottom-color: #3d83c5; }
.portal-attachment-caption textarea {
  box-sizing: border-box;
  width: 100%;
  min-height: 48px;
  max-height: 112px;
  margin: 0;
  padding: 14px 44px 10px 0;
  border: 0;
  resize: none;
  outline: none;
  background: transparent;
  color: #1f2b35;
  font: inherit;
  line-height: 22px;
}
.portal-attachment-caption > button {
  position: absolute;
  right: 0;
  bottom: 7px;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: transparent;
  cursor: pointer;
  font-size: 20px;
}
.portal-attachment-caption > button:hover { background: #eef2f5; }
.portal-attachment-emoji {
  position: absolute;
  z-index: 5;
  right: 0;
  bottom: 48px;
  width: 236px;
  padding: 8px;
  border: 1px solid #dce2e7;
  border-radius: 8px;
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 3px;
  background: #fff;
  box-shadow: 0 12px 32px rgba(25, 31, 37, 0.16);
}
.portal-attachment-emoji button {
  aspect-ratio: 1;
  border: 0;
  border-radius: 6px;
  display: grid;
  place-items: center;
  background: transparent;
  cursor: pointer;
  font-size: 21px;
}
.portal-attachment-emoji button:hover { background: #eef3f6; }
.portal-attachment-error {
  margin: 8px 20px 0;
  color: #b52f45;
  font-size: 12px;
}
.portal-attachment-actions {
  min-width: 0;
  min-height: 60px;
  padding: 8px 12px 8px 14px;
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  align-items: center;
  gap: 4px;
}
.portal-attachment-actions button {
  min-width: 44px;
  min-height: 42px;
  padding: 0 10px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #357dbd;
  cursor: pointer;
  font: inherit;
  font-size: 14px;
  font-weight: 650;
}
.portal-attachment-actions > span { min-width: 0; }
.portal-attachment-actions button:hover { background: #edf3f8; }
.portal-attachment-actions button:disabled,
.portal-attachment-close:disabled,
.portal-attachment-caption button:disabled { cursor: wait; opacity: 0.5; }
.portal-attachment-send { color: #246fae !important; }

@media (max-width: 640px) {
  .portal-attachment-dialog { padding: 0; place-items: end center; }
  .portal-attachment-panel {
    width: 100%;
    max-height: min(92dvh, 760px);
    border-right: 0;
    border-bottom: 0;
    border-left: 0;
    border-radius: 8px 8px 0 0;
  }
  .portal-attachment-header { min-height: 54px; padding-left: 16px; }
  .portal-attachment-header h2 { font-size: 17px; }
  .portal-attachment-preview { padding-inline: 12px; }
  .portal-attachment-dialog .portal-upload-item--hero { height: min(430px, 48dvh); min-height: 220px; }
  .portal-attachment-dialog .portal-upload-queue--multiple { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .portal-attachment-summary { padding-inline: 14px; }
  .portal-attachment-mode { margin-inline: 14px; }
  .portal-attachment-caption { margin-inline: 14px; }
  .portal-attachment-actions { padding-inline: 6px; }
  .portal-attachment-actions button { padding-inline: 8px; }
}

/* Unified public header and roomier sign-in photo */
.portal-site-header {
  z-index: 1300;
}

.portal-access--with-site-header {
  margin-top: var(--topbar-height);
}

.portal-access--with-site-header .portal-access-panel > .portal-brand {
  display: none;
}

.portal-auth-actions {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  width: 100%;
}

.portal-auth-actions .portal-button {
  min-width: 0;
  padding-inline: 14px;
  text-align: center;
}

@media (min-width: 761px) {
  .portal-access--with-site-header {
    height: calc(100dvh - var(--topbar-height));
  }

  .portal-access--with-site-header .portal-access-copy {
    margin-top: clamp(70px, 11vh, 112px);
  }
}

@media (max-width: 760px) {
  .portal-access--with-site-header {
    min-height: calc(100dvh - var(--topbar-height));
    grid-template-rows: clamp(300px, 42dvh, 420px) auto;
  }

  .portal-access--with-site-header .portal-access-photo {
    min-height: 300px;
    height: clamp(300px, 42dvh, 420px);
  }

  .portal-access--with-site-header .portal-access-photo img {
    object-position: center 34%;
  }

  .portal-access--with-site-header .portal-access-panel {
    min-height: calc(100dvh - var(--topbar-height) - clamp(300px, 42dvh, 420px) + 24px);
    padding-top: 22px;
  }

  .portal-access--with-site-header .portal-access-copy {
    margin: 10px 0 22px;
  }

  .portal-auth-actions {
    gap: 8px;
  }

  .portal-auth-actions .portal-button {
    min-height: 50px;
    padding-inline: 10px;
    font-size: 14px;
  }

  .portal-auth-actions .portal-vk-mark,
  .portal-auth-actions .portal-ok-mark {
    width: 26px;
    height: 26px;
    font-size: 11px;
  }
}

@media (max-width: 370px) {
  .portal-auth-actions .portal-button {
    font-size: 13px;
    padding-inline: 8px;
  }
}

.portal-auth-label,
.portal-auth-label-full,
.portal-auth-label-short {
  min-width: 0;
  white-space: nowrap;
}

.portal-auth-label-short {
  display: none;
}

@media (max-width: 380px) {
  .portal-auth-label-full {
    display: none;
  }

  .portal-auth-label-short {
    display: inline;
  }
}

/* Compact desktop sign-in composition; mobile keeps its native stacked layout. */
@media (min-width: 981px) {
  .portal-site-header {
    min-height: var(--topbar-height);
    padding-block: 8px;
  }

  .portal-site-header .brand-symbol {
    width: 60px;
  }

  .portal-site-header .brand-mark {
    gap: 16px;
  }

  .portal-site-header .brand-mark strong {
    font-size: 26px;
  }

  .portal-site-header .brand-mark small {
    font-size: 14px;
  }

  .portal-access--with-site-header .portal-access-copy {
    margin: 28px 0 22px;
  }

  .portal-access--with-site-header .portal-auth-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }
}
