@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=Montserrat:wght@400;500;600;700&display=swap');

/* ============================================================== */
/* RESET + VARIABLES                                                */
/* ============================================================== */
:root {
  --bg: #eeeef0;
  --bg-soft: #f9f9f9;
  --surface: #f9f9f9;
  --border: #e5e7eb;
  --border-strong: #d1d5db;
  --text: #111827;
  --text-soft: #4b5563;
  --text-muted: #9ca3af;
  --primary: #dc6326;
  --primary-soft: #f6e6dd;
  --primary-strong: #b75422;
  --danger: #dc2626;
  --danger-soft: #fee2e2;
  --warning: #d97706;
  --warning-soft: #fef3c7;
  --info: #2563eb;
  --info-soft: #dbeafe;
  --sidebar-w: 240px;
  --ai-panel-w: 380px;
  --ai-header-h: 57px;
  --topbar-h: 70px;
  --radius: 12px;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .05);
  --shadow: 0 4px 16px rgba(0, 0, 0, .06);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, .10);
}

* {
  box-sizing: border-box;
  font-family: "Inter", "Montserrat", sans-serif;
}

*:focus {
  outline: 0 !important;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  padding: 0;
  background-color: var(--bg);
  color: var(--text);
  overflow: hidden;
  font-size: 14px;
}

.close {
  display: none !important;
}

button {
  font-family: inherit;
  cursor: pointer;
}

/* ============================================================== */
/* BURGER                                                           */
/* ============================================================== */
button#burger {
  display: none;
  z-index: 9999997;
  position: fixed;
  top: 18px;
  left: 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  width: 40px;
  height: 40px;
  font-size: 18px;
  box-shadow: var(--shadow-sm);
}

/* ============================================================== */
/* SIDEBAR                                                          */
/* ============================================================== */
#sidebar_bg {
  position: fixed;
  inset: 0;
  background-color: rgba(0, 0, 0, .45);
  z-index: 9999998;
}

#sidebar_bg.close {
  display: none;
}

aside#sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-w);
  height: 100vh;
  background-color: var(--bg);
  border-right: 1px solid var(--border);
  padding: 16px 14px 16px 14px;
  display: flex;
  flex-direction: column;
  transition: transform .35s ease;
  z-index: 9999999;
}

aside#sidebar .brand {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6px 0 14px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 10px;
}

aside#sidebar .brand img {
  width: 110px;
}

aside#sidebar .nav {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding-right: 4px;
}

aside#sidebar .nav::-webkit-scrollbar {
  width: 6px;
}

aside#sidebar .nav::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 6px;
}

aside#sidebar h4 {
  font-size: 11px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 700;
  margin: 14px 8px 6px 8px;
}

aside#sidebar .nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 14px;
  color: var(--text-soft);
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  transition: all .15s ease;
  user-select: none;
}

aside#sidebar .nav-item i {
  width: 18px;
  text-align: center;
  font-size: 14px;
  color: var(--text-muted);
}

aside#sidebar .nav-item:hover {
  background-color: var(--bg-soft);
  color: var(--text);
}

aside#sidebar .nav-item.active:not(.brand) {
  background-color: var(--primary-strong);
  color: white;
}

aside#sidebar .nav-item.active i {
  color: white;
}

aside#sidebar .nav-item.subtle {
  color: var(--text-muted);
  font-size: 13px;
}

aside#sidebar .nav-item.nav-sub {
  font-size: 13px;
  padding-left: 28px;
}

#chats {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: 4px;
  /* max-height: 220px; */
  overflow-y: auto;
}

#chats::-webkit-scrollbar {
  width: 6px;
}

#chats::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 6px;
}

#chats .chat_sidebar {
  font-size: 13px;
  color: var(--text-soft);
  padding: 8px 12px 8px 40px;
  border-radius: 8px;
  cursor: pointer;
  /* overflow: hidden; */
  text-overflow: ellipsis;
  white-space: nowrap;
}

#chats .chat_sidebar:hover {
  background: var(--bg-soft);
}

#chats .chat_sidebar.active {
  background: var(--primary-soft);
  color: var(--primary-strong);
  font-weight: 600;
}

#profile.nav-profile {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: 12px;
  cursor: pointer;
  transition: background .2s;
  border-top: 1px solid var(--border);
  margin-top: 8px;
}

#profile.nav-profile:hover {
  background: var(--bg-soft);
}

#profile .avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
  flex-shrink: 0;
}

#profile .info {
  min-width: 0;
  flex: 1;
}

#profile .info>div {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#profile .info>small {
  color: var(--text-muted);
  font-size: 11px;
}

/* ============================================================== */
/* MAIN APP                                                         */
/* ============================================================== */
main#app {
  position: fixed;
  top: 0;
  left: var(--sidebar-w);
  right: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: right .3s ease;
}

body.ai-open main#app {
  right: var(--ai-panel-w);
}

header#topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 28px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  min-height: var(--topbar-h);
}

header#topbar .left h1 {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
}

header#topbar .left p {
  margin: 2px 0 0;
  font-size: 13px;
  color: var(--text-muted);
}

header#topbar .right {
  display: flex;
  gap: 10px;
}

section#page_container {
  flex: 1;
  overflow-y: auto;
  padding: 24px 28px 40px;
  background-color: var(--bg);
}

section#page_container::-webkit-scrollbar {
  width: 8px;
}

section#page_container::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 8px;
}

/* ============================================================== */
/* BUTTONS                                                          */
/* ============================================================== */
.btn {
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 9px 16px;
  font-size: 13px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all .15s ease;
  background: var(--surface);
  color: var(--text);
}

.btn.primary {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.btn.primary:hover {
  background: var(--primary-strong);
  border-color: var(--primary-strong);
}

.btn.ghost {
  background: transparent;
  /* border: 1px solid var(--border-strong); */
  color: var(--text-soft);
}

.btn.ghost:hover {
  background: var(--bg-soft);
  color: var(--text);
}

.btn.danger {
  background: var(--danger);
  color: #fff;
  border-color: var(--danger);
}

.btn.danger.ghost {
  background: transparent;
  color: var(--danger);
  border-color: var(--danger-soft);
}

.btn.danger.ghost:hover {
  background: var(--danger-soft);
}

.btn.sm {
  padding: 5px 10px;
  font-size: 12px;
  border-radius: 8px;
}

.btn:disabled {
  opacity: .5;
  cursor: not-allowed;
}

.icon-btn {
  background: transparent;
  border: none;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-soft);
  font-size: 14px;
}

.icon-btn:hover {
  background: var(--bg-soft);
  color: var(--text);
}

/* ============================================================== */
/* CARDS / KPI                                                      */
/* ============================================================== */
.card {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 20px;
  box-shadow: var(--shadow-sm);
}

.card .card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  gap: 12px;
}

.card .card-head h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
}

.card .card-head .meta {
  font-size: 12px;
  color: var(--text-muted);
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.kpi-grid-3 {
  grid-template-columns: repeat(3, 1fr);
}

.kpi {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 18px 20px;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  box-shadow: var(--shadow-sm);
}

.kpi .icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}

.kpi .icon.green {
  background: var(--primary-soft);
  color: var(--primary);
}

.kpi .icon.blue {
  background: var(--info-soft);
  color: var(--info);
}

.kpi .icon.amber {
  background: var(--warning-soft);
  color: var(--warning);
}

.kpi .icon.red {
  background: var(--danger-soft);
  color: var(--danger);
}

.kpi .body {
  flex: 1;
  min-width: 0;
}

.kpi .label {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: .05em;
}

.kpi .value {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  margin: 4px 0 0;
}

.kpi .sub {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

.grid-2 {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 16px;
}

@media (max-width: 1100px) {
  .grid-2 {
    grid-template-columns: 1fr;
  }
}

/* ============================================================== */
/* TABLES                                                           */
/* ============================================================== */
.table-wrap {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.table-wrap .table-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
  gap: 10px;
}

.table-wrap .table-head h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
}

.table-wrap .table-head .actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.table-wrap .table-head input[type="search"],
.table-wrap .table-head select {
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  padding: 7px 12px;
  font-size: 13px;
  background: var(--bg-soft);
  min-width: 200px;
}

table.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

