/*
 * All-customers workspace
 * Scope: customer navigation only. Existing fields, handlers, and persistence stay unchanged.
 */

.customer-page-toolbar {
  display: none;
}

.mobile-customer-list-back {
  display: none;
}

.mobile-customer-detail-loading {
  display: none;
}

.customer-page-toolbar svg,
.customer-header-avatar svg,
.customer-item-activity svg {
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.customer-header-top {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr);
  align-items: center;
}

.customer-header-avatar {
  display: grid;
  width: 58px;
  height: 58px;
  place-items: center;
  border: 1px solid var(--color-border-soft);
  border-radius: 50%;
  background: var(--color-surface-soft);
  color: var(--color-text-primary);
}

.customer-header-avatar svg {
  width: 34px;
  height: 34px;
  stroke-width: 1.7;
}

.customer-header-name,
.customer-header-name-input {
  min-width: 0;
  max-width: 100%;
}

.customer-header-name {
  overflow-wrap: anywhere;
  word-break: break-word;
}

.customer-header-meta-row {
  display: flex;
  min-width: 0;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px 10px;
  margin-top: 5px;
}

.customer-header-account {
  max-width: 100%;
  overflow: hidden;
  color: var(--color-text-secondary);
  font-size: 13px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.customer-header-meta-row .customer-header-tags {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.customer-record-tabs {
  display: flex;
  grid-column: 1 / -1;
  min-width: 0;
  align-items: center;
  gap: 6px;
  overflow-x: auto;
  border-bottom: 1px solid var(--color-border-soft);
  background: var(--color-surface);
  scrollbar-width: none;
}

.customer-record-tabs::-webkit-scrollbar {
  display: none;
}

.customer-record-tabs a {
  position: relative;
  flex: 0 0 auto;
  min-height: 44px;
  padding: 11px 18px 10px;
  color: var(--color-text-secondary);
  font-size: 13px;
  font-weight: 800;
  text-decoration: none;
  white-space: nowrap;
}

.customer-record-tabs a:hover,
.customer-record-tabs a:focus-visible,
.customer-record-tabs a.is-active {
  color: var(--color-accent-text);
  outline: none;
}

.customer-record-tabs a.is-active::after,
.customer-record-tabs a:focus-visible::after {
  position: absolute;
  right: 12px;
  bottom: -1px;
  left: 12px;
  height: 3px;
  border-radius: 999px 999px 0 0;
  background: var(--color-accent);
  content: "";
}

#customerSummaryPanel,
#customerSessionWorkspace,
#customerProfileCards,
#customerBodyMapPanel,
#customerOtherWorkspace {
  scroll-margin-top: 58px;
}

.customer-next-plan-card {
  display: grid;
  gap: 12px;
}

.customer-next-plan-card label {
  display: grid;
  min-width: 0;
}

.customer-next-plan-card textarea {
  min-height: 118px;
}

.customer-next-plan-card > .secondary-button {
  width: 100%;
}

.customer-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: center;
  gap: 0;
  min-height: 94px;
  padding: 10px 34px 10px 10px;
  text-align: left;
}

