/* ==========================================================================
   Screen 2: Appointment Creation & Details Modal
   ========================================================================== */

.appointment-modal-card {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  position: fixed;
  top: var(--appointment-popout-top, 12px);
  left: var(--appointment-popout-left, 12px);
  width: var(--appointment-popout-width, min(980px, calc(100vw - 24px)));
  height: var(--appointment-popout-height, min(680px, calc(100svh - 32px)));
  min-width: min(860px, calc(100vw - 24px));
  min-height: min(480px, calc(100svh - 32px));
  max-width: calc(100vw - 24px);
  max-height: calc(100svh - 24px);
  background: var(--mobile-page-bg, #f4f3f8);
  border-radius: 14px;
  box-shadow: 0 18px 48px color-mix(in srgb, var(--theme-text, #21133d) 22%, transparent);
  border: 1px solid var(--mobile-card-border, #9bc7df);
  overflow: hidden;
}

.appointment-modal-card .app-modal-header {
  align-items: center;
  padding: 8px 14px;
  cursor: move;
  user-select: none;
  background: linear-gradient(135deg, var(--mobile-purple, #21133d) 0%, #35215c 100%);
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  color: #ffffff;
}

.appointment-modal-card .drawer-eyebrow {
  font-size: 9.5px;
  line-height: 1.1;
  color: rgba(255, 255, 255, 0.72);
}

.appointment-modal-card .app-modal-header h2 {
  margin-top: 1px;
  font-size: 15px;
  line-height: 1.15;
  color: #ffffff;
  font-weight: 700;
}

.appointment-modal-card .app-modal-close,
.appointment-modal-card .app-modal-minimize {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 6px;
  transition: all 0.12s ease;
}

.appointment-modal-card .app-modal-close:hover,
.appointment-modal-card .app-modal-minimize:hover {
  background: rgba(255, 255, 255, 0.25);
  color: #ffffff;
}

.appointment-modal-card .appointment-worksheet-body {
  display: flex;
  flex-direction: column;
  flex: 1 1 0;
  min-height: 0;
  height: 100%;
  overflow: hidden;
  background: var(--mobile-page-bg, #f4f3f8);
  padding: 8px 12px;
  gap: 6px;
  box-sizing: border-box;
}

.appointment-form-alert {
  padding: 8px 12px;
  background: #fef2f2;
  border: 1px solid #f87171;
  border-radius: var(--radius-tight, 6px);
  color: #991b1b;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.4;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 1px 2px rgba(239, 68, 68, 0.1);
}

.appointment-form-alert[hidden] {
  display: none !important;
}

/* Clean Selected Client Card */
.appointment-selected-client-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  background: var(--theme-panel, #ffffff);
  border: 1px solid var(--mobile-card-border, #9bc7df);
  border-radius: 12px;
  box-shadow: 0 2px 8px color-mix(in srgb, var(--theme-text, #21133d) 4%, transparent);
  flex-shrink: 0;
}

.client-card-avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 2px solid transparent;
  background: linear-gradient(var(--theme-panel, #ffffff), var(--theme-panel, #ffffff)) padding-box,
              linear-gradient(135deg, var(--mobile-coral, #ec665c), var(--mobile-purple, #21133d)) border-box;
  color: var(--mobile-purple, #21133d);
  font-size: 16px;
  font-weight: 700;
  flex-shrink: 0;
  box-shadow: 0 2px 8px color-mix(in srgb, var(--theme-accent, #ec665c) 20%, transparent);
}

.client-card-details {
  flex: 1;
  min-width: 0;
}

.client-card-name-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.client-card-name {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  color: var(--mobile-purple, #21133d);
  line-height: 1.2;
}

.client-card-badge {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 2px 8px;
  background: #f1f3f7;
  border-radius: 9999px;
  color: var(--mobile-text-subtle, #5e5772);
}

.client-card-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
  font-size: 12px;
  color: var(--mobile-text-subtle, #5e5772);
  flex-wrap: wrap;
}

.client-card-meta-dot {
  opacity: 0.5;
}

.appointment-change-client-btn {
  white-space: nowrap;
  font-size: 11.5px;
  font-weight: 600;
  padding: 5px 14px;
  border-radius: 9999px;
  border: 1px solid var(--theme-border, #d7d9de);
  background: var(--theme-panel, #ffffff);
  color: var(--mobile-purple, #21133d);
  transition: all 0.15s ease;
}

.appointment-change-client-btn:hover {
  border-color: var(--mobile-coral, #ec665c);
  color: var(--mobile-coral, #ec665c);
  background: #fff8f8;
}

/* Appointment Slot Toolbar */
.appointment-slot-toolbar {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px 10px;
  padding: 8px 10px;
  background: var(--theme-panel, #ffffff);
  border: 1px solid var(--theme-border, #e2e4ea);
  border-radius: 12px;
  box-shadow: 0 2px 8px color-mix(in srgb, var(--theme-text, #21133d) 4%, transparent);
  flex-shrink: 0;
}

.appointment-slot-toolbar .form-field {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 11px;
  font-weight: 700;
  color: var(--mobile-purple, #21133d);
  min-width: 0;
}

.appointment-slot-toolbar input,
.appointment-slot-toolbar select {
  height: 34px !important;
  min-height: 34px !important;
  max-height: 34px !important;
  box-sizing: border-box !important;
  padding: 0 8px !important;
  line-height: 32px !important;
  border: 1px solid var(--theme-border, #d7d9de);
  border-radius: 8px;
  background: var(--theme-panel, #ffffff);
  font-size: 12px;
  color: var(--mobile-purple, #21133d);
  width: 100% !important;
  min-width: 0 !important;
  -webkit-appearance: none;
  appearance: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.appointment-slot-toolbar input:focus,
.appointment-slot-toolbar select:focus {
  outline: none;
  border-color: var(--mobile-coral, #ec665c) !important;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--theme-accent, #ec665c) 15%, transparent) !important;
}

.appointment-slot-toolbar select {
  background-image: url('data:image/svg+xml;utf8,<svg fill="%2321133d" height="18" viewBox="0 0 24 24" width="18" xmlns="http://www.w3.org/2000/svg"><path d="M7 10l5 5 5-5z"/></svg>');
  background-repeat: no-repeat;
  background-position: right 6px center;
  padding-right: 24px !important;
}

/* Automated Status Update Display Badge (Non-pickable) */
.appointment-status-badge {
  display: flex;
  align-items: center;
  height: 34px !important;
  min-height: 34px !important;
  max-height: 34px !important;
  padding: 0 8px !important;
  border: 1px solid var(--theme-border, #d7d9de);
  border-radius: 8px;
  background: var(--theme-panel, #ffffff);
  box-sizing: border-box;
  cursor: default;
  user-select: none;
}

.appointment-status-badge .status-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 9999px;
  font-size: 11.5px;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: 0.01em;
}

.status-pill.status-pill-confirmed {
  background: var(--theme-panel, #eef2fa);
  color: var(--mobile-purple, #21133d);
  border: 1px solid #c3e1f2;
}

.status-pill.status-pill-checked-in {
  background: #dcfce7;
  color: #15803d;
  border: 1px solid #bbf7d0;
}

.status-pill.status-pill-requested {
  background: #ede9fe;
  color: #5b21b6;
  border: 1px solid #ddd6fe;
}

.status-pill.status-pill-pending {
  background: #fef3c7;
  color: #b45309;
  border: 1px solid #fde68a;
}

.status-pill.status-pill-completed {
  background: var(--theme-panel, #f1f5f9);
  color: var(--theme-quiet, #475569);
  border: 1px solid var(--theme-border, #e2e8f0);
}

.status-pill.status-pill-cancelled {
  background: #fee2e2;
  color: #991b1b;
  border: 1px solid #fecaca;
}

.status-pill.status-pill-no-show {
  background: #ffe4e6;
  color: #9f1239;
  border: 1px solid #fecdd3;
}

/* Appointment Lines Panel (Color-coded ticket table container) */
.appointment-lines-panel {
  position: relative;
  display: flex;
  flex-direction: column;
  flex: 1 1 0;
  min-height: 0;
  overflow: hidden;
  margin-top: 2px;
  background: var(--theme-panel, #ffffff);
  border: 1px solid var(--theme-border, #e2e4ea);
  border-radius: 12px;
  box-shadow: 0 2px 8px color-mix(in srgb, var(--theme-text, #21133d) 4%, transparent);
}

.appointment-lines-panel .ticket-lines-toolbar {
  flex-shrink: 0;
  padding: 6px 10px;
  background: var(--theme-panel, #ffffff);
  border-bottom: 1px solid var(--theme-border, #e2e4ea);
}

.appointment-lines-panel .panel-caption {
  color: var(--mobile-purple, #21133d);
  font-weight: 700;
  font-size: 13px;
}

#appointment-add-line {
  background: var(--mobile-coral, #ec665c) !important;
  color: #ffffff !important;
  border: 1px solid var(--mobile-coral, #ec665c) !important;
  border-radius: 9999px !important;
  font-weight: 700 !important;
  padding: 3px 14px !important;
  font-size: 11.5px !important;
  cursor: pointer;
  box-shadow: 0 2px 6px color-mix(in srgb, var(--theme-accent, #ec665c) 25%, transparent);
  transition: all 0.15s ease;
}

#appointment-add-line:hover {
  background: #e0554b !important;
  border-color: #e0554b !important;
}

.appointment-lines-panel .ticket-table-scroll {
  flex: 1 1 0;
  min-height: 100px;
  max-height: none;
  overflow-x: auto;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.appointment-lines-panel .ticket-table-hint {
  flex-shrink: 0;
  margin-top: 2px;
  font-size: 10.5px;
  color: var(--mobile-text-subtle, #5e5772);
}

/* ==========================================================================
   Appointment Bottom 3-Column Grid
   ========================================================================== */
.appointment-bottom-grid {
  display: grid;
  grid-template-columns: minmax(250px, 0.78fr) 1.52fr;
  gap: 10px;
  margin-top: auto;
  align-items: stretch;
  flex-shrink: 0;
}

@media (max-width: 860px) {
  .appointment-modal-card .appointment-worksheet-body {
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    padding: 6px 8px 10px;
    gap: 6px;
  }

  .appointment-lines-panel {
    flex: 0 0 auto;
    min-height: 155px;
    max-height: 240px;
  }

  .appointment-lines-panel .ticket-table-scroll {
    min-height: 120px;
  }

  .appointment-bottom-grid {
    grid-template-columns: 1fr;
    gap: 6px;
    margin-top: 0;
  }

  .appointment-grid-col {
    padding: 8px 10px;
  }
}

.appointment-grid-col {
  background: var(--theme-panel, #ffffff);
  border: 1px solid var(--theme-border, #e2e4ea);
  border-radius: 12px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  box-shadow: 0 2px 8px color-mix(in srgb, var(--theme-text, #21133d) 4%, transparent);
}

/* Column 1: Metadata & Comments (2 Columns Split) */
.appointment-meta-col {
  padding: 8px 10px;
}

.appointment-meta-2col-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  width: 100%;
}

.appointment-meta-subcol {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.appointment-meta-subcol .form-field {
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: 11px;
  font-weight: 700;
  color: var(--mobile-purple, #21133d);
  min-width: 0;
}

.appointment-meta-subcol .form-field > span:first-child,
.appointment-meta-subcol .form-field-label-row {
  height: 20px;
  min-height: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  box-sizing: border-box;
  color: var(--mobile-purple, #21133d);
  font-size: 11px;
  font-weight: 700;
}

.appointment-meta-subcol select,
.appointment-meta-subcol input,
.appointment-meta-subcol input.ticket-info-input {
  height: 34px !important;
  min-height: 34px !important;
  max-height: 34px !important;
  padding: 0 8px !important;
  line-height: 32px !important;
  border: 1px solid var(--theme-border, #d7d9de) !important;
  border-radius: 8px !important;
  font-family: inherit;
  font-size: 12px !important;
  font-weight: 500;
  color: var(--mobile-purple, #21133d) !important;
  background-color: var(--theme-panel, #ffffff) !important;
  width: 100%;
  min-width: 0;
  box-sizing: border-box !important;
  -webkit-appearance: none;
  appearance: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.appointment-meta-subcol select {
  background-image: url('data:image/svg+xml;utf8,<svg fill="%2321133d" height="18" viewBox="0 0 24 24" width="18" xmlns="http://www.w3.org/2000/svg"><path d="M7 10l5 5 5-5z"/></svg>');
  background-repeat: no-repeat;
  background-position: right 6px center;
  padding-right: 24px !important;
  cursor: pointer;
}

.appointment-meta-subcol select:focus,
.appointment-meta-subcol input:focus,
.appointment-meta-subcol input.ticket-info-input:focus {
  outline: none;
  border-color: var(--mobile-coral, #ec665c) !important;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--theme-accent, #ec665c) 15%, transparent) !important;
}

.form-field-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}

.form-field-spacer {
  visibility: hidden;
  user-select: none;
}

.btn-meta-edit {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 18px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 0 8px;
  border-radius: 9999px;
  background: #e0f2fe;
  color: #0369a1;
  border: 1px solid #bae6fd;
  cursor: pointer;
  line-height: 1;
  transition: all 0.12s ease;
}

.btn-meta-edit:hover {
  background: #0284c7;
  color: #ffffff;
  border-color: #0284c7;
}

.appointment-no-show-field {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.appointment-no-show-rate-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 34px !important;
  min-height: 34px !important;
  max-height: 34px !important;
  margin-top: 0 !important;
  padding: 0 8px;
  background: var(--theme-panel, #f8fafc);
  border-radius: 8px;
  border: 1px solid var(--theme-border, #d7d9de);
  font-size: 12px;
  box-sizing: border-box;
}

.appointment-no-show-rate-box .rate-label {
  font-weight: 600;
  color: #486581;
}

.appointment-no-show-rate-box .rate-value {
  font-weight: 700;
  color: #0b69a3;
  font-size: 12px;
  background: #e0f2fe;
  padding: 1px 6px;
  border-radius: 10px;
}

/* Mobile Service Cards (Photo #2 Design) */
.appointment-mobile-services-panel {
  display: none;
}

.mobile-service-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 10px;
  background: var(--theme-panel, #ffffff);
  border: 1px solid var(--theme-border, #cbd5e1);
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
  gap: 8px;
}

.mobile-service-card-main {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
}

.mobile-service-icon {
  width: 26px;
  height: 26px;
  border-radius: 6px;
  background: var(--theme-panel, #f1f5f9);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  flex-shrink: 0;
}

.mobile-service-info {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.mobile-service-title {
  font-weight: 700;
  font-size: 12px;
  color: var(--theme-text, #0f172a);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mobile-service-sub {
  font-size: 10.5px;
  color: var(--theme-quiet, #64748b);
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}

.mobile-service-card-side {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.mobile-service-pricing {
  text-align: right;
}

.mobile-service-price {
  font-weight: 700;
  font-size: 12px;
  color: var(--theme-text, #0f172a);
}

.mobile-service-stylist {
  font-size: 10px;
  color: var(--theme-quiet, #64748b);
}

.mobile-service-remove-btn {
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 5px;
  border: 1px solid #fee2e2;
  background: #fef2f2;
  color: #ef4444;
  font-size: 14px;
  cursor: pointer;
  padding: 0;
  line-height: 1;
  transition: all 0.12s ease;
}

.mobile-service-remove-btn:hover {
  background: #ef4444;
  color: #ffffff;
  border-color: #ef4444;
}

.mobile-services-empty {
  padding: 8px 10px;
  text-align: center;
  background: var(--theme-panel, #ffffff);
  border: 1px dashed var(--theme-border, #cbd5e1);
  border-radius: 8px;
  color: var(--theme-quiet, #64748b);
  font-size: 11.5px;
}

.appointment-mobile-services-actions {
  display: flex;
  gap: 6px;
  margin-top: 3px;
}

.mobile-service-add-btn {
  flex: 1;
  padding: 6px 10px;
  font-size: 11.5px;
  font-weight: 600;
  color: #2563eb;
  background: var(--theme-panel, #eff6ff);
  border: 1px dashed #93c5fd;
  border-radius: 6px;
  cursor: pointer;
  text-align: center;
  transition: all 0.15s ease;
}

.mobile-service-add-btn:hover {
  background: var(--theme-panel, #dbeafe);
  border-color: #3b82f6;
}

.mobile-product-add-btn {
  color: #059669;
  background: #ecfdf5;
  border-color: #a7f3d0;
}

.mobile-product-add-btn:hover {
  background: #d1fae5;
  border-color: #10b981;
}

/* Created By Options Manager Modal */
.created-by-modal-card {
  width: min(92vw, 420px);
  border-radius: 16px;
  overflow: hidden;
  background: var(--theme-panel, #ffffff);
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.2);
}

.created-by-modal-body {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.created-by-modal-desc {
  font-size: 12px;
  color: var(--theme-quiet, #64748b);
  margin: 0;
  line-height: 1.4;
}

.created-by-add-row {
  display: flex;
  gap: 8px;
}

.created-by-add-row input {
  flex: 1;
  padding: 8px 10px;
  border: 1px solid var(--theme-border, #cbd5e1);
  border-radius: 6px;
  font-size: 12.5px;
}

.created-by-list-container {
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: var(--theme-panel, #f8fafc);
  border: 1px solid var(--theme-border, #e2e8f0);
  border-radius: 8px;
  padding: 10px;
}

.created-by-list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11.5px;
  font-weight: 700;
  color: #486581;
}

.created-by-options-list {
  list-style: none;
  padding: 0;
  margin: 0;
  max-height: 200px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.created-by-option-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 10px;
  background: var(--theme-panel, #ffffff);
  border: 1px solid var(--theme-border, #cbd5e1);
  border-radius: 6px;
  font-size: 12px;
  color: var(--theme-text, #1e293b);
}

.created-by-item-remove-btn {
  border: none;
  background: transparent;
  color: #ef4444;
  font-size: 14px;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
  line-height: 1;
}

.created-by-item-remove-btn:hover {
  background: #fee2e2;
}

.created-by-form-actions {
  display: flex;
  justify-content: flex-end;
  border-top: 1px solid var(--theme-border, #e2e8f0);
  padding-top: 10px;
}

/* Column 2: Totals & Tip */
.appointment-totals-col {
  justify-content: space-between;
  gap: 6px;
  background: var(--theme-panel, #f8fafc);
}

.appointment-total-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12.5px;
  color: #334e68;
}

.appointment-total-row strong {
  font-weight: 700;
  color: #102a43;
}

.appointment-tip-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.appointment-tip-input-wrap {
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--theme-panel, #ffffff);
  border: 1px solid var(--theme-border, #c5d5e6);
  border-radius: 8px;
  padding: 0 10px;
  width: 108px;
  height: 32px;
  box-sizing: border-box;
  overflow: hidden;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.appointment-tip-input-wrap:focus-within {
  border-color: var(--mobile-coral, #ec665c);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--theme-accent, #ec665c) 15%, transparent);
}

.appointment-tip-input-wrap .currency-prefix {
  font-size: 12.5px;
  color: var(--theme-quiet, #64748b);
  font-weight: 700;
  flex-shrink: 0;
  line-height: 1;
}

.appointment-tip-input-wrap input.ticket-tip-input {
  width: 100%;
  min-width: 0;
  min-height: 0 !important;
  height: 100% !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  padding: 0 !important;
  margin: 0 !important;
  font-size: 13px;
  font-weight: 600;
  text-align: right;
  color: var(--mobile-purple, #21133d);
  outline: none !important;
  -moz-appearance: textfield;
  appearance: textfield;
}

.appointment-tip-input-wrap input.ticket-tip-input::-webkit-inner-spin-button,
.appointment-tip-input-wrap input.ticket-tip-input::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.appointment-main-total-row {
  border-top: 2px solid var(--theme-border, #cbd5e1);
  padding-top: 8px;
  margin-top: 4px;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
}

.appointment-main-total-row .main-total-label {
  font-size: 13.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--mobile-purple, #21133d);
}

.appointment-grand-total-big {
  font-size: 26px !important;
  font-weight: 800 !important;
  color: var(--mobile-purple, #21133d) !important;
  line-height: 1;
}

/* Merged POS Checkout & Actions Panel */
.appointment-pos-merged-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

.appointment-pos-top-split {
  display: grid;
  grid-template-columns: 1.28fr 1fr;
  gap: 8px;
  align-items: stretch;
}

.appointment-pos-top-split .appointment-grid-col {
  padding: 8px 10px;
  background: var(--theme-panel, #ffffff);
  border: 1px solid var(--theme-border, #e2e4ea);
  border-radius: 12px;
  box-shadow: 0 2px 8px color-mix(in srgb, var(--theme-text, #21133d) 4%, transparent);
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.appointment-pos-top-split .appointment-totals-col {
  justify-content: space-between;
  gap: 4px;
}

.appointment-pos-top-split .appointment-actions-col {
  justify-content: flex-start;
  gap: 6px;
}

.appointment-tender-field-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
}

.appointment-tender-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--mobile-purple, #21133d);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.appointment-tender-select {
  flex: 1;
  width: 100%;
  height: 32px !important;
  min-height: 32px !important;
  max-height: 32px !important;
  padding: 0 24px 0 8px;
  border: 1px solid var(--theme-border, #d7d9de);
  border-radius: 8px;
  background-color: var(--theme-panel, #ffffff);
  background-image: url('data:image/svg+xml;utf8,<svg fill="%2321133d" height="18" viewBox="0 0 24 24" width="18" xmlns="http://www.w3.org/2000/svg"><path d="M7 10l5 5 5-5z"/></svg>');
  background-repeat: no-repeat;
  background-position: right 6px center;
  color: var(--mobile-purple, #21133d);
  font-size: 12px;
  font-weight: 600;
  box-sizing: border-box;
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.appointment-tender-select:focus {
  border-color: var(--mobile-coral, #ec665c);
  outline: none;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--theme-accent, #ec665c) 15%, transparent);
}

.appointment-primary-actions-stack {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.appointment-action-btn {
  width: 100%;
  padding: 6px 8px !important;
  font-size: 12px !important;
  font-weight: 700;
  text-align: center;
  border-radius: 8px !important;
  box-shadow: 0 1px 3px color-mix(in srgb, var(--theme-text, #21133d) 8%, transparent);
  cursor: pointer;
  min-height: 32px !important;
  line-height: 1.2;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
}

.appointment-action-btn:active {
  transform: scale(0.98);
}

/* Process Credit/Debit Button (Deep Purple) */
.appointment-btn-process-card {
  background: var(--mobile-purple, #21133d) !important;
  border: 1px solid var(--mobile-purple, #21133d) !important;
  color: #ffffff !important;
  box-shadow: 0 2px 6px color-mix(in srgb, var(--theme-text, #21133d) 20%, transparent) !important;
}

.appointment-btn-process-card:hover {
  background: #35215c !important;
  border-color: #35215c !important;
}

/* Check-out / Close Button (Vibrant Coral) */
.appointment-btn-checkout-close {
  background: var(--mobile-coral, #ec665c) !important;
  border: 1px solid var(--mobile-coral, #ec665c) !important;
  color: #ffffff !important;
  box-shadow: 0 2px 8px color-mix(in srgb, var(--theme-accent, #ec665c) 25%, transparent) !important;
}

.appointment-btn-checkout-close:hover {
  background: #e0554b !important;
  border-color: #e0554b !important;
}

/* Schedule / Leave-Open Button */
.appointment-btn-schedule-open {
  background: var(--theme-panel, #ffffff) !important;
  border: 1px solid var(--theme-border, #d7d9de) !important;
  color: var(--mobile-purple, #21133d) !important;
}

.appointment-btn-schedule-open:hover {
  background: var(--theme-panel, #f4f3f8) !important;
  border-color: var(--mobile-purple, #21133d) !important;
}

/* Lower Sub-actions container */
.appointment-sub-actions-container {
  position: relative;
  background: var(--theme-panel, #ffffff);
  border: 1px solid var(--theme-border, #e2e4ea);
  border-radius: 12px;
  padding: 6px 8px;
  box-shadow: 0 2px 8px color-mix(in srgb, var(--theme-text, #21133d) 4%, transparent);
}

.appointment-sub-actions-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
}

.appointment-sub-btn {
  padding: 6px 8px !important;
  font-size: 11.5px !important;
  font-weight: 600;
  text-align: center;
  border-radius: 8px !important;
  border: 1px solid var(--theme-border, #d7d9de);
  background: var(--theme-panel, #f8fafc);
  color: var(--mobile-purple, #21133d);
  cursor: pointer;
  white-space: nowrap;
  min-height: 32px !important;
  line-height: 1.2;
  transition: background 0.12s ease, border-color 0.12s ease;
}

.appointment-sub-btn:hover {
  background: var(--theme-panel, #eef2fa);
  border-color: var(--mobile-card-border, #9bc7df);
}

.appointment-sub-btn.danger,
#appointment-void.appointment-sub-btn {
  color: #dc2626 !important;
  border-color: #fecaca !important;
  background: #fef2f2 !important;
  font-weight: 700 !important;
}

.appointment-sub-btn.danger:hover,
#appointment-void.appointment-sub-btn:hover {
  background: #fee2e2 !important;
  border-color: #f87171 !important;
}

#appointment-delete,
#appointment-schedule-close {
  display: none !important;
}

/* More Side Pop-Out Flyout Menu */
.appointment-more-flyout {
  position: absolute;
  right: 0;
  bottom: calc(100% + 6px);
  width: 220px;
  background: var(--theme-panel, #ffffff);
  border: 1px solid var(--theme-border, #94a3b8);
  border-radius: var(--radius-tight, 6px);
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.22);
  z-index: 100;
  padding: 6px 0;
  display: flex;
  flex-direction: column;
}

.appointment-more-flyout .flyout-header {
  padding: 6px 12px 4px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--theme-quiet, #64748b);
  border-bottom: 1px solid var(--theme-border, #e2e8f0);
}

.appointment-more-flyout .flyout-menu-list {
  display: flex;
  flex-direction: column;
  padding: 4px 0;
}

.appointment-more-flyout .flyout-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 12px;
  border: none;
  background: transparent;
  width: 100%;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--theme-text, #1e293b);
  text-align: left;
  cursor: pointer;
  transition: background 0.1s ease;
}

.appointment-more-flyout .flyout-menu-item:hover {
  background: var(--theme-panel, #f1f5f9);
  color: #0b69a3;
}

.appointment-more-flyout .flyout-item-icon {
  font-size: 14px;
  opacity: 0.7;
  width: 16px;
  text-align: center;
}

.appointment-more-flyout .flyout-footer {
  padding: 4px 12px 2px;
  font-size: 10.5px;
  color: var(--theme-quiet, #94a3b8);
  border-top: 1px solid #f1f5f9;
  font-style: italic;
}

.checkout-modal-card {
  /* Default size when opened, then freely resizable by dragging the bottom-right grip.
     The min-* values are the smallest the worksheet can get while still holding the
     two-column header, table, and totals without clustering; max-* keep it on-screen. */
  width: min(1120px, calc(100vw - 24px));
  height: min(800px, calc(100svh - 40px));
  min-width: min(680px, calc(100vw - 24px));
  min-height: min(420px, calc(100svh - 40px));
  max-width: calc(100vw - 24px);
  max-height: calc(100svh - 24px);
  resize: both;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
}

.checkout-form {
  min-width: 0;
  min-height: 0;
  grid-template-columns: minmax(0, 1fr);
  overflow-x: hidden;
  overflow-y: auto;
}

.checkout-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
  min-height: 0;
}

/* The Appointment Tickets sidebar is not part of the drawn ticket worksheet.
   Keep the element in the DOM (both runtimes require #checkout-ticket-list) but
   remove it from the visual layout; ticket selection now happens via the compact
   #checkout-ticket-selector dropdown. */
.checkout-ticket-panel {
  display: none;
}

.checkout-ticket-panel,
.checkout-working-panel {
  min-width: 0;
}

.checkout-ticket-selector-row {
  display: flex;
  justify-content: flex-start;
  margin-bottom: 10px;
}

.checkout-ticket-selector-field {
  display: grid;
  gap: 4px;
  width: min(420px, 100%);
}

.checkout-ticket-selector-field span {
  color: var(--theme-quiet, #5b7088);
  font-size: 11px;
  font-weight: 800;
}

.checkout-ticket-selector-field select {
  min-height: 32px;
  border: 1px solid var(--theme-border, #a9bbcf);
  border-radius: var(--radius-tight);
  background: var(--theme-panel, #ffffff);
  color: var(--theme-text, #263c54);
  font: inherit;
}

.checkout-ticket-list {
  display: grid;
  gap: 6px;
  max-height: min(520px, calc(100svh - 190px));
  overflow: auto;
  padding-right: 2px;
}

.checkout-ticket-button {
  display: grid;
  gap: 3px;
  width: 100%;
  min-height: 62px;
  padding: 8px;
  border: 1px solid #9eb2ca;
  border-radius: var(--radius-tight);
  background: linear-gradient(var(--theme-panel, #ffffff), #e9f1fb);
  color: var(--theme-text, #263c54);
  text-align: left;
}

.checkout-ticket-button:hover,
.checkout-ticket-button:focus-visible {
  background: linear-gradient(var(--theme-panel, #ffffff), var(--theme-panel, #dce8f7));
}

.checkout-ticket-button.is-selected {
  border-color: #c47e2a;
  background: linear-gradient(#fff8e8, #f2d9a6);
}

.checkout-ticket-button strong,
.checkout-ticket-button span {
  min-width: 0;
  overflow-wrap: anywhere;
  white-space: normal;
}

.checkout-ticket-button span {
  color: #5f748f;
  font-size: 11px;
}

.checkout-ticket-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--theme-border, #c4d1df);
  border-radius: var(--radius-tight);
  background: linear-gradient(var(--theme-panel, #ffffff), var(--theme-panel, #edf4fc));
}

.checkout-ticket-heading h3 {
  margin: 2px 0 0;
  color: #24384f;
  font-size: 16px;
}

.ticket-detail {
  position: relative;
  min-width: 0;
}

.ticket-top-grid {
  display: grid;
  grid-template-columns: minmax(250px, 0.9fr) minmax(310px, 1.1fr);
  gap: 12px;
}

.ticket-info-panel,
.ticket-client-panel,
.ticket-lines-panel {
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--theme-border, #c4d1df);
  border-radius: var(--radius-tight);
  background: var(--theme-panel, #ffffff);
}

.ticket-client-name {
  font-size: 24px;
  line-height: 1.15;
}

.ticket-info-grid {
  display: grid;
  gap: 6px;
  margin: 7px 0 0;
}

.ticket-info-row {
  display: grid;
  grid-template-columns: minmax(86px, 0.7fr) minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  min-width: 0;
}

.ticket-info-row dt {
  color: var(--theme-quiet, #5b7088);
  font-size: 11px;
  font-weight: 700;
}

.ticket-info-row dd {
  min-width: 0;
  margin: 0;
  color: var(--theme-text, #263c54);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.ticket-info-row-editable label {
  color: var(--theme-quiet, #5b7088);
  font-size: 11px;
  font-weight: 700;
}

.ticket-info-input {
  width: 100%;
  min-width: 0;
  padding: 4px 6px;
  border: 1px solid var(--theme-border, #c1d1e4);
  border-radius: var(--radius-tight);
  background: var(--theme-panel, #fff);
  color: var(--theme-text, #263c54);
  font-size: 12px;
}

.ticket-info-select {
  padding-right: 22px;
}

.ticket-info-id {
  font-weight: 800;
}

.ticket-status-cell,
.ticket-reminder-cell {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.ticket-status-select,
.ticket-date-input,
.ticket-cell-input,
.ticket-search-field select,
.ticket-search-field input {
  min-width: 0;
  border: 1px solid var(--theme-border, #a9bbcf);
  border-radius: var(--radius-tight);
  background: var(--theme-panel, #ffffff);
  color: var(--theme-text, #263c54);
  font: inherit;
}

.ticket-status-select,
.ticket-date-input {
  min-height: 30px;
  padding: 5px 7px;
}

.ticket-reminder-status,
.ticket-resend-toggle {
  color: var(--theme-quiet, #50677f);
  font-size: 11px;
  font-weight: 700;
}

.ticket-resend-toggle {
  display: inline-flex;
  gap: 5px;
  align-items: center;
}

.ticket-client-name {
  margin: 4px 0 0;
  color: #24384f;
  font-size: 17px;
}

.ticket-client-contact {
  min-height: 17px;
  margin-top: 3px;
  color: var(--theme-quiet, #5b7088);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.ticket-client-actions,
.ticket-lines-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  align-items: center;
}

.ticket-client-actions {
  margin-top: 9px;
}

.ticket-lines-panel {
  margin-top: 10px;
}

.ticket-lines-toolbar {
  justify-content: space-between;
  margin-bottom: 8px;
}

.ticket-lines-toolbar-title {
  display: inline-flex;
  gap: 6px;
  align-items: center;
}

.ticket-fit-all-button {
  display: inline-grid;
  place-items: center;
  width: 24px;
  height: 24px;
  padding: 0;
  border: 1px solid var(--theme-border, #a9bbcf);
  border-radius: var(--radius-tight);
  background: linear-gradient(var(--theme-panel, #ffffff), #e9f1fb);
  color: #345a83;
  font-size: 13px;
  line-height: 1;
}

.ticket-fit-all-button:hover,
.ticket-fit-all-button:focus-visible {
  border-color: #c47e2a;
  background: linear-gradient(#fff8e8, #f2d9a6);
}

.ticket-table-scroll {
  max-width: 100%;
  overflow: auto;
  border: 2px solid var(--theme-border, #b8c6d8);
  border-radius: var(--radius-tight);
  background: var(--theme-panel, #ffffff);
}

.ticket-table {
  width: 100%;
  min-width: 1180px;
  border-collapse: collapse;
  table-layout: fixed;
  color: var(--theme-text, #263c54);
  font-size: 11px;
  --ticket-row-height: 19px;
}

.ticket-table.is-column-fitted {
  min-width: 0;
  width: 100%;
  max-width: 100%;
}

.ticket-table th,
.ticket-table td {
  height: var(--ticket-row-height);
  padding: 2px 4px;
  border: 1px solid var(--mobile-grid-line, #d7d9de);
  vertical-align: middle;
}

.ticket-table th {
  position: relative;
  background: var(--theme-panel, #f4f3f8);
  color: var(--mobile-purple, #21133d);
  font-size: 10px;
  font-weight: 800;
  text-align: left;
  overflow: hidden;
}

.ticket-col-resize-handle {
  position: absolute;
  top: 0;
  right: -3px;
  z-index: 2;
  width: 7px;
  height: 100%;
  cursor: col-resize;
  touch-action: none;
}

.ticket-col-resize-handle::after {
  content: "";
  position: absolute;
  top: 18%;
  right: 3px;
  bottom: 18%;
  width: 1px;
  background: #cbd5e1;
}

body.is-resizing-ticket-col {
  cursor: col-resize;
  user-select: none;
}

.ticket-table tr:last-child td {
  border-bottom: 0;
}

.ticket-table th:last-child,
.ticket-table td:last-child {
  border-right: 0;
}

.ticket-col-employee {
  width: 118px;
}

.ticket-table tr.ticket-line-row > td,
.ticket-table tr.ticket-line-filler > td {
  height: var(--ticket-row-height);
  max-height: var(--ticket-row-height);
  padding: 0;
  overflow: hidden;
  line-height: 1;
}

.ticket-line-row td.ticket-cell-editable {
  padding: 0;
}

.ticket-table tr.ticket-line-row > td.ticket-cell-total,
.ticket-table tr.ticket-line-row > td.ticket-cell-tax {
  padding: 0 4px;
  font-size: 10px;
  line-height: var(--ticket-row-height);
}

.ticket-table tr.ticket-line-row input:not([type="checkbox"]),
.ticket-table tr.ticket-line-row select,
.ticket-cell-inline {
  display: block;
  box-sizing: border-box;
  width: 100%;
  min-height: 0;
  height: var(--ticket-row-height);
  max-height: var(--ticket-row-height);
  margin: 0;
  padding: 0 3px;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  font-size: 10px;
  line-height: var(--ticket-row-height);
  color: var(--theme-text, #263c54);
}

/* Appointment modal ledger: fixed 21px rows (25% thinner than the previous
   28px rows) to ensure 25 preloaded rows scroll cleanly in a single view. */
.appointment-lines-table {
  --ticket-row-height: 21px;
}

.appointment-lines-table thead th {
  position: sticky;
  top: 0;
  z-index: 5;
  background: var(--theme-panel, #f4f3f8);
  color: var(--mobile-purple, #21133d);
  box-shadow: 0 1px 0 var(--mobile-grid-line, #d7d9de);
  white-space: nowrap;
}

.appointment-lines-table tr.ticket-line-row > td,
.appointment-lines-table tr.ticket-line-filler > td {
  line-height: var(--ticket-row-height);
}

.appointment-lines-table tr.ticket-line-row input:not([type="checkbox"]),
.appointment-lines-table tr.ticket-line-row select,
.appointment-lines-table tr.ticket-line-filler input:not([type="checkbox"]),
.appointment-lines-table .ticket-cell-inline {
  min-height: 0;
  height: var(--ticket-row-height);
  max-height: var(--ticket-row-height);
  margin: 0;
  padding: 0 4px;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  background-color: transparent;
  line-height: var(--ticket-row-height);
}

.appointment-lines-table tr.ticket-line-row select.ticket-cell-inline-select {
  padding-right: 14px;
}

.appointment-lines-table input:focus,
.appointment-lines-table select:focus {
  background-color: #fff8e8;
  border: 0;
  box-shadow: none;
  outline: 2px solid #5b8ec4;
  outline-offset: -2px;
}

.appointment-lines-table .ticket-cell-tax-checkbox {
  width: 11px;
  height: 11px;
  min-height: 0;
  max-height: 11px;
  margin: 0 auto;
  padding: 0;
  display: block;
}

.ticket-cell-inline-select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 14px;
  cursor: pointer;
  background-color: transparent;
  background-image:
    linear-gradient(45deg, transparent 50%, #38536f 50%),
    linear-gradient(135deg, #38536f 50%, transparent 50%);
  background-position:
    calc(100% - 8px) calc(50% - 1px),
    calc(100% - 5px) calc(50% - 1px);
  background-size: 3px 3px, 3px 3px;
  background-repeat: no-repeat;
}

.ticket-line-row td.ticket-cell-editable:focus-within {
  outline: 2px solid #5b8ec4;
  outline-offset: -2px;
  background: var(--theme-panel, #fff);
}

.ticket-line-context-menu {
  position: fixed;
  z-index: 1500;
  display: grid;
  min-width: 124px;
  padding: 2px 0;
  overflow: hidden;
  border: 1px solid #6f95c4;
  border-radius: 2px;
  background: #f7f7f7;
  box-shadow: 2px 3px 8px rgba(28, 45, 66, 0.28);
  color: #001f7a;
  font-size: 12px;
  line-height: 1.2;
  user-select: none;
}

.ticket-line-context-menu[hidden] {
  display: none;
}

.ticket-line-context-menu-item {
  width: 100%;
  padding: 7px 12px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.ticket-line-context-menu-item:hover,
.ticket-line-context-menu-item:focus-visible {
  background: linear-gradient(#fff7b8, #f5c138);
  color: #151000;
  outline: 1px solid #d7a113;
  outline-offset: -1px;
}

.ticket-col-start {
  width: 78px;
}

.ticket-table th.ticket-col-id,
.ticket-table td.ticket-col-id {
  width: 44px;
  min-width: 44px;
  max-width: 44px;
  padding-left: 5px;
  padding-right: 5px;
  text-align: center;
}

.ticket-col-id .ticket-cell-id-input {
  padding-left: 5px;
  padding-right: 5px;
}

.ticket-table th.ticket-col-mins,
.ticket-table td.ticket-col-mins {
  width: 40px;
  min-width: 40px;
  max-width: 40px;
  padding-left: 5px;
  padding-right: 5px;
  text-align: center;
}

.ticket-table th.ticket-col-type,
.ticket-table td.ticket-col-type {
  width: 36px;
  min-width: 36px;
  max-width: 36px;
  padding-left: 4px;
  padding-right: 4px;
  text-align: center;
}

.ticket-col-mins .ticket-cell-mins {
  padding-left: 5px;
  padding-right: 5px;
  text-align: center;
}

.ticket-table th.ticket-col-price,
.ticket-table td.ticket-col-price {
  width: 64px;
  min-width: 64px;
  max-width: 64px;
  padding-left: 5px;
  padding-right: 5px;
  text-align: right;
}

.ticket-col-price .ticket-cell-price {
  padding-left: 5px;
  padding-right: 5px;
  text-align: right;
}

.ticket-table th.ticket-col-qty-prch,
.ticket-table td.ticket-col-qty-prch,
.ticket-table th.ticket-col-qty-used,
.ticket-table td.ticket-col-qty-used {
  width: 36px;
  min-width: 36px;
  max-width: 36px;
  padding-left: 5px;
  padding-right: 5px;
  text-align: center;
}

.ticket-col-qty-prch .ticket-cell-qty-prch,
.ticket-col-qty-used .ticket-cell-qty-used {
  padding-left: 5px;
  padding-right: 5px;
  text-align: center;
}

.ticket-table th.ticket-col-discount,
.ticket-table td.ticket-col-discount {
  width: 52px;
  min-width: 52px;
  max-width: 52px;
  padding-left: 5px;
  padding-right: 5px;
  text-align: right;
}

.ticket-col-discount .ticket-cell-discount {
  padding-left: 5px;
  padding-right: 5px;
  text-align: right;
}

.ticket-table tbody tr > td.ticket-col-start,
.ticket-table tbody tr > td:nth-child(2) {
  background: #e8f4e8;
}

.ticket-line-row td.ticket-col-start:focus-within {
  background: #f3faf3;
}

.ticket-table tbody tr > td.ticket-col-id,
.ticket-table tbody tr > td:nth-child(3) {
  background: #ede8f4;
}

.ticket-line-row td.ticket-col-id:focus-within {
  background: #f5f1fa;
}

.ticket-table tbody tr > td.ticket-col-mins,
.ticket-table tbody tr > td:nth-child(4) {
  background: #fde8d6;
}

.ticket-line-row td.ticket-col-mins:focus-within,
.ticket-line-row td:nth-child(4):focus-within {
  background: #fff3e8;
}

.ticket-table tbody tr > td.ticket-col-price,
.ticket-table tbody tr > td:nth-child(7),
.ticket-line-row td:has(.ticket-cell-price) {
  background: #dff5f5;
}

.ticket-line-row td.ticket-col-price:focus-within,
.ticket-line-row td:has(.ticket-cell-price):focus-within {
  background: #ecfafa;
}

.ticket-table tbody tr > td.ticket-col-qty-prch,
.ticket-table tbody tr > td:nth-child(10) {
  background: #e8f4e8;
}

.ticket-line-row td.ticket-col-qty-prch:focus-within {
  background: #f3faf3;
}

.ticket-table tbody tr > td.ticket-col-qty-used,
.ticket-table tbody tr > td:nth-child(11) {
  background: #fce8e8;
}

.ticket-line-row td.ticket-col-qty-used:focus-within {
  background: #fdf3f3;
}

.ticket-table tbody tr > td:nth-child(13),
.ticket-table tbody tr > td.ticket-cell-total {
  background: #fdf8e3;
}

.ticket-col-desc {
  width: 230px;
}

.ticket-col-num {
  width: 76px;
  text-align: right;
}

.ticket-col-actions {
  width: 42px;
  text-align: center;
}

.ticket-cell-input {
  width: 100%;
  min-height: 28px;
  padding: 4px 5px;
}

.ticket-cell-compact {
  min-height: 24px;
  height: 24px;
  padding: 2px 4px;
  font-size: 11px;
}

.ticket-cell-select {
  width: 100%;
  min-height: 12px;
  padding: 1px 14px 1px 3px;
  font-size: 10px;
}

.ticket-cell-start,
.ticket-cell-employee-select {
  text-align: left;
}

.ticket-cell-start {
  text-align: center;
}

.ticket-col-type .ticket-cell-type-select {
  padding-left: 4px;
  padding-right: 14px;
  text-align: center;
  background-position:
    calc(100% - 7px) calc(50% - 2px),
    calc(100% - 4px) calc(50% - 2px);
}

.ticket-cell-num {
  text-align: right;
}

.ticket-cell-id-input {
  color: #19446b;
  font-weight: 700;
  text-align: center;
}

.ticket-cell-id:hover,
.ticket-cell-id:focus-within {
  outline: 2px solid #c47e2a;
  outline-offset: -2px;
  background: #fff8e8;
}

.ticket-cell-tax {
  text-align: center;
}

.ticket-cell-tax-checkbox {
  width: 11px;
  height: 11px;
  min-height: 0;
  margin: 0 auto;
  display: block;
  accent-color: #1e73d8;
}

.ticket-table tr.ticket-line-row .ticket-cell-tax {
  text-align: center;
}

.ticket-cell-total {
  font-weight: 700;
}

.ticket-line-remove,
.ticket-search-close {
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--theme-border, #a9bbcf);
  border-radius: var(--radius-tight);
  background: linear-gradient(var(--theme-panel, #ffffff), #e9f1fb);
  color: #345a83;
  font-weight: 800;
}

.ticket-line-remove {
  width: 26px;
  height: 26px;
}

.ticket-line-remove:hover,
.ticket-line-remove:focus-visible,
.ticket-search-close:hover,
.ticket-search-close:focus-visible {
  border-color: #c47e2a;
  background: linear-gradient(#fff8e8, #f2d9a6);
}

.ticket-empty-row {
  cursor: pointer;
  height: 23px;
  color: var(--theme-quiet, #5b7088);
  text-align: center;
}

.ticket-line-filler td {
  height: var(--ticket-row-height);
  padding: 0;
  overflow: hidden;
  line-height: 1;
  background: #fcfdff;
}

.ticket-line-filler td.ticket-col-start,
.ticket-line-filler td:nth-child(2) {
  background: #e8f4e8;
}

.ticket-line-filler td.ticket-col-id,
.ticket-line-filler td:nth-child(3) {
  background: #ede8f4;
}

.ticket-line-filler td.ticket-col-mins,
.ticket-line-filler td:nth-child(4) {
  background: #fde8d6;
}

.ticket-line-filler td.ticket-col-price,
.ticket-line-filler td:nth-child(7) {
  background: #dff5f5;
}

.ticket-line-filler td.ticket-col-qty-prch,
.ticket-line-filler td:nth-child(10) {
  background: #e8f4e8;
}

.ticket-line-filler td.ticket-col-qty-used,
.ticket-line-filler td:nth-child(11) {
  background: #fce8e8;
}

.ticket-line-filler td.ticket-col-total,
.ticket-line-filler td:nth-child(13) {
  background: #fdf8e3;
}

.ticket-filler-id-cell {
  padding: 0;
  cursor: text;
}

.ticket-filler-id-input {
  color: var(--theme-quiet, #5b7088);
  font-weight: 700;
  text-align: center;
}

.ticket-line-filler .ticket-filler-id-input:focus {
  background: #fff8e8;
}

.ticket-bottom-placeholder {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  min-height: 220px;
  margin-top: 12px;
  border: 2px solid #c7d3e1;
  border-radius: 12px;
  overflow: hidden;
  background: var(--theme-panel, #ffffff);
}

.ticket-bottom-cell {
  min-width: 0;
  border-right: 1px solid #c7d3e1;
  padding: 10px;
  color: #9aa9bc;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.ticket-bottom-cell:last-child {
  border-right: 0;
}

.ticket-bottom-cell-totals {
  padding: 0;
  color: inherit;
  text-transform: none;
  letter-spacing: normal;
}

.ticket-bottom-cell-totals .appointment-ticket-totals {
  height: 100%;
  margin-top: 0;
  border: 0;
  border-radius: 0;
  background: linear-gradient(var(--theme-panel, #f8fbff), #edf4fb);
}

.ticket-bottom-cell-totals .checkout-grand-total strong {
  font-size: 16px;
}

.ticket-table-hint {
  margin: 7px 0 0;
  color: var(--theme-quiet, #5b7088);
  font-size: 11px;
}

.ticket-search-popover {
  position: absolute;
  z-index: 30;
  width: min(360px, calc(100% - 16px));
  max-height: 320px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px;
  border: 1px solid #8fa5bf;
  border-radius: var(--radius-tight);
  background: var(--theme-panel, #f8fbff);
  box-shadow: 0 16px 32px rgba(38, 60, 84, 0.18);
}

.ticket-search-header,
.ticket-search-popover-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-shrink: 0;
}

.ticket-search-close {
  width: 28px;
  height: 28px;
}

.ticket-search-controls,
.ticket-search-popover-controls {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  flex-shrink: 0;
}

.ticket-search-field {
  display: grid;
  gap: 3px;
  min-width: 0;
  color: var(--theme-quiet, #50677f);
  font-size: 11px;
  font-weight: 700;
  flex-shrink: 0;
}

.ticket-search-field select,
.ticket-search-field input {
  min-height: 30px;
  padding: 5px 7px;
  font-size: 12px;
  font-weight: 500;
}

.ticket-search-list,
.ticket-search-popover-list {
  display: grid;
  gap: 4px;
  min-height: 0;
  max-height: 150px;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-right: 2px;
  flex: 1 1 auto;
}

.ticket-search-item {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  min-height: 34px;
  padding: 6px 7px;
  border: 1px solid var(--theme-border, #b8c6d8);
  border-radius: var(--radius-tight);
  background: var(--theme-panel, #ffffff);
  color: var(--theme-text, #263c54);
  text-align: left;
}

.ticket-search-item:hover,
.ticket-search-item:focus-visible {
  border-color: #c47e2a;
  background: #fff8e8;
}

.ticket-search-code {
  color: #19446b;
  font-weight: 800;
}

.ticket-search-name {
  min-width: 0;
  overflow-wrap: anywhere;
}

.ticket-search-price {
  color: #426f2d;
  font-weight: 800;
  text-align: right;
}

.ticket-search-empty {
  margin: 0;
  padding: 10px;
  color: var(--theme-quiet, #5b7088);
  text-align: center;
}

.checkout-status-pill {
  flex: 0 0 auto;
  padding: 4px 8px;
  border: 1px solid #87a0be;
  border-radius: var(--radius-tight);
  background: linear-gradient(var(--theme-panel, #ffffff), var(--theme-panel, #dce8f7));
  color: #345a83;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.checkout-status-pill.is-closed {
  border-color: #799966;
  background: linear-gradient(#f5fff1, #dcefd2);
  color: #426f2d;
}

.checkout-ticket-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 8px 0;
}

.checkout-ticket-meta span {
  padding: 3px 7px;
  border: 1px solid #b2c2d5;
  border-radius: var(--radius-tight);
  background: var(--theme-panel, #f8fbff);
  color: var(--theme-quiet, #50677f);
  font-size: 11px;
  font-weight: 700;
}

.checkout-lines,
.checkout-totals {
  display: grid;
  gap: 6px;
  padding: 9px;
  border: 1px solid var(--theme-border, #b9c8d9);
  border-radius: var(--radius-tight);
  background: linear-gradient(var(--theme-panel, #f8fbff), #edf4fb);
}

.checkout-line,
.checkout-totals > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.checkout-line span,
.checkout-totals span {
  color: var(--theme-quiet, #5b7088);
  font-size: 12px;
}

.checkout-line strong,
.checkout-totals strong {
  color: var(--theme-text, #263c54);
  text-align: right;
}

.checkout-payment-grid {
  margin-top: 10px;
}

.checkout-totals {
  margin-top: 10px;
}

.checkout-grand-total {
  padding-top: 6px;
  border-top: 1px solid var(--theme-border, #b7c5d6);
}

.checkout-grand-total strong {
  color: #19446b;
  font-size: 18px;
}

.checkout-note-field {
  margin-top: 10px;
}

.checkout-actions {
  margin-top: 10px;
}

.service-catalog-modal-card {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(1320px, calc(100vw - 36px));
  height: min(860px, calc(100svh - 44px));
  max-width: calc(100vw - 36px);
  max-height: calc(100svh - 44px);
  border: 1px solid var(--classic-frame-border, #9ab7ce);
  border-radius: 16px;
  box-shadow: 0 24px 64px color-mix(in srgb, var(--theme-text, #21133d) 28%, transparent);
  background: var(--classic-frame-bg, #bcd4e6);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  overflow: hidden;
  z-index: 1000;
}

.service-catalog-modal-card .app-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 18px;
  background: linear-gradient(135deg, var(--classic-header-bg, #221d3b) 0%, var(--theme-text, #342459) 100%);
  color: #ffffff;
  border-bottom: 1px solid rgba(255, 255, 255, 0.14);
  user-select: none;
}

.service-catalog-modal-card .drawer-eyebrow {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.75);
  margin-bottom: 2px;
}

.service-catalog-modal-card .app-modal-header h2 {
  font-size: 17px;
  font-weight: 700;
  color: #ffffff;
  line-height: 1.2;
}

.service-catalog-modal-card .modal-summary {
  font-size: 11.5px;
  color: rgba(255, 255, 255, 0.85);
  margin-top: 2px;
}

.service-catalog-modal-card .app-modal-close {
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
}

.service-catalog-modal-card .app-modal-close:hover {
  background: rgba(255, 255, 255, 0.25);
  color: #ffffff;
}

.service-catalog-body {
  display: grid;
  grid-template-columns: minmax(500px, 1.35fr) minmax(420px, 1fr);
  gap: 14px;
  min-height: 0;
  height: 100%;
  padding: 14px;
  background: var(--classic-frame-bg, #bcd4e6);
  overflow: hidden;
}

.service-catalog-picker-card,
.service-catalog-detail-card {
  background: var(--theme-panel, #ffffff);
  border: 1px solid var(--theme-border, #cad9e6);
  border-radius: 14px;
  box-shadow: 0 4px 16px color-mix(in srgb, var(--theme-text, #21133d) 5%, transparent);
  display: flex;
  flex-direction: column;
  min-height: 0;
  height: 100%;
  overflow: hidden;
}

.service-catalog-picker-card {
  padding: 12px;
}

.service-catalog-detail-card {
  padding: 14px;
  overflow-y: auto;
}

.service-catalog-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  flex-shrink: 0;
}

.service-catalog-search-field {
  flex: 1 1 auto;
  min-width: 0;
}

.service-catalog-search-field input {
  width: 100%;
  height: 36px;
  padding: 0 14px;
  border-radius: 9999px;
  border: 1px solid var(--theme-border, #cad7e2);
  background: var(--theme-panel, #ffffff);
  font-size: 12px;
  color: var(--theme-text, #221d3b);
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.service-catalog-search-field input:focus {
  border-color: var(--theme-accent, #d98c2b);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--theme-accent, #ec665c) 20%, transparent);
}

.service-sort-field {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 700;
  color: var(--theme-quiet, #475569);
  flex-shrink: 0;
}

.service-sort-field select {
  height: 34px;
  border-radius: 8px;
  border: 1px solid var(--theme-border, #cad7e2);
  background: var(--theme-panel, #f8fafc);
  font-size: 11.5px;
  font-weight: 600;
  padding: 0 8px;
  color: var(--theme-text, #221d3b);
}

.service-new-btn {
  flex-shrink: 0;
  height: 36px;
  padding: 0 16px;
  border-radius: 9999px;
  background: linear-gradient(135deg, var(--theme-accent, #d98c2b) 0%, #b45309 100%);
  color: #ffffff;
  font-weight: 700;
  font-size: 12px;
  border: none;
  cursor: pointer;
  box-shadow: 0 2px 8px color-mix(in srgb, var(--theme-accent, #ec665c) 30%, transparent);
  transition: all 0.15s ease;
}

.service-new-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px color-mix(in srgb, var(--theme-accent, #ec665c) 40%, transparent);
}

.service-category-chips {
  display: flex;
  align-items: center;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 6px;
  margin-bottom: 10px;
  scrollbar-width: none;
  flex-shrink: 0;
}

.service-category-chips::-webkit-scrollbar {
  display: none;
}

.service-category-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 12px;
  border-radius: 9999px;
  border: 1px solid var(--theme-border, #cad7e2);
  background: var(--theme-panel, #f1f5f9);
  color: var(--theme-quiet, #334155);
  font-size: 11.5px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
  user-select: none;
}

.service-category-chip:hover {
  background: var(--theme-panel, #e2e8f0);
  border-color: var(--theme-border, #94a3b8);
}

.service-category-chip.is-active {
  background: var(--theme-accent, #ec665c);
  border-color: var(--theme-accent, #ec665c);
  color: #ffffff;
  box-shadow: 0 2px 8px color-mix(in srgb, var(--theme-accent, #ec665c) 35%, transparent);
}

.service-category-chip .chip-count {
  font-size: 10px;
  font-weight: 800;
  padding: 1px 6px;
  border-radius: 9999px;
  background: rgba(0, 0, 0, 0.08);
}

.service-category-chip.is-active .chip-count {
  background: rgba(255, 255, 255, 0.25);
  color: #ffffff;
}

.service-catalog-sort-head {
  display: grid;
  grid-template-columns: minmax(130px, 1.8fr) minmax(50px, 0.6fr) minmax(85px, 1fr) minmax(75px, 0.8fr) minmax(75px, 0.8fr) minmax(65px, 0.7fr);
  gap: 6px;
  padding: 6px 10px;
  border: 1px solid var(--theme-border, #cad7e2);
  border-radius: 8px;
  background: #f4f7fb;
  align-items: center;
  flex-shrink: 0;
}

.service-catalog-sort-head button {
  min-height: 28px;
  border: 0;
  background: transparent;
  color: var(--theme-text, #221d3b);
  text-align: left;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  cursor: pointer;
  padding: 0;
}

.service-catalog-sort-head button:disabled {
  cursor: default;
  color: var(--theme-quiet, #64748b);
}

.service-catalog-list {
  flex: 1 1 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 6px;
  overflow-y: auto;
  padding-right: 2px;
  min-height: 0;
}

.service-catalog-row {
  display: grid;
  grid-template-columns: minmax(130px, 1.8fr) minmax(50px, 0.6fr) minmax(85px, 1fr) minmax(75px, 0.8fr) minmax(75px, 0.8fr) minmax(65px, 0.7fr);
  grid-template-rows: auto auto;
  gap: 4px 6px;
  align-items: center;
  width: 100%;
  padding: 7px 10px;
  border: 1px solid #e2eaf2;
  border-radius: 8px;
  background: var(--theme-panel, #ffffff);
  text-align: left;
  cursor: pointer;
  transition: all 0.12s ease;
}

.service-catalog-row:hover {
  background: var(--theme-panel, #f0f6fc);
  border-color: #b8d2eb;
}

.service-catalog-row.is-active {
  border-color: var(--theme-accent, #d98c2b);
  background: #fff8eb;
  box-shadow: 0 0 0 1px var(--theme-accent, #d98c2b) inset;
}

.service-catalog-row strong {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--theme-text, #221d3b);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.service-catalog-cell-id {
  font-family: ui-monospace, SFMono-Regular, monospace;
  font-size: 11px;
  font-weight: 700;
  color: var(--theme-quiet, #475569);
  background: var(--theme-panel, #f1f5f9);
  padding: 2px 5px;
  border-radius: 4px;
  text-align: center;
  white-space: nowrap;
}

.service-catalog-cell-category {
  font-size: 11px;
  color: var(--theme-quiet, #64748b);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.service-catalog-cell-duration {
  font-size: 11px;
  font-weight: 700;
  color: #9a4811;
  background: #fdeee3;
  padding: 2px 6px;
  border-radius: 5px;
  text-align: center;
  white-space: nowrap;
}

.service-catalog-cell-price {
  font-size: 11.5px;
  font-weight: 800;
  color: #0f6c49;
  background: #e2f6f0;
  padding: 2px 6px;
  border-radius: 5px;
  text-align: center;
  white-space: nowrap;
}

.service-catalog-cell-status {
  font-size: 10px;
  font-weight: 800;
  color: #166534;
  background: #dcfce7;
  border: 1px solid #bbf7d0;
  padding: 1px 6px;
  border-radius: 9999px;
  text-align: center;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.service-catalog-row-meta {
  grid-column: 1 / -1;
  font-size: 10.5px;
  color: var(--theme-quiet, #64748b);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.service-catalog-row-match {
  grid-column: 1 / -1;
  font-size: 10px;
  font-weight: 700;
  color: #0f6c49;
  background: #e2f6f0;
  padding: 1px 6px;
  border-radius: 4px;
  display: inline-block;
  width: fit-content;
}

.service-catalog-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 0;
}

.service-hero-banner {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 14px;
  background: linear-gradient(135deg, var(--theme-panel, #f8fafc) 0%, var(--theme-panel, #edf4fc) 100%);
  border: 1px solid var(--theme-border, #cad9e6);
  border-radius: 12px;
  margin-bottom: 2px;
}

.service-hero-avatar {
  width: 42px;
  height: 42px;
  border-radius: 9999px;
  background: linear-gradient(135deg, var(--theme-accent, #ec665c) 0%, var(--theme-text, #21133d) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  font-size: 18px;
  flex-shrink: 0;
  box-shadow: 0 2px 6px color-mix(in srgb, var(--theme-text, #21133d) 15%, transparent);
}

.service-hero-info {
  flex: 1 1 auto;
  min-width: 0;
}

.service-hero-eyebrow {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 3px;
}

.service-hero-category-pill {
  font-size: 10.5px;
  font-weight: 700;
  color: #1e3a5f;
  background: #e6f0fa;
  padding: 1px 7px;
  border-radius: 9999px;
}

.service-hero-status-pill {
  font-size: 10px;
  font-weight: 800;
  color: #166534;
  background: #dcfce7;
  border: 1px solid #bbf7d0;
  padding: 1px 6px;
  border-radius: 9999px;
  letter-spacing: 0.04em;
}

.service-hero-status-pill.is-new {
  color: #d97706;
  background: #fef3c7;
  border-color: #fde68a;
}

.service-hero-title {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  color: var(--theme-text, #221d3b);
  line-height: 1.25;
}

.service-summary {
  font-size: 11px;
  color: var(--theme-quiet, #64748b);
  line-height: 1.35;
  margin-top: 4px;
}

.service-section-box {
  background: var(--theme-panel, #ffffff);
  border: 1px solid #dce6f0;
  border-radius: 10px;
  padding: 10px 12px;
}

.service-section-title {
  font-size: 11px;
  font-weight: 800;
  color: var(--theme-text, #221d3b);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 6px;
}

.service-section-hint {
  font-size: 11px;
  color: var(--theme-quiet, #64748b);
  margin: 0 0 8px 0;
}

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

.service-name-field {
  grid-column: 1 / -1;
}

.service-provider-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.service-provider-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 9999px;
  border: 1px solid var(--theme-border, #cad9e6);
  background: var(--theme-panel, #f8fafc);
  color: var(--theme-quiet, #334155);
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  user-select: none;
  transition: all 0.12s ease;
}

.service-provider-chip:hover {
  background: var(--theme-panel, #f1f5f9);
  border-color: var(--theme-border, #94a3b8);
}

.service-provider-chip.is-assigned {
  background: #e6f0fa;
  border-color: #7d9cb8;
  color: #1e3a5f;
  font-weight: 700;
}

.service-provider-chip input {
  display: none;
}

.service-provider-avatar {
  width: 20px;
  height: 20px;
  border-radius: 9999px;
  background: var(--theme-text, #221d3b);
  color: #ffffff;
  font-size: 9px;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.service-provider-chip.is-assigned .service-provider-avatar {
  background: var(--theme-accent, #d98c2b);
}

.service-description-field textarea {
  width: 100%;
  border-radius: 8px;
  border: 1px solid var(--theme-border, #cad7e2);
  padding: 8px;
  font-size: 12px;
  color: var(--theme-text, #221d3b);
  resize: vertical;
}

.service-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid #e2eaf2;
}

.service-actions-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.appointment-modal-card .app-modal-header button {
  cursor: pointer;
}

.appointment-modal-card.is-minimized {
  min-height: 0 !important;
}

.appointment-modal-card.is-minimized .appointment-modal-resize {
  display: none;
}

.appointment-modal-card.is-measuring-min-fit {
  width: max-content !important;
  height: max-content !important;
  min-width: 0 !important;
  min-height: 0 !important;
  max-width: none !important;
  max-height: none !important;
}

.appointment-modal-card.is-measuring-min-fit #appointment-form {
  overflow: visible !important;
}

.appointment-modal-card.is-measuring-min-fit .ticket-table-scroll {
  overflow: visible;
  width: max-content;
  max-width: none;
}

.appointment-modal-card.is-measuring-min-fit .ticket-bottom-placeholder,
.appointment-modal-card.is-measuring-min-fit .appointment-worksheet-placeholder {
  min-height: 0 !important;
}

.appointment-modal-card .appointment-modal-resize-handle {
  position: absolute;
  z-index: 20;
  user-select: none;
  touch-action: none;
}

.appointment-modal-card .resize-edge-n {
  top: 0;
  left: 14px;
  right: 14px;
  height: 8px;
  cursor: ns-resize;
}

.appointment-modal-card .resize-edge-s {
  bottom: 0;
  left: 14px;
  right: 14px;
  height: 8px;
  cursor: ns-resize;
}

.appointment-modal-card .resize-edge-e {
  top: 14px;
  bottom: 14px;
  right: 0;
  width: 8px;
  cursor: ew-resize;
}

.appointment-modal-card .resize-edge-w {
  top: 14px;
  bottom: 14px;
  left: 0;
  width: 8px;
  cursor: ew-resize;
}

.appointment-modal-card .resize-corner-nw {
  top: 0;
  left: 0;
  width: 14px;
  height: 14px;
  cursor: nwse-resize;
}

.appointment-modal-card .resize-corner-ne {
  top: 0;
  right: 0;
  width: 14px;
  height: 14px;
  cursor: nesw-resize;
}

.appointment-modal-card .resize-corner-sw {
  bottom: 0;
  left: 0;
  width: 14px;
  height: 14px;
  cursor: nesw-resize;
}

.appointment-modal-card .resize-corner-se {
  bottom: 0;
  right: 0;
  width: 18px;
  height: 18px;
  cursor: nwse-resize;
}

.appointment-modal-resize {
  position: absolute;
  right: 3px;
  bottom: 3px;
  z-index: 25;
  width: 18px;
  height: 18px;
  padding: 0;
  border: 0;
  background:
    linear-gradient(135deg, transparent 0 46%, rgba(61, 91, 130, 0.48) 47% 53%, transparent 54%),
    linear-gradient(135deg, transparent 0 62%, rgba(61, 91, 130, 0.48) 63% 69%, transparent 70%);
  cursor: nwse-resize;
}

body.is-moving-appointment-popout,
body.is-moving-appointment-popout * {
  cursor: move;
}

body.is-resizing-appointment-popout,
body.is-resizing-appointment-popout * {
  cursor: nwse-resize;
}

body.is-resizing-appointment-popout[data-resize-edge="e"],
body.is-resizing-appointment-popout[data-resize-edge="w"],
body.is-resizing-appointment-popout[data-resize-edge="e"] *,
body.is-resizing-appointment-popout[data-resize-edge="w"] * {
  cursor: ew-resize !important;
}

body.is-resizing-appointment-popout[data-resize-edge="n"],
body.is-resizing-appointment-popout[data-resize-edge="s"],
body.is-resizing-appointment-popout[data-resize-edge="n"] *,
body.is-resizing-appointment-popout[data-resize-edge="s"] * {
  cursor: ns-resize !important;
}

body.is-resizing-appointment-popout[data-resize-edge="nw"],
body.is-resizing-appointment-popout[data-resize-edge="se"],
body.is-resizing-appointment-popout[data-resize-edge="nw"] *,
body.is-resizing-appointment-popout[data-resize-edge="se"] * {
  cursor: nwse-resize !important;
}

body.is-resizing-appointment-popout[data-resize-edge="ne"],
body.is-resizing-appointment-popout[data-resize-edge="sw"],
body.is-resizing-appointment-popout[data-resize-edge="ne"] *,
body.is-resizing-appointment-popout[data-resize-edge="sw"] * {
  cursor: nesw-resize !important;
}

#appointment-form {
  display: flex;
  flex-direction: column;
  flex: 1 1 0;
  min-width: 0;
  min-height: 0;
  height: 100%;
  overflow: hidden;
  padding: 0;
  margin: 0;
}

.appointment-worksheet-top {
  align-items: start;
}

#appointment-form.is-editing-appointment .appointment-worksheet-top,
#appointment-form.is-client-selected .appointment-worksheet-top {
  grid-template-columns: minmax(0, 188px) minmax(0, 1fr);
  justify-content: stretch;
  width: 100%;
  max-width: 100%;
  padding-bottom: 10px;
  border-bottom: 1px solid #1a1a1a;
}

.appointment-info-panel,
.appointment-client-panel {
  display: grid;
  gap: 8px;
  align-content: start;
}

.appointment-info-panel {
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.appointment-info-panel > .panel-caption {
  padding: 0 0 4px;
  border: 0;
  background: transparent;
}

.appointment-info-panel .appointment-slot-grid .ticket-info-row-editable {
  grid-template-columns: minmax(0, 1fr);
  gap: 3px;
}

.appointment-info-panel .ticket-info-row-editable label {
  font-size: 10px;
}

.appointment-info-panel .appointment-slot-summary {
  padding: 0;
  border: 0;
  background: transparent;
}

.appointment-client-panel {
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}

#appointment-form.is-editing-appointment .appointment-client-panel,
#appointment-form.is-client-selected .appointment-client-panel {
  justify-self: end;
  width: min(260px, 100%);
  max-width: 260px;
}

.appointment-client-panel > .panel-caption {
  padding: 0 0 4px;
  border: 0;
  background: transparent;
}

#appointment-form.is-client-selected .appointment-client-panel .appointment-selected-client,
#appointment-form.is-editing-appointment .appointment-client-panel .appointment-selected-client {
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.appointment-client-panel .appointment-lookup-shell {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.appointment-ledger-panel {
  margin-top: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.appointment-slot-summary {
  display: none;
}

.appointment-slot-grid {
  margin-top: 0;
}

.appointment-slot-grid #appointment-date {
  width: 128px;
  max-width: 100%;
  justify-self: start;
}

.appointment-slot-grid #appointment-start {
  width: 72px;
  max-width: 100%;
  justify-self: start;
}

.appointment-ledger-toolbar {
  justify-content: flex-end;
}

.ticket-bottom-cell-actions {
  display: grid;
  place-items: center;
  padding: 12px;
  color: inherit;
  text-transform: none;
  letter-spacing: normal;
}

.appointment-action-buttons {
  display: grid;
  gap: 6px;
  width: min(132px, 100%);
}

.appointment-action-buttons-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.appointment-schedule-close-button,
.appointment-cancel-button,
.appointment-no-show-button {
  width: 100%;
  min-width: 0;
  min-height: 34px;
  padding: 6px 8px;
  font-size: 11px;
  font-weight: 700;
}

.appointment-schedule-close-button {
  font-size: 12px;
  padding-inline: 14px;
}

.appointment-worksheet-lower {
  display: grid;
  gap: 10px;
}

.appointment-worksheet-lower .appointment-buffer-panel {
  margin-top: 0;
}

.appointment-worksheet-lower .appointment-buffer-caption {
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--theme-quiet, #5b7088);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.appointment-worksheet-lower .appointment-buffer-grid {
  border: 1px solid var(--theme-border, #c4d1df);
  border-radius: var(--radius-tight);
  background: #fcfdff;
}

.appointment-worksheet-placeholder {
  min-height: 120px;
}

#appointment-form:not(.is-editing-appointment):not(.is-client-selected) .appointment-info-panel,
#appointment-form:not(.is-editing-appointment):not(.is-client-selected) .appointment-worksheet-lower,
#appointment-form:not(.is-editing-appointment):not(.is-client-selected) .appointment-worksheet-placeholder {
  display: none;
}

#appointment-form:not(.is-editing-appointment):not(.is-client-selected) .appointment-worksheet-top {
  grid-template-columns: minmax(0, 1fr);
}

#appointment-form.is-editing-appointment .appointment-info-panel,
#appointment-form.is-client-selected .appointment-info-panel,
#appointment-form.is-editing-appointment .appointment-slot-summary,
#appointment-form.is-client-selected .appointment-slot-summary {
  display: grid;
}

#appointment-form.is-editing-appointment .appointment-worksheet-placeholder,
#appointment-form.is-client-selected .appointment-worksheet-placeholder {
  display: grid;
}

#appointment-form .appointment-worksheet-lower,
#appointment-form .appointment-worksheet-lower-fields {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.storage-cutover-card {
  width: min(620px, calc(100vw - 20px));
}

.time-block-modal-card {
  width: min(500px, calc(100vw - 24px));
}

.availability-modal-card {
  width: min(520px, calc(100vw - 24px));
}

.availability-recurring-modal-card {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  width: min(980px, calc(100vw - 32px));
  max-height: min(86svh, 760px);
}

.availability-recurring-modal-card .app-form {
  overflow: auto;
}

.time-block-form {
  gap: 9px;
}

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

.time-block-confirm-popover {
  position: fixed;
  inset: auto 24px 24px auto;
  z-index: 1200;
  width: min(420px, calc(100vw - 32px));
}

.time-block-confirm-card {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid #c6d2df;
  border-radius: var(--radius-card);
  background: var(--theme-panel, #f8fafc);
  box-shadow: 0 18px 38px rgb(15 23 42 / 24%);
}

.time-block-confirm-card h2 {
  margin: 0;
  font-size: 1.05rem;
  color: #263548;
}

.time-block-confirm-summary {
  margin: 0;
  color: #4d5c6e;
  font-size: 0.88rem;
}

.time-block-confirm-details {
  padding: 9px 10px;
  border: 1px solid #d7c6a8;
  border-radius: var(--radius-tight);
  background: #fff8ea;
  color: #4d3a1f;
  font-weight: 700;
}

.time-block-confirm-actions {
  justify-content: flex-end;
  margin-top: 2px;
}

.appointment-slot-summary {
  display: grid;
  gap: 5px;
  padding: 6px;
}

.appointment-slot-summary > .panel-caption {
  padding: 4px 6px;
}

.appointment-slot-summary-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.appointment-slot-summary-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 5px 7px;
  border: 1px solid #d6e1ef;
  border-radius: var(--radius-tight);
  background: rgba(255, 255, 255, 0.72);
}

.appointment-slot-summary-item span {
  color: #58708d;
  font-weight: 700;
}

.appointment-lookup-shell {
  display: grid;
  gap: 6px;
}

.appointment-lookup-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0;
  align-items: end;
}

.appointment-lookup-field,
.appointment-limit-field {
  margin: 0;
}

.appointment-limit-field {
  min-width: 108px;
}

.appointment-client-results {
  min-height: 220px;
  max-height: 330px;
  overflow-y: auto;
  border: 1px solid #a8bdd8;
  border-radius: var(--radius-tight);
  background: rgba(255, 255, 255, 0.36);
}

.appointment-selected-meta,
.lookup-result-meta {
  color: #5b728c;
  line-height: 1.35;
}

.appointment-selected-label,
.appointment-ticket-caption {
  color: #516d90;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
}

.appointment-clear-client {
  justify-self: start;
}

.appointment-client-change-back {
  justify-self: start;
  min-height: 24px;
  padding: 2px 10px;
}

.appointment-new-client-fields {
  display: grid;
  gap: 6px;
  padding: 7px;
  border: 1px solid #d7c07b;
  border-radius: var(--radius-tight);
  background: linear-gradient(#fffbe9, #f6edd0);
}

.appointment-modal-card .lookup-results-shell,
.appointment-modal-card .lookup-intro {
  padding: 6px 8px;
}

.appointment-modal-card .lookup-results-shell {
  gap: 6px;
}

.appointment-modal-card .lookup-result-button {
  padding: 5px 8px;
}

.appointment-client-list {
  display: grid;
}

.appointment-client-row {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1.75fr) auto;
  align-items: center;
  gap: 8px;
  min-height: 20px;
  padding: 3px 8px;
  border: 0;
  border-bottom: 1px solid rgba(112, 139, 174, 0.2);
  border-radius: 0;
  text-align: left;
}

.appointment-client-row:nth-child(odd) {
  background: rgba(232, 242, 253, 0.92);
}

.appointment-client-row:nth-child(even) {
  background: rgba(246, 250, 255, 0.96);
}

.appointment-client-row:hover,
.appointment-client-row:focus-visible,
.appointment-client-row.is-selected {
  background: rgba(216, 232, 251, 1);
}

.appointment-client-row strong {
  overflow: hidden;
  color: #213b5c;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.appointment-client-row .lookup-result-meta {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.appointment-no-show-badge {
  min-width: 82px;
  padding: 2px 6px;
  border: 1px solid rgba(89, 111, 87, 0.18);
  border-radius: var(--radius-tight);
  background: var(--no-show-rate-bg, #e5f4dc);
  color: #33452f;
  font-size: 11px;
  font-weight: 700;
  text-align: center;
  white-space: nowrap;
}

.appointment-modal-card .form-grid {
  gap: 6px 8px;
}

.appointment-modal-card .form-field {
  gap: 2px;
}

.appointment-modal-card textarea {
  min-height: 62px;
}

.appointment-ticket-caption {
  display: none;
}

#appointment-form.appointment-creation-form:not(.is-editing-appointment):not(.is-client-selected) .appointment-slot-summary,
#appointment-form.appointment-creation-form:not(.is-editing-appointment):not(.is-client-selected) .appointment-selected-client,
#appointment-form.appointment-creation-form:not(.is-editing-appointment):not(.is-client-selected) .appointment-clear-client,
#appointment-form.appointment-creation-form:not(.is-editing-appointment) .client-context-banner,
#appointment-form.appointment-creation-form:not(.is-editing-appointment) .appointment-ticket-caption,
#appointment-form.appointment-creation-form:not(.is-editing-appointment) .appointment-service-grid,
#appointment-form.appointment-creation-form:not(.is-editing-appointment) .appointment-buffer-panel,
#appointment-form.appointment-creation-form:not(.is-editing-appointment) .appointment-notes-field {
  display: none;
}

#appointment-form.appointment-creation-form:not(.is-editing-appointment) .appointment-lookup-shell {
  min-height: 0;
}

#appointment-form.appointment-creation-form:not(.is-editing-appointment) .appointment-client-results {
  min-height: min(330px, 44vh);
  max-height: min(430px, 52vh);
}

#appointment-form.is-client-selected .appointment-new-client-fields {
  display: none;
}

#appointment-form.is-client-selected .appointment-selected-client {
  display: grid;
  gap: 4px;
  padding: 8px;
  border: 1px solid var(--theme-border, #c4d1df);
  border-radius: var(--radius-tight);
  background: rgba(255, 255, 255, 0.82);
}

.appointment-form-controls {
  display: none !important;
}

.appointment-ticket-actions {
  justify-content: space-between;
  align-items: center;
}

.appointment-ticket-actions-left,
.appointment-ticket-actions-right {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

#appointment-form.is-client-selected .appointment-selected-client strong,
#appointment-form.is-editing-appointment .appointment-selected-client strong {
  color: #24384f;
  font-size: 16px;
  line-height: 1.15;
}

#appointment-form.is-client-selected .appointment-selected-meta {
  font-size: 11px;
}

#appointment-form.is-client-selected .appointment-clear-client {
  min-height: 22px;
  padding: 1px 8px;
  justify-self: start;
}

#appointment-form .appointment-ticket-caption,
#appointment-form .appointment-service-grid,
#appointment-form #appointment-client-context {
  display: none !important;
}

#appointment-form.is-client-selected .appointment-lookup-header,
#appointment-form.is-client-selected .appointment-client-results {
  display: none !important;
}

.appointment-buffer-panel {
  display: grid;
  gap: 0;
  margin-top: -3px;
}

.appointment-buffer-panel .panel-caption {
  padding: 4px 6px;
  border: 1px solid var(--theme-border, #9fb5d0);
  border-bottom: 0;
  border-radius: var(--radius-tight) var(--radius-tight) 0 0;
  background: linear-gradient(#f4f8fd, #e0ebf8);
  color: #36536f;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.appointment-buffer-grid {
  display: grid;
  grid-template-columns: 0.72fr 0.72fr minmax(0, 1.7fr);
  gap: 5px;
  padding: 6px;
  border: 1px solid var(--theme-border, #9fb5d0);
  border-radius: 0 0 var(--radius-tight) var(--radius-tight);
  background: var(--theme-panel, #edf4fc);
}

.appointment-buffer-grid .inline-note {
  align-self: center;
  min-height: 32px;
  padding: 5px 7px;
  border: 1px solid var(--theme-border, #c1d1e4);
  border-radius: var(--radius-tight);
  background: rgba(255, 255, 255, 0.56);
  color: var(--theme-quiet, #50677f);
  font-size: 11px;
}

#appointment-form.is-client-selected .appointment-notes-field textarea {
  min-height: 52px;
}

.client-context-item {
  display: grid;
  gap: 2px;
  padding: 7px 8px;
  border: 1px solid rgba(140, 112, 25, 0.18);
  border-radius: var(--radius-tight);
  background: rgba(255, 255, 255, 0.66);
}

.client-context-label {
  color: #785b06;
  font-weight: 700;
}

