/* Polaris renklerine yakın Bootstrap CSS değişkenleri */
:root{
  /* Yüzeyler */
  --polaris-surface: #FFFFFF;         /* kart/nav yüzeyi */
  --polaris-bg: #F6F6F7;              /* sayfa arkaplanı */
  --polaris-border: #C9CCCF;          /* sınır/ayraç */
  /* Metin */
  --polaris-text: #202223;            /* ana metin */
  --polaris-text-subdued: #6D7175;    /* ikincil metin */
  /* Aksiyonlar */
  --polaris-primary: #008060;         /* Shopify Primary (yeşil) */
  --polaris-primary-hover: #006E52;
  --polaris-link: #2C6ECB;            /* bilgi/bağlantı mavisi */
}

/* Bootstrap 5.3 CSS değişkenleri üzerinden tema ayarı */
:root{
  --bs-body-bg: var(--polaris-bg);
  --bs-body-color: var(--polaris-text);
  --bs-border-color: var(--polaris-border);
  --bs-primary: var(--polaris-primary);
  --bs-primary-rgb: 0,128,96;
  --bs-link-color: var(--polaris-link);
  --bs-link-hover-color: #1F5199;
  --bs-card-bg: var(--polaris-surface);
}

/* Genel tipografi rötuşları */
h1,h2,h3{ letter-spacing:.2px; }

/* Polaris yüzey sınıfı (navbar vs.) */
.polaris-surface{
  background: var(--polaris-surface) !important;
}
.polaris-text{ color: var(--polaris-text) !important; }
.polaris-text-strong{ color: #111213 !important; }
.polaris-body{ color: var(--polaris-text) !important; }

/* Kartlar: açık yüzey + yumuşak sınır ve köşe */
.polaris-card{
  background: var(--polaris-surface);
  border: 1px solid var(--polaris-border) !important;
  border-radius: 12px !important;
  overflow: hidden !important;
}

/* Card sınıfı ile birlikte kullanıldığında Bootstrap override */
.card.polaris-card {
  border-radius: 12px !important;
  overflow: hidden !important;
}

/* Navbar linkleri (Polaris tonları) */
.navbar .nav-link.polaris-nav{
  color: var(--polaris-text-subdued);
}
.navbar .nav-link.polaris-nav:hover,
.navbar .nav-link.polaris-nav:focus{
  color: var(--polaris-text);
}

/* Tablo başlıkları açık yüzeyde vurgulu dursun */
.table thead th{
  color: var(--polaris-text-subdued);
  border-bottom-color: var(--polaris-border);
}

/* Butonlar (primary hover) */
.btn-primary{
  background: var(--polaris-primary);
  border-color: var(--polaris-primary);
}
.btn-primary:hover{
  background: var(--polaris-primary-hover);
  border-color: var(--polaris-primary-hover);
}

/* ---- Polaris benzeri spacing ölçeği ---- */
:root{
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
}

/* Stack helpers (dikey/yatay boşluk yönetimi) */
.epb-stack { display:flex; flex-direction:column; gap: var(--space-4); }
.epb-inline { display:flex; align-items:center; gap: var(--space-3); }

/* Gap varyasyonları */
.gap-1{ gap: var(--space-1) !important; }
.gap-2{ gap: var(--space-2) !important; }
.gap-3{ gap: var(--space-3) !important; }
.gap-4{ gap: var(--space-4) !important; }
.gap-5{ gap: var(--space-5) !important; }
.gap-6{ gap: var(--space-6) !important; }

/* Card iç boşluklarını Polaris'e yaklaştır (isteğe bağlı) */
.polaris-card .card-body{ padding: var(--space-5); }

/* Card header - border radius uyumu */
.polaris-card > .card-header:first-child,
.card.polaris-card > .card-header:first-child {
  border-radius: 12px 12px 0 0 !important;
  border-top: none;
  margin: -1px -1px 0 -1px;
  padding: 16px 20px;
}

/* Card footer - border radius uyumu */
.polaris-card .card-footer,
.card.polaris-card .card-footer {
  border-radius: 0 !important;
  border-bottom: none;
  margin: 0;
}

/* Stat tile typography (header-less <x-polaris-card flush> tiles — replaces inline font-sizes) */
.polaris-card__stat-label { font-size: 12px; color: var(--polaris-text-subdued); }
.polaris-card__stat-value { font-size: 18px; font-weight: 600; color: var(--polaris-text); }

/* Başlık/ikincil metin tonları */
.polaris-text      { color: var(--polaris-text) !important; }
.polaris-text-strong{ color:#111213 !important; }
.polaris-subdued   { color: var(--polaris-text-subdued) !important; }

/* ---- İkon rozetleri (Polaris-friendly) ---- */
.epb-icon{
  width: 40px; height: 40px; border-radius: 10px;
  display:grid; place-items:center;
  background: #F1F2F3;           /* açık yüzey */
  color: var(--polaris-text);     /* ikon rengi */
  border: 1px solid var(--polaris-border);
}
.epb-icon.sm{ width: 32px; height: 32px; border-radius: 8px; }
.epb-icon .bi{ font-size: 18px; }           /* normal */
.epb-icon.sm .bi{ font-size: 16px; }        /* küçük */

/* Buton ikon aralığı */
.btn .bi{ vertical-align: -2px; margin-right: 6px; }

/* ---- Polaris-style Form Controls (Input Focus) ---- */
.form-control,
.form-select,
textarea.form-control {
  border: 1px solid var(--polaris-border);
  border-radius: 8px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-control:hover,
.form-select:hover,
textarea.form-control:hover {
  border-color: #8C9196;
}

.form-control:focus,
.form-select:focus,
textarea.form-control:focus {
  border-color: var(--polaris-primary);
  box-shadow: 0 0 0 1px var(--polaris-primary);
  outline: none;
}

/* Input group içindeki select için */
.input-group .form-select:focus {
  z-index: 3;
}

/* Invalid state (hata durumu) */
.form-control.is-invalid:focus,
.form-select.is-invalid:focus,
textarea.form-control.is-invalid:focus {
  border-color: #dc3545;
  box-shadow: 0 0 0 1px #dc3545;
}

/* ---- Embedded App Styles ---- */
body.embedded-app {
  background: var(--polaris-bg);
  margin: 0;
  padding: 0;
}

/* ---- Polaris Footer ---- */
.polaris-footer {
  margin-top: 48px;
  padding: 24px 0;
  border-top: 1px solid var(--polaris-border);
  background: transparent;
}

.polaris-footer-inner {
  display: flex;
  justify-content: center;
  align-items: center;
  text-align: center;
}

.polaris-footer-text {
  font-size: 13px;
  color: var(--polaris-text-subdued);
  margin: 0;
}

.polaris-footer-text a {
  color: var(--polaris-link);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.15s ease;
}

.polaris-footer-text a:hover {
  color: #1F5199;
  text-decoration: underline;
}

/* ---- Main Content Area ---- */
.main-content {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px;
  min-height: calc(100vh - 60px);
}

.main-content.embedded {
  background: var(--polaris-bg);
}

/* Alert improvements */
.main-content .alert {
  border-radius: 8px;
  border: 1px solid;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  margin-bottom: 20px;
}

.main-content .alert .bi {
  font-size: 20px;
  flex-shrink: 0;
  line-height: 1;
}

.main-content .alert .btn-close {
  position: static;
  margin-left: auto;
  padding: 8px;
  opacity: 0.6;
  flex-shrink: 0;
}

.main-content .alert .btn-close:hover {
  opacity: 1;
}

.main-content .alert ul {
  margin: 0;
  padding-left: 20px;
}

.main-content .alert-success {
  background: #F1F8F5;
  border-color: #9DC8BA;
  color: #004C3F;
}

.main-content .alert-danger {
  background: #FEF3F2;
  border-color: #FECDCA;
  color: #8A1D17;
}

.main-content .alert-info {
  background: #F1F5F9;
  border-color: #C7D7E5;
  color: #1B4A7A;
}

/* ---- Polaris Banner Component ---- */
.polaris-banner {
  display: flex;
  gap: 16px;
  padding: 16px;
  border-radius: 12px;
  border-left: 4px solid;
  background: var(--banner-bg);
  border-color: var(--banner-border);
}

.polaris-banner-icon {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  margin-top: 2px;
}

.polaris-banner-icon .bi {
  font-size: 20px;
  line-height: 1;
  color: var(--banner-icon);
}

.polaris-banner-content {
  flex: 1;
  min-width: 0;
  font-size: 14px;
  line-height: 20px;
  color: var(--banner-text);
}

.polaris-banner-content p {
  margin: 0;
}

.polaris-banner-content p + p {
  margin-top: 8px;
}

.polaris-banner-content strong {
  font-weight: 600;
}

.polaris-banner-note {
  font-size: 13px;
  line-height: 18px;
  opacity: 0.9;
}

/* Info variant - Azure tones */
.polaris-banner-info {
  --banner-bg: rgba(234, 244, 255, 1);
  --banner-border: rgba(0, 148, 213, 1);
  --banner-icon: rgba(0, 148, 213, 1);
  --banner-text: rgba(0, 58, 90, 1);
}

/* Success variant - Green tones */
.polaris-banner-success {
  --banner-bg: rgba(205, 254, 212, 1);
  --banner-border: rgba(4, 123, 93, 1);
  --banner-icon: rgba(4, 123, 93, 1);
  --banner-text: rgba(1, 75, 64, 1);
}

/* Warning variant - Orange tones */
.polaris-banner-warning {
  --banner-bg: rgba(255, 241, 227, 1);
  --banner-border: rgba(178, 132, 0, 1);
  --banner-icon: rgba(178, 132, 0, 1);
  --banner-text: rgba(94, 66, 0, 1);
}

/* Caution variant - Yellow tones */
.polaris-banner-caution {
  --banner-bg: rgba(255, 248, 219, 1);
  --banner-border: rgba(153, 138, 0, 1);
  --banner-icon: rgba(153, 138, 0, 1);
  --banner-text: rgba(79, 71, 0, 1);
}

/* Critical variant - Red tones */
.polaris-banner-critical {
  --banner-bg: rgba(254, 232, 235, 1);
  --banner-border: rgba(199, 10, 36, 1);
  --banner-icon: rgba(226, 44, 56, 1);
  --banner-text: rgba(142, 11, 33, 1);
}

/* ---- Polaris Toast Notification System ---- */
.polaris-toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 10100; /* Higher than modal backdrop (10000) to ensure visibility */
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: 450px;
  pointer-events: none;
}

.polaris-toast {
  background: var(--polaris-surface);
  border: 1px solid;
  border-radius: 12px;
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.15), 0 0 1px rgba(0, 0, 0, 0.1);
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 320px;
  max-width: 450px;
  pointer-events: all;
  animation: polaris-toast-in 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  transform-origin: top right;
  list-style: none;
}

@keyframes polaris-toast-in {
  from {
    opacity: 0;
    transform: translateX(100%) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateX(0) scale(1);
  }
}

.polaris-toast.polaris-toast-out {
  animation: polaris-toast-out 0.2s ease-out forwards;
}

@keyframes polaris-toast-out {
  from {
    opacity: 1;
    transform: translateX(0) scale(1);
  }
  to {
    opacity: 0;
    transform: translateX(100%) scale(0.95);
  }
}

.polaris-toast-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.polaris-toast-icon .bi {
  font-size: 20px;
}

.polaris-toast-content {
  flex: 1;
  min-width: 0;
}

.polaris-toast-message {
  font-size: 14px;
  font-weight: 500;
  line-height: 20px;
  margin: 0;
  word-wrap: break-word;
}

.polaris-toast-close {
  width: 24px;
  height: 24px;
  border: none;
  background: transparent;
  color: inherit;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  transition: background 0.15s ease;
  padding: 0;
  margin-top: -2px;
  margin-right: -4px;
  flex-shrink: 0;
  opacity: 0.7;
}

.polaris-toast-close:hover {
  opacity: 1;
  background: rgba(0, 0, 0, 0.05);
}

.polaris-toast-close .bi {
  font-size: 16px;
}

/* Success Toast - Polaris Green */
.polaris-toast.polaris-toast-success {
  border-color: #9DC8BA;
  background: #F1F8F5;
}

.polaris-toast.polaris-toast-success .polaris-toast-icon {
  color: #008060;
}

.polaris-toast.polaris-toast-success .polaris-toast-message {
  color: #004C3F;
}

.polaris-toast.polaris-toast-success .polaris-toast-close {
  color: #004C3F;
}

/* Error Toast - Polaris Red */
.polaris-toast.polaris-toast-error {
  border-color: #FECDCA;
  background: #FEF3F2;
}

.polaris-toast.polaris-toast-error .polaris-toast-icon {
  color: #D72C0D;
}

.polaris-toast.polaris-toast-error .polaris-toast-message {
  color: #8A1D17;
}

.polaris-toast.polaris-toast-error .polaris-toast-close {
  color: #8A1D17;
}

/* Warning Toast - Polaris Yellow */
.polaris-toast.polaris-toast-warning {
  border-color: #FFD79D;
  background: #FFF8E6;
}

.polaris-toast.polaris-toast-warning .polaris-toast-icon {
  color: #916A00;
}

.polaris-toast.polaris-toast-warning .polaris-toast-message {
  color: #593815;
}

.polaris-toast.polaris-toast-warning .polaris-toast-close {
  color: #593815;
}

/* Info Toast - Polaris Blue */
.polaris-toast.polaris-toast-info {
  border-color: #C7D7E5;
  background: #F1F5F9;
}

.polaris-toast.polaris-toast-info .polaris-toast-icon {
  color: #2C6ECB;
}

.polaris-toast.polaris-toast-info .polaris-toast-message {
  color: #1B4A7A;
}

.polaris-toast.polaris-toast-info .polaris-toast-close {
  color: #1B4A7A;
}

/* Progress bar (optional) */
.polaris-toast-progress {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 3px;
  background: currentColor;
  opacity: 0.3;
  border-radius: 0 0 12px 12px;
  animation: polaris-toast-progress 5s linear;
}

@keyframes polaris-toast-progress {
  from {
    width: 100%;
  }
  to {
    width: 0%;
  }
}

/* Mobile responsive */
@media (max-width: 576px) {
  .polaris-toast-container {
    right: 12px;
    left: 12px;
    top: 12px;
  }

  .polaris-toast {
    min-width: auto;
    max-width: 100%;
  }
}

/* ---- Polaris Confirmation Modal ---- */
.polaris-modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}