table.data-table th,
table.data-table td {
  text-align: left;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

table.data-table th {
  background: var(--bg-soft);
  color: var(--text-soft);
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .04em;
  white-space: nowrap;
}

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

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

.catalog-summary {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 20px 0;
  color: var(--text-soft);
  font-size: 12px;
  flex-wrap: wrap;
}

.category-path {
  color: var(--text-soft);
  font-size: 12px;
  line-height: 1.5;
}

.table-pagination {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 20px;
  border-top: 1px solid var(--border);
  background: var(--surface);
  flex-wrap: wrap;
}

.table-pagination span {
  color: var(--text-soft);
  font-size: 12px;
}

.thumb {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  background: var(--bg-soft);
  object-fit: cover;
  border: 1px solid var(--border);
}

.row-actions {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
}

.badge.green {
  background: var(--primary-soft);
  color: var(--primary-strong);
}

.badge.red {
  background: var(--danger-soft);
  color: var(--danger);
}

.badge.amber {
  background: var(--warning-soft);
  color: var(--warning);
}

.badge.blue {
  background: var(--info-soft);
  color: var(--info);
}

.badge.gray {
  background: var(--bg-soft);
  color: var(--text-soft);
  border: 1px solid var(--border);
}

.badge.orange {
  background: #fff3e0;
  color: #e65100;
}

.analysis-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 12px;
  margin-bottom: 16px;
  font-size: 13px;
}

.analysis-banner > i:first-child {
  font-size: 18px;
  flex-shrink: 0;
}

.analysis-banner strong {
  display: block;
  font-size: 14px;
  margin-bottom: 2px;
}

.analysis-banner div > div {
  color: var(--text-muted);
  font-size: 12px;
}

.analysis-banner.analyzing {
  background: #fff8e1;
  color: #8a6d00;
  border: 1px solid #ffe082;
}

.analysis-banner.ready {
  background: #e8f5e9;
  color: #1b5e20;
  border: 1px solid #a5d6a7;
  cursor: pointer;
  transition: background 0.15s ease;
}

.analysis-banner.ready:hover {
  background: #dcedc8;
}

.similar-question-box {
  padding: 12px 14px;
  background: #f3f6ff;
  border: 1px solid #c5d4f7;
  border-radius: 10px;
}

.similar-question-box.similar-question-empty {
  background: var(--bg-soft);
  border-color: var(--border);
}

.similar-question-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}

.similar-question-head strong {
  font-size: 13px;
  color: var(--text);
}

.similar-question-meta {
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.similar-question-block {
  padding: 10px;
  background: rgba(255, 255, 255, 0.7);
  border-radius: 8px;
  margin-bottom: 8px;
}

.similar-question-block.answer {
  border-left: 3px solid var(--primary);
}

.similar-question-label {
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.similar-question-text {
  font-size: 13px;
  line-height: 1.5;
  color: var(--text);
}

.similar-question-loading {
  font-size: 12px;
  color: var(--text-muted);
}

.similar-question-empty p {
  margin: 0;
  font-size: 12px;
  color: var(--text-muted);
}

.similar-question-box .btn {
  margin-top: 4px;
}

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

.empty i {
  font-size: 32px;
  margin-bottom: 10px;
  display: block;
  opacity: .6;
}

.store-disconnected .btn {
  margin-top: 18px;
}

/* ============================================================== */
/* FORMS                                                            */
/* ============================================================== */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
}

.form-grid.cols-1 {
  grid-template-columns: 1fr;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-soft);
}

.field input,
.field select,
.field textarea {
  border: 1px solid var(--border-strong);
  border-radius: 9px;
  padding: 9px 12px;
  font-size: 13px;
  background: var(--surface);
  color: var(--text);
  transition: border-color .15s;
  font-family: inherit;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--primary);
}

.field textarea {
  min-height: 80px;
  resize: vertical;
}

.field .hint {
  font-size: 11px;
  color: var(--text-muted);
}

/* Ürün V2 form */
.product-v2-info {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 20px;
  margin-bottom: 16px;
  padding: 12px 16px;
  background: var(--surface-raised, var(--surface));
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 12px;
  color: var(--text-soft);
}

.product-v2-info-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

.product-v2-info-item i {
  color: var(--primary);
  opacity: .8;
}

.product-actions {
  flex-wrap: wrap;
}

.product-meta-line {
  font-size: 11px;
  color: var(--text-muted);
}

.product-code {
  font-size: 11px;
  background: var(--surface-raised, rgba(0, 0, 0, .04));
  padding: 2px 6px;
  border-radius: 4px;
}

.product-form-alert {
  padding: 10px 14px;
  border-radius: 9px;
  font-size: 12px;
  line-height: 1.5;
  margin-bottom: 14px;
  background: rgba(245, 158, 11, .1);
  border: 1px solid rgba(245, 158, 11, .25);
  color: var(--text-soft);
}

.product-form-alert.info {
  background: rgba(59, 130, 246, .08);
  border-color: rgba(59, 130, 246, .2);
}

.product-form-alert i {
  margin-right: 6px;
}

.product-form-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0;
}

.product-form-tabs button {
  border: none;
  background: none;
  padding: 8px 14px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  font-family: inherit;
}

.product-form-tabs button.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

.product-form-panel {
  display: none;
}

.product-form-panel.active {
  display: block;
}

.product-table code {
  font-family: ui-monospace, monospace;
}

/* ============================================================== */
/* MODAL                                                            */
/* ============================================================== */
#modal_bg {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .45);
  z-index: 9999999990;
}

#modal {
  position: fixed;
  inset: 0;
  z-index: 9999999991;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-card {
  background: var(--surface);
  border-radius: 16px;
  width: min(640px, calc(100vw - 40px));
  max-height: calc(100vh - 80px);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
}

.modal-card.modal-wide {
  width: min(820px, calc(100vw - 40px));
}

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

.modal-head h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
}

#modal_body {
  padding: 20px;
  overflow-y: auto;
}

.modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 20px;
  border-top: 1px solid var(--border);
}

/* ============================================================== */
/* TOAST                                                            */
/* ============================================================== */
#toast_wrap {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 999999999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.toast {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-left: 4px solid var(--primary);
  border-radius: 10px;
  padding: 12px 16px;
  box-shadow: var(--shadow-lg);
  font-size: 13px;
  min-width: 260px;
  display: flex;
  align-items: center;
  gap: 10px;
  pointer-events: auto;
  animation: toastIn .25s ease;
}

.toast.danger {
  border-left-color: var(--danger);
}

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

@keyframes toastIn {
  from {
    transform: translateY(20px);
    opacity: 0;
  }

  to {
    transform: none;
    opacity: 1;
  }
}

/* ============================================================== */
/* CHANGES BANNER + POPUP                                           */
/* ============================================================== */
#changes {
  display: none;
  position: fixed;
  top: 0;
  left: var(--sidebar-w);
  right: 0;
  background-color: #fef3c7;
  border-bottom: 1px solid #fcd34d;
  color: #78350f;
  font-size: 13px;
  padding: 8px 24px;
  z-index: 999;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

body.ai-open #changes {
  right: var(--ai-panel-w);
}

#changes.show {
  display: flex;
}

#changes button {
  border: none;
  background: #78350f;
  color: #fff;
  padding: 5px 12px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
}

#changes button:hover {
  background: #5a2a08;
}

body.changes-banner-visible main#app {
  padding-top: 0;
}

#popup_changes {
  position: fixed;
  inset: 0;
  background: var(--bg);
  z-index: 999999999;
  overflow-y: auto;
}

#popup_changes.collapse {
  display: none;
}

#close_popup {
  position: fixed;
  right: 30px;
  top: 22px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 18px;
  width: 40px;
  height: 40px;
  z-index: 10;
}

#popup_changes>.container {
  width: min(900px, calc(100vw - 60px));
  margin: 40px auto;
  padding-bottom: 80px;
}

#popup_changes .header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 28px;
}

#popup_changes .header h4 {
  margin: 0;
  font-size: 26px;
  font-weight: 700;
  color: var(--text);
}

#save_changes {
  background: var(--primary);
  color: #fff;
  border: none;
  padding: 10px 18px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
}

#save_changes:hover {
  background: var(--primary-strong);
}

#save_changes:hover {
  background: var(--primary-strong);
}

#save_changes:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.publish-validation-panel {
  margin-bottom: 20px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  padding: 16px 18px;
}

.publish-validation-panel.is-loading {
  color: var(--text-muted);
  font-size: 13px;
}

.publish-validation-panel.is-error {
  border-color: #f3b4b4;
  background: #fff6f6;
}

.publish-validation-panel.is-warning {
  border-color: #f0d58a;
  background: #fffbea;
}

.publish-validation-panel.is-success {
  border-color: #a8ddb0;
  background: #f4fff6;
}

.publish-validation-panel h5 {
  margin: 0 0 8px;
  font-size: 14px;
  font-weight: 700;
}

.publish-validation-panel p {
  margin: 0 0 10px;
  font-size: 13px;
  line-height: 1.5;
}

.publish-validation-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}

.publish-validation-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.04);
  font-size: 12px;
  font-weight: 600;
}

