:root {
  --green-900: #06573f;
  --green-800: #0b6b4c;
  --green-700: #13855d;
  --green-600: #1aa36d;
  --surface: #f5f6f6;
  --ink: #1f2937;
  --muted: #6b7280;
  --card-border: rgba(17, 24, 39, 0.28);
  --danger: #e83434;
  --warn: #f39c12;
  --ok: #22b35e;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Plus Jakarta Sans", sans-serif;
  color: var(--ink);
  background: #eef0f2;
}

.bg-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    radial-gradient(rgba(255, 255, 255, 0.8) 0.8px, transparent 0.8px),
    radial-gradient(rgba(0, 0, 0, 0.03) 1px, transparent 1px);
  background-size: 3px 3px, 6px 6px;
  opacity: 0.8;
}

.app-shell {
  width: min(1200px, 100%);
  margin: 0 auto;
  display: grid;
  gap: 8px;
  padding-bottom: 8px;
  position: relative;
}

.app-header {
  background: linear-gradient(120deg, var(--green-900), var(--green-800));
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 12px;
}

.header-left,
.header-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.header-logo {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  object-fit: cover;
}

.header-right {
  position: relative;
}

.icon-btn {
  border: 0;
  background: transparent;
  color: inherit;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  padding: 3px;
}

#settingsBtn.icon-btn {
  display: none;
}

.brand {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: "Space Grotesk", sans-serif;
  font-weight: 700;
  font-size: clamp(20px, 2.4vw, 28px);
}

.sub {
  margin: 2px 0 0;
  font-size: clamp(11px, 1.2vw, 14px);
  color: rgba(255, 255, 255, 0.92);
}

@keyframes waveBeat {
  0%, 100% { transform: scaleY(0.4); }
  50% { transform: scaleY(1.12); }
}

.mic-toggle {
  width: 46px;
  height: 46px;
  border: 0;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: #f31359;
  color: #fff;
  cursor: pointer;
  padding: 9px;
}

.mic-toggle.mic-on {
  background: #4bb33f;
}

.mic-toggle.mic-denied {
  background: #991b1b;
}

.mic-icon {
  width: 100%;
  height: 100%;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.mic-toggle.mic-on .mic-slash {
  display: none;
}

.pill-btn,
.ghost-btn,
.tab-btn,
#closeViewer,
#closeSettings,
#closeProfile {
  border: 0;
  cursor: pointer;
}

.pill-btn {
  padding: 7px 10px;
  border-radius: 8px;
  background: var(--green-700);
  color: #fff;
  font-weight: 700;
  font-size: 12px;
}

.tabs {
  display: flex;
  overflow-x: auto;
  background: var(--green-800);
  border-top: 1px solid rgba(255, 255, 255, 0.14);
  border-bottom: 1px solid rgba(0, 0, 0, 0.2);
}

.tab-btn {
  flex: 1 0 auto;
  background: transparent;
  color: rgba(255, 255, 255, 0.95);
  font-size: clamp(13px, 1.4vw, 16px);
  padding: 9px 6px;
  border-right: 1px solid rgba(0, 0, 0, 0.3);
}

.tab-btn:last-child {
  border-right: 0;
}

.tab-btn.active {
  background: rgba(255, 255, 255, 0.13);
}

.tab-badge {
  min-width: 18px;
  height: 18px;
  display: inline-grid;
  place-items: center;
  margin-left: 4px;
  padding: 0 5px;
  border-radius: 999px;
  background: #f31359;
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
  vertical-align: 1px;
}

.actions-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 30;
  display: grid;
  gap: 4px;
  width: 210px;
  padding: 6px;
  border: 1px solid rgba(17, 24, 39, 0.16);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 14px 34px rgba(17, 24, 39, 0.18);
}

.action-btn {
  width: 100%;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #1f2937;
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
  padding: 9px 10px;
  text-align: left;
}

.action-btn:hover {
  background: #eef0f2;
}

.menu-group {
  display: grid;
  gap: 3px;
}

.menu-group summary {
  list-style: none;
}