.polaris-modal-backdrop.active {
  opacity: 1;
  visibility: visible;
}

.polaris-modal {
  background: var(--polaris-surface);
  border-radius: 12px;
  box-shadow: 0 26px 80px rgba(0, 0, 0, 0.2), 0 0 1px rgba(0, 0, 0, 0.2);
  max-width: 400px;
  width: 90%;
  transform: scale(0.95) translateY(-10px);
  transition: transform 0.2s ease;
}

.polaris-modal-backdrop.active .polaris-modal {
  transform: scale(1) translateY(0);
}

.polaris-modal-header {
  padding: 20px 20px 0;
  display: flex;
  align-items: center;
  gap: 12px;
}

.polaris-modal-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.polaris-modal-icon.danger {
  background: #FEF3F2;
  color: #D72C0D;
}

.polaris-modal-icon.warning {
  background: #FFF5E6;
  color: #B98900;
}

.polaris-modal-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--polaris-text);
  margin: 0;
  line-height: 1.4;
}

.polaris-modal-body {
  padding: 12px 20px 20px;
}

.polaris-modal-message {
  font-size: 14px;
  color: var(--polaris-text-subdued);
  margin: 0;
  line-height: 1.5;
}

.polaris-modal-message ul {
  margin: 0;
  padding-left: 20px;
  list-style-type: disc;
}

.polaris-modal-message ul li {
  margin: 2px 0;
  padding: 0;
  line-height: 1.4;
}

.polaris-modal-message strong {
  color: var(--polaris-text);
  font-weight: 600;
}

.polaris-modal-footer {
  padding: 16px 20px;
  background: #FAFBFB;
  border-top: 1px solid var(--polaris-border);
  border-radius: 0 0 12px 12px;
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

.polaris-modal-btn {
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  border: 1px solid transparent;
}

.polaris-modal-btn-cancel {
  background: var(--polaris-surface);
  border-color: var(--polaris-border);
  color: var(--polaris-text);
}

.polaris-modal-btn-cancel:hover {
  background: #F6F6F7;
}

.polaris-modal-btn-danger {
  background: #D72C0D;
  color: white;
  border-color: #D72C0D;
}

.polaris-modal-btn-danger:hover {
  background: #BC2200;
  border-color: #BC2200;
}

/* ---- Polaris Data Table / Index Grid ---- */
.polaris-card .card-body.p-0 {
  padding: 0 !important;
}

/* Table wrapper for proper border radius */
.polaris-card .table {
  margin-bottom: 0;
  border-collapse: separate;
  border-spacing: 0;
}

/* Table header - Polaris style */
.polaris-card .table thead th {
  background: #FAFBFB;
  color: var(--polaris-text-subdued);
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--polaris-border);
  border-top: none;
  white-space: nowrap;
}

/* First header cell - rounded top-left */
.polaris-card .table thead th:first-child {
  border-top-left-radius: 11px;
}

/* Last header cell - rounded top-right */
.polaris-card .table thead th:last-child {
  border-top-right-radius: 11px;
}

/* Table body cells */
.polaris-card .table tbody td {
  padding: 14px 16px;
  border-bottom: 1px solid #EDEEEF;
  vertical-align: middle;
  color: var(--polaris-text);
  font-size: 14px;
}

/* Last row - rounded bottom corners */
.polaris-card .table tbody tr:last-child td:first-child {
  border-bottom-left-radius: 11px;
}

.polaris-card .table tbody tr:last-child td:last-child {
  border-bottom-right-radius: 11px;
}

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

/* Alternating row backgrounds for readability */
.polaris-card .table tbody tr:nth-child(even) {
  background-color: #FAFBFB;
}

/* Row hover effect - Polaris style */
.polaris-card .table tbody tr {
  transition: background-color 0.15s ease;
}

.polaris-card .table tbody tr:hover {
  background-color: #F1F2F3;
}

/* Name column - primary text */
.polaris-card .table .polaris-text-strong {
  font-weight: 600;
  color: var(--polaris-text);
}

/* Badges in table */
.polaris-card .table .badge {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 10px;
  text-transform: none;
  letter-spacing: 0;
}

/* Tag badges - Polaris teal */
.polaris-card .table .badge.bg-primary {
  background: #E4F3F2 !important;
  color: #006E52 !important;
  font-weight: 500;
}

/* Synced badge */
.polaris-card .table .badge.bg-success {
  background: #AEE9D1 !important;
  color: #0B5D42 !important;
}

/* Partially synced badge */
.polaris-card .table .badge.bg-warning {
  background: #FFEA8A !important;
  color: #6B5E00 !important;
}

/* Shopify badge */
.polaris-card .table .badge.bg-info {
  background: #A4E8F2 !important;
  color: #00464F !important;
}

/* Action buttons - Polaris style */
.polaris-card .table .btn-sm {
  padding: 6px 10px;
  font-size: 13px;
  border-radius: 6px;
  border: 1px solid var(--polaris-border);
  background: var(--polaris-surface);
  color: var(--polaris-text);
  transition: all 0.15s ease;
}

.polaris-card .table .btn-sm:hover {
  background: #F6F6F7;
  border-color: #8C9196;
}

.polaris-card .table .btn-outline-secondary {
  border-color: var(--polaris-border);
}

.polaris-card .table .btn-outline-secondary:hover {
  background: #F6F6F7;
  border-color: #8C9196;
  color: var(--polaris-text);
}

.polaris-card .table .btn-outline-danger {
  border-color: var(--polaris-border);
  color: #D72C0D;
}

.polaris-card .table .btn-outline-danger:hover {
  background: #FEF3F2;
  border-color: #D72C0D;
  color: #D72C0D;
}

/* Action buttons icon only */
.polaris-card .table .btn-sm .bi {
  margin-right: 0;
  font-size: 14px;
}

/* Empty state styling */
.polaris-card .polaris-empty-state {
  padding: 48px 24px;
  text-align: center;
  animation: emptyStateFadeIn 0.4s ease-out;
}

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

.polaris-card .polaris-empty-state .empty-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 16px;
  background: #F6F6F7;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.polaris-card .polaris-empty-state .empty-icon .bi {
  font-size: 28px;
  color: var(--polaris-text-subdued);
}

.polaris-card .polaris-empty-state h5 {
  font-size: 16px;
  font-weight: 600;
  color: var(--polaris-text);
  margin-bottom: 8px;
}

.polaris-card .polaris-empty-state p {
  font-size: 14px;
  color: var(--polaris-text-subdued);
  margin-bottom: 20px;
}

/* Pagination - Polaris style */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 0;
  margin: 0;
  list-style: none;
}

.pagination .page-item {
  margin: 0;
}

.pagination .page-link {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 36px;
  padding: 0 12px;
  border: 1px solid var(--polaris-border);
  border-radius: 8px;
  background: #FFFFFF;
  color: var(--polaris-text);
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  transition: all 0.15s ease;
}

.pagination .page-link:hover {
  background: #F6F6F7;
  border-color: #8C9196;
  color: var(--polaris-text);
  text-decoration: none;
}

.pagination .page-link:focus {
  outline: none;
  box-shadow: 0 0 0 2px rgba(0, 128, 96, 0.2);
  border-color: var(--polaris-primary);
}

.pagination .page-item.active .page-link {
  background: var(--polaris-primary);
  border-color: var(--polaris-primary);
  color: #FFFFFF;
  box-shadow: 0 1px 3px rgba(0, 128, 96, 0.3);
}

.pagination .page-item.active .page-link:hover {
  background: #006E52;
  border-color: #006E52;
}

.pagination .page-item.disabled .page-link {
  background: #FAFBFB;
  border-color: var(--polaris-border);
  color: #B5B5B5;
  cursor: not-allowed;
  pointer-events: none;
}

/* Polaris Pagination Wrapper */
.polaris-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.polaris-pagination-info {
  font-size: 14px;
  color: var(--polaris-text-subdued);
}

/* Pagination icons */
.pagination .page-link i {
  font-size: 12px;
  line-height: 1;
}

/* Search/Filter card styling - CRITICAL: overflow visible for dropdown */
.polaris-card.polaris-filter-card,
.card.polaris-card.polaris-filter-card {
  position: relative;
  z-index: 1050 !important;
  overflow: visible !important;
}