.publish-validation-issues {
  margin: 0;
  padding-left: 18px;
  font-size: 13px;
  line-height: 1.55;
}

.publish-validation-issues li+li {
  margin-top: 6px;
}

#changes_list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.change-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  cursor: pointer;
  transition: all .2s;
  position: relative;
}

.change-card:not(.empty-state):hover {
  box-shadow: var(--shadow);
  transform: translateY(-1px);
}

.change-card.empty-state {
  cursor: default;
}

.change-card-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
  padding-right: 110px;
}

.change-card-summary {
  font-size: 13px;
  color: var(--text-muted);
}

.change-card button.cancel {
  position: absolute;
  top: 35px;
  right: 16px;
  background: transparent;
  color: var(--danger);
  border: 1px solid var(--danger-soft);
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all .15s;
}

.change-card button.cancel:hover {
  background: var(--danger-soft);
}

.change-card button.cancel:disabled {
  opacity: .5;
  cursor: not-allowed;
}

/* ============================================================== */
/* CHANGES PUBLISHING LOADER                                        */
/* ============================================================== */
#changes-loading {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  z-index: 9999999999;
  align-items: center;
  justify-content: center;
}

#changes-loading.show {
  display: flex;
}

#changes-loading .loader-box {
  background: var(--surface);
  border-radius: 18px;
  padding: 30px 40px;
  text-align: center;
  min-width: 320px;
  box-shadow: var(--shadow-lg);
}

#changes-loading h4 {
  margin: 18px 0 6px;
  font-size: 16px;
  color: var(--text);
}

#changes-loading p {
  margin: 0;
  font-size: 13px;
  color: var(--text-muted);
}

#changes-loading .spinner {
  width: 44px;
  height: 44px;
  margin: 0 auto;
  border: 3px solid var(--bg-soft);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.operation-kpis {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 18px;
}

.operation-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.operation-toolbar-text {
  margin: 0;
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.6;
}

.operation-section {
  margin-bottom: 18px;
}

.operation-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.operation-card {
  width: 100%;
  text-align: left;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 14px;
  padding: 16px 18px;
  cursor: pointer;
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}

.operation-card:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow);
  border-color: color-mix(in srgb, var(--primary) 35%, var(--border));
}

.operation-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 8px;
}

.operation-card-type {
  color: var(--text-muted);
  font-size: 12px;
  margin-bottom: 4px;
}

.operation-card-title {
  color: var(--text);
  font-size: 15px;
  font-weight: 700;
}

.operation-card-desc {
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.6;
  margin-bottom: 12px;
}

.operation-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 18px;
  color: var(--text-muted);
  font-size: 12px;
}

.operation-card-meta span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.operation-empty {
  min-height: 140px;
}

.operation-detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.operation-detail-row {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
  background: var(--bg-soft);
}

.operation-detail-row span {
  display: block;
  color: var(--text-muted);
  font-size: 12px;
  margin-bottom: 6px;
}

.operation-detail-row strong {
  color: var(--text);
  font-size: 14px;
}

.operation-detail-block {
  margin-top: 14px;
}

.operation-detail-block h4 {
  margin: 0 0 8px;
  color: var(--text);
  font-size: 14px;
}

.operation-detail-block p {
  margin: 0;
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.6;
}

.operation-chip-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.operation-code-chip {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 7px 10px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

.operation-warning-list {
  margin: 0;
  padding-left: 18px;
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.7;
}

@media (max-width: 900px) {

  .operation-kpis,
  .operation-detail-grid {
    grid-template-columns: 1fr;
  }

  .operation-toolbar {
    flex-direction: column;
    align-items: stretch;
  }
}

.changes-popup-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .45);
  z-index: 9999999999;
  align-items: center;
  justify-content: center;
}

.changes-popup {
  width: min(900px, calc(100vw - 32px));
  max-height: calc(100vh - 48px);
  overflow-y: auto;
  background: var(--surface);
  border-radius: 16px;
  padding: 20px;
}

.changes-popup-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

#changes_popup_title {
  font-size: 20px;
  margin: 0;
  color: var(--text);
}

#changes_popup_close {
  border: none;
  background: var(--bg-soft);
  width: 40px;
  height: 40px;
  border-radius: 10px;
  font-size: 22px;
}

.popup-object-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.popup-object-card {
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px;
  display: flex;
  gap: 14px;
}

.popup-object-image {
  width: 84px;
  height: 84px;
  border-radius: 10px;
  overflow: hidden;
  background: var(--bg-soft);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.popup-object-image img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.popup-object-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 2px;
}

.popup-object-type {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.popup-change-list {
  margin: 0;
  padding-left: 18px;
  color: var(--text-soft);
  font-size: 13px;
}

.popup-change-list li+li {
  margin-top: 4px;
}

/* ============================================================== */
/* AI PANEL                                                         */
/* ============================================================== */
aside#ai_panel {
  position: fixed;
  top: 0;
  right: 0;
  width: var(--ai-panel-w);
  height: var(--ai-header-h);
  background: var(--bg);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 999;
  transition: transform .3s ease;
  box-shadow: none;
  overflow: visible;
}

aside#ai_panel.close {
  transform: translateX(100%);
  display: flex !important;
}

.ai-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px;
  /* border-bottom: 1px solid var(--border); */
}

.ai-header strong {
  font-size: 15px;
}

.ai-header small {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
}

.ai-history {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.ai-welcome {
  margin: auto;
  text-align: center;
  opacity: .5;
}

.ai-welcome img.logo {
  width: 180px;
}

.ai-history .message {
  font-size: 14px;
  padding: 10px 14px;
  border-radius: 12px;
  max-width: 90%;
  line-height: 1.5;
  word-wrap: break-word;
}

.ai-history .message.user {
  background: var(--primary-soft);
  color: var(--primary-strong);
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}

.ai-history .message.assistant {
  background: var(--bg-soft);
  color: var(--text);
  align-self: flex-start;
  border-bottom-left-radius: 4px;
}

.ai-history .message.assistant.assistant-composite,
.chat-msg.assistant.assistant-composite {
  max-width: min(92%, 720px);
}

.assistant-stream {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
}

.process-card-inline {
  margin: 2px 0;
}

.process-card-inline .process-card {
  max-width: 100%;
}

.stream-live,
.chat-msg .stream-live,
.stream-segment-md-live {
  display: block;
  white-space: pre-wrap;
  word-break: break-word;
  min-height: 1.2em;
}

.assistant-stream>.stream-live:empty {
  display: none;
  min-height: 0;
  margin: 0;
  padding: 0;
}

.stream-segment-md-live {
  white-space: normal;
}

/* Chat markdown (assistant mesajları) */
.chat-markdown {
  font-size: 14px;
  line-height: 1.55;
  word-break: break-word;
}

.chat-markdown> :first-child {
  margin-top: 0;
}

.chat-markdown> :last-child {
  margin-bottom: 0;
}

.chat-markdown p {
  margin: 0 0 0.65em;
}

.chat-markdown h1,
.chat-markdown h2,
.chat-markdown h3,
.chat-markdown h4 {
  margin: 0.85em 0 0.4em;
  font-weight: 700;
  line-height: 1.3;
  color: var(--text);
}

.chat-markdown h1 {
  font-size: 1.35em;
}

.chat-markdown h2 {
  font-size: 1.2em;
}

.chat-markdown h3 {
  font-size: 1.08em;
}

.chat-markdown ul,
.chat-markdown ol {
  margin: 0.35em 0 0.65em;
  padding-left: 1.35em;
}

.chat-markdown li {
  margin: 0.2em 0;
}

.chat-markdown li>p {
  margin: 0;
}

.chat-markdown strong {
  font-weight: 700;
  color: var(--text);
}

.chat-markdown em {
  font-style: italic;
}

.chat-markdown code {
  font-family: ui-monospace, Consolas, monospace;
  font-size: 0.9em;
  background: rgba(0, 0, 0, 0.06);
  padding: 0.12em 0.35em;
  border-radius: 4px;
}

.chat-markdown pre {
  margin: 0.5em 0 0.75em;
  padding: 12px 14px;
  background: #1e1e1e;
  color: #f3f3f3;
  border-radius: 8px;
  overflow-x: auto;
  font-size: 12px;
  line-height: 1.45;
}

.chat-markdown pre code {
  background: none;
  padding: 0;
  color: inherit;
  font-size: inherit;
}

.chat-markdown blockquote {
  margin: 0.5em 0;
  padding: 0.35em 0 0.35em 12px;
  border-left: 3px solid var(--primary);
  color: var(--text-muted);
}

.chat-markdown a {
  color: var(--primary-strong);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.chat-markdown a:hover {
  color: var(--primary);
}

.chat-markdown hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 0.75em 0;
}

.chat-markdown table {
  width: 100%;
  border-collapse: collapse;
  margin: 0.5em 0 0.75em;
  font-size: 13px;
}

.chat-markdown th,
.chat-markdown td {
  border: 1px solid var(--border);
  padding: 6px 10px;
  text-align: left;
}

.chat-markdown th {
  background: var(--primary-soft);
  font-weight: 600;
}

.assistant-stream .stream-segment-md .chat-markdown,
.assistant-stream .stream-segment-md-live .chat-markdown {
  width: 100%;
}

.ai-history .message.error {
  background: var(--danger-soft);
  color: var(--danger);
  align-self: flex-start;
}

.ai-history .message.process,
.chat-history .message.process {
  background: transparent;
  border: none;
  padding: 4px 0;
  max-width: 100%;
  font-style: normal;
  opacity: 1;
}

.process-card {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-soft);
  max-width: 320px;
  font-size: 13px;
  line-height: 1.35;
}