.menu-group summary::-webkit-details-marker {
  display: none;
}

.menu-group[open] summary {
  background: #fee2e2;
}

.menu-group .action-btn:not(summary) {
  padding-left: 22px;
}

.action-btn.danger {
  color: #991b1b;
}

.action-btn.danger:hover {
  background: #fee2e2;
}

main {
  padding: 8px 12px 112px;
}

.mode-page {
  min-height: calc(100vh - 190px);
  display: grid;
  align-content: start;
  justify-items: center;
  gap: 16px;
  padding: clamp(18px, 5vw, 48px) 0;
  text-align: center;
}

.mode-heading p,
.mode-heading h2 {
  margin: 0;
}

.mode-heading h2 {
  margin-top: 3px;
  color: var(--green-800);
  font-family: "Space Grotesk", sans-serif;
  font-size: clamp(34px, 7vw, 72px);
}

.mode-heading p {
  color: #4b5563;
}

.mode-kicker {
  color: var(--green-700) !important;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

.listening-package {
  width: min(720px, 100%);
  min-height: 300px;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 14px;
  padding: 24px;
  border: 1px solid rgba(6, 87, 63, 0.22);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.84);
}

.listening-page {
  gap: 20px;
  padding-top: clamp(24px, 4vw, 38px);
}

.listening-page .mode-heading {
  display: grid;
  justify-items: center;
}

.mic-switch-btn {
  margin-top: 14px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  border: 0;
  border-radius: 999px;
  padding: 10px 14px;
  background: #dbe7e3;
  color: var(--green-900);
  cursor: pointer;
  font: inherit;
  font-weight: 800;
}

.mic-switch-track {
  width: 48px;
  height: 28px;
  position: relative;
  border-radius: 999px;
  background: #b7c9c2;
  transition: background-color 0.18s ease;
}

.mic-switch-knob {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  background: #fff;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.18);
  transition: transform 0.18s ease;
}

.mic-switch-btn.mic-switch-on .mic-switch-track {
  background: var(--green-700);
}

.mic-switch-btn.mic-switch-on .mic-switch-knob {
  transform: translateX(20px);
}

.listening-package h3,
.listening-package p {
  margin: 0;
}

.listening-pulse {
  display: flex;
  align-items: center;
  gap: 4px;
  height: 54px;
}

.listening-pulse i {
  width: 7px;
  height: 24px;
  border-radius: 999px;
  background: var(--green-600);
  animation: waveBeat 0.9s ease-in-out infinite;
}

.listening-pulse i:nth-child(2),
.listening-pulse i:nth-child(4) { animation-delay: 0.13s; height: 42px; }
.listening-pulse i:nth-child(3) { animation-delay: 0.23s; height: 54px; }

.listening-package.mic-muted .listening-pulse i {
  animation-play-state: paused;
}

.listening-content {
  max-width: 100%;
  overflow-wrap: anywhere;
  font-size: clamp(20px, 4vw, 36px);
}

.listening-emoji {
  font-size: clamp(100px, 28vw, 220px);
  line-height: 1;
}

.listening-image {
  max-width: min(100%, 540px);
  max-height: 48vh;
  border-radius: 14px;
  object-fit: contain;
}

.listening-actions {
  display: flex;
  gap: 10px;
  margin-top: 8px;
}

.listening-actions button {
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  padding: 10px 18px;
  font-weight: 800;
}

.listening-clear {
  background: #e8eff3;
  color: #1f2937;
}

.listening-delete {
  background: #fee2e2;
  color: #991b1b;
}

.sending-page {
  align-content: start;
  gap: 16px;
  padding: 18px 0 24px;
}

.audio-mode-toggle {
  display: inline-grid;
  grid-template-columns: repeat(2, minmax(92px, 1fr));
  gap: 4px;
  margin-top: 8px;
  padding: 4px;
  border-radius: 999px;
  background: #dbe7e3;
}