.customer-item-content {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.customer-item-primary {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 6px;
}

.customer-item .customer-name {
  display: block;
  min-width: 0;
  flex: 1 1 auto;
  line-height: 1.35;
}

.customer-item .customer-name > span:first-child {
  display: block;
  overflow: hidden;
  color: var(--color-text-primary);
  font-size: 14px;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.customer-item-badges {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 5px;
}

.customer-visit-type {
  display: inline-flex;
  min-height: 22px;
  align-items: center;
  padding: 2px 7px;
  border: 1px solid var(--color-success-border);
  border-radius: 999px;
  background: var(--color-success-bg);
  color: var(--color-success-text);
  font-size: 10px;
  font-weight: 900;
  line-height: 1;
  white-space: nowrap;
}

.customer-visit-type.is-new {
  border-color: #c7dfec;
  background: #edf7fc;
  color: #39718e;
}

.customer-level {
  color: #d17721;
  font-size: 11px;
  font-weight: 900;
  white-space: nowrap;
}

.customer-item .customer-x-id {
  display: block;
  min-width: 0;
  overflow: hidden;
  color: var(--color-text-muted);
  font-size: 11px;
  font-weight: 600;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.customer-item-activity {
  display: grid;
  grid-template-columns: 14px minmax(0, 1fr) auto;
  min-width: 0;
  align-items: center;
  gap: 5px;
  color: var(--color-text-secondary);
  font-size: 11px;
  line-height: 1.35;
}

.customer-item-activity svg {
  width: 14px;
  height: 14px;
  color: var(--color-accent);
  stroke-width: 1.7;
}

.customer-item-activity > span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.customer-item-activity time {
  color: var(--color-text-muted);
  white-space: nowrap;
}

.customer-item-wrap .customer-item-menu-button {
  top: 9px;
  right: 5px;
  width: 30px;
  min-width: 30px;
  height: 34px;
  min-height: 34px;
  border-radius: 8px;
}

@media (min-width: 981px) {
  .app-shell[data-active-nav-category="customer"],
  .app-shell.sidebar-collapsed[data-active-nav-category="customer"] {
    --customer-list-width: clamp(292px, 24vw, 348px);
    grid-template-columns: 288px var(--customer-list-width) minmax(0, 1fr);
  }

  .app-shell[data-active-nav-category="customer"] > .sidebar,
  .app-shell.sidebar-collapsed[data-active-nav-category="customer"] > .sidebar {
    grid-template-columns: 268px minmax(0, 1fr);
  }

  .app-shell[data-active-nav-category="customer"] > .sidebar > .sidebar-body,
  .app-shell.sidebar-collapsed[data-active-nav-category="customer"] > .sidebar > .sidebar-body {
    --customer-list-header-space: 92px;
    height: calc(100% - var(--customer-list-header-space) + var(--customer-list-scroll-offset, 0px));
    margin-top: calc(var(--customer-list-header-space) - var(--customer-list-scroll-offset, 0px));
    margin-left: 10px;
    padding: 14px;
    gap: 12px;
    border-radius: 12px;
  }

  .app-shell[data-active-nav-category="customer"] > .workspace {
    min-width: 0;
    padding-top: 0;
  }

  .app-shell[data-active-nav-category="customer"] .topbar,
  .app-shell[data-active-nav-category="customer"] .topbar.hide-context-title {
    position: relative;
    z-index: 5;
    display: block;
    width: calc(100% + var(--customer-list-width) + 6px);
    min-height: 80px;
    margin: 0 0 12px calc(-1 * var(--customer-list-width) - 6px);
    padding: 13px 16px;
    border: 1px solid var(--color-border-soft);
    border-top: 0;
    border-radius: 0 0 12px 12px;
    background: var(--color-surface);
    box-shadow: 0 2px 12px rgba(80, 55, 35, 0.04);
  }

  .app-shell[data-active-nav-category="customer"] .topbar > :not(.customer-page-toolbar) {
    display: none;
  }

  .app-shell[data-active-nav-category="customer"] .customer-page-toolbar {
    display: grid !important;
    grid-template-columns: minmax(220px, 0.9fr) minmax(250px, 1.3fr) auto;
    align-items: center;
    gap: 12px 16px;
  }

  .customer-page-heading {
    min-width: 0;
  }

  .customer-page-title-line {
    display: flex;
    min-width: 0;
    align-items: center;
    gap: 10px;
  }

  .customer-page-title-line h2 {
    margin: 0;
    color: var(--color-text-primary);
    font-size: 22px;
    line-height: 1.25;
  }

  .customer-page-heading p {
    margin: 3px 0 0;
    overflow: hidden;
    color: var(--color-text-muted);
    font-size: 11px;
    line-height: 1.4;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .customer-page-toolbar .profile-auto-save-status {
    min-height: 25px;
    padding: 4px 8px;
    font-size: 10px;
    box-shadow: none;
  }

  .customer-page-search {
    position: relative;
    display: block;
    min-width: 0;
  }

  .customer-page-search svg {
    position: absolute;
    top: 50%;
    left: 13px;
    z-index: 1;
    width: 18px;
    height: 18px;
    color: var(--color-text-muted);
    stroke-width: 1.8;
    transform: translateY(-50%);
    pointer-events: none;
  }

  .customer-page-search input {
    min-height: 46px;
    padding: 9px 38px 9px 40px;
    border-radius: 10px;
    background: var(--color-surface);
    font-size: 13px;
  }

  .customer-page-toolbar-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
  }

  .customer-page-toolbar-actions button {
    display: inline-flex;
    min-height: 46px;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 8px 12px;
    border-radius: 10px;
    font-size: 12px;
    white-space: nowrap;
  }

  .customer-page-toolbar-actions svg {
    width: 17px;
    height: 17px;
    stroke-width: 1.8;
  }

  .app-shell[data-active-nav-category="customer"] .customer-seg-bar {
    gap: 8px;
  }

  .app-shell[data-active-nav-category="customer"] .customer-seg-chip {
    min-height: 66px;
    align-items: flex-start;
    justify-content: center;
    padding: 8px 12px;
    border-radius: 10px;
  }

  .app-shell[data-active-nav-category="customer"] .customer-seg-chip b {
    font-size: 20px;
  }

  .app-shell[data-active-nav-category="customer"] .customer-seg-chip span {
    font-size: 11px;
    font-weight: 800;
  }

  .app-shell[data-active-nav-category="customer"] .sidebar-body .search {
    gap: 5px;
  }

  .app-shell[data-active-nav-category="customer"] .sidebar-body .search > span {
    font-size: 11px;
  }

  .app-shell[data-active-nav-category="customer"] .sidebar-body .search input {
    min-height: 42px;
    border-radius: 9px;
  }

  .app-shell[data-active-nav-category="customer"] .customer-sort-controls {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    align-items: end;
    gap: 8px;
  }

  .app-shell[data-active-nav-category="customer"] .customer-sort-controls .sort-filter-row {
    gap: 6px;
  }

  .app-shell[data-active-nav-category="customer"] .sort-filter-label {
    display: none;
  }

  .app-shell[data-active-nav-category="customer"] .sort-filter-row select {
    min-height: 40px;
    border-radius: 9px;
  }

  .app-shell[data-active-nav-category="customer"] .customer-list {
    gap: 7px;
    padding: 1px 2px 4px 1px;
  }

  .app-shell[data-active-nav-category="customer"] .sidebar-footer {
    gap: 8px;
  }

  .app-shell[data-active-nav-category="customer"] .sidebar-footer .trash-nav-button {
    min-height: 40px;
  }

  .app-shell[data-active-nav-category="customer"] .detail-center {
    grid-template-columns: minmax(0, 1fr);
    gap: 14px;
  }

  .app-shell[data-active-nav-category="customer"] .customer-header-card {
    display: grid;
    grid-template-columns: minmax(0, 1.55fr) minmax(250px, 0.9fr);
    grid-template-rows: auto auto;
    gap: 14px 18px;
    min-height: 0;
    padding: 18px 20px;
    border-width: 1px;
    border-radius: 12px;
  }

  .app-shell[data-active-nav-category="customer"] .customer-header-top {
    grid-column: 1;
    grid-row: 1;
    grid-template-columns: minmax(0, 1fr);
    padding: 0;
  }

  .app-shell[data-active-nav-category="customer"] .customer-header-avatar {
    display: none;
  }

  .app-shell[data-active-nav-category="customer"] .customer-header-name {
    font-size: 21px;
  }

  .app-shell[data-active-nav-category="customer"] .customer-header-card .customer-next-todo {
    grid-column: 2;
    grid-row: 1 / span 2;
    align-self: stretch;
    align-content: center;
    margin: 0;
    padding: 14px 15px;
    border-left-width: 1px;
    background: var(--color-surface);
  }

  .app-shell[data-active-nav-category="customer"] .customer-header-card .customer-next-todo .cnt-head {
    width: 100%;
  }

  .app-shell[data-active-nav-category="customer"] .customer-header-card .customer-next-todo .cnt-chips {
    display: grid;
    width: 100%;
  }

  .app-shell[data-active-nav-category="customer"] .customer-header-card .customer-next-todo .cnt-chip {
    width: 100%;
    min-height: 44px;
    align-items: center;
    border: 0;
    background: transparent;
    padding: 7px 0;
    font-size: 13px;
  }

  .app-shell[data-active-nav-category="customer"] .customer-header-card .customer-summary-body {
    grid-column: 1;
    grid-row: 2;
    margin-top: 0;
    padding-top: 12px;
    border-top: 1px solid var(--color-border-soft);
  }

  .app-shell[data-active-nav-category="customer"] .customer-card-info-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0;
  }

  .app-shell[data-active-nav-category="customer"] .customer-card-info-item {
    min-width: 0;
    padding: 0 9px;
    border-right: 1px solid var(--color-border-soft);
  }

  .app-shell[data-active-nav-category="customer"] .customer-card-info-item:first-child {
    padding-left: 0;
  }

  .app-shell[data-active-nav-category="customer"] .customer-card-info-item:last-child {
    padding-right: 0;
    border-right: 0;
  }

  .app-shell[data-active-nav-category="customer"] .customer-card-info-item strong {
    overflow: visible;
    font-size: 12px;
    text-overflow: clip;
    white-space: nowrap;
  }

  .app-shell[data-active-nav-category="customer"] .customer-card-info-item .info-label,
  .app-shell[data-active-nav-category="customer"] .customer-card-info-item small {
    font-size: 10px;
  }

  .app-shell[data-active-nav-category="customer"] .customer-record-tabs {
    position: sticky;
    top: 0;
    z-index: 4;
    margin: -2px 0 0;
    padding: 0 4px;
    border: 1px solid var(--color-border-soft);
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(80, 55, 35, 0.03);
  }

  .app-shell[data-active-nav-category="customer"] .customer-session-card-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
  }

  .app-shell[data-active-nav-category="customer"] .customer-session-card-grid > .panel,
  .app-shell[data-active-nav-category="customer"] .detail-card-grid > .panel {
    padding: 15px;
    border-radius: 11px;
  }

  .app-shell[data-active-nav-category="customer"] .customer-session-card-grid .panel-header h3,
  .app-shell[data-active-nav-category="customer"] .detail-card-grid .panel-header h3 {
    font-size: 15px;
  }

  .app-shell[data-active-nav-category="customer"] .post-session-memo-card .post-session-memo-box,
  .app-shell[data-active-nav-category="customer"] .session-note-card .form-grid.one-col {
    padding: 0;
    border: 0;
    background: transparent;
  }

  .app-shell[data-active-nav-category="customer"] .customer-session-card-grid textarea {
    min-height: 118px;
    border-radius: 9px;
    font-size: 12px;
  }

  .app-shell[data-active-nav-category="customer"] .post-session-memo-card .button-row {
    margin-top: 10px;
  }

  .app-shell[data-active-nav-category="customer"] .post-session-memo-card .button-row button,
  .app-shell[data-active-nav-category="customer"] .customer-next-plan-card > button {
    min-height: 40px;
    font-size: 12px;
  }

  .app-shell[data-active-nav-category="customer"] .previous-session-card textarea {
    height: var(--customer-session-shared-textarea-height, 118px);
    min-height: var(--customer-session-shared-textarea-height, 118px);
  }

  @media (min-width: 1280px) {
    .app-shell[data-active-nav-category="customer"] .customer-session-card-grid > .post-session-memo-card,
    .app-shell[data-active-nav-category="customer"] .customer-session-card-grid > .previous-session-card,
    .app-shell[data-active-nav-category="customer"] .customer-session-card-grid > .customer-next-plan-card {
      align-self: stretch;
      align-content: start;
      gap: 12px;
    }

    .app-shell[data-active-nav-category="customer"] .customer-session-card-grid > .post-session-memo-card,
    .app-shell[data-active-nav-category="customer"] .customer-session-card-grid > .previous-session-card {
      grid-template-rows: auto auto;
    }

    .app-shell[data-active-nav-category="customer"] .customer-session-card-grid > .customer-next-plan-card {
      grid-template-rows: auto auto auto;
    }

    .app-shell[data-active-nav-category="customer"] .customer-session-card-grid > .panel > .panel-header {
      min-height: 54px;
      align-items: flex-start;
      margin-bottom: 0;
    }

    .app-shell[data-active-nav-category="customer"] .post-session-memo-card .post-session-memo-box,
    .app-shell[data-active-nav-category="customer"] .previous-session-card .form-grid.one-col {
      align-self: start;
      align-content: start;
      gap: 12px;
    }

    .app-shell[data-active-nav-category="customer"] .post-session-memo-card .post-session-memo-box {
      grid-template-rows: auto auto;
    }

    .app-shell[data-active-nav-category="customer"] .previous-session-card .form-grid.one-col {
      grid-template-rows: auto auto auto;
    }

    .app-shell[data-active-nav-category="customer"] .post-session-memo-card textarea {
      height: clamp(220px, 21vw, 328px);
      min-height: clamp(220px, 21vw, 328px);
    }

    .app-shell[data-active-nav-category="customer"] .previous-session-card textarea,
    .app-shell[data-active-nav-category="customer"] .customer-next-plan-card textarea {
      height: var(--customer-session-shared-textarea-height, clamp(220px, 21vw, 328px));
      min-height: var(--customer-session-shared-textarea-height, clamp(220px, 21vw, 328px));
    }

    .app-shell[data-active-nav-category="customer"] .post-session-memo-card .button-row {
      margin-top: 0;
    }
  }

  .app-shell[data-active-nav-category="customer"] .customer-today-plan-panel {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(260px, 0.75fr);
    align-items: center;
    gap: 8px 20px;
    padding: 14px 18px;
  }

  .app-shell[data-active-nav-category="customer"] .customer-today-plan-panel .panel-header,
  .app-shell[data-active-nav-category="customer"] .customer-today-plan-panel .today-plan-lead {
    grid-column: 1;
  }

  .app-shell[data-active-nav-category="customer"] .customer-today-plan-panel .panel-header h3 {
    font-size: 16px;
  }

  .app-shell[data-active-nav-category="customer"] .customer-today-plan-panel .today-plan-lead {
    font-size: 11px;
  }

  .app-shell[data-active-nav-category="customer"] .customer-today-plan-panel .today-plan-actions {
    grid-column: 2;
    grid-row: 1 / span 2;
    width: 100%;
  }

  .app-shell[data-active-nav-category="customer"] .customer-today-plan-panel .today-plan-actions button {
    width: 100%;
    min-height: 48px;
  }

  .app-shell[data-active-nav-category="customer"] .detail-card-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }

  .app-shell[data-active-nav-category="customer"] .detail-card-grid > .wide {
    grid-column: 1 / -1;
  }

  .app-shell[data-active-nav-category="customer"] .detail-card-grid > .editable-profile-card,
  .app-shell[data-active-nav-category="customer"] .detail-card-grid > .customer-memo-card,
  .app-shell[data-active-nav-category="customer"] .detail-card-grid > .customer-history-panel {
    min-height: 220px;
  }

  .app-shell[data-active-nav-category="customer"] .profile-card-display,
  .app-shell[data-active-nav-category="customer"] .customer-memo-field textarea {
    min-height: 104px;
  }

  .app-shell[data-active-nav-category="customer"] .customer-history-panel .reservation-timeline {
    margin-top: 2px;
  }

  .app-shell[data-active-nav-category="customer"] .customer-history-panel .reservation-timeline-item {
    padding: 8px 0;
    border: 0;
    border-bottom: 1px solid var(--color-border-soft);
    border-radius: 0;
    background: transparent;
    font-size: 11px;
  }

  .app-shell[data-active-nav-category="customer"] .customer-history-panel .reservation-timeline-item:last-child {
    border-bottom: 0;
  }
}