.polaris-card.polaris-filter-card .card-body,
.card.polaris-card.polaris-filter-card .card-body {
  overflow: visible !important;
  padding: 16px 20px;
}

.polaris-card.polaris-filter-card .row,
.polaris-card.polaris-filter-card .col-auto {
  overflow: visible !important;
}

/* Filter dropdown container must allow overflow */
.polaris-filter-dropdown {
  position: relative;
  z-index: 1060 !important;
}

/* Ensure cards after filter card are below filter dropdowns */
.polaris-card.polaris-filter-card + .polaris-card,
.card.polaris-card.polaris-filter-card + .card {
  position: relative;
  z-index: 1 !important;
}

/* Polaris-style buttons in filter card - consistent height */
.polaris-filter-card .btn {
  height: 36px;
  padding: 0 16px;
  font-size: 14px;
  font-weight: 500;
  line-height: 34px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.polaris-filter-card .btn-outline-primary {
  border-color: var(--polaris-primary);
  color: var(--polaris-primary);
}

.polaris-filter-card .btn-outline-primary:hover {
  background: rgba(0, 128, 96, 0.08);
  border-color: var(--polaris-primary);
  color: var(--polaris-primary);
}

.polaris-filter-card .btn-outline-secondary {
  border-color: var(--polaris-border);
  color: var(--polaris-text);
}

.polaris-filter-card .btn-outline-secondary:hover {
  background: #F6F6F7;
  border-color: #8C9196;
  color: var(--polaris-text);
}

.polaris-filter-card .btn-outline-success {
  border-color: var(--polaris-primary);
  color: var(--polaris-primary);
}

.polaris-filter-card .btn-outline-success:hover {
  background: rgba(0, 128, 96, 0.08);
  border-color: var(--polaris-primary);
  color: var(--polaris-primary);
}

/* Search input with integrated clear button */
.polaris-filter-card .form-control {
  height: 36px;
  border-radius: 8px;
  border-color: var(--polaris-border);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.polaris-filter-card .form-control:focus {
  border-color: var(--polaris-primary);
  box-shadow: 0 0 0 1px var(--polaris-primary);
}

/* Clear button inside search input */
.polaris-filter-card .position-relative a.text-muted {
  opacity: 0.5;
  transition: opacity 0.15s ease;
}

.polaris-filter-card .position-relative a.text-muted:hover {
  opacity: 1;
  color: var(--polaris-text) !important;
}

/* Active filter tag */
.polaris-filter-tag {
  background: #F6F6F7;
  border: 1px solid var(--polaris-border);
  border-radius: 6px;
  padding: 6px 12px;
  font-size: 13px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.polaris-filter-tag a {
  opacity: 0.6;
  transition: opacity 0.15s ease;
}

.polaris-filter-tag a:hover {
  opacity: 1;
}

/* Filter Dropdown - Polaris Style */
.polaris-filter-dropdown {
  position: relative;
}

.polaris-filter-btn.btn {
  height: 36px !important;
  min-height: 36px !important;
  padding: 0 16px !important;
  font-size: 14px !important;
  font-weight: 500 !important;
  line-height: 1 !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 6px !important;
  white-space: nowrap;
}

.polaris-filter-btn .bi-chevron-down {
  font-size: 12px;
  transition: transform 0.2s ease;
}

.polaris-filter-dropdown.open .polaris-filter-btn .bi-chevron-down {
  transform: rotate(180deg);
}

.polaris-filter-menu {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  min-width: 220px;
  background: #FFFFFF;
  border: 1px solid var(--polaris-border);
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  z-index: 9999 !important;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: all 0.2s ease;
}

.polaris-filter-menu.show {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.polaris-filter-menu-header {
  padding: 12px 16px 8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--polaris-text-subdued);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--polaris-border);
}

.polaris-filter-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  font-size: 14px;
  color: var(--polaris-text);
  text-decoration: none;
  transition: background-color 0.15s ease;
}

.polaris-filter-option:hover {
  background-color: #F6F6F7;
  color: var(--polaris-text);
  text-decoration: none;
}

.polaris-filter-option.active {
  background-color: rgba(0, 128, 96, 0.08);
  color: #008060;
  font-weight: 500;
}

.polaris-filter-option .bi-check {
  color: #008060;
  font-size: 16px;
  font-weight: bold;
}

.polaris-filter-option:first-of-type {
  border-radius: 0;
}

.polaris-filter-option:last-child {
  border-radius: 0 0 8px 8px;
}

/* Page header styling */
.polaris-page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.polaris-page-header h4 {
  font-size: 20px;
  font-weight: 600;
  color: var(--polaris-text);
  margin: 0;
}

/* Back button (Shopify-style, left of page title) */
.polaris-back-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  margin-top: -2px;
  border-radius: 8px;
  color: var(--polaris-text-subdued, #616161);
  background: transparent;
  border: 1px solid transparent;
  text-decoration: none;
  transition: background-color .15s ease, color .15s ease;
}

.polaris-back-button:hover {
  background-color: rgba(0, 0, 0, .06);
  color: var(--polaris-text, #202223);
}

.polaris-back-button:focus-visible {
  outline: 2px solid var(--polaris-focus, #005bd3);
  outline-offset: 1px;
}

.polaris-back-button i {
  font-size: 16px;
  line-height: 1;
}

/* Page header action button (e.g. "View in Shopify") — never wraps, never shrinks */
.polaris-page-header .btn {
  white-space: nowrap;
  flex-shrink: 0;
}

/* Responsive table */
@media (max-width: 768px) {
  .polaris-card .table thead th,
  .polaris-card .table tbody td {
    padding: 10px 12px;
  }

  .polaris-card .table .badge {
    font-size: 10px;
    padding: 2px 6px;
  }
}

/* Contact Feed (Dashboard) */
.contact-feed {
  padding: 0;
}

.contact-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--polaris-border);
  transition: background-color 0.15s ease;
}

.contact-item:last-child {
  border-bottom: none;
}

.contact-item:hover {
  background-color: #F6F6F7;
}

.contact-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  flex-shrink: 0;
  font-size: 14px;
  background-color: rgba(0, 128, 96, 0.1);
  color: #008060;
}

.contact-content {
  flex: 1;
  min-width: 0;
}

.contact-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--polaris-text);
  line-height: 1.4;
}

.contact-details {
  font-size: 12px;
  color: var(--polaris-text-subdued);
  margin-top: 2px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.contact-details span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.contact-details i {
  font-size: 11px;
}

.contact-action {
  flex-shrink: 0;
}

/* Activity Feed */
.activity-feed {
  padding: 0;
}

.activity-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--polaris-border);
  transition: background-color 0.15s ease;
}

.activity-item:last-child {
  border-bottom: none;
}

.activity-item:hover {
  background-color: #F6F6F7;
}

.activity-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  flex-shrink: 0;
  font-size: 14px;
}

.activity-icon-success {
  background-color: rgba(0, 128, 96, 0.1);
  color: #008060;
}

.activity-icon-warning {
  background-color: rgba(255, 193, 7, 0.15);
  color: #B98900;
}

.activity-icon-danger {
  background-color: rgba(220, 53, 69, 0.1);
  color: #D72C0D;
}

.activity-icon-info {
  background-color: rgba(44, 110, 203, 0.1);
  color: #2C6ECB;
}

.activity-icon-primary {
  background-color: rgba(0, 128, 96, 0.1);
  color: #008060;
}

.activity-icon-secondary {
  background-color: rgba(109, 113, 117, 0.1);
  color: #6D7175;
}

.activity-content {
  flex: 1;
  min-width: 0;
}

.activity-description {
  font-size: 14px;
  color: var(--polaris-text);
  line-height: 1.4;
  word-break: break-word;
}

.activity-time {
  font-size: 12px;
  color: var(--polaris-text-subdued);
  margin-top: 2px;
}

.activity-action {
  flex-shrink: 0;
}

/* Activity Log Page */
.activity-log-list {
  padding: 0;
}

.activity-log-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--polaris-border);
  transition: background-color 0.15s ease;
}

.activity-log-item:last-child {
  border-bottom: none;
}

.activity-log-item:hover {
  background-color: #F6F6F7;
}

.activity-log-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  flex-shrink: 0;
  font-size: 16px;
}

.activity-log-content {
  flex: 1;
  min-width: 0;
}

.activity-log-description {
  font-size: 14px;
  font-weight: 500;
  color: var(--polaris-text);
  line-height: 1.4;
  margin-bottom: 4px;
}

.activity-log-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.activity-log-time {
  font-size: 13px;
  color: var(--polaris-text-subdued);
  display: flex;
  align-items: center;
  gap: 4px;
}

.activity-log-time i {
  font-size: 12px;
}

.activity-log-relative {
  font-size: 12px;
  color: var(--polaris-text-subdued);
  opacity: 0.8;
}

.activity-log-type {
  flex-shrink: 0;
}

.activity-log-type .badge {
  font-size: 11px;
  font-weight: 500;
  padding: 4px 10px;
  border-radius: 12px;
}

/* Badge subtle colors */
.bg-success-subtle {
  background-color: rgba(0, 128, 96, 0.1) !important;
}

.bg-info-subtle {
  background-color: rgba(44, 110, 203, 0.1) !important;
}

.bg-danger-subtle {
  background-color: rgba(215, 44, 13, 0.1) !important;
}

.bg-primary-subtle {
  background-color: rgba(0, 128, 96, 0.1) !important;
}

.bg-secondary-subtle {
  background-color: rgba(109, 113, 117, 0.1) !important;
}

.bg-warning-subtle {
  background-color: rgba(185, 137, 0, 0.1) !important;
}

.text-success {
  color: #008060 !important;
}

.text-info {
  color: #2C6ECB !important;
}

.text-danger {
  color: #D72C0D !important;
}

.text-warning {
  color: #916A00 !important; /* Polaris caution text — Bootstrap's #ffc107 is unreadable on subtle backgrounds */
}

