/* Clean Unlinked Locked Text in Table */
.locked-text-tag {
  color: #94a3b8;
  font-size: 0.75rem;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  user-select: none;
}

/* Action Button Locked State */
.btn-wa-locked,
.action-btn.btn-locked-action {
  background: #f1f5f9 !important;
  color: #94a3b8 !important;
  border-color: #cbd5e1 !important;
  opacity: 0.5 !important;
  cursor: pointer !important;
}
.action-btn.btn-locked-action:hover {
  background: #e2e8f0 !important;
  color: #64748b !important;
}

/* Clear Filters Solid Button in Quick Filters Row */
.btn-clear-quick-solid {
  background: #0f172a !important;
  color: #ffffff !important;
  border: 1px solid #0f172a !important;
  font-weight: 700 !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 6px !important;
  cursor: pointer !important;
  border-radius: 999px !important;
  padding: 6px 14px !important;
  font-size: 0.78rem !important;
  margin-left: 6px !important;
  transition: all 0.15s ease !important;
}
.btn-clear-quick-solid:hover {
  background: #1e293b !important;
  transform: translateY(-1px) !important;
}

/* Settings & Templates Modal */
.modal-backdrop-custom {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.75);
  backdrop-filter: blur(4px);
  z-index: 3000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.modal-card-custom {
  background: #ffffff;
  border-radius: 14px;
  max-width: 560px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.2);
  position: relative;
  display: flex;
  flex-direction: column;
}
.modal-header-custom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px;
  border-bottom: 1px solid #e2e8f0;
}
.modal-title-custom {
  font-size: 1.15rem;
  font-weight: 700;
  color: #0f172a;
  display: flex;
  align-items: center;
  gap: 8px;
}
.modal-body-custom {
  padding: 20px 22px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.modal-footer-custom {
  padding: 14px 22px;
  border-top: 1px solid #e2e8f0;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  background: #f8fafc;
  border-radius: 0 0 14px 14px;
}
.tag-pills {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin: 6px 0 12px 0;
}
.tag-pill {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  color: #1d4ed8;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 4px;
  cursor: pointer;
}
.tag-pill:hover {
  background: #dbeafe;
}
.template-card {
  border: 1.5px solid #e2e8f0;
  border-radius: 8px;
  padding: 12px 14px;
  background: #f8fafc;
}
.template-card.active {
  border-color: #ff8426;
  background: #fff7ed;
}
.template-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
.template-card-title {
  font-size: 0.85rem;
  font-weight: 700;
  color: #0f172a;
  display: flex;
  align-items: center;
  gap: 8px;
}
.template-textarea {
  width: 100%;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  padding: 8px 10px;
  font-size: 0.8rem;
  font-family: inherit;
  resize: vertical;
  min-height: 60px;
  background: #ffffff;
  box-sizing: border-box;
}
.template-textarea:focus {
  border-color: #ff8426;
  outline: none;
}
.btn-save-settings {
  background: #ff8426;
  color: #ffffff;
  border: none;
  padding: 8px 18px;
  border-radius: 6px;
  font-weight: 700;
  font-size: 0.85rem;
  cursor: pointer;
}
.btn-save-settings:hover {
  background: #ea580c;
}
.btn-close-modal {
  background: transparent;
  border: none;
  cursor: pointer;
  color: #64748b;
  display: flex;
  align-items: center;
  justify-content: center;
}
.btn-close-modal:hover {
  color: #0f172a;
}

/* Minimal edition marker: visible only in Demo builds. */
.demo-edition-tag {
  display: inline-flex;
  align-items: center;
  margin-left: 8px;
  padding: 2px 7px;
  border: 1px solid #fb923c;
  border-radius: 999px;
  color: #c2410c;
  background: #fff7ed;
  font-size: 0.62rem;
  line-height: 1.25;
  font-weight: 800;
  letter-spacing: 0.08em;
  vertical-align: middle;
}

.settings-data-tools {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.settings-data-tools .btn-data-tool {
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  background: #ffffff;
  color: #334155;
  padding: 7px 10px;
  font-size: 0.76rem;
  font-weight: 700;
  cursor: pointer;
}

.state-count-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
}
.state-count-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--line, #e2e8f0);
  border-radius: 12px;
  background: var(--card, #ffffff);
}
.state-count-item strong { color: #ea580c; }

.attachment-preview-content img,
.attachment-preview-content iframe {
  display: block;
  width: 100%;
  max-height: 68vh;
  border: 0;
  object-fit: contain;
  background: #f8fafc;
}
.attachment-preview-content iframe { height: 68vh; }

@media (max-width: 720px) {
  /* Mirror desktop's showing/filtered count in the compact mobile meta row. */
  .meta-count {
    display: inline-flex !important;
    width: 100%;
    margin-top: 4px;
    font-size: 0.76rem !important;
    white-space: normal !important;
  }

  /* Never cover row 50 with a fixed pagination footer. */
  .grid-table-container > .pagination-bar,
  .grid-table-container > .pagination-bar.is-mobile-sticky {
    position: static !important;
    inset: auto !important;
    width: 100% !important;
    min-width: 100% !important;
    margin: 0 !important;
    box-shadow: none !important;
  }
  .grid-table-container { padding-bottom: max(12px, env(safe-area-inset-bottom)) !important; }
}