.process-card.running {
  border-color: var(--primary-soft);
  background: linear-gradient(135deg, var(--bg-soft) 0%, var(--primary-soft) 120%);
}

.process-card.done {
  /* border-color: #c8e6c9; */
  /* background: #f1f8f4; */
  border-color: transparent;
  background-color: transparent;
  padding: 0px 12px;
}

.process-icon-wrap {
  position: relative;
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
}

.process-icon-wrap .fa-database,
.process-icon-wrap .fa-search,
.process-icon-wrap .fa-chart-column,
.process-icon-wrap .fa-file-excel {
  font-size: 14px;
  opacity: 0.45;
}

.chat-chart-wrap {
  margin: 12px 0;
  max-width: 100%;
}

.chat-chart-host {
  position: relative;
  min-height: 200px;
  width: 100%;
  max-width: 560px;
}

.chat-chart-canvas-wrap {
  position: relative;
  width: 100%;
  height: min(320px, 50vh);
}

.chat-chart-canvas {
  width: 100% !important;
  height: 100% !important;
}

.chat-chart-loading,
.chat-chart-error,
.chat-chart-host-pending {
  font-size: 13px;
  color: var(--text-muted);
  padding: 24px;
  text-align: center;
  border: 1px dashed var(--border, #e5e7eb);
  border-radius: 10px;
}

.chat-graphic-wrap {
  margin: 12px 0;
  max-width: 100%;
}

.chat-graphic-img {
  display: block;
  max-width: 100%;
  height: auto;
  border-radius: 10px;
  border: 1px solid var(--border, #e5e7eb);
  background: #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.chat-graphic-img.chat-graphic-error {
  min-height: 80px;
  opacity: 0.5;
}

.chat-file-wrap {
  display: inline-block;
  margin: 8px 0;
}

.chat-file-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid var(--border, #e5e7eb);
  background: #f0fdf4;
  color: #166534;
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
  transition: background 0.15s ease, border-color 0.15s ease;
}

.chat-file-link:hover {
  background: #dcfce7;
  border-color: #86efac;
}

.chat-file-link.chat-file-error {
  background: #fef2f2;
  color: #991b1b;
  border-color: #fecaca;
}

.chat-file-link .fa-file-excel {
  font-size: 16px;
}

.chat-zoomable-img {
  cursor: zoom-in;
}

body.image-lightbox-open {
  overflow: hidden;
}

.image-lightbox {
  position: fixed;
  inset: 0;
  z-index: 99999992;
  display: flex;
  align-items: center;
  justify-content: center;
}

.image-lightbox.close {
  display: none;
}

.image-lightbox-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(10, 12, 18, 0.82);
  backdrop-filter: blur(4px);
}

.image-lightbox-shell {
  position: relative;
  z-index: 1;
  width: min(96vw, 1200px);
  height: min(92vh, 900px);
  display: flex;
  flex-direction: column;
  padding: 12px 12px 8px;
  box-sizing: border-box;
}

.image-lightbox-close {
  position: absolute;
  top: 0;
  right: 0;
  z-index: 3;
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.95);
  color: #1a1a1a;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.25);
  transition: background 0.15s, transform 0.15s;
}

.image-lightbox-close:hover {
  background: #fff;
  transform: scale(1.05);
}

.image-lightbox-toolbar {
  position: absolute;
  left: 50%;
  top: 0;
  transform: translateX(-50%);
  z-index: 3;
  display: flex;
  gap: 6px;
  padding: 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.image-lightbox-tool {
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: #333;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.image-lightbox-tool:hover {
  background: rgba(0, 0, 0, 0.06);
}

.image-lightbox-viewport {
  flex: 1;
  min-height: 0;
  margin-top: 44px;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.35);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: none;
  user-select: none;
}

.image-lightbox-viewport.can-pan {
  cursor: grab;
}

.image-lightbox-viewport.can-pan.is-dragging {
  cursor: grabbing;
}

.image-lightbox-img {
  max-width: none;
  max-height: none;
  transform-origin: center center;
  will-change: transform;
  pointer-events: none;
}

.image-lightbox-hint {
  margin: 8px 0 0;
  text-align: center;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.75);
}

.process-icon-wrap .fa-spinner,
.process-icon-wrap .process-check,
.process-card.done .process-check {
  position: absolute;
  right: -2px;
  bottom: -2px;
  font-size: 11px;
  background: #fff;
  border-radius: 50%;
  width: 16px;
  height: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}

.process-card.done .process-icon-wrap .fa-spinner {
  display: none;
}

.process-card.done .process-check {
  color: #2e7d32;
}

.process-card.done .process-icon-wrap .fa-database,
.process-card.done .process-icon-wrap .fa-search,
.process-card.done .process-icon-wrap .fa-chart-column,
.process-card.done .process-icon-wrap .fa-file-excel {
  opacity: 0.35;
}

.process-title {
  font-weight: 600;
  color: var(--text);
}

.process-sub {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

.process-dur {
  font-weight: 400;
  color: var(--text-muted);
}

.ai-history .message.data {
  background: transparent;
  color: transparent;
  background-image: linear-gradient(90deg, #888 0%, #888 40%, #fff 50%, #888 60%, #888 100%);
  background-size: 200% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  animation: textShimmer 2s infinite linear;
}

@keyframes textShimmer {
  0% {
    background-position: 200% 0;
  }

  100% {
    background-position: -200% 0;
  }
}

.ai-history .think {
  background: #f3f4f6;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.ai-history .product {
  display: inline-block;
  background: var(--primary-soft);
  color: var(--primary-strong);
  padding: 1px 8px;
  border-radius: 5px;
  font-weight: 600;
  cursor: pointer;
}

.ai-history .product:hover {
  background: var(--primary);
  color: #fff;
}

/* ---- Entity chips (chat rich tags) ---- */
.entity-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: min(340px, 100%);
  vertical-align: middle;
  margin: 0 2px;
  padding: 3px 10px 3px 4px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.3;
  cursor: default;
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.12s;
}

.entity-chip:hover {
  border-color: var(--primary);
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.15);
  transform: translateY(-1px);
}

.entity-chip-icon-wrap {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-soft);
}

.entity-chip-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.entity-chip-icon-fallback {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  color: var(--text-muted);
}

.entity-chip-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.entity-chip-meta {
  font-weight: 500;
  color: var(--text-muted);
  margin-left: 4px;
}