@media (min-width: 1536px) {
  .app-shell[data-active-nav-category="customer"] .detail-card-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (min-width: 981px) and (max-width: 1279px) {
  .app-shell[data-active-nav-category="customer"] > .sidebar > .sidebar-body,
  .app-shell.sidebar-collapsed[data-active-nav-category="customer"] > .sidebar > .sidebar-body {
    --customer-list-header-space: 128px;
  }

  .app-shell[data-active-nav-category="customer"] .topbar,
  .app-shell[data-active-nav-category="customer"] .topbar.hide-context-title {
    min-height: 116px;
  }

  .app-shell[data-active-nav-category="customer"] .customer-page-toolbar {
    grid-template-columns: minmax(200px, 1fr) auto;
  }

  .app-shell[data-active-nav-category="customer"] .customer-page-search {
    grid-column: 1 / -1;
    grid-row: 2;
  }

  .app-shell[data-active-nav-category="customer"] .customer-page-toolbar-actions button {
    padding-inline: 9px;
  }

  .app-shell[data-active-nav-category="customer"] .customer-header-card {
    grid-template-columns: minmax(0, 1fr);
  }

  .app-shell[data-active-nav-category="customer"] .customer-header-card .customer-header-top,
  .app-shell[data-active-nav-category="customer"] .customer-header-card .customer-summary-body,
  .app-shell[data-active-nav-category="customer"] .customer-header-card .customer-next-todo {
    grid-column: 1;
    grid-row: auto;
  }

  .app-shell[data-active-nav-category="customer"] .customer-header-card .customer-next-todo {
    min-height: 0;
  }

  .app-shell[data-active-nav-category="customer"] .customer-card-info-item {
    padding-inline: 4px;
  }

  .app-shell[data-active-nav-category="customer"] .customer-card-info-item strong {
    font-size: 11px;
  }

  .app-shell[data-active-nav-category="customer"] .customer-session-card-grid,
  .app-shell[data-active-nav-category="customer"] .detail-card-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .app-shell[data-active-nav-category="customer"] .detail-card-grid > .wide {
    grid-column: 1;
  }

  .app-shell[data-active-nav-category="customer"] .customer-today-plan-panel {
    grid-template-columns: minmax(0, 1fr);
  }

  .app-shell[data-active-nav-category="customer"] .customer-today-plan-panel .today-plan-actions {
    grid-column: 1;
    grid-row: auto;
  }
}

@media (max-width: 980px) {
  .app-shell[data-active-nav-category="customer"] .customer-page-toolbar {
    display: flex !important;
    order: 2;
    align-items: center;
    margin-left: auto;
  }

  .app-shell[data-active-nav-category="customer"] .customer-page-heading {
    display: contents;
  }

  .app-shell[data-active-nav-category="customer"] .customer-page-heading h2,
  .app-shell[data-active-nav-category="customer"] .customer-page-heading p,
  .app-shell[data-active-nav-category="customer"] .customer-page-search,
  .app-shell[data-active-nav-category="customer"] .customer-page-toolbar-actions {
    display: none;
  }

  .app-shell[data-active-nav-category="customer"] .customer-page-title-line {
    display: contents;
  }

  .app-shell[data-active-nav-category="customer"] .topbar > div:first-of-type:not(.customer-page-toolbar) {
    order: 1;
  }

  .app-shell[data-active-nav-category="customer"] .top-actions {
    order: 3;
  }

  .customer-header-top {
    grid-template-columns: 50px minmax(0, 1fr);
    gap: 10px;
  }

  .customer-header-avatar {
    width: 50px;
    height: 50px;
  }

  .customer-header-avatar svg {
    width: 29px;
    height: 29px;
  }

  .customer-record-tabs {
    margin-inline: -2px;
  }

  .customer-record-tabs a {
    padding-inline: 14px;
  }

  .customer-session-card-grid,
  .detail-card-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .customer-session-card-grid > .panel,
  .detail-card-grid > .panel {
    min-width: 0;
  }
}

@media (max-width: 620px) {
  .customer-item {
    min-height: 90px;
    padding-right: 38px;
  }

  .customer-item-badges {
    gap: 4px;
  }

  .customer-level {
    font-size: 10px;
  }

  .customer-header-meta-row {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (max-width: 760px) {
  .customer-level {
    display: none;
  }

  .customer-header-top {
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
  }

  .customer-header-avatar {
    display: none;
  }

  .customer-header-id {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    grid-template-areas:
      "name visit-type actions"
      "account account account";
    align-items: center;
    column-gap: 8px;
    row-gap: 5px;
  }

  .customer-name-row,
  .customer-header-meta-row {
    display: contents;
  }

  .customer-header-name,
  .customer-header-name-input {
    grid-area: name;
  }

  .customer-header-meta-row .customer-header-tags {
    grid-area: visit-type;
    justify-self: start;
    margin: 0;
  }

  .name-edit-button,
  .name-edit-cancel-button {
    grid-area: actions;
  }

  .customer-header-account {
    grid-area: account;
  }

  .app-shell[data-active-nav-category="customer"] .customer-card-info-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: 12px;
    row-gap: 14px;
  }

  .app-shell[data-active-nav-category="customer"] .customer-card-info-item {
    min-width: 0;
  }

  .app-shell[data-active-nav-category="customer"][data-mobile-customer-screen="list"][data-has-customer-selection="true"] > .workspace {
    display: none;
  }

  .app-shell[data-active-nav-category="customer"][data-mobile-customer-screen="detail"] > .sidebar,
  .app-shell[data-active-nav-category="customer"][data-mobile-customer-screen="detail"] > .workspace > .topbar {
    display: none;
  }

  .app-shell[data-active-nav-category="customer"][data-mobile-customer-screen="detail"] > .workspace {
    padding-top: 12px;
  }

  .app-shell[data-active-nav-category="customer"][data-mobile-customer-screen="detail"] .mobile-customer-list-back {
    display: inline-flex;
    grid-column: 1 / -1;
    align-items: center;
    justify-self: start;
    min-height: 44px;
    padding: 8px 13px;
    border: 1px solid var(--color-border);
    border-radius: 12px;
    background: var(--color-surface);
    color: var(--color-text-primary);
    font: inherit;
    font-weight: 800;
    cursor: pointer;
  }

  .app-shell[data-active-nav-category="customer"][data-mobile-customer-screen="detail"] .mobile-customer-list-back:focus-visible {
    outline: 3px solid color-mix(in srgb, var(--color-accent) 35%, transparent);
    outline-offset: 2px;
  }

  .app-shell[data-active-nav-category="customer"] #detailView[data-mobile-customer-loading="true"] > :not(.mobile-customer-list-back):not(.mobile-customer-detail-loading) {
    display: none !important;
  }

  .app-shell[data-active-nav-category="customer"] #detailView[data-mobile-customer-loading="true"] .mobile-customer-detail-loading {
    display: grid;
    grid-column: 1 / -1;
    min-height: min(58dvh, 460px);
    place-content: center;
    justify-items: center;
    gap: 8px;
    padding: 32px 20px;
    border: 1px solid var(--color-border);
    border-radius: 18px;
    background: var(--color-surface);
    color: var(--color-text-secondary);
    text-align: center;
  }

  .app-shell[data-active-nav-category="customer"] #detailView[data-mobile-customer-loading="true"] .mobile-customer-detail-loading strong {
    color: var(--color-text-primary);
    font-size: 1.25rem;
  }
}