.audio-mode-toggle button {
  border: 0;
  border-radius: 999px;
  padding: 8px 14px;
  background: transparent;
  color: var(--green-900);
  cursor: pointer;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.audio-mode-toggle button.active {
  background: var(--green-700);
  color: #fff;
}

.big-send-btn {
  width: clamp(124px, 16vw, 144px);
  height: clamp(124px, 16vw, 144px);
  display: grid;
  place-items: center;
  border: 5px solid rgba(6, 87, 63, 0.18);
  border-radius: 999px;
  background: #fff;
  color: var(--green-900);
  cursor: pointer;
  font-size: 18px;
  font-weight: 800;
  overflow: hidden;
  position: relative;
}

.big-send-btn img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.send-tools {
  width: min(600px, 100%);
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: 8px;
  margin-top: 2px;
}

.send-tool {
  display: grid;
  gap: 3px;
  justify-items: center;
  border: 1px solid rgba(6, 87, 63, 0.16);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.88);
  color: #1f2937;
  cursor: pointer;
  padding: 9px 6px;
  min-height: 58px;
  font-size: 11px;
  font-weight: 800;
}

.send-tool-icon {
  width: 24px;
  height: 24px;
  object-fit: contain;
}

.send-tool-label {
  line-height: 1.1;
}

.send-tool.recording {
  background: #fee2e2;
  color: #991b1b;
}

.emoji-palette {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 18px;
  overflow-y: auto;
  padding: max(18px, env(safe-area-inset-top)) 18px max(18px, env(safe-area-inset-bottom));
  background: #f7fcff;
}

.emoji-palette header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.emoji-palette h2 {
  margin: 0;
  color: var(--green-900);
  font-size: clamp(28px, 6vw, 46px);
}

.emoji-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(58px, 1fr));
  align-content: start;
  gap: 10px;
}

.emoji-grid button {
  border: 1px solid rgba(6, 87, 63, 0.16);
  border-radius: 16px;
  background: #fff;
  cursor: pointer;
  padding: 10px 4px;
  font-size: clamp(30px, 7vw, 46px);
}

.emoji-close {
  width: 54px;
  height: 54px;
  border: 0;
  border-radius: 999px;
  background: #b8babc;
  color: #fff;
  cursor: pointer;
  font-size: 44px;
  font-weight: 800;
  line-height: 1;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 96px;
  z-index: 60;
  transform: translateX(-50%);
  border-radius: 999px;
  padding: 10px 16px;
  background: #06573f;
  color: #fff;
  box-shadow: 0 10px 28px rgba(17, 24, 39, 0.22);
  font-size: 14px;
  font-weight: 700;
}

.list-wrap {
  display: grid;
  gap: 8px;
}

.placeholder {
  border: 1px solid var(--card-border);
  padding: 14px;
  background: #fff;
}

.hidden {
  display: none !important;
}

.item-wrap {
  display: grid;
  gap: 4px;
}

.item-time {
  margin: 0;
  color: #6b7280;
  font-size: clamp(11px, 1vw, 13px);
  padding-inline: 8px;
}

.item-card {
  display: grid;
  grid-template-columns: auto 1fr auto auto auto;
  gap: 9px;
  align-items: center;
  padding: 8px 10px;
  border: 1px solid var(--card-border);
  border-radius: 8px;
  background: #f7f7f8;
  touch-action: pan-y;
  transition: transform 0.18s ease, border-color 0.18s ease, background-color 0.18s ease;
}

.item-card.expanded {
  grid-template-columns: auto 1fr auto auto auto;
}

.item-card.starred {
  border-color: rgba(245, 158, 11, 0.55);
  background: #fffaf0;
}

.item-card.incoming-new {
  animation: receivedGlow 2.4s ease-out;
}

@keyframes receivedGlow {
  0% { box-shadow: 0 0 0 4px rgba(34, 179, 94, 0.45); }
  100% { box-shadow: 0 0 0 0 rgba(34, 179, 94, 0); }
}

.item-card.swiping {
  background: #fee2e2;
  transition: none;
}

.badge {
  width: 38px;
  height: 38px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 18px;
  font-weight: 700;
}

.badge-slot {
  width: 38px;
  height: 38px;
}

