/* Local interaction refinements: detail spacing, recording drawer, and unread recording mark. */
body .phone :is(#create-visit, #create-todo) > .box {
  width: 100%;
  padding-top: 0;
  padding-right: 0;
  padding-left: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

body .phone :is(#create-visit, #create-todo) .create-visit-head-spacer {
  width: 40px;
  flex: 0 0 40px;
}

body .phone:has(#create-todo.active),
body .phone:has(#create-todo.active)::after,
body .phone .screen:has(#create-todo.active),
body .phone #create-todo,
body .phone #create-todo > .app-head {
  background: var(--colorNeutralBackground1, #fff) !important;
}

body .phone:has(#edit-todo.active),
body .phone:has(#edit-todo.active)::after,
body .phone .screen:has(#edit-todo.active),
body .phone #edit-todo,
body .phone #edit-todo > .app-head {
  background: var(--colorNeutralBackground1, #fff) !important;
}

body .phone #edit-todo > .box {
  padding-top: 0;
}

body .phone .audio-import-sheet {
  padding-top: 0;
}

body .phone .audio-import-backdrop {
  background: #17233366;
  backdrop-filter: none;
}

body .phone .audio-import-head {
  min-height: 64px;
  margin-bottom: 0;
  justify-content: center;
  text-align: center;
}

body .phone .audio-import-head > b {
  width: 100%;
}

body .phone .audio-import-close {
  display: none;
}

body .phone .audio-file-label {
  border-color: #b9d3f4;
  color: var(--system-blue);
}

body .phone:has(#visit-detail.active),
body .phone:has(#ended-visit-detail.active),
body .phone:has(#ended-visit-empty-detail.active),
body .phone:has(#edit-visit.active),
body .phone .screen:has(#visit-detail.active),
body .phone .screen:has(#ended-visit-detail.active),
body .phone .screen:has(#ended-visit-empty-detail.active),
body .phone .screen:has(#edit-visit.active) {
  background: #fff !important;
}

body .phone .screen:has(#visit-detail.active),
body .phone .screen:has(#ended-visit-detail.active),
body .phone .screen:has(#ended-visit-empty-detail.active),
body .phone .screen:has(#edit-visit.active) {
  padding-right: 24px;
  padding-left: 24px;
}

body .phone #visit-detail .visit-actions {
  margin-right: -24px;
  margin-left: -24px;
  padding-top: 14px;
  padding-right: 24px;
  padding-bottom: calc(14px + env(safe-area-inset-bottom));
  padding-left: 24px;
}

body .phone .record-new-mark {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-right: 7px;
  color: var(--color-brand-primary);
  font-size: 12px;
  font-weight: 650;
  vertical-align: 1px;
}

body .phone .record-new-mark::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: linear-gradient(135deg, #7d5cff, #22a7f0);
  box-shadow: 0 0 0 3px rgba(23, 105, 210, 0.08);
}

body .phone .recording-drawer-backdrop {
  position: absolute;
  inset: 0;
  z-index: 29;
  background: rgba(19, 33, 58, 0.3);
  transition: opacity 180ms ease;
}

body .phone > .cache-dialog-backdrop[data-end-recording-close] {
  z-index: 39;
}

body .phone > [data-end-recording-dialog] {
  z-index: 40;
}

body .phone.recording-drawer-collapsed .recording-drawer-backdrop {
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
}

body .phone.recording-drawer-suspended > #recording.recording-drawer-visible,
body .phone.recording-drawer-suspended > .recording-drawer-backdrop {
  display: none !important;
}

body .phone > #recording.recording-drawer-visible {
  position: absolute;
  inset: 30px 0 0;
  z-index: 30;
  display: block !important;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 0 24px calc(24px + env(safe-area-inset-bottom));
  border-radius: 24px 24px 0 0;
  background: #fff;
  box-shadow: 0 -10px 34px rgba(19, 33, 58, 0.18);
  transition: inset 220ms ease, height 220ms ease, border-radius 220ms ease;
}

body .phone > #recording.recording-drawer-visible > .recording-drawer-handle {
  display: block;
  width: 100%;
  height: 24px;
  padding: 0;
  border: 0;
  background: transparent;
  touch-action: none;
}

body .phone > #recording.recording-drawer-visible > .recording-drawer-handle::before {
  content: "";
  display: block;
  width: 36px;
  height: 4px;
  margin: 8px auto 0;
  border-radius: 999px;
  background: #c8cdd5;
}

body .phone > #recording.recording-drawer-visible > .app-head {
  margin-top: 0;
  border-bottom: 0;
  background: transparent !important;
  backdrop-filter: none;
}

body .phone > #recording.recording-drawer-visible > .app-head .back,
body .phone > #recording.recording-drawer-visible > .app-head > :last-child {
  visibility: hidden;
}

body .phone > #recording.recording-drawer-visible > .recording-mini {
  display: none;
}

body .phone.recording-drawer-active .record-fab {
  display: none !important;
}

body .phone .record-fab.is-capturing {
  display: none !important;
}

body .phone.recording-drawer-collapsed > #recording.recording-drawer-visible {
  top: auto;
  right: 12px;
  bottom: 12px;
  left: auto;
  width: min(300px, calc(100% - 24px));
  height: 68px;
  min-height: 68px;
  max-height: 68px;
  overflow: hidden;
  padding: 0;
  border: 1px solid #e3e7ed;
  border-radius: 20px;
  box-shadow: 0 10px 26px rgba(19, 33, 58, 0.16);
}

body .phone.recording-drawer-collapsed[data-record-underlay="workbench"] > #recording.recording-drawer-visible,
body .phone.recording-drawer-collapsed[data-record-underlay="mine"] > #recording.recording-drawer-visible {
  bottom: calc(82px + env(safe-area-inset-bottom));
}

body .phone.recording-drawer-collapsed.recording-underlay-has-bottom-action > #recording.recording-drawer-visible {
  bottom: calc(92px + env(safe-area-inset-bottom));
}

body .phone.recording-drawer-collapsed[data-record-underlay="workbench"] > .bottom,
body .phone.recording-drawer-collapsed[data-record-underlay="mine"] > .bottom {
  display: grid !important;
}

body .phone.recording-drawer-collapsed > #recording > :not(.recording-mini) {
  display: none !important;
}

body .phone.recording-drawer-collapsed > #recording.recording-drawer-visible > .recording-mini {
  display: flex;
  height: 100%;
  align-items: center;
  gap: 10px;
  padding: 8px 10px 8px 15px;
  touch-action: none;
}

.recording-mini-expand {
  display: flex;
  min-width: 0;
  flex: 1;
  align-items: center;
  gap: 10px;
  padding: 0;
  border: 0;
  background: transparent;
  color: #1c2533;
  text-align: left;
}

.recording-mini-wave {
  display: inline-flex;
  width: 24px;
  height: 24px;
  align-items: center;
  justify-content: center;
  color: var(--color-brand-primary);
  font-size: 18px;
  letter-spacing: -3px;
}

.recording-mini-copy {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 10px;
}

.recording-mini-title {
  order: 2;
  overflow: hidden;
  font-size: 14px;
  font-weight: 650;
  line-height: 19px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.recording-mini-time {
  order: 1;
  flex: 0 0 auto;
  color: #697586;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  line-height: 16px;
}

.recording-mini-pause {
  position: relative;
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: #eef4fc;
  color: #1c2533;
  font-size: 0;
  font-weight: 650;
  touch-action: none;
  -webkit-touch-callout: none;
}

@property --recording-hold-angle {
  syntax: "<angle>";
  inherits: false;
  initial-value: 0deg;
}

.recording-mini-pause::after {
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  background: conic-gradient(var(--color-danger-text) var(--recording-hold-angle), transparent 0);
  content: "";
  opacity: 0;
  pointer-events: none;
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 3px), #000 0);
  mask: radial-gradient(farthest-side, transparent calc(100% - 3px), #000 0);
}

.recording-mini-pause.is-holding::after {
  opacity: 1;
  animation: recording-mini-hold-progress 1.2s linear forwards;
}

@keyframes recording-mini-hold-progress {
  to { --recording-hold-angle: 360deg; }
}

.recording-mini-pause::before {
  content: "";
  width: 12px;
  height: 16px;
  display: block;
  margin: auto;
  background: linear-gradient(90deg,currentColor 0 4px,transparent 4px 8px,currentColor 8px 12px);
  border-radius: 1px;
}

body .phone.recording-drawer-collapsed.recording-drawer-paused .recording-mini-pause {
  background: #fff4e5;
  color: #9a5b12;
}

body .phone.recording-drawer-collapsed.recording-drawer-paused .recording-mini-pause::before {
  width: 18px;
  height: 18px;
  border: 0;
  border-radius: 0;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M7.4 6.2c0-1.35 1.55-2.1 2.62-1.28l8.2 6.28c.86.66.86 1.94 0 2.6l-8.2 6.28c-1.07.82-2.62.07-2.62-1.28V6.2Z' fill='black'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M7.4 6.2c0-1.35 1.55-2.1 2.62-1.28l8.2 6.28c.86.66.86 1.94 0 2.6l-8.2 6.28c-1.07.82-2.62.07-2.62-1.28V6.2Z' fill='black'/%3E%3C/svg%3E") center / contain no-repeat;
  transform: translateX(1px);
}

body .phone .recording-underlay {
  display: block !important;
}

@media (prefers-reduced-motion: reduce) {
  body .phone > #recording.recording-drawer-visible,
  body .phone .recording-drawer-backdrop { transition: none; }
}

/* Recording uses the same two-level sheet model as iOS Notes while keeping app-specific fields. */
body .phone > #recording.recording-drawer-visible {
  inset: 26px 0 0;
  padding: 0 24px calc(16px + env(safe-area-inset-bottom));
  border-radius: 26px 26px 0 0;
  background: var(--neutral-surface-raised);
}

body .phone > #recording.recording-drawer-visible > .app-head {
  position: relative;
  height: 50px;
  min-height: 50px;
  padding: 0;
}

body .phone > #recording.recording-drawer-visible > .app-head > .drawer-title {
  position: absolute;
  left: 50%;
  width: max-content;
  max-width: calc(100% - 96px);
  margin: 0;
  transform: translateX(-50%);
  text-align: center;
  font-size: 18px;
  line-height: 24px;
}

body .phone > #recording.recording-drawer-visible > .app-head > .recording-finish {
  visibility: visible;
  display: grid;
  width: 36px;
  height: 36px;
  min-height: 36px;
  padding: 0;
  place-items: center;
  border: 1px solid transparent;
  border-radius: 50%;
  background: var(--neutral-surface-subtle);
  color: var(--neutral-text-disabled);
  box-shadow: none;
  opacity: 1;
  transition: background-color .18s ease, border-color .18s ease, color .18s ease, box-shadow .18s ease, transform .18s ease;
}

body .phone > #recording.recording-drawer-visible > .app-head > .recording-finish svg {
  width: 21px;
  height: 21px;
}