.entity-product {
  border-color: rgba(99, 102, 241, 0.25);
  background: linear-gradient(135deg, #eef2ff, #faf5ff);
}

.entity-product .entity-chip-icon-fallback {
  color: #6366f1;
  background: rgba(99, 102, 241, 0.12);
}

.entity-category {
  border-color: rgba(14, 165, 233, 0.25);
  background: linear-gradient(135deg, #ecfeff, #f0f9ff);
}

.entity-category .entity-chip-icon-fallback {
  color: #0284c7;
  background: rgba(14, 165, 233, 0.12);
}

.entity-brand {
  border-color: rgba(245, 158, 11, 0.25);
  background: linear-gradient(135deg, #fffbeb, #fef3c7);
}

.entity-brand .entity-chip-icon-fallback {
  color: #d97706;
  background: rgba(245, 158, 11, 0.12);
}

.entity-coupon {
  border-color: rgba(236, 72, 153, 0.25);
  background: linear-gradient(135deg, #fdf2f8, #fce7f3);
}

.entity-coupon .entity-chip-icon-fallback {
  color: #db2777;
  background: rgba(236, 72, 153, 0.12);
}

.entity-order {
  border-color: rgba(16, 185, 129, 0.25);
  background: linear-gradient(135deg, #ecfdf5, #d1fae5);
}

.entity-order .entity-chip-icon-fallback {
  color: #059669;
  background: rgba(16, 185, 129, 0.12);
}

.entity-unknown {
  border-style: dashed;
  opacity: 0.85;
}

.entity-popover {
  position: absolute;
  z-index: 1200;
  pointer-events: none;
  display: none;
  align-items: flex-start;
  gap: 12px;
  min-width: 240px;
  max-width: 320px;
  padding: 12px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: 0 12px 40px rgba(15, 23, 42, 0.18);
}

.entity-popover-media {
  width: 72px;
  height: 72px;
  border-radius: 12px;
  overflow: hidden;
  flex-shrink: 0;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  position: relative;
}

.entity-popover-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: none;
}

.entity-popover-icon-wrap {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--primary-soft), #fff);
}

.entity-popover-icon {
  font-size: 24px;
  color: var(--primary);
}

.entity-popover-type {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 2px;
}

.entity-popover-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.3;
  margin-bottom: 4px;
}

.entity-popover-meta {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.45;
}

.chat-msg .entity-chip,
.ai-history .entity-chip,
.message .entity-chip {
  font-size: 12px;
}

.ai-input {
  border-top: 1px solid var(--border);
  padding: 12px 14px;
  display: flex;
  gap: 8px;
  align-items: flex-end;
}

.ai-input textarea {
  flex: 1;
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  resize: none;
  padding: 10px 12px;
  font-size: 13px;
  font-family: inherit;
  background: var(--bg-soft);
  min-height: 44px;
  max-height: 140px;
}

.ai-input textarea:focus {
  background: var(--surface);
  border-color: var(--primary);
}

.ai-input button {
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 50%;
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
}

.ai-input button:hover {
  background: var(--primary-strong);
}

.ai-input button:disabled {
  background: var(--border-strong);
  cursor: not-allowed;
}

/* ============================================================== */
/* UNIFIED CHAT (tek DOM — merkez ↔ sağ panel)                      */
/* ============================================================== */
#unified_chat.unified-chat {
  display: flex;
  flex-direction: column;
  background: var(--bg);
  z-index: 60;
  transition: left .3s ease, right .3s ease, width .3s ease, top .3s ease, visibility .2s;
}

body[data-page="chat"] header#topbar {
  display: none;
}

body[data-page="chat"] #unified_chat {
  position: fixed;
  left: var(--sidebar-w);
  right: 0;
  top: 0;
  bottom: 0;
  width: 57.5% !important;
  margin-left: 15%;
}

body.ai-open:not([data-page="chat"]) #unified_chat {
  position: fixed;
  top: var(--ai-header-h);
  right: 0;
  width: var(--ai-panel-w);
  bottom: 0;
  z-index: 998;
  border-left: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
}

body:not([data-page="chat"]):not(.ai-open) #unified_chat {
  visibility: hidden;
  pointer-events: none;
}

body[data-page="chat"] #page_container {
  display: none;
}

.unified-chat .uc-chat-title {
  flex-shrink: 0;
  text-align: center;
  font-size: 15px;
  font-weight: 600;
  color: var(--text-muted);
  padding: 14px 16px 4px;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.unified-chat .uc-history {
  flex: 1;
  overflow-y: auto;
  padding: 16px 24px;
}

.unified-chat .uc-inner {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 100%;
}

.unified-chat .uc-welcome {
  margin: auto;
  text-align: center;
  opacity: .55;
  /* padding: 32px 16px; */
  margin-bottom: 0px;
}

.unified-chat .uc-welcome img {
  width: 110px;
  margin-bottom: 12px;
}

.unified-chat .uc-welcome p {
  font-size: 24px;
  margin: 0 0 8px;
  margin-bottom: 10px;
}

.unified-chat .uc-welcome-hint {
  display: block;
  font-size: 12px;
  opacity: .75;
  max-width: 360px;
  margin: 0 auto;
  line-height: 1.45;
}

body.ai-open:not([data-page="chat"]) .uc-welcome-hint {
  display: none;
}

.unified-chat .uc-composer {
  /* border-top: 1px solid var(--border); */
  padding: 12px 16px 14px;
  /* background: var(--surface); */
  margin-bottom: 30px;
  width: 700px;
  max-width: 100%;
  margin-left: calc(50% - 350px);
  box-sizing: border-box;
}

/* Sağ AI paneli (sohbet sayfası dışında) */
body.ai-open:not([data-page="chat"]) .unified-chat .uc-composer {
  width: 80%;
  margin-left: 10%;
}

body.ai-open:not([data-page="chat"]) .unified-chat .uc-welcome p {
  font-size: 19px;
  margin: 0 0 8px;
  margin-bottom: 20px;
}

/* Hoş geldin ekranı — henüz mesaj yok */
.unified-chat:not(:has(.uc-inner > .chat-msg)) .uc-composer {
  margin-bottom: 400px;
}

.unified-chat .uc-box {
  /* border: 1px solid var(--border-strong); */
  border-radius: 35px;
  padding: 10px 12px;
  background: var(--bg-soft);
  transition: border-color .15s, background .15s, box-shadow .15s;
}

/* Hoş geldin ekranı — henüz mesaj yok */
.unified-chat:not(:has(.uc-inner > .chat-msg)) .uc-box {
  box-shadow: 0px 0px 50px 5px #ffa25330;
}

.unified-chat .uc-box.drag-over {
  border-color: var(--primary);
  background: var(--primary-soft);
}

.unified-chat .composer-row {
  display: flex;
  gap: 8px;
  align-items: flex-end;
}

.unified-chat textarea {
  flex: 1;
  border: none;
  background: transparent;
  resize: none;
  padding: 8px 4px;
  font-size: 14px;
  font-family: inherit;
  /* min-height: 44px; */
  /* max-height: 160px; */
  line-height: 1.45;
  height: 40px;
  padding-left: 15px;
}

.unified-chat textarea:focus {
  outline: none;
}

.unified-chat .composer-row button {
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  cursor: pointer;
}

.unified-chat .composer-row button:hover {
  background: var(--primary-strong);
}

.unified-chat .composer-row button:disabled {
  background: var(--border-strong);
  cursor: not-allowed;
}

/* ============================================================== */
/* CHAT PAGE (full)                                                 */
/* ============================================================== */
.chat-page {
  display: flex;
  flex-direction: column;
  height: calc(100vh - var(--topbar-h) - 0px);
  margin: -24px -28px -40px;
  background: var(--surface);
}

/* Chat sayfasındayken topbar gizli (yukarıda); ai_toggle artık görünmez */

/* ============================================================== */
/* CONTEXT CHIPS (Cursor benzeri sürükle-bırak)                     */
/* ============================================================== */

/* Sürüklenebilir tablo satırı görsel ipucu */
table.data-table tbody tr[draggable="true"] {
  cursor: grab;
}

table.data-table tbody tr[draggable="true"]:active {
  cursor: grabbing;
}

table.data-table tbody tr.dragging {
  opacity: .45;
}

/* Composer içindeki chip şeridi */
.chip-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chip-strip:empty {
  display: none;
}

/* Tekil chip */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-soft);
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  padding: 4px 4px 4px 8px;
  font-size: 12px;
  color: var(--text);
  max-width: 220px;
  line-height: 1.2;
}

.chip i {
  font-size: 11px;
  color: var(--primary);
}

.chip .chip-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 160px;
}

.chip .chip-remove {
  background: transparent;
  border: none;
  width: 18px;
  height: 18px;
  border-radius: 4px;
  color: var(--text-muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  padding: 0;
}

.chip .chip-remove:hover {
  background: var(--danger-soft);
  color: var(--danger);
}

/* AI panel composer'ı dikey düzenle */
aside#ai_panel .ai-input {
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
}

aside#ai_panel .ai-input .composer-row {
  display: flex;
  gap: 8px;
  align-items: flex-end;
}

aside#ai_panel .ai-input.drag-over {
  background: var(--primary-soft);
  outline: 2px dashed var(--primary);
  outline-offset: -6px;
  border-radius: 8px;
}

/* Chat sayfası composer'ı */
.chat-page .composer .box {
  width: min(720px, 100%);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.chat-page .composer .composer-row {
  display: flex;
  gap: 10px;
  align-items: flex-end;
  width: 100%;
}

.chat-page .composer .box.drag-over {
  background: var(--primary-soft);
  outline: 2px dashed var(--primary);
  outline-offset: -6px;
  border-radius: 16px;
  padding: 6px;
}

/* Mesaj içinde gösterilen chip'ler */
.msg-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}

.msg-chips .chip {
  background: rgba(255, 255, 255, 0.6);
}

