/* ============================================================
   Appointment Book — full-viewport grid layout
   Loaded only on appointment-book.html.
   ============================================================ */

/* Make the page fill the viewport exactly — no page-level scroll.
   All scrolling happens inside the grid's own overflow container. */
html, body { overflow: hidden; height: 100vh; }

/* .app-main is injected by appshell. Override to suppress its natural scroll. */
.app-main { overflow: hidden; min-height: 0; }

/* ── Page wrapper (sits below the sticky topbar injected by appshell) ── */
.ab-page {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* ── Controls bar ── */
.ab-controls {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-color);
  flex-wrap: wrap;
}

.ab-btn {
  padding: 5px 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-strong);
  background: var(--bg-card);
  color: var(--text-main);
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s, border-color 0.15s;
  white-space: nowrap;
}
.ab-btn:hover { background: var(--bg-subtle); }
.ab-btn-icon { padding: 5px 9px; font-size: 11px; }
.ab-btn-sm { padding: 4px 8px; font-size: 11.5px; }

.ab-date-label {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-main);
  min-width: 200px;
  text-align: center;
}

.ab-jump-group {
  display: flex;
  gap: 4px;
  margin-left: 6px;
}

.ab-date-input {
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  padding: 4px 8px;
  font-size: 12.5px;
  font-family: inherit;
  background: var(--bg-input);
  color: var(--text-main);
  cursor: pointer;
}
.ab-date-input:focus { outline: none; border-color: var(--border-focus); box-shadow: var(--glow); }

.ab-check-label {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 12.5px;
  color: var(--text-muted);
  cursor: pointer;
  white-space: nowrap;
  user-select: none;
}
.ab-check-label input { cursor: pointer; accent-color: var(--brand-accent); }
.ab-check-label:hover { color: var(--text-main); }

.ab-controls-spacer { flex: 1; }

/* ── Waiting list & Openings UI ── */
.ab-waitlist-wrap { position: relative; margin-right: 6px; }
.ab-waitlist-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
}
.ab-waitlist-badge {
  background: var(--brand-primary, #2563eb);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
  min-width: 16px;
  height: 16px;
  border-radius: 99px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
}
.ab-waitlist-badge.has-matches {
  background: #16a34a;
  animation: pulse-green 2s infinite;
}
@keyframes pulse-green {
  0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(22, 163, 74, 0.7); }
  70% { transform: scale(1.08); box-shadow: 0 0 0 6px rgba(22, 163, 74, 0); }
  100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(22, 163, 74, 0); }
}

.ab-waitlist-panel {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  width: 380px;
  max-height: 480px;
  overflow-y: auto;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  z-index: 50;
}
.ab-waitlist-panel.open { display: block; }
.ab-waitlist-panel-header {
  padding: 10px 12px;
  font-weight: 700;
  font-size: 13px;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-main);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.ab-waitlist-tabs {
  display: flex;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-subtle);
}
.ab-waitlist-tab {
  flex: 1;
  padding: 8px 6px;
  font-size: 11.5px;
  font-weight: 600;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  color: var(--text-muted);
  text-align: center;
}
.ab-waitlist-tab.active {
  color: var(--brand-primary, #2563eb);
  border-bottom-color: var(--brand-primary, #2563eb);
  background: var(--bg-card);
}
.ab-waitlist-list {
  padding: 4px 0;
}
.ab-waitlist-empty {
  padding: 24px 16px;
  text-align: center;
  font-size: 12.5px;
  color: var(--text-muted);
}
.ab-waitlist-card {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-color);
  font-size: 12.5px;
  transition: background 0.15s ease;
}
.ab-waitlist-card:last-child { border-bottom: none; }
.ab-waitlist-card:hover { background: var(--bg-hover, rgba(0,0,0,0.02)); }
.ab-waitlist-card.is-match {
  background: #f0fdf4;
  border-left: 3px solid #16a34a;
}
.ab-waitlist-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 3px;
}
.ab-waitlist-card-name {
  font-weight: 700;
  color: var(--text-main);
}
.ab-waitlist-card-phone {
  font-size: 11.5px;
  color: var(--text-muted);
}
.ab-waitlist-card-services {
  color: var(--text-main);
  font-size: 12px;
  margin: 2px 0 4px;
}
.ab-waitlist-card-time {
  font-size: 11.5px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}
.ab-waitlist-card-matchinfo {
  margin: 6px 0 4px;
  padding: 4px 8px;
  background: #dcfce7;
  color: #166534;
  font-size: 11.5px;
  border-radius: var(--radius-sm);
  font-weight: 600;
}
.ab-waitlist-card-actions {
  display: flex;
  gap: 6px;
  margin-top: 6px;
}
.ab-waitlist-card-actions button {
  flex: 1;
  padding: 4px 8px;
  font-size: 11.5px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  cursor: pointer;
  border: 1px solid var(--border-color);
  background: var(--bg-subtle);
  color: var(--text-main);
}
.ab-waitlist-card-actions button.ab-wl-book-btn {
  background: #16a34a;
  color: #fff;
  border-color: #16a34a;
}
.ab-waitlist-card-actions button.ab-wl-book-btn:hover {
  background: #15803d;
}
.ab-waitlist-card-actions button.ab-wl-del-btn {
  flex: 0 0 28px;
  color: #dc2626;
}

/* Add waitlist service row inside modal */
.ab-wl-service-row {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 6px;
}
.ab-wl-service-row input { font-size: 12.5px; }