body .phone > #recording.recording-drawer-visible > .app-head > .recording-finish .fluent-icon-label > span {
  display: none;
}

body .phone > #recording.recording-drawer-visible > .app-head > .recording-finish:disabled {
  border-color: var(--neutral-stroke-divider);
  background: var(--neutral-surface-subtle);
  color: var(--neutral-text-disabled);
}

body .phone > #recording.recording-drawer-visible > .app-head > .recording-finish:not(:disabled) {
  border-color: var(--color-brand-primary);
  background: var(--color-brand-primary);
  color: var(--color-on-brand, #fff);
  box-shadow: none;
}

body .phone > #recording.recording-drawer-visible > .app-head > .recording-finish:not(:disabled):is(:hover, :focus-visible) {
  border-color: var(--color-brand-hover);
  background: var(--color-brand-hover);
}

body .phone > #recording.recording-drawer-visible > .app-head > .recording-finish:not(:disabled):active {
  transform: scale(.94);
}

body .phone > #recording.recording-drawer-visible .recording-shell {
  position: relative;
  display: flex;
  flex-direction: column;
  margin: 0 -24px;
  padding: 2px 24px 20px;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  text-align: center;
}

body .phone > #recording.recording-drawer-visible .recording-kicker {
  order: 1;
  align-self: center;
  padding: 0;
  border-radius: 0;
  background: transparent;
  color: var(--color-recording);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0;
}

