.popover {
  position: fixed;
  z-index: 40;
  min-width: 240px;
  max-width: calc(100vw - 32px);
  max-height: calc(100vh - 32px);
  overflow-y: auto;
  padding: 8px;
  border-radius: var(--radius-lg);
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  animation: pop-in var(--duration) var(--ease);
}

.popover__title {
  padding: 10px 12px 8px;
  font-size: var(--fs-sm);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.popover__divider {
  height: 1px;
  margin: 6px 10px;
  background: var(--border);
}

.menu-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 38px;
  padding: 6px 10px;
  border-radius: var(--radius-md);
  text-align: left;
  font-size: var(--fs-base);
  font-weight: 500;
  transition: background var(--duration) var(--ease);
}

.menu-item:hover,
.menu-item.is-highlighted {
  background: var(--surface-soft);
}

.menu-item[aria-checked="true"] {
  background: var(--surface-active);
}

.menu-item:disabled {
  opacity: 0.45;
}

.menu-item:disabled:hover {
  background: transparent;
}

.menu-item--danger {
  color: var(--red-500);
}

.menu-item__body {
  display: grid;
  flex: 1;
  min-width: 0;
}

.menu-item__hint {
  font-size: var(--fs-sm);
  font-weight: 400;
  color: var(--text-muted);
}

.menu-item__check {
  color: var(--text);
}

.status-dot {
  width: 10px;
  height: 10px;
  flex-shrink: 0;
  border-radius: 50%;
}

.status-dot--baru {
  background: var(--blue-500);
}
.status-dot--follow_up {
  background: var(--orange-500);
}
.status-dot--menunggu_pembayaran {
  background: #8a55c9;
}
.status-dot--closing {
  background: var(--gold-500);
}
.status-dot--selesai {
  background: var(--green-500);
}
.status-dot--on_progress {
  background: var(--blue-500);
}
.status-dot--unsolved {
  background: var(--orange-500);
}
.status-dot--solved {
  background: var(--green-500);
}
.status-dot--tidak_deal {
  background: var(--red-500);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgb(23 19 15 / 45%);
  animation: fade-in var(--duration) var(--ease);
}

.modal {
  display: flex;
  flex-direction: column;
  width: min(520px, 100%);
  max-height: calc(100vh - 48px);
  border-radius: var(--radius-xl);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  animation: pop-in 200ms var(--ease);
}

.modal--wide {
  width: min(720px, 100%);
}

.modal__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 22px 24px 14px;
}

.modal__title {
  font-size: var(--fs-lg);
  font-weight: 700;
}

.modal__subtitle {
  margin-top: 4px;
  color: var(--text-muted);
}

.modal__body {
  display: grid;
  gap: 18px;
  padding: 6px 24px 20px;
  overflow-y: auto;
}

.modal__footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 24px;
  border-top: 1px solid var(--border);
}

.toast-region {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 60;
  display: grid;
  gap: 8px;
  transform: translateX(-50%);
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 18px;
  border-radius: var(--radius-md);
  color: #fff;
  background: var(--ink-900);
  box-shadow: var(--shadow-lg);
  font-weight: 500;
  animation: toast-in 220ms var(--ease);
}

.toast .icon {
  color: var(--gold-400);
}

.toast.is-leaving {
  opacity: 0;
  transform: translateY(8px);
  transition:
    opacity 200ms var(--ease),
    transform 200ms var(--ease);
}

@keyframes pop-in {
  from {
    opacity: 0;
    transform: translateY(-4px) scale(0.98);
  }
}

@keyframes fade-in {
  from {
    opacity: 0;
  }
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .popover,
  .modal,
  .modal-backdrop,
  .toast {
    animation: none;
  }
}

.popover--wide {
  width: 380px;
}

.popover__text {
  padding: 0 12px 10px;
  color: var(--text-secondary);
}