/* ── Cancellation-requests bell + dropdown ── */
.ab-cancelreq-wrap { position: relative; }
.ab-cancelreq-btn { position: relative; }
.ab-cancelreq-badge {
  position: absolute;
  top: -5px;
  right: -5px;
  background: #dc2626;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
  min-width: 16px;
  height: 16px;
  border-radius: 99px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 3px;
}
.ab-cancelreq-panel {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  width: 320px;
  max-height: 360px;
  overflow-y: auto;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  z-index: 50;
}
.ab-cancelreq-panel.open { display: block; }
.ab-cancelreq-panel-header {
  padding: 10px 12px;
  font-weight: 700;
  font-size: 13px;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-main);
}
.ab-cancelreq-empty {
  padding: 16px 12px;
  font-size: 12.5px;
  color: var(--text-muted);
  text-align: center;
}
.ab-cancelreq-item {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-color);
  font-size: 12.5px;
}
.ab-cancelreq-item:last-child { border-bottom: none; }
.ab-cancelreq-item-name { font-weight: 600; color: var(--text-main); }
.ab-cancelreq-item-meta { color: var(--text-muted); margin: 2px 0 8px; }
.ab-cancelreq-item-actions { display: flex; gap: 6px; }
.ab-cancelreq-item-actions button {
  flex: 1;
  padding: 5px 0;
  font-size: 11.5px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  cursor: pointer;
  border: 1px solid var(--border-color);
  background: var(--bg-subtle);
  color: var(--text-main);
}
.ab-cancelreq-item-actions button.ab-cancelreq-keep {
  border-color: #16a34a;
  color: #16a34a;
}
.ab-cancelreq-item-actions button.ab-cancelreq-keep:hover { background: #f0fdf4; }
.ab-cancelreq-item-actions button:hover { background: var(--border-color); }

/* ── Online Booking Review Queue ── */
.ab-onlinequeue-wrap { position: relative; }
.ab-onlinequeue-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-main);
}
.ab-onlinequeue-badge {
  background: #3b82f6;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
  min-width: 16px;
  height: 16px;
  border-radius: 99px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
}
.ab-onlinequeue-badge.has-pending {
  background: #2563eb;
  animation: pulse-badge 2s infinite;
}

@keyframes pulse-badge {
  0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(37, 99, 235, 0.7); }
  70% { transform: scale(1.08); box-shadow: 0 0 0 6px rgba(37, 99, 235, 0); }
  100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(37, 99, 235, 0); }
}

.ab-onlinequeue-panel {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  width: 360px;
  max-height: 420px;
  overflow-y: auto;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  z-index: 50;
}
.ab-onlinequeue-panel.open { display: block; }
.ab-onlinequeue-panel-header {
  padding: 10px 12px;
  font-weight: 700;
  font-size: 13px;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-main);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.ab-onlinequeue-empty {
  padding: 20px 12px;
  font-size: 12.5px;
  color: var(--text-muted);
  text-align: center;
}
.ab-onlinequeue-item {
  padding: 12px;
  border-bottom: 1px solid var(--border-color);
  font-size: 12.5px;
  background: var(--bg-subtle);
  cursor: pointer;
  transition: background 0.15s ease, transform 0.1s ease;
}
.ab-onlinequeue-item:hover {
  background: var(--bg-card);
}
.ab-onlinequeue-item:last-child { border-bottom: none; }
.ab-onlinequeue-item-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}
.ab-onlinequeue-item-name { font-weight: 600; color: var(--text-main); font-size: 13px; }
.ab-onlinequeue-item-price { font-weight: 700; color: #10b981; }
.ab-onlinequeue-badge-new {
  background: #8b5cf6;
  color: white;
  font-size: 9.5px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 6px;
  margin-left: 4px;
}
.ab-onlinequeue-item-meta { color: var(--text-main); margin-bottom: 4px; }
.ab-onlinequeue-item-time { color: var(--text-muted); font-size: 11.5px; margin-bottom: 8px; }
.ab-onlinequeue-item-time-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--accent, #2563eb);
  cursor: pointer;
  text-decoration: underline dotted;
  font-weight: 500;
}
.ab-onlinequeue-item-time-link:hover {
  text-decoration: underline solid;
}
.ab-onlinequeue-item-actions { display: flex; gap: 6px; }
.ab-onlinequeue-item-actions button {
  flex: 1;
  padding: 6px 0;
  font-size: 11.5px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  cursor: pointer;
  border: 1px solid var(--border-color);
}
.ab-onlinequeue-item-actions .ab-btn-approve {
  background: #10b981;
  color: white;
  border-color: #059669;
}
.ab-onlinequeue-item-actions .ab-btn-approve:hover { background: #059669; }
.ab-onlinequeue-item-actions .ab-btn-open {
  background: var(--bg-card);
  color: var(--text-main);
}
.ab-onlinequeue-item-actions .ab-btn-open:hover { background: var(--border-color); }
.ab-onlinequeue-item-actions .ab-btn-decline {
  background: transparent;
  color: #ef4444;
  border-color: rgba(239, 68, 68, 0.4);
}
.ab-onlinequeue-item-actions .ab-btn-decline:hover { background: rgba(239, 68, 68, 0.1); }

@keyframes ab-appt-pulse {
  0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(37, 99, 235, 0.7); }
  50% { transform: scale(1.02); box-shadow: 0 0 0 8px rgba(37, 99, 235, 0); }
  100% { transform: scale(1); box-shadow: var(--shadow-sm); }
}
.ab-block.ab-target-highlight {
  animation: ab-appt-pulse 0.7s ease-in-out 3;
  z-index: 25 !important;
}

/* Online Booking Real-Time Toast */
.ab-onlinequeue-toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: #1e293b;
  border: 1px solid #3b82f6;
  border-radius: 10px;
  padding: 14px 18px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5), 0 0 15px rgba(59, 130, 246, 0.25);
  z-index: 9999;
  max-width: 320px;
  animation: slide-in-toast 0.3s ease-out;
}