body .phone > #recording.recording-drawer-visible .recording-kicker::before {
  width: 7px;
  height: 7px;
  background: currentColor;
  box-shadow: none;
}

body .phone > #recording.recording-drawer-visible .recording-shell > .wave {
  order: 2;
  position: relative;
  box-sizing: border-box;
  width: 100%;
  height: 164px;
  margin: 14px 0 0;
  padding: 16px 18px;
  gap: 5px;
  overflow: hidden;
  border: 1px solid var(--neutral-stroke-divider);
  border-radius: 18px;
  background: var(--neutral-surface-subtle);
}

body .phone > #recording.recording-drawer-visible .recording-shell > .wave::before {
  content: "";
  position: absolute;
  top: 50%;
  right: 18px;
  left: 18px;
  height: 1px;
  background: color-mix(in srgb, var(--neutral-stroke-divider) 72%, transparent);
  transform: translateY(-50%);
}

body .phone > #recording.recording-drawer-visible .recording-shell > .wave::after {
  content: "";
  position: absolute;
  top: 16px;
  bottom: 16px;
  left: 50%;
  width: 2px;
  border-radius: 999px;
  background: var(--color-recording);
  transform: translateX(-50%);
}

body .phone > #recording.recording-drawer-visible .recording-shell > .wave i {
  position: relative;
  z-index: 1;
  width: 3px;
  max-height: 82%;
  border-radius: 999px;
  background: color-mix(in srgb, var(--color-recording) 72%, white);
}

body .phone > #recording.recording-drawer-visible .recording-time {
  order: 3;
  margin: 14px 0 0;
  color: var(--neutral-text-primary);
  font-size: 38px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  letter-spacing: .5px;
  line-height: 44px;
}

body .phone > #recording.recording-drawer-visible .recording-shell > .actions {
  order: 4;
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, .85fr);
  gap: 10px;
  width: 100%;
  margin: 18px auto 0;
}

body .phone > #recording.recording-drawer-visible .recording-shell > .actions > button {
  width: 100%;
  height: 48px !important;
  min-height: 48px !important;
  border-radius: 24px;
  font-size: 15px !important;
  font-weight: 600;
  justify-content: center;
}

body .phone > #recording.recording-drawer-visible [data-record-pause] {
  border: 1px solid var(--color-brand-primary);
  background: var(--color-brand-primary);
  color: #fff;
}

body .phone > #recording.recording-drawer-visible [data-record-pause]:not(:disabled):is(:hover, :active, :focus-visible) {
  border-color: var(--color-brand-hover);
  background: var(--color-brand-hover) !important;
  color: #fff !important;
}

body .phone > #recording.recording-drawer-visible [data-end-recording] {
  border: 1px solid var(--neutral-stroke-control);
  background: #fff;
  color: var(--neutral-text-primary);
}

body .phone > #recording.recording-drawer-visible [data-end-recording]:not(:disabled):is(:hover, :active, :focus-visible) {
  background: var(--neutral-surface-subtle);
}

body .phone > #recording.recording-drawer-visible .recording-shell.is-paused .recording-kicker {
  background: transparent;
  color: var(--neutral-text-tertiary);
}

