:root {
  color-scheme: light;
  --bg: #f5f7fa;
  --surface: #ffffff;
  --ink: #172026;
  --muted: #667985;
  --line: #dce4ea;
  --accent: #019fae;
  --accent-dark: #017d89;
  --accent-soft: #e6f8fa;
  --green: #148554;
  --green-bg: #e8f7ef;
  --amber: #936400;
  --amber-bg: #fff6d8;
  --red: #b42318;
  --red-bg: #fdecec;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
}

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.hidden {
  display: none !important;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.muted {
  color: var(--muted);
}

.public-home {
  display: grid;
  place-items: center;
  padding: 24px;
}

.lookup-shell {
  width: min(720px, 100%);
}

.lookup-card,
.profile-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: 0 18px 50px rgba(23, 32, 38, 0.08);
}

.lookup-card {
  padding: clamp(24px, 5vw, 48px);
  text-align: center;
}

.lookup-card h1,
.profile-heading h2,
.section-heading h2 {
  margin: 0;
}

.lookup-copy {
  max-width: 560px;
  margin-left: auto;
  margin-right: auto;
  color: var(--muted);
  line-height: 1.55;
}

.lookup-logo {
  display: block;
  width: min(220px, 62vw);
  height: auto;
  margin: 0 auto 18px;
}

.lookup-form {
  display: grid;
  gap: 10px;
  margin-top: 24px;
  text-align: center;
}

.lookup-form label {
  font-weight: 800;
}

.lookup-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
}

input {
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0 13px;
}

textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 13px;
  resize: vertical;
}

input:not([readonly]):focus,
textarea:not([readonly]):focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(1, 159, 174, 0.14);
  outline: none;
}

button,
.admin-link,
.back-link,
.microsoft-login-button {
  border: 0;
  border-radius: 10px;
  background: var(--accent);
  color: #fff;
  min-height: 42px;
  padding: 0 16px;
  font-weight: 800;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

button:hover,
.admin-link:hover,
.back-link:hover,
.microsoft-login-button:hover {
  background: var(--accent-dark);
}

.login-card {
  display: grid;
  justify-items: center;
}

.microsoft-login-button {
  gap: 12px;
  margin-top: 12px;
  min-height: 50px;
  padding-inline: 20px;
}

.microsoft-mark {
  display: grid;
  grid-template-columns: repeat(2, 9px);
  grid-template-rows: repeat(2, 9px);
  gap: 2px;
}

.microsoft-mark span:nth-child(1) {
  background: #f25022;
}

.microsoft-mark span:nth-child(2) {
  background: #7fba00;
}

.microsoft-mark span:nth-child(3) {
  background: #00a4ef;
}

.microsoft-mark span:nth-child(4) {
  background: #ffb900;
}

.admin-link {
  margin-top: 22px;
  background: #eef3f7;
  color: var(--ink);
}

.form-error,
.profile-message {
  margin: 12px 0 0;
  color: var(--red);
}

.profile-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 22px clamp(16px, 4vw, 48px);
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.topbar-actions {
  display: grid;
  justify-items: end;
  gap: 8px;
  margin-left: auto;
}

.account-summary {
  text-align: right;
}

.account-label {
  display: block;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.account-summary strong {
  display: block;
  max-width: min(360px, 48vw);
  overflow: hidden;
  color: var(--ink);
  font-size: 0.95rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topbar-button-row {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.topbar-button-row .back-link {
  margin-left: 0;
}

.back-link {
  margin-left: auto;
  background: #eef3f7;
  color: var(--ink);
}

.sign-out-button {
  min-height: 42px;
  background: #eef3f7;
  color: var(--ink);
}

.sign-out-button:hover {
  background: #dfe8ee;
}

.topbar-logo {
  flex: 0 0 auto;
  width: clamp(118px, 13vw, 180px);
  height: auto;
}

.profile-shell {
  width: min(1440px, 100%);
  margin: 0 auto;
  padding: 24px clamp(14px, 3vw, 36px) 72px;
}

.profile-message {
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface);
}

.profile-message.warning {
  background: var(--amber-bg);
  border-color: #edd78a;
  color: var(--amber);
}

.profile-message.error {
  background: var(--red-bg);
  border-color: #f2b6b0;
  color: var(--red);
}

.profile-card {
  padding: clamp(16px, 3vw, 28px);
}

.profile-heading {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: start;
}

.profile-phone {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 1rem;
  font-weight: 700;
}

.count-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(110px, 1fr));
  gap: 8px;
  margin: 0;
}

.count-grid div,
.fact-list div {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f9fbfc;
}

dt {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

dd {
  margin: 4px 0 0;
  font-weight: 800;
}

.profile-tabs {
  display: flex;
  gap: 8px;
  margin: 24px 0;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #f7fafb;
}

.profile-tab {
  background: transparent;
  color: var(--muted);
  border-radius: 10px;
}

.profile-tab:hover,
.detail-tab:hover {
  color: #fff;
}

.profile-tab.active {
  background: var(--accent);
  color: #fff;
}

.profile-tab-panel {
  display: none;
}

.profile-tab-panel.active {
  display: block;
}

.contact-edit-card,
.profile-detail-card,
.conversation-card,
.dispatch-card,
.blue-yonder-card,
.coming-soon {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #fff;
  padding: 16px;
  box-shadow: 0 1px 2px rgba(23, 32, 38, 0.04);
}

.contact-edit-card,
.profile-detail-card {
  margin-bottom: 16px;
}

.blue-yonder-frame {
  width: 100%;
  min-height: 720px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
}

.card-header-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.card-header-row h3 {
  margin: 0;
}

.contact-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.contact-form label {
  display: grid;
  align-content: start;
  gap: 4px;
  min-height: 64px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f9fbfc;
  color: var(--ink);
  font-weight: 800;
}

.contact-form label span {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  line-height: 1.1;
  text-transform: uppercase;
}

.edit-pencil {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 19px;
  height: 19px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-dark);
  font-size: 0.76rem;
  min-height: 0;
  padding: 0;
}

.contact-form label:nth-child(3) {
  grid-column: span 2;
}

.contact-form input,
.contact-form textarea {
  min-height: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  padding: 0;
  color: var(--ink);
  font-size: 1.03rem;
  font-weight: 900;
  line-height: 1.35;
}

.contact-form textarea {
  min-height: 54px;
}

.contact-form input[readonly],
.contact-form textarea[readonly] {
  cursor: default;
}

.editable-field.editing {
  background: #fff;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(1, 159, 174, 0.12);
}

.editable-field.editing input,
.editable-field.editing textarea {
  background: #fff;
}

.form-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  grid-column: span 2;
}