@keyframes slide-in-toast {
  from { transform: translateY(30px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.ab-onlinequeue-toast-title {
  font-weight: 700;
  font-size: 13.5px;
  color: #60a5fa;
  margin-bottom: 4px;
}
.ab-onlinequeue-toast-body {
  font-size: 12.5px;
  color: #e2e8f0;
  line-height: 1.4;
  margin-bottom: 10px;
}
.ab-onlinequeue-toast-actions button {
  background: #3b82f6;
  color: white;
  border: none;
  border-radius: 6px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

/* ── Toast stack ── */
.ab-toast-stack {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.ab-toast {
  width: 300px;
  background: var(--bg-card);
  border: 1px solid #dc2626;
  border-left: 4px solid #dc2626;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  padding: 10px 12px;
  font-size: 12.5px;
  animation: ab-toast-in .2s ease;
}
@keyframes ab-toast-in {
  from { opacity: 0; transform: translateX(20px); }
  to   { opacity: 1; transform: translateX(0); }
}
.ab-toast-title { font-weight: 700; color: #991b1b; margin-bottom: 3px; }
.ab-toast-body { color: var(--text-main); }

.ab-load-status {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
}

.ab-last-updated {
  font-size: 11.5px;
  color: var(--text-muted);
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  border-radius: 99px;
  padding: 3px 10px;
  white-space: nowrap;
  transition: color 0.3s;
}
/* Brief flash to green when fresh data arrives */
.ab-last-updated.ab-updated-flash {
  color: var(--success);
  border-color: var(--success);
}

/* ── Scrollable grid container ── */
.ab-grid-outer {
  flex: 1;
  min-height: 0;
  overflow: auto;
  position: relative;
}

.ab-grid-inner {
  display: flex;
  flex-direction: column;
  min-width: max-content;   /* expand to hold all columns */
}

.ab-empty-msg {
  padding: 48px 32px;
  color: var(--text-muted);
  font-size: 14px;
  text-align: center;
}

/* ── Header row (sticky top) ── */
.ab-header {
  display: flex;
  position: sticky;
  top: 0;
  z-index: 30;
  background: var(--bg-card);
  border-bottom: 2px solid var(--brand-accent);
}

/* Corner cell: sticky in both axes */
.ab-corner {
  width: 64px;
  flex-shrink: 0;
  position: sticky;
  left: 0;
  z-index: 31;
  background: var(--bg-card);
  border-right: 1px solid var(--border-color);
  border-bottom: 2px solid var(--brand-accent);
}

.ab-col-head {
  flex: 1 0 160px;
  padding: 8px 6px;
  text-align: center;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-main);
  border-right: 1px solid var(--border-color);
  line-height: 1.3;
  cursor: grab;
  user-select: none;
  transition: background 0.15s, opacity 0.15s, box-shadow 0.15s;
  position: relative;
}
.ab-col-head:active { cursor: grabbing; }
.ab-col-head:hover { background: var(--bg-subtle); }
.ab-col-head.ab-col-dragging {
  opacity: 0.45;
  background: var(--bg-subtle);
}
.ab-col-head.ab-col-dragover-left {
  box-shadow: inset 3px 0 0 0 var(--brand-accent);
}
.ab-col-head.ab-col-dragover-right {
  box-shadow: inset -3px 0 0 0 var(--brand-accent);
}
.ab-col-head .ab-col-head-sub {
  font-size: 11px;
  font-weight: 400;
  color: var(--text-muted);
  margin-top: 1px;
}

/* ── Body row (contains time col + stylist cols) ── */
.ab-body {
  display: flex;
  position: relative;
}

/* ── Time axis column (sticky left) ── */
.ab-time-col {
  width: 64px;
  flex-shrink: 0;
  position: sticky;
  left: 0;
  z-index: 20;
  background: var(--bg-color);
  border-right: 1px solid var(--border-color);
}

.ab-time-inner {
  position: relative;
  /* height set inline from JS: TOTAL_MIN * PX_PER_MIN */
}

.ab-time-label {
  position: absolute;
  right: 8px;
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1;
  /* top set inline from JS */
}

/* ── Stylist column ── */
.ab-col {
  flex: 1 0 160px;
  position: relative;
  border-right: 1px solid var(--border-color);
  cursor: crosshair;   /* click-to-book affordance; blocks override with grab */
  /* height set inline from JS */
  /* Grid lines: hourly (strongest) > 30-min > 15-min (subtlest) */
  background-image:
    repeating-linear-gradient(
      to bottom,
      transparent 0,
      transparent 119px,
      var(--border-color) 119px,
      var(--border-color) 120px
    ),
    repeating-linear-gradient(
      to bottom,
      transparent 0,
      transparent 59px,
      rgba(0,0,0,0.12) 59px,
      rgba(0,0,0,0.12) 60px
    ),
    repeating-linear-gradient(
      to bottom,
      transparent 0,
      transparent 29px,
      rgba(0,0,0,0.07) 29px,
      rgba(0,0,0,0.07) 30px
    );
}

/* ── Appointment block ── */
.ab-block {
  position: absolute;
  left: 3px;
  right: 3px;
  border-radius: 5px;
  padding: 4px 6px;
  overflow: hidden;
  cursor: pointer;
  font-size: 11.5px;
  line-height: 1.35;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.15s, transform 0.1s;
  /* Left border = status indicator; background set inline per category */
  border-left: 3px solid #94a3b8;
  background: #f1f5f9;           /* fallback; overridden by JS */
  color: #1e293b;                /* always dark — pastels guarantee contrast */
  user-select: none;
  touch-action: none;            /* allow pointer events to handle touch drag */
}
.ab-block:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
  z-index: 5;
}

/* Confirmed: dark-blue left border */
.ab-block.ab-confirmed {
  border-left-color: #1e40af;
}

/* Checked in: green left border */
.ab-block.ab-checked-in {
  border-left-color: #16a34a;
}

/* Cancel requested (via SMS reply): red left border */
.ab-block.ab-cancel-requested {
  border-left-color: #dc2626;
}

/* Closed tickets: pale gray ticket styling (DaySmart style) */
.ab-block.ab-closed {
  background: #e2e8f0 !important;
  border-left-color: #64748b;
  color: #475569;
  opacity: 0.82;
}
.ab-block.ab-closed .ab-block-name {
  color: #334155;
}
.ab-block.ab-closed .ab-block-sub {
  color: #64748b;
  opacity: 0.9;
}
/* Unconfirmed online booking: dotted blue border */
.ab-block.ab-unconfirmed-online {
  border: 2.5px dotted #2563eb !important;
  box-shadow: 0 0 0 1px rgba(37, 99, 235, 0.25), var(--shadow-sm);
  background-image: repeating-linear-gradient(
    45deg,
    transparent,
    transparent 6px,
    rgba(37, 99, 235, 0.05) 6px,
    rgba(37, 99, 235, 0.05) 12px
  );
}

.ab-status-badge.ab-status-online-pending {
  background: #dbeafe;
  color: #1d4ed8;
  border: 1px dotted #3b82f6;
}

/* Web booking indicator (overlaid badge, not a state) */
.ab-block.ab-web::after {
  content: "🌐";
  position: absolute;
  top: 3px;
  right: 4px;
  font-size: 10px;
}

.ab-block-name {
  font-weight: 600;
  font-size: 11.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ab-block-sub {
  font-size: 10.5px;
  opacity: 0.72;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ab-block-tags {
  font-size: 10px;
  margin-top: 2px;
  letter-spacing: 0.05em;
}
/* Condensed view for very short blocks */
.ab-block.ab-tiny .ab-block-sub,
.ab-block.ab-tiny .ab-block-tags { display: none; }

/* ── Group connector — thin line bridging the gap between grouped services ── */
.ab-group-connector {
  position: absolute;
  left: 3px;
  width: 3px;
  border-left: 3px solid #94a3b8;
  z-index: 2;
  pointer-events: none;
  opacity: 0.65;
}

/* Continuation block — slightly de-emphasised so the first block leads visually */
.ab-block.ab-continuation {
  opacity: 0.88;
}

/* ── Off-hours shading — non-working portions of each stylist column ── */
.ab-off-zone {
  position: absolute;
  left: 0;
  right: 0;
  background: rgba(0, 0, 0, 0.055);
  pointer-events: none;
  /* No z-index — DOM order keeps zones below appointment blocks */
}

/* ── Outside-hours warning on appointment blocks ── */
.ab-block.ab-outside-hours {
  outline: 1.5px dashed #d97706;
  outline-offset: -1px;
}
/* Warning badge at bottom-right (top-right is reserved for ab-web::after) */
.ab-block.ab-outside-hours::before {
  content: "⚠";
  position: absolute;
  bottom: 2px;
  right: 4px;
  font-size: 9px;
  line-height: 1;
  color: #d97706;
}

/* Warning strip in the detail panel */
.ab-outside-warn {
  background: #fef3c7;
  border: 1px solid #d97706;
  border-radius: var(--radius-md);
  padding: 7px 12px;
  font-size: 12.5px;
  color: #92400e;
  margin-bottom: 12px;
}

/* ── Current-time indicator ── */
.ab-now-line {
  position: absolute;
  left: 0;
  right: 0;
  height: 2px;
  background: #ef4444;
  z-index: 15;
  pointer-events: none;
}
.ab-now-line::before {
  content: "";
  position: absolute;
  left: -1px;
  top: -4px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #ef4444;
}

/* ── Detail drawer ── */
.ab-detail {
  position: fixed;
  top: var(--topbar-height);
  right: 0;
  width: 320px;
  height: calc(100vh - var(--topbar-height));
  background: var(--bg-card);
  border-left: 1px solid var(--border-color);
  box-shadow: -4px 0 20px rgba(15, 23, 42, 0.1);
  z-index: 60;
  overflow-y: auto;
  transform: translateX(100%);
  transition: transform 0.25s ease;
  display: flex;
  flex-direction: column;
}
.ab-detail.open {
  transform: translateX(0);
}

.ab-detail-close {
  position: sticky;
  top: 0;
  background: var(--bg-card);
  border: none;
  font-size: 16px;
  cursor: pointer;
  color: var(--text-muted);
  padding: 12px 14px;
  text-align: right;
  display: block;
  width: 100%;
  border-bottom: 1px solid var(--border-color);
  transition: color 0.15s;
  z-index: 1;
}
.ab-detail-close:hover { color: var(--text-main); }

.ab-detail-body {
  padding: 16px;
  flex: 1;
}

.ab-detail-name {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 2px;
}
.ab-detail-phone {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 12px;
}
.ab-phone-copy {
  color: var(--brand-accent);
  cursor: pointer;
}
.ab-phone-copy:hover { text-decoration: underline; }

.ab-alert-box {
  background: #fef3c7;
  border: 1px solid #d97706;
  border-radius: var(--radius-md);
  padding: 8px 12px;
  font-size: 12.5px;
  color: #92400e;
  margin-bottom: 12px;
  line-height: 1.4;
}

.ab-alert-box.ab-alert-medical {
  background: #fef2f2;
  border: 1.5px solid #dc2626;
  color: #7f1d1d;
  font-weight: 500;
  box-shadow: 0 1px 4px rgba(220, 38, 38, 0.15);
}

.ab-detail-section {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted);
  margin: 14px 0 6px;
}

.ab-detail-services {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.ab-detail-svc {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
  padding: 6px 0;
  border-bottom: 1px solid var(--border-color);
  font-size: 13px;
}
.ab-detail-svc:last-child { border-bottom: none; }
.ab-detail-svc-name { font-weight: 500; }
.ab-detail-svc-time { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.ab-detail-svc-price {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-main);
  flex-shrink: 0;
}

.ab-detail-meta {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 12.5px;
  color: var(--text-muted);
  margin-bottom: 16px;
}
.ab-detail-meta strong { color: var(--text-main); }

.ab-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 99px;
  font-size: 11.5px;
  font-weight: 600;
}
.ab-status-unconfirmed { background: #fef9c3; color: #854d0e; }
.ab-status-confirmed   { background: #dbeafe; color: #1e40af; }
.ab-status-checked-in  { background: #dcfce7; color: #14532d; }
.ab-status-cancelrequested { background: #fee2e2; color: #991b1b; }
.ab-status-closed      { background: #e2e8f0; color: #475569; }

.ab-checkin-btn {
  width: 100%;
  padding: 10px;
  background: var(--brand-accent);
  color: white;
  border: none;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s;
  margin-top: 16px;
}
.ab-checkin-btn:hover { background: var(--brand-accent-hover); }
.ab-checkin-btn:disabled { opacity: 0.6; cursor: not-allowed; }

/* ── Backdrop (close detail on click outside) ── */
.ab-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 59;
  background: rgba(0, 0, 0, 0.15);
}
.ab-backdrop.visible { display: block; }

/* ── Drag & drop ── */

/* Grab cursor on draggable blocks (checked-in blocks stay pointer) */
.ab-block:not(.ab-checked-in) { cursor: grab; }

/* Dim source blocks during drag */
.ab-block.ab-dragging-source {
  opacity: 0.35;
  pointer-events: none;
}

/* Cut appointment visual feedback */
.ab-block.ab-cut-source {
  opacity: 0.5;
  filter: grayscale(35%);
  outline: 2px dashed var(--accent, #6366f1);
  outline-offset: -2px;
}

/* Floating ghost block */
.ab-drag-ghost {
  position: fixed;
  z-index: 9999;
  pointer-events: none;
  width: 160px;
  min-height: 50px;
  border-radius: 5px;
  padding: 4px 6px;
  font-size: 11.5px;
  line-height: 1.35;
  color: #1e293b;
  border-left: 3px solid #94a3b8;
  box-shadow: 0 8px 24px rgba(0,0,0,0.22);
  opacity: 0.9;
  transform: rotate(1.5deg);
}
.ab-drag-count {
  font-size: 10px;
  color: rgba(30,41,59,0.65);
  margin-top: 2px;
}

/* ── Service block resizing ── */
.ab-resize-handle {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 8px;
  cursor: ns-resize;
  z-index: 10;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  touch-action: none;
}
.ab-resize-handle::after {
  content: "";
  display: block;
  width: 28px;
  height: 2.5px;
  border-radius: 2px;
  background: rgba(0, 0, 0, 0.25);
  margin-bottom: 2px;
  opacity: 0;
  transition: opacity 0.15s, background-color 0.15s;
}
.ab-block:hover .ab-resize-handle::after,
.ab-resize-handle:hover::after {
  opacity: 1;
}
.ab-resize-handle:hover::after {
  background: rgba(0, 0, 0, 0.5);
}

.ab-block.ab-resizing {
  z-index: 50 !important;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25) !important;
  transition: none !important;
  user-select: none;
}
.ab-block.ab-resizing .ab-resize-handle::after {
  opacity: 1;
  background: var(--primary, #2563eb);
}

/* Duration badge overlay shown during resize */
.ab-resize-badge {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(15, 23, 42, 0.88);
  color: #ffffff;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 12px;
  white-space: nowrap;
  pointer-events: none;
  z-index: 60;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.3);
  letter-spacing: 0.02em;
  display: flex;
  align-items: center;
  gap: 4px;
}
.ab-resize-badge .ab-resize-badge-end {
  font-size: 10px;
  font-weight: 500;
  opacity: 0.82;
}

/* Drop target highlight on columns */
.ab-col.ab-drop-target {
  background-color: rgba(59,130,246,0.08);
  outline: 2px dashed rgba(59,130,246,0.4);
  outline-offset: -2px;
}

/* ── Drop line (precise landing indicator during drag) ── */
#abDropLine {
  display: none;
  position: absolute;
  left: 64px;
  height: 0;
  border-top: 2px dashed rgba(59,130,246,0.85);
  z-index: 25;     /* above blocks (~5), below sticky header (30) */
  pointer-events: none;
}
.ab-drop-line-label {
  position: absolute;
  top: 3px;
  left: 0;
  font-size: 10px;
  font-weight: 700;
  color: #3b82f6;
  background: #fff;
  padding: 1px 5px;
  border-radius: 3px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.14);
  line-height: 1.4;
  letter-spacing: 0.01em;
}

/* ── Hold bar ── */
.ab-hold-bar {
  flex: 0 0 auto;
  display: none;           /* shown only when has-items */
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  background: var(--bg-subtle);
  border-bottom: 2px dashed var(--border-color);
  overflow-x: auto;
  min-height: 56px;
  transition: background 0.2s, border-color 0.2s;
}
.ab-hold-bar.has-items  { display: flex; }
.ab-hold-bar.drag-active {
  display: flex;
  border-color: rgba(59,130,246,0.35);
  background: rgba(59,130,246,0.04);
}
.ab-hold-bar.drag-active .ab-hold-bar-label::after {
  content: " — drop here to hold";
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  opacity: 0.7;
}
.ab-hold-bar.ab-drop-target {
  background: rgba(59,130,246,0.1);
  border-color: var(--brand-accent);
}

.ab-hold-bar-label {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted);
  white-space: nowrap;
  flex-shrink: 0;
}

.ab-hold-card {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 10px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  cursor: grab;
  user-select: none;
  touch-action: none;
}
.ab-hold-card:hover { box-shadow: var(--shadow-md); border-color: var(--brand-accent); }
.ab-hold-card-name { font-size: 12px; font-weight: 600; color: var(--text-main); }
.ab-hold-card-meta { font-size: 10.5px; color: var(--text-muted); }
.ab-hold-card-remove {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 14px;
  padding: 2px 4px;
  line-height: 1;
  border-radius: 4px;
  flex-shrink: 0;
}
.ab-hold-card-remove:hover { color: var(--text-main); background: var(--bg-subtle); }

/* ── New Appointment Modal ── */

.ab-modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  z-index: 1100;
  align-items: center;
  justify-content: center;
  padding: 16px;
  box-sizing: border-box;
  overflow-y: auto;
}
.ab-modal-overlay.open { display: flex; }

.ab-modal {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: 0 20px 60px rgba(15, 23, 42, 0.22);
  width: 430px;
  max-width: min(430px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  margin: auto;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
/* Wider variant for the multi-line ticket dialog */
.ab-modal.ab-modal-wide {
  width: 980px;
  max-width: min(980px, calc(100vw - 32px));
}

.ab-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border-color);
  flex-shrink: 0;
}
.ab-modal-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-main);
}
.ab-modal-close-btn {
  background: none;
  border: none;
  font-size: 15px;
  color: var(--text-muted);
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
  line-height: 1;
}
.ab-modal-close-btn:hover { color: var(--text-main); background: var(--bg-subtle); }

.ab-modal-body {
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow-y: auto;
  flex: 1 1 auto;
  min-height: 0;
}

.ab-modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 20px;
  border-top: 1px solid var(--border-color);
  flex-shrink: 0;
  background: var(--bg-card);
  position: sticky;
  bottom: 0;
  z-index: 10;
}

.ab-form-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

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

.ab-form-label {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.ab-form-static {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-main);
  padding: 6px 0;
}

.ab-form-input {
  padding: 7px 10px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  background: var(--bg-input);
  color: var(--text-main);
  font-size: 13px;
  font-family: inherit;
  width: 100%;
  box-sizing: border-box;
}
.ab-form-input:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: var(--glow);
}

/* ── Lookup-select rows (select + Edit button side by side) ── */
.ab-lookup-row {
  display: flex;
  gap: 6px;
  align-items: center;
}
.ab-lookup-row select.ab-form-input {
  flex: 1;
  min-width: 0;
}

/* ── Lookup edit modal (sits above main modal) ── */
.ab-lookup-edit-overlay { z-index: 1200; }

.ab-lookup-item-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 2px;
  border-bottom: 1px solid var(--border-color);
  font-size: 13px;
  color: var(--text-main);
}
.ab-lookup-item-row:last-child { border-bottom: none; }