.badge.red { background: var(--danger); }
.badge.orange {
  background: var(--warn);
  animation: pulse 1.4s ease-in-out infinite;
}
.badge.green { background: var(--ok); }

@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(243, 156, 18, 0.4); }
  100% { box-shadow: 0 0 0 12px rgba(243, 156, 18, 0); }
}

.item-title {
  margin: 0;
  font-size: clamp(14px, 1.2vw, 17px);
  font-weight: 700;
}

.item-meta {
  margin: 2px 0 0;
  color: #4b5563;
  font-size: clamp(12px, 1vw, 14px);
}

.wave-btn {
  width: 38px;
  height: 38px;
  border-radius: 999px;
  border: 2px solid rgba(0, 0, 0, 0.24);
  background: #f0f4f7;
  font-size: 18px;
  cursor: pointer;
}

.card-details {
  grid-column: 1 / -1;
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  transform: translateY(-6px);
  transition: max-height 0.24s ease, opacity 0.18s ease, transform 0.24s ease;
}

.item-card.expanded .card-details {
  max-height: 900px;
  opacity: 1;
  transform: translateY(0);
  padding-top: 2px;
}

.card-detail-profile,
.card-detail-audio {
  display: grid;
  gap: 10px;
}

.card-detail-profile-fields {
  display: grid;
  gap: 10px;
  margin: 0;
}

.card-detail-profile-fields div {
  display: grid;
  gap: 2px;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(15, 23, 42, 0.08);
}