/* Badge subtle styles for tags */
.badge-subtle-info {
  background-color: rgba(44, 110, 203, 0.12) !important;
  color: #1B4A7A !important;
  font-size: 13px;
  font-weight: 500;
  padding: 6px 12px;
  border-radius: 16px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.badge-subtle-success {
  background-color: rgba(0, 128, 96, 0.12) !important;
  color: #004C3F !important;
  font-size: 13px;
  font-weight: 500;
  padding: 6px 12px;
  border-radius: 16px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.badge-subtle-warning {
  background-color: rgba(185, 137, 0, 0.12) !important;
  color: #593815 !important;
  font-size: 13px;
  font-weight: 500;
  padding: 6px 12px;
  border-radius: 16px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

/* Responsive activity log */
@media (max-width: 576px) {
  .activity-log-item {
    flex-wrap: wrap;
    gap: 12px;
  }

  .activity-log-type {
    width: 100%;
    margin-left: 56px;
  }
}

/* Dashboard Cards - Equal Height */
.dashboard-card-body {
  min-height: 320px;
  max-height: 320px;
  overflow-y: auto;
  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none; /* IE and Edge */
}

.dashboard-card-body::-webkit-scrollbar {
  display: none; /* Chrome, Safari, Opera */
}

/* Pro Tip Card */
/* ---- Welcome Banner Card (Daily Tip style in blue) ---- */
.welcome-banner-card {
  background: linear-gradient(135deg, #EFF6FF 0%, #DBEAFE 100%);
  border-color: #60A5FA !important;
}

.welcome-banner-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #DBEAFE;
  border: 1px solid #60A5FA;
  color: #1D4ED8;
  flex-shrink: 0;
}

.welcome-banner-icon .bi {
  font-size: 18px;
}

.welcome-banner-content {
  flex: 1;
  min-width: 0;
}

.welcome-banner-title {
  font-weight: 600;
  font-size: 14px;
  color: #1E3A5F;
}

.welcome-banner-list {
  list-style: none;
  padding: 0;
  margin: 8px 0 0 0;
}

.welcome-banner-list li {
  position: relative;
  padding-left: 16px;
  font-size: 13px;
  line-height: 20px;
  color: #1E3A5F;
  opacity: 0.85;
}

.welcome-banner-list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 8px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background-color: #3B82F6;
}

.welcome-banner-list li + li {
  margin-top: 4px;
}

.welcome-banner-list li strong {
  font-weight: 600;
}

.welcome-banner-actions {
  margin-top: 12px;
}

.welcome-banner-action {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 500;
  line-height: 1;
  color: #1D4ED8;
  background-color: #DBEAFE;
  border: 1px solid #60A5FA;
  border-radius: 6px;
  cursor: pointer;
  text-decoration: none;
  transition: background-color 0.15s ease;
}

.welcome-banner-action:hover {
  background-color: #BFDBFE;
  color: #1D4ED8;
  text-decoration: none;
}

.welcome-banner-action .bi {
  font-size: 14px;
}

.welcome-banner-dismiss {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  background: transparent;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  color: #3B82F6;
  opacity: 0.6;
  transition: opacity 0.15s ease, background-color 0.15s ease;
  flex-shrink: 0;
}

.welcome-banner-dismiss:hover {
  opacity: 1;
  background-color: rgba(59, 130, 246, 0.1);
}

.welcome-banner-dismiss .bi {
  font-size: 18px;
}

/* ---- Pro Tip Card ---- */
.pro-tip-card {
  background: linear-gradient(135deg, #FFFBEB 0%, #FEF3C7 100%);
  border-color: #FCD34D !important;
}

.pro-tip-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #FEF3C7;
  border: 1px solid #FCD34D;
  color: #B45309;
  flex-shrink: 0;
}

.pro-tip-icon .bi {
  font-size: 18px;
}

.pro-tip-feature-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: rgba(180, 83, 9, 0.1);
  color: #B45309;
  flex-shrink: 0;
}

.pro-tip-feature-icon .bi {
  font-size: 24px;
}

.pro-tip-title {
  font-weight: 600;
  font-size: 14px;
  color: #92400E;
}

.pro-tip-text {
  font-size: 13px;
  line-height: 20px;
  color: #92400E;
  opacity: 0.85;
}

/* ---- Contact Address Styles ---- */

/* Address Section Card */
.address-section {
  margin-top: 0;
}

.address-section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--polaris-border);
  background: #FAFBFB;
  border-radius: 11px 11px 0 0;
}

.address-section-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--polaris-text);
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
}

.address-section-title i {
  color: var(--polaris-text-subdued);
}

/* Address List */
.address-list {
  padding: 0;
}

.address-list:empty + .address-empty-state {
  display: block;
}

/* Address Item */
.address-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--polaris-border);
  transition: background-color 0.15s ease;
}

.address-item:last-child {
  border-bottom: none;
}

.address-item:hover {
  background-color: #F6F6F7;
}

.address-item-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: rgba(0, 128, 96, 0.1);
  color: var(--polaris-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 16px;
}

.address-item-content {
  flex: 1;
  min-width: 0;
}

.address-item-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.address-item-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--polaris-text);
}

.address-item-company {
  font-size: 13px;
  color: var(--polaris-text-subdued);
}

.address-default-badge {
  font-size: 11px;
  font-weight: 500;
  padding: 2px 8px;
  background: #E4F3F2;
  color: #006E52;
  border-radius: 10px;
}

.address-item-details {
  font-size: 13px;
  color: var(--polaris-text-subdued);
  line-height: 1.5;
}

.address-item-details p {
  margin: 0;
}

.address-item-phone {
  margin-top: 4px;
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: var(--polaris-text-subdued);
}

.address-item-phone i {
  font-size: 11px;
}

.address-item-actions {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}

.address-item-actions .btn {
  padding: 6px 10px;
  font-size: 13px;
  border-radius: 6px;
  border: 1px solid var(--polaris-border);
  background: var(--polaris-surface);
  color: var(--polaris-text);
  transition: all 0.15s ease;
}

.address-item-actions .btn .bi {
  margin-right: 0;
  font-size: 14px;
}

.address-item-actions .btn-outline-secondary {
  border-color: var(--polaris-border);
}

.address-item-actions .btn-outline-secondary:hover {
  background: #F6F6F7;
  border-color: #8C9196;
  color: var(--polaris-text);
}

.address-item-actions .btn-outline-danger {
  border-color: var(--polaris-border);
  color: #D72C0D;
}

.address-item-actions .btn-outline-danger:hover {
  background: #FEF3F2;
  border-color: #D72C0D;
  color: #D72C0D;
}

/* Empty State */
.address-empty-state {
  padding: 32px 20px;
  text-align: center;
}

.address-empty-icon {
  width: 48px;
  height: 48px;
  margin: 0 auto 12px;
  background: #F6F6F7;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.address-empty-icon i {
  font-size: 20px;
  color: var(--polaris-text-subdued);
}

.address-empty-state h6 {
  font-size: 14px;
  font-weight: 600;
  color: var(--polaris-text);
  margin-bottom: 4px;
}

.address-empty-state p {
  font-size: 13px;
  color: var(--polaris-text-subdued);
  margin-bottom: 16px;
}

/* Address Modal */
.address-modal .polaris-modal {
  max-width: 520px;
}

.address-modal .polaris-modal-header {
  padding: 20px;
  border-bottom: 1px solid var(--polaris-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.address-modal .polaris-modal-body {
  padding: 20px;
  max-height: 60vh;
  overflow-y: auto;
}

.address-modal .polaris-modal-footer {
  padding: 16px 20px;
  background: #FAFBFB;
  border-top: 1px solid var(--polaris-border);
  border-radius: 0 0 12px 12px;
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

/* Address Form */
.address-form-row {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
}

.address-form-row > * {
  flex: 1;
}

.address-form-group {
  margin-bottom: 16px;
}

.address-form-group:last-child {
  margin-bottom: 0;
}

.address-form-label {
  display: block;
  font-size: 14px;
  font-weight: 500;
  color: var(--polaris-text);
  margin-bottom: 6px;
}

.address-form-label .optional {
  font-weight: 400;
  color: var(--polaris-text-subdued);
}

.address-form-checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  padding-top: 16px;
  border-top: 1px solid var(--polaris-border);
}

.address-form-checkbox input {
  width: 18px;
  height: 18px;
  accent-color: var(--polaris-primary);
}

.address-form-checkbox label {
  font-size: 14px;
  color: var(--polaris-text);
  cursor: pointer;
}

/* Province select loading state */
.province-loading {
  position: relative;
}

.province-loading::after {
  content: '';
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  border: 2px solid #E4F3F2;
  border-top-color: var(--polaris-primary);
  border-radius: 50%;
  animation: province-spin 0.6s linear infinite;
}

@keyframes province-spin {
  to {
    transform: translateY(-50%) rotate(360deg);
  }
}

/* =====================================
   Store Credit Section
   ===================================== */
.store-credit-section {
  margin-top: 0;
}

.store-credit-content {
  padding: 0;
}

.store-credit-balance-container {
  min-height: 80px;
}

.store-credit-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 20px;
  color: var(--polaris-text-subdued);
  font-size: 14px;
}

.store-credit-balance {
  text-align: center;
  padding: 24px 20px;
  background: linear-gradient(135deg, #E4F3F2 0%, #F6F6F7 100%);
  border-radius: 0 0 11px 11px;
}

.balance-amount {
  font-size: 32px;
  font-weight: 700;
  color: var(--polaris-primary);
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 6px;
}

.balance-currency {
  font-size: 16px;
  font-weight: 600;
  color: var(--polaris-text-subdued);
}

.balance-value {
  line-height: 1;
}

.balance-label {
  font-size: 12px;
  color: var(--polaris-text-subdued);
  margin-top: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 500;
}

/* Empty State - matches address-empty-state */
.store-credit-no-balance {
  padding: 32px 20px;
  text-align: center;
}

.store-credit-empty-icon {
  width: 48px;
  height: 48px;
  margin: 0 auto 12px;
  background: #F6F6F7;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.store-credit-empty-icon i {
  font-size: 20px;
  color: var(--polaris-text-subdued);
}

.store-credit-no-balance h6 {
  font-size: 14px;
  font-weight: 600;
  color: var(--polaris-text);
  margin-bottom: 4px;
}

.store-credit-no-balance p {
  font-size: 13px;
  color: var(--polaris-text-subdued);
  margin-bottom: 16px;
}

.store-credit-not-synced,
.tax-details-not-synced {
  padding: 20px;
}

.store-credit-not-synced .alert,
.custom-fields-not-synced .alert,
.tax-details-not-synced .alert {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 16px;
  border-radius: 8px;
  font-size: 13px;
  line-height: 1.5;
}

.store-credit-error {
  padding: 20px;
}

.store-credit-error .alert {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 16px;
  border-radius: 8px;
  font-size: 13px;
}

/* Store Credit Actions */
.store-credit-actions {
  display: flex;
  gap: 8px;
}

.btn-store-credit-deduct {
  background: white;
  border: 1px solid #D82C0D;
  color: #D82C0D;
  font-weight: 500;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 13px;
  transition: all 0.15s ease;
}

.btn-store-credit-deduct:hover {
  background: #FEF1F1;
  border-color: #BC2200;
  color: #BC2200;
}

.btn-store-credit-deduct:active {
  background: #FED3D1;
}

/* Store Credit Modal */
.store-credit-modal .polaris-modal {
  max-width: 450px;
}

.store-credit-modal .polaris-modal-header,
.deduct-credit-modal .polaris-modal-header {
  padding: 20px;
  border-bottom: 1px solid var(--polaris-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.store-credit-modal .polaris-modal-body,
.deduct-credit-modal .polaris-modal-body {
  padding: 20px;
}

.store-credit-modal .polaris-modal-footer,
.deduct-credit-modal .polaris-modal-footer {
  padding: 16px 20px;
  background: #FAFBFB;
  border-top: 1px solid var(--polaris-border);
  border-radius: 0 0 12px 12px;
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

.store-credit-form .input-group {
  flex-wrap: nowrap;
}

.store-credit-form .input-group .form-select {
  border-right: none;
  border-radius: 8px 0 0 8px;
  background-color: #FAFBFB;
}

.store-credit-form .input-group .form-control {
  border-radius: 0 8px 8px 0;
}

/* =====================================
   Transaction History Section
   ===================================== */

/* Transaction History Header */
.transaction-history-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  background: #FAFBFB;
  border-top: 1px solid var(--polaris-border);
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.transaction-history-header:hover {
  background: #F1F2F3;
}

.transaction-history-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--polaris-text);
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.transaction-history-title i {
  color: var(--polaris-text-subdued);
}

.transaction-history-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--polaris-link);
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
}

.transaction-history-toggle i {
  transition: transform 0.2s ease;
}

.transaction-history-toggle.expanded i {
  transform: rotate(180deg);
}

/* Transaction List */
.transaction-list {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
}

.transaction-list.expanded {
  max-height: 1000px;
}

.transaction-list-inner {
  padding: 16px 20px 20px;
}

/* Transaction Loading State */
.transaction-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 20px;
  color: var(--polaris-text-subdued);
  font-size: 13px;
}

/* Transaction Empty State */
.transaction-empty {
  text-align: center;
  padding: 24px 20px;
}

.transaction-empty-icon {
  width: 40px;
  height: 40px;
  margin: 0 auto 12px;
  background: #F6F6F7;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.transaction-empty-icon i {
  font-size: 18px;
  color: var(--polaris-text-subdued);
}

.transaction-empty h6 {
  font-size: 13px;
  font-weight: 600;
  color: var(--polaris-text);
  margin-bottom: 4px;
}

.transaction-empty p {
  font-size: 12px;
  color: var(--polaris-text-subdued);
  margin: 0;
}

/* Transaction Item */
.transaction-item {
  display: flex;
  align-items: flex-start;
  padding: 12px 0;
  border-bottom: 1px solid #EDEEEF;
}

.transaction-item:first-child {
  padding-top: 0;
}

.transaction-item:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

/* Transaction Icon */
.transaction-icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-right: 12px;
}