.ab-lookup-del-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 14px;
  padding: 0 4px;
  line-height: 1;
  border-radius: 3px;
}
.ab-lookup-del-btn:hover { color: var(--error, #dc2626); background: var(--bg-subtle); }

.ab-lookup-add-row {
  display: flex;
  gap: 8px;
  margin-top: 4px;
}
.ab-lookup-add-row .ab-form-input { flex: 1; }

.ab-form-error {
  font-size: 12.5px;
  color: var(--error, #dc2626);
  min-height: 1em;
}

/* Client search typeahead dropdown */
.ab-client-results {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  margin-top: 2px;
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  z-index: 10;
  max-height: 180px;
  overflow-y: auto;
}
.ab-client-result {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 7px 12px;
  font-size: 13px;
  cursor: pointer;
  gap: 8px;
}
.ab-client-result:hover { background: var(--bg-subtle); }
.ab-client-result + .ab-client-result { border-top: 1px solid var(--border-color); }
.ab-cr-name   { font-weight: 500; color: var(--text-main); }
.ab-cr-phone  { font-size: 11.5px; color: var(--text-muted); flex-shrink: 0; }
.ab-client-noresult { color: var(--text-muted); cursor: default; font-style: italic; }
.ab-client-noresult:hover { background: none; }

/* Primary action button */
.ab-btn-primary {
  background: var(--brand-accent);
  color: #fff;
  border-color: var(--brand-accent);
}
.ab-btn-primary:hover:not(:disabled) { background: var(--brand-accent-hover); }
.ab-btn-primary:disabled { opacity: 0.6; cursor: not-allowed; }

/* ── Ungroup button in detail panel ── */
.ab-ungroup-btn {
  width: 100%;
  padding: 7px 10px;
  background: none;
  color: var(--brand-accent);
  border: 1px solid var(--brand-accent);
  border-radius: var(--radius-md);
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s;
  margin-top: 8px;
}
.ab-ungroup-btn:hover { background: rgba(59,130,246,0.07); }

.ab-edit-btn {
  width: 100%;
  padding: 7px 10px;
  background: var(--brand-accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-md);
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s;
  margin-top: 8px;
}
.ab-edit-btn:hover { background: var(--brand-accent-hover); }

/* ── Hover card ── */

#abHoverCard {
  position: fixed;
  z-index: 500;
  width: 268px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: 0 8px 24px -4px rgba(15,23,42,0.18), 0 2px 6px rgba(15,23,42,0.08);
  padding: 13px 14px 11px;
  pointer-events: none;
  display: none;
  max-height: 380px;
  overflow: hidden;
}
#abHoverCard.visible { display: block; }

.ab-hc-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ab-hc-phone {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 8px;
}
.ab-hc-status {
  margin-bottom: 8px;
}
/* Reuse .ab-alert-box from the detail panel — no extra styles needed */
.ab-hc-alert { margin-bottom: 8px; }

.ab-hc-divider {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted);
  margin: 8px 0 5px;
}
.ab-hc-svc {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 6px;
  padding: 4px 0;
  border-bottom: 1px solid var(--border-color);
  font-size: 12.5px;
}
.ab-hc-svc:last-child { border-bottom: none; }
.ab-hc-svc-left { min-width: 0; }
.ab-hc-svc-name { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ab-hc-svc-time { font-size: 11.5px; color: var(--text-muted); }
.ab-hc-svc-price { font-size: 12.5px; font-weight: 600; flex-shrink: 0; color: var(--text-main); }
.ab-hc-total {
  margin-top: 7px;
  font-size: 12.5px;
  font-weight: 600;
  text-align: right;
  color: var(--text-main);
  border-top: 1px solid var(--border-color);
  padding-top: 6px;
}

/* ── Ticket dialog — line items ── */

/* Column grid shared by the header row and each line row:
   badge | search | employee | time | dur/qty | price | discount | tax | backbar | remove */
.ab-line-col-heads,
.ab-line-row {
  display: grid;
  grid-template-columns: 24px minmax(180px, 1fr) 140px 80px 76px 82px 90px 32px 82px 24px;
  align-items: center;
  gap: 6px;
}

.ab-line-col-heads {
  padding: 0 0 5px;
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 4px;
}

.ab-line-row {
  padding: 4px 0;
  border-bottom: 1px solid var(--border-color);
}
.ab-line-row:last-child { border-bottom: none; }

/* S / P type badge */
.ab-line-badge {
  width: 22px;
  height: 22px;
  border-radius: 3px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10.5px;
  font-weight: 700;
  flex-shrink: 0;
  user-select: none;
}
.ab-line-badge-s  { background: #dbeafe; color: #1e40af; }
.ab-line-badge-p  { background: #dcfce7; color: #15803d; }
.ab-line-badge-gc { background: #fef9c3; color: #854d0e; }

/* Search input wrapper (position:relative allows the dropdown to anchor here) */
.ab-line-search-wrap { position: relative; }

/* Line search dropdown results - expand cleanly outside tight cell bounds */
.ab-line-results {
  min-width: 480px !important;
  max-width: 620px !important;
  width: max-content !important;
  z-index: 9999 !important;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.22);
}

.ab-line-results .ab-client-result {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  gap: 16px;
  white-space: nowrap;
}

.ab-line-results .ab-cr-name {
  font-weight: 600;
  color: var(--text-main);
  white-space: nowrap;
}

.ab-line-results .ab-cr-phone {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
  flex-shrink: 0;
  text-align: right;
}

/* Compact inputs in line rows */
.ab-line-row .ab-form-input {
  padding: 5px 6px;
  font-size: 12.5px;
}

/* Employee select within a line */
.ab-line-emp-sel {
  width: 100%;
  padding: 5px 4px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  background: var(--bg-input);
  color: var(--text-main);
  font-size: 12px;
  font-family: inherit;
  cursor: pointer;
  min-width: 0;
}
.ab-line-emp-sel:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: var(--glow);
}

/* "time not applicable" placeholder cell for product lines */
.ab-line-time-ph {
  height: 29px;
  border-radius: var(--radius-md);
  background: var(--bg-subtle);
  border: 1px dashed var(--border-color);
}

/* Number-with-unit compound cell (dur/qty, price, backbar) */
.ab-line-num-wrap {
  display: flex;
  align-items: center;
  gap: 2px;
  min-width: 0;
}
.ab-line-num-wrap .ab-form-input {
  min-width: 0;
  flex: 1;
  padding: 5px 4px;
  text-align: right;
}
.ab-line-unit {
  font-size: 10.5px;
  color: var(--text-muted);
  white-space: nowrap;
  flex-shrink: 0;
  user-select: none;
}

/* Remove-line button */
.ab-line-remove {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 15px;
  line-height: 1;
  padding: 2px 3px;
  border-radius: 4px;
  flex-shrink: 0;
}
.ab-line-remove:hover { color: #dc2626; background: #fee2e2; }

/* Empty-lines message */
.ab-lines-empty {
  padding: 14px 0;
  text-align: center;
  font-size: 12.5px;
  color: var(--text-muted);
  font-style: italic;
}

/* Section header above line grid */
.ab-lines-header {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted);
  margin-bottom: 6px;
}

/* Add-line button row */
.ab-lines-add {
  display: flex;
  gap: 6px;
  padding-top: 8px;
}

/* Ticket total */
.ab-ticket-total {
  text-align: right;
  font-size: 14px;
  font-weight: 700;
  color: var(--text-main);
  padding-top: 8px;
  border-top: 1px solid var(--border-color);
  margin-top: 4px;
}

/* ── Time Blocks ── */
.ab-timeblock {
  position: absolute;
  left: 3px;
  right: 3px;
  border-radius: 5px;
  padding: 4px 6px;
  overflow: hidden;
  cursor: pointer;
  font-size: 11.5px;
  background: repeating-linear-gradient(
    -45deg,
    #e2e8f0,
    #e2e8f0 5px,
    #cbd5e1 5px,
    #cbd5e1 10px
  );
  border-left: 3px solid #64748b;
  color: #475569;
  z-index: 2;
  user-select: none;
  touch-action: none;
}
.ab-timeblock:hover {
  border-left-color: #334155;
  filter: brightness(0.96);
}
.ab-timeblock-label {
  font-weight: 600;
  font-size: 11px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Phantom block shown while drag-to-create is in progress */
.ab-timeblock-phantom {
  position: absolute;
  left: 3px;
  right: 3px;
  border-radius: 5px;
  background: rgba(100, 116, 139, 0.2);
  border: 2px dashed #64748b;
  pointer-events: none;
  z-index: 10;
}

/* Danger/delete button variant */
.ab-btn-danger {
  background: #fee2e2;
  color: #b91c1c;
  border-color: #fca5a5;
}
.ab-btn-danger:hover:not(:disabled) {
  background: #fecaca;
}

/* Print Slip Modal Stylings */
.ps-note-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 8px;
  border-radius: var(--radius-sm);
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  transition: background 0.15s;
  cursor: pointer;
  user-select: none;
}
.ps-note-item:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-strong);
}
.ps-note-item input[type="checkbox"] {
  margin-top: 3px;
  flex-shrink: 0;
  width: 15px;
  height: 15px;
  cursor: pointer;
}
.ps-note-content {
  flex: 1;
  font-size: 12.5px;
  line-height: 1.4;
}
.ps-note-meta {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 500;
  margin-bottom: 3px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}
.ps-note-tag {
  background: var(--brand-indigo);
  color: white;
  padding: 1px 6px;
  border-radius: 3px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
}
.ps-note-text {
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--text-main);
}

