/* Macroware Loop Interactive Demo Styles */
.demo-meta-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  max-width: 1120px;
  margin: 0 auto 12px;
}

.demo-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 12px;
  border-radius: 999px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
}

.demo-badge-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--primary);
}

.demo-reset-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  padding: 0 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-surface);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.demo-reset-btn:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}

/* Window / Phone Shell */
.loop-shell {
  position: relative;
  width: 100%;
  min-width: 0;
  max-width: 1120px;
  margin: 0 auto;
  background: var(--bg-page);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  text-align: left;
  color: var(--text-primary);
}

.loop-chrome {
  display: none;
}

@media (min-width: 768px) {
  .loop-chrome {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 38px;
    padding: 0 14px;
    background: var(--bg-sidebar);
    border-bottom: 1px solid var(--border);
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
  }
}

.chrome-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.chrome-left svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.loop-sb-brand svg {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
}

.hud-brand-row svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.chrome-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}

.chrome-glyph {
  width: 24px;
  height: 22px;
  display: grid;
  place-items: center;
  color: var(--text-muted);
  font-size: 12px;
  user-select: none;
}

/* Mobile Phone Frame */
@media (max-width: 767px) {
  .loop-shell {
    max-width: 396px;
    border-radius: 30px;
    border: 4px solid var(--border);
    box-shadow: var(--shadow-lg);
  }
}

.phone-notch {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px 0 4px;
  background: var(--bg-surface);
}

.phone-speaker {
  width: 56px;
  height: 5px;
  border-radius: 999px;
  background: var(--border);
}

@media (min-width: 768px) {
  .phone-notch {
    display: none;
  }
}

/* App Layout */
.loop-body {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 580px;
  background: var(--bg-page);
}

@media (min-width: 768px) {
  .loop-body {
    flex-direction: row;
    height: 640px;
  }
}

@media (min-width: 768px) {
  .loop-shell.loop-large .loop-body {
    height: 700px;
  }
}

/* Sidebar (Desktop + Tablet Icon-only) */
.loop-sidebar {
  display: none;
}

@media (min-width: 768px) {
  .loop-sidebar {
    display: flex;
    flex-direction: column;
    width: 68px;
    flex-shrink: 0;
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border);
    padding: 14px 10px;
    gap: 6px;
  }
  .loop-sb-text,
  .loop-sb-badge,
  .loop-sb-meta,
  .loop-sb-btn-label {
    display: none;
  }
  .loop-sb-brand {
    justify-content: center;
  }
  .loop-nav-item {
    justify-content: center;
    padding: 0;
  }
  .loop-sb-footer-btn {
    justify-content: center;
    padding: 0;
  }
}

@media (min-width: 1025px) {
  .loop-sidebar {
    width: 244px;
    padding: 16px 12px 14px;
  }
  .loop-sb-text,
  .loop-sb-badge,
  .loop-sb-meta,
  .loop-sb-btn-label {
    display: initial;
  }
  .loop-sb-brand {
    justify-content: flex-start;
  }
  .loop-nav-item {
    justify-content: flex-start;
    padding: 0 12px;
  }
  .loop-sb-footer-btn {
    justify-content: flex-start;
    padding: 0 10px;
  }
}

.loop-sb-brand {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 14px;
  padding-inline: 2px;
}

.loop-sb-title {
  font-size: 13px;
  font-weight: 700;
  line-height: 1.2;
  color: var(--text-primary);
}

.loop-sb-sub {
  font-size: 11px;
  color: var(--text-secondary);
}

.loop-nav-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.loop-nav-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  height: 40px;
  width: 100%;
  border: none;
  border-radius: 7px;
  background: transparent;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  transition: background-color 140ms ease, color 140ms ease;
}

.loop-nav-item:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.loop-nav-item.active {
  background: var(--bg-surface);
  color: var(--primary);
  font-weight: 600;
  box-shadow: var(--shadow-sm);
}

.loop-nav-item.active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 10px;
  bottom: 10px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--primary);
}

.loop-nav-item svg {
  width: 17px;
  height: 17px;
  flex-shrink: 0;
}