:root[data-theme="dark"] .customer-visit-type.is-new {
  border-color: rgba(125, 177, 205, 0.4);
  background: rgba(65, 119, 148, 0.2);
  color: #9bc9e1;
}

:root[data-theme="dark"] .customer-level {
  color: #efad73;
}

/* Mid-width keeps the mobile-friendly vertical sequence. */
@media (min-width: 761px) {
  .app-shell[data-active-nav-category="customer"] .customer-card-info-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: 16px;
    row-gap: 14px;
  }
}

@media (min-width: 761px) and (max-width: 980px) {
  .app-shell[data-active-nav-category="customer"] .body-map-inline .body-map-canvas {
    grid-template-columns: minmax(0, 1fr);
    width: min(100%, 520px);
    gap: 16px;
  }
}

/* PC places the smaller front and back figures side by side. */
@media (min-width: 981px) {
  .app-shell[data-active-nav-category="customer"] .body-map-inline .body-map-canvas {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: min(100%, 760px);
    gap: 16px;
  }

  .app-shell[data-active-nav-category="customer"] .body-map-inline .body-figure-card {
    min-width: 0;
  }
}

/* UI-002: enlarge mobile customer actions without scaling their visible icons. */
@media (max-width: 760px) {
  .customer-item-wrap .customer-item {
    padding-right: 52px;
  }

  .customer-item-wrap .customer-item-menu-button {
    top: 4px;
    right: 2px;
    width: 44px;
    min-width: 44px;
    height: 44px;
    min-height: 44px;
  }

  .name-edit-button,
  .name-edit-cancel-button,
  #reservationImageButton {
    min-height: 44px;
  }
}