.ab-print-btn {
  width: 100%;
  padding: 10px;
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  color: var(--text-main);
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s, border-color 0.15s;
  margin-top: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  box-shadow: var(--shadow-sm);
}
.ab-print-btn:hover {
  background: var(--bg-subtle);
  border-color: var(--text-muted);
}

/* ── Repeat Conflict Preview ── */
.ab-repeat-preview-wrap {
  margin-top: 12px;
  border-radius: var(--radius-sm, 6px);
  font-size: 12px;
  line-height: 1.4;
  border: 1px solid var(--border-color);
  background: var(--bg-subtle);
  overflow: hidden;
}
.ab-repeat-status-bar {
  padding: 8px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-weight: 500;
}
.ab-repeat-status-bar.clear {
  background: rgba(34, 197, 94, 0.1);
  color: #16a34a;
  border-left: 4px solid #22c55e;
}
.ab-repeat-status-bar.conflict {
  background: rgba(239, 68, 68, 0.1);
  color: #dc2626;
  border-left: 4px solid #ef4444;
}
.ab-repeat-status-bar.checking {
  background: var(--bg-subtle);
  color: var(--text-muted);
  border-left: 4px solid var(--border-strong);
}
.ab-repeat-dates-wrap {
  padding: 8px 10px;
  background: var(--bg-card, #fff);
  border-top: 1px solid var(--border-color);
  font-size: 11.5px;
}
.ab-repeat-dates-label {
  margin-bottom: 6px;
  color: var(--text-main);
  font-size: 11.5px;
}
.ab-repeat-dates-list {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}
.ab-repeat-date-chip {
  display: inline-flex;
  align-items: center;
  padding: 2px 7px;
  border-radius: var(--radius-sm, 4px);
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  font-size: 11px;
  font-weight: 500;
  white-space: nowrap;
}
.ab-repeat-date-chip.conflict {
  background: rgba(239, 68, 68, 0.12);
  border-color: rgba(239, 68, 68, 0.35);
  color: #dc2626;
  font-weight: 600;
}
.ab-repeat-date-more {
  display: inline-flex;
  align-items: center;
  padding: 2px 6px;
  font-size: 11px;
  color: var(--text-muted);
  font-style: italic;
}
.ab-conflict-list {
  padding: 6px 12px 10px 12px;
  background: rgba(239, 68, 68, 0.03);
  border-top: 1px dashed rgba(239, 68, 68, 0.25);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.ab-conflict-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 6px 8px;
  background: var(--bg-card);
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: 4px;
}
.ab-conflict-date {
  font-weight: 600;
  color: #dc2626;
  font-size: 11.5px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.ab-conflict-detail {
  color: var(--text-main);
  font-size: 11.5px;
}
.ab-conflict-overlap {
  color: var(--text-muted);
  font-size: 11px;
}

/* ============================================================
   Context Menu (Right-Click Menu)
   ============================================================ */

.ab-context-menu {
  position: fixed;
  z-index: 1200;
  min-width: 200px;
  max-width: min(320px, calc(100vw - 24px));
  max-height: calc(100vh - 24px);
  overflow-y: auto;
  overflow-x: hidden;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg, 0 10px 25px -5px rgba(0, 0, 0, 0.25), 0 8px 10px -6px rgba(0, 0, 0, 0.2));
  padding: 3px 0;
  font-size: 12px;
  color: var(--text-main);
  user-select: none;
  animation: abCtxFadeIn 0.12s ease-out;
}

@keyframes abCtxFadeIn {
  from { opacity: 0; transform: scale(0.96); }
  to   { opacity: 1; transform: scale(1); }
}

.ab-ctx-header {
  padding: 5px 11px;
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-subtle, var(--border-color));
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ab-ctx-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4.5px 12px;
  cursor: pointer;
  transition: background 0.1s, color 0.1s;
  color: var(--text-main);
  line-height: 1.35;
}