.loop-sb-text {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.loop-sb-badge {
  min-width: 24px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-surface);
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
}

.loop-nav-item.active .loop-sb-badge {
  background: var(--primary-soft);
  color: var(--primary-text);
  border-color: transparent;
}

.loop-sb-spacer {
  flex: 1;
}

.loop-sb-footer-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  width: 100%;
  border-radius: 7px;
  border: 1px solid var(--border);
  background: var(--bg-surface);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
}

.loop-sb-footer-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.loop-sb-footer-btn svg {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
}

.loop-sb-btn-label {
  flex: 1;
  text-align: left;
}

.loop-kbd {
  font-family: var(--font-mono);
  font-size: 10px;
  padding: 1px 5px;
  border-radius: 4px;
  background: var(--bg-page);
  border: 1px solid var(--border);
  color: var(--text-muted);
}

.loop-sb-meta {
  font-size: 11px;
  color: var(--text-secondary);
  padding: 4px 4px 0;
}

/* Main Workspace Column */
.loop-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  position: relative;
}

/* Top Bar */
.loop-topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 10px;
  padding: 10px 12px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  min-width: 0;
}

@media (min-width: 768px) {
  .loop-topbar {
    flex-wrap: nowrap;
    height: 64px;
    padding: 10px 20px;
  }
}

.loop-top-left {
  min-width: 0;
  flex: 1 1 170px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.loop-page-title {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  line-height: 1.25;
  color: var(--text-primary);
}

@media (min-width: 768px) {
  .loop-page-title {
    font-size: 18px;
  }
}

.loop-progress-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.loop-progress-track {
  width: 68px;
  height: 6px;
  border-radius: 999px;
  background: var(--border);
  overflow: hidden;
  flex-shrink: 0;
}

@media (min-width: 768px) {
  .loop-progress-track {
    width: 140px;
  }
}

.loop-progress-fill {
  height: 100%;
  background: var(--primary);
  border-radius: 999px;
  transition: width 260ms cubic-bezier(0.22, 1, 0.36, 1), background-color 200ms ease;
}

.loop-progress-fill.complete {
  background: var(--success);
}

.loop-progress-text {
  font-size: 11px;
  color: var(--text-secondary);
  white-space: nowrap;
}

.loop-top-right {
  display: flex;
  align-items: center;
  gap: 8px;
  position: relative;
}

.phone-ready-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 32px;
  padding: 0 10px;
  border-radius: 999px;
  background: var(--success-soft);
  color: var(--success-text);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

@media (max-width: 767px) {
  .phone-ready-pill {
    width: 32px;
    padding: 0;
    justify-content: center;
  }
  .phone-ready-label {
    display: none;
  }
}

.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.55);
  animation: dotPulse 2s infinite;
  flex-shrink: 0;
}

@keyframes dotPulse {
  0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.55); }
  70% { box-shadow: 0 0 0 7px rgba(16, 185, 129, 0); }
  100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

.loop-sync-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 34px;
  padding: 0 12px;
  border-radius: 8px;
  border: none;
  background: var(--primary);
  color: #FFFFFF;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.loop-sync-btn:hover {
  background: var(--primary-hover);
}

.loop-sync-btn svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

.loop-sync-btn.syncing svg {
  animation: spinSlow 700ms linear infinite;
}

@media (max-width: 767px) {
  .loop-sync-btn {
    width: 36px;
    padding: 0;
  }
  .loop-sync-label {
    display: none;
  }
}

.loop-mobile-theme-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-surface);
  color: var(--text-primary);
  cursor: pointer;
}

@media (min-width: 768px) {
  .loop-mobile-theme-btn {
    display: none;
  }
}

.loop-kebab-btn {
  display: none;
}

@media (min-width: 768px) {
  .loop-kebab-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--bg-surface);
    color: var(--text-secondary);
    cursor: pointer;
  }
  .loop-kebab-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
  }
}

.kebab-menu {
  position: absolute;
  top: 42px;
  right: 0;
  z-index: 30;
  min-width: 215px;
  padding: 5px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-surface);
  box-shadow: var(--shadow-md);
}