.inline-status {
  margin: 0;
  color: var(--muted);
  font-weight: 800;
}

.inline-status.success {
  color: var(--green);
}

.inline-status.error {
  color: var(--red);
}

.detail-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #f7fafb;
  margin-bottom: 14px;
}

.detail-tab {
  min-height: 38px;
  background: transparent;
  color: var(--muted);
  border-radius: 10px;
}

.detail-tab.active {
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 1px 6px rgba(23, 32, 38, 0.09);
}

.detail-panel {
  display: none;
}

.detail-panel.active {
  display: block;
}

.fact-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

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

.compact-row,
.empty-state {
  padding: 11px 12px;
  border-radius: 10px;
  background: #f7f9fb;
  color: var(--muted);
}

.accordion-item {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  overflow: hidden;
}

.accordion-item + .accordion-item {
  margin-top: 8px;
}

.accordion-item summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 48px;
  padding: 12px 14px;
  cursor: pointer;
  font-weight: 900;
  list-style: none;
}

.accordion-item summary::-webkit-details-marker {
  display: none;
}

.accordion-item summary::after {
  content: "⌄";
  color: var(--muted);
  transition: transform 0.18s ease;
}

.accordion-item[open] summary::after {
  transform: rotate(180deg);
}

.accordion-item summary small {
  margin-left: auto;
  color: var(--muted);
  font-weight: 700;
}

.mini-facts {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0 14px 14px;
}

.mini-facts div {
  padding: 10px 12px;
  border-radius: 10px;
  background: #f7f9fb;
}

.accordion-stack {
  display: grid;
  gap: 8px;
  padding-bottom: 14px;
}

.conversation-section {
  margin-top: 28px;
}

.section-heading {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 12px;
}

.dispatch-list {
  display: grid;
  gap: 16px;
}

.dispatch-date-group {
  display: grid;
  gap: 8px;
}

.dispatch-date-group h3 {
  margin: 0;
  color: var(--muted);
  font-size: 0.86rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.dispatch-order-body {
  display: grid;
  gap: 10px;
  padding: 0 14px 14px;
}

.dispatch-image-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 10px;
  padding: 0 14px 14px;
}

