
/* ========== Modern UI System v3 ========== */
:root {
  --m-bg: #eef2ff;
  --m-bg2: #f8fafc;
  --m-surface: rgba(255,255,255,0.85);
  --m-surface-solid: #ffffff;
  --m-border: rgba(148,163,184,0.35);
  --m-text: #0f172a;
  --m-muted: #64748b;
  --m-primary: #1d4ed8;
  --m-primary-2: #4f46e5;
  --m-accent: #0d9488;
  --m-danger: #e11d48;
  --m-radius: 18px;
  --m-radius-sm: 12px;
  --m-shadow: 0 10px 40px rgba(15, 23, 42, 0.08);
  --m-shadow-sm: 0 4px 16px rgba(15, 23, 42, 0.06);
}

html.dark {
  --m-bg: #0b1220;
  --m-bg2: #111827;
  --m-surface: rgba(30, 41, 59, 0.88);
  --m-surface-solid: #1e293b;
  --m-border: rgba(71, 85, 105, 0.55);
  --m-text: #f1f5f9;
  --m-muted: #94a3b8;
  --m-shadow: 0 12px 40px rgba(0,0,0,0.35);
}

body {
  font-family: 'Vazirmatn', Tahoma, sans-serif !important;
  background:
    radial-gradient(1200px 600px at 100% -10%, rgba(99,102,241,0.18), transparent 55%),
    radial-gradient(900px 500px at -10% 10%, rgba(13,148,136,0.14), transparent 50%),
    linear-gradient(180deg, var(--m-bg), var(--m-bg2)) !important;
  background-attachment: fixed !important;
  color: var(--m-text) !important;
  -webkit-font-smoothing: antialiased;
}

.container, .max-w-6xl {
  max-width: 1120px !important;
}

/* Glass cards */
.card, .table-wrapper, #shopHeader, .tabs, #adminTabs, .filter-tabs, .ticket-chat-pane, .ticket-inbox-list {
  background: var(--m-surface) !important;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--m-border) !important;
  border-radius: var(--m-radius) !important;
  box-shadow: var(--m-shadow-sm) !important;
}

.card {
  padding: 1.25rem 1.35rem !important;
  margin-bottom: 1rem !important;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.card:hover {
  box-shadow: var(--m-shadow) !important;
}

.card h3, header h1, #shopTitle {
  color: var(--m-text) !important;
  letter-spacing: -0.02em;
  font-weight: 800 !important;
}

.hint, header h2, #shopSubtitle {
  color: var(--m-muted) !important;
}

/* Tabs modern pill */
.tabs, #adminTabs {
  padding: 0.45rem !important;
  gap: 0.35rem !important;
  overflow-x: auto;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar, #adminTabs::-webkit-scrollbar { display: none; }

.tab-btn, .filter-btn {
  border-radius: 999px !important;
  border: none !important;
  background: transparent !important;
  color: var(--m-muted) !important;
  font-weight: 700 !important;
  padding: 0.55rem 1rem !important;
  transition: all 0.18s ease !important;
}
.tab-btn:hover, .filter-btn:hover {
  background: rgba(99,102,241,0.08) !important;
  color: var(--m-text) !important;
}
.tab-btn.active, .filter-btn.active {
  background: linear-gradient(135deg, var(--m-primary), var(--m-primary-2)) !important;
  color: #fff !important;
  box-shadow: 0 8px 20px rgba(37, 99, 235, 0.28) !important;
}

/* Buttons */
button:not(.tab-btn):not(.filter-btn):not(.share-btn):not(.ticket-row),
.btn {
  border-radius: 12px !important;
  font-weight: 700 !important;
  letter-spacing: -0.01em;
  transition: transform 0.15s ease, filter 0.15s ease, box-shadow 0.15s ease !important;
}
button:not(.tab-btn):not(.filter-btn):not(.share-btn):not(.ticket-row):not(.secondary):not(.danger):not(.ticket-row) {
  background: linear-gradient(135deg, var(--m-primary), var(--m-primary-2)) !important;
  box-shadow: 0 8px 18px rgba(37, 99, 235, 0.25) !important;
}
button:not(.tab-btn):not(.filter-btn):not(.ticket-row):hover {
  transform: translateY(-1px);
  filter: brightness(1.05);
}
.secondary {
  background: rgba(148,163,184,0.18) !important;
  color: var(--m-text) !important;
  box-shadow: none !important;
}
.danger {
  background: linear-gradient(135deg, #e11d48, #f43f5e) !important;
  color: #fff !important;
  box-shadow: 0 8px 18px rgba(225, 29, 72, 0.25) !important;
}

/* Inputs */
input[type="text"], input[type="password"], input[type="number"], input[type="file"],
textarea, select {
  border-radius: 12px !important;
  border: 1px solid var(--m-border) !important;
  background: var(--m-surface-solid) !important;
  color: var(--m-text) !important;
  padding: 0.7rem 0.9rem !important;
  transition: border-color 0.15s, box-shadow 0.15s;
}
input:focus, textarea:focus, select:focus {
  border-color: #93c5fd !important;
  box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.15) !important;
  outline: none !important;
}