.kebab-item {
  display: flex;
  align-items: center;
  width: 100%;
  padding: 8px 10px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--text-primary);
  font-size: 12px;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
}

.kebab-item:hover {
  background: var(--bg-hover);
}

/* Main Content Scroll Area */
.loop-view {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 12px 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

@media (min-width: 768px) {
  .loop-view {
    padding: 16px 20px 20px;
    gap: 14px;
  }
}

/* Toolbar & Filters */
.loop-toolbar {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

@media (min-width: 960px) {
  .loop-toolbar {
    flex-direction: row;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
  }
}

.loop-search-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

@media (min-width: 960px) {
  .loop-search-wrap {
    width: 220px;
  }
}

.loop-search-wrap svg {
  position: absolute;
  left: 11px;
  width: 15px;
  height: 15px;
  color: var(--text-muted);
  pointer-events: none;
}

.loop-search-input {
  width: 100%;
  height: 36px;
  padding: 0 12px 0 33px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-surface);
  color: var(--text-primary);
  font-size: 13px;
}

.loop-search-input:focus {
  outline: none;
  border-color: var(--primary);
}

.loop-filter-bar {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 3px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-surface);
  overflow-x: auto;
  scrollbar-width: none;
  scroll-snap-type: x proximity;
}

.loop-filter-bar::-webkit-scrollbar {
  display: none;
}

.loop-filter-pill {
  flex-shrink: 0;
  scroll-snap-align: start;
  height: 30px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.loop-filter-pill:hover {
  color: var(--text-primary);
}

.loop-filter-pill.active {
  background: var(--primary-soft);
  color: var(--primary-text);
  border-color: var(--primary);
}

.loop-upcoming-wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
}

@media (min-width: 960px) {
  .loop-upcoming-wrap {
    margin-left: auto;
  }
}

/* Toggle Switch */
.loop-switch {
  position: relative;
  width: 42px;
  height: 24px;
  border-radius: 999px;
  border: none;
  background: var(--border);
  cursor: pointer;
  padding: 0;
  flex-shrink: 0;
  transition: background-color 150ms ease;
}

.loop-switch[aria-checked="true"] {
  background: var(--primary);
}

.loop-switch-thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #FFFFFF;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
  transition: transform 150ms cubic-bezier(0.22, 1, 0.36, 1);
}

.loop-switch[aria-checked="true"] .loop-switch-thumb {
  transform: translateX(18px);
}

/* Reconciliation Strip */
.recon-strip {
  font-size: 12px;
  color: var(--text-secondary);
  padding: 8px 12px;
  border-radius: 8px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
}

.recon-strip strong {
  color: var(--text-primary);
}

/* Desktop Table vs Mobile Stacked Cards */
.loop-table-card {
  display: none;
}

.loop-cards-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

@media (min-width: 768px) {
  .loop-table-card {
    display: block;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    overflow: hidden;
  }
  .loop-cards-list {
    display: none;
  }
}

.loop-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.loop-table th {
  padding: 10px 12px;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border);
  background: var(--bg-surface);
}

.loop-table th.col-actions {
  text-align: center;
  width: 136px;
}

.loop-table th.col-due {
  width: 130px;
}

.loop-table th.col-status {
  width: 158px;
}

.loop-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-subtle);
  vertical-align: middle;
  font-size: 13px;
}

.loop-table tbody tr {
  cursor: pointer;
  transition: background-color 120ms ease;
  animation: rowFadeIn 240ms ease both;
}

.loop-table tbody tr:hover {
  background: var(--bg-hover);
}

.loop-table tbody tr:last-child td {
  border-bottom: none;
}

@keyframes rowFadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

.shop-cell {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.shop-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
}