.transaction-icon i {
  font-size: 14px;
}

.transaction-icon.credit {
  background: #AEE9D1;
  color: #0B5D42;
}

.transaction-icon.debit {
  background: #FED3D1;
  color: #D72C0D;
}

.transaction-icon.revert {
  background: #A4E8F2;
  color: #00464F;
}

.transaction-icon.expired {
  background: #E4E5E7;
  color: #6D7175;
}

/* Transaction Content */
.transaction-content {
  flex: 1;
  min-width: 0;
}

.transaction-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 2px;
}

.transaction-type {
  font-size: 13px;
  font-weight: 500;
  color: var(--polaris-text);
}

.transaction-amount {
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}

.transaction-amount.positive {
  color: #0B5D42;
}

.transaction-amount.negative {
  color: #D72C0D;
}

.transaction-meta {
  font-size: 12px;
  color: var(--polaris-text-subdued);
}

.transaction-meta span {
  display: inline-flex;
  align-items: center;
}

.transaction-meta span:not(:last-child)::after {
  content: "·";
  margin: 0 6px;
  color: var(--polaris-border);
}

/* Load More Button */
.transaction-load-more {
  text-align: center;
  padding-top: 12px;
  border-top: 1px solid #EDEEEF;
  margin-top: 12px;
}

.transaction-load-more button {
  font-size: 13px;
  color: var(--polaris-link);
  background: none;
  border: none;
  padding: 8px 16px;
  cursor: pointer;
  border-radius: 6px;
  transition: background-color 0.15s ease;
}

.transaction-load-more button:hover {
  background: #F6F6F7;
}

.transaction-load-more button:disabled {
  color: var(--polaris-text-subdued);
  cursor: not-allowed;
}

/* Form card sections */
.form-section-card {
  margin-bottom: 20px;
}

.form-section-card:last-child {
  margin-bottom: 0;
}

.form-section-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--polaris-text);
  padding: 16px 20px;
  background: #FAFBFB;
  border-bottom: 1px solid var(--polaris-border);
  border-radius: 11px 11px 0 0;
  margin: 0;
}

/* Leading icon on form-section-title cards — match the subdued tone of .address-section-title icons.
   Scoped to the title's own icon (h5 direct child, or the first span) so trailing badges keep their color. */
.form-section-title > i,
.form-section-title > span:first-child > i {
  color: var(--polaris-text-subdued);
}

.form-section-body {
  padding: 20px;
}

/* Responsive */
@media (max-width: 576px) {
  .address-form-row {
    flex-direction: column;
    gap: 16px;
  }

  .address-item {
    flex-wrap: wrap;
  }

  .address-item-actions {
    width: 100%;
    justify-content: flex-end;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--polaris-border);
  }
}

/* =====================
   BULK ACTIONS STYLES
   ===================== */

/* Floating Action Bar */
.bulk-action-bar {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: #1F2124;
  color: #FFFFFF;
  padding: 12px 20px;
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
  z-index: 1050;
  animation: slideUp 0.2s ease-out;
  min-width: auto;
  max-width: 600px;
  width: auto;
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
}

.bulk-action-bar-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.bulk-action-bar-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.bulk-selection-count {
  font-weight: 500;
  white-space: nowrap;
}

.bulk-action-bar-left .btn-link {
  color: #A0A0A0;
  text-decoration: none;
  padding: 0;
}

.bulk-action-bar-left .btn-link:hover {
  color: #FFFFFF;
}

.bulk-action-bar-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.bulk-action-bar-right .btn {
  border-color: rgba(255, 255, 255, 0.3);
  color: #FFFFFF;
}

.bulk-action-bar-right .btn:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.5);
}

.bulk-action-bar-right .btn-outline-primary {
  background: var(--polaris-primary);
  border-color: var(--polaris-primary);
}

.bulk-action-bar-right .btn-outline-primary:hover {
  background: var(--polaris-primary-hover);
  border-color: var(--polaris-primary-hover);
}

/* Checkbox column */
.bulk-checkbox-col {
  width: 40px;
  text-align: center;
  vertical-align: middle;
}

.bulk-checkbox-col .form-check-input {
  margin: 0;
  cursor: pointer;
}

/* Selected row highlight */
tr.table-active {
  background-color: rgba(0, 128, 96, 0.08) !important;
}

/* Bulk Tag Input Container */
.bulk-tag-input-container {
  border: 1px solid var(--polaris-border);
  border-radius: 8px;
  padding: 8px;
  min-height: 42px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  background: #FFFFFF;
}

.bulk-tag-input-container:focus-within {
  border-color: var(--polaris-primary);
  box-shadow: 0 0 0 2px rgba(0, 128, 96, 0.15);
}

.bulk-selected-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.bulk-tag-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  font-size: 13px;
  font-weight: 500;
}

.bulk-tag-remove {
  cursor: pointer;
  font-size: 10px;
  opacity: 0.7;
  margin-left: 2px;
}

.bulk-tag-remove:hover {
  opacity: 1;
}

.bulk-tag-input {
  border: none;
  outline: none;
  flex: 1;
  min-width: 150px;
  padding: 4px;
  font-size: 14px;
}

.bulk-tag-input:focus {
  box-shadow: none;
}

/* Popular tags in modal */
.bulk-popular-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.bulk-popular-tag {
  cursor: pointer;
  border: 1px solid var(--polaris-border);
  transition: all 0.15s ease;
}

.bulk-popular-tag:hover {
  background: var(--polaris-primary) !important;
  color: #FFFFFF !important;
  border-color: var(--polaris-primary);
}

/* Responsive bulk action bar */

/* Tablet (max-width: 1023px) */
@media (max-width: 1023px) {
  .bulk-action-bar {
    max-width: calc(100% - 48px);
    margin: 0 24px;
  }
}

/* Large Phone (max-width: 767px) */
@media (max-width: 767px) {
  .bulk-action-bar {
    width: calc(100% - 32px);
    left: 16px;
    right: 16px;
    transform: none;
    padding: 12px;
    max-width: none;
  }

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

  .bulk-action-bar-content {
    flex-direction: column;
    gap: 12px;
  }

  .bulk-action-bar-left,
  .bulk-action-bar-right {
    width: 100%;
    justify-content: center;
  }

  .bulk-action-bar-right {
    flex-wrap: wrap;
    gap: 8px;
  }

  .bulk-action-bar-right .btn {
    min-height: 44px; /* Touch-friendly */
    flex: 1 1 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }
}

/* Mobile (max-width: 575px) */
@media (max-width: 575px) {
  .bulk-action-bar {
    width: calc(100% - 24px);
    left: 12px;
    right: 12px;
    bottom: 12px;
    padding: 10px;
    border-radius: 8px;
  }

  .bulk-action-bar-right .btn {
    font-size: 13px;
    padding: 10px 12px;
  }

  /* More Actions dropdown opens upward on mobile */
  .bulk-action-bar .dropdown-menu {
    bottom: 100%;
    top: auto !important;
    margin-bottom: 8px;
    transform: none !important;
  }

  .bulk-action-bar .dropdown-menu-end {
    right: 0;
    left: auto;
  }
}

/* Small Mobile (max-width: 374px) */
@media (max-width: 374px) {
  .bulk-action-bar {
    width: calc(100% - 16px);
    left: 8px;
    right: 8px;
    bottom: 8px;
    padding: 8px;
  }

  .bulk-selection-count {
    font-size: 12px;
  }

  .bulk-action-bar-left .btn-link {
    font-size: 12px;
  }

  .bulk-action-bar-right .btn {
    font-size: 12px;
    padding: 8px 10px;
    min-height: 40px;
  }

  .bulk-action-bar-right .btn i {
    font-size: 14px;
  }
}

/* =====================
   BULK DELETE MODAL
   ===================== */

.cursor-pointer {
  cursor: pointer;
}

.delete-option-card {
  border: 1px solid #E1E3E5;
  border-radius: 8px;
  padding: 16px;
  transition: all 0.15s ease;
}

.delete-option-card:hover {
  border-color: #8C9196;
}

.delete-option-card.selected {
  border-color: #008060;
  background-color: rgba(0, 128, 96, 0.05);
}

.delete-option-card.disabled {
  opacity: 0.5;
  pointer-events: none;
  background-color: #F6F6F7;
}

.delete-option-card .form-check {
  margin-bottom: 8px;
}

.delete-option-card .form-check-input {
  width: 20px;
  height: 20px;
  margin-top: 0;
}

.delete-option-card .form-check-input:checked {
  background-color: #008060;
  border-color: #008060;
}

.delete-option-card .form-check-label {
  cursor: pointer;
  padding-left: 8px;
}

.delete-option-desc {
  padding-left: 36px;
}

/* =====================
   EXPIRATION BADGES
   ===================== */

/* Base expiration badge */
.expiration-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: 10px;
  white-space: nowrap;
}

.expiration-badge i {
  font-size: 10px;
}

/* Permanent - No expiration */
.expiration-badge.permanent {
  background: #E4F3F2;
  color: #006E52;
}

/* Active - More than 30 days */
.expiration-badge.active {
  background: #E4F3F2;
  color: #006E52;
}

/* Expiring Soon - 30 days or less */
.expiration-badge.expiring-soon {
  background: #FFF5E6;
  color: #B45309;
}

/* Expired */
.expiration-badge.expired {
  background: #F6F6F7;
  color: #6D7175;
}

/* Unknown status */
.expiration-badge.unknown {
  background: #F6F6F7;
  color: #6D7175;
}

/* Expiration info in transaction item */
.transaction-expiration {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
}

.transaction-expires-text {
  font-size: 11px;
  color: var(--polaris-text-subdued);
}

.transaction-expires-text.warning {
  color: #B45309;
}

/* Date picker for expiration */
.store-credit-form .expiration-group {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--polaris-border);
}

.store-credit-form .expiration-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  font-weight: 500;
  color: var(--polaris-text);
  margin-bottom: 8px;
}

