:root {
  --brand: #465fff;
  --brand-dark: #3a4ee0;
  --brand-soft: #eef2ff;
  --success: #16a34a;
  --success-dark: #15803d;
  --success-soft: #dcfce7;
  --danger: #ef4444;
  --danger-dark: #b91c1c;
  --danger-soft: #fee2e2;
  --warning: #f59e0b;
  --warning-dark: #92400e;
  --warning-soft: #fef3c7;
  --info: #3b82f6;
  --info-dark: #1d4ed8;
  --info-soft: #dbeafe;
  --indigo-soft: #e0e7ff;
  --indigo-dark: #4338ca;
  --gray-soft: #f3f4f6;
  --gray-mid: #6b7280;
  --text: #1f2937;
  --muted: #6b7280;
  --border: #e5e7eb;
  --bg: #f9fafb;
  --card: #ffffff;
  --shadow-card: 0 1px 2px rgba(16, 24, 40, .05);
  --shadow-pop: 0 12px 32px rgba(16, 24, 40, .14);
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: "Inter", "Segoe UI", "Tahoma", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  font-size: 14px;
}

a { color: var(--brand); text-decoration: none; }
a:hover { color: var(--brand-dark); text-decoration: underline; }
a.btn:hover, a.pill-item:hover, a.site-link:hover, a.lang-btn:hover, a.avatar:hover { text-decoration: none; }

h1, h2, h3, h4 { color: var(--text); }

/* ---------- layout ---------- */
.layout { display: flex; flex-direction: column; min-height: 100vh; }

/* ---------- top header ---------- */
.site-header {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 12px 24px;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
}
.site-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
.brand-logo {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--brand), #7b86ff);
  color: #fff;
  font-weight: 700;
  font-size: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 10px rgba(70, 95, 255, .28);
}
.brand-name { font-weight: 700; font-size: 15px; line-height: 1.2; color: var(--text); }
.brand-sub { color: var(--muted); font-size: 12px; }

/* ---------- pill nav ---------- */
.pill-nav {
  flex: 1;
  min-width: 0;
  display: flex;
  overflow-x: auto;
  scrollbar-width: none;
}
.pill-nav::-webkit-scrollbar { display: none; }
.pill-track {
  position: relative;
  display: flex;
  width: fit-content;
  max-width: 100%;
  margin: auto;
  background: var(--gray-soft);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px;
}
.pill-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 500;
  color: var(--muted);
  white-space: nowrap;
}
.pill-item:hover { color: var(--text); background: #fff; }
.pill-item.pill-active { color: var(--brand); font-weight: 600; }
.pill-badge {
  background: rgba(107, 114, 128, .16);
  border-radius: 999px;
  font-size: 11px;
  line-height: 1;
  padding: 3px 7px;
}
.pill-clip {
  position: absolute;
  inset-block: 4px;
  inset-inline-start: 4px;
  z-index: 2;
  display: flex;
  width: max-content;
  min-width: calc(100% - 8px);
  clip-path: inset(0px 100% 0px 100% round 999px);
  transition: clip-path .25s ease;
  overflow: hidden;
  pointer-events: none;
}
.pill-clip .pill-item {
  background: var(--brand);
  color: #fff;
  font-weight: 600;
  box-shadow: 0 2px 6px rgba(70, 95, 255, .35);
}
.pill-clip .pill-item:hover { background: var(--brand); color: #fff; }
.pill-clip .pill-badge { background: rgba(255, 255, 255, .28); color: #fff; }

/* ---------- pill overflow "More" ---------- */
.pill-more { position: relative; flex-shrink: 0; }
.pill-more[hidden] { display: none; }
.pill-more-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  height: 100%;
  padding: 8px 14px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background .15s, color .15s;
}
.pill-more-btn:hover { background: #fff; color: var(--text); }
.pill-more-btn svg { width: 15px; height: 15px; transition: transform .2s; }
.pill-more.is-open .pill-more-btn { background: #fff; color: var(--brand); }
.pill-more.is-open .pill-more-btn svg { transform: rotate(180deg); }
.pill-more[hidden] { display: none; }
.pill-more-panel {
  position: fixed;
  min-width: 210px;
  max-height: 360px;
  overflow-y: auto;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow-pop);
  z-index: 200;
  padding: 6px;
  transform-origin: top right;
  animation: pill-panel-in .15s cubic-bezier(.16,1,.3,1);
}
@keyframes pill-panel-in {
  from { opacity: 0; transform: translateY(-4px) scale(.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.pill-more-panel[hidden] { display: none !important; }
.pill-more-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 10px;
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
  transition: background .12s;
}
.pill-more-item:hover { background: var(--gray-soft); text-decoration: none; }
.pill-more-item.pill-more-active { color: var(--brand); background: var(--brand-soft); font-weight: 600; }

.site-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.header-cart {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 38px;
  padding: 7px 11px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
  color: var(--text);
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
  transition: border-color .15s, background .15s, color .15s;
}
.header-cart:hover { border-color: #cbd0da; background: var(--gray-soft); color: var(--brand); text-decoration: none; }
.header-cart.is-active { border-color: var(--brand); background: var(--brand-soft); color: var(--brand); }
.header-cart > svg { width: 19px; height: 19px; }
.header-cart-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 19px;
  height: 19px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--brand);
  color: #fff;
  font-size: 10px;
  font-weight: 800;
}
.lang-btn {
  display: block;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--card);
  font-size: 13px;
  color: var(--text);
  white-space: nowrap;
}
.lang-btn:hover { background: var(--gray-soft); color: var(--text); }
.lang-btn.active { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 600; }
.site-link {
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  font-size: 14px;
  white-space: nowrap;
}
.site-link:hover { background: var(--gray-soft); color: var(--text); }

/* ---------- main content ---------- */
.content { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.greeting {
  color: var(--text);
  font-size: 13px;
  white-space: nowrap;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--card);
}
.greeting strong { color: var(--brand); }

/* ---------- notifications ---------- */
.notif { position: relative; }
.notif-bell {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--card);
  color: var(--muted);
  cursor: pointer;
  transition: background .2s, color .2s, border-color .2s, box-shadow .2s;
}
.notif-bell:hover { background: var(--gray-soft); color: var(--text); border-color: #d1d5db; }
.notif-bell:active { transform: scale(.96); }
.notif-bell svg { width: 19px; height: 19px; }
.notif-badge {
  position: absolute;
  top: -5px;
  right: -5px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--danger);
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  line-height: 18px;
  text-align: center;
  box-shadow: 0 0 0 2px var(--card);
  transition: transform .2s cubic-bezier(.4,0,.2,1), opacity .2s;
}
.notif-badge[hidden] { transform: scale(0); opacity: 0; }
.notif-badge.is-pulse { animation: notif-pulse .4s ease; }
@keyframes notif-pulse {
  0% { transform: scale(1); }
  40% { transform: scale(1.25); }
  100% { transform: scale(1); }
}
.notif-panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 360px;
  max-height: 460px;
  display: flex;
  flex-direction: column;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow-pop);
  z-index: 50;
  overflow: hidden;
  transform-origin: top right;
  animation: notif-panel-in .18s cubic-bezier(.16,1,.3,1);
}
@keyframes notif-panel-in {
  from { opacity: 0; transform: translateY(-6px) scale(.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.notif-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.notif-head-left { display: flex; align-items: center; gap: 8px; }
.notif-head-left strong { font-size: 14px; }
.notif-head-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--brand-soft);
  color: var(--brand);
  font-size: 11px;
  font-weight: 700;
}
.notif-mark-all-btn {
  border: 0;
  background: none;
  color: var(--brand);
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  padding: 4px 8px;
  border-radius: 8px;
  transition: background .15s;
}
.notif-mark-all-btn:hover { background: var(--brand-soft); }
.notif-mark-all-btn:disabled { opacity: .4; cursor: default; }
.notif-list {
  list-style: none;
  margin: 0;
  padding: 4px 0;
  overflow-y: auto;
  flex: 1 1 auto;
  max-height: 320px;
}
.notif-list li { border-bottom: none; }
.notif-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 10px 16px;
  cursor: pointer;
  transition: background .12s;
  text-decoration: none;
  color: var(--text);
}
.notif-item:hover { background: #f8fafc; text-decoration: none; }
.notif-item.is-unread { background: var(--brand-soft); }
.notif-item.is-unread:hover { background: #e4eaff; }
.notif-item-icon {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  border-radius: 10px;
  background: var(--gray-soft);
  color: var(--gray-mid);
  line-height: 0;
}
.notif-item-icon svg { width: 18px; height: 18px; }
.notif-item-icon-ticket { background: var(--info-soft); color: var(--info-dark); }
.notif-item-icon-po, .notif-item-icon-order { background: var(--warning-soft); color: var(--warning-dark); }
.notif-item-icon-invoice { background: #dbeafe; color: #1d4ed8; }
.notif-item-icon-user { background: var(--indigo-soft); color: var(--indigo-dark); }
.notif-item-icon-info { background: var(--gray-soft); color: var(--gray-mid); }
.notif-item-body { flex: 1; min-width: 0; }
.notif-item-title {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.notif-item.is-unread .notif-item-title { font-weight: 700; }
.notif-item-detail {
  display: block;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.4;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-top: 2px;
}
.notif-item-time {
  display: block;
  font-size: 11px;
  color: #9ca3af;
  margin-top: 3px;
}
.notif-item-dot {
  width: 7px;
  height: 7px;
  flex: 0 0 7px;
  border-radius: 50%;
  background: transparent;
  margin-top: 6px;
}
.notif-item.is-unread .notif-item-dot { background: var(--brand); }
.notif-panel-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 32px 16px;
  text-align: center;
}
.notif-panel-empty[hidden] { display: none; }
.notif-panel[hidden] { display: none !important; }
.notif-panel-empty-icon {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: var(--brand-soft);
  color: var(--brand);
  margin-bottom: 10px;
  line-height: 0;
}
.notif-panel-empty-icon svg { width: 22px; height: 22px; }
.notif-panel-empty-text { font-size: 13px; color: var(--muted); }
.notif-panel-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 16px;
  border-top: 1px solid var(--border);
  color: var(--brand);
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
  flex-shrink: 0;
  transition: background .12s;
}
.notif-panel-footer:hover { background: var(--brand-soft); text-decoration: none; }
.notif-panel-footer svg { width: 16px; height: 16px; }
[dir="rtl"] .notif-panel-footer svg { transform: scaleX(-1); }
.notif-empty { padding: 20px 16px; color: var(--muted); font-size: 13px; text-align: center; }

.container {
  flex: 1;
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 24px clamp(18px, 2.2vw, 36px) 40px;
}

/* ---------- page head ---------- */
.page-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 20px;
}
.page-head h1 { font-size: 22px; font-weight: 700; letter-spacing: -.01em; }

/* ---------- cards ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 20px 22px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-card);
}
.card h2 { font-size: 15px; font-weight: 600; margin-bottom: 14px; }
.card h3 { font-size: 14px; font-weight: 600; margin-bottom: 10px; }

.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  align-items: start;
}
@media (max-width: 860px) { .two-col { grid-template-columns: 1fr; } }

/* ---------- metric cards ---------- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}
.stat-card {
  display: flex;
  flex-direction: column-reverse;
  justify-content: center;
  gap: 2px;
  padding: 20px;
  text-align: left;
  margin-bottom: 0;
}
.stat-value { font-size: 28px; font-weight: 700; color: var(--text); letter-spacing: -.02em; line-height: 1.2; }
.stat-label { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th, .table td { text-align: left; padding: 11px 12px; border-bottom: 1px solid #f1f2f4; }
.table th {
  color: var(--muted);
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .05em;
  background: #fafbfc;
}
.table tbody tr:hover { background: #f9fafb; }
.table tfoot th { border-top: 2px solid var(--border); color: var(--text); }
.info-table td:first-child { color: var(--muted); width: 150px; }
.table td .badge { white-space: nowrap; }

/* ---------- badges ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
}
.badge-pending { background: var(--warning-soft); color: var(--warning-dark); }
.badge-approved { background: var(--info-soft); color: var(--info-dark); }
.badge-in_progress { background: var(--indigo-soft); color: var(--indigo-dark); }
.badge-completed { background: var(--success-soft); color: var(--success-dark); }
.badge-closed { background: #f1f2f4; color: #4b5563; }
.badge-rejected { background: var(--danger-soft); color: var(--danger-dark); }
.badge-open { background: var(--danger-soft); color: var(--danger-dark); }
.badge-low { background: #f1f2f4; color: #4b5563; }
.badge-medium { background: var(--warning-soft); color: var(--warning-dark); }
.badge-high { background: var(--danger-soft); color: var(--danger-dark); }
.badge-admin { background: #fce7f3; color: #be185d; }
.badge-buyer { background: var(--success-soft); color: var(--success-dark); }
.badge-store { background: var(--indigo-soft); color: var(--indigo-dark); }
.badge-active { background: var(--success-soft); color: var(--success-dark); }
.badge-inactive { background: #f1f2f4; color: #4b5563; }
.badge-action { background: var(--brand-soft); color: var(--brand-dark); }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 18px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background .15s, border-color .15s, box-shadow .15s, transform .05s;
  line-height: 1.4;
}
.btn:hover { background: #f9fafb; border-color: #d1d5db; color: var(--text); }
.btn:active { transform: translateY(1px); }
.btn-primary {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
  font-weight: 600;
  box-shadow: 0 1px 2px rgba(70, 95, 255, .25);
}
.btn-primary:hover { background: var(--brand-dark); border-color: var(--brand-dark); color: #fff; }
.btn-success { background: var(--success); border-color: var(--success); color: #fff; font-weight: 600; }
.btn-success:hover { background: var(--success-dark); border-color: var(--success-dark); color: #fff; }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; font-weight: 600; }
.btn-danger:hover { background: var(--danger-dark); border-color: var(--danger-dark); color: #fff; }
.btn-secondary { background: var(--gray-soft); border-color: var(--border); color: #374151; }
.btn-secondary:hover { background: #e5e7eb; border-color: #d1d5db; color: #374151; }
.btn-block { width: 100%; }
.btn-sm { padding: 5px 12px; font-size: 13px; border-radius: 8px; }
.btn + .btn { margin-left: 8px; }

.actions { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }
.actions-col { white-space: nowrap; }
.inline-form { display: inline-flex; gap: 8px; align-items: center; }

/* ---------- forms ---------- */
.form-card { max-width: 720px; }
.form-group { margin-bottom: 14px; }
.form-group label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; color: #374151; }
.form-control {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid #d1d5db;
  border-radius: 10px;
  font-size: 14px;
  background: #fff;
  color: var(--text);
  transition: border-color .15s, box-shadow .15s;
}
.form-control:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(70, 95, 255, .15);
}
textarea.form-control { resize: vertical; }

.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.filters .form-control { width: auto; min-width: 160px; }
.filters .form-control[type="search"] { flex: 1; min-width: 220px; }
.select-inline { width: auto; min-width: 130px; }

.filter-panel { padding: 12px 14px; margin-top: 12px; background: #fafbfc; border: 1px solid var(--border); border-radius: 12px; }

/* ---------- register item page ---------- */
.crumbs { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; font-size: 13px; color: var(--muted); }
.crumbs a { color: var(--muted); text-decoration: none; transition: color .15s; }
.crumbs a:hover { color: var(--brand); }
.crumb-sep { color: #d1d5db; }
.crumb-current { color: var(--text); font-weight: 600; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 620px) { .form-grid { grid-template-columns: 1fr; } }
.store-assign-head { display: flex; justify-content: flex-end; margin: 10px 0 12px; }
.store-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px; }
.store-check {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px;
  background: #fafbfc; cursor: pointer; transition: border-color .15s, background .15s;
}
.store-check:hover { border-color: #c7cbd4; background: #f3f5f8; }
.store-check:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); }
.store-check input { width: 16px; height: 16px; accent-color: var(--brand); cursor: pointer; flex: 0 0 auto; }
.store-check span { font-size: 14px; font-weight: 500; color: var(--text); }