/* Pastel avatars Light / Saturated Dark */
.av-0 { background: #FFEDD5; color: #9A3412; }
.av-1 { background: #CFFAFE; color: #155E75; }
.av-2 { background: #FCE7F3; color: #9D174D; }
.av-3 { background: #DCFCE7; color: #166534; }
.av-4 { background: #FEF3C7; color: #92400E; }
.av-5 { background: #E0E7FF; color: #3730A3; }
.av-6 { background: #EDE9FE; color: #5B21B6; }

html[data-theme="dark"] .av-0 { background: #9A3412; color: #FFFFFF; }
html[data-theme="dark"] .av-1 { background: #0E7490; color: #FFFFFF; }
html[data-theme="dark"] .av-2 { background: #9D174D; color: #FFFFFF; }
html[data-theme="dark"] .av-3 { background: #15803D; color: #FFFFFF; }
html[data-theme="dark"] .av-4 { background: #B45309; color: #FFFFFF; }
html[data-theme="dark"] .av-5 { background: #4338CA; color: #FFFFFF; }
html[data-theme="dark"] .av-6 { background: #6D28D9; color: #FFFFFF; }

.shop-meta {
  min-width: 0;
}

.shop-name {
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.shop-phone {
  font-size: 12px;
  color: var(--text-secondary);
}

.due-primary {
  font-weight: 600;
  font-size: 12px;
}

.due-primary.overdue { color: var(--danger-text); }
.due-primary.upcoming { color: var(--text-secondary); }

.due-amount {
  font-weight: 700;
  font-size: 13px;
  color: var(--text-primary);
}

.due-cycle {
  font-size: 11px;
  color: var(--text-secondary);
}

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

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 24px;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

.status-pill::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.st-pending { background: var(--warning-soft); color: var(--warning-text); }
.st-done { background: var(--success-soft); color: var(--success-text); }
.st-danger { background: var(--danger-soft); color: var(--danger-text); }
.st-indigo { background: var(--primary-soft); color: var(--primary-text); }
.st-muted { background: var(--bg-hover); color: var(--text-secondary); }

.verified-mini {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--success-soft);
  color: var(--success-text);
  font-size: 11px;
  font-weight: 600;
}

.unverified-icon {
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
}

.note-text {
  color: var(--text-secondary);
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.note-text.is-last {
  font-style: italic;
}

.row-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.row-call-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 32px;
  padding: 0 12px;
  border-radius: 7px;
  border: none;
  background: var(--primary-soft);
  color: var(--primary-text);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.row-call-btn:hover {
  background: var(--primary);
  color: #FFFFFF;
}

.row-verify-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 7px;
  border: 1px solid var(--border);
  background: var(--bg-surface);
  color: var(--text-secondary);
  cursor: pointer;
}

.row-verify-btn:hover {
  background: var(--bg-hover);
  color: var(--success-text);
  border-color: var(--success);
}

/* Mobile Stacked Task Cards */
.m-task-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  cursor: pointer;
}

.m-task-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.m-task-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.m-task-actions {
  display: grid;
  grid-template-columns: 1fr 48px;
  gap: 8px;
}

.m-task-actions .row-call-btn,
.m-task-actions .row-verify-btn {
  height: 44px;
  width: 100%;
}

/* Bottom Tab Bar on Mobile */
.loop-bottom-tabs {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  background: var(--bg-surface);
  border-top: 1px solid var(--border);
  padding: 4px 4px 6px;
}

@media (min-width: 768px) {
  .loop-bottom-tabs {
    display: none;
  }
}

.loop-btab {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-height: 48px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
}

.loop-btab.active {
  color: var(--primary-text);
  background: var(--primary-soft);
}

.loop-btab svg {
  width: 18px;
  height: 18px;
}

/* Empty State */
.loop-empty {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 42px 20px;
  text-align: center;
  color: var(--text-secondary);
  font-size: 14px;
}

/* History & Settings */
.history-subhead {
  margin: 8px 0 0;
  font-size: 14px;
  font-weight: 700;
}

.history-table-wrap {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow-x: auto;
}

.history-table {
  width: 100%;
  min-width: 680px;
  border-collapse: collapse;
  font-size: 12px;
}

.history-table th {
  padding: 9px 12px;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border);
}

.history-table td {
  padding: 9px 12px;
  border-bottom: 1px solid var(--border-subtle);
}

.settings-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.settings-card-title {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
}

.slider-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-subtle);
}

.slider-row:last-child {
  padding-bottom: 0;
  border-bottom: none;
}

.slider-row.disabled {
  opacity: 0.5;
}

.slider-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.slider-title {
  font-size: 13px;
  font-weight: 600;
}

.slider-desc {
  font-size: 12px;
  color: var(--text-secondary);
}

.slider-pill {
  padding: 4px 10px;
  border-radius: 8px;
  background: var(--primary-soft);
  color: var(--primary-text);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.loop-range {
  width: 100%;
  accent-color: var(--primary);
  height: 28px;
  cursor: pointer;
}

@media (max-width: 767px) {
  .loop-range::-webkit-slider-thumb {
    width: 24px;
    height: 24px;
  }
}

.toggle-setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 6px 0;
  font-size: 13px;
  font-weight: 600;
}

.adb-collapse-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  border: none;
  background: transparent;
  padding: 0;
  cursor: pointer;
  text-align: left;
}

/* Shop Inspector Drawer (Desktop right panel / Mobile bottom sheet) */
.inspector-scrim {
  position: absolute;
  inset: 0;
  z-index: 40;
  background: rgba(15, 23, 42, 0.45);
  opacity: 0;
  pointer-events: none;
  transition: opacity 160ms ease;
}

.inspector-scrim.open {
  opacity: 1;
  pointer-events: auto;
}

.inspector-drawer {
  position: absolute;
  z-index: 45;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 18px;
  visibility: hidden;
  transition: transform 180ms cubic-bezier(0.22, 1, 0.36, 1), visibility 180ms ease;
}

.inspector-drawer.open {
  visibility: visible;
}

@media (min-width: 768px) {
  .inspector-drawer {
    top: 0;
    right: 0;
    bottom: 0;
    width: 390px;
    max-width: 92%;
    border-top: none;
    border-right: none;
    border-bottom: none;
    transform: translateX(102%);
  }
  .inspector-drawer.open {
    transform: translateX(0);
  }
  .sheet-handle {
    display: none;
  }
}

@media (max-width: 767px) {
  .inspector-drawer {
    left: 0;
    right: 0;
    bottom: 0;
    max-height: 86%;
    border-radius: 18px 18px 0 0;
    transform: translateY(104%);
    padding-top: 10px;
  }
  .inspector-drawer.open {
    transform: translateY(0);
  }
  .sheet-handle {
    width: 40px;
    height: 4px;
    border-radius: 999px;
    background: var(--border);
    margin: 0 auto 6px;
    flex-shrink: 0;
  }
}

.ins-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.ins-shop {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.ins-box {
  background: var(--bg-page);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ins-kv {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 12px;
}

.ins-kv span:first-child { color: var(--text-secondary); }
.ins-kv span:last-child { font-weight: 600; text-align: right; }

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

.ins-outcome-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 38px;
  padding: 6px 8px;
  border-radius: 8px;
  border: 1px dashed var(--border);
  background: var(--bg-page);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.ins-outcome-btn.unlocked {
  border-style: solid;
  color: var(--text-primary);
}

.ins-outcome-btn.selected {
  border-color: var(--primary);
  background: var(--primary-soft);
  color: var(--primary-text);
}

/* Call HUD Modal (Mandatory Wrap-up, No Close/Cancel) */
.hud-overlay {
  position: absolute;
  inset: 0;
  z-index: 60;
  background: rgba(15, 23, 42, 0.56);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.hud-overlay.open {
  display: flex;
}

.hud-card {
  width: 100%;
  max-width: 500px;
  max-height: 100%;
  overflow-y: auto;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 22px;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

@media (max-width: 767px) {
  .hud-overlay {
    position: fixed;
    inset: 0;
    z-index: 140;
    padding: 0;
    height: 100dvh;
  }
  .hud-card {
    max-width: none;
    height: 100dvh;
    border-radius: 0;
    border: none;
    padding: calc(16px + env(safe-area-inset-top, 0)) 16px calc(16px + env(safe-area-inset-bottom, 0));
  }
}

.hud-brand-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
}

.hud-active-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 10px;
}

.hud-status-pill {
  padding: 4px 14px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  background: var(--primary-soft);
  color: var(--primary-text);
}

.hud-status-pill.live {
  background: var(--success-soft);
  color: var(--success-text);
}

.hud-pulse-avatar {
  position: relative;
  width: 84px;
  height: 84px;
  display: grid;
  place-items: center;
  margin: 4px 0;
}

.hud-pulse-avatar::before,
.hud-pulse-avatar::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid var(--primary);
  opacity: 0;
  animation: ringPulse 2s ease-out infinite;
}

.hud-pulse-avatar::after {
  animation-delay: 1s;
}

.hud-avatar-lg {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 20px;
  font-weight: 700;
  position: relative;
  z-index: 1;
}

.hud-timer {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: 0.03em;
}

.hud-end-btn {
  width: 100%;
  min-height: 44px;
  border-radius: 8px;
  border: none;
  background: var(--danger);
  color: #FFFFFF;
  font-size: 14px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
}

.hud-end-btn:hover {
  background: var(--danger-hover);
}

.hud-order-card {
  width: 100%;
  text-align: left;
  background: var(--bg-page);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.hud-order-item {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
}

.hud-order-qty {
  color: var(--primary-text);
  font-weight: 700;
}

.hud-verify-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--success-soft);
  color: var(--success-text);
  font-size: 12px;
  font-weight: 600;
}

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

@media (min-width: 768px) {
  .hud-outcomes-grid.cols-5 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.hud-outcome-btn {
  min-height: 42px;
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-page);
  color: var(--text-primary);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.hud-outcome-btn:hover {
  border-color: var(--primary);
}

.hud-outcome-btn.selected {
  background: var(--primary-soft);
  color: var(--primary-text);
  border-color: var(--primary);
  box-shadow: 0 0 0 1px var(--primary);
}

.hud-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.hud-chip {
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-page);
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
}

.hud-chip:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}

.hud-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  margin-top: auto;
}

@media (max-width: 767px) {
  .hud-footer {
    position: sticky;
    bottom: 0;
    background: var(--bg-surface);
    padding-bottom: 4px;
  }
  .hud-footer .btn {
    flex: 1;
  }
}

.btn-save-next {
  background: var(--success-btn);
  color: #FFFFFF;
}

.btn-save-next:hover:not(:disabled) {
  background: var(--success-btn-hover);
}

.btn:disabled,
.btn-save-next:disabled {
  opacity: 0.48;
  cursor: not-allowed;
}

/* Demo Toast */
.loop-toast-wrap {
  position: absolute;
  right: 16px;
  bottom: 16px;
  z-index: 70;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

@media (max-width: 767px) {
  .loop-toast-wrap {
    bottom: 66px;
    left: 12px;
    right: 12px;
  }
}

.loop-toast {
  pointer-events: auto;
  min-width: 240px;
  max-width: 330px;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--primary);
  box-shadow: var(--shadow-md);
  font-size: 12px;
  font-weight: 500;
  color: var(--text-primary);
}

.loop-toast.success { border-left-color: var(--success); }
.loop-toast.warning { border-left-color: var(--warning); }

/* Quick Search Palette */
.cmd-overlay {
  position: absolute;
  inset: 0;
  z-index: 55;
  background: rgba(15, 23, 42, 0.45);
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding: 48px 16px;
}

.cmd-overlay.open {
  display: flex;
}

.cmd-card {
  width: 100%;
  max-width: 440px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.cmd-input {
  width: 100%;
  height: 44px;
  padding: 0 14px;
  border: none;
  border-bottom: 1px solid var(--border);
  background: var(--bg-surface);
  color: var(--text-primary);
  font-size: 14px;
}

.cmd-input:focus {
  outline: none;
}

.cmd-results {
  max-height: 260px;
  overflow-y: auto;
  padding: 6px;
}

.cmd-item {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--text-primary);
  font-size: 13px;
  text-align: left;
  cursor: pointer;
}

.cmd-item:hover {
  background: var(--bg-hover);
}