.store-credit-form .expiration-label .optional {
  font-weight: 400;
  color: var(--polaris-text-subdued);
  font-size: 12px;
}

.store-credit-form .expiration-help {
  font-size: 12px;
  color: var(--polaris-text-subdued);
  margin-top: 6px;
}

.store-credit-form input[type="date"] {
  width: 100%;
  height: 36px;
  padding: 0 12px 0 36px;
  border: 1px solid var(--polaris-border);
  border-radius: 8px;
  font-size: 14px;
  color: var(--polaris-text);
  background: #FFFFFF url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%236D7175' viewBox='0 0 16 16'%3E%3Cpath d='M3.5 0a.5.5 0 0 1 .5.5V1h8V.5a.5.5 0 0 1 1 0V1h1a2 2 0 0 1 2 2v11a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2V3a2 2 0 0 1 2-2h1V.5a.5.5 0 0 1 .5-.5zM1 4v10a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1V4H1z'/%3E%3C/svg%3E") no-repeat 10px center;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  cursor: pointer;
}

/* Hide the native calendar icon */
.store-credit-form input[type="date"]::-webkit-calendar-picker-indicator {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  cursor: pointer;
  background: transparent;
  opacity: 0;
}

.store-credit-form input[type="date"]:hover {
  border-color: #8C9196;
}

.store-credit-form input[type="date"]:focus {
  border-color: var(--polaris-primary);
  box-shadow: 0 0 0 1px var(--polaris-primary);
  outline: none;
}

/* Clear date button */
.expiration-input-wrapper {
  position: relative;
}

.expiration-input-wrapper .clear-date {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--polaris-text-subdued);
  cursor: pointer;
  padding: 4px;
  font-size: 14px;
  opacity: 0.6;
  transition: opacity 0.15s ease;
  z-index: 1;
}

.expiration-input-wrapper .clear-date:hover {
  opacity: 1;
  color: var(--polaris-text);
}

.expiration-input-wrapper input[type="date"] {
  padding-right: 36px;
}

/* Days remaining indicator inline */
.days-remaining {
  font-size: 11px;
  color: var(--polaris-text-subdued);
}

.days-remaining.warning {
  color: #B45309;
  font-weight: 500;
}

.days-remaining.critical {
  color: #D72C0D;
  font-weight: 500;
}

/* ===== INDEX TABLE - POLARIS STANDARDS ===== */

/* Table layout fixed for consistent columns */
.polaris-card .table {
  table-layout: fixed;
  width: 100%;
}

/* Checkbox column */
.polaris-card .table .bulk-checkbox-col {
  width: 48px;
}

/* Name column - primary, flexible with limits */
.polaris-card .table th:nth-child(2),
.polaris-card .table td:nth-child(2) {
  width: 25%;
  min-width: 150px;
  max-width: 280px;
}

/* Phone column */
.polaris-card .table th:nth-child(3),
.polaris-card .table td:nth-child(3) {
  width: 140px;
}

/* Email column */
.polaris-card .table th:nth-child(4),
.polaris-card .table td:nth-child(4) {
  width: 200px;
}

/* Tags column - percentage based to prevent overflow */
.polaris-card .table th:nth-child(5),
.polaris-card .table td:nth-child(5) {
  width: 15%;
  min-width: 100px;
}

/* Actions column - wider for comfortable button spacing */
.polaris-card .table th:nth-child(6),
.polaris-card .table td:nth-child(6) {
  width: 110px;
}

/* Templates hub table opts OUT of the data-grid column sizing above.
   Those nth-child widths + table-layout:fixed are tuned for the 6-column contacts
   grid; on this 3-column table they clamp the Actions cell to 140px, which clips
   the action buttons under .polaris-card's overflow:hidden. ID beats the class
   selectors, so these win without touching any other table. */
#document-templates-table {
  table-layout: auto;
}

#document-templates-table th,
#document-templates-table td {
  width: auto;
  min-width: 0;
  max-width: none;
}

/* ===== TRUNCATION STYLES ===== */

/* Name cell truncation */
.contact-name-cell {
  max-width: 0; /* Enables truncation in table-layout: fixed */
}

.contact-name-wrapper {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0; /* Allow flex children to shrink */
}

.contact-name-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
  min-width: 0;
}

/* Email/Phone truncation */
.contact-email-cell,
.contact-phone-cell {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 0;
}

/* Tags - scrollable container showing all tags */
.contact-tags-cell {
  max-height: 60px;
  overflow-y: auto;
  overflow-x: hidden;
}

.contact-tags-cell .d-flex {
  flex-wrap: wrap;
  gap: 4px;
}

/* Consistent row height - Polaris standard 52px */
.polaris-card .table tbody td {
  height: 52px;
  padding: 8px 16px;
  vertical-align: middle;
}

/* ===== RESPONSIVE DATA GRID - TABLET (769-1024px) ===== */
/* Shopify Admin sidebar gizlendiğinde, içerik full-width olur */
@media (max-width: 1024px) and (min-width: 769px) {
  .polaris-card .table {
    table-layout: fixed;
  }

  /* Checkbox column */
  .polaris-card .table .bulk-checkbox-col {
    width: 44px;
  }

  /* Name column - proportionally reduced */
  .polaris-card .table th:nth-child(2),
  .polaris-card .table td:nth-child(2) {
    width: 22%;
    min-width: 130px;
    max-width: 220px;
  }

  /* Phone column */
  .polaris-card .table th:nth-child(3),
  .polaris-card .table td:nth-child(3) {
    width: 120px;
  }

  /* Email column */
  .polaris-card .table th:nth-child(4),
  .polaris-card .table td:nth-child(4) {
    width: 170px;
  }

  /* Tags column - percentage based */
  .polaris-card .table th:nth-child(5),
  .polaris-card .table td:nth-child(5) {
    width: 14%;
    min-width: 90px;
  }

  /* Actions column - wider for button spacing */
  .polaris-card .table th:nth-child(6),
  .polaris-card .table td:nth-child(6) {
    width: 100px;
  }

  /* Reduced padding */
  .polaris-card .table thead th,
  .polaris-card .table tbody td {
    padding: 10px 14px;
  }
}

/* ===== RESPONSIVE DATA GRID - LARGE MOBILE (490-768px) ===== */
@media (max-width: 768px) and (min-width: 490px) {
  .polaris-card .table {
    table-layout: fixed;
  }

  /* Checkbox column */
  .polaris-card .table .bulk-checkbox-col {
    width: 40px;
  }

  /* Name column */
  .polaris-card .table th:nth-child(2),
  .polaris-card .table td:nth-child(2) {
    width: 22%;
    min-width: 120px;
    max-width: 200px;
  }

  /* Phone column */
  .polaris-card .table th:nth-child(3),
  .polaris-card .table td:nth-child(3) {
    width: 110px;
  }

  /* Email column */
  .polaris-card .table th:nth-child(4),
  .polaris-card .table td:nth-child(4) {
    width: 160px;
  }

  /* Tags column - percentage based */
  .polaris-card .table th:nth-child(5),
  .polaris-card .table td:nth-child(5) {
    width: 12%;
    min-width: 80px;
  }

  /* Actions column - wider for button spacing */
  .polaris-card .table th:nth-child(6),
  .polaris-card .table td:nth-child(6) {
    width: 95px;
  }

  /* Reduced padding */
  .polaris-card .table thead th,
  .polaris-card .table tbody td {
    padding: 8px 10px;
  }

  /* Maintain row height */
  .polaris-card .table tbody td {
    height: 52px;
  }
}

/* ===== FAZ 2: TOUCH TARGET İYİLEŞTİRMELERİ ===== */

/* Checkbox - base size increased */
.polaris-card .table .bulk-checkbox-col .form-check-input {
  width: 20px;
  height: 20px;
  margin: 0;
  cursor: pointer;
}

/* Touch devices: larger checkbox hit area */
@media (pointer: coarse) {
  .polaris-card .table .bulk-checkbox-col .form-check-input {
    width: 24px;
    height: 24px;
  }

  /* Checkbox column wider for comfortable tapping */
  .polaris-card .table .bulk-checkbox-col {
    width: 56px;
    padding: 8px 16px;
  }

  /* Action buttons - 44px minimum for touch */
  .polaris-card .table .btn-sm {
    min-width: 44px;
    min-height: 44px;
    padding: 10px 12px;
  }

  /* Increase gap between action buttons for touch */
  .polaris-card .table td .d-inline-flex.gap-1 {
    gap: 8px !important;
  }

  /* Row tap area enhancement */
  .polaris-card .table tbody tr {
    cursor: pointer;
  }
}

/* ===== FAZ 3: TAGS OVERFLOW (+N MORE) ===== */

.contact-tags-cell .tags-container {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
}

.contact-tags-cell .tags-container .badge {
  white-space: nowrap;
  flex-shrink: 0;
}

/* ===== FAZ 4: MOBİL COLUMN PRIORITY (490-767px) ===== */
/* Tags sütunu gizlenir, diğerleri yeniden boyutlandırılır */
@media (max-width: 767px) and (min-width: 490px) {
  /* Hide Tags column - lowest priority information */
  .polaris-card .table th:nth-child(5),
  .polaris-card .table td:nth-child(5) {
    display: none;
  }

  /* Redistribute space to remaining columns */
  .polaris-card .table th:nth-child(2),
  .polaris-card .table td:nth-child(2) {
    width: 28%;
    min-width: 130px;
  }

  .polaris-card .table th:nth-child(3),
  .polaris-card .table td:nth-child(3) {
    width: 115px;
  }

  .polaris-card .table th:nth-child(4),
  .polaris-card .table td:nth-child(4) {
    width: 170px;
  }

  /* Actions column - wider for button spacing */
  .polaris-card .table th:nth-child(6),
  .polaris-card .table td:nth-child(6) {
    width: 90px;
  }
}

/* ===== FAZ 5: CARD LAYOUT (< 490px) ===== */
/* Matches Shopify Polaris condensed mode threshold */
@media (max-width: 489px) {
  /* Hide table header - data labels will be contextual */
  .polaris-card .table thead {
    display: none;
  }

  /* Transform table rows to card-like blocks */
  .polaris-card .table,
  .polaris-card .table tbody,
  .polaris-card .table tr,
  .polaris-card .table td {
    display: block;
    width: 100%;
  }

  /* Card-style rows */
  .polaris-card .table tbody tr {
    padding: 16px;
    padding-left: 48px;
    border-bottom: 1px solid var(--polaris-border);
    position: relative;
    min-height: auto;
  }

  .polaris-card .table tbody tr:last-child {
    border-bottom: none;
  }

  .polaris-card .table tbody tr:hover {
    background-color: #F6F6F7;
  }

  /* Checkbox - top left positioning */
  .polaris-card .table .bulk-checkbox-col {
    position: absolute;
    top: 16px;
    left: 12px;
    width: auto;
    padding: 0;
    height: auto;
  }

  /* Name cell - primary, no offset needed due to row padding */
  .polaris-card .table td:nth-child(2) {
    font-size: 15px;
    font-weight: 600;
    padding: 0 0 4px 0;
    max-width: none;
    min-width: unset;
    height: auto;
  }

  .polaris-card .table td:nth-child(2) .contact-name-wrapper {
    flex-wrap: wrap;
    padding-right: 70px; /* Space for actions */
  }

  /* Phone cell - with label */
  .polaris-card .table td:nth-child(3) {
    font-size: 13px;
    color: var(--polaris-text-subdued);
    padding: 2px 0;
    width: auto;
    height: auto;
  }

  .polaris-card .table td:nth-child(3)::before {
    content: "Phone: ";
    font-weight: 500;
    color: var(--polaris-text-subdued);
  }

  /* Email cell - with label */
  .polaris-card .table td:nth-child(4) {
    font-size: 13px;
    color: var(--polaris-text-subdued);
    padding: 2px 0;
    width: auto;
    height: auto;
  }

  .polaris-card .table td:nth-child(4)::before {
    content: "Email: ";
    font-weight: 500;
    color: var(--polaris-text-subdued);
  }

  /* Tags cell */
  .polaris-card .table td:nth-child(5) {
    padding: 8px 0 0 0;
    height: auto;
  }

  .polaris-card .table td:nth-child(5) .tags-container,
  .polaris-card .table td:nth-child(5) .d-flex {
    flex-wrap: wrap;
  }

  /* Actions - top right corner */
  .polaris-card .table td:nth-child(6) {
    position: absolute;
    top: 12px;
    right: 12px;
    width: auto;
    padding: 0;
    height: auto;
  }

  /* Hide empty phone/email cells (showing just "-") */
  .polaris-card .table td:nth-child(3):has(.polaris-subdued),
  .polaris-card .table td:nth-child(4):has(.polaris-subdued) {
    display: none;
  }

  /* Remove truncation on card layout */
  .polaris-card .table .contact-email-cell,
  .polaris-card .table .contact-phone-cell {
    overflow: visible;
    text-overflow: unset;
    white-space: normal;
    max-width: none;
  }
}