.dispatch-image-grid a,
.dispatch-image-grid button {
  display: grid;
  min-height: 92px;
  place-items: center;
  overflow: hidden;
  border: 0;
  border-radius: 12px;
  background: rgba(1, 159, 174, 0.1);
  color: var(--accent);
  font-weight: 800;
  text-decoration: none;
}

.dispatch-image-grid button {
  width: 100%;
  padding: 0;
  cursor: pointer;
}

.dispatch-image-grid button:hover,
.dispatch-image-grid button:focus-visible {
  background: rgba(1, 159, 174, 0.16);
  color: var(--accent-dark);
  box-shadow: none;
  outline: none;
}

.dispatch-image-grid img {
  width: 100%;
  height: 120px;
  object-fit: cover;
}

.dispatch-image-grid a.image-unavailable,
.dispatch-image-grid button.image-unavailable {
  min-height: 120px;
  padding: 12px;
  color: var(--accent);
  text-align: center;
}

.conversation-list {
  display: grid;
  gap: 12px;
}

.conversation-card-header {
  display: flex;
  justify-content: space-between;
  gap: 14px;
}

.conversation-card h3 {
  margin: 0;
}

.conversation-summary {
  line-height: 1.55;
}

.conversation-summary.loading-summary {
  color: var(--muted);
  font-style: italic;
}

.secondary-button {
  background: #eef3f7;
  color: var(--ink);
}

.floating-progress {
  position: fixed;
  right: 18px;
  bottom: 18px;
  width: min(420px, calc(100vw - 36px));
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 16px 45px rgba(23, 32, 38, 0.16);
}

.floating-progress-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
}

.progress-track {
  height: 9px;
  margin: 12px 0;
  overflow: hidden;
  border-radius: 999px;
  background: #e8eef2;
}

.progress-track span {
  display: block;
  width: 3%;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
  transition: width 0.25s ease;
}

.floating-progress p {
  margin: 0;
  color: var(--muted);
}

.conversation-modal,
.image-gallery-modal {
  width: min(900px, calc(100vw - 28px));
  max-height: min(820px, calc(100vh - 28px));
  border: 0;
  border-radius: 18px;
  padding: 0;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.32);
}

.image-gallery-modal {
  width: min(1100px, calc(100vw - 28px));
  background: #0f171d;
  color: #fff;
}

.confirm-modal {
  width: min(560px, calc(100vw - 28px));
  border: 0;
  border-radius: 18px;
  padding: 0;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.32);
}

.confirm-modal::backdrop {
  background: rgba(10, 16, 22, 0.46);
}

.confirm-card {
  padding: 22px;
}

.confirm-card h2 {
  margin: 0;
}

.confirm-list {
  display: grid;
  gap: 8px;
  margin: 18px 0;
}

.confirm-list div {
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f9fbfc;
}

.confirm-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.conversation-modal::backdrop,
.image-gallery-modal::backdrop {
  background: rgba(10, 16, 22, 0.46);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
}

.modal-header h2 {
  margin: 0;
}

.image-gallery-header {
  border-bottom-color: rgba(255, 255, 255, 0.12);
}

.image-gallery-header .muted {
  margin: 4px 0 0;
  color: rgba(255, 255, 255, 0.68);
}

.image-gallery-stage {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr) 64px;
  align-items: center;
  gap: 12px;
  min-height: min(680px, calc(100vh - 180px));
  padding: 20px;
}

.image-gallery-stage figure {
  display: grid;
  gap: 12px;
  justify-items: center;
  margin: 0;
}

.gallery-media-frame {
  display: grid;
  place-items: center;
  width: 100%;
}

.gallery-media-inline {
  display: grid;
  place-items: center;
  width: 100%;
}

.gallery-media-loading {
  opacity: 0;
}

.gallery-media-loading-text {
  margin: 0;
  color: rgba(255, 255, 255, 0.78);
  font-weight: 900;
}

.image-gallery-stage img,
.image-gallery-stage video {
  max-width: 100%;
  max-height: min(620px, calc(100vh - 230px));
  border-radius: 14px;
  object-fit: contain;
  background: rgba(255, 255, 255, 0.06);
}

.image-gallery-stage video {
  width: min(100%, 920px);
}

.gallery-media-fallback {
  display: grid;
  gap: 12px;
  place-items: center;
  min-height: 260px;
  padding: 24px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 14px;
  color: rgba(255, 255, 255, 0.78);
  text-align: center;
}