.chat-msg.user .msg-chips .chip,
.message.user .msg-chips .chip {
  background: rgba(255, 255, 255, 0.7);
  border-color: rgba(0, 0, 0, 0.08);
}

.msg-text {
  white-space: pre-wrap;
  word-wrap: break-word;
}

.chat-page .history {
  flex: 1;
  overflow-y: auto;
  padding: 24px 0;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.chat-page .history .inner {
  width: min(720px, calc(100% - 40px));
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.chat-page .composer {
  border-top: 1px solid var(--border);
  padding: 18px;
  display: flex;
  justify-content: center;
}

.chat-page .composer .box {
  width: min(720px, 100%);
  display: flex;
  gap: 10px;
  align-items: flex-end;
}

.chat-page .composer textarea {
  flex: 1;
  border: 1px solid var(--border-strong);
  border-radius: 16px;
  padding: 14px 18px;
  font-size: 15px;
  resize: none;
  background: var(--bg-soft);
  min-height: 54px;
  max-height: 200px;
  font-family: inherit;
}

.chat-page .composer textarea:focus {
  background: var(--surface);
  border-color: var(--primary);
}

.chat-page .composer button {
  background: var(--primary);
  color: #fff;
  border: none;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  font-size: 15px;
}

.chat-page .welcome {
  margin: auto;
  text-align: center;
  opacity: .55;
}

.chat-page .welcome img {
  width: 220px;
}

.chat-page .welcome p {
  font-size: 16px;
  color: var(--text-soft);
}

.chat-msg {
  font-size: 14px;
  padding: 12px 16px;
  border-radius: 14px;
  max-width: 80%;
  line-height: 1.55;
  word-wrap: break-word;
}

.chat-msg.user {
  background: var(--primary-soft);
  color: var(--primary-strong);
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}

.chat-msg.assistant {
  background: transparent;
  align-self: flex-start;
  max-width: 100%;
}

.chat-msg.error {
  background: var(--danger-soft);
  color: var(--danger);
  align-self: flex-start;
}

.chat-msg.process {
  background: transparent;
  border: none;
  padding: 4px 0;
  max-width: 100%;
  font-style: normal;
  opacity: 1;
}

.chat-msg.data {
  background: transparent;
  color: transparent;
  background-image: linear-gradient(90deg, #888 0%, #888 40%, #fff 50%, #888 60%, #888 100%);
  background-size: 200% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  animation: textShimmer 2s infinite linear;
}

.chat-msg .think {
  background: var(--bg-soft);
  padding: 10px 14px;
  border-radius: 10px;
  margin-bottom: 8px;
  font-size: 13px;
  color: var(--text-muted);
}

.chat-msg .product {
  display: inline-block;
  background: var(--primary-soft);
  color: var(--primary-strong);
  padding: 1px 8px;
  border-radius: 5px;
  font-weight: 600;
  cursor: pointer;
}

.chat-msg .product:hover {
  background: var(--primary);
  color: #fff;
}

/* entity chips on chat page inherit global .entity-chip styles */

/* ============================================================== */
/* PROFILE PAGE                                                     */
/* ============================================================== */
.profile-grid {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 20px;
}

@media (max-width: 900px) {
  .profile-grid {
    grid-template-columns: 1fr;
  }
}

.usage-card .usage-summary {
  margin: 0 0 12px;
  font-size: 15px;
}

.usage-card .usage-summary strong {
  color: var(--primary-strong);
  font-size: 22px;
}

.usage-card .usage-of {
  color: var(--text-muted);
  margin-left: 6px;
}

.usage-progress {
  height: 12px;
  border-radius: 999px;
  background: var(--primary-soft);
  overflow: hidden;
  margin-bottom: 12px;
}

.usage-progress-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--primary), var(--primary-strong));
  transition: width 0.35s ease;
}

.usage-breakdown {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  font-size: 13px;
  color: var(--text-muted);
}

.usage-breakdown i {
  color: var(--primary);
  margin-right: 4px;
}

.profile-side {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 26px 20px;
  text-align: center;
  height: 300px;
}

.profile-side .big-avatar {
  width: 96px;
  height: 96px;
  background: var(--primary);
  color: #fff;
  border-radius: 50%;
  margin: 0 auto 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 30px;
  font-weight: 700;
}

.profile-side h3 {
  margin: 4px 0;
  font-size: 18px;
}

.profile-side small {
  color: var(--text-muted);
}

.profile-side .logout {
  display: inline-block;
  margin-top: 22px;
  color: var(--danger);
  font-size: 13px;
  text-decoration: none;
  font-weight: 500;
}

.profile-side .logout:hover {
  text-decoration: underline;
}

/* ============================================================== */
/* ORDER DETAIL                                                     */
/* ============================================================== */
.order-detail-grid {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 16px;
}

@media (max-width: 900px) {
  .order-detail-grid {
    grid-template-columns: 1fr;
  }
}

.order-items-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.order-item-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
}

.order-item-row img {
  width: 50px;
  height: 50px;
  border-radius: 8px;
  object-fit: cover;
  background: var(--bg-soft);
}

.order-item-row .name {
  font-weight: 600;
  font-size: 13px;
}

.order-item-row .meta {
  font-size: 12px;
  color: var(--text-muted);
}

.order-item-row .price {
  margin-left: auto;
  font-weight: 700;
}

.badge.purple {
  background: rgba(139, 92, 246, 0.12);
  color: #7c3aed;
}

.orders-pool-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.orders-view-tabs {
  display: flex;
  gap: 6px;
}

.orders-view-tabs button {
  padding: 8px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-soft);
  font-size: 13px;
  cursor: pointer;
}

.orders-view-tabs button.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.order-status-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 14px;
}

.order-status-tabs button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: #fff;
  font-size: 12px;
  cursor: pointer;
}

.order-status-tabs button.active {
  border-color: var(--primary);
  color: var(--primary);
  background: rgba(var(--primary-rgb, 59, 130, 246), 0.08);
}

.orders-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 16px;
}

.orders-filters input,
.orders-filters select {
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 13px;
  min-width: 160px;
}

.order-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 14px;
}

.order-card {
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #fff;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: box-shadow 0.2s;
}

.order-card:hover {
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.06);
}

.order-card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
}

.order-card-head .no {
  font-weight: 700;
  font-size: 14px;
}

.order-card-head .pkg-id {
  font-size: 11px;
  color: var(--text-muted);
}

.order-card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.order-tag {
  font-size: 10px;
  padding: 3px 7px;
  border-radius: 6px;
  font-weight: 600;
}

.order-tag.fast {
  background: rgba(245, 158, 11, 0.15);
  color: #b45309;
}

.order-tag.corp {
  background: rgba(59, 130, 246, 0.12);
  color: #1d4ed8;
  cursor: help;
}

.order-tag.e-invoice {
  background: rgba(16, 185, 129, 0.12);
  color: #047857;
}

.order-card-meta {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.6;
}

.order-card-meta strong {
  color: var(--text);
}

.order-card-items {
  font-size: 12px;
  color: var(--text-muted);
  border-top: 1px dashed var(--border);
  padding-top: 8px;
}

.order-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: auto;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}

.order-card-actions .btn {
  font-size: 11px;
  padding: 5px 9px;
}

.catalog-search-results,
.brand-search-results {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 8px;
  max-height: 220px;
  overflow: auto;
}

.catalog-search-item,
.brand-search-item {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-soft);
  cursor: pointer;
  text-align: left;
  font-family: inherit;
}

.catalog-search-item strong,
.brand-search-item strong {
  font-size: 13px;
  font-weight: 600;
  line-height: 1.35;
}

.catalog-search-item span,
.brand-search-item span {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  flex-shrink: 0;
}

.catalog-search-item:hover,
.brand-search-item:hover {
  border-color: var(--primary);
  background: var(--surface);
}

.catalog-search-empty,
.brand-search-empty {
  font-size: 12px;
  color: var(--text-muted);
  padding: 6px 0;
}

.order-locked-notice {
  font-size: 11px;
  color: var(--danger);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  border-radius: 8px;
  background: rgba(239, 68, 68, 0.08);
}

.cargo-countdown {
  font-size: 11px;
  color: var(--danger);
  font-weight: 600;
}

.fin-row {
  display: flex;
  justify-content: space-between;
  padding: 4px 0;
  font-size: 13px;
}

.fin-row .neg {
  color: var(--danger);
}

.fin-divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 8px 0;
}

.fin-campaigns {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px dashed var(--border);
}

.fin-campaigns-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 6px;
  text-transform: uppercase;
}

.fin-campaign-item {
  font-size: 12px;
  padding: 4px 0;
  color: var(--primary);
}

.fin-campaign-item i {
  margin-right: 6px;
}