/* ===== FAZ 6: STICKY TABLE HEADER ===== */

/* Wrapper for horizontal scroll control */
.table-responsive-wrapper {
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  position: relative;
}

/* Sticky header - works within the wrapper */
.polaris-card .table thead th {
  position: sticky;
  top: 0;
  z-index: 10;
  background: #FAFBFB;
}

/* Scroll shadow indicators */
.table-responsive-wrapper.has-scroll-left::before,
.table-responsive-wrapper.has-scroll-right::after {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  width: 20px;
  pointer-events: none;
  z-index: 11;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.table-responsive-wrapper.has-scroll-left::before {
  left: 0;
  background: linear-gradient(to right, rgba(0,0,0,0.06), transparent);
  opacity: 1;
}

.table-responsive-wrapper.has-scroll-right::after {
  right: 0;
  background: linear-gradient(to left, rgba(0,0,0,0.06), transparent);
  opacity: 1;
}

/* Disable sticky on card layout */
@media (max-width: 489px) {
  .polaris-card .table thead th {
    position: static;
  }

  .table-responsive-wrapper::before,
  .table-responsive-wrapper::after {
    display: none;
  }
}

/* ===== FAZ 7: FILTER CARD MOBILE ===== */
@media (max-width: 575px) {
  .polaris-filter-card .card-body {
    padding: 12px 16px;
  }

  .polaris-filter-card .row.g-2 {
    flex-direction: column;
    gap: 12px !important;
  }

  .polaris-filter-card .col,
  .polaris-filter-card .col-auto {
    width: 100% !important;
    flex: none !important;
  }

  .polaris-filter-card .col-auto.d-flex {
    display: flex !important;
    flex-wrap: wrap;
    gap: 8px !important;
  }

  .polaris-filter-card .col-auto .btn {
    flex: 1 1 calc(50% - 4px);
    min-width: 0;
  }

  /* Prevent iOS zoom on input focus */
  .polaris-filter-card .form-control {
    font-size: 16px;
  }

  /* Filter dropdown full width */
  .polaris-filter-card .polaris-filter-dropdown {
    flex: 1 1 100%;
  }

  .polaris-filter-card .polaris-filter-btn {
    width: 100%;
    justify-content: space-between !important;
  }

  .polaris-filter-card .polaris-filter-menu {
    left: 0;
    right: 0;
    min-width: auto;
  }

  /* Search form stacks */
  .polaris-filter-card form.d-flex {
    flex-direction: column;
    gap: 8px;
  }

  .polaris-filter-card form.d-flex .btn {
    width: 100%;
  }
}

@media (max-width: 374px) {
  .polaris-filter-card .col-auto .btn {
    flex: 1 1 100%;
  }
}

/* ===== FAZ 8: PAGE HEADER MOBILE ===== */
@media (max-width: 575px) {
  .polaris-page-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .polaris-page-header .btn {
    width: 100%;
    justify-content: center;
  }

  .polaris-page-header h4 {
    font-size: 18px;
  }

  .polaris-page-header p {
    font-size: 13px;
  }
}

/* ===== ANALYTICS PAGE - SEGMENT BADGES ===== */
.segment-badge {
  padding: 16px;
  border-radius: 8px;
  text-align: center;
}

.segment-badge .segment-value {
  font-size: 1.75rem;
  font-weight: 600;
  line-height: 1.2;
}

.segment-badge .segment-label {
  font-size: 0.875rem;
  color: var(--polaris-text-subdued);
  margin-top: 4px;
}

.segment-badge .segment-sublabel {
  font-size: 0.75rem;
  color: var(--polaris-text-subdued);
  opacity: 0.8;
}

/* Segment badge color variants - Polaris colors */
.segment-badge-success {
  background: #AEE9D1;
}
.segment-badge-success .segment-value {
  color: #0B5D42;
}

.segment-badge-info {
  background: #A4E8F2;
}
.segment-badge-info .segment-value {
  color: #00464F;
}

.segment-badge-warning {
  background: #FFEA8A;
}
.segment-badge-warning .segment-value {
  color: #6B5E00;
}

.segment-badge-danger {
  background: #FED3D1;
}
.segment-badge-danger .segment-value {
  color: #9E1A1A;
}

.segment-badge-purple {
  background: #E4DBFF;
}
.segment-badge-purple .segment-value {
  color: #5C2D91;
}

/* Analytics stat icon colors */
.analytics-icon-primary {
  background: rgba(0, 128, 96, 0.1);
  color: #008060;
}

.analytics-icon-success {
  background: rgba(11, 93, 66, 0.1);
  color: #0B5D42;
}

.analytics-icon-info {
  background: rgba(0, 111, 187, 0.1);
  color: #006FBB;
}

.analytics-icon-secondary {
  background: #F1F2F3;
  color: var(--polaris-text-subdued);
}

/* ===== ANALYTICS - TRACKING INFO BANNER ===== */
.tracking-info-banner {
  background: linear-gradient(135deg, #ECFDF5 0%, #D1FAE5 100%);
  border-color: #34D399 !important;
}

.tracking-info-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: rgba(5, 150, 105, 0.15);
  border: 1px solid #34D399;
  color: #059669;
  flex-shrink: 0;
}

.tracking-info-icon .bi {
  font-size: 20px;
}

.tracking-info-content {
  flex: 1;
  min-width: 0;
}

.tracking-info-title {
  font-weight: 600;
  font-size: 15px;
  color: #065F46;
}

.tracking-info-text {
  font-size: 13px;
  line-height: 1.5;
  color: #065F46;
  opacity: 0.9;
}

.tracking-info-features {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 12px;
}

.tracking-info-features span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: #047857;
  font-weight: 500;
}

.tracking-info-features .bi-check2 {
  color: #059669;
  font-size: 14px;
}

.tracking-info-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}

.tracking-info-action {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 500;
  line-height: 1;
  border-radius: 8px;
  text-decoration: none;
  transition: all 0.15s ease;
}

/* Primary button - Enable in Theme */
.tracking-info-action-primary {
  color: #FFFFFF;
  background-color: #059669;
  border: none;
}

.tracking-info-action-primary:hover {
  background-color: #047857;
  color: #FFFFFF;
  text-decoration: none;
}

/* Secondary button - Setup Guide */
.tracking-info-action-secondary {
  color: #059669;
  background-color: rgba(5, 150, 105, 0.1);
  border: 1px solid #34D399;
}

.tracking-info-action-secondary:hover {
  background-color: rgba(5, 150, 105, 0.2);
  color: #047857;
  text-decoration: none;
}

/* Already Enabled badge */
.tracking-info-action-enabled {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  color: #008060;
  background: #F1F8F5;
  border: 1px solid #C9E8D9;
  cursor: default;
}

.tracking-info-dismiss {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  background: transparent;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  color: #065F46;
  opacity: 0.6;
  flex-shrink: 0;
  transition: all 0.15s ease;
}

.tracking-info-dismiss:hover {
  opacity: 1;
  background-color: rgba(5, 150, 105, 0.1);
}

/* Responsive */
@media (max-width: 767.98px) {
  .tracking-info-features {
    flex-direction: column;
    gap: 8px;
  }

  .tracking-info-banner .card-body {
    flex-direction: column;
  }

  .tracking-info-dismiss {
    position: absolute;
    top: 12px;
    right: 12px;
  }

  .tracking-info-banner {
    position: relative;
  }
}

/* ===== IMPORT PAGE - DUPLICATE OPTION CARDS ===== */
.duplicate-option-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20px 16px;
  border: 2px solid var(--polaris-border);
  border-radius: 12px;
  background: var(--polaris-surface);
  cursor: pointer;
  transition: all 0.15s ease;
  text-align: center;
  height: 100%;
}

.duplicate-option-card:hover {
  border-color: #8C9196;
  background: #FAFBFB;
}

.duplicate-option-card.active {
  border-color: var(--polaris-primary);
  background: rgba(0, 128, 96, 0.04);
}

.duplicate-option-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  margin-bottom: 12px;
  background: #F6F6F7;
}

.duplicate-option-card.active .duplicate-option-icon {
  background: rgba(0, 128, 96, 0.1);
}

.duplicate-option-title {
  font-weight: 600;
  font-size: 15px;
  color: var(--polaris-text);
  margin-bottom: 4px;
}

.duplicate-option-desc {
  font-size: 13px;
  color: var(--polaris-text-subdued);
  margin-bottom: 12px;
  line-height: 1.4;
}