body .phone > #recording.recording-drawer-visible .recording-shell.is-paused .wave i {
  background: var(--neutral-stroke-strong);
  opacity: .55;
}

body .phone > #recording.recording-drawer-visible .recording-meta {
  display: block;
  margin: 0 -24px;
  padding: 0 24px;
  border: 0;
  border-top: 1px solid var(--neutral-stroke-divider);
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

body .phone > #recording.recording-drawer-visible .recording-meta > .form-row {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  align-items: center;
  min-height: 54px;
  margin: 0;
  padding: 8px 0;
  border-bottom: 1px solid var(--neutral-stroke-divider);
}

body .phone > #recording.recording-drawer-visible .recording-meta > .form-row > label {
  margin: 0;
  color: var(--neutral-text-tertiary);
  font-size: 12px;
  font-weight: 400;
}

body .phone > #recording.recording-drawer-visible .recording-meta .recording-location-value,
body .phone > #recording.recording-drawer-visible .recording-meta :is(.select, .field-select, .unified-select-trigger) {
  width: 100%;
  min-height: 36px;
  height: auto;
  margin: 0;
  padding: 6px 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  color: var(--neutral-text-primary);
  font-size: 13px;
  line-height: 22px;
}

body .phone > #recording.recording-drawer-visible .recording-meta .recording-location-value {
  display: block;
  overflow: visible;
  text-overflow: clip;
  white-space: normal;
}

body .phone.recording-drawer-collapsed > #recording.recording-drawer-visible {
  right: 12px;
  bottom: 12px;
  width: min(330px, calc(100% - 24px));
  height: 76px;
  min-height: 76px;
  max-height: 76px;
  border-color: var(--neutral-stroke-control);
  border-radius: 22px;
  background: var(--neutral-surface-raised);
  box-shadow: 0 10px 26px rgb(19 33 58 / 16%);
}

body .phone.recording-drawer-collapsed > #recording.recording-drawer-visible > .recording-mini {
  gap: 10px;
  padding: 9px 10px 9px 14px;
}

body .phone .recording-mini-wave {
  color: var(--color-recording);
}

body .phone .recording-mini-copy {
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
}

body .phone .recording-mini-title {
  order: 1;
  color: var(--neutral-text-primary);
  font-size: 13px;
  line-height: 18px;
}

body .phone .recording-mini-meta {
  order: 2;
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  font-size: 11px;
  line-height: 16px;
}

body .phone .recording-mini-time {
  order: initial;
  color: var(--neutral-text-secondary);
  font-size: 11px;
}

body .phone .recording-mini-state {
  color: var(--color-recording);
  white-space: nowrap;
}

body .phone .recording-mini-state::before {
  content: "·";
  margin-right: 7px;
  color: var(--neutral-text-tertiary);
}

body .phone.recording-drawer-collapsed .recording-mini-pause {
  background: var(--color-recording-surface);
  color: var(--color-recording);
}

body .phone.recording-drawer-collapsed.recording-drawer-paused .recording-mini-wave,
body .phone.recording-drawer-collapsed.recording-drawer-paused .recording-mini-state {
  color: var(--neutral-text-tertiary);
}

body .phone.recording-drawer-collapsed.recording-drawer-paused .recording-mini-pause {
  background: var(--color-brand-subtle);
  color: var(--color-brand-primary);
}

body .phone .record-fab.is-capturing,
body .phone .record-fab.is-capturing:not(:disabled):hover,
body .phone .record-fab.is-capturing:not(:disabled):active {
  background: var(--color-recording) !important;
}

body .phone #workbench-visits .visit-recording-status {
  color: var(--color-recording) !important;
}

/* Keep every link-style text action on the same interaction language. */
body .phone :is(.link,.visit-edit-link,.navigation-link,.note-toggle) {
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  transition: color .15s ease, opacity .15s ease;
}

@media (hover:hover) and (pointer:fine) {
  body .phone :is(.link,.visit-edit-link,.navigation-link,.note-toggle):not(:disabled):hover {
    background: transparent !important;
    color: var(--system-blue) !important;
    opacity: .76;
  }
}

body .phone :is(.link,.visit-edit-link,.navigation-link,.note-toggle):not(:disabled):active {
  background: transparent !important;
  color: var(--system-blue) !important;
  opacity: .58;
  transform: none !important;
}

body .phone :is(.link,.visit-edit-link,.navigation-link,.note-toggle):focus-visible {
  outline: 2px solid var(--system-blue) !important;
  outline-offset: 2px;
}

/* Icon-only controls keep a neutral, transparent pressed surface app-wide. */
body .phone :is(
  .back,
  .share-icon,
  .square,
  .ai-menu-trigger,
  .notes-header-action,
  .arrow,
  .navigation-link,
  .drawer-close,
  .audio-import-close,
  .cache-dialog-close,
  .share-dialog-close,
  .attendee-picker-close,
  .ai-drawer-close,
  .attachment-remove
) {
  -webkit-tap-highlight-color: transparent;
}

body .phone :is(
  .back,
  .share-icon,
  .square,
  .ai-menu-trigger,
  .notes-header-action,
  .arrow,
  .navigation-link,
  .drawer-close,
  .audio-import-close,
  .cache-dialog-close,
  .share-dialog-close,
  .attendee-picker-close,
  .ai-drawer-close,
  .attachment-remove
):not(:disabled):active {
  background: transparent !important;
  box-shadow: none !important;
  opacity: .58;
}