.menu-item--featured {
  margin-bottom: 4px;
  color: var(--gold-700);
  background: var(--surface-active);
  border: 1px solid #ecdcbc;
}

.menu-item--featured .menu-item__hint {
  color: var(--gold-700);
}

.capacity {
  width: 72px;
  height: 5px;
  flex-shrink: 0;
  overflow: hidden;
  border: 0;
  border-radius: var(--radius-full);
  background: var(--surface-pill);
  appearance: none;
}

.capacity::-webkit-progress-bar {
  background: var(--surface-pill);
}

.capacity::-webkit-progress-value {
  border-radius: var(--radius-full);
  background: var(--gold-500);
}

.capacity::-moz-progress-bar {
  border-radius: var(--radius-full);
  background: var(--gold-500);
}

.notice {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  font-size: var(--fs-md);
  color: var(--text-secondary);
  background: var(--surface-soft);
  border: 1px solid var(--border);
}

.notice .icon {
  margin-top: 1px;
  color: var(--gold-700);
}

.notice--warning {
  color: var(--orange-600);
  background: var(--orange-100);
  border-color: #f5dcae;
}

.notice--warning .icon {
  color: var(--orange-600);
}

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

.option-list--grid {
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
}

.option {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  cursor: pointer;
  transition:
    border-color var(--duration) var(--ease),
    background var(--duration) var(--ease);
}

.option:hover {
  background: var(--surface-soft);
}

.option:has(input:checked) {
  background: var(--surface-active);
  border-color: var(--gold-500);
}

.option input {
  flex-shrink: 0;
  accent-color: var(--gold-700);
}

.option__body {
  display: grid;
  flex: 1;
  gap: 2px;
  min-width: 0;
}

.option__title {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  font-weight: 700;
}

.option__hint {
  font-size: var(--fs-md);
  color: var(--text-muted);
}

.new-tag {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 16px 0 0;
  border: 0;
  border-top: 1px solid var(--border);
}

.new-tag__row {
  display: flex;
  gap: 8px;
}

.swatches {
  display: flex;
  gap: 8px;
}

.swatch {
  position: relative;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  cursor: pointer;
}

.swatch input {
  position: absolute;
  opacity: 0;
}

.swatch:has(input:checked) {
  box-shadow:
    0 0 0 2px var(--surface),
    0 0 0 4px var(--ink-900);
}

.swatch:has(input:focus-visible) {
  box-shadow:
    0 0 0 2px var(--surface),
    var(--focus-ring);
}

.swatch--red {
  background: var(--red-500);
}
.swatch--gold {
  background: var(--gold-500);
}
.swatch--blue {
  background: var(--blue-500);
}
.swatch--green {
  background: var(--green-500);
}
.swatch--orange {
  background: var(--orange-500);
}
.swatch--purple {
  background: var(--purple-500);
}

.detail-grid {
  display: grid;
  grid-template-columns: minmax(140px, auto) 1fr;
  margin: 0;
}

.detail-grid dt,
.detail-grid dd {
  margin: 0;
  padding: 11px 0;
  border-bottom: 1px solid var(--border-soft);
}

.detail-grid dt {
  color: var(--text-muted);
}

.detail-grid dd {
  font-weight: 600;
  text-align: right;
}

.record-list {
  display: grid;
  gap: 10px;
}

.record-list__item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
}

.record-list__icon {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  color: var(--gold-700);
  background: #f6eedd;
}

.record-list__body {
  display: grid;
  flex: 1;
  color: var(--text-muted);
}

.record-list__body strong {
  color: var(--text);
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.template-preview {
  display: grid;
  gap: 8px;
}

.template-preview__bubble {
  justify-self: end;
  max-width: 90%;
  padding: 12px 16px;
  border-radius: var(--radius-lg);
  line-height: 1.55;
  background: var(--bubble-out);
  border: 1px solid var(--bubble-out-border);
}

@media (max-width: 600px) {
  .field-row {
    grid-template-columns: 1fr;
  }
}