.ab-ctx-item:hover:not(.disabled) {
  background: var(--bg-subtle, #f1f5f9);
  color: var(--brand-accent, #2563eb);
}

.ab-ctx-item.disabled {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
}

.ab-ctx-item.danger:hover:not(.disabled) {
  background: rgba(239, 68, 68, 0.08);
  color: #dc2626;
}

.ab-ctx-icon {
  width: 16px;
  font-size: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.ab-ctx-label {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ab-ctx-shortcut {
  font-size: 10.5px;
  color: var(--text-muted);
  margin-left: auto;
}

.ab-ctx-divider {
  height: 1px;
  background: var(--border-color);
  margin: 4px 0;
}

/* ============================================================
   Print Schedule Modal & Print Options Styles
   ============================================================ */

.ab-print-group {
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 8px 12px;
  background: var(--bg-subtle, #f8fafc);
}

.ab-print-group-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.ab-print-radio-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12.5px;
}

.ab-print-radio-row label {
  display: flex;
  align-items: center;
  gap: 7px;
  cursor: pointer;
}

.ab-print-check-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px 10px;
  font-size: 12.5px;
}

.ab-print-check-grid label {
  display: flex;
  align-items: center;
  gap: 7px;
  cursor: pointer;
}

.ab-print-staff-list {
  max-height: 120px;
  overflow-y: auto;
  border: 1px solid var(--border-strong, var(--border-color));
  border-radius: var(--radius-sm);
  padding: 6px 8px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 4px 6px;
  background: var(--bg-card);
}

.ab-print-staff-list label {
  display: flex;
  align-items: center;
  gap: 7px;
  cursor: pointer;
  white-space: nowrap;
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
}