/* Completing a task keeps the row surface while clearly marking the finished copy. */
body .phone .checkrow.todo-completed {
  color: inherit;
}

body .phone .checkrow.todo-completed .row-title {
  color: var(--neutral-text-tertiary, #7b8492) !important;
  text-decoration: line-through !important;
}

body .phone :is(
  #todo,
  #visit-detail,
  #visit-record-detail,
  #ended-visit-detail,
  #ended-visit-empty-detail,
  #organize-action,
  #organize-generated
) .checkrow.todo-completed {
  background: transparent !important;
}

body .phone #workbench-todo > .checkrow.todo-completed {
  background: var(--wb-card-bg, #fff) !important;
}

/* Recording organization steps: keep each number and label on one horizontal line. */
body .phone :is(#organize-link, #organize-speaker, #organize-summary, #organize-edit) > .steps > .step {
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 5px;
  line-height: 20px;
  text-align: left;
}

body .phone :is(#organize-link, #organize-speaker, #organize-summary, #organize-edit) > .steps > .step::after {
  content: "›";
  top: 50%;
  right: -3px;
  left: auto;
  width: auto;
  height: auto;
  transform: translateY(-50%);
  background: transparent !important;
  color: #b3bfcc;
  font-size: 17px;
  line-height: 1;
}

body .phone :is(#organize-link, #organize-speaker, #organize-summary, #organize-edit) > .steps > .step.is-complete::after {
  background: transparent !important;
  color: #7ca8d6;
}

/* Keep page chrome compact and consistent across every secondary view. */
body .phone .app-head h1,
body .phone .ai-page-header h1 {
  font-size: 18px !important;
  line-height: 24px !important;
}

body .phone .app-head > button:last-child:not(.back),
body .phone .app-head .head-actions button,
body .phone .app-head > .notes-header-action {
  font-size: 15px !important;
}

/* Form pages use the screen itself as the container; fields retain their own boundaries. */
body .phone :is(
  #create-visit,
  #create-todo,
  #create-opportunity,
  #edit-todo,
  #edit-visit,
  #prompt-template-edit,
  #organize-edit
) > .box {
  width: 100%;
  margin-right: 0;
  margin-left: 0;
  padding-right: 0;
  padding-left: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

body .phone :is(
  #create-visit,
  #create-todo,
  #create-opportunity,
  #edit-todo,
  #edit-visit,
  #prompt-template-edit,
  #organize-edit
) > .box > .form-row {
  width: 100%;
}

/* Match the login form's compact field-to-primary-action rhythm. */
body .phone #create-opportunity > .box {
  padding-top: 0;
  padding-bottom: 0;
}

body .phone #create-opportunity > .primary:last-child {
  position: static;
  margin-top: 8px;
  box-shadow: none;
}

body .phone #create-opportunity > .box > .new-customer-fields:not([hidden]) > .form-row:last-child {
  margin-bottom: 14px;
}

body .phone:has(#create-opportunity.active),
body .phone:has(#create-opportunity.active)::after,
body .phone .screen:has(#create-opportunity.active),
body .phone #create-opportunity,
body .phone #create-opportunity > .app-head {
  background: #fff !important;
}

/* Recording metadata follows the same flat field system as every create/edit form. */
body .phone #recording .recording-meta {
  display: block;
  margin-top: 20px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

body .phone #recording .recording-meta > .form-row {
  width: 100%;
  margin: 14px 0;
}

body .phone #recording .recording-meta > .form-row:first-child {
  margin-top: 0;
}

body .phone #recording .recording-meta > .form-row:last-child {
  margin-bottom: 0;
}

body .phone #recording .recording-meta .recording-location-value {
  display: flex;
  align-items: center;
  width: 100%;
  height: 36px;
  min-height: 36px;
  padding: 5px 12px;
  overflow: hidden;
  border: 1px solid var(--l);
  border-radius: var(--form-control-radius);
  background: var(--colorNeutralBackground1);
  color: var(--b);
  font-size: 13px;
  font-weight: 400;
  line-height: 20px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body .phone #recording .recording-meta :is(.select, .field-select, .unified-select-trigger) {
  width: 100%;
  margin: 0;
}

/* Keep a consistent, readable gap between every editable form Key and Value. */
body .phone .form-row > label,
body .phone .notes-editing .notes-edit-target > b,
body .phone #ended-visit-detail.notes-editing .kv:not(.notes-edit-readonly) > b {
  margin-bottom: 10px;
}

/* Keep the detail title and its tabs in one stable navigation area. */
body .phone :is(#visit-detail, #ended-visit-detail, #ended-visit-empty-detail) > .app-head {
  position: sticky;
  top: 0;
  z-index: 6;
  margin-bottom: 0;
  background: #fff;
}

body .phone :is(#visit-detail, #ended-visit-detail, #ended-visit-empty-detail) > .visit-detail-nav {
  top: var(--app-header-height, 56px);
  z-index: 7;
}

body .phone :is(#visit-detail, #ended-visit-detail, #ended-visit-empty-detail) > .section-title.visit-group-title {
  scroll-margin-top: 128px;
}