.claim-cards {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.claim-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px;
  background: #fff;
}

.claim-card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.claim-countdown {
  color: var(--danger);
  font-weight: 700;
  font-size: 13px;
}

.claim-countdown i {
  margin-right: 6px;
}

.split-wizard-step {
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-bottom: 10px;
}

.split-line-row {
  display: grid;
  grid-template-columns: 1fr 80px 80px;
  gap: 8px;
  align-items: center;
  padding: 6px 0;
  font-size: 13px;
}

.alert-box {
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 12px;
  line-height: 1.5;
  margin-bottom: 12px;
}

.alert-box.warning {
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.3);
  color: #92400e;
}

/* ============================================================== */
/* RESPONSIVE                                                       */
/* ============================================================== */
@media (max-width: 900px) {
  aside#sidebar {
    transform: translateX(-110%);
  }

  aside#sidebar:not(.close) {
    transform: none;
  }

  main#app {
    left: 0;
  }

  body.ai-open:not([data-page="chat"]) #unified_chat {
    top: var(--ai-header-h);
    width: 100vw;
    right: 0;
  }

  aside#ai_panel {
    width: 100vw;
  }

  button#burger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  header#topbar {
    padding-left: 70px;
  }

  #changes {
    left: 0;
  }
}

/* ============================================================== */
/* LEGACY (login page still kullanır)                              */
/* ============================================================== */

#ai_toggle {
  background-color: transparent;
  border: none;
}

/* AI Model Mode Toggle */
.uc-mode-toggle {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
  background: var(--bg-soft, #f1f5f9);
  padding: 4px;
  border-radius: 20px;
  width: fit-content;
  align-self: flex-start;
  border: 1px solid var(--border, #e2e8f0);
}

.uc-mode-toggle .mode-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border: none;
  background: transparent;
  border-radius: 16px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted, #64748b);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.uc-mode-toggle .mode-btn:hover {
  color: var(--text, #1e293b);
  background: rgba(0, 0, 0, 0.03);
}

.uc-mode-toggle .mode-btn.active {
  background: var(--surface, #ffffff);
  color: var(--primary, #ffa253);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08), 0 1px 3px rgba(0, 0, 0, 0.04);
}

.uc-mode-toggle .mode-btn i {
  font-size: 12px;
}

/* Thinking Box UI */
.thinking-box {
  margin: 4px 0;
  border: 1px solid var(--border, #e2e8f0);
  border-left: 4px solid var(--primary, #ffa253);
  border-radius: 12px;
  background: var(--bg-soft, #f8fafc);
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02);
  transition: border-color 0.2s;
  width: 100%;
  max-width: 100%;
  flex-shrink: 0;
  align-self: flex-start;
}

.thinking-box.loading {
  width: auto;
  max-width: 100%;
}

.thinking-summary {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted, #64748b);
  cursor: pointer;
  user-select: none;
  list-style: none;
  background: rgba(0, 0, 0, 0.01);
  transition: background 0.15s;
}

.thinking-summary::-webkit-details-marker {
  display: none;
}

.thinking-summary:hover {
  background: rgba(0, 0, 0, 0.03);
  color: var(--text, #1e293b);
}

.thinking-summary i {
  color: var(--primary, #ffa253);
  animation: brainShimmer 3s infinite ease-in-out;
}

@keyframes brainShimmer {

  0%,
  100% {
    opacity: 0.7;
    transform: scale(1);
  }

  50% {
    opacity: 1;
    transform: scale(1.1);
  }
}

.thinking-content {
  padding: 12px 16px;
  font-size: 13px;
  line-height: 1.6;
  color: var(--text-muted, #475569);
  white-space: pre-wrap;
  border-top: 1px solid var(--border, #e2e8f0);
  background: var(--surface, #ffffff);
  font-family: var(--font-mono, monospace);
  max-height: 250px;
  overflow-y: auto;
}

.thinking-box[open] {
  border-color: rgba(255, 162, 83, 0.4);
}

/* Gemini-style Thinking Shimmer Loading State */
.thinking-box.loading {
  border-left-color: #cbd5e1;
}

.thinking-box.loading .thinking-summary {
  cursor: default;
}

.thinking-box.loading .thinking-summary i {
  background: linear-gradient(135deg, #4285f4, #9b51e0, #e051a3);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: brainRotate 2s linear infinite;
}

@keyframes brainRotate {
  0% {
    transform: rotate(0deg) scale(1);
  }

  50% {
    transform: rotate(180deg) scale(1.1);
  }

  100% {
    transform: rotate(360deg) scale(1);
  }
}

.shimmer-text {
  background: linear-gradient(90deg,
      #64748b 0%,
      #64748b 35%,
      #4285f4 50%,
      #64748b 65%,
      #64748b 100%);
  background-size: 200% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: textShimmer 2s infinite linear;
  display: inline-block;
}

@keyframes textShimmer {
  0% {
    background-position: 200% 0;
  }

  100% {
    background-position: -200% 0;
  }
}

.thinking-shimmer-bar {
  height: 8px;
  margin: 10px 0;
  border-radius: 4px;
  background: linear-gradient(90deg,
      #f1f5f9 25%,
      #e2e8f0 50%,
      #f1f5f9 75%);
  background-size: 200% 100%;
  animation: barShimmer 1.5s infinite linear;
}

@keyframes barShimmer {
  0% {
    background-position: 200% 0;
  }

  100% {
    background-position: -200% 0;
  }
}

/* ============================================================== */
/* PRODUCT ANALYSIS                                                 */
/* ============================================================== */
.pa-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.pa-toolbar-text {
  font-size: 13px;
  color: var(--text-soft);
}

.pa-severity-legend {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.pa-legend-label {
  font-size: 11px;
  color: var(--text-muted);
  margin-left: 4px;
}

.pa-severity-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
  display: inline-block;
  box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.08);
}

.pa-severity-dot-good {
  background: #22c55e;
}

.pa-product-card-ok .pa-product-head {
  border-bottom-color: rgba(34, 197, 94, 0.18);
}

.pa-score-badge-ok {
  color: #15803d;
  border-color: rgba(34, 197, 94, 0.25);
  background: rgba(34, 197, 94, 0.08);
}

.pa-issue-ok {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #15803d;
}

.pa-issue-ok i {
  font-size: 14px;
}

.pa-product-grid {
  display: grid;
  gap: 16px;
}

.pa-product-card {
  padding: 0;
  overflow: hidden;
}

.pa-product-head {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 18px;
  border: 0;
  border-bottom: 1px solid var(--border);
  background: var(--bg-soft);
  text-align: left;
}

.pa-product-head-link {
  cursor: pointer;
  transition: background .15s ease;
}

.pa-product-head-link:hover {
  background: var(--surface);
}

.pa-product-media {
  position: relative;
  width: 72px;
  height: 72px;
  flex-shrink: 0;
}

.pa-product-thumb {
  width: 72px;
  height: 72px;
  border-radius: 12px;
  object-fit: cover;
  border: 1px solid var(--border);
  background: var(--surface);
}

.pa-product-thumb-fallback {
  width: 72px;
  height: 72px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 22px;
}

.pa-product-head-text {
  flex: 1;
  min-width: 0;
}

.pa-product-head-text h3 {
  margin: 0 0 6px;
  font-size: 16px;
  font-weight: 700;
  line-height: 1.35;
}

.pa-product-meta {
  font-size: 12px;
  color: var(--text-muted);
}

.pa-product-head-side {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  flex-shrink: 0;
}

.pa-score-badge {
  font-size: 11px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px 8px;
  color: var(--text-soft);
}

.pa-product-summary {
  margin: 0;
  padding: 14px 18px 0;
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-soft);
}

.pa-score-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  padding: 14px 18px 0;
}

.pa-score-item {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-soft);
}

.pa-score-item-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.pa-score-item-label {
  font-size: 12px;
  color: var(--text-soft);
}

.pa-score-item-value {
  font-size: 13px;
  font-weight: 700;
}

.pa-score-bar-track {
  height: 6px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.25);
  overflow: hidden;
}

.pa-score-bar-fill {
  height: 100%;
  border-radius: 999px;
  transition: width .2s ease;
}

.pa-issue-list {
  list-style: none;
  margin: 14px 0 0;
  padding: 0 18px 16px;
  display: grid;
  gap: 10px;
}

.pa-issue-item {
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-soft);
}

.pa-issue-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}

.pa-issue-title-row strong {
  font-size: 13px;
}

.pa-issue-reason {
  margin: 0;
  font-size: 13px;
  line-height: 1.55;
  color: var(--text-soft);
}

.pa-issue-recommendation {
  margin: 8px 0 0;
  font-size: 13px;
  line-height: 1.55;
}

.pa-issue-recommendation span {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  color: var(--primary);
  margin-right: 6px;
}

.pa-issue-empty {
  margin: 12px 18px 0;
  color: var(--text-soft);
  font-size: 13px;
}

.pa-analyzed-at {
  padding: 0 18px 16px;
  font-size: 11px;
  color: var(--text-muted);
}

.pa-schedule-banner {
  margin-bottom: 14px;
}

.pa-sort-field {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-soft);
}

.pa-sort-field select {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  padding: 7px 10px;
  font-size: 12px;
}

.pa-list-stack {
  display: grid;
  gap: 10px;
}

.pa-list-row {
  width: 100%;
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr) auto 20px;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  text-align: left;
  cursor: pointer;
  transition: border-color .15s ease, box-shadow .15s ease;
}

.pa-list-row:hover {
  border-color: rgba(249, 115, 22, 0.35);
  box-shadow: var(--shadow-sm);
}

.pa-list-row-media {
  position: relative;
  width: 64px;
  height: 64px;
}

.pa-list-thumb,
.pa-list-thumb-fallback {
  width: 64px;
  height: 64px;
  border-radius: 10px;
}

.pa-list-thumb {
  object-fit: cover;
  border: 1px solid var(--border);
  background: var(--bg-soft);
}

.pa-list-thumb-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  background: var(--bg-soft);
  color: var(--text-muted);
}

.pa-list-row-title {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 4px;
}

.pa-list-row-summary {
  font-size: 13px;
  color: var(--text-soft);
}

.pa-list-row-chevron {
  color: var(--text-muted);
  font-size: 12px;
}

.pa-score-ring {
  --pa-score: 0;
  --pa-score-color: #22c55e;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background:
    radial-gradient(farthest-side, var(--surface) 72%, transparent 73%),
    conic-gradient(var(--pa-score-color) calc(var(--pa-score) * 1%), rgba(148, 163, 184, 0.25) 0);
}

.pa-score-ring-sm {
  width: 54px;
  height: 54px;
}

.pa-score-ring-lg {
  width: 132px;
  height: 132px;
}

.pa-score-ring-inner {
  text-align: center;
  line-height: 1.1;
}

.pa-score-ring-inner strong {
  display: block;
  font-size: 18px;
}

.pa-score-ring-lg .pa-score-ring-inner strong {
  font-size: 34px;
}

.pa-score-ring-inner span {
  font-size: 11px;
  color: var(--text-muted);
}

.pa-detail-shell {
  display: grid;
  gap: 14px;
}

.pa-back-btn {
  justify-self: start;
}

.pa-detail-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px;
}

.pa-detail-header-main {
  display: flex;
  gap: 16px;
  min-width: 0;
}

.pa-detail-header-media {
  position: relative;
  width: 88px;
  height: 88px;
  flex-shrink: 0;
}

.pa-detail-thumb,
.pa-detail-thumb-fallback {
  width: 88px;
  height: 88px;
  border-radius: 12px;
}

.pa-detail-thumb {
  object-fit: cover;
  border: 1px solid var(--border);
}

.pa-detail-thumb-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  background: var(--bg-soft);
  color: var(--text-muted);
  font-size: 28px;
}

.pa-detail-header-text h2 {
  margin: 0 0 10px;
  font-size: 22px;
}

.pa-detail-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.pa-tag {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(59, 130, 246, 0.1);
  color: #2563eb;
  font-size: 12px;
  font-weight: 600;
}

.pa-detail-meta-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.pa-detail-meta-grid span {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.pa-detail-meta-grid strong {
  font-size: 13px;
}

.pa-detail-header-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
  flex-shrink: 0;
}

.pa-detail-last {
  font-size: 12px;
  color: var(--text-muted);
}

.pa-detail-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  border-bottom: 1px solid var(--border);
  padding: 0 4px;
}

.pa-detail-tab {
  border: 0;
  background: transparent;
  padding: 12px 2px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-soft);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.pa-detail-tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

.pa-tab-badge {
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: #ef4444;
  color: #fff;
  font-size: 11px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.pa-detail-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(280px, 0.9fr);
  gap: 16px;
  align-items: start;
}

.pa-detail-issues-panel,
.pa-detail-score-card {
  padding: 18px 20px;
}

.pa-detail-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.pa-detail-panel-head h3,
.pa-detail-score-card h3 {
  margin: 0;
  font-size: 16px;
}

.pa-issue-filter {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  padding: 7px 10px;
  font-size: 12px;
}

.pa-detail-issue-stack {
  display: grid;
  gap: 12px;
}

.pa-detail-issue {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg-soft);
}