/* Table modern */
.table-wrapper {
  overflow: hidden !important;
}
table thead tr {
  background: linear-gradient(135deg, #1e3a8a, #4f46e5) !important;
}
table th {
  font-weight: 700 !important;
  font-size: 0.82rem !important;
  letter-spacing: 0.01em;
}
table tbody tr {
  transition: background 0.15s ease;
}
table tbody tr:hover {
  background: rgba(99,102,241,0.06) !important;
}
html.dark table tbody tr:hover {
  background: rgba(99,102,241,0.12) !important;
}

/* Share / action chips */
.share-btn, .track-btn, .copy-btn {
  border-radius: 10px !important;
  font-weight: 700 !important;
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

/* Ticket chat modern */
.ticket-chat-header {
  background: linear-gradient(135deg, #1e3a8a, #4f46e5) !important;
  color: #fff !important;
  border-radius: 0 !important;
}
.msg-bubble {
  border-radius: 16px !important;
  box-shadow: 0 4px 14px rgba(15,23,42,0.06) !important;
}
.ticket-row {
  transition: background 0.15s ease, transform 0.15s ease;
}
.ticket-row:hover {
  background: rgba(99,102,241,0.08) !important;
}
.ticket-row.active {
  background: rgba(99,102,241,0.14) !important;
  border-right: 3px solid #4f46e5 !important;
}

/* License banner */
.license-banner.show {
  border-radius: 14px !important;
  font-weight: 700 !important;
  box-shadow: var(--m-shadow-sm);
}

/* Header actions */
.admin-link {
  border-radius: 999px !important;
  border: 1px solid rgba(37,99,235,0.35) !important;
  color: var(--m-primary) !important;
  background: rgba(255,255,255,0.7) !important;
  padding: 0.4rem 0.9rem !important;
  font-weight: 700 !important;
}
html.dark .admin-link {
  background: rgba(30,41,59,0.8) !important;
  color: #93c5fd !important;
}

/* Footer */
footer, .copyright {
  color: var(--m-muted) !important;
}
.copyright a {
  color: var(--m-primary) !important;
  font-weight: 700;
}

/* Mobile polish */
@media (max-width: 700px) {
  .card { border-radius: 16px !important; padding: 1rem !important; }
  .tab-btn, .filter-btn { padding: 0.5rem 0.8rem !important; font-size: 0.78rem !important; }
}

/* Bridge styles with Tailwind CDN */
.tab-panel { display: none; }
.tab-panel.active { display: block; animation: fadeUp 0.35s ease both; }
.tab-btn.active {
  background: linear-gradient(135deg, #0f2744 0%, #1e4e8c 100%) !important;
  color: #fff !important;
  box-shadow: 0 6px 16px rgba(30, 78, 140, 0.28);
}
.filter-btn.active {
  background: linear-gradient(135deg, #0f2744 0%, #1e4e8c 100%) !important;
  color: #fff !important;
}
.license-banner.show { display: block !important; }
.license-banner.expired { background: #fef2f2; border: 1px solid #fecaca; color: #b91c1c; }
.license-banner {
  display: none;
  background: linear-gradient(90deg, #ecfeff 0%, #e0f2fe 100%);
  border: 1px solid #99f6e4;
  color: #0f766e;
}
.status { margin-top: 10px; font-size: 0.9rem; }
.status.success { color: #047857; }
.status.error { color: #b91c1c; }
.error { color: #b91c1c; font-size: 0.9rem; margin-top: 8px; }

/* buttons default when not utility-heavy */
button:not(.tab-btn):not(.filter-btn):not(.share-btn):not(.ticket-row):not(.secondary):not(.danger):not(.ticket-row) {
  background: linear-gradient(135deg, #0f2744 0%, #1e4e8c 100%);
  color: #fff;
  border: none;
  padding: 0.6rem 1.1rem;
  border-radius: 0.75rem;
  font-family: inherit;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(15, 39, 68, 0.18);
}
input, textarea, select {
  font-family: inherit;
}
input[type="text"], input[type="password"], input[type="number"], textarea, select {
  border: 1px solid #e2e8f0;
  border-radius: 0.75rem;
  padding: 0.6rem 0.85rem;
  width: 100%;
  background: #fff;
}
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: #93c5fd;
  box-shadow: 0 0 0 3px rgba(30, 78, 140, 0.12);
}

:root {
  --primary: #0f2744;
  --primary-light: #1e4e8c;
  --accent: #0d9488;
  --accent-soft: #ccfbf1;
  --danger: #dc2626;
  --warn: #d97706;
  --bg: #f0f4f8;
  --bg-glow: radial-gradient(1200px 600px at 100% -10%, #dbeafe 0%, transparent 55%),
             radial-gradient(900px 500px at -10% 20%, #ccfbf1 0%, transparent 50%),
             #f0f4f8;
  --card: #ffffff;
  --border: #e2e8f0;
  --text: #0f172a;
  --muted: #64748b;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 10px 30px rgba(15, 39, 68, 0.07);
  --shadow-sm: 0 2px 8px rgba(15, 39, 68, 0.05);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Vazirmatn', Tahoma, sans-serif;
  background: var(--bg-glow);
  background-attachment: fixed;
  color: var(--text);
  line-height: 1.65;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea, table, .tab-btn, .status, .hint {
  font-family: 'Vazirmatn', Tahoma, sans-serif;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px 16px 60px;
}

header {
  text-align: center;
  margin-bottom: 28px;
  position: relative;
}

header h1 {
  font-size: 1.85rem;
  color: var(--primary);
  margin-bottom: 4px;
  letter-spacing: -0.02em;
}

header h2 {
  font-size: 1.05rem;
  color: var(--muted);
  font-weight: 500;
}

#shopHeader {
  background: rgba(255,255,255,0.75);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 16px 20px;
  box-shadow: var(--shadow-sm);
}

.admin-link {
  position: absolute;
  left: 0;
  top: 8px;
  font-size: 0.9rem;
  color: var(--primary-light);
  text-decoration: none;
  border: 1px solid var(--primary-light);
  padding: 6px 12px;
  border-radius: 6px;
  transition: all 0.2s;
}

.admin-link:hover {
  background: var(--primary-light);
  color: white;
}

.search-box {
  display: flex;
  gap: 10px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}

.search-box input {
  flex: 1;
  min-width: 220px;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 1rem;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s;
}

.search-box input:focus {
  border-color: var(--primary-light);
  box-shadow: 0 0 0 3px rgba(43, 108, 176, 0.15);
}

button {
  padding: 12px 20px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: var(--radius);
  font-size: 0.95rem;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
}

button:hover {
  background: var(--primary-light);
}

button:active {
  transform: scale(0.98);
}

button.secondary {
  background: #edf2f7;
  color: var(--text);
}

button.secondary:hover {
  background: #e2e8f0;
}

button.danger {
  background: var(--danger);
}

button.danger:hover {
  background: #c53030;
}

.info-bar {
  display: flex;
  justify-content: space-between;
  margin-bottom: 12px;
  font-size: 0.9rem;
  color: var(--muted);
}

.table-wrapper {
  overflow-x: auto;
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}

thead {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
  color: white;
}

th, td {
  padding: 12px 14px;
  text-align: right;
  white-space: nowrap;
}

th {
  font-weight: 600;
}

tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background 0.15s;
}

tbody tr:hover {
  background: #f0f7ff;
}

tbody tr:last-child {
  border-bottom: none;
}

.barcode-link {
  color: var(--primary-light);
  text-decoration: none;
  font-family: monospace;
  font-size: 0.88rem;
  direction: ltr;
  display: inline-block;
}

.barcode-link:hover {
  text-decoration: underline;
}

.ops {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.ops a, .ops button {
  font-size: 0.8rem;
  padding: 6px 10px;
  border-radius: 6px;
  text-decoration: none;
}

.ops a {
  background: #ebf8ff;
  color: var(--primary-light);
  border: 1px solid #bee3f8;
}

.ops a:hover {
  background: #bee3f8;
}

.ops .copy-btn {
  background: #f0fff4;
  color: var(--accent);
  border: 1px solid #c6f6d5;
  padding: 6px 10px;
  cursor: pointer;
  font-family: inherit;
}

.ops .copy-btn:hover {
  background: #c6f6d5;
}

.pagination {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin-top: 24px;
  flex-wrap: wrap;
}

.pagination button {
  min-width: 40px;
  padding: 8px 12px;
  background: white;
  color: var(--text);
  border: 1px solid var(--border);
}

.pagination button.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

.pagination button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  padding: 22px;
  margin-bottom: 20px;
}

.card h3 {
  margin-bottom: 12px;
  color: var(--primary);
  font-size: 1.15rem;
}

.hint {
  font-size: 0.88rem;
  color: var(--muted);
  margin-bottom: 12px;
}

.hint code {
  background: #edf2f7;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.85rem;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.form-grid input,
#passwordInput,
#pdfFile,
#pdfToExcelFile,
#excelFile {
  width: 100%;
  padding: 11px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.95rem;
  font-family: inherit;
  outline: none;
}

.form-grid input:focus,
#passwordInput:focus {
  border-color: var(--primary-light);
}

.status {
  margin-top: 12px;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 0.9rem;
  display: none;
}

.status.success {
  display: block;
  background: #f0fff4;
  color: #276749;
  border: 1px solid #c6f6d5;
}

.status.error {
  display: block;
  background: #fff5f5;
  color: #c53030;
  border: 1px solid #fed7d7;
}

.status.info {
  display: block;
  background: #ebf8ff;
  color: #2b6cb0;
  border: 1px solid #bee3f8;
}

.error {
  color: var(--danger);
  margin-top: 8px;
  font-size: 0.9rem;
}

footer {
  text-align: center;
  margin-top: 40px;
  color: var(--muted);
  font-size: 0.85rem;
}

@media (max-width: 700px) {
  header h1 { font-size: 1.4rem; }
  th, td { padding: 10px 8px; font-size: 0.85rem; }
  .admin-link { position: static; display: inline-block; margin-top: 10px; }
}


.copyright {
  margin-top: 10px;
  font-size: 0.85rem;
  color: var(--muted);
}

.copyright a {
  color: var(--primary-light);
  text-decoration: none;
  font-weight: 600;
}

.copyright a:hover {
  text-decoration: underline;
}

.license-banner {
  display: none;
  background: linear-gradient(90deg, #ecfeff 0%, #e0f2fe 100%);
  border: 1px solid #99f6e4;
  color: #0f766e;
  padding: 12px 16px;
  border-radius: 12px;
  margin-bottom: 16px;
  font-size: 0.92rem;
  font-weight: 600;
  text-align: center;
}

.license-banner.show {
  display: block;
}

.license-banner.expired {
  background: #fff5f5;
  border-color: #feb2b2;
  color: #c53030;
}

/* Tabs */
.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 18px;
  padding: 8px;
  background: rgba(255,255,255,0.7);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow-sm);
}
.tab-btn {
  background: transparent;
  color: var(--muted);
  border: 1px solid transparent;
  padding: 10px 18px;
  border-radius: 12px;
  font-size: 0.9rem;
  font-weight: 600;
  transition: all 0.18s ease;
}
.tab-btn:hover {
  background: #f1f5f9;
  color: var(--text);
}
.tab-btn.active {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 6px 16px rgba(30, 78, 140, 0.28);
}
.tab-panel { display: none; }
.tab-panel.active { display: block; }


.profile-layout {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 24px;
  align-items: start;
}
@media (max-width: 640px) {
  .profile-layout { grid-template-columns: 1fr; justify-items: center; }
}
.profile-logo-col {
  text-align: center;
  background: linear-gradient(180deg, #f7fafc 0%, #edf2f7 100%);
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  padding: 16px 12px 14px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.8);
}
.logo-preview {
  width: 120px;
  height: 120px;
  object-fit: contain;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  background: #fff;
  margin: 0 auto 10px;
  display: block;
  box-shadow: 0 4px 14px rgba(26,54,93,0.08);
}
.logo-placeholder {
  width: 120px;
  height: 120px;
  margin: 0 auto 10px;
  border: 1.5px dashed #cbd5e0;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #a0aec0;
  font-size: 0.8rem;
  background: #fff;
}
.profile-logo-col input[type="file"] {
  font-size: 0.75rem;
  max-width: 100%;
}
.profile-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px 14px;
}
@media (max-width: 640px) {
  .profile-fields { grid-template-columns: 1fr; width: 100%; }
}
.profile-fields label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.8rem;
  color: #4a5568;
  font-weight: 600;
  background: #f7fafc;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 10px 12px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.profile-fields label:focus-within {
  border-color: #90cdf4;
  box-shadow: 0 0 0 3px rgba(43,108,176,0.12);
  background: #fff;
}
.profile-fields input {
  font-weight: 400;
  font-size: 0.95rem;
  border: none !important;
  background: transparent !important;
  padding: 4px 0 !important;
  margin: 0 !important;
  box-shadow: none !important;
  width: 100%;
}
.profile-fields label:nth-child(7) {
  grid-column: 1 / -1;
}
#profileCard h3 {
  display: flex;
  align-items: center;
  gap: 8px;
}
#profileCard .hint {
  margin-bottom: 16px;
}
.video-preview {
  border-radius: 14px;
  overflow: hidden;
  background: #1a365d;
  aspect-ratio: 16/9;
  max-width: 520px;
  border: 1px solid #e2e8f0;
  box-shadow: 0 8px 24px rgba(26,54,93,0.12);
}
.video-preview iframe, .video-preview video {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}

.bulk-actions input[type="checkbox"] {
  width: auto;
  margin: 0;
}


/* ========== Animations ========== */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes softPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(13, 148, 136, 0.0); }
  50% { box-shadow: 0 0 0 6px rgba(13, 148, 136, 0.12); }
}
@keyframes slideDown {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes rowIn {
  from { opacity: 0; transform: translateX(6px); }
  to { opacity: 1; transform: translateX(0); }
}

.container {
  animation: fadeIn 0.35s ease both;
}

header, #shopHeader {
  animation: fadeUp 0.45s ease both;
}

.tabs {
  animation: fadeUp 0.4s ease 0.05s both;
}

.card {
  animation: fadeUp 0.45s ease both;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.card:hover {
  box-shadow: 0 14px 34px rgba(15, 39, 68, 0.1);
}

.tab-panel.active {
  animation: fadeUp 0.35s ease both;
}

.license-banner.show {
  animation: slideDown 0.35s ease both;
}

.table-wrapper tbody tr {
  animation: rowIn 0.28s ease both;
}
.table-wrapper tbody tr:nth-child(1) { animation-delay: 0.02s; }
.table-wrapper tbody tr:nth-child(2) { animation-delay: 0.04s; }
.table-wrapper tbody tr:nth-child(3) { animation-delay: 0.06s; }
.table-wrapper tbody tr:nth-child(4) { animation-delay: 0.08s; }
.table-wrapper tbody tr:nth-child(5) { animation-delay: 0.1s; }
.table-wrapper tbody tr:nth-child(6) { animation-delay: 0.12s; }
.table-wrapper tbody tr:nth-child(7) { animation-delay: 0.14s; }
.table-wrapper tbody tr:nth-child(8) { animation-delay: 0.16s; }

.tab-btn {
  transition: all 0.2s ease, transform 0.15s ease;
}
.tab-btn:active {
  transform: scale(0.97);
}

.search-box input:focus,
input:focus,
textarea:focus {
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.status.success, .status.error {
  animation: slideDown 0.3s ease both;
}

#loginSection.card {
  animation: fadeUp 0.5s ease both;
}

.logo-preview, .logo-placeholder {
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}
.profile-logo-col:hover .logo-preview {
  transform: scale(1.03);
}

a {
  transition: color 0.15s ease, opacity 0.15s ease;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

.expiry-alerts-card h4 { font-size: 1rem; }
.expiry-alert-list { max-height: 280px; overflow-y: auto; }

.support-channels {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}
.support-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 10px 18px;
  border-radius: 12px;
  color: #fff !important;
  text-decoration: none !important;
  font-weight: 700;
  box-shadow: 0 6px 16px rgba(0,0,0,0.12);
  transition: transform 0.15s, filter 0.15s;
}
.support-btn:hover { filter: brightness(1.05); transform: translateY(-1px); }
.support-btn.wa { background: linear-gradient(135deg, #128C7E, #25D366); }
.support-btn.tg { background: linear-gradient(135deg, #1d4ed8, #2AABEE); }
.ticket-item {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  margin-bottom: 10px;
  background: #f8fafc;
}
.ticket-item .tid { font-family: monospace; direction: ltr; font-size: 0.8rem; color: var(--muted); }

.tab-badge {
  display: inline-block;
  min-width: 18px;
  padding: 1px 6px;
  margin-right: 4px;
  border-radius: 999px;
  background: #dc2626;
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  vertical-align: middle;
}
.ticket-item.is-new {
  border-color: #f59e0b;
  box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.15);
}

.ticket-inbox-layout {
  display: grid;
  grid-template-columns: minmax(240px, 340px) 1fr;
  gap: 12px;
  min-height: 420px;
}
@media (max-width: 800px) {
  .ticket-inbox-layout { grid-template-columns: 1fr; }
}
.ticket-inbox-list {
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: auto;
  max-height: 520px;
  background: #f8fafc;
}
.ticket-row {
  display: block;
  width: 100%;
  text-align: right;
  padding: 12px 14px;
  border: none;
  border-bottom: 1px solid #e2e8f0;
  background: transparent;
  cursor: pointer;
  font-family: inherit;
  color: inherit;
  transition: background 0.15s;
}
.ticket-row:hover { background: #eef2ff; }
.ticket-row.active { background: #e0e7ff; border-right: 3px solid var(--primary-light); }
.ticket-row .tr-name { font-weight: 700; color: var(--primary); }
.ticket-row .tr-meta { font-size: 0.78rem; color: var(--muted); margin-top: 4px; }
.ticket-row .tr-preview { font-size: 0.85rem; color: #475569; margin-top: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ticket-row .tr-status { font-size: 0.75rem; margin-top: 6px; }
.ticket-chat-pane {
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #fff;
  min-height: 420px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.ticket-chat-empty {
  margin: auto;
  color: var(--muted);
  padding: 24px;
  text-align: center;
}
.ticket-chat-header {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  background: #f8fafc;
  font-weight: 700;
}
.ticket-chat-messages {
  flex: 1;
  overflow: auto;
  padding: 12px;
  max-height: 340px;
  background: linear-gradient(180deg, #f8fafc, #fff);
}
.ticket-chat-compose {
  border-top: 1px solid var(--border);
  padding: 12px;
  background: #fff;
}
.ticket-chat-compose textarea {
  width: 100%;
  padding: 10px;
  border-radius: 10px;
  border: 1px solid #e2e8f0;
  font-family: inherit;
}

.msg-bubble {
  max-width: 85%;
  margin: 8px 0;
  padding: 10px 12px;
  border-radius: 14px;
  line-height: 1.55;
  box-shadow: 0 2px 8px rgba(15,39,68,0.06);
  animation: fadeUp 0.25s ease both;
}
.msg-bubble.customer {
  margin-right: auto;
  background: linear-gradient(135deg, #eef2ff, #e0e7ff);
  color: #1e3a8a;
  border-bottom-right-radius: 4px;
}
.msg-bubble.support {
  margin-left: auto;
  background: linear-gradient(135deg, #ecfdf5, #d1fae5);
  color: #065f46;
  border-bottom-left-radius: 4px;
}
.msg-bubble .msg-role {
  font-size: 0.72rem;
  font-weight: 700;
  opacity: 0.85;
  margin-bottom: 4px;
}
.msg-bubble .msg-at {
  font-size: 0.72rem;
  opacity: 0.65;
  margin-top: 6px;
}
.ticket-inbox-list {
  box-shadow: inset 0 0 0 1px rgba(226,232,240,0.8);
}
.ticket-row .tr-status {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  background: #e2e8f0;
  color: #334155;
}
.ticket-row .tr-status.open { background: #fef3c7; color: #92400e; }
.ticket-row .tr-status.answered { background: #dbeafe; color: #1e40af; }
.ticket-row .tr-status.closed { background: #e2e8f0; color: #475569; }
.ticket-chat-header {
  background: linear-gradient(135deg, #0f2744, #1e4e8c);
  color: #fff !important;
}
.ticket-chat-header div { color: rgba(255,255,255,0.8) !important; }

.filter-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 6px;
  background: rgba(255,255,255,0.7);
  border: 1px solid var(--border);
  border-radius: 14px;
}
.filter-btn {
  background: transparent;
  color: var(--muted);
  border: 1px solid transparent;
  padding: 8px 14px;
  border-radius: 10px;
  font-size: 0.85rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.15s ease;
}
.filter-btn:hover { background: #f1f5f9; color: var(--text); }
.filter-btn.active {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
  color: #fff;
  box-shadow: 0 4px 12px rgba(30, 78, 140, 0.25);
}

.share-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 0.8rem;
  font-weight: 700;
  color: #fff !important;
  text-decoration: none !important;
  margin: 2px;
  white-space: nowrap;
}
.share-btn.wa { background: linear-gradient(135deg, #128C7E, #25D366); }
.share-btn.tg { background: linear-gradient(135deg, #1d4ed8, #2AABEE); }
.share-btn:hover { filter: brightness(1.06); }
.actions-cell, .actions-cell > div {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}


/* ========== Mobile Responsive ========== */
@media (max-width: 900px) {
  .container {
    padding: 12px 10px 40px;
    max-width: 100%;
  }
  .ticket-inbox-layout {
    grid-template-columns: 1fr;
    min-height: auto;
  }
  .ticket-inbox-list {
    max-height: 220px;
  }
  .ticket-chat-pane {
    min-height: 360px;
  }
  .ticket-chat-messages {
    max-height: 260px;
  }
}

@media (max-width: 700px) {
  body {
    font-size: 0.95rem;
  }
  header {
    margin-bottom: 16px;
  }
  header h1 {
    font-size: 1.35rem !important;
    line-height: 1.35;
  }
  header h2 {
    font-size: 0.95rem !important;
  }
  #shopHeader {
    padding: 12px !important;
    border-radius: 14px;
  }
  .admin-link, #logoutBtn, header .admin-link {
    position: static !important;
    display: inline-flex !important;
    margin: 6px 4px 0;
  }
  header {
    display: flex;
    flex-direction: column;
    align-items: center;
  }

  .tabs, #adminTabs {
    gap: 6px;
    padding: 6px;
    border-radius: 12px;
    overflow-x: auto;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .tabs::-webkit-scrollbar, #adminTabs::-webkit-scrollbar { display: none; }
  .tab-btn {
    flex: 0 0 auto;
    padding: 8px 12px;
    font-size: 0.8rem;
    white-space: nowrap;
  }

  .card {
    padding: 14px 12px !important;
    border-radius: 12px;
    margin-bottom: 12px;
  }
  .card h3 {
    font-size: 1rem;
  }

  .search-box {
    flex-direction: column;
  }
  .search-box input,
  .form-grid input,
  .form-grid select,
  textarea,
  input[type="text"],
  input[type="password"],
  input[type="number"],
  input[type="file"] {
    width: 100% !important;
    min-width: 0 !important;
    font-size: 16px !important; /* جلوگیری از زوم iOS */
  }
  .form-grid {
    grid-template-columns: 1fr !important;
  }

  button, .btn, .secondary, .danger {
    width: auto;
    min-height: 40px;
  }

  .support-channels {
    flex-direction: column;
  }
  .support-btn {
    width: 100%;
  }

  .table-wrapper {
    border-radius: 12px;
    margin: 0 -2px;
    -webkit-overflow-scrolling: touch;
  }
  table {
    min-width: 640px;
    font-size: 0.82rem;
  }
  th, td {
    padding: 8px 10px !important;
    white-space: nowrap;
  }
  /* جدول عمومی موبایل: کارت‌مانند در صورت امکان */
  .actions-cell, .actions-cell > div {
    flex-direction: column;
    align-items: stretch;
  }
  .actions-cell a, .actions-cell button,
  .share-btn, .copy-btn, .track-btn {
    width: 100%;
    text-align: center;
    justify-content: center;
  }

  .profile-layout {
    grid-template-columns: 1fr !important;
    justify-items: center;
  }
  .profile-fields {
    grid-template-columns: 1fr !important;
    width: 100%;
  }

  .filter-tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .filter-btn {
    flex: 0 0 auto;
    font-size: 0.78rem;
    padding: 7px 10px;
  }

  .ticket-row {
    padding: 10px 12px;
  }
  .msg-bubble {
    max-width: 92%;
  }

  .bulk-actions {
    flex-direction: column;
    align-items: stretch;
  }

  footer {
    margin-top: 24px;
    padding: 0 8px;
    font-size: 0.8rem;
  }

  .license-banner {
    font-size: 0.82rem;
    padding: 10px 12px;
  }

  .pagination, .pager {
    flex-wrap: wrap;
    gap: 6px;
    justify-content: center;
  }
}

@media (max-width: 420px) {
  header h1 { font-size: 1.2rem !important; }
  .tab-btn { font-size: 0.75rem; padding: 7px 10px; }
  .card { padding: 12px 10px !important; }
  table { min-width: 560px; }
}

/* بهبود لمس موبایل */
@media (hover: none) and (pointer: coarse) {
  .tab-btn, .filter-btn, button, .share-btn, .ticket-row {
    min-height: 42px;
  }
  tbody tr:hover {
    background: transparent;
  }
}

html.dark body, html.dark .card, html.dark .table-wrapper, html.dark #shopHeader {
  /* تکمیل با کلاس‌های tailwind روی body */
}
html.dark .card, html.dark .table-wrapper, html.dark .ticket-chat-pane, html.dark .ticket-inbox-list {
  background: #1e293b !important;
  border-color: #334155 !important;
  color: #e2e8f0;
}
html.dark input, html.dark textarea, html.dark select {
  background: #0f172a !important;
  border-color: #334155 !important;
  color: #e2e8f0 !important;
}
html.dark .tabs, html.dark #adminTabs, html.dark .filter-tabs {
  background: #1e293b !important;
  border-color: #334155 !important;
}
html.dark .tab-btn, html.dark .filter-btn { color: #94a3b8; }
html.dark table { color: #e2e8f0; }
html.dark tbody tr { border-color: #334155; }
html.dark .hint, html.dark .text-slate-500 { color: #94a3b8 !important; }

#dashStats {
  direction: rtl;
}
html:not(.dark) #dashStats div {
  color: inherit;
}


/* ===== Premium Admin Buttons v2 ===== */
#adminSection button:not(.tab-btn):not(.filter-btn):not(.ticket-row):not(.profile-subtab),
#loginSection button:not(.tab-btn):not(.ticket-row),
.card button:not(.tab-btn):not(.filter-btn):not(.ticket-row):not(.profile-subtab) {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  border: none !important;
  border-radius: 12px !important;
  padding: 0.7rem 1.15rem !important;
  font-family: Vazirmatn, Tahoma, sans-serif !important;
  font-weight: 800 !important;
  font-size: 0.9rem !important;
  letter-spacing: -0.01em;
  line-height: 1.2;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease, filter 0.18s ease, background 0.18s ease !important;
  box-shadow: 0 8px 20px rgba(37, 99, 235, 0.22);
  background: linear-gradient(135deg, #1d4ed8 0%, #4f46e5 55%, #6366f1 100%) !important;
  color: #fff !important;
  text-shadow: 0 1px 0 rgba(0,0,0,0.08);
  -webkit-tap-highlight-color: transparent;
}

#adminSection button:not(.tab-btn):not(.filter-btn):not(.ticket-row):not(.profile-subtab):hover,
#loginSection button:not(.tab-btn):not(.ticket-row):hover,
.card button:not(.tab-btn):not(.filter-btn):not(.ticket-row):not(.profile-subtab):hover {
  transform: translateY(-2px);
  filter: brightness(1.06);
  box-shadow: 0 12px 28px rgba(79, 70, 229, 0.32);
}

#adminSection button:not(.tab-btn):not(.filter-btn):not(.ticket-row):not(.profile-subtab):active,
#loginSection button:not(.tab-btn):not(.ticket-row):active {
  transform: translateY(0) scale(0.98);
  filter: brightness(0.98);
}

/* Secondary */
#adminSection button.secondary,
.card button.secondary,
#loginSection button.secondary {
  background: linear-gradient(180deg, #ffffff 0%, #f1f5f9 100%) !important;
  color: #1e3a8a !important;
  border: 1px solid #c7d2fe !important;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.06) !important;
  text-shadow: none;
}
#adminSection button.secondary:hover,
.card button.secondary:hover {
  background: linear-gradient(180deg, #eef2ff 0%, #e0e7ff 100%) !important;
  border-color: #a5b4fc !important;
  box-shadow: 0 8px 20px rgba(99, 102, 241, 0.16) !important;
  color: #1e3a8a !important;
}

/* Danger */
#adminSection button.danger,
.card button.danger {
  background: linear-gradient(135deg, #e11d48 0%, #f43f5e 100%) !important;
  color: #fff !important;
  border: none !important;
  box-shadow: 0 8px 20px rgba(225, 29, 72, 0.28) !important;
}
#adminSection button.danger:hover,
.card button.danger:hover {
  filter: brightness(1.05);
  box-shadow: 0 12px 26px rgba(225, 29, 72, 0.36) !important;
}

/* Small action buttons in tables */
#adminSection td button,
#adminSection .ops button,
#adminSection table button {
  padding: 0.45rem 0.75rem !important;
  font-size: 0.78rem !important;
  border-radius: 10px !important;
  min-height: 34px;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.14);
}

/* Tabs remain pill style but richer */
#adminTabs .tab-btn,
.tabs .tab-btn {
  border-radius: 999px !important;
  font-weight: 700 !important;
  transition: all 0.2s ease !important;
}
#adminTabs .tab-btn.active,
.tabs .tab-btn.active {
  background: linear-gradient(135deg, #1d4ed8, #4f46e5) !important;
  color: #fff !important;
  box-shadow: 0 8px 18px rgba(37, 99, 235, 0.28) !important;
  border: none !important;
}
#adminTabs .tab-btn:not(.active):hover,
.tabs .tab-btn:not(.active):hover {
  background: #eef2ff !important;
  color: #1e3a8a !important;
}

/* Share / track mini buttons already gradient — polish */
#adminSection .share-btn,
#adminSection .track-btn,
#adminSection .copy-btn {
  border-radius: 10px !important;
  font-weight: 800 !important;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  transition: transform 0.15s ease, filter 0.15s ease;
}
#adminSection .share-btn:hover,
#adminSection .track-btn:hover,
#adminSection .copy-btn:hover {
  transform: translateY(-1px);
  filter: brightness(1.06);
}

/* Login primary */
#loginSection button#loginBtn,
#loginSection #loginBtn {
  width: 100%;
  padding: 0.85rem 1.2rem !important;
  font-size: 1rem !important;
  border-radius: 14px !important;
  background: linear-gradient(135deg, #1d4ed8, #4f46e5, #7c3aed) !important;
  box-shadow: 0 12px 28px rgba(79, 70, 229, 0.35) !important;
}

/* Soft focus ring for accessibility */
#adminSection button:focus-visible,
#loginSection button:focus-visible {
  outline: 3px solid rgba(99, 102, 241, 0.45);
  outline-offset: 2px;
}

/* Dark mode buttons */
html.dark #adminSection button:not(.tab-btn):not(.filter-btn):not(.ticket-row):not(.profile-subtab):not(.secondary):not(.danger) {
  box-shadow: 0 8px 22px rgba(0,0,0,0.35);
}
html.dark #adminSection button.secondary {
  background: linear-gradient(180deg, #1e293b, #0f172a) !important;
  color: #e2e8f0 !important;
  border-color: #334155 !important;
}
html.dark #adminTabs .tab-btn:not(.active):hover {
  background: #334155 !important;
  color: #e2e8f0 !important;
}

@media (max-width: 640px) {
  #adminSection button:not(.tab-btn):not(.filter-btn):not(.ticket-row):not(.profile-subtab) {
    padding: 0.75rem 1rem !important;
    min-height: 44px;
  }
}

/* ===== Ops row compact + button animations ===== */
@keyframes btnPress {
  0% { transform: scale(1); }
  50% { transform: scale(0.96); }
  100% { transform: scale(1); }
}
@keyframes btnShine {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}
@keyframes btnFloatIn {
  from { opacity: 0; transform: translateY(6px) scale(0.96); }
  to { opacity: 1; transform: none; }
}

#adminSection button:not(.tab-btn):not(.filter-btn):not(.ticket-row):not(.profile-subtab),
#loginSection button:not(.tab-btn):not(.ticket-row),
.card button:not(.tab-btn):not(.filter-btn):not(.ticket-row):not(.profile-subtab) {
  background-size: 200% 200% !important;
  transition: transform 0.18s cubic-bezier(.22,1,.36,1), box-shadow 0.18s ease, filter 0.18s ease !important;
  animation: btnFloatIn 0.35s ease both;
}
#adminSection button:not(.tab-btn):not(.filter-btn):not(.ticket-row):not(.profile-subtab):hover,
#loginSection button:not(.tab-btn):not(.ticket-row):hover {
  transform: translateY(-2px) scale(1.02);
}
#adminSection button:not(.tab-btn):not(.filter-btn):not(.ticket-row):not(.profile-subtab):active,
#loginSection button:not(.tab-btn):not(.ticket-row):active {
  animation: btnPress 0.25s ease;
  transform: scale(0.97);
}

/* Compact single-row ops */
#adminSection tbody td:last-child {
  display: flex !important;
  flex-wrap: nowrap !important;
  align-items: center !important;
  gap: 4px !important;
  white-space: nowrap !important;
  max-width: 420px;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  padding: 6px 8px !important;
  vertical-align: middle !important;
}
#adminSection tbody td:last-child button,
#adminSection tbody td:last-child a,
#adminSection tbody td:last-child .share-btn {
  flex: 0 0 auto !important;
  padding: 3px 8px !important;
  font-size: 0.68rem !important;
  min-height: 28px !important;
  height: 28px !important;
  border-radius: 999px !important;
  margin: 0 !important;
  line-height: 1 !important;
  box-shadow: 0 3px 8px rgba(37, 99, 235, 0.12) !important;
  white-space: nowrap !important;
  animation: none !important; /* avoid stagger lag in table */
}
#adminSection tbody td:last-child button:hover,
#adminSection tbody td:last-child a:hover {
  transform: translateY(-1px) scale(1.03);
}
#adminSection .table-wrapper {
  overflow-x: auto !important;
}
#adminSection table {
  min-width: 860px;
}

/* Primary buttons subtle gradient motion on hover */
#adminSection button:not(.secondary):not(.danger):not(.tab-btn):not(.filter-btn):hover {
  background-size: 200% 200% !important;
  animation: btnShine 2.5s ease infinite;
}


/* public logo hard limit */
#shopLogo,
img#shopLogo {
  width: 56px !important;
  height: 56px !important;
  max-width: 56px !important;
  max-height: 56px !important;
  object-fit: contain !important;
  border-radius: 12px !important;
  flex-shrink: 0 !important;
}
#shopHeader img {
  max-width: 56px !important;
  max-height: 56px !important;
}


/* full width public table */
.container .table-wrapper,
#tableSection .table-wrapper {
  width: 100% !important;
}
.container table,
#tableSection table {
  width: 100% !important;
}
.container thead th {
  background: linear-gradient(135deg, #0f2744, #1e4e8c) !important;
}


/* ===== Support inbox — light elegant cards ===== */
.ticket-inbox-list {
  background: #f8fafc !important;
  border: 1px solid #e2e8f0 !important;
  border-radius: 18px !important;
  padding: 10px !important;
  gap: 10px !important;
  display: flex !important;
  flex-direction: column !important;
}

.ticket-inbox-list .ticket-row,
button.ticket-row {
  display: block !important;
  width: 100% !important;
  text-align: right !important;
  border: 1px solid #e2e8f0 !important;
  background: #ffffff !important;
  color: #0f172a !important;
  border-radius: 14px !important;
  padding: 12px 14px !important;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.04) !important;
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease, background .15s ease !important;
  cursor: pointer !important;
  margin: 0 !important;
}

.ticket-inbox-list .ticket-row:hover,
button.ticket-row:hover {
  background: #f0f9ff !important;
  border-color: #bae6fd !important;
  box-shadow: 0 8px 20px rgba(14, 165, 233, 0.1) !important;
  transform: translateY(-1px);
}

.ticket-inbox-list .ticket-row.active,
button.ticket-row.active {
  background: linear-gradient(135deg, #eff6ff 0%, #f0f9ff 100%) !important;
  border: 1px solid #93c5fd !important;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12), 0 8px 22px rgba(37, 99, 235, 0.08) !important;
  color: #0f172a !important;
}

.ticket-row .tr-name {
  font-weight: 800 !important;
  font-size: 0.92rem !important;
  color: #0f172a !important;
  line-height: 1.45 !important;
}

.ticket-row.active .tr-name {
  color: #1e3a8a !important;
}

.ticket-row .tr-meta {
  font-size: 0.75rem !important;
  color: #64748b !important;
  margin-top: 4px !important;
  font-weight: 500 !important;
}

.ticket-row .tr-preview {
  font-size: 0.82rem !important;
  color: #475569 !important;
  margin-top: 6px !important;
  line-height: 1.5 !important;
  white-space: normal !important;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.ticket-row .tr-status {
  display: inline-flex !important;
  align-items: center !important;
  margin-top: 8px !important;
  padding: 3px 10px !important;
  border-radius: 999px !important;
  font-size: 0.72rem !important;
  font-weight: 800 !important;
  background: #f1f5f9 !important;
  color: #475569 !important;
  border: 1px solid #e2e8f0 !important;
}

.ticket-row .tr-status.open,
.ticket-row .tr-status.باز {
  background: #fffbeb !important;
  color: #b45309 !important;
  border-color: #fde68a !important;
}

.ticket-row .tr-status.answered,
.ticket-row .tr-status.پاسخ‌داده‌شده {
  background: #eff6ff !important;
  color: #1d4ed8 !important;
  border-color: #bfdbfe !important;
}

.ticket-row .tr-status.closed,
.ticket-row .tr-status.بسته‌شده {
  background: #f1f5f9 !important;
  color: #64748b !important;
  border-color: #e2e8f0 !important;
}

/* chat header stays branded but softer */
.ticket-chat-header {
  background: linear-gradient(135deg, #1e3a8a, #3b82f6) !important;
  border-radius: 16px 16px 0 0 !important;
  color: #fff !important;
}


/* ===== Ticket rows MUST stay light (override button theme) ===== */
#adminSection button.ticket-row,
#adminSection .ticket-inbox-list button.ticket-row,
#adminSection .ticket-row,
button.ticket-row {
  background: #ffffff !important;
  background-image: none !important;
  color: #0f172a !important;
  text-shadow: none !important;
  border: 1px solid #e2e8f0 !important;
  border-radius: 14px !important;
  box-shadow: 0 2px 10px rgba(15, 23, 42, 0.05) !important;
  padding: 12px 14px !important;
  font-weight: 500 !important;
  min-height: auto !important;
  height: auto !important;
  transform: none !important;
  animation: none !important;
  filter: none !important;
  letter-spacing: normal !important;
  display: block !important;
  width: 100% !important;
  text-align: right !important;
}

#adminSection button.ticket-row:hover,
#adminSection .ticket-row:hover {
  background: #f0f9ff !important;
  background-image: none !important;
  color: #0f172a !important;
  border-color: #7dd3fc !important;
  box-shadow: 0 6px 16px rgba(14, 165, 233, 0.12) !important;
  transform: none !important;
  filter: none !important;
}

#adminSection button.ticket-row.active,
#adminSection .ticket-row.active {
  background: #eff6ff !important;
  background-image: none !important;
  color: #0f172a !important;
  border: 1px solid #60a5fa !important;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15) !important;
  transform: none !important;
  filter: none !important;
}

#adminSection .ticket-row .tr-name,
#adminSection button.ticket-row .tr-name {
  color: #0f172a !important;
  font-weight: 800 !important;
  font-size: 0.9rem !important;
}

#adminSection .ticket-row.active .tr-name {
  color: #1e3a8a !important;
}

#adminSection .ticket-row .tr-meta {
  color: #64748b !important;
  font-size: 0.75rem !important;
}