.gallery-media-fallback p {
  margin: 0;
}

.gallery-media-fallback a {
  color: #fff;
  font-weight: 900;
  text-decoration: underline;
  text-underline-offset: 4px;
}

.image-gallery-stage figcaption {
  color: rgba(255, 255, 255, 0.78);
  font-weight: 800;
  text-align: center;
}

.gallery-nav {
  width: 54px;
  height: 54px;
  min-width: 54px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  color: var(--accent);
  font-size: 2.4rem;
  line-height: 1;
}

.gallery-nav:hover,
.gallery-nav:focus-visible {
  background: transparent;
  box-shadow: none;
  color: #28c6d2;
  outline: none;
}

.gallery-nav:disabled {
  opacity: 0.35;
  cursor: default;
}

.image-gallery-modal .icon-button {
  min-width: 42px;
  width: 42px;
  height: 42px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  color: var(--accent);
  font-size: 1.7rem;
}

.image-gallery-modal .icon-button:hover,
.image-gallery-modal .icon-button:focus-visible {
  background: transparent;
  box-shadow: none;
  color: #28c6d2;
  outline: none;
}

.icon-button {
  min-width: 42px;
  padding: 0;
  border-radius: 50%;
}

.modal-search {
  display: grid;
  gap: 6px;
  padding: 14px 20px;
  font-weight: 800;
}

.chat-thread {
  display: grid;
  gap: 12px;
  max-height: 520px;
  overflow: auto;
  padding: 6px 20px 22px;
}

.chat-message {
  max-width: 72%;
  padding: 12px 14px;
  border-radius: 16px;
}

.chat-message.inbound {
  justify-self: start;
  background: #eef3f7;
}

.chat-message.outbound {
  justify-self: end;
  background: var(--accent);
  color: #fff;
}

.chat-message p {
  margin: 0;
  white-space: pre-wrap;
}

.chat-message time {
  display: block;
  margin-top: 7px;
  opacity: 0.72;
  font-size: 0.78rem;
}

@media (max-width: 760px) {
  .lookup-row,
  .contact-form,
  .profile-heading,
  .conversation-card-header {
    grid-template-columns: 1fr;
    display: grid;
  }

  .count-grid {
    grid-template-columns: 1fr;
  }

  .fact-list {
    grid-template-columns: 1fr;
  }

  .contact-form label:nth-child(3),
  .form-actions {
    grid-column: span 1;
  }

  .profile-topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .topbar-actions {
    align-items: stretch;
    justify-items: stretch;
    margin-left: 0;
    width: 100%;
  }

  .account-summary {
    text-align: left;
  }

  .account-summary strong {
    max-width: 100%;
  }

  .topbar-button-row {
    display: grid;
    grid-template-columns: 1fr;
  }

  .back-link,
  .sign-out-button {
    margin-left: 0;
  }

  .lookup-row,
  .confirm-actions {
    grid-template-columns: 1fr;
    display: grid;
  }

  .lookup-row button,
  .confirm-actions button {
    width: 100%;
  }

  .chat-message {
    max-width: 88%;
  }
}