/* ---------- create inventory item ---------- */
.item-new-page .container { padding-bottom: 28px; }
.item-create-crumbs { margin-bottom: 12px; }
.item-create-head { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 18px; }
.item-create-head h1 { margin: 0; font-size: 22px; line-height: 1.3; }
.item-create-head p { margin-top: 4px; color: var(--muted); font-size: 12px; }
.item-create-head .btn svg, .item-create-actions .btn svg { width: 17px; height: 17px; }
.item-create-layout { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(320px, .85fr); gap: 16px; align-items: stretch; }
.item-create-panel { min-width: 0; overflow: hidden; border: 1px solid var(--border); border-radius: 16px; background: #fff; box-shadow: var(--shadow-card); }
.item-details-panel, .item-image-panel { display: flex; flex-direction: column; }
.item-stores-panel { grid-column: 1 / -1; }
.item-panel-head { display: flex; align-items: center; gap: 12px; min-height: 72px; padding: 15px 18px; border-bottom: 1px solid #eceef2; background: #fcfcfd; }
.item-panel-head > div { min-width: 0; }
.item-panel-head h2 { margin: 0; font-size: 15px; font-weight: 700; }
.item-panel-head p { margin-top: 3px; color: var(--muted); font-size: 11px; line-height: 1.45; }
.item-panel-icon { display: inline-flex; align-items: center; justify-content: center; width: 38px; height: 38px; flex: 0 0 auto; border-radius: 11px; background: var(--brand-soft); color: var(--brand); }
.item-panel-icon svg { width: 20px; height: 20px; }
.item-panel-body { flex: 1; padding: 18px; }
.item-details-panel .item-panel-body { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 15px 18px; align-content: start; }
.item-details-panel .item-field-wide { grid-column: 1 / -1; }
.item-details-panel .item-stock-preview { grid-column: 1 / -1; }
.item-description-input { min-height: 74px; resize: vertical; }
.item-field-help { margin-top: 6px; color: var(--muted); font-size: 10px; }
.item-qty-control { display: grid; grid-template-columns: 42px minmax(70px, 1fr) 42px; height: 42px; overflow: hidden; border: 1px solid #d1d5db; border-radius: 10px; background: #fff; }
.item-qty-control:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(70,95,255,.12); }
.item-qty-control button { border: 0; background: #f8f9fb; color: #596170; font-size: 19px; cursor: pointer; transition: background .15s, color .15s; }
.item-qty-control button:hover { background: var(--brand-soft); color: var(--brand); }
.item-qty-control input { min-width: 0; border: 0; border-inline: 1px solid #e5e7eb; outline: 0; background: #fff; color: var(--text); font-size: 14px; font-weight: 700; text-align: center; appearance: textfield; }
.item-qty-control input::-webkit-outer-spin-button, .item-qty-control input::-webkit-inner-spin-button { margin: 0; appearance: none; }
.item-stock-preview { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 45px; padding: 10px 13px; border: 1px solid #fecaca; border-radius: 10px; background: #fff7f7; }
.item-stock-preview span { display: inline-flex; align-items: center; gap: 7px; color: var(--muted); font-size: 11px; }
.item-stock-preview i { width: 7px; height: 7px; border-radius: 50%; background: var(--danger); }
.item-stock-preview strong { color: var(--danger-dark); font-size: 12px; }
.item-stock-preview[data-state="low_stock"] { border-color: #fde68a; background: #fffbeb; }
.item-stock-preview[data-state="low_stock"] i { background: var(--warning); }
.item-stock-preview[data-state="low_stock"] strong { color: var(--warning-dark); }
.item-stock-preview[data-state="medium_stock"] { border-color: #bfdbfe; background: #eff6ff; }
.item-stock-preview[data-state="medium_stock"] i { background: var(--info); }
.item-stock-preview[data-state="medium_stock"] strong { color: var(--info-dark); }
.item-stock-preview[data-state="high_stock"] { border-color: #bbf7d0; background: #f0fdf4; }
.item-stock-preview[data-state="high_stock"] i { background: var(--success); }
.item-stock-preview[data-state="high_stock"] strong { color: var(--success-dark); }
.item-image-panel .item-panel-body { display: flex; flex-direction: column; }
.item-image-dropzone { position: relative; display: flex; align-items: center; justify-content: center; flex: 1; min-height: 176px; overflow: hidden; border: 2px dashed #d5d9e2; border-radius: 12px; background: #fafbfc; cursor: pointer; transition: border-color .15s, background .15s; }
.item-image-dropzone:hover, .item-image-dropzone.is-dragging { border-color: var(--brand); background: var(--brand-soft); }
.item-image-dropzone.has-image { border-style: solid; background: #f3f4f6; }
.item-upload-placeholder { display: flex; align-items: center; flex-direction: column; gap: 6px; padding: 22px; color: var(--muted); text-align: center; }
.item-upload-placeholder strong { color: var(--text); font-size: 12px; }
.item-upload-placeholder small { max-width: 250px; font-size: 10px; line-height: 1.5; }
.item-upload-icon { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; margin-bottom: 3px; border: 1px solid #dfe3ea; border-radius: 50%; background: #fff; color: var(--brand); }
.item-upload-icon svg { width: 21px; height: 21px; }
.item-image-dropzone img { width: 100%; height: 100%; min-height: 176px; max-height: 230px; object-fit: cover; }
.item-image-meta { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 9px; font-size: 10px; }
.item-image-meta span { min-width: 0; overflow: hidden; color: var(--muted); text-overflow: ellipsis; white-space: nowrap; }
.item-image-meta button { padding: 0; border: 0; background: transparent; color: var(--danger); font: inherit; font-weight: 700; cursor: pointer; }
.item-image-error { margin-top: 8px; color: var(--danger); font-size: 10px; }
.item-publish-note { display: flex; align-items: flex-start; gap: 10px; margin-top: 12px; padding: 11px 12px; border: 1px solid #bfdbfe; border-radius: 10px; background: #eff6ff; color: var(--info-dark); }
.item-publish-note > svg { width: 18px; height: 18px; flex: 0 0 auto; margin-top: 1px; }
.item-publish-note strong, .item-publish-note span { display: block; }
.item-publish-note strong { font-size: 11px; }
.item-publish-note span { margin-top: 2px; color: #496482; font-size: 10px; line-height: 1.45; }
.item-stores-head > div { flex: 1; }
.item-store-selection { display: flex; align-items: center; justify-content: flex-end; gap: 12px; margin-inline-start: auto; }
.item-store-selection span { color: var(--muted); font-size: 10px; white-space: nowrap; }
.item-store-selection b { color: var(--text); }
.item-store-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px; }
.item-store-check { position: relative; display: flex; align-items: center; gap: 10px; min-height: 58px; padding: 9px 12px; border: 1px solid var(--border); border-radius: 11px; background: #fafbfc; cursor: pointer; transition: border-color .15s, background .15s, box-shadow .15s; }
.item-store-check:hover { border-color: #c5cad4; background: #f7f8fa; }
.item-store-check:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); box-shadow: inset 0 0 0 1px rgba(70,95,255,.1); }
.item-store-check input { position: absolute; opacity: 0; pointer-events: none; }
.item-store-mark { position: absolute; top: 7px; inset-inline-end: 7px; display: inline-flex; align-items: center; justify-content: center; width: 18px; height: 18px; border: 1px solid #d6dae2; border-radius: 6px; background: #fff; color: transparent; }
.item-store-mark svg { width: 13px; height: 13px; }
.item-store-check input:checked + .item-store-mark { border-color: var(--brand); background: var(--brand); color: #fff; }
.item-store-check input:focus-visible + .item-store-mark { box-shadow: 0 0 0 3px rgba(70,95,255,.18); }
.item-store-avatar { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; flex: 0 0 auto; border-radius: 10px; background: #e9ecf2; color: #697386; font-size: 13px; font-weight: 800; }
.item-store-check:has(input:checked) .item-store-avatar { background: #fff; color: var(--brand); }
.item-store-name { min-width: 0; padding-inline-end: 18px; overflow: hidden; color: var(--text); font-size: 12px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.item-create-actions { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 16px; padding: 14px 16px; border: 1px solid var(--border); border-radius: 14px; background: #fff; box-shadow: var(--shadow-card); }
.item-create-actions > p { color: var(--muted); font-size: 11px; }
.item-create-actions > div { display: flex; align-items: center; gap: 8px; }
.item-create-actions .btn + .btn { margin: 0; }

/* ---------- inventory cards ---------- */
.inv-toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; margin-bottom: 16px; }
.inv-toolbar .form-control[type="search"] { flex: 1; min-width: 220px; }

.inv-tabs { display: flex; gap: 6px; flex-wrap: nowrap; overflow-x: auto; margin-bottom: 18px; padding-bottom: 4px; }
.inv-tab {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px; border-radius: 999px;
  border: 1px solid var(--border); background: #fff;
  color: var(--muted); font-size: 13px; font-weight: 600;
  white-space: nowrap; cursor: pointer; text-decoration: none;
  transition: background .15s, border-color .15s, color .15s;
}
.inv-tab:hover { background: var(--gray-soft); border-color: #d1d5db; color: var(--text); text-decoration: none; }
.inv-tab.active { background: var(--brand); border-color: var(--brand); color: #fff; }

.inv-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px; margin-bottom: 20px;
}
.inv-card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: 16px; overflow: hidden;
  display: flex; flex-direction: column;
  transition: box-shadow .2s, transform .2s;
}
.inv-card:hover { box-shadow: 0 8px 22px rgba(16, 24, 40, .1); transform: translateY(-2px); }

.inv-card-icon {
  height: 100px; display: flex; align-items: center; justify-content: center;
  background: var(--brand-soft); font-size: 32px; font-weight: 700;
  color: var(--brand-dark); text-transform: uppercase;
  border-bottom: 1px solid var(--border);
}
.inv-card-icon.inv-icon-success { background: var(--success-soft); color: var(--success-dark); }
.inv-card-icon.inv-icon-warning { background: var(--warning-soft); color: var(--warning-dark); }
.inv-card-icon.inv-icon-danger { background: var(--danger-soft); color: var(--danger-dark); }
.inv-card-icon.inv-icon-info { background: var(--info-soft); color: var(--info-dark); }

.inv-card-body {
  padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 6px; flex: 1;
}
.inv-card-name {
  font-size: 15px; font-weight: 600; color: var(--text); line-height: 1.25;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.inv-card-store { font-size: 12px; color: var(--muted); }
.inv-card-meta { font-size: 11px; color: var(--muted); margin-top: auto; }

.inv-qty-badge {
  display: inline-flex; align-items: center;
  padding: 3px 10px; border-radius: 999px;
  font-size: 13px; font-weight: 700; width: fit-content;
}
.inv-qty-badge.qty-ok { background: var(--success-soft); color: var(--success-dark); }
.inv-qty-badge.qty-low { background: var(--warning-soft); color: var(--warning-dark); }
.inv-qty-badge.qty-out { background: var(--danger-soft); color: var(--danger-dark); }

.inv-empty { text-align: center; color: var(--muted); padding: 48px 20px; font-size: 15px; }

/* update modal */
.inv-modal-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,.35);
  display: flex; align-items: center; justify-content: center;
  z-index: 200; opacity: 0; pointer-events: none;
  transition: opacity .2s;
}
.inv-modal-backdrop.open { opacity: 1; pointer-events: auto; }
.inv-modal {
  background: var(--card); border-radius: 20px; border: 1px solid var(--border);
  box-shadow: var(--shadow-pop); width: 100%; max-width: 400px; margin: 16px;
  padding: 24px; transform: translateY(12px) scale(.97);
  transition: transform .2s;
}
.inv-modal-backdrop.open .inv-modal { transform: translateY(0) scale(1); }
.inv-modal h2 { font-size: 17px; font-weight: 700; margin-bottom: 4px; }
.inv-modal .inv-modal-sub { margin-bottom: 18px; }
.inv-modal .form-group:last-of-type { margin-bottom: 18px; }
.inv-modal .actions { justify-content: flex-end; }

/* ---------- inventory sheet ---------- */
.inventory-sheet { overflow: hidden; border: 1px solid var(--border); border-radius: 18px; background: var(--card); box-shadow: var(--shadow-card); }
.inventory-sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 20px 22px; border-bottom: 1px solid var(--border); }
.inventory-sheet-head h1 { font-size: 19px; font-weight: 700; letter-spacing: -.015em; }
.inventory-sheet-head p { margin-top: 3px; color: var(--muted); font-size: 13px; }
.inventory-sheet-actions { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.inventory-sheet-actions .btn { min-height: 42px; }
.inventory-sheet-actions svg { width: 19px; height: 19px; }
.inventory-sheet-actions .btn:disabled { cursor: not-allowed; opacity: .48; }

.inventory-sheet-tools { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; padding: 15px 22px; border-bottom: 1px solid var(--border); }
.inventory-filter-fields { display: flex; align-items: flex-end; justify-content: flex-end; gap: 10px; }
.inventory-search-combobox { position: relative; width: min(100%, 420px); }
.inventory-search { position: relative; display: flex; align-items: center; width: 100%; height: 43px; border: 1px solid #d1d5db; border-radius: 11px; background: #fff; transition: border-color .15s, box-shadow .15s; }
.inventory-search:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(70,95,255,.13); }
.inventory-search svg { position: absolute; inset-inline-start: 13px; width: 19px; height: 19px; color: #8b93a1; }
.inventory-search input { width: 100%; height: 100%; padding: 0 13px 0 41px; border: 0; outline: 0; border-radius: inherit; background: transparent; color: var(--text); font: inherit; }
[dir="rtl"] .inventory-search input { padding: 0 41px 0 13px; }
.inventory-search-results { position: absolute; top: calc(100% + 7px); inset-inline-start: 0; z-index: 35; width: min(100vw - 32px, 520px); max-height: 330px; overflow-y: auto; padding: 6px; border: 1px solid var(--border); border-radius: 13px; background: #fff; box-shadow: var(--shadow-pop); }
.inventory-search-result { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 12px; width: 100%; padding: 10px 11px; border: 0; border-radius: 9px; background: transparent; color: var(--text); font: inherit; text-align: start; cursor: pointer; }
.inventory-search-result:hover, .inventory-search-result.is-active { background: var(--brand-soft); }
.inventory-search-result strong, .inventory-search-result small { display: block; }
.inventory-search-result strong { overflow: hidden; font-size: 13px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.inventory-search-result small { margin-top: 2px; color: var(--muted); font-size: 11px; }
.inventory-search-result-meta { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 10px; white-space: nowrap; }
.inventory-search-result-meta b { color: var(--text); font-size: 11px; }
.inventory-search-no-results { padding: 18px 12px; color: var(--muted); font-size: 12px; text-align: center; }
.inventory-status-filter { min-width: 185px; }
.inventory-status-filter > label { display: block; margin: 0 0 5px 2px; color: var(--muted); font-size: 11px; font-weight: 600; }
.inventory-status-filter .form-control { min-height: 43px; }
.inventory-store-tabs { display: flex; gap: 7px; overflow-x: auto; padding: 12px 22px; border-bottom: 1px solid var(--border); scrollbar-width: thin; }
.inventory-store-tabs .inv-tab { padding: 7px 13px; background: #f5f6f8; border-color: transparent; font-size: 12px; }
.inventory-store-tabs .inv-tab.active { background: var(--brand); }

.inventory-table-wrap { overflow-x: auto; }
.inventory-table { width: 100%; min-width: 820px; border-collapse: collapse; }
.inventory-table th { padding: 12px 18px; border-bottom: 1px solid var(--border); background: #fafbfc; color: var(--muted); text-align: start; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .045em; white-space: nowrap; }
.inventory-table td { padding: 13px 18px; border-bottom: 1px solid #eff1f4; color: #4b5563; font-size: 13px; vertical-align: middle; white-space: nowrap; }
.inventory-table tbody tr { transition: background .15s; }
.inventory-table tbody tr:hover { background: #fafbfc; }
.inventory-table tbody tr:last-child td { border-bottom: 0; }
.inventory-sort { display: inline-flex; align-items: center; gap: 8px; padding: 0; border: 0; background: transparent; color: inherit; font: inherit; text-transform: inherit; letter-spacing: inherit; cursor: pointer; }
.inventory-sort:hover, .inventory-sort.is-active { color: var(--brand); }
.inventory-sort-icon { position: relative; width: 9px; height: 12px; }
.inventory-sort-icon::before, .inventory-sort-icon::after { content: ""; position: absolute; inset-inline-start: 1px; border-inline: 4px solid transparent; }
.inventory-sort-icon::before { top: 0; border-bottom: 4px solid #c4c9d2; }
.inventory-sort-icon::after { bottom: 0; border-top: 4px solid #c4c9d2; }
.inventory-sort.is-asc .inventory-sort-icon::before { border-bottom-color: var(--brand); }
.inventory-sort.is-desc .inventory-sort-icon::after { border-top-color: var(--brand); }
.inventory-product-cell { display: flex; align-items: center; gap: 11px; }
.inventory-product-avatar { display: inline-flex; align-items: center; justify-content: center; width: 42px; height: 42px; flex: 0 0 auto; overflow: hidden; border-radius: 10px; background: linear-gradient(135deg, var(--brand-soft), #dfe5ff); color: var(--brand-dark); font-size: 16px; font-weight: 800; }
.inventory-product-avatar img { width: 100%; height: 100%; object-fit: cover; }
.inventory-product-cell strong, .inventory-product-cell small { display: block; }
.inventory-product-cell strong { max-width: 240px; overflow: hidden; color: var(--text); font-size: 13px; font-weight: 600; text-overflow: ellipsis; }
.inventory-product-cell small { margin-top: 2px; color: #9ca3af; font-size: 10px; }
.inventory-store-name { color: #4b5563; }
.inventory-quantity { color: var(--text); font-size: 14px; }
.inventory-status { display: inline-flex; align-items: center; gap: 6px; padding: 5px 9px; border-radius: 999px; font-size: 11px; font-weight: 700; }
.inventory-status i { width: 6px; height: 6px; border-radius: 50%; }
.inventory-status-in_stock { background: var(--success-soft); color: var(--success-dark); }
.inventory-status-in_stock i { background: var(--success); }
.inventory-status-high_stock { background: var(--success-soft); color: var(--success-dark); }
.inventory-status-high_stock i { background: var(--success); }
.inventory-status-medium_stock { background: var(--info-soft); color: var(--info-dark); }
.inventory-status-medium_stock i { background: var(--info); }
.inventory-status-low_stock { background: var(--warning-soft); color: var(--warning-dark); }
.inventory-status-low_stock i { background: var(--warning); }
.inventory-status-out_of_stock { background: var(--danger-soft); color: var(--danger-dark); }
.inventory-status-out_of_stock i { background: var(--danger); }
.inventory-updated { color: var(--muted); font-size: 12px; }
.inventory-action-cell { width: 62px; text-align: center; }
.inventory-more { display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; border: 1px solid transparent; border-radius: 9px; background: transparent; color: var(--muted); cursor: pointer; transition: background .15s, border-color .15s, color .15s; }
.inventory-more:hover { border-color: var(--border); background: #fff; color: var(--brand); box-shadow: var(--shadow-card); }
.inventory-more svg { width: 20px; height: 20px; }
.inventory-list-empty { padding: 54px 20px; text-align: center; }
.inventory-list-empty > span { display: inline-flex; align-items: center; justify-content: center; width: 58px; height: 58px; margin-bottom: 13px; border-radius: 17px; background: var(--brand-soft); color: var(--brand); }
.inventory-list-empty svg { width: 28px; height: 28px; }
.inventory-list-empty h2 { margin-bottom: 5px; font-size: 17px; }
.inventory-list-empty p { color: var(--muted); font-size: 13px; }
.inventory-sheet-footer { display: flex; align-items: center; justify-content: space-between; gap: 15px; padding: 14px 22px; border-top: 1px solid var(--border); }
.inventory-sheet-footer p { color: var(--muted); font-size: 12px; }
.inventory-sheet-footer p b { color: var(--text); font-weight: 600; }
.inventory-pagination { display: flex; align-items: center; gap: 5px; }
.inventory-page-btn { display: inline-flex; align-items: center; justify-content: center; min-width: 34px; height: 34px; padding: 0 8px; border: 1px solid var(--border); border-radius: 9px; background: #fff; color: #4b5563; font-size: 12px; font-weight: 600; cursor: pointer; transition: border-color .15s, background .15s, color .15s; }
.inventory-page-btn:hover:not(:disabled) { border-color: var(--brand); color: var(--brand); }
.inventory-page-btn.is-active { border-color: var(--brand); background: var(--brand); color: #fff; }
.inventory-page-btn:disabled { cursor: not-allowed; opacity: .4; }

/* ---------- users page ---------- */
.users-card { padding: 20px; }
.users-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 14px; }
.users-head-text h2 { font-size: 18px; margin: 0 0 4px; color: var(--text); }
.users-head-text p { margin: 0; font-size: 13px; }
.users-tools { display: flex; align-items: center; gap: 10px; margin: 0; }
.input-icon { position: relative; }
.input-icon .form-control { width: 280px; padding-left: 38px; }
.input-icon-ic { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); display: inline-flex; pointer-events: none; }
.check-col { width: 40px; }
.check-col input[type="checkbox"], .row-check { width: 16px; height: 16px; accent-color: var(--brand); cursor: pointer; }
.users-table .user-cell .avatar { width: 38px; height: 38px; font-size: 15px; }
.status-pill { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; font-weight: 600; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.status-active { color: var(--success-dark); }
.status-active .status-dot { background: var(--success); }
.status-inactive { color: #4b5563; }
.status-inactive .status-dot { background: #9ca3af; }
.icon-actions { display: inline-flex; align-items: center; gap: 6px; }
.icon-actions form { margin: 0; display: inline-flex; }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; border-radius: 9px;
  border: 1px solid var(--border); background: #fff; color: #4b5563;
  cursor: pointer; transition: background .15s, border-color .15s, color .15s;
}
.icon-btn:hover { background: #f3f4f6; border-color: #d1d5db; color: var(--text); }
.icon-btn-danger:hover { background: var(--danger-soft); border-color: #fecaca; color: var(--danger-dark); }
.icon-btn-success:hover { background: var(--success-soft); border-color: #bbf7d0; color: var(--success-dark); }
.users-foot { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding-top: 14px; margin-top: 14px; border-top: 1px solid #f1f2f4; }

/* ---------- order history page ---------- */
.order-card { padding: 20px; }
.order-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 14px; }
.order-head-text h2 { font-size: 18px; margin: 0 0 4px; color: var(--text); }
.order-head-text p { margin: 0; font-size: 13px; }
.order-tools { display: flex; align-items: center; gap: 10px; margin: 0; }
.order-tools .input-icon .form-control { width: 260px; }
.order-table .po-num { font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace; font-weight: 600; font-size: 13px; }
.order-table .customer-name { font-weight: 600; color: var(--text); }
.order-table .customer-name:hover { color: var(--brand); }
.order-table .amount { font-weight: 600; white-space: nowrap; }
.product-cell { display: flex; align-items: center; gap: 6px; }
.item-count {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 20px; padding: 1px 6px; border-radius: 999px;
  font-size: 11px; font-weight: 700; color: var(--brand-dark);
  background: var(--brand-soft);
}
.sort-link { display: inline-flex; align-items: center; gap: 4px; color: var(--text); font-weight: 600; }
.sort-link:hover { color: var(--brand); text-decoration: none; }
.sort-ic { color: var(--muted); font-size: 12px; }
.order-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding-top: 14px; margin-top: 14px; border-top: 1px solid #f1f2f4; }
.pagination { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.page-link {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 32px; height: 32px; padding: 0 10px;
  border-radius: 9px; border: 1px solid var(--border);
  background: #fff; color: #4b5563; font-size: 13px; font-weight: 500;
}
.page-link:hover { border-color: var(--brand); color: var(--brand); text-decoration: none; }
.page-link.active { background: var(--brand); border-color: var(--brand); color: #fff; }
.page-link.disabled { opacity: .45; cursor: not-allowed; }
.page-link.ellipsis { border-color: transparent; background: transparent; }

.kebab { position: relative; display: inline-block; }
.kebab-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; border-radius: 9px;
  border: 1px solid var(--border); background: #fff; color: #4b5563;
  cursor: pointer; transition: background .15s, border-color .15s, color .15s;
}
.kebab-btn:hover { background: #f3f4f6; border-color: #d1d5db; color: var(--text); }
.kebab-dropdown {
  position: absolute; top: calc(100% + 6px); right: 0;
  min-width: 190px; padding: 6px;
  background: var(--card); border: 1px solid var(--border);
  border-radius: 12px; box-shadow: var(--shadow-pop); z-index: 1000;
}
.kebab-item {
  display: block; width: 100%; text-align: left;
  padding: 8px 12px; border-radius: 8px;
  font-size: 13px; font-weight: 500; color: var(--text);
  background: transparent; border: none; cursor: pointer;
}
.kebab-item:hover { background: var(--brand-soft); color: var(--brand-dark); text-decoration: none; }
.kebab-item.kebab-danger { color: var(--danger-dark); }
.kebab-item.kebab-danger:hover { background: var(--danger-soft); }
.kebab-form { margin: 0; }

/* ---------- order status dots ---------- */
.st-pending { color: var(--warning-dark); }
.st-pending .status-dot { background: var(--warning); }
.st-approved { color: var(--info-dark); }
.st-approved .status-dot { background: var(--info); }
.st-in_progress { color: var(--indigo-dark); }
.st-in_progress .status-dot { background: #6366f1; }
.st-completed { color: var(--success-dark); }
.st-completed .status-dot { background: var(--success); }
.st-closed { color: #4b5563; }
.st-closed .status-dot { background: #9ca3af; }
.st-rejected { color: var(--danger-dark); }
.st-rejected .status-dot { background: var(--danger); }

/* ---------- flash messages ---------- */
.flash {
  padding: 11px 16px;
  border-radius: 12px;
  margin-bottom: 16px;
  font-size: 14px;
  border: 1px solid transparent;
  font-weight: 500;
}
.flash-success { background: var(--success-soft); color: var(--success-dark); border-color: #bbf7d0; }
.flash-danger { background: var(--danger-soft); color: var(--danger-dark); border-color: #fecaca; }
.flash-info { background: var(--info-soft); color: var(--info-dark); border-color: #bfdbfe; }
.flash-warning { background: var(--warning-soft); color: var(--warning-dark); border-color: #fde68a; }

/* ---------- auth ---------- */
.auth-card {
  max-width: 420px;
  margin: 48px auto;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 32px;
  box-shadow: var(--shadow-pop);
}
.auth-card h1 { font-size: 22px; margin-bottom: 4px; letter-spacing: -.01em; }
.auth-card p.muted { margin-bottom: 20px; }
.muted { color: var(--muted); }
.center { text-align: center; }

.auth-page .site-link { display: none; }
.auth-page .content { flex: 1 1 100%; }
.auth-page .site-header { justify-content: space-between; }
.auth-page .container { padding-top: 16px; }

/* ---------- timeline ---------- */
.timeline { list-style: none; position: relative; padding-left: 0; }
.timeline li {
  position: relative;
  padding: 0 0 18px 34px;
  border-left: 2px solid #eef0f2;
  margin-left: 8px;
}
.timeline li:last-child { border-left-color: transparent; }
.timeline li::before {
  content: "";
  position: absolute;
  left: -7px;
  top: 2px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #d7dade;
  border: 2px solid #fff;
  box-shadow: 0 0 0 1px #d7dade;
}
.timeline li.active::before { background: var(--brand); box-shadow: 0 0 0 4px var(--brand-soft); }
.timeline li.done::before { background: var(--success); box-shadow: 0 0 0 4px var(--success-soft); }
.timeline li span { font-weight: 600; display: block; }
.timeline li small { color: var(--muted); }

/* ---------- chat ---------- */
.chat {
  max-height: 420px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 6px;
  margin-bottom: 14px;
}
.msg {
  align-self: flex-start;
  background: #f3f4f6;
  border-radius: 14px 14px 14px 4px;
  padding: 10px 14px;
  max-width: 80%;
}
.msg-own {
  align-self: flex-end;
  background: var(--brand);
  color: #fff;
  border-radius: 14px 14px 4px 14px;
}
.msg-head { font-size: 12px; margin-bottom: 4px; }
.msg-own .msg-head small { color: #dbe2ff; }
.msg-body { word-break: break-word; }
.chat-form { display: flex; gap: 8px; }
.chat-form .form-control { flex: 1; }

/* ---------- shop ---------- */
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
.latin-number {
  direction: ltr; unicode-bidi: isolate; font-family: Arial, sans-serif;
  font-variant-numeric: lining-nums tabular-nums; font-feature-settings: "lnum" 1, "tnum" 1;
}
.shop-page .container { max-width: none; }

.shop-discovery {
  padding: 12px; margin-bottom: 14px; background: var(--card);
  border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow-card);
}
.shop-filters { display: grid; grid-template-columns: minmax(260px, 1fr) 160px 190px auto; gap: 9px; align-items: end; }
.shop-search {
  position: relative; display: flex; align-items: center; height: 40px;
  border: 1px solid #d1d5db; border-radius: 10px; background: #fff;
  transition: border-color .15s, box-shadow .15s;
}
.shop-search:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(70,95,255,.13); }
.shop-search svg { position: absolute; inset-inline-start: 12px; width: 17px; height: 17px; color: #8b93a1; }
.shop-search input { width: 100%; height: 100%; padding: 0 12px 0 38px; border: 0; outline: 0; border-radius: inherit; background: transparent; color: var(--text); font: inherit; font-size: 12px; }
[dir="rtl"] .shop-search input { padding: 0 38px 0 12px; }
.shop-filter-field > label { display: block; margin: 0 0 5px 2px; color: var(--muted); font-size: 11px; font-weight: 600; }
.shop-filter-field .form-control { height: 40px; padding-block: 7px; font-size: 12px; }
.shop-search-btn { height: 40px; padding-inline: 16px; font-size: 12px; }
.shop-search-btn svg { width: 17px; height: 17px; }
.shop-tabs { display: flex; gap: 6px; overflow-x: auto; margin-top: 10px; padding-top: 10px; border-top: 1px solid #f0f1f3; scrollbar-width: thin; }
.shop-tab {
  display: inline-flex; align-items: center; padding: 6px 11px; border: 1px solid transparent;
  border-radius: 999px; background: #f5f6f8; color: #5f6877; font-size: 12px;
  font-weight: 600; white-space: nowrap; text-decoration: none; transition: all .15s;
}
.shop-tab:hover { background: var(--brand-soft); color: var(--brand-dark); text-decoration: none; }
.shop-tab.active { background: var(--brand); border-color: var(--brand); color: #fff; box-shadow: 0 3px 8px rgba(70,95,255,.2); }

.shop-results-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin: 0 2px 10px; }
.shop-results-head h2 { font-size: 16px; line-height: 1.3; }
.shop-results-head p { margin-top: 2px; color: var(--muted); font-size: 12px; }
.shop-clear { display: inline-flex; align-items: center; gap: 5px; color: var(--muted); font-size: 12px; font-weight: 600; }
.shop-clear svg { width: 15px; height: 15px; }

.shop-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(235px, 1fr)); gap: 12px; margin-bottom: 24px; }
.shop-product-card {
  min-width: 0; overflow: hidden; background: #fff; border: 1px solid var(--border);
  border-radius: 14px; box-shadow: var(--shadow-card); transition: transform .18s, box-shadow .18s, border-color .18s;
}
.shop-product-card:hover { transform: translateY(-2px); border-color: #cfd4df; box-shadow: 0 8px 20px rgba(16,24,40,.09); }
.shop-product-card.is-unavailable { opacity: .72; }
.shop-product-media { position: relative; height: 128px; overflow: hidden; background: #eef1ff; }
.shop-product-media img { width: 100%; height: 100%; display: block; object-fit: cover; transition: transform .35s; }
.shop-product-card:hover .shop-product-media img { transform: scale(1.035); }
.shop-product-media::after { content: ""; position: absolute; inset: 0; background: linear-gradient(to bottom, rgba(15,23,42,.03), rgba(15,23,42,.16)); pointer-events: none; }
.shop-category-badge, .shop-stock-dot { position: absolute; z-index: 1; top: 9px; }
.shop-category-badge {
  inset-inline-start: 9px; max-width: 55%; overflow: hidden; text-overflow: ellipsis;
  padding: 4px 7px; border: 1px solid rgba(255,255,255,.5); border-radius: 999px;
  background: rgba(255,255,255,.88); color: #374151; backdrop-filter: blur(5px);
  font-size: 10px; font-weight: 700; white-space: nowrap;
}
.shop-stock-dot {
  inset-inline-end: 9px; display: inline-flex; align-items: center; gap: 4px; padding: 4px 7px;
  border-radius: 999px; background: rgba(255,255,255,.91); color: var(--success-dark);
  font-size: 10px; font-weight: 700; backdrop-filter: blur(5px);
}
.shop-stock-dot i { width: 6px; height: 6px; border-radius: 50%; background: var(--success); box-shadow: 0 0 0 2px rgba(22,163,74,.14); }
.shop-stock-dot.is-low { color: var(--warning-dark); }
.shop-stock-dot.is-low i { background: var(--warning); box-shadow: 0 0 0 2px rgba(245,158,11,.16); }
.shop-stock-dot.is-medium { color: var(--info-dark); }
.shop-stock-dot.is-medium i { background: var(--info); box-shadow: 0 0 0 2px rgba(59,130,246,.15); }
.shop-stock-dot.is-high { color: var(--success-dark); }
.shop-stock-dot.is-high i { background: var(--success); box-shadow: 0 0 0 2px rgba(22,163,74,.14); }
.shop-stock-dot.is-out { color: var(--danger-dark); }
.shop-stock-dot.is-out i { background: var(--danger); box-shadow: 0 0 0 2px rgba(239,68,68,.14); }
.shop-product-body { display: flex; flex-direction: column; min-height: 190px; padding: 12px; }
.shop-product-copy { flex: 1; }
.shop-product-code { display: block; margin-bottom: 2px; color: #9aa1ad; font-size: 9px; }
.shop-product-copy h3 { margin: 0 0 4px; overflow: hidden; color: var(--text); font-size: 14px; font-weight: 700; line-height: 1.3; text-overflow: ellipsis; white-space: nowrap; }
.shop-product-copy p { min-height: 34px; color: var(--muted); font-size: 11px; line-height: 1.5; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; }
.shop-product-meta { display: flex; align-items: flex-end; justify-content: space-between; gap: 8px; padding: 9px 0; }
.shop-product-price strong, .shop-product-price span { display: block; }
.shop-product-price strong { color: var(--text); font-size: 16px; line-height: 1.2; letter-spacing: -.02em; }
.shop-product-price span { display: none; }
.shop-unit-label { color: var(--muted); font-size: 10px; white-space: nowrap; }
.shop-card-form { display: grid; grid-template-columns: 88px minmax(0, 1fr); gap: 7px; margin-top: auto; }
.shop-quantity { display: grid; grid-template-columns: 27px 32px 27px; align-items: stretch; height: 36px; border: 1px solid #d9dce3; border-radius: 9px; overflow: hidden; background: #fff; }
.shop-quantity button { border: 0; background: #f7f8fa; color: #596170; font-size: 17px; cursor: pointer; transition: background .15s, color .15s; }
.shop-quantity button:hover { background: var(--brand-soft); color: var(--brand); }
.shop-quantity button:disabled { cursor: default; color: #c5c9d0; background: #fafafa; }
.shop-quantity label { min-width: 0; border-inline: 1px solid #e6e8ed; }
.shop-quantity input { width: 100%; height: 100%; padding: 0; border: 0; outline: 0; background: #fff; color: var(--text); font-size: 13px; font-weight: 700; text-align: center; appearance: textfield; }
.shop-quantity input::-webkit-outer-spin-button, .shop-quantity input::-webkit-inner-spin-button { margin: 0; appearance: none; }
.btn-add-cart { min-width: 0; height: 36px; padding: 7px 9px; white-space: nowrap; font-size: 11px; }
.btn-add-cart svg { width: 15px; height: 15px; flex: 0 0 auto; }
.btn-add-cart:disabled { cursor: not-allowed; opacity: .5; box-shadow: none; }
.shop-empty { padding: 60px 20px; border: 1px dashed #d6d9e1; border-radius: 18px; background: #fff; text-align: center; }
.shop-empty > span { display: inline-flex; align-items: center; justify-content: center; width: 58px; height: 58px; margin-bottom: 14px; border-radius: 18px; background: var(--brand-soft); color: var(--brand); }
.shop-empty svg { width: 28px; height: 28px; }
.shop-empty h2 { margin-bottom: 5px; font-size: 18px; }
.shop-empty p { margin-bottom: 17px; color: var(--muted); font-size: 13px; }
.qty {
  width: 64px; padding: 8px 6px; border: 1px solid #d1d5db; border-radius: 8px;
  background: #fff; color: var(--text); font-size: 14px;
}
.qty:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(70,95,255,.15); }

.cart-product { display: flex; gap: 12px; align-items: center; }
.cart-product img { width: 56px; height: 56px; border-radius: 10px; object-fit: cover; border: 1px solid var(--border); }
.cart-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 16px;
  flex-wrap: wrap;
  gap: 10px;
}
.cart-panel { overflow: hidden; padding: 0; }
.cart-panel .table-wrap { padding: 6px 20px 0; }
.cart-table td { vertical-align: middle; }
.cart-table tfoot th { padding-top: 16px; padding-bottom: 16px; }
.cart-actions { margin: 0; padding: 18px 22px; border-top: 1px solid var(--border); background: #fafbfc; }
.cart-secure-note { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; }
.cart-secure-note svg { width: 18px; height: 18px; color: var(--success); }
.cart-empty-state { padding: 60px 20px; text-align: center; }
.cart-empty-state > span { display: inline-flex; align-items: center; justify-content: center; width: 60px; height: 60px; margin-bottom: 14px; border-radius: 18px; background: var(--brand-soft); color: var(--brand); }
.cart-empty-state > span svg { width: 29px; height: 29px; }
.cart-empty-state h2 { margin-bottom: 5px; font-size: 18px; }
.cart-empty-state p { margin-bottom: 18px; color: var(--muted); font-size: 13px; }
.js .cart-update-fallback { display: none; }
.cart-row-removing { opacity: 0; transform: translateX(12px); transition: opacity .18s, transform .18s; }

/* ---------- user management ---------- */
.avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--brand-soft);
  color: var(--brand-dark);
  font-weight: 700;
  font-size: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  text-decoration: none;
}
a.avatar:hover { background: var(--brand); color: #fff; }
.avatar-sm { width: 32px; height: 32px; font-size: 13px; }
.user-cell { display: flex; align-items: center; gap: 10px; }
.user-cell .user-name { display: block; font-weight: 600; color: var(--text); }
.user-cell .user-name:hover { color: var(--brand); }
.block { display: block; }
.row-inactive td { opacity: .55; }

.chip {
  display: inline-block;
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  background: #f1f5f9;
  color: #334155;
  border: 1px solid var(--border);
}
.chip-active { background: var(--success-soft); color: var(--success-dark); border-color: #bbf7d0; }
.chip-inactive { background: var(--danger-soft); color: var(--danger-dark); border-color: #fecaca; }

/* ---------- access control ---------- */
.switch-form { display: inline-block; margin: 0; }
.switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  padding: 0;
  border: none;
  border-radius: 999px;
  background: #d1d5db;
  cursor: pointer;
  transition: background .2s;
  vertical-align: middle;
}
.switch span {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .3);
  transition: left .2s;
}
.switch.on { background: var(--brand); }
.switch.on span { left: 22px; }

/* ---------- misc ---------- */
.empty { text-align: center; color: var(--muted); padding: 20px; }

/* ---------- application dialog ---------- */
body.dialog-open { overflow: hidden; }
.app-dialog-layer {
  position: fixed; inset: 0; z-index: 1000; display: flex; align-items: center;
  justify-content: center; padding: 16px; opacity: 0; transition: opacity .16s ease;
}
.app-dialog-layer[hidden] { display: none; }
.app-dialog-layer.is-open { opacity: 1; }
.app-dialog-backdrop { position: absolute; inset: 0; background: rgba(15,23,42,.48); backdrop-filter: blur(2px); }
.app-dialog {
  position: relative; width: min(100%, 440px); padding: 24px; border: 1px solid var(--border);
  border-radius: 16px; outline: none; background: var(--card); box-shadow: 0 24px 70px rgba(15,23,42,.25);
  transform: translateY(10px) scale(.985); transition: transform .18s ease;
}
.app-dialog-layer.is-open .app-dialog { transform: translateY(0) scale(1); }
.app-dialog-header { display: grid; grid-template-columns: auto 1fr; gap: 13px; padding-inline-end: 28px; text-align: start; }
.app-dialog-symbol { display: inline-flex; align-items: center; justify-content: center; width: 42px; height: 42px; border-radius: 13px; background: var(--brand-soft); color: var(--brand); }
.app-dialog-symbol svg { width: 23px; height: 23px; }
.app-dialog h2 { margin: 1px 0 6px; font-size: 18px; font-weight: 700; line-height: 1.3; }
.app-dialog p { color: var(--muted); font-size: 13px; line-height: 1.6; }
.app-dialog-footer { display: flex; justify-content: flex-end; gap: 9px; padding-top: 24px; }
.app-dialog-footer .btn { min-width: 96px; }
.app-dialog-close { position: absolute; top: 15px; inset-inline-end: 15px; display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; border: 0; border-radius: 8px; background: transparent; color: var(--muted); cursor: pointer; opacity: .72; }
.app-dialog-close:hover { background: var(--gray-soft); color: var(--text); opacity: 1; }
.app-dialog-close:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.app-dialog-close svg { width: 20px; height: 20px; }
.app-dialog.tone-danger .app-dialog-symbol { background: var(--danger-soft); color: var(--danger); }
.app-dialog.tone-danger .app-dialog-confirm { border-color: var(--danger); background: var(--danger); color: #fff; box-shadow: 0 1px 2px rgba(239,68,68,.24); }
.app-dialog.tone-danger .app-dialog-confirm:hover { border-color: var(--danger-dark); background: var(--danger-dark); }

/* ---------- admin notification centre ---------- */
.notification-center { min-width: 0; }
.notification-center-head { display: flex; align-items: center; justify-content: space-between; gap: 24px; margin-bottom: 20px; }
.notification-center-eyebrow { display: block; margin-bottom: 5px; color: var(--brand); font-size: 11px; font-weight: 800; letter-spacing: .09em; text-transform: uppercase; }
.notification-center-head h1 { margin: 0; font-size: clamp(24px, 2vw, 30px); line-height: 1.2; }
.notification-center-head p { max-width: 680px; margin-top: 7px; color: var(--muted); font-size: 13px; line-height: 1.5; }
.notification-center-head .btn { min-height: 42px; padding-inline: 17px; white-space: nowrap; }
.notification-center-head .btn svg { width: 18px; height: 18px; }
.notification-workspace { display: grid; grid-template-columns: 250px minmax(0, 1fr); min-height: clamp(560px, calc(100vh - 215px), 780px); overflow: hidden; border: 1px solid var(--border); border-radius: 18px; background: #fff; box-shadow: var(--shadow-card); }
.notification-mail-sidebar { min-width: 0; padding: 18px 12px; border-inline-end: 1px solid var(--border); background: #f8f9fb; }
.notification-sidebar-heading { display: flex; align-items: center; gap: 12px; padding: 2px 8px 20px; border-bottom: 1px solid #e7e9ed; }
.notification-sidebar-symbol { display: grid; place-items: center; width: 46px; height: 46px; flex: 0 0 46px; border-radius: 14px; background: var(--brand); color: #fff; line-height: 0; box-shadow: 0 8px 18px rgba(70,95,255,.2); }
.notification-sidebar-symbol svg { display: block; width: 23px; height: 23px; margin: auto; }
.notification-sidebar-heading div { min-width: 0; }
.notification-sidebar-heading strong, .notification-sidebar-heading span { display: block; }
.notification-sidebar-heading strong { color: var(--text); font-size: 14px; }
.notification-sidebar-heading div > span { margin-top: 3px; overflow: hidden; color: var(--muted); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.notification-sidebar-group { padding-top: 18px; }
.notification-sidebar-label { display: block; padding: 0 10px 8px; color: #8b93a1; font-size: 10px; font-weight: 800; letter-spacing: .07em; text-transform: uppercase; }
.notification-folder { display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%; min-height: 42px; margin: 2px 0; padding: 9px 10px; border: 0; border-radius: 10px; background: transparent; color: #4b5563; font: inherit; font-size: 12px; font-weight: 600; text-align: start; cursor: pointer; transition: background .15s, color .15s, box-shadow .15s; }
.notification-folder:hover { background: #eef0f4; color: var(--text); }
.notification-folder:focus-visible { outline: 2px solid var(--brand); outline-offset: -2px; }
.notification-folder.is-active { background: #fff; color: var(--brand); box-shadow: 0 1px 3px rgba(15,23,42,.08); }
.notification-folder > span { display: flex; align-items: center; gap: 10px; min-width: 0; }
.notification-folder svg { display: block; width: 18px; height: 18px; flex: 0 0 18px; }
.notification-folder b { display: grid; place-items: center; min-width: 24px; height: 22px; padding: 0 7px; border-radius: 999px; background: #e8ebf0; color: #667085; font-size: 10px; }
.notification-folder.is-active b { background: var(--brand-soft); color: var(--brand); }
.notification-category-dot { display: block; width: 9px; height: 9px; flex: 0 0 9px; border-radius: 50%; background: #98a2b3; }
.notification-category-dot.category-ticket { background: #3b82f6; }
.notification-category-dot.category-po, .notification-category-dot.category-order { background: #f59e0b; }
.notification-category-dot.category-invoice { background: #0ea5e9; }
.notification-category-dot.category-user { background: #8b5cf6; }
.notification-category-dot.category-info { background: #64748b; }
.notification-category-dot.category-all { background: var(--brand); }

.notification-inbox { display: flex; min-width: 0; flex-direction: column; background: #fff; }
.notification-inbox-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 18px; min-height: 82px; padding: 14px 18px; border-bottom: 1px solid var(--border); background: #fff; }
.notification-inbox-title { min-width: 120px; }
.notification-inbox-title h2 { margin: 0; color: var(--text); font-size: 17px; }
.notification-inbox-title span { display: block; margin-top: 3px; color: var(--muted); font-size: 11px; }
.notification-toolbar-controls { display: grid; grid-template-columns: minmax(220px, 1fr) 145px 155px; gap: 9px; width: min(720px, 78%); }
.notification-search { position: relative; display: flex; align-items: center; width: 100%; height: 44px; border: 1px solid #d1d5db; border-radius: 11px; background: #f9fafb; transition: border-color .15s, background .15s, box-shadow .15s; }
.notification-search:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(70,95,255,.12); }
.notification-search:focus-within { background: #fff; }
.notification-search > svg { position: absolute; inset-inline-start: 13px; width: 19px; height: 19px; color: #7c8594; pointer-events: none; }
.notification-search input { width: 100%; height: 100%; padding: 0 42px; border: 0; outline: 0; background: transparent; color: var(--text); font: inherit; font-size: 13px; }
.notification-search-clear { position: absolute; inset-inline-end: 7px; display: grid; place-items: center; width: 30px; height: 30px; padding: 0; border: 0; border-radius: 8px; background: transparent; color: #7c8594; cursor: pointer; }
.notification-search-clear:hover { background: #e9ecf1; color: var(--text); }
.notification-search-clear svg { display: block; width: 17px; height: 17px; }
.notification-native-filter { width: 100%; height: 44px; padding: 0 34px 0 11px; border: 1px solid #d1d5db; border-radius: 11px; outline: 0; background: #f9fafb; color: #4b5563; font: inherit; font-size: 11px; font-weight: 650; cursor: pointer; }
[dir="rtl"] .notification-native-filter { padding: 0 11px 0 34px; }
.notification-native-filter:focus { border-color: var(--brand); background: #fff; box-shadow: 0 0 0 3px rgba(70,95,255,.12); }
.notification-list { display: flex; min-height: 0; flex: 1 1 auto; flex-direction: column; overflow-y: auto; }
.notification-row { position: relative; display: grid; grid-template-columns: 10px 48px minmax(0, 1fr); gap: 14px; align-items: center; min-height: 102px; padding: 15px 18px; border-bottom: 1px solid #edf0f3; outline: 0; background: #fff; cursor: pointer; transition: background .15s, box-shadow .15s; }
.notification-row:last-child { border-bottom: 0; }
.notification-row:hover { z-index: 1; background: #fafbfc; box-shadow: inset 3px 0 0 var(--brand); }
.notification-row:focus-visible { z-index: 2; box-shadow: inset 0 0 0 2px var(--brand); }
[dir="rtl"] .notification-row:hover { box-shadow: inset -3px 0 0 var(--brand); }
.notification-row:focus-visible { z-index: 2; box-shadow: inset 0 0 0 2px var(--brand); }
.notification-row.is-unread { background: #f6f8ff; }
.notification-unread-dot { display: block; width: 7px; height: 7px; border-radius: 50%; background: transparent; }
.notification-row.is-unread .notification-unread-dot { background: var(--brand); box-shadow: 0 0 0 3px rgba(70,95,255,.1); }
.notification-row-icon { display: grid; place-items: center; width: 48px; height: 48px; padding: 0; border-radius: 14px; background: var(--gray-soft); color: var(--gray-mid); line-height: 0; }
.notification-row-icon svg { display: block; width: 23px; height: 23px; margin: auto; }
.notification-row-icon-ticket { background: var(--info-soft); color: var(--info-dark); }
.notification-row-icon-po, .notification-row-icon-order { background: var(--warning-soft); color: var(--warning-dark); }
.notification-row-icon-invoice { background: var(--info-soft); color: var(--info-dark); }
.notification-row-icon-user { background: var(--indigo-soft); color: var(--indigo-dark); }
.notification-row-content { min-width: 0; }
.notification-row-title { display: flex; align-items: center; gap: 9px; min-width: 0; }
.notification-row-title strong { overflow: hidden; color: var(--text); font-size: 14px; font-weight: 650; text-overflow: ellipsis; white-space: nowrap; }
.notification-row.is-unread .notification-row-title strong { font-weight: 800; }
.notification-row-state { padding: 4px 8px; border-radius: 999px; background: var(--gray-soft); color: var(--gray-mid); font-size: 9px; font-weight: 800; white-space: nowrap; }
.notification-row.is-unread .notification-row-state { background: var(--brand-soft); color: var(--brand-dark); }
.notification-row-content > p { margin-top: 6px; overflow: hidden; color: #596273; font-size: 12px; line-height: 1.5; text-overflow: ellipsis; white-space: nowrap; }
.notification-row-meta { display: flex; align-items: center; gap: 10px; margin-top: 7px; color: #8f98a7; font-size: 10px; }
.notification-row-meta span::after { content: "•"; margin-inline-start: 10px; color: #c1c6ce; }
.notification-row-meta span { text-transform: capitalize; }
.notification-center-empty { display: grid; min-height: 340px; padding: 54px 20px; place-content: center; text-align: center; }
.notification-center-empty[hidden] { display: none; }
.notification-center-empty > span { display: grid; place-items: center; width: 64px; height: 64px; margin: 0 auto 14px; border-radius: 18px; background: var(--brand-soft); color: var(--brand); line-height: 0; }
.notification-center-empty svg { display: block; width: 30px; height: 30px; margin: auto; }
.notification-center-empty h2 { margin: 0; font-size: 17px; }
.notification-center-empty p { margin-top: 6px; color: var(--muted); font-size: 12px; }

.notification-reader { display: none; min-height: 0; flex: 1 1 auto; flex-direction: column; background: #fff; animation: notif-reader-in .2s ease; }
@keyframes notif-reader-in { from { opacity: 0; transform: translateX(8px); } to { opacity: 1; transform: translateX(0); } }
.notification-reader[hidden], .notification-reader-actions [hidden] { display: none !important; }
.notification-inbox.is-reading > .notification-inbox-toolbar,
.notification-inbox.is-reading > .notification-list,
.notification-inbox.is-reading > .notification-center-empty { display: none !important; }
.notification-inbox.is-reading > .notification-reader { display: flex; }
.notification-reader-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 66px; padding: 11px 18px; border-bottom: 1px solid var(--border); background: #fafbfc; }
.notification-reader-button { display: inline-flex; align-items: center; gap: 7px; min-height: 38px; padding: 7px 11px; border: 1px solid #d9dde4; border-radius: 9px; background: #fff; color: #475467; font: inherit; font-size: 12px; font-weight: 700; cursor: pointer; transition: border-color .15s, color .15s, background .15s; }
.notification-reader-button:hover { border-color: #bfc5ce; color: var(--text); }
.notification-reader-button:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.notification-reader-button svg { width: 18px; height: 18px; }
[dir="rtl"] .notification-reader-back svg { transform: scaleX(-1); }
.notification-reader-navigation { display: flex; align-items: center; gap: 7px; }
.notification-reader-navigation > span { min-width: 58px; color: var(--muted); font-size: 11px; text-align: center; }
.notification-reader-icon-button { display: grid; place-items: center; width: 36px; height: 36px; padding: 0; border: 1px solid #d9dde4; border-radius: 9px; background: #fff; color: #667085; cursor: pointer; transition: border-color .15s, color .15s; }
.notification-reader-icon-button:hover:not(:disabled) { border-color: var(--brand); color: var(--brand); }
.notification-reader-icon-button:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.notification-reader-icon-button:disabled { opacity: .38; cursor: default; }
.notification-reader-icon-button svg { width: 18px; height: 18px; }
[dir="rtl"] .notification-reader-icon-button svg { transform: scaleX(-1); }
.notification-reader-body { width: min(860px, 100%); margin: 0 auto; padding: clamp(26px, 5vw, 54px); }
.notification-reader-heading { display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 18px; align-items: start; padding-bottom: 26px; border-bottom: 1px solid #edf0f3; }
.notification-reader-main-icon { display: grid; place-items: center; width: 64px; height: 64px; border-radius: 18px; background: var(--gray-soft); color: var(--gray-mid); line-height: 0; }
.notification-reader-main-icon svg { display: block; width: 30px; height: 30px; margin: auto; }
.notification-reader-main-icon.notification-row-icon-ticket { background: var(--info-soft); color: var(--info-dark); }
.notification-reader-main-icon.notification-row-icon-po,
.notification-reader-main-icon.notification-row-icon-order { background: var(--warning-soft); color: var(--warning-dark); }
.notification-reader-main-icon.notification-row-icon-invoice { background: var(--info-soft); color: var(--info-dark); }
.notification-reader-main-icon.notification-row-icon-user { background: var(--indigo-soft); color: var(--indigo-dark); }
.notification-reader-category { display: block; margin-bottom: 7px; color: var(--brand); font-size: 10px; font-weight: 800; letter-spacing: .07em; text-transform: uppercase; }
.notification-reader-heading h2 { margin: 0; color: var(--text); font-size: clamp(20px, 2.2vw, 28px); line-height: 1.3; }
.notification-reader-meta { display: flex; align-items: center; gap: 10px; margin-top: 10px; color: var(--muted); font-size: 11px; }
.notification-reader-meta span { padding: 4px 8px; border-radius: 999px; background: var(--brand-soft); color: var(--brand); font-weight: 750; }
.notification-reader-message { min-height: 180px; padding: 28px 0 34px; }
.notification-reader-message-label { display: block; margin-bottom: 12px; color: #98a2b3; font-size: 10px; font-weight: 800; letter-spacing: .07em; text-transform: uppercase; }
.notification-reader-message p { margin: 0; color: #475467; font-size: 14px; line-height: 1.8; white-space: pre-wrap; }
.notification-reader-actions { display: flex; align-items: center; justify-content: flex-end; gap: 10px; padding-top: 20px; border-top: 1px solid #edf0f3; }
.notification-reader-actions .btn { min-height: 42px; }
.notification-reader-actions .btn svg { width: 18px; height: 18px; }

.btn.is-loading { cursor: wait; opacity: .78; }
.btn.is-success { border-color: var(--success); background: var(--success); color: #fff; box-shadow: 0 1px 2px rgba(22,163,74,.22); }
.btn.is-success svg { width: 17px; height: 17px; }
.button-spinner { width: 15px; height: 15px; flex: 0 0 auto; border: 2px solid currentColor; border-inline-end-color: transparent; border-radius: 50%; animation: button-spin .7s linear infinite; }
@keyframes button-spin { to { transform: rotate(360deg); } }

/* ---------- toasts ---------- */
#toast-root {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
  max-width: 400px;
}
.toast {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  width: 100%;
  border: 1px solid var(--toast-border, #475569);
  border-radius: 12px;
  padding: 14px 18px;
  background: var(--toast-bg, #1f2937);
  box-shadow: 0 12px 32px rgba(0, 0, 0, .28);
  opacity: 1;
  transform: translateY(0);
  transition: opacity .3s, transform .3s;
}
.toast-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  color: #fff;
  flex-shrink: 0;
  background: var(--toast-icon-bg, #64748b);
}
.toast-icon svg { width: 16px; height: 16px; }
.toast-body { flex: 1; display: flex; flex-direction: column; align-items: flex-start; gap: 2px; }
.toast-title { font-size: 14px; font-weight: 600; line-height: 22px; letter-spacing: -.2px; color: var(--toast-title, #e2e8f0); }
.toast-description { font-size: 13px; line-height: 20px; letter-spacing: -.2px; color: #cbd5e1; }
.toast-default { --toast-bg: #1f2937; --toast-border: #475569; --toast-icon-bg: #64748b; --toast-title: #e2e8f0; }
.toast-success { --toast-bg: #0b3b2a; --toast-border: #15803d; --toast-icon-bg: #16a34a; --toast-title: #4ade80; }
.toast-warning { --toast-bg: #3a2a05; --toast-border: #b45309; --toast-icon-bg: #d97706; --toast-title: #fbbf24; }
.toast-error { --toast-bg: #3d1010; --toast-border: #b91c1c; --toast-icon-bg: #dc2626; --toast-title: #f87171; }
.toast-info { --toast-bg: #102a4f; --toast-border: #2563eb; --toast-icon-bg: #3b82f6; --toast-title: #60a5fa; }
.toast-out { opacity: 0; transform: translateY(8px); }

/* ---------- user menu ---------- */
.user-menu { position: relative; }
.user-menu-trigger {
  display: flex; align-items: center; gap: 8px;
  padding: 4px 8px 4px 4px;
  border: 1px solid var(--border); border-radius: 12px;
  background: #fff; cursor: pointer;
  transition: background .15s, border-color .15s;
  font-family: inherit;
}
.user-menu-trigger:hover { background: var(--gray-soft); border-color: #d1d5db; }
.user-menu-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--brand-soft); color: var(--brand-dark);
  font-weight: 700; font-size: 14px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; text-transform: uppercase;
}
.user-menu-avatar-lg { width: 40px; height: 40px; font-size: 16px; }
.user-menu-info { display: flex; flex-direction: column; align-items: flex-start; line-height: 1.2; }
.user-menu-name { font-size: 13px; font-weight: 600; color: var(--text); white-space: nowrap; }
.user-menu-role { font-size: 11px; }
.user-menu-chevron { width: 16px; height: 16px; color: var(--muted); flex-shrink: 0; transition: transform .15s; }
.user-menu.open .user-menu-chevron { transform: rotate(180deg); }

.user-menu-panel {
  position: absolute; top: calc(100% + 8px); right: 0;
  width: 260px;
  background: var(--card); border: 1px solid var(--border);
  border-radius: 16px; box-shadow: var(--shadow-pop);
  padding: 6px; z-index: 100;
  opacity: 0; transform: translateY(-4px) scale(.97);
  pointer-events: none;
  transition: opacity .15s, transform .15s;
}
.user-menu.open .user-menu-panel { opacity: 1; transform: translateY(0) scale(1); pointer-events: auto; }

.user-menu-header {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 10px 8px;
}
.user-menu-header-name { font-size: 14px; font-weight: 600; color: var(--text); }
.user-menu-header-role { font-size: 12px; color: var(--muted); text-transform: capitalize; }
.user-menu-status {
  margin-left: auto;
  padding: 3px 8px; border-radius: 999px;
  font-size: 11px; font-weight: 700;
  background: var(--success-soft); color: var(--success-dark);
}

.user-menu-sep { height: 1px; background: var(--border); margin: 4px 10px; }

.user-menu-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px; border-radius: 10px;
  font-size: 13px; font-weight: 500; color: var(--text);
  text-decoration: none; transition: background .12s;
}
.user-menu-item svg { width: 18px; height: 18px; color: var(--muted); flex-shrink: 0; }
.user-menu-item:hover { background: var(--gray-soft); text-decoration: none; }
.user-menu-logout { color: var(--danger-dark); }
.user-menu-logout svg { color: var(--danger); }

/* ---------- custom select ---------- */
.select-wrap { position: relative; display: inline-block; vertical-align: middle; }
.select-wrap.form-control { padding: 0; border: 0; border-radius: 0; background: transparent; box-shadow: none; }
.select-wrap .select-native { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.select-trigger {
  display: flex; align-items: center; gap: 8px;
  width: 100%;
  padding: 9px 12px;
  border: 1px solid #d1d5db;
  border-radius: 10px;
  font-size: 14px;
  background: #fff;
  color: var(--text);
  cursor: pointer;
  transition: border-color .15s, box-shadow .15s;
  text-align: left;
  font-family: inherit;
}
.select-trigger:hover { border-color: #9ca3af; }
.select-wrap.open .select-trigger { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(70, 95, 255, .15); }
.select-wrap:has(.select-native:invalid:not(:disabled)) .select-trigger { border-color: var(--danger); }
.select-trigger:disabled { background: #f3f4f6; color: #9ca3af; cursor: not-allowed; }
.select-trigger-label { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.select-chevron { display: inline-flex; flex-shrink: 0; color: var(--muted); transition: transform .15s; }
.select-wrap.open .select-chevron { transform: rotate(180deg); }
.select-panel {
  position: absolute; top: calc(100% + 6px); left: 0; z-index: 60;
  min-width: 100%; max-width: min(400px, 90vw);
  padding: 6px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow-pop);
}
.select-search-input {
  width: 100%;
  padding: 8px 10px 8px 32px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 13px;
  background: var(--bg) url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="%236b7280" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="11" cy="11" r="8"/><path d="m21 21-4.3-4.3"/></svg>') no-repeat 10px center;
  color: var(--text);
}
.select-search-input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(70, 95, 255, .15); }
.select-options { max-height: 220px; overflow-y: auto; margin-top: 4px; display: flex; flex-direction: column; gap: 2px; width: auto; }
.select-option {
  display: block; width: 100%; text-align: left;
  padding: 8px 10px;
  border: 0; border-radius: 8px;
  background: transparent;
  font-size: 14px; color: var(--text);
  cursor: pointer;
  font-family: inherit;
  white-space: nowrap;
}
.select-option:hover, .select-option.highlight { background: var(--gray-soft); }
.select-option.selected { color: var(--brand); font-weight: 600; }
.select-option.disabled { color: #9ca3af; cursor: not-allowed; }
.select-option.selected::after { content: "\2713"; float: right; }
.select-empty { padding: 10px; font-size: 13px; color: var(--muted); text-align: center; }

/* ---------- tickets ---------- */
.tk-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 20px; }
.tk-stat-card { display: flex; align-items: center; gap: 14px; background: #fff; border: 1px solid #e5e7eb; border-radius: 12px; padding: 18px 20px; }
.tk-stat-icon { width: 48px; height: 48px; border-radius: 12px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.tk-stat-icon-total { background: #fff3e0; color: #f57c00; }
.tk-stat-icon-open { background: #e3f2fd; color: #1e88e5; }
.tk-stat-icon-closed { background: #e8f5e9; color: #43a047; }
.tk-stat-body { display: flex; flex-direction: column; gap: 2px; }
.tk-stat-num { font-size: 24px; font-weight: 700; line-height: 1; color: var(--text); }
.tk-stat-label { font-size: 13px; color: var(--muted); }

.tk-search-wrap { min-width: 0; flex: 1 1 260px; }

#tk-table { width: 100%; border-collapse: collapse; }
#tk-table th.sortable { cursor: pointer; user-select: none; white-space: nowrap; }
#tk-table th.sortable:hover { color: var(--brand); }
.sort-icon { font-size: 10px; opacity: 0.4; margin-left: 4px; }
#tk-table th.sort-asc .sort-icon::after { content: "\25B2"; }
#tk-table th.sort-desc .sort-icon::after { content: "\25BC"; }

.tk-num { font-weight: 600; white-space: nowrap; }
.tk-title-cell { max-width: 320px; }
.tk-title-text { display: block; font-weight: 500; }
.tk-preview { display: block; font-size: 12px; color: var(--muted); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tk-replies { text-align: center; font-weight: 600; color: var(--muted); }
.tk-date { white-space: nowrap; font-size: 13px; color: var(--muted); }

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

.tk-pagination { display: flex; align-items: center; justify-content: center; gap: 6px; padding: 16px 0 4px; }
.tk-page-btn { min-width: 34px; height: 34px; display: inline-flex; align-items: center; justify-content: center; border: 1px solid #d7dade; border-radius: 8px; background: #fff; font-size: 13px; font-weight: 500; color: var(--text); cursor: pointer; transition: border-color .15s, background .15s; padding: 0 8px; }
.tk-page-btn:hover { border-color: var(--brand); color: var(--brand); }
.tk-page-btn.active { background: var(--brand); color: #fff; border-color: var(--brand); }
.tk-page-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.tk-page-info { font-size: 13px; color: var(--muted); margin: 0 8px; }

/* ---------- ticket detail ---------- */
.tk-detail-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 340px);
  gap: 20px;
  align-items: stretch;
  min-height: calc(100vh - 129px);
}
.tk-detail-main { min-width: 0; display: flex; }

.tk-detail-card {
  width: 100%;
  min-height: 0;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 16px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.tk-detail-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 18px 24px; border-bottom: 1px solid #eef0f2; }
.tk-detail-title { margin: 0; font-size: 16px; font-weight: 600; color: var(--text); }
.tk-detail-date { margin: 4px 0 0; font-size: 13px; color: var(--muted); }
.tk-detail-header-actions { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.tk-msg-count { font-size: 13px; color: var(--muted); white-space: nowrap; }
.tk-nav-btn { display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; border: 1px solid #d7dade; border-radius: 8px; color: #6b7280; text-decoration: none; transition: border-color .15s, color .15s; }
.tk-nav-btn:hover { border-color: var(--brand); color: var(--brand); }

.tk-chat-scroll {
  flex: 1 1 auto;
  min-height: 260px;
  max-height: none;
  overflow-y: auto;
  padding: 24px 24px 8px;
  scrollbar-gutter: stable;
}

.tk-msg { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 16px; }
.tk-msg + .tk-msg { margin-top: 4px; }
.tk-msg-own { flex-direction: row-reverse; }

.tk-msg-avatar { width: 36px; height: 36px; border-radius: 50%; background: #e3e7ec; color: #6b7280; font-size: 14px; font-weight: 700; display: flex; align-items: center; justify-content: center; flex-shrink: 0; margin-top: 2px; }
.tk-msg-avatar-own { background: var(--brand); color: #fff; }

.tk-msg-bubble { width: fit-content; max-width: 72%; min-width: 80px; }
.tk-msg-meta { display: flex; align-items: center; gap: 8px; margin-bottom: 5px; flex-wrap: wrap; }
.tk-msg-own .tk-msg-meta { flex-direction: row-reverse; }
.tk-msg-sender-name { font-size: 13px; font-weight: 600; color: var(--text); }
.tk-msg-role { font-size: 11px; color: var(--muted); }
.tk-msg-own .tk-msg-role { display: none; }
.tk-msg-time { font-size: 11px; color: var(--muted); white-space: nowrap; }

.tk-msg-content {
  padding: 12px 16px; border-radius: 16px; font-size: 14px; line-height: 1.55;
  background: #f3f4f6; color: #1f2937;
  border-top-left-radius: 4px;
}
.tk-msg-own .tk-msg-content {
  background: var(--brand); color: #fff;
  border-top-left-radius: 16px; border-top-right-radius: 4px;
}
.tk-msg-content p { margin: 0 0 6px; }
.tk-msg-content p:last-child { margin-bottom: 0; }
.tk-msg-content ul { margin: 6px 0; padding-left: 18px; }
.tk-msg-content li { margin-bottom: 3px; }

.tk-reply-area {
  flex: 0 0 auto;
  padding: 18px 24px 22px;
  border-top: 1px solid #eef0f2;
  background: #fff;
}

.tk-reply-box { border: 1px solid #e5e7eb; border-radius: 16px; overflow: hidden; transition: border-color .15s; }
.tk-reply-box:focus-within { border-color: var(--brand); }
.tk-reply-textarea { width: 100%; border: none; background: transparent; padding: 16px 20px 0; font-size: 14px; line-height: 1.5; color: var(--text); resize: none; outline: none; font-family: inherit; min-height: 80px; }
.tk-reply-textarea::placeholder { color: #9ca3af; }
.tk-reply-footer { display: flex; align-items: center; justify-content: space-between; padding: 10px 14px; }
.tk-reply-attach { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); cursor: pointer; padding: 6px 10px; border-radius: 8px; transition: background .15s, color .15s; }
.tk-reply-attach:hover { background: #f3f4f6; color: #374151; }
.tk-reply-send { padding: 8px 20px; border-radius: 8px; }

.tk-status-row { display: flex; align-items: center; gap: 12px; padding: 16px 0 0; flex-wrap: wrap; }
.tk-status-label { font-size: 13px; color: var(--muted); }
.tk-status-options { display: flex; align-items: center; gap: 16px; }
.tk-radio-label { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 500; color: #374151; cursor: pointer; user-select: none; }
.tk-radio-input { position: absolute; opacity: 0; width: 0; height: 0; }
.tk-radio-dot { width: 16px; height: 16px; border-radius: 50%; border: 1.5px solid #d1d5db; display: flex; align-items: center; justify-content: center; transition: border-color .15s, background .15s; flex-shrink: 0; }
.tk-radio-dot::after { content: ""; width: 8px; height: 8px; border-radius: 50%; background: transparent; transition: background .15s; }
.tk-radio-input:checked + .tk-radio-dot { border-color: var(--brand); background: var(--brand); }
.tk-radio-input:checked + .tk-radio-dot::after { background: #fff; }

.tk-chat-closed { padding: 24px; text-align: center; color: var(--muted); font-size: 14px; border-top: 1px solid #eef0f2; }

.tk-sidebar-card { background: #fff; border: 1px solid #e5e7eb; border-radius: 16px; overflow: hidden; }
.tk-sidebar-header { padding: 18px 24px; border-bottom: 1px solid #eef0f2; }
.tk-sidebar-header h3 { margin: 0; font-size: 16px; font-weight: 600; color: var(--text); }
.tk-sidebar-list { list-style: none; margin: 0; padding: 0; }
.tk-sidebar-item { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; padding: 12px 24px; border-bottom: 1px solid #f3f4f6; }
.tk-sidebar-item:last-child { border-bottom: none; }
.tk-sidebar-label { font-size: 13px; color: var(--muted); }
.tk-sidebar-value { font-size: 13px; font-weight: 500; color: var(--text); text-align: right; word-break: break-word; }
.tk-sidebar-desc { padding: 16px 24px; border-top: 1px solid #eef0f2; }
.tk-sidebar-desc .tk-sidebar-label { display: block; margin-bottom: 6px; font-size: 12px; text-transform: uppercase; letter-spacing: 0.4px; }
.tk-sidebar-desc p:last-child { margin: 0; font-size: 13px; color: #4b5563; line-height: 1.5; }

.tk-actions-card { background: #fff; border: 1px solid #e5e7eb; border-radius: 16px; padding: 20px; margin-top: 16px; }
.tk-actions-title { margin: 0 0 14px; font-size: 14px; font-weight: 600; color: var(--text); }
.tk-actions-list { display: flex; flex-direction: column; gap: 8px; }
.tk-action-btn { display: flex; align-items: center; gap: 8px; width: 100%; padding: 10px 14px; border-radius: 10px; border: 1px solid #e5e7eb; background: #fff; font-size: 13px; font-weight: 500; color: var(--text); cursor: pointer; text-decoration: none; transition: border-color .15s, background .15s, color .15s; font-family: inherit; text-align: left; }
.tk-action-btn:hover { background: #f9fafb; border-color: #d1d5db; }
.tk-action-close { color: var(--danger); }
.tk-action-close:hover { background: #fef2f2; border-color: #fca5a5; }
.tk-action-reopen { color: var(--brand); }
.tk-action-reopen:hover { background: #eff6ff; border-color: #93bbfd; }
.tk-action-list { color: #374151; }
.tk-action-po { color: var(--brand); }

/* ---------- export center ---------- */
.export-center { min-width: 0; }
.export-center-head { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 18px; }
.export-center-head h1 { margin: 0; font-size: 30px; line-height: 1.2; }
.export-center-head p { max-width: 760px; margin: 6px 0 0; color: var(--muted); font-size: 14px; }
.export-eyebrow { display: block; margin-bottom: 5px; color: var(--brand); font-size: 11px; font-weight: 800; letter-spacing: .09em; text-transform: uppercase; }
.export-format-badge { display: flex; align-items: center; gap: 11px; min-width: 220px; padding: 11px 14px; border: 1px solid #bbf7d0; border-radius: 13px; background: #f0fdf4; }
.export-format-badge > span { display: grid; place-items: center; width: 48px; height: 38px; border-radius: 9px; background: #15803d; color: #fff; font-size: 11px; font-weight: 850; }
.export-format-badge strong, .export-format-badge small { display: block; }
.export-format-badge strong { font-size: 13px; }
.export-format-badge small { margin-top: 2px; color: #15803d; font-size: 10px; }
.export-workspace { display: grid; grid-template-columns: minmax(420px, .9fr) minmax(0, 1.35fr); gap: 16px; align-items: start; }
.export-builder, .export-preview-panel { min-width: 0; overflow: hidden; border: 1px solid var(--border); border-radius: 16px; background: #fff; box-shadow: var(--shadow-card); }
.export-panel { padding: 19px; border-bottom: 1px solid #edf0f3; }
.export-panel > header { display: flex; align-items: flex-start; gap: 11px; margin-bottom: 15px; }
.export-panel > header > div { min-width: 0; flex: 1; }
.export-panel h2, .export-preview-panel h2 { margin: 0; font-size: 16px; }
.export-panel header p, .export-preview-panel header p { margin: 3px 0 0; color: var(--muted); font-size: 11px; line-height: 1.45; }
.export-step { display: grid; place-items: center; width: 29px; height: 29px; flex: 0 0 29px; border-radius: 9px; background: var(--brand-soft); color: var(--brand); font-size: 11px; font-weight: 850; }
.export-field { display: block; min-width: 0; }
.export-field > span { display: block; margin: 0 0 6px 2px; color: #475467; font-size: 11px; font-weight: 700; }
.export-filter-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 11px; }
.export-filter-field[hidden] { display: none; }
.export-reset-link { margin-top: 12px; padding: 0; border: 0; background: transparent; color: var(--brand); font: inherit; font-size: 11px; font-weight: 700; cursor: pointer; }
.export-column-count { display: grid; place-items: center; min-width: 29px; height: 27px; padding: 0 7px; border-radius: 99px; background: var(--brand-soft); color: var(--brand); font-size: 10px; }
.export-column-tools { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 7px; margin-bottom: 10px; }
.export-column-tools > label { position: relative; display: flex; align-items: center; min-width: 0; height: 38px; border: 1px solid #d1d5db; border-radius: 9px; }
.export-column-tools svg { position: absolute; inset-inline-start: 10px; width: 16px; height: 16px; color: var(--muted); }
.export-column-tools input { width: 100%; height: 100%; padding-inline: 33px 10px; border: 0; outline: 0; background: transparent; font: inherit; font-size: 11px; }
.export-column-tools > button { padding: 0 10px; border: 1px solid var(--border); border-radius: 9px; background: #fff; color: #475467; font: inherit; font-size: 10px; font-weight: 700; cursor: pointer; }
.export-column-tools > button:hover { border-color: #b8c2ff; background: #f8f9ff; color: var(--brand); }
.export-column-list { display: flex; max-height: 310px; flex-direction: column; gap: 6px; overflow-y: auto; padding-inline-end: 3px; }
.export-column-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 42px; padding: 7px 8px 7px 11px; border: 1px solid #edf0f3; border-radius: 9px; background: #fafbfc; }
.export-column-row[hidden] { display: none; }
.export-column-row > label { display: grid; min-width: 0; flex: 1; grid-template-columns: 18px minmax(0, 1fr) auto; gap: 8px; align-items: center; cursor: pointer; }
.export-column-row input { accent-color: var(--brand); }
.export-column-row span { overflow: hidden; font-size: 12px; font-weight: 650; text-overflow: ellipsis; white-space: nowrap; }
.export-column-row small { color: #98a2b3; font-size: 9px; }
.export-column-row > div { display: flex; gap: 3px; }
.export-column-row button { display: grid; place-items: center; width: 25px; height: 25px; border: 1px solid var(--border); border-radius: 7px; background: #fff; color: var(--muted); cursor: pointer; }
.export-builder-footer { display: flex; align-items: center; justify-content: space-between; gap: 15px; padding: 16px 19px; background: #fafbfc; }
.export-builder-footer > div { display: flex; align-items: baseline; gap: 5px; }
.export-builder-footer strong { color: var(--brand); font-size: 19px; }
.export-builder-footer span { color: var(--muted); font-size: 10px; }
.export-download-button svg { width: 18px; height: 18px; }
.export-download-button:disabled { opacity: .5; cursor: not-allowed; }
.export-preview-panel { position: sticky; top: 76px; }
.export-preview-panel > header { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 18px 20px; border-bottom: 1px solid var(--border); }
.export-preview-panel > header > div { display: flex; align-items: flex-start; gap: 11px; }
.export-preview-status { padding: 5px 9px; border-radius: 99px; background: var(--success-soft); color: var(--success-dark); font-size: 10px; font-weight: 800; }
.export-preview-status.is-loading { background: var(--warning-soft); color: var(--warning-dark); }
.export-preview-summary { display: flex; align-items: baseline; gap: 6px; padding: 15px 20px 12px; }
.export-preview-summary strong { font-size: 23px; }
.export-preview-summary span { font-size: 12px; font-weight: 700; }
.export-preview-summary small { margin-inline-start: auto; color: var(--muted); font-size: 9px; }
.export-preview-table { min-height: 320px; max-height: 490px; overflow: auto; border-block: 1px solid #edf0f3; }
.export-preview-table table { margin: 0; }
.export-preview-table th { position: sticky; top: 0; z-index: 2; min-width: 125px; background: #f8fafc; font-size: 10px; white-space: nowrap; }
.export-preview-table td { max-width: 240px; overflow: hidden; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.export-preview-empty { display: grid; min-height: 260px; place-items: center; color: var(--muted); font-size: 12px; }
.export-preview-empty[hidden] { display: none; }
.export-safety-note { display: flex; gap: 10px; align-items: flex-start; padding: 14px 18px; background: #f8f9ff; }
.export-safety-note svg { width: 22px; height: 22px; flex: 0 0 22px; color: var(--brand); }
.export-safety-note strong { display: block; font-size: 11px; }
.export-safety-note p { margin: 2px 0 0; color: var(--muted); font-size: 9px; line-height: 1.45; }

/* ---------- finance workspace ---------- */
.finance-workspace { min-width: 0; }
.finance-page-head { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 16px; }
.finance-page-head h1 { margin: 0; font-size: 30px; line-height: 1.2; }
.finance-page-head p { max-width: 720px; margin: 6px 0 0; color: var(--muted); font-size: 14px; line-height: 1.5; }
.finance-eyebrow { display: block; margin-bottom: 5px; color: var(--brand); font-size: 11px; font-weight: 800; letter-spacing: .09em; text-transform: uppercase; }
.finance-head-actions { display: flex; align-items: center; gap: 8px; }
.finance-filter-shell { position: relative; z-index: 20; display: grid; grid-template-columns: minmax(210px, 1fr) 140px 140px 160px 170px auto; gap: 8px; align-items: end; margin-bottom: 14px; padding: 12px; border: 1px solid var(--border); border-radius: 14px; background: #fff; box-shadow: var(--shadow-card); }
.finance-filter-shell > label > span { display: block; margin: 0 0 6px 2px; color: #475467; font-size: 12px; font-weight: 700; }
.finance-filter-shell .form-control, .finance-filter-shell .btn { height: 40px; }
.finance-search { position: relative; display: flex; align-items: center; height: 40px; border: 1px solid #d1d5db; border-radius: 10px; background: #f9fafb; }
.finance-search:focus-within { border-color: var(--brand); background: #fff; box-shadow: 0 0 0 3px rgba(70,95,255,.1); }
.finance-search svg { position: absolute; inset-inline-start: 11px; width: 18px; height: 18px; color: #8b93a1; }
.finance-search input { width: 100%; height: 100%; padding: 0 12px 0 38px; border: 0; outline: 0; background: transparent; font: inherit; font-size: 14px; }
[dir="rtl"] .finance-search input { padding: 0 38px 0 12px; }
.finance-filter-shell:has(.select-wrap.open) { z-index: 150; }
.finance-filter-shell .select-wrap.open { z-index: 160; }
.finance-filter-shell .select-panel { z-index: 170; }

.finance-kpi-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 11px; margin-bottom: 10px; }
.finance-kpi { display: flex; align-items: center; gap: 14px; min-width: 0; min-height: 108px; padding: 17px 18px; border: 1px solid var(--border); border-radius: 14px; background: #fff; box-shadow: var(--shadow-card); }
.finance-kpi-icon { display: grid; place-items: center; width: 45px; height: 45px; flex: 0 0 45px; border-radius: 12px; line-height: 0; }
.finance-kpi-icon svg { display: block; width: 22px; height: 22px; margin: auto; }
.finance-kpi-revenue .finance-kpi-icon { background: var(--brand-soft); color: var(--brand); }
.finance-kpi-payments .finance-kpi-icon { background: var(--success-soft); color: var(--success-dark); }
.finance-kpi-outstanding .finance-kpi-icon { background: var(--warning-soft); color: var(--warning-dark); }
.finance-kpi-overdue .finance-kpi-icon { background: var(--danger-soft); color: var(--danger-dark); }
.finance-kpi > div { min-width: 0; }
.finance-kpi > div > span, .finance-kpi strong, .finance-kpi small { display: block; }
.finance-kpi > div > span { color: var(--muted); font-size: 13px; font-weight: 700; }
.finance-kpi strong { margin-top: 4px; overflow: hidden; color: var(--text); font-size: clamp(20px, 1.7vw, 26px); line-height: 1.25; text-overflow: ellipsis; white-space: nowrap; }
.finance-kpi small { margin-top: 5px; color: #7c8594; font-size: 11px; }
.finance-secondary-strip { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin-bottom: 14px; overflow: hidden; border: 1px solid var(--border); border-radius: 11px; background: #fafbfc; }
.finance-secondary-strip > div { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 39px; padding: 8px 13px; border-inline-end: 1px solid var(--border); }
.finance-secondary-strip > div:last-child { border-inline-end: 0; }
.finance-secondary-strip span { color: var(--muted); font-size: 12px; }
.finance-secondary-strip strong { font-size: 13px; }

.finance-tabs { display: flex; gap: 3px; padding: 4px; overflow-x: auto; border: 1px solid var(--border); border-radius: 12px 12px 0 0; background: #f4f6f8; scrollbar-width: none; }
.finance-tabs button { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-width: 112px; min-height: 42px; padding: 9px 15px; border: 0; border-radius: 8px; background: transparent; color: #667085; font: inherit; font-size: 13px; font-weight: 750; cursor: pointer; white-space: nowrap; }
.finance-tabs button:hover { color: var(--text); }
.finance-tabs button.is-active { background: #fff; color: var(--brand); box-shadow: 0 1px 4px rgba(15,23,42,.1); }
.finance-tabs button span { display: grid; place-items: center; min-width: 22px; height: 21px; padding: 0 6px; border-radius: 999px; background: #e7eaf0; color: #667085; font-size: 10px; }
.finance-tabs button.is-active span { background: var(--brand-soft); color: var(--brand); }
.finance-tab-panels { min-height: 480px; border: 1px solid var(--border); border-top: 0; border-radius: 0 0 16px 16px; background: #fff; box-shadow: var(--shadow-card); }
.finance-tab-panel { display: none; }
.finance-tab-panel.is-active { display: block; }
.finance-tab-panel[hidden], [data-finance-show-more][hidden] { display: none !important; }

.finance-overview-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.finance-card { min-width: 0; padding: 22px; border-inline-end: 1px solid #edf0f3; border-bottom: 1px solid #edf0f3; }
.finance-card:nth-child(even) { border-inline-end: 0; }
.finance-card > header { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 15px; }
.finance-card > header h2 { margin: 0; font-size: 17px; line-height: 1.35; }
.finance-card > header p { margin: 4px 0 0; color: var(--muted); font-size: 12px; line-height: 1.45; }
.finance-card > header > span { color: var(--muted); font-size: 11px; }
.finance-chart-card { grid-column: 1 / -1; border-inline-end: 0; }
.finance-chart-summary { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 12px; }
.finance-chart-summary span, .finance-chart-summary strong { display: block; }
.finance-chart-summary span { color: var(--muted); font-size: 12px; }
.finance-chart-summary strong { margin-top: 3px; font-size: 25px; line-height: 1.2; }
.finance-chart-summary p { margin: 0; color: var(--muted); font-size: 12px; }
.finance-chart-summary p b { margin-inline-start: 5px; color: var(--text); }
.finance-revenue-chart { display: grid; grid-template-columns: 58px minmax(0, 1fr); gap: 10px; min-height: 300px; }
.finance-chart-y-axis { display: flex; height: 260px; flex-direction: column; justify-content: space-between; padding-block: 8px 12px; color: #7c8594; font-size: 11px; text-align: end; }
.finance-chart-scroll { min-width: 0; overflow-x: auto; overflow-y: hidden; scrollbar-width: thin; }
.finance-chart-plot { position: relative; min-width: 720px; height: 260px; cursor: crosshair; }
.finance-chart-plot svg { display: block; width: 100%; height: 100%; overflow: visible; }
.finance-chart-gridline { stroke: #e6e9ee; stroke-width: 1; stroke-dasharray: 4 5; vector-effect: non-scaling-stroke; }
.finance-chart-area { fill: url(#finance-chart-fill); }
.finance-chart-line { fill: none; stroke: var(--brand); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.finance-chart-marker { fill: #fff; stroke: var(--brand); stroke-width: 3; vector-effect: non-scaling-stroke; }
.finance-chart-tooltip { position: absolute; z-index: 3; min-width: 140px; padding: 9px 11px; transform: translateX(-50%); border: 1px solid #dfe3e8; border-radius: 10px; background: #111827; color: #fff; box-shadow: 0 8px 24px rgba(15,23,42,.18); pointer-events: none; }
.finance-chart-tooltip[hidden] { display: none; }
.finance-chart-tooltip span, .finance-chart-tooltip strong { display: block; }
.finance-chart-tooltip span { color: #cbd5e1; font-size: 11px; }
.finance-chart-tooltip strong { margin-top: 3px; font-size: 13px; }
.finance-chart-x-axis { display: grid; min-width: 720px; grid-template-columns: repeat(12, minmax(42px, 1fr)); padding-top: 9px; color: #7c8594; font-size: 11px; text-align: center; }
.finance-attention-list { display: flex; max-height: 210px; flex-direction: column; overflow-y: auto; }
.finance-attention-list > a { display: grid; grid-template-columns: 8px minmax(0, 1fr) auto; gap: 9px; align-items: center; padding: 10px 3px; border-bottom: 1px solid #f0f2f5; color: inherit; text-decoration: none; }
.finance-attention-list > a:hover strong { color: var(--brand); }
.finance-attention-list strong, .finance-attention-list small { display: block; }
.finance-attention-list strong { font-size: 13px; }
.finance-attention-list small { margin-top: 3px; color: var(--muted); font-size: 11px; }
.finance-attention-list b { font-size: 12px; white-space: nowrap; }
.finance-attention-dot { width: 7px; height: 7px; border-radius: 50%; }
.finance-attention-dot.is-danger { background: var(--danger); }
.finance-attention-dot.is-warning { background: var(--warning); }
.finance-alert-count { display: grid; place-items: center; min-width: 25px; height: 23px; border-radius: 999px; background: var(--danger-soft); color: var(--danger-dark) !important; font-weight: 800; }
.finance-clear-state { display: grid; min-height: 180px; place-content: center; text-align: center; }
.finance-clear-state > span { display: grid; place-items: center; width: 39px; height: 39px; margin: 0 auto 8px; border-radius: 12px; background: var(--success-soft); color: var(--success); }
.finance-clear-state strong { font-size: 14px; }
.finance-clear-state p { margin: 4px 0 0; color: var(--muted); font-size: 12px; }
.finance-ranking-list { display: flex; flex-direction: column; gap: 13px; }
.finance-ranking-list > div > div { display: flex; justify-content: space-between; gap: 10px; margin-bottom: 7px; font-size: 12px; }
.finance-ranking-list > div > div span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.finance-ranking-list > div > div strong { font-size: 11px; white-space: nowrap; }
.finance-ranking-list i, .finance-method-list i { display: block; height: 8px; overflow: hidden; border-radius: 99px; background: #edf0f3; }
.finance-ranking-list i b, .finance-method-list i b { display: block; height: 100%; border-radius: inherit; background: var(--brand); }
.finance-ranking-buyer i b { background: #8b5cf6; }
.finance-method-card { grid-column: auto; }
.finance-method-list { display: grid; grid-template-columns: 1fr; gap: 12px; }
.finance-method-list > div { display: grid; grid-template-columns: 8px minmax(0, 1fr) 36px auto; gap: 8px; align-items: center; }
.finance-method-list > div > div strong { display: block; margin-bottom: 6px; font-size: 12px; }
.finance-method-list > div > span, .finance-method-list > div > b { font-size: 11px; }
.finance-method-dot { width: 7px; height: 7px; border-radius: 50%; }
.method-0 { background: var(--brand) !important; }
.method-1 { background: #10b981 !important; }
.method-2 { background: #f59e0b !important; }
.method-3 { background: #8b5cf6 !important; }
.finance-no-data { margin: 30px 0; color: var(--muted); font-size: 13px; text-align: center; }

.finance-section-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; min-height: 68px; padding: 13px 17px; border-bottom: 1px solid #edf0f3; }
.finance-section-head h2 { margin: 0; font-size: 17px; }
.finance-section-head p { margin: 4px 0 0; color: var(--muted); font-size: 12px; }
.finance-table-shell { min-width: 0; }
.finance-data-table { margin: 0; }
.finance-data-table thead { position: sticky; top: 0; z-index: 2; }
.finance-data-table th { background: #fafbfc; font-size: 12px; white-space: nowrap; }
.finance-data-table td { font-size: 13px; vertical-align: middle; white-space: nowrap; }
.finance-data-table td small { display: block; margin-top: 4px; color: var(--muted); font-size: 11px; }
.finance-data-table tr[hidden] { display: none; }
.finance-table-shell > footer { display: flex; justify-content: center; padding: 12px; border-top: 1px solid #edf0f3; }
.finance-table-empty { padding: 60px 20px; color: var(--muted); font-size: 11px; text-align: center; }
.finance-table-empty[hidden] { display: none; }
.finance-report-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; padding: 18px; }
.finance-report-grid > button, .finance-report-grid > a { display: grid; grid-template-columns: 42px minmax(0, 1fr); gap: 13px; align-items: center; padding: 17px; border: 1px solid var(--border); border-radius: 13px; outline: 0; background: #fff; color: inherit; font: inherit; text-align: start; text-decoration: none; cursor: pointer; }
.finance-report-grid > button:hover, .finance-report-grid > a:hover { border-color: #b8c2ff; background: #f8f9ff; }
.finance-report-grid > button > span, .finance-report-grid > a > span { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 12px; background: var(--brand-soft); color: var(--brand); font-size: 10px; font-weight: 800; }
.finance-report-grid strong { display: block; font-size: 14px; }
.finance-report-grid p { margin: 5px 0 0; color: var(--muted); font-size: 12px; line-height: 1.5; }

/* ---------- billing and invoices ---------- */
.billing-page-head { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 20px; }
.billing-page-head h1 { margin: 0; font-size: 26px; }
.billing-page-head p { max-width: 680px; margin: 6px 0 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
.billing-eyebrow { display: block; margin-bottom: 5px; color: var(--brand); font-size: 10px; font-weight: 800; letter-spacing: .09em; text-transform: uppercase; }
.billing-head-actions { display: flex; align-items: center; gap: 9px; }
.billing-head-actions form { margin: 0; }
.billing-sim-button { border-color: #f59e0b; background: #fffbeb; color: #b45309; }
.billing-sim-button:hover { border-color: #d97706; background: #fef3c7; color: #92400e; }
.billing-summary-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.billing-summary-grid article { display: flex; min-height: 92px; flex-direction: column; justify-content: center; padding: 16px 18px; border: 1px solid var(--border); border-radius: 14px; background: #fff; box-shadow: var(--shadow-card); }
.billing-summary-grid span { color: var(--muted); font-size: 11px; }
.billing-summary-grid strong { margin-top: 6px; color: var(--text); font-size: 20px; }
.billing-panel { overflow: hidden; border: 1px solid var(--border); border-radius: 16px; background: #fff; box-shadow: var(--shadow-card); }
.billing-panel:has(.select-wrap.open) { position: relative; z-index: 120; overflow: visible; }
.billing-filterbar .select-wrap { position: relative; z-index: 2; }
.billing-filterbar .select-wrap.open { z-index: 140; }
.billing-filterbar .select-panel { z-index: 150; }
.billing-panel-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 17px 19px; border-bottom: 1px solid #edf0f3; }
.billing-panel-head h2 { margin: 0; font-size: 15px; }
.billing-panel-head p { margin: 4px 0 0; color: var(--muted); font-size: 10px; }
.billing-filterbar { display: grid; grid-template-columns: minmax(240px, 1fr) 180px auto; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--border); background: #fafbfc; }
.billing-search { position: relative; display: flex; align-items: center; height: 42px; border: 1px solid #d1d5db; border-radius: 10px; background: #fff; }
.billing-search svg { position: absolute; inset-inline-start: 12px; width: 18px; height: 18px; color: #8b93a1; }
.billing-search input { width: 100%; height: 100%; padding: 0 12px 0 39px; border: 0; outline: 0; background: transparent; font: inherit; font-size: 12px; }
[dir="rtl"] .billing-search input { padding: 0 39px 0 12px; }
.billing-table { margin: 0; }
.billing-table th { white-space: nowrap; }
.billing-table td { vertical-align: middle; }
.billing-table td small { display: block; margin-top: 3px; color: var(--muted); font-size: 9px; }
.billing-status { display: inline-flex; align-items: center; min-height: 25px; padding: 4px 9px; border-radius: 999px; background: #eef0f3; color: #596273; font-size: 9px; font-weight: 800; white-space: nowrap; }
.billing-status-draft { background: #f1f5f9; color: #475569; }
.billing-status-issued { background: var(--info-soft); color: var(--info-dark); }
.billing-status-partial { background: var(--warning-soft); color: var(--warning-dark); }
.billing-status-paid { background: var(--success-soft); color: var(--success-dark); }
.billing-status-overdue, .billing-status-void { background: var(--danger-soft); color: var(--danger-dark); }
.billing-empty { padding: 70px 20px; text-align: center; }
.billing-empty h2 { margin: 0; font-size: 17px; }
.billing-empty p { margin: 6px 0 0; color: var(--muted); font-size: 12px; }

.billing-settings-layout { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(330px, .9fr); gap: 16px; align-items: start; }
.billing-settings-side { display: flex; flex-direction: column; gap: 16px; }
.billing-form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 15px; padding: 19px; }
.billing-form-grid label > span, .billing-stack-form label > span { display: block; margin-bottom: 6px; color: #475467; font-size: 10px; font-weight: 750; }
.billing-field-wide { grid-column: 1 / -1; }
.billing-form-actions { display: flex; justify-content: flex-end; }
.billing-input-suffix { position: relative; }
.billing-input-suffix > span { position: absolute; inset-block: 0; inset-inline-end: 11px; display: flex; align-items: center; color: var(--muted); font-size: 10px; pointer-events: none; }
.billing-input-suffix .form-control { padding-inline-end: 46px; }
.billing-rule-form { display: grid; grid-template-columns: minmax(0, 1fr) 100px auto; gap: 8px; padding: 14px 16px; border-bottom: 1px solid #edf0f3; }
.billing-fee-rule-form { grid-template-columns: minmax(120px, 1fr) 125px 90px; }
.billing-fee-rule-form .billing-check, .billing-fee-rule-form .btn { align-self: center; }
.billing-check { display: flex; align-items: center; gap: 7px; color: #475467; font-size: 10px; font-weight: 650; }
.billing-check input { accent-color: var(--brand); }
.billing-rule-list { padding: 7px 14px 12px; }
.billing-rule-list article { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 11px 4px; border-bottom: 1px solid #f0f2f5; }
.billing-rule-list article:last-child { border-bottom: 0; }
.billing-rule-list strong, .billing-rule-list span { display: block; }
.billing-rule-list strong { font-size: 11px; }
.billing-rule-list span { margin-top: 3px; color: var(--muted); font-size: 9px; }
.billing-toggle { position: relative; width: 36px; height: 21px; padding: 0; border: 0; border-radius: 999px; background: #d5dae1; cursor: pointer; }
.billing-toggle i { position: absolute; top: 3px; inset-inline-start: 3px; width: 15px; height: 15px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.2); transition: transform .15s; }
.billing-toggle.is-on { background: var(--brand); }
.billing-toggle.is-on i { transform: translateX(15px); }
[dir="rtl"] .billing-toggle.is-on i { transform: translateX(-15px); }

.billing-invoice-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 16px; align-items: start; }
.billing-invoice-paper { min-width: 0; overflow: hidden; border: 1px solid var(--border); border-radius: 16px; background: #fff; box-shadow: var(--shadow-card); }
.billing-invoice-parties { display: grid; grid-template-columns: 1fr 1fr minmax(160px, .7fr); gap: 24px; padding: 28px; border-bottom: 1px solid #edf0f3; }
.billing-invoice-parties > div > span, .billing-invoice-notes > span { display: block; margin-bottom: 8px; color: #98a2b3; font-size: 9px; font-weight: 800; letter-spacing: .07em; text-transform: uppercase; }
.billing-invoice-parties strong { display: block; font-size: 13px; }
.billing-invoice-parties p { margin: 5px 0; color: #667085; font-size: 11px; line-height: 1.5; }
.billing-invoice-parties small { color: var(--muted); font-size: 9px; }
.billing-invoice-parties dl { margin: 0; }
.billing-invoice-parties dl > div { display: flex; justify-content: space-between; gap: 10px; padding: 6px 0; border-bottom: 1px solid #f1f3f5; font-size: 10px; }
.billing-invoice-parties dt { color: var(--muted); }
.billing-invoice-parties dd { margin: 0; font-weight: 700; text-align: end; }
.billing-line-table { margin: 0; }
.billing-line-table th, .billing-line-table td { padding: 14px 18px; }
.billing-invoice-bottom { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 32px; padding: 28px; border-top: 1px solid #edf0f3; }
.billing-invoice-notes p { margin: 0 0 22px; color: #667085; font-size: 11px; line-height: 1.6; white-space: pre-wrap; }
.billing-totals > div { display: flex; align-items: center; justify-content: space-between; gap: 15px; padding: 7px 0; color: #667085; font-size: 10px; }
.billing-totals strong { color: #344054; }
.billing-totals .billing-grand-total { margin-top: 7px; padding: 13px 0; border-top: 1px solid #dfe3e8; border-bottom: 1px solid #dfe3e8; color: var(--text); font-size: 13px; }
.billing-totals .billing-grand-total strong { font-size: 17px; }
.billing-totals .billing-balance { color: var(--brand); font-weight: 800; }
.billing-payment-history { padding: 0 28px 28px; }
.billing-payment-history h2 { font-size: 14px; }
.billing-invoice-sidebar { display: flex; flex-direction: column; gap: 14px; }
.billing-stack-form { display: flex; flex-direction: column; gap: 13px; padding: 17px; }
.billing-stack-form .billing-form-grid { padding: 0; gap: 9px; }
.billing-charge-list { padding: 8px 16px 0; }
.billing-charge-list article { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 0; border-bottom: 1px solid #edf0f3; }
.billing-charge-list strong, .billing-charge-list span { display: block; font-size: 10px; }
.billing-charge-list span { margin-top: 3px; color: var(--muted); font-size: 9px; }
.billing-charge-list button { width: 28px; height: 28px; border: 0; border-radius: 8px; background: var(--danger-soft); color: var(--danger); cursor: pointer; }
.billing-full-button { width: 100%; min-height: 44px; }
.billing-danger-zone { padding: 17px; border-color: #fecaca; }
.billing-danger-zone h2 { margin: 0 0 10px; color: var(--danger-dark); font-size: 13px; }
.billing-danger-zone form { display: flex; flex-direction: column; gap: 10px; }
.billing-new-invoice-panel { max-width: 920px; margin-inline: auto; }
.billing-edit-item-list { padding: 8px 16px 0; }
.billing-edit-item-list > form { display: flex; flex-direction: column; gap: 7px; padding: 11px 0; border-bottom: 1px solid #edf0f3; }
.billing-edit-item-list > form > div { display: grid; grid-template-columns: 90px minmax(0, 1fr); gap: 7px; }
.billing-edit-item-list footer { display: flex; justify-content: flex-end; gap: 6px; }
.billing-new-item-form { border-top: 1px solid #edf0f3; }
.billing-po-invoice-link { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 16px; padding: 14px 16px; border: 1px solid #c7d2fe; border-radius: 12px; background: #f5f7ff; }
.billing-po-invoice-link span, .billing-po-invoice-link strong, .billing-po-invoice-link small { display: block; }
.billing-po-invoice-link span { color: var(--muted); font-size: 9px; text-transform: uppercase; }
.billing-po-invoice-link strong { margin-top: 3px; font-size: 13px; }
.billing-po-invoice-link small { margin-top: 3px; color: var(--brand); font-size: 9px; }

@media print {
  .site-header, .billing-page-head, .billing-invoice-sidebar, #toast-root { display: none !important; }
  .container { max-width: none; padding: 0; }
  .billing-invoice-layout { display: block; }
  .billing-invoice-paper { border: 0; box-shadow: none; }
}

/* ---------- responsive ---------- */
@media (max-width: 1020px) {
  .export-workspace { grid-template-columns: 1fr; }
  .export-preview-panel { position: static; }
  .shop-filters { grid-template-columns: minmax(240px, 1fr) 170px 200px; }
  .shop-search-btn { grid-column: 1 / -1; }
  .shop-grid { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
  .notification-workspace { grid-template-columns: 220px minmax(0, 1fr); }
  .notification-inbox-toolbar { align-items: stretch; flex-direction: column; }
  .notification-toolbar-controls { width: 100%; }
  .notification-row { grid-template-columns: 9px 44px minmax(0, 1fr); }
  .notification-row-icon { width: 44px; height: 44px; }
  .billing-settings-layout, .billing-invoice-layout { grid-template-columns: 1fr; }
  .billing-invoice-sidebar { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .billing-invoice-sidebar > form, .billing-invoice-sidebar .billing-danger-zone { grid-column: 1 / -1; }
  .finance-filter-shell { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .finance-search { grid-column: 1 / -1; }
  .finance-kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 720px) {
  .export-center-head { align-items: stretch; flex-direction: column; }
  .export-format-badge { min-width: 0; }
  .site-header { flex-wrap: wrap; gap: 12px; }
  .site-actions { order: 3; width: 100%; justify-content: flex-end; }
  .pill-nav { order: 4; flex: 1 1 100%; }
  .container { padding: 16px 16px 40px; }
  .two-col { grid-template-columns: 1fr; }
  .inv-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
  .inv-toolbar { flex-direction: column; align-items: stretch; }
  .user-menu-info { display: none; }
  .user-menu-trigger { padding: 4px; }
  .tk-stats { grid-template-columns: 1fr; gap: 10px; }
  .tk-detail-layout { grid-template-columns: 1fr; min-height: 0; }
  .tk-detail-main { display: block; }
  .tk-detail-card { min-height: 0; }
  .tk-chat-scroll { min-height: 0; max-height: 55vh; }
  .tk-reply-area { padding: 16px; }
  .tk-title-cell { max-width: 180px; }
  .tk-col-priority { display: none; }
  .tk-msg-bubble { width: fit-content; max-width: 85%; }
  .tk-detail-header { flex-direction: column; align-items: flex-start; gap: 8px; }
  .shop-discovery { padding: 12px; }
  .shop-filters { grid-template-columns: 1fr; }
  .shop-search-btn { grid-column: auto; }
  .shop-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .shop-product-media { height: 118px; }
  .shop-product-body { min-height: 190px; }
  .shop-results-head { align-items: center; }
  .app-dialog { padding: 22px 20px 20px; }
  .app-dialog-footer { flex-direction: column-reverse; }
  .app-dialog-footer .btn { width: 100%; }
  .cart-panel .table-wrap { padding-inline: 12px; }
  .cart-actions { align-items: stretch; flex-direction: column; padding: 16px; }
  .cart-actions form, .cart-actions .btn { width: 100%; }
  .inventory-sheet-head { align-items: stretch; flex-direction: column; padding: 18px 16px; }
  .inventory-sheet-actions { width: 100%; }
  .inventory-sheet-actions .btn { flex: 1; padding-inline: 12px; }
  .inventory-sheet-tools { align-items: stretch; flex-direction: column; padding: 14px 16px; }
  .inventory-search-combobox, .inventory-search { width: 100%; }
  .inventory-status-filter { width: 100%; }
  .inventory-filter-fields { align-items: stretch; flex-direction: column; width: 100%; }
  .inventory-store-tabs { padding-inline: 16px; }
  .inventory-sheet-footer { align-items: stretch; flex-direction: column; padding: 14px 16px; }
  .inventory-pagination { justify-content: space-between; }
  .item-create-head { align-items: flex-start; }
  .item-create-layout { grid-template-columns: 1fr; }
  .item-stores-panel { grid-column: auto; }
  .item-details-panel .item-panel-body { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .item-stores-head { align-items: flex-start; flex-wrap: wrap; }
  .item-store-selection { width: 100%; margin: 0; padding-inline-start: 50px; justify-content: space-between; }
  .item-create-actions { align-items: stretch; flex-direction: column; }
  .item-create-actions > div { justify-content: flex-end; }
  .notification-workspace { grid-template-columns: 1fr; min-height: 0; }
  .notification-mail-sidebar { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 12px; padding: 14px; border-inline-end: 0; border-bottom: 1px solid var(--border); }
  .notification-sidebar-heading { grid-column: 1 / -1; }
  .notification-toolbar-controls { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .notification-search { grid-column: 1 / -1; }
  .notification-list { max-height: 62vh; }
  .billing-page-head { align-items: stretch; flex-direction: column; }
  .billing-head-actions { flex-wrap: wrap; }
  .billing-summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .billing-filterbar { grid-template-columns: 1fr; }
  .billing-invoice-sidebar { grid-template-columns: 1fr; }
  .billing-invoice-sidebar > form, .billing-invoice-sidebar .billing-danger-zone { grid-column: auto; }
  .billing-invoice-parties { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .billing-invoice-parties dl { grid-column: 1 / -1; }
  .billing-invoice-bottom { grid-template-columns: 1fr; }
  .billing-fee-rule-form { grid-template-columns: 1fr 1fr; }
  .finance-page-head { align-items: stretch; flex-direction: column; }
  .finance-filter-shell { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .finance-filter-shell .btn { width: 100%; }
  .finance-overview-grid { grid-template-columns: 1fr; }
  .finance-card, .finance-card:nth-child(even) { border-inline-end: 0; }
  .finance-method-card { grid-column: auto; }
  .finance-revenue-chart { grid-template-columns: 48px minmax(0, 1fr); }
  .finance-secondary-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .finance-secondary-strip > div:nth-child(2) { border-inline-end: 0; }
  .finance-secondary-strip > div:nth-child(-n+2) { border-bottom: 1px solid var(--border); }
}

@media (max-width: 520px) {
  .export-filter-grid, .export-column-tools { grid-template-columns: 1fr; }
  .export-column-tools > button { min-height: 36px; }
  .export-builder-footer { align-items: stretch; flex-direction: column; }
  .export-download-button { width: 100%; }
  .shop-grid { grid-template-columns: 1fr; }
  .shop-product-media { height: 145px; }
  .shop-card-form { grid-template-columns: 92px minmax(0, 1fr); }
  .shop-quantity { grid-template-columns: 29px 32px 29px; }
  .item-create-head { flex-direction: column; }
  .item-create-head .btn { width: 100%; }
  .item-details-panel .item-panel-body { grid-template-columns: 1fr; }
  .item-details-panel .item-field-wide { grid-column: auto; }
  .item-details-panel .item-stock-preview { grid-column: auto; }
  .item-store-selection { padding-inline-start: 0; }
  .item-store-grid { grid-template-columns: 1fr; }
  .item-create-actions > div { flex-direction: column-reverse; }
  .item-create-actions .btn { width: 100%; }
  .notification-center-head { align-items: stretch; flex-direction: column; }
  .notification-center-head .btn { width: 100%; }
  .notification-mail-sidebar { grid-template-columns: 1fr; }
  .notification-sidebar-heading { grid-column: auto; }
  .notification-toolbar-controls { grid-template-columns: 1fr; }
  .notification-search { grid-column: auto; }
  .notification-row { grid-template-columns: 8px 40px minmax(0, 1fr); gap: 10px; padding: 13px 11px; }
  .notification-row-icon { width: 40px; height: 40px; border-radius: 12px; }
  .notification-row-icon svg { width: 20px; height: 20px; }
  .notification-row-title { align-items: flex-start; flex-direction: column; gap: 5px; }
  .notification-row-content > p { white-space: normal; }
  .notification-reader-body { padding: 24px 18px; }
  .notification-reader-heading { grid-template-columns: 50px minmax(0, 1fr); gap: 13px; }
  .notification-reader-main-icon { width: 50px; height: 50px; border-radius: 14px; }
  .notification-reader-main-icon svg { width: 24px; height: 24px; }
  .notification-reader-actions { align-items: stretch; flex-direction: column-reverse; }
  .notification-reader-actions .btn { width: 100%; }
  .billing-summary-grid, .billing-form-grid, .billing-invoice-parties { grid-template-columns: 1fr; }
  .billing-field-wide, .billing-invoice-parties dl { grid-column: auto; }
  .billing-rule-form, .billing-fee-rule-form { grid-template-columns: 1fr; }
  .billing-invoice-parties, .billing-invoice-bottom { padding: 20px 16px; }
  .billing-line-table th, .billing-line-table td { padding: 11px 12px; }
  .finance-head-actions { align-items: stretch; flex-direction: column; }
  .finance-filter-shell, .finance-kpi-grid { grid-template-columns: 1fr; }
  .finance-search { grid-column: auto; }
  .finance-tabs button { min-width: 95px; }
  .finance-method-list, .finance-report-grid { grid-template-columns: 1fr; }
  .finance-kpi { min-height: 80px; }
  .finance-card { padding: 18px 15px; }
  .finance-chart-summary { align-items: flex-start; flex-direction: column; }
  .finance-chart-summary strong { font-size: 22px; }
  .finance-revenue-chart { grid-template-columns: 42px minmax(0, 1fr); gap: 7px; }
}

/* ---------- RTL ---------- */
[dir="rtl"] body { font-family: "Segoe UI", "Tahoma", "Arial", sans-serif; }
[dir="rtl"] .layout { flex-direction: column; }
[dir="rtl"] #toast-root { right: auto; left: 24px; }
[dir="rtl"] .table th, [dir="rtl"] .table td { text-align: right; }
[dir="rtl"] .input-icon .form-control { padding-left: 12px; padding-right: 38px; }
[dir="rtl"] .input-icon-ic { left: auto; right: 12px; }
[dir="rtl"] .info-table td:first-child { text-align: right; }
[dir="rtl"] .btn + .btn { margin-left: 0; margin-right: 8px; }
[dir="rtl"] .notif-panel { right: auto; left: 0; }
[dir="rtl"] .kebab-dropdown { right: auto; left: 0; }
[dir="rtl"] .select-trigger { text-align: right; }
[dir="rtl"] .select-panel { left: auto; right: 0; }
[dir="rtl"] .select-search-input { padding: 8px 32px 8px 10px; background-position: right 10px center; }
[dir="rtl"] .select-option { text-align: right; }
[dir="rtl"] .select-option.selected::after { content: "\2713"; float: left; }
[dir="rtl"] .kebab-item { text-align: right; }
[dir="rtl"] .notif-info, [dir="rtl"] .notif-success, [dir="rtl"] .notif-warning, [dir="rtl"] .notif-danger { border-left: none; }
[dir="rtl"] .notif-info { border-right: 3px solid var(--info); }
[dir="rtl"] .notif-success { border-right: 3px solid var(--success); }
[dir="rtl"] .notif-warning { border-right: 3px solid var(--warning); }
[dir="rtl"] .notif-danger { border-right: 3px solid var(--danger); }
[dir="rtl"] .timeline li { border-left: none; border-right: 2px solid #eef0f2; padding: 0 34px 18px 0; margin-right: 8px; margin-left: 0; }
[dir="rtl"] .timeline li::before { left: auto; right: -7px; }
[dir="rtl"] .msg-own { align-self: flex-start; }
[dir="rtl"] .msg { align-self: flex-end; }
[dir="rtl"] .switch span { left: auto; right: 2px; transition: right .2s; }
[dir="rtl"] .switch.on span { right: 22px; }

/* ---------- inventory RTL ---------- */
[dir="rtl"] .inv-card-name { direction: ltr; text-align: left; }
[dir="rtl"] .inv-modal { text-align: right; }
[dir="rtl"] .user-menu-panel { right: auto; left: 0; }
[dir="rtl"] .user-menu-info { align-items: flex-end; }
[dir="rtl"] .user-menu-trigger { flex-direction: row-reverse; }
[dir="rtl"] .user-menu-status { margin-left: 0; margin-right: auto; }
[dir="rtl"] .tk-preview { direction: rtl; }
[dir="rtl"] .tk-detail-layout { direction: rtl; }
[dir="rtl"] .tk-msg-content { padding-left: 16px; padding-right: 16px; }
[dir="rtl"] .tk-msg-meta { flex-direction: row-reverse; }
[dir="rtl"] .tk-sidebar-value { text-align: left; }

/* ---------- whatsapp connection ---------- */
.whatsapp-status {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px;
  border-radius: 12px;
}
.whatsapp-connected {
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
}
.whatsapp-status-icon {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  border-radius: 12px;
  background: #25d366;
  color: #fff;
  line-height: 0;
}
.whatsapp-status-icon svg { width: 22px; height: 22px; }
.whatsapp-status strong { display: block; font-size: 14px; color: #065f46; }
.whatsapp-status .muted { font-size: 12px; }
.whatsapp-status .btn { margin-inline-start: auto; }
.whatsapp-demo-notice { background:#fef3c7; border:1px solid #f59e0b; border-radius:8px; padding:12px 16px; margin-bottom:16px; font-size:13px; line-height:1.6; }

/* ---------- automation center ---------- */
.auto-tabs { display:flex; gap:4px; border-bottom:2px solid var(--c-border,#e5e7eb); margin-bottom:24px; }
.auto-tab { padding:10px 20px; border:none; background:none; cursor:pointer; font-size:14px; font-weight:500; color:var(--c-muted,#6b7280); border-bottom:2px solid transparent; margin-bottom:-2px; transition:all .15s; }
.auto-tab:hover { color:var(--c-text,#111827); }
.auto-tab-active { color:var(--c-accent,#2563eb); border-bottom-color:var(--c-accent,#2563eb); }
.auto-tab-count { background:var(--c-bg-soft,#f3f4f6); border-radius:10px; padding:1px 8px; font-size:11px; margin-inline-start:6px; }
.auto-panel { min-height:200px; }
.auto-empty { text-align:center; padding:60px 20px; }
.auto-empty-icon { font-size:48px; margin-bottom:12px; }
.auto-empty h3 { margin:8px 0 4px; }
.auto-empty p { color:var(--c-muted,#6b7280); margin-bottom:16px; }
.auto-card-grid { display:grid; grid-template-columns:repeat(auto-fill,minmax(340px,1fr)); gap:16px; }
.auto-card { border:1px solid var(--c-border,#e5e7eb); border-radius:12px; padding:16px; background:var(--c-bg,#fff); }
.auto-card-head { display:flex; gap:12px; align-items:flex-start; }
.auto-card-icon { font-size:28px; flex-shrink:0; }
.auto-card-head h3 { margin:0; font-size:15px; }
.auto-card-head small { font-size:12px; }
.auto-card-status { margin-inline-start:auto; flex-shrink:0; }
.auto-card-stats { display:flex; gap:16px; flex-wrap:wrap; margin-top:12px; font-size:13px; color:var(--c-muted,#6b7280); }
.auto-card-actions { display:flex; gap:6px; flex-wrap:wrap; margin-top:12px; }
.auto-row-actions { display:flex; gap:4px; flex-wrap:wrap; }
.auto-log-modal { position:fixed; inset:0; background:rgba(0,0,0,.4); z-index:1000; display:grid; place-items:center; }
.auto-log-modal[hidden] { display:none; }
.auto-log-modal-content { background:var(--c-bg,#fff); border-radius:12px; width:90%; max-width:700px; max-height:80vh; overflow:auto; padding:24px; }
.auto-log-modal-head { display:flex; justify-content:space-between; align-items:center; margin-bottom:16px; }
.auto-form-card { max-width:800px; }
.auto-form-footer { display:flex; gap:8px; margin-top:24px; padding-top:16px; border-top:1px solid var(--c-border,#e5e7eb); }
.form-row { display:flex; gap:16px; }
.form-group-half { flex:1; }
.auto-cond-row, .auto-act-row { display:flex; gap:8px; align-items:center; margin-bottom:8px; }
.auto-cond-row .form-control, .auto-act-row .form-control { flex:1; min-width:0; }
.auto-act-params { display:flex; gap:8px; flex:1; min-width:0; }
.auto-act-params .form-control { flex:1; min-width:0; }

/* ---------- automation canvas ---------- */
.auto-canvas-page { overflow:hidden; height:100vh; margin:0; padding:0; position:fixed; top:0; left:0; right:0; bottom:0; z-index:100; background:var(--c-bg,#fff); }
.auto-canvas-page .site-header { display:none; }
.auto-canvas-page .layout { padding:0; margin:0; }
.auto-canvas-layout { display:flex; height:100vh; width:100%; transition:outline .15s; outline:2px solid transparent; }
.auto-canvas-layout.canvas-focused { outline:2px solid var(--c-accent,#2563eb); outline-offset:-2px; }
.auto-canvas-main { flex:1; display:flex; flex-direction:column; overflow:hidden; min-width:0; }
.auto-canvas-main--full { flex:1; }
.auto-canvas-toolbar { display:flex; align-items:center; gap:12px; padding:8px 16px; border-bottom:1px solid var(--c-border,#e5e7eb); font-size:13px; background:var(--c-bg,#fff); flex-shrink:0; }
.auto-toolbar-toggle { display:flex; align-items:center; gap:6px; }
.auto-canvas-container { flex:1; overflow:hidden; background:var(--c-bg-soft,#f9fafb); background-image:radial-gradient(circle,#e5e7eb 1px,transparent 1px); background-size:20px 20px; user-select:none; cursor:default; min-height:0; }
.auto-canvas-container[data-panning="1"] { cursor:grabbing !important; }
.auto-canvas-svg { width:100%; height:100%; display:block; cursor:inherit; }
.auto-marquee { fill:rgba(59,130,246,.08); stroke:rgba(59,130,246,.5); stroke-width:1; stroke-dasharray:4 2; pointer-events:none; }
.auto-node-rect { fill:var(--c-bg,#fff); stroke:var(--c-border,#d1d5db); stroke-width:1.5; transition:stroke .15s; }
.auto-node-trigger .auto-node-rect { stroke:#3b82f6; }
.auto-node-condition .auto-node-rect { stroke:#f59e0b; }
.auto-node-action .auto-node-rect { stroke:#10b981; }
.auto-node-selected .auto-node-rect { stroke:var(--c-accent,#2563eb); stroke-width:2.5; filter:drop-shadow(0 0 4px rgba(37,99,235,.3)); }
.auto-port { fill:var(--c-bg,#fff); stroke:var(--c-border,#9ca3af); stroke-width:1.5; cursor:crosshair; transition:all .15s; }
.auto-port:hover { fill:var(--c-accent,#2563eb); stroke:var(--c-accent,#2563eb); }
.auto-edge { transition:stroke .15s, stroke-width .15s; }
.auto-edge:hover { stroke:var(--c-accent,#2563eb); stroke-width:3; }
.auto-edge-preview { pointer-events:none; opacity:.85; }
.auto-canvas-config { width:280px; border-inline-start:1px solid var(--c-border,#e5e7eb); background:var(--c-bg,#fff); display:flex; flex-direction:column; overflow-y:auto; flex-shrink:0; }
.auto-canvas-config[hidden] { display:none; }
.auto-config-head { display:flex; justify-content:space-between; align-items:center; padding:12px 16px; border-bottom:1px solid var(--c-border,#e5e7eb); }
.auto-config-head h4 { margin:0; font-size:14px; }
.auto-config-head .form-group, #config-body { padding:0 16px; }
#config-body { flex:1; overflow-y:auto; padding:12px 16px; }
.auto-config-footer { padding:12px 16px; border-top:1px solid var(--c-border,#e5e7eb); }

/* ---------- canvas context menu ---------- */
.auto-ctx-menu { position:fixed; z-index:9999; background:var(--c-bg,#fff); border:1px solid var(--c-border,#e5e7eb); border-radius:10px; box-shadow:0 8px 30px rgba(0,0,0,.12); min-width:220px; max-width:300px; max-height:400px; overflow:hidden; display:flex; flex-direction:column; }
.auto-ctx-menu[hidden] { display:none; }
.auto-ctx-search { border:none; border-bottom:1px solid var(--c-border,#e5e7eb); padding:10px 14px; font-size:13px; outline:none; background:transparent; width:100%; box-sizing:border-box; }
.auto-ctx-search:focus { background:var(--c-bg-soft,#f9fafb); }
.auto-ctx-list { overflow-y:auto; padding:4px 0; }
.auto-ctx-cat { padding:8px 14px 4px; font-size:10px; text-transform:uppercase; letter-spacing:.8px; color:var(--c-muted,#6b7280); font-weight:600; }
.auto-ctx-item { display:flex; align-items:center; gap:10px; padding:8px 14px; font-size:13px; cursor:pointer; transition:background .1s; }
.auto-ctx-item:hover { background:var(--c-bg-soft,#f3f4f6); }
.auto-ctx-item .auto-ctx-icon { font-size:16px; flex-shrink:0; width:22px; text-align:center; }
.auto-ctx-danger { color:#dc2626; }
.auto-ctx-danger:hover { background:#fef2f2; }

/* ---------- automation badge colors ---------- */
.badge-success { background:#ecfdf5; color:#065f46; }
.badge-running { background:#eff6ff; color:#1e40af; }
.badge-failed { background:#fef2f2; color:#991b1b; }
.badge-partial { background:#fffbeb; color:#92400e; }
.badge-pass { background:#ecfdf5; color:#065f46; }
.badge-live { background:#ecfdf5; color:#065f46; }
.badge-once { background:#fffbeb; color:#92400e; }
.auto-card-status { display:flex; gap:6px; align-items:center; }