.card-detail-profile-fields dt {
  font-size: 12px;
  font-weight: 800;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.card-detail-profile-fields dd {
  margin: 0;
  color: #0f172a;
  font-size: 15px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.card-detail-profile-image {
  max-height: 180px;
}

.card-detail-audio audio {
  width: 100%;
}

.card-detail-emoji {
  display: grid;
  place-items: center;
  min-height: 120px;
  font-size: clamp(48px, 8vw, 84px);
  line-height: 1;
}

.card-detail-text {
  margin: 0;
  color: #1f2937;
  font-size: clamp(13px, 1.1vw, 15px);
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.card-detail-image {
  display: block;
  max-width: 100%;
  max-height: 220px;
  border-radius: 12px;
  object-fit: contain;
}

.star-btn,
.delete-btn {
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: transparent;
  cursor: pointer;
  font-size: 20px;
  line-height: 1;
}

.star-btn {
  color: #8a6b12;
}

.star-btn.active {
  color: #f59e0b;
  background: #fff2bf;
}

.delete-btn {
  color: #991b1b;
  background: #fee2e2;
  font-size: 24px;
}

.composer {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 20;
  width: 100%;
  display: grid;
  grid-template-columns: 1fr minmax(0, 1fr) 1fr;
  gap: 8px;
  align-items: center;
  margin: 0;
  padding: 8px max(10px, env(safe-area-inset-right)) max(8px, env(safe-area-inset-bottom)) max(10px, env(safe-area-inset-left));
  border-radius: 0;
  border: 0;
  border-top: 1px solid rgba(0, 0, 0, 0.12);
  background: rgba(245, 247, 248, 0.98);
  box-shadow: 0 10px 30px rgba(17, 24, 39, 0.16);
}

.attachment-preview {
  grid-column: 2;
  grid-row: 1;
  justify-self: center;
  display: flex;
  gap: 7px;
  align-items: center;
  min-width: 0;
  max-width: min(420px, calc(100vw - 120px));
}

.attachment-thumb {
  width: 32px;
  height: 32px;
  flex: 0 0 auto;
  border-radius: 6px;
  object-fit: cover;
}

.file-badge {
  max-width: 260px;
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
  background: #d9f6ea;
  color: #06573f;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 14px;
}

.remove-attachment {
  width: 26px;
  height: 26px;
  flex: 0 0 auto;
  border: 0;
  border-radius: 999px;
  background: #fee2e2;
  color: #991b1b;
  cursor: pointer;
  font-size: 20px;
  line-height: 1;
}

#textComposerInput {
  width: 100%;
  min-height: 132px;
  resize: vertical;
  border: 1px solid #d1d5db;
  border-radius: 12px;
  padding: 10px 13px;
  font: inherit;
}

.text-composer-actions {
  margin-top: 10px;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.debug {
  margin-top: 12px;
  border: 1px solid rgba(0, 0, 0, 0.16);
  background: #edf2f4;
  border-radius: 12px;
  padding: 8px;
}

.ghost-btn {
  border-radius: 999px;
  padding: 7px 12px;
  background: #e8eff3;
  border: 1px solid rgba(0, 0, 0, 0.2);
  color: #1f2937;
  font-weight: 600;
}

.debug-body {
  margin-top: 8px;
}

#specCanvas {
  width: 100%;
  height: 160px;
  border-radius: 10px;
  background: #031728;
  border: 1px solid rgba(156, 216, 255, 0.2);
}

.stats {
  margin-top: 6px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 3px;
  font-size: 15px;
  color: #335474;
}

.debug-log {
  margin-top: 8px;
  background: #f9fcff;
  border-radius: 10px;
  border: 1px solid rgba(23, 84, 137, 0.2);
  height: 160px;
  overflow: auto;
  padding: 8px;
  font-size: 12px;
  white-space: pre-wrap;
}

.viewer-modal {
  border: 0;
  border-radius: 16px;
  width: min(560px, calc(100% - 18px));
  padding: 0;
  background: transparent;
}

.viewer-modal::backdrop {
  background: rgba(5, 21, 35, 0.4);
}

.viewer-modal article {
  background: #f7fcff;
  border: 1px solid rgba(34, 90, 139, 0.26);
  border-radius: 16px;
  padding: 12px;
}

.viewer-modal header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.settings-form {
  display: grid;
  gap: 16px;
  justify-items: center;
  padding: 8px 0 10px;
}

.settings-form label {
  display: flex;
  gap: 18px;
  align-items: center;
  font-size: 16px;
}

.settings-form input,
.settings-form select {
  border: 1px solid rgba(0, 0, 0, 0.2);
  border-radius: 10px;
  padding: 9px;
}

.settings-form .compact-check {
  display: flex;
  gap: 7px;
  align-items: center;
}

.settings-form .compact-check input {
  width: 16px;
  height: 16px;
  padding: 0;
}

.settings-value-row strong {
  min-width: 94px;
}

.settings-modal {
  width: min(680px, calc(100vw - 18px));
}

.settings-modal article {
  padding: 16px;
  border-radius: 22px;
}

.settings-modal header {
  justify-content: center;
  position: relative;
}

.settings-modal header h3 {
  margin: 0;
  font-size: 26px;
  font-weight: 500;
}

.settings-close {
  position: absolute;
  right: 0;
  width: 58px;
  height: 58px;
  border: 0;
  border-radius: 999px;
  background: #b8babc;
  color: #fff;
  cursor: pointer;
  font-size: 46px;
  font-weight: 800;
  line-height: 1;
}

.settings-form .pill-btn {
  min-width: 168px;
}

.profile-modal {
  width: min(640px, calc(100vw - 24px));
  min-height: min(760px, calc(100vh - 28px));
}

.profile-modal .profile-panel {
  min-height: min(736px, calc(100vh - 52px));
  padding: 24px;
  border-radius: 24px;
  background: #f7fcff;
}

.profile-modal .profile-header {
  margin-bottom: 10px;
}

.profile-modal .profile-header h3 {
  margin: 0;
  font-size: clamp(26px, 5vw, 34px);
}

.profile-close {
  width: 58px;
  height: 58px;
  border: 0;
  border-radius: 999px;
  background: #b8babc;
  color: #fff;
  cursor: pointer;
  font-size: 48px;
  font-weight: 800;
  line-height: 1;
}

.profile-form {
  display: grid;
  gap: 16px;
}

.profile-photo-row,
.profile-field {
  display: grid;
  grid-template-columns: minmax(136px, 0.9fr) minmax(0, 1.8fr) 34px;
  gap: 14px;
  align-items: center;
}

.profile-photo-row {
  min-height: 120px;
}

.profile-photo-picker {
  width: 116px;
  height: 116px;
  justify-self: end;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: #b8babc;
  cursor: pointer;
}

.profile-photo-picker svg {
  width: 76px;
  height: 76px;
  fill: none;
  stroke: #fff;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 4;
}

.profile-icon-preview {
  width: 100%;
  height: 100%;
  border-radius: inherit;
  object-fit: cover;
}

.profile-photo-picker.has-image svg {
  display: none;
}

.profile-photo-label,
.profile-field > span {
  font-size: clamp(18px, 3.8vw, 28px);
}

.profile-photo-row input[type="file"] {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
}

.profile-field input[type="text"],
.profile-field input[type="tel"],
.profile-field input[type="email"] {
  min-width: 0;
  border: 2px solid #d2d2d2;
  border-radius: 16px;
  padding: 12px;
  background: #fff;
  font-size: 18px;
}

.profile-form input[type="checkbox"] {
  width: 30px;
  height: 30px;
  padding: 0;
  accent-color: var(--green-700);
}

.profile-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 12px;
}

.profile-actions button {
  font-size: 18px;
  font-weight: 800;
}

.profile-crop-modal {
  width: min(390px, calc(100vw - 24px));
}

.profile-crop-modal article {
  display: grid;
  gap: 14px;
  justify-items: center;
  padding: 18px;
}

.profile-crop-modal header {
  width: 100%;
}

.profile-crop-modal header h3 {
  margin: 0;
}

#closeProfileCrop {
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 999px;
  background: #b8babc;
  color: #fff;
  cursor: pointer;
  font-size: 30px;
  line-height: 1;
}