@media (max-width: 1024px) {
  .profile-shell {
    padding-inline: 12px;
  }

  .profile-heading {
    display: grid;
    grid-template-columns: 1fr;
  }

  .count-grid {
    width: 100%;
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .fact-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 600px) {
  body {
    font-size: 15px;
  }

  .public-home {
    align-items: start;
    min-height: 100dvh;
    padding: 12px;
  }

  .lookup-card,
  .profile-card {
    border-radius: 14px;
    box-shadow: 0 10px 28px rgba(23, 32, 38, 0.08);
  }

  .lookup-card {
    padding: 20px 16px;
  }

  .lookup-logo {
    width: min(180px, 68vw);
    margin-bottom: 12px;
  }

  .lookup-card h1 {
    font-size: clamp(1.45rem, 8vw, 2rem);
  }

  .lookup-copy {
    font-size: 0.98rem;
  }

  .profile-topbar {
    position: sticky;
    top: 0;
    z-index: 10;
    flex-direction: row;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
  }

  .topbar-logo {
    width: min(112px, 42vw);
  }

  .back-link {
    min-height: 38px;
    padding-inline: 12px;
    white-space: nowrap;
  }

  .topbar-actions {
    width: auto;
  }

  .account-summary {
    display: none;
  }

  .topbar-button-row {
    display: flex;
    gap: 8px;
  }

  .sign-out-button {
    min-height: 38px;
    padding-inline: 12px;
    white-space: nowrap;
  }

  .profile-shell {
    padding: 10px 8px 96px;
  }

  .profile-card {
    padding: 12px;
  }

  .profile-heading {
    gap: 12px;
  }

  .profile-heading h2 {
    font-size: clamp(1.35rem, 7vw, 1.85rem);
    overflow-wrap: anywhere;
  }

  .count-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .count-grid div,
  .fact-list div {
    padding: 10px;
  }

  .profile-tabs,
  .detail-tabs {
    position: sticky;
    z-index: 8;
    display: grid;
    gap: 6px;
    margin: 14px -4px;
    padding: 4px;
    border-radius: 12px;
  }

  .profile-tabs {
    top: 56px;
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .detail-tabs {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .profile-tab,
  .detail-tab {
    min-height: 40px;
    padding-inline: 14px;
  }

  .contact-edit-card,
  .profile-detail-card,
  .conversation-card,
  .dispatch-card,
  .blue-yonder-card,
  .coming-soon {
    padding: 12px;
    border-radius: 14px;
  }

  .card-header-row,
  .section-heading,
  .conversation-card-header {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .contact-form {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .contact-form label,
  .contact-form label:nth-child(3),
  .form-actions {
    grid-column: 1;
  }

  .form-actions button,
  .conversation-card button,
  .secondary-button {
    width: 100%;
  }

  .fact-list {
    grid-template-columns: 1fr;
  }

  .compact-row,
  .empty-state {
    overflow-wrap: anywhere;
  }

  .accordion-item summary {
    align-items: flex-start;
    flex-direction: column;
    gap: 5px;
  }

  .accordion-item summary small {
    margin-left: 0;
  }

  .dispatch-order-body,
  .mini-facts {
    padding-inline: 10px;
  }

  .dispatch-image-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    padding-inline: 10px;
  }

  .dispatch-image-grid img {
    height: 108px;
  }

  .conversation-section {
    margin-top: 18px;
  }

  .conversation-summary {
    overflow-wrap: anywhere;
  }

  .floating-progress {
    right: 8px;
    bottom: 8px;
    left: 8px;
    width: auto;
    padding: 12px;
    border-radius: 12px;
  }

  .floating-progress-header {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2px;
  }

  .conversation-modal,
  .image-gallery-modal,
  .confirm-modal {
    width: calc(100vw - 12px);
    max-height: calc(100dvh - 12px);
    border-radius: 14px;
  }

  .modal-header {
    padding: 12px;
  }

  .modal-search {
    padding: 12px;
  }

  .chat-thread {
    max-height: calc(100dvh - 210px);
    padding: 4px 12px 14px;
  }

  .chat-message {
    max-width: 94%;
    padding: 10px 12px;
  }

  .image-gallery-stage {
    grid-template-columns: 1fr;
    min-height: auto;
    padding: 12px;
  }

  .gallery-nav {
    position: absolute;
    top: 50%;
    width: 42px;
    height: 42px;
    min-width: 42px;
    font-size: 1.8rem;
    transform: translateY(-50%);
  }

  .gallery-nav.previous {
    left: 10px;
  }

  .gallery-nav.next {
    right: 10px;
  }

  .image-gallery-stage img,
  .image-gallery-stage video {
    max-height: calc(100dvh - 190px);
  }

  .confirm-card {
    padding: 16px;
  }

  .confirm-actions {
    display: grid;
    grid-template-columns: 1fr;
  }
}

@media (max-width: 430px) {
  .profile-shell {
    padding-inline: 6px;
  }

  .profile-card {
    border-inline: 0;
    border-radius: 12px;
  }

  .count-grid {
    grid-template-columns: 1fr 1fr;
    gap: 6px;
  }

  .profile-tabs {
    top: 50px;
  }

  .detail-tabs {
    grid-template-columns: 1fr;
  }

  .dispatch-image-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 375px) {
  .profile-topbar {
    padding-inline: 8px;
  }

  .topbar-logo {
    width: 94px;
  }

  .back-link {
    min-height: 36px;
    padding-inline: 10px;
    font-size: 0.9rem;
  }

  .sign-out-button {
    min-height: 36px;
    padding-inline: 10px;
    font-size: 0.9rem;
  }

  .profile-card {
    padding: 10px;
  }

  .count-grid {
    grid-template-columns: 1fr;
  }
}