body .phone #todo-record-detail .record-edit-button.notes-header-action {
  width: 40px;
  height: 36px;
  min-height: 36px;
  color: #202938;
}

body .phone .app-head > .notes-header-action {
  flex: 0 0 40px;
  width: 40px;
  height: 36px;
  min-height: 36px;
}

/* Separate the recording source from its transcript with one clear section break. */
body .phone #organize-speaker > .record-audio-player {
  padding-bottom: 14px;
  border-bottom: 0;
}

body .phone #organize-speaker > .section-title.record-detail-group-title.organize-transcript-heading {
  min-height: 46px;
  margin: 0 -18px 2px !important;
  padding: 16px 20px 0;
  border-top: 8px solid var(--neutral-surface-subtle);
}

body .phone #organize-speaker > .speaker-recognition-hint {
  margin: 0 !important;
  padding: 4px 2px 8px !important;
  border: 0 !important;
  background: transparent !important;
  color: var(--notes-label) !important;
}

body .phone #organize-speaker > .organize-transcript-preview .transcript-turn {
  padding-top: 7px;
  padding-bottom: 8px;
  border-bottom: 0;
}

body .phone #organize-speaker > .organize-transcript-preview .transcript-turn + .transcript-turn {
  padding-top: 9px;
}

body .phone #organize-speaker > .organize-transcript-preview .transcript-turn::before {
  top: 13px;
}

body .phone #organize-speaker > .organize-transcript-preview .transcript-turn.playing {
  padding-right: 8px;
  padding-left: 42px;
}

body .phone #organize-speaker > .organize-transcript-preview .transcript-turn.playing::before {
  left: 8px;
}

body .phone .speaker-picker-head {
  min-height: 46px;
  justify-content: center;
  text-align: center;
}

body .phone .speaker-picker-head > b {
  width: 100%;
  font-size: 17px;
  line-height: 24px;
}

body .phone .speaker-picker-close {
  display: none;
}

/* Let the transcript share the page scroll so the audio summary can leave the viewport. */
body .phone #organize-speaker > .organize-transcript-preview {
  max-height: none;
  overflow: visible;
}

/* Keep the speaker-step action available while the transcript scrolls. */
body .phone > :is(.organize-speaker-footer, .organize-edit-footer, .edit-visit-footer) {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 7;
  display: none;
  padding: 12px 18px calc(14px + env(safe-area-inset-bottom));
  background: #fff;
  box-shadow: 0 -8px 20px rgba(20, 32, 48, .08);
}

body .phone:has(#organize-speaker.active) > .organize-speaker-footer {
  display: block;
}

body .phone:has(#organize-edit.active) > .organize-edit-footer {
  display: block;
}

body .phone:has(#edit-visit.active) > .edit-visit-footer {
  display: block;
}

body .phone > .organize-edit-footer > [hidden] {
  display: none !important;
}

body .phone .screen:has(#organize-speaker.active),
body .phone .screen:has(#organize-edit.active),
body .phone .screen:has(#edit-visit.active) {
  padding-bottom: calc(88px + env(safe-area-inset-bottom));
}

body .phone #organize-edit > .summary-template-row {
  grid-template-columns: minmax(0, 1fr) 104px;
}

/* Keep the template subordinate to note content and reveal it only for generation. */
body .phone #organize-edit > .note-content-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

body .phone #organize-edit .note-regenerate-toggle {
  flex: 0 0 auto;
  min-height: 32px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--b);
  font-size: 14px;
  font-weight: 500;
}

body .phone #organize-edit > .summary-template-panel {
  margin-top: -2px;
  padding-top: 0;
  border-bottom: 0;
}

/* Use the shared form surface for the summary template selector. */
body .phone #organize-edit > .summary-template-row :is(.field-select, .select, .unified-select-trigger) {
  border: 1px solid var(--form-control-border, var(--l));
  border-radius: var(--form-control-radius, 8px);
  background: var(--colorNeutralBackground1, #fff);
  box-shadow: none;
}

body .phone #organize-edit .note-regenerate-toggle[hidden],
body .phone #organize-edit > .summary-template-panel[hidden] {
  display: none !important;
}

/* Use one color per filter state for the icon, label, and chevron. */
body .phone #workbench .visit-filter-select {
  color: var(--study-secondary, #718096) !important;
}

body .phone #workbench .visit-filter-select.is-filtered,
body .phone #workbench .visit-filter-select[aria-expanded="true"] {
  color: var(--system-blue) !important;
}

body .phone #workbench .visit-filter-select :is(svg, span) {
  color: inherit !important;
}

/* Keep text-only actions at one readable size across the app. */
body .phone {
  --text-action-size: 14px;
}

body .phone .view:is(#workbench, [id]) :is(
  button.link,
  label.link,
  a.link,
  .visit-edit-link,
  .navigation-link,
  .note-toggle,
  .record-flow-action,
  .attendee-add-toggle,
  .attachment-trigger,
  [data-new-opportunity],
  [data-todo-new-opportunity]
) {
  font-size: var(--text-action-size) !important;
}

/* The note preview owns its vertical rhythm, independent of generated text length. */
body .phone #ended-visit-detail .ended-note > .record-note-text {
  padding-top: 4px;
  padding-bottom: 12px;
}