.duplicate-option-badge {
  font-size: 11px;
  padding: 4px 10px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.duplicate-option-badge.badge-subtle-success {
  background: #AEE9D1;
  color: #0B5D42;
}

.duplicate-option-badge.badge-subtle-info {
  background: #A4E8F2;
  color: #00464F;
}

.duplicate-option-badge.badge-subtle-warning {
  background: #FFEA8A;
  color: #6B5E00;
}

/* Responsive: Stack cards on mobile */
@media (max-width: 767.98px) {
  .duplicate-option-card {
    padding: 16px 12px;
  }

  .duplicate-option-icon {
    width: 40px;
    height: 40px;
    font-size: 20px;
  }
}

/* ---- Polaris Page Transition Loading Bar ---- */
.polaris-loading-bar {
  position: fixed;
  top: 0;
  left: 0;
  width: 0;
  height: 3px;
  background: var(--polaris-primary);
  z-index: 10200;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.polaris-loading-bar.active {
  opacity: 1;
  animation: polaris-loading-progress 10s cubic-bezier(0.1, 0.05, 0.1, 0.05) forwards;
}

.polaris-loading-bar.finishing {
  opacity: 1;
  width: 100% !important;
  animation: none;
  transition: width 0.2s ease-out, opacity 0.3s ease 0.2s;
}

.polaris-loading-bar.finished {
  opacity: 0;
  width: 100% !important;
  animation: none;
}

@keyframes polaris-loading-progress {
  0%   { width: 0; }
  10%  { width: 30%; }
  30%  { width: 55%; }
  50%  { width: 70%; }
  70%  { width: 80%; }
  100% { width: 90%; }
}

/* Content fade during page navigation */
.main-content {
  transition: opacity 0.2s ease;
}

.main-content.navigating {
  opacity: 0.6;
  transition: opacity 0.2s ease;
  pointer-events: none;
}

/* ---- UI Polish: Button press micro-interaction ---- */
.btn {
  transition: all 0.15s ease;
}

.btn:active:not(:disabled) {
  transform: scale(0.97);
}

/* ---- UI Polish: Focus ring for keyboard navigation (a11y) ---- */
.btn:focus-visible,
.form-control:focus-visible,
.form-select:focus-visible,
.page-link:focus-visible {
  outline: 2px solid var(--polaris-primary);
  outline-offset: 2px;
  box-shadow: none;
}

/* ---- UI Polish: Dashboard card hover lift ---- */
.dashboard-stat-card {
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.dashboard-stat-card:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  transform: translateY(-2px);
}

/* ---- UI Polish: Filter active dot indicator ---- */
.filter-active-dot {
  width: 8px;
  height: 8px;
  background: var(--polaris-primary);
  border-radius: 50%;
  display: inline-block;
  margin-left: 4px;
  vertical-align: middle;
}

/* ==========================================================================
   Contacts v2: Segmented Control + Filter Chips + Race Mitigation
   ========================================================================== */

/* Segmented control — wrapper */
.segmented-control {
  display: flex;
  border: 1px solid var(--polaris-border);
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 16px;
  background: var(--polaris-surface);
}

.segmented-control-segment {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 12px 16px;
  text-decoration: none;
  color: var(--polaris-text);
  background: var(--polaris-surface);
  transition: background-color 0.15s ease;
  border-right: 1px solid var(--polaris-border);
  cursor: pointer;
  outline: none;
}

.segmented-control-segment:last-child {
  border-right: none;
}

.segmented-control-segment:hover {
  background: var(--polaris-bg);
  color: var(--polaris-text);
  text-decoration: none;
}

.segmented-control-segment:focus-visible {
  box-shadow: inset 0 0 0 2px var(--polaris-link);
}

.segmented-control-segment--active {
  background: var(--polaris-bg);
  color: var(--polaris-text);
  font-weight: 600;
  box-shadow: inset 0 -3px 0 var(--polaris-primary);
}

.segmented-control-segment--active:hover {
  background: var(--polaris-bg);
}

.segmented-control-segment-label {
  font-size: 14px;
  line-height: 1.3;
}

.segmented-control-segment-count {
  font-size: 12px;
  color: var(--polaris-text-subdued);
  margin-top: 2px;
}

/* Filter chips */
.filter-chip-row {
  /* container — uses Bootstrap d-flex flex-wrap gap-2 utilities in markup */
}

.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 12px;
  border: 1px solid var(--polaris-border);
  border-radius: 999px;
  background: var(--polaris-surface);
  color: var(--polaris-text);
  font-size: 13px;
  line-height: 1.5;
  text-decoration: none;
  transition: background-color 0.15s ease, border-color 0.15s ease;
  cursor: pointer;
  white-space: nowrap;
}

.filter-chip:hover {
  background: var(--polaris-bg);
  border-color: var(--polaris-text-subdued);
  color: var(--polaris-text);
  text-decoration: none;
}

.filter-chip--active {
  background: var(--polaris-primary);
  border-color: var(--polaris-primary);
  color: var(--polaris-surface);
  font-weight: 500;
}

.filter-chip--active:hover {
  background: var(--polaris-primary-hover);
  border-color: var(--polaris-primary-hover);
  color: var(--polaris-surface);
}

.filter-chip-icon {
  font-size: 14px;
  line-height: 1;
}

/* Segment-link race mitigation: applied during async bulk operations */
.segment-link-disabled {
  pointer-events: none;
  opacity: 0.5;
  cursor: not-allowed;
}

/* ===== Orders pages ===== */

/* Whole-row navigation (rows carrying a data-href target) */
tr[data-href] {
  cursor: pointer;
}

/* Orders grid column plan — fixed layout with th-based widths (the first row sizes
   fixed-layout columns; class-selector widths on <col> elements are unreliable across
   engines). Compact columns get fixed percentages, .col-customer (no width) absorbs
   the rest. Below the min-width the wrapper scrolls instead of crushing columns. */
#orders-table,
#drafts-table {
  table-layout: fixed;
  min-width: 800px;
}

#orders-table td,
#drafts-table td {
  vertical-align: middle;
}

#orders-table .col-order, #drafts-table .col-order { width: 10%; }
#orders-table .col-date, #drafts-table .col-date { width: 12%; }
#orders-table .col-status, #drafts-table .col-status { width: 17%; }
#orders-table .col-items { width: 6%; } /* orders only — drafts has no Items column */
#orders-table .col-total, #drafts-table .col-total { width: 13%; }
#orders-table .col-actions, #drafts-table .col-actions { width: 8%; }

/* Single-line cell that must never wrap (dates, money) */
.cell-nowrap {
  white-space: nowrap;
}

/* Ellipsis-truncated cell content (full value provided via title attribute) */
.cell-truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Order status tag — same shape family as .address-default-badge (11px / soft solid
   background / 10px radius), in the four Polaris badge tones. Rendered by the
   x-order-status-badge component (list, detail header, companies Recent Orders card). */
.status-tag {
  display: inline-block;
  font-size: 11px;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: 10px;
  white-space: nowrap;
}

.status-tag--subdued {
  background: #E4E5E7;
  color: #202223;
}

.status-tag--warning {
  background: #FFEA8A;
  color: #6B5E00;
}

.status-tag--info {
  background: #A4E8F2;
  color: #00464F;
}

.status-tag--danger {
  background: #FED3D1;
  color: #5F1613;
}

/* Line-item thumbnail (order detail) with icon placeholder fallback */
.line-item-thumb {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  object-fit: cover;
  border: 1px solid var(--polaris-border);
  flex-shrink: 0;
}

.line-item-thumb--placeholder {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--polaris-bg);
  color: var(--polaris-text-subdued);
  font-size: 16px;
}


/* ============================================================
   Document Template Editor (Templates -> Customize) — Faz 2
   ============================================================ */
/* App-wide switch style (green, Polaris). Used on the Settings tab and the
   document editor sidebar so every toggle in the app reads the same. */
.settings-toggle {
  width: 44px !important;
  height: 24px !important;
  cursor: pointer;
}
.settings-toggle:checked {
  background-color: #008060 !important;
  border-color: #008060 !important;
}
.settings-toggle:focus {
  box-shadow: 0 0 0 0.2rem rgba(0, 128, 96, 0.25) !important;
  border-color: #008060 !important;
}

.doc-editor-body {
  display: grid;
  /* minmax(0, 1fr): let the preview track shrink below the 820px document so any
     overflow is contained inside the preview panel, never on the whole page. */
  grid-template-columns: 340px minmax(0, 1fr);
  gap: 16px;
  min-height: 560px;
}
@media (max-width: 900px) {
  .doc-editor-body { grid-template-columns: 1fr; }
}
.doc-editor-sidebar {
  padding: 6px 0;
  overflow: hidden;
  align-self: start;
}
.doc-editor-section { border-bottom: 1px solid var(--polaris-border-subdued, #ebedef); }
.doc-editor-section:last-of-type { border-bottom: none; }
.doc-editor-section summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 11px 16px;
  font-weight: 600;
  font-size: 13px;
}
.doc-editor-section summary::-webkit-details-marker { display: none; }
.doc-editor-section summary::after {
  content: "\25BE";
  color: var(--polaris-text-subdued);
  font-size: 11px;
  margin-left: auto;
  transition: transform .15s;
}
.doc-editor-section:not([open]) summary::after { transform: rotate(-90deg); }
.doc-editor-sec { padding: 2px 16px 14px; }
.de-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 6px 0;
  font-size: 13px;
}
.de-row > label { color: var(--polaris-text); margin: 0; flex: 1; min-width: 0; }
.de-row .form-select, .de-row .form-control { max-width: 150px; font-size: 13px; }
.de-row.de-row-wide { flex-wrap: wrap; }
.de-row.de-row-wide .form-control, .de-row.de-row-wide textarea { max-width: 100%; flex-basis: 100%; }
.de-row input[type="color"] {
  width: 34px; height: 24px; padding: 1px;
  border: 1px solid var(--polaris-border); border-radius: 6px; background: #fff;
}
.de-row input[type="range"] { width: 130px; accent-color: var(--polaris-primary); }
.de-row .de-link-input { max-width: 110px; font-size: 12px; }
.de-row.de-child { margin-left: 12px; padding-left: 10px; border-left: 2px solid var(--polaris-border-subdued, #ebedef); }
.de-subgroup {
  margin: 10px 0 4px;
  font-size: 11px; font-weight: 700; letter-spacing: .7px;
  color: var(--polaris-text-subdued); text-transform: uppercase;
}
.de-badge {
  font-size: 11px; font-weight: 700; border-radius: 8px; padding: 1px 7px;
  background: var(--polaris-bg); color: var(--polaris-text-subdued); text-transform: none;
}
.de-hint { font-size: 12px; color: var(--polaris-text-subdued); margin: 4px 0 0; line-height: 1.5; }
.de-hint-inline { font-size: 11px; color: var(--polaris-text-subdued); font-weight: 400; }
.doc-editor-preview {
  background: #eceef0;
  border: 1px solid var(--polaris-border);
  border-radius: 12px;
  padding: 22px;
  overflow: auto; /* dogal 820px belge — scale/zoom YOK, kaydirma var */
  min-width: 0; /* grid item may shrink below its content → scroll stays in the box */
  position: relative;
}
.doc-editor-preview .template-preview { width: fit-content; margin: 0 auto; background: #fff; box-shadow: 0 3px 14px rgba(0,0,0,.14); }
.doc-editor-preview-meta { position: sticky; top: 0; display: flex; justify-content: flex-end; z-index: 2; height: 0; }
.doc-editor-pill {
  background: #fff; border: 1px solid var(--polaris-border); border-radius: 999px;
  font-size: 11px; color: var(--polaris-text-subdued); padding: 2px 9px; font-weight: 600;
}
.doc-editor-spin {
  width: 11px; height: 11px; display: inline-block; border-radius: 50%;
  border: 2px solid var(--polaris-border); border-top-color: var(--polaris-primary);
  animation: doc-editor-spin 1s linear infinite; vertical-align: -2px;
}
@keyframes doc-editor-spin { to { transform: rotate(360deg); } }
.edit-text-mode .template-preview [contenteditable="true"] {
  outline: 1px dashed var(--polaris-primary);
  outline-offset: 2px;
  cursor: text;
}
.doc-editor-fallback-bar {
  position: sticky; bottom: 0; z-index: 5;
  display: flex; align-items: center; gap: 8px;
  background: #1a1c1d; color: #fff;
  border-radius: 10px; padding: 9px 16px; margin-top: 12px;
}
.doc-editor-fallback-bar.d-none { display: none; }
.doc-editor-dot {
  width: 8px; height: 8px; border-radius: 50%; background: #ffd79d; display: inline-block;
}