#adminSection .ticket-row .tr-preview {
  color: #334155 !important;
  font-size: 0.82rem !important;
  white-space: normal !important;
  overflow: visible !important;
  text-overflow: unset !important;
  line-height: 1.5 !important;
}

#adminSection .ticket-row .tr-status {
  display: inline-block !important;
  margin-top: 8px !important;
  padding: 2px 10px !important;
  border-radius: 999px !important;
  background: #fef3c7 !important;
  color: #92400e !important;
  border: 1px solid #fde68a !important;
  font-size: 0.72rem !important;
  font-weight: 800 !important;
}


#ticketChatHeader, .ticket-chat-header {
  color: #ffffff !important;
}
#ticketChatHeader *, .ticket-chat-header * {
  color: inherit;
}
#ticketChatHeader div {
  color: #ffffff !important;
}


/* ===== Profile page redesign ===== */
.profile-page { display: flex; flex-direction: column; gap: 14px; }
.profile-page-head {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px;
  background: linear-gradient(135deg, #eff6ff, #f8fafc);
  border: 1px solid #dbeafe;
  border-radius: 18px;
  padding: 16px 18px;
}
.profile-page-title { margin: 0; font-size: 1.15rem; font-weight: 800; color: #0f2744; }
.profile-page-sub { margin: 4px 0 0; font-size: 0.85rem; color: #64748b; }
.profile-save-btn {
  background: linear-gradient(135deg, #1e3a8a, #3b82f6) !important;
  color: #fff !important;
  border: none !important;
  border-radius: 12px !important;
  padding: 10px 18px !important;
  font-weight: 800 !important;
}
.profile-subtabs {
  display: flex; flex-wrap: wrap; gap: 8px;
  background: #f1f5f9;
  border-radius: 14px;
  padding: 6px;
}
.profile-subtab {
  border: none !important;
  background: transparent !important;
  color: #64748b !important;
  border-radius: 10px !important;
  padding: 8px 14px !important;
  font-weight: 700 !important;
  box-shadow: none !important;
  transform: none !important;
  min-height: auto !important;
  height: auto !important;
}
.profile-subtab:hover { background: #e2e8f0 !important; color: #0f172a !important; }
.profile-subtab.active {
  background: #fff !important;
  color: #1e3a8a !important;
  box-shadow: 0 2px 10px rgba(15,23,42,.06) !important;
}
.profile-section { display: none; }
.profile-section.active { display: block; animation: fadeUp .25s ease both; }
.profile-card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 18px;
  padding: 16px 18px;
  margin-bottom: 12px;
  box-shadow: 0 6px 18px rgba(15,23,42,.04);
}
.profile-card-title {
  font-size: 0.98rem;
  font-weight: 800;
  color: #0f2744;
  margin-bottom: 6px;
}
.profile-card-desc {
  font-size: 0.82rem;
  color: #64748b;
  margin: 0 0 12px;
  line-height: 1.6;
}
.profile-label {
  display: block;
  font-size: 0.78rem;
  font-weight: 700;
  color: #475569;
  margin-bottom: 4px;
}
.profile-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.profile-grid-2 .full { grid-column: 1 / -1; }
.profile-check {
  display: flex !important;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  color: #334155;
  margin: 8px 0;
}
.profile-checks-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  margin-top: 8px;
}
.profile-tips {
  margin-top: 14px;
  background: #f8fafc;
  border: 1px dashed #cbd5e1;
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 0.8rem;
  color: #475569;
  line-height: 1.7;
}
@media (max-width: 700px) {
  .profile-grid-2 { grid-template-columns: 1fr; }
  .profile-page-head { align-items: flex-start; }
}


/* ===== Profile subtabs — distinct from global buttons ===== */
#adminSection .profile-subtabs,
.profile-subtabs {
  display: flex !important;
  flex-wrap: wrap !important;
  gap: 6px !important;
  background: #eef2ff !important;
  border: 1px solid #c7d2fe !important;
  border-radius: 16px !important;
  padding: 5px !important;
  box-shadow: inset 0 1px 2px rgba(15,23,42,.04) !important;
}

#adminSection button.profile-subtab,
button.profile-subtab,
.profile-subtab {
  all: unset !important;
  box-sizing: border-box !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  cursor: pointer !important;
  font-family: Vazirmatn, Tahoma, sans-serif !important;
  font-size: 0.86rem !important;
  font-weight: 700 !important;
  color: #4338ca !important;
  background: transparent !important;
  background-image: none !important;
  border: none !important;
  border-radius: 12px !important;
  padding: 9px 16px !important;
  min-height: 38px !important;
  height: auto !important;
  box-shadow: none !important;
  text-shadow: none !important;
  letter-spacing: normal !important;
  transform: none !important;
  filter: none !important;
  animation: none !important;
  transition: background .15s ease, color .15s ease, box-shadow .15s ease !important;
}

#adminSection button.profile-subtab:hover,
button.profile-subtab:hover {
  background: rgba(255,255,255,.7) !important;
  color: #1e1b4b !important;
  transform: none !important;
  filter: none !important;
  box-shadow: none !important;
}

#adminSection button.profile-subtab.active,
button.profile-subtab.active {
  background: #ffffff !important;
  color: #1e3a8a !important;
  box-shadow: 0 2px 8px rgba(30, 58, 138, 0.12) !important;
  border: 1px solid #bfdbfe !important;
  transform: none !important;
  filter: none !important;
}

#adminSection button.profile-subtab:active,
button.profile-subtab:active {
  transform: none !important;
  filter: none !important;
}


/* ===== Admin login dark mode ===== */
html.dark body {
  background: #0b1220 !important;
  color: #e2e8f0 !important;
}
html.dark #loginSection,
html.dark #loginSection.card {
  background: #111827 !important;
  border: 1px solid #1f2937 !important;
  box-shadow: 0 12px 40px rgba(0,0,0,.45) !important;
  color: #e2e8f0 !important;
}
html.dark #loginSection h3 {
  color: #f8fafc !important;
}
html.dark #loginSection .hint,
html.dark #loginSection p {
  color: #94a3b8 !important;
}
html.dark #loginSection input {
  background: #0f172a !important;
  border: 1px solid #334155 !important;
  color: #f1f5f9 !important;
}
html.dark #loginSection input::placeholder {
  color: #64748b !important;
}
html.dark #loginSection #loginError,
html.dark #loginSection .error {
  color: #fca5a5 !important;
}
html.dark header.admin-header,
html.dark .admin-topbar,
html.dark body > header {
  background: #0f172a !important;
  border-color: #1f2937 !important;
  color: #e2e8f0 !important;
}
html.dark .profile-card,
html.dark .profile-page-head,
html.dark .card {
  background: #111827 !important;
  border-color: #1f2937 !important;
  color: #e2e8f0 !important;
}
html.dark .profile-page-title,
html.dark .profile-card-title,
html.dark h3 {
  color: #f8fafc !important;
}
html.dark .profile-page-sub,
html.dark .profile-card-desc,
html.dark .hint {
  color: #94a3b8 !important;
}
html.dark .profile-subtabs {
  background: #1e293b !important;
  border-color: #334155 !important;
}
html.dark button.profile-subtab {
  color: #93c5fd !important;
}
html.dark button.profile-subtab.active {
  background: #0f172a !important;
  color: #f8fafc !important;
  border-color: #334155 !important;
}

#loginSection.login-card, .login-card { background:#fff; border:1px solid #e2e8f0; }

.security-banner {
  max-width: 520px;
  margin: 12px auto;
  background: #fff7ed;
  border: 1px solid #fdba74;
  color: #9a3412;
  border-radius: 14px;
  padding: 12px 14px;
  font-size: 0.9rem;
  font-weight: 600;
  text-align: center;
}
html.dark .security-banner {
  background: #7c2d12;
  border-color: #c2410c;
  color: #ffedd5;
}

.captcha-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.captcha-q {
  flex: 0 0 auto;
  min-width: 88px;
  text-align: center;
  font-weight: 800;
  font-size: 1.05rem;
  color: #1e3a8a;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 12px;
  padding: 10px 12px;
  letter-spacing: 0.5px;
}
.captcha-input {
  flex: 1;
  margin: 0 !important;
}
.captcha-refresh {
  flex: 0 0 auto !important;
  min-width: 44px !important;
  padding: 10px 12px !important;
  font-size: 1.1rem !important;
}
html.dark .captcha-q {
  background: #1e293b;
  border-color: #334155;
  color: #93c5fd;
}