/* Audio titles use the same compact metadata scale in every shared player. */
body .phone .record-audio-player .record-audio-title {
  font-size: 13px !important;
  line-height: 20px !important;
}

/* The full pending-recordings list uses the app's plain white page surface. */
body .phone:has(:is(#record-list, #pending-recordings-page).active),
body .phone:has(:is(#record-list, #pending-recordings-page).active)::after,
body .phone .screen:has(:is(#record-list, #pending-recordings-page).active),
body .phone #record-list,
body .phone #record-list > .app-head,
body .phone #pending-recordings-page,
body .phone #pending-recordings-page > .app-head {
  background: #fff !important;
}

/* Give each recording a stable title, facts, location, and opportunity hierarchy. */
body .phone #record-list > .record-list-card {
  margin-top: 4px;
  border: 0;
  border-radius: 0 !important;
  background: transparent;
  box-shadow: none;
}

body .phone #record-list .record-list-card .record-flow-card {
  gap: 0;
  width: 100%;
  padding: 16px 16px 15px !important;
}

body .phone #record-list .record-flow-title {
  display: flex;
  align-items: center;
  gap: 0;
  min-width: 0;
  overflow: visible;
  color: var(--b);
  font-size: 15px;
  font-weight: 600;
  line-height: 22px;
}

body .phone #record-list .record-new-mark {
  flex: 0 0 auto;
  margin-right: 0;
  margin-left: 4px;
  font-size: 10px !important;
}

body .phone #record-list .record-flow-name {
  min-width: 0;
  display: -webkit-box;
  overflow: hidden;
  white-space: normal;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

body .phone #record-list .record-flow-source {
  flex: 0 0 auto;
  margin-left: 8px;
  padding: 2px 6px;
  border-radius: 999px;
  background: #f1f3f6;
  color: #687386;
  font-size: 11px;
  font-weight: 500;
  line-height: 16px;
}

body .phone #record-list .record-flow-facts {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
  margin-top: 7px;
  color: #687386;
  font-size: 12px;
  line-height: 18px;
}

body .phone #record-list :is(.record-flow-location, .record-flow-opportunity) {
  display: flex !important;
  align-items: flex-start;
  gap: 5px;
  margin-top: 4px;
  color: #687386;
  font-size: 12px;
  line-height: 18px;
}

body .phone #record-list .record-flow-location {
  overflow: hidden;
  white-space: normal;
}

body .phone #record-list .record-flow-opportunity {
  color: #525f73;
}

body .phone #record-list .record-flow-action {
  margin-top: 8px;
}

body .phone #record-list .record-flow-fact {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

body .phone #record-list :is(.record-flow-fact, .record-flow-location, .record-flow-opportunity) > .fluent-icon,
body .phone #pending-recordings-page :is(.pending-record-facts, .pending-record-location, .record-visit) .fluent-icon {
  flex: 0 0 auto;
  width: 14px;
  height: 14px;
  margin-top: 2px;
  color: #7b8492;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Keep the current pending-recordings page on the same readable hierarchy. */
body .phone #pending-recordings-page > .pending-records-list {
  padding: 0 0 24px;
}

body .phone #pending-recordings-page > .app-head {
  margin-bottom: 0;
}

body .phone #pending-recordings-page .pending-record {
  min-height: 0;
  grid-template-columns: minmax(0, 1fr) 18px;
  align-items: start;
  gap: 12px;
  margin: 0 !important;
  box-sizing: border-box;
  width: 100%;
  padding: 18px 22px !important;
  border: 0 !important;
  border-bottom: 1px solid #eef0f2 !important;
  border-radius: 0 !important;
  background: #fff !important;
}

body .phone #pending-recordings-page .record-leading-icon {
  display: none;
}

body .phone #pending-recordings-page .record-card-copy {
  min-width: 0;
}

body .phone #pending-recordings-page .record-title {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 0;
  min-width: 0;
  color: var(--b);
  font-size: 15px;
  font-weight: 600;
  line-height: 22px;
}

body .phone #pending-recordings-page .pending-record-name {
  order: 1;
  flex: 0 1 auto;
  min-width: 0;
  display: -webkit-box;
  overflow: hidden;
  white-space: normal;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

body .phone #pending-recordings-page .record-new-mark {
  order: 2;
  margin-right: 0;
  margin-left: 4px;
}

body .phone #pending-recordings-page .pending-record-source {
  order: 3;
  flex: 0 0 auto;
  margin-left: 8px;
  height: var(--tag-status-height);
  min-height: var(--tag-status-height);
  padding: var(--tag-status-padding);
  border-radius: var(--tag-radius-pill);
  background: var(--tag-neutral-surface);
  color: var(--tag-neutral-text);
  font-size: var(--tag-status-font-size);
  font-weight: var(--tag-font-weight);
  line-height: var(--tag-status-height);
}

body .phone #pending-recordings-page .pending-record-facts {
  display: flex !important;
  flex-wrap: wrap;
  gap: 4px 12px;
  margin-top: 10px;
  color: #687386;
  font-size: 12px;
  line-height: 18px;
}

body .phone #pending-recordings-page .pending-record-facts > span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