#profileCropCanvas {
  width: min(256px, 76vw);
  height: min(256px, 76vw);
  border: 4px solid var(--green-700);
  border-radius: 999px;
  background: #e5e7eb;
  cursor: grab;
  touch-action: none;
}

#profileCropCanvas:active {
  cursor: grabbing;
}

.profile-crop-zoom {
  width: min(300px, 100%);
  display: grid;
  gap: 6px;
  font-weight: 700;
}

.profile-crop-zoom input {
  width: 100%;
}

.profile-crop-modal p {
  margin: 0;
  color: #4b5563;
  text-align: center;
  font-size: 13px;
}

.profile-crop-actions {
  display: flex;
  justify-content: center;
  gap: 10px;
}

@media (min-width: 900px) {
  .stats {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (max-width: 860px) {
  .header-right {
    gap: 8px;
  }

  .icon-btn {
    font-size: 21px;
  }

  .brand {
    font-size: clamp(18px, 3.2vw, 24px);
  }

  .sub {
    font-size: clamp(10px, 2vw, 13px);
  }

  .tab-btn {
    font-size: clamp(12px, 2.2vw, 15px);
  }

  .item-title {
    font-size: clamp(13px, 2.2vw, 16px);
  }

  .item-meta {
    font-size: clamp(11px, 1.8vw, 13px);
  }

}

@media (max-width: 640px) {
  .header-left {
    gap: 6px;
  }

  .header-logo {
    width: 36px;
    height: 36px;
  }

  .header-right {
    gap: 6px;
  }

  .mic-toggle {
    width: 40px;
    height: 40px;
    padding: 8px;
  }

  .send-tools {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .profile-modal .profile-panel {
    padding: 16px;
  }

  .profile-photo-row,
  .profile-field {
    grid-template-columns: minmax(92px, 0.9fr) minmax(0, 1.8fr) 28px;
    gap: 8px;
  }

  .profile-photo-row {
    min-height: 96px;
  }

  .profile-photo-picker {
    width: 92px;
    height: 92px;
  }

  .profile-photo-picker svg {
    width: 62px;
    height: 62px;
  }

  .profile-form input[type="checkbox"] {
    width: 26px;
    height: 26px;
  }

  .profile-actions {
    margin-top: 12px;
  }

  main {
    padding: 8px 8px 108px;
  }

  .item-card {
    gap: 6px;
    grid-template-columns: auto 1fr auto auto auto;
  }
}