.pa-issue-icon {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
}

.pa-issue-icon.critical {
  background: rgba(239, 68, 68, 0.12);
  color: #dc2626;
}

.pa-issue-icon.high {
  background: rgba(249, 115, 22, 0.12);
  color: #ea580c;
}

.pa-issue-icon.medium {
  background: rgba(234, 179, 8, 0.15);
  color: #ca8a04;
}

.pa-issue-icon.low {
  background: rgba(148, 163, 184, 0.18);
  color: #64748b;
}

.pa-detail-issue-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
}

.pa-detail-issue-head strong {
  font-size: 14px;
}

.pa-detail-issue-body p {
  margin: 0;
  font-size: 13px;
  line-height: 1.55;
  color: var(--text-soft);
}

.pa-detail-issue-effect {
  margin-top: 8px;
  font-size: 12px;
  color: var(--text-muted);
}

.pa-severity-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 4px 8px;
  border-radius: 999px;
  white-space: nowrap;
}

.pa-severity-badge.critical {
  background: rgba(239, 68, 68, 0.12);
  color: #dc2626;
}

.pa-severity-badge.high {
  background: rgba(249, 115, 22, 0.12);
  color: #ea580c;
}

.pa-severity-badge.medium {
  background: rgba(234, 179, 8, 0.15);
  color: #ca8a04;
}

.pa-severity-badge.low {
  background: rgba(148, 163, 184, 0.18);
  color: #64748b;
}

.pa-show-all {
  margin-top: 14px;
}

.pa-detail-sidebar {
  display: grid;
  gap: 16px;
}

.pa-detail-score-center {
  display: flex;
  justify-content: center;
  margin: 16px 0;
}

.pa-detail-score-card p {
  margin: 0;
  font-size: 13px;
  line-height: 1.6;
  color: var(--text-soft);
}

.pa-detail-score-list {
  display: grid;
  gap: 12px;
}

.pa-detail-score-row-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
  font-size: 12px;
}

.pa-quick-suggestions {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 10px;
}

.pa-quick-suggestions li {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 13px;
  line-height: 1.5;
}

.pa-quick-suggestions i {
  color: #22c55e;
  margin-top: 3px;
}

.pa-detail-empty,
.pa-detail-placeholder {
  padding: 28px 20px;
  text-align: center;
  color: var(--text-soft);
}

.pa-detail-placeholder i {
  font-size: 28px;
  color: var(--primary);
  margin-bottom: 10px;
}

.pa-detail-placeholder strong {
  display: block;
  margin-bottom: 6px;
}

@media (max-width: 980px) {
  .pa-detail-layout {
    grid-template-columns: 1fr;
  }

  .pa-detail-meta-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .pa-detail-header {
    flex-direction: column;
  }

  .pa-detail-header-actions {
    align-items: flex-start;
  }
}

@media (max-width: 640px) {
  .pa-list-row {
    grid-template-columns: 56px minmax(0, 1fr);
    grid-template-areas:
      "media main"
      "score score";
  }

  .pa-list-row-media { grid-area: media; }
  .pa-list-row-main { grid-area: main; }
  .pa-list-row-score {
    grid-area: score;
    justify-self: start;
  }

  .pa-list-row-chevron {
    display: none;
  }
}

/* ── Product Analysis: New on-demand styles ── */

.pa-token-banner {
  margin-bottom: 14px;
}

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

.pa-section-title i {
  color: var(--primary);
}

.pa-product-list {
  display: grid;
  gap: 8px;
}

.pa-product-row {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) auto;
  align-items: center;
  gap: 24px;
  padding: 12px 16px;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  transition: border-color 0.15s;
}

.pa-product-row:hover {
  border-color: var(--primary);
}

.pa-product-action {
  flex-shrink: 0;
}

.pa-list-row-pending {
  opacity: 0.7;
  pointer-events: none;
}

@media (max-width: 640px) {
  .pa-product-row {
    grid-template-columns: 40px minmax(0, 1fr);
    gap: 10px;
  }

  .pa-product-action {
    grid-column: 1 / -1;
    justify-self: end;
  }
}