body .phone #pending-recordings-page :is(.pending-record-location, .record-visit) {
  display: flex !important;
  align-items: flex-start;
  gap: 5px;
  margin-top: 6px;
  overflow: hidden;
  color: #687386 !important;
  font-size: 12px;
  font-weight: 400;
  line-height: 18px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body .phone #pending-recordings-page .record-visit {
  color: #525f73 !important;
}

body .phone #pending-recordings-page .record-card-tail {
  align-self: stretch;
}

/* The workbench preview stays compact; full metadata belongs to the list page. */
body .phone #workbench-recordings .pending-record {
  grid-template-columns: 40px minmax(0, 1fr) 18px;
  gap: 12px;
  min-height: 0;
  padding: 11px 0 !important;
}

body .phone #workbench-recordings :is(
  .record-new-mark,
  .pending-record-source,
  .pending-record-facts,
  .pending-record-location,
  .visit-status-inline
) {
  display: none !important;
}

body .phone #workbench-recordings .record-title {
  display: block;
  overflow: hidden;
  font-size: 14px;
  font-weight: 600;
  line-height: 20px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body .phone #workbench-recordings .record-visit {
  display: block !important;
  margin-top: 3px;
  overflow: hidden;
  color: #687386 !important;
  font-size: 12px;
  font-weight: 400;
  line-height: 18px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body .phone #workbench-recordings .record-visit .fluent-icon {
  display: none;
}

/* Ongoing visits use the same semantic success tag in list and detail views. */
body .phone #visit-detail[data-notes-state="ongoing"] .visit-status-inline {
  background: var(--color-success-surface) !important;
  color: var(--color-success-text) !important;
}

/* Match every detail-page edit action to its established back icon color. */
body .phone .view > .app-head:has(.notes-header-action) {
  --detail-header-icon-color: #52525b;
}

body .phone .view > .app-head:has(.notes-header-action) > :is(.back, .notes-header-action) {
  color: var(--detail-header-icon-color) !important;
}

/* The prototype edit form derives the visit name from the linked opportunity. */
body .phone #edit-visit .form-row:has([data-edit-title]) {
  display: none !important;
}

/* Edit visit reuses the create-visit form rhythm without changing its fields. */
body .phone .screen:has(#edit-visit.active) {
  padding-right: 16px;
  padding-left: 16px;
}

body .phone #edit-visit > .box {
  margin-top: 0;
  padding: 0;
}

body .phone #edit-visit > .box:last-of-type {
  padding-bottom: 16px;
}

body .phone #edit-visit .form-row {
  width: 100%;
  margin: 14px 0;
  padding: 0;
  border: 0;
}

body .phone #edit-visit .form-row:has([data-edit-title]) + .form-row {
  margin-top: 0;
}

body .phone #edit-visit > .box:last-of-type > .form-row:first-child {
  margin-top: 14px;
}

body .phone #edit-visit > .box:last-of-type > .form-row:last-child {
  margin-bottom: 0;
}

body .phone #edit-visit .form-row > label {
  margin-bottom: 10px;
  color: #7b8492;
  font-size: 13px;
  font-weight: 500;
  line-height: 19.5px;
}

body .phone #edit-visit :is(.field-input, .field-select, .unified-select-trigger) {
  min-height: 36px;
  height: 36px;
  padding: 5px 12px;
  border: 1px solid #dce2e9;
  border-radius: 8px;
  background: #fff;
  color: #202936;
  font-size: 13px;
  font-weight: 400;
  line-height: 19.5px;
}

body .phone #edit-visit :is([data-edit-opportunity-search], [data-edit-location-search]) {
  padding-right: 40px;
}

body .phone #edit-visit textarea.field-input {
  min-height: 96px;
  height: 96px;
  padding: 10px 12px;
  line-height: 23.4px;
}

body .phone #edit-visit > .primary:last-child {
  margin-top: 16px;
}

/* Keep the editable visit purpose in the same vertical form rhythm as other fields. */
body .phone #ended-visit-detail.notes-editing .visit-opportunity-details .kv:not(.notes-edit-readonly) {
  display: flex !important;
  flex-direction: column;
  gap: 10px;
  padding: 10px 2px;
}

body .phone #ended-visit-detail.notes-editing .visit-opportunity-details .kv:not(.notes-edit-readonly) > b {
  display: block;
  margin: 0 !important;
  padding: 0;
}

body .phone #ended-visit-detail.notes-editing [data-ended-purpose][contenteditable="true"] {
  display: block;
  width: 100%;
  min-height: 66px;
  margin: 0 !important;
}

/* Keep all empty and unfilled states on the same secondary text token. */
body .phone {
  --empty-state-text-color: #7b8492;
}

body .phone :is(.ended-empty-inline, .visit-empty-state, .visit-empty-value, .ai-history-empty),
body .phone :is(.ended-empty-inline, .visit-empty-state, .visit-empty-value, .ai-history-empty) .muted,
body .phone .empty-data-text {
  color: var(--empty-state-text-color) !important;
}

body .phone :is(#workbench, #record-list, #pending-recordings-page) .empty-data-text {
  color: var(--empty-state-text-color) !important;
}

body .phone :is(#workbench, #record-list, #pending-recordings-page) .record-visit.empty-data-text {
  color: var(--empty-state-text-color) !important;
}
