:root {
  color-scheme: light;
  --bg: #eef1f4;
  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --line: #d7dde5;
  --line-strong: #b7c0cc;
  --text: #172033;
  --muted: #667085;
  --muted-strong: #475467;
  --accent: #0f766e;
  --accent-dark: #115e59;
  --blue: #2563eb;
  --amber: #b45309;
  --danger: #b42318;
  --shadow: 0 12px 32px rgba(22, 32, 51, 0.08);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.45 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

a { color: var(--accent-dark); text-decoration: none; }
strong { font-weight: 750; }
small { color: var(--muted); }

.app-shell {
  min-height: 100vh;
  display: flex;
}

.sidebar {
  width: 248px;
  min-height: 100vh;
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  gap: 22px;
  padding: 18px;
  background: #172033;
  color: #e6edf6;
}

.brand {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
  color: #fff;
}

.brand-logo {
  width: min(180px, 100%);
  max-height: 64px;
  object-fit: contain;
  flex: 0 0 auto;
}

.brand strong {
  display: block;
  font-size: 20px;
  line-height: 1.05;
}

.brand-mark {
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: #0f766e;
  color: #fff;
  font-weight: 850;
  letter-spacing: 0;
}

.brand-mark.large {
  width: 48px;
  height: 48px;
  margin-bottom: 12px;
}

.brand small {
  display: block;
  color: #aab6c7;
  font-size: 12px;
}

.auth-logo {
  width: min(260px, 100%);
  height: auto;
  display: block;
  margin-bottom: 18px;
  padding: 12px;
  border-radius: 8px;
  background: #172033;
}

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

.side-nav a {
  min-height: 40px;
  display: flex;
  align-items: center;
  padding: 9px 11px;
  border-radius: 6px;
  color: #cbd5e1;
}

.side-nav a:hover,
.side-nav a.active {
  background: rgba(255, 255, 255, 0.09);
  color: #fff;
}

.side-nav a.nav-with-count {
  justify-content: space-between;
}

.side-nav a.nav-with-count strong {
  min-width: 22px;
  min-height: 22px;
  display: inline-grid;
  place-items: center;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--danger);
  color: #fff;
  font-size: 12px;
  line-height: 1;
}

.side-nav a.has-alerts {
  background: rgba(180, 35, 24, 0.2);
  color: #fff;
}

.sidebar-section-title {
  margin: 4px 0 6px;
  color: #91a1b8;
  font-size: 11px;
  font-weight: 850;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.status-nav {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.status-link {
  min-height: 34px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 9px;
  border-radius: 6px;
  color: #cbd5e1;
}

.status-link span {
  min-width: 0;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.status-link i {
  width: 9px;
  height: 9px;
  flex: 0 0 9px;
  border-radius: 999px;
  background: var(--status-color, #94a3b8);
}

.status-link strong {
  min-width: 28px;
  min-height: 22px;
  display: inline-grid;
  place-items: center;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  font-size: 12px;
}

.status-link:hover,
.status-link.active {
  background: rgba(255, 255, 255, 0.09);
  color: #fff;
}

.sidebar-footer {
  margin-top: auto;
  display: grid;
  gap: 10px;
  color: #cbd5e1;
  font-size: 13px;
}

.main-area {
  flex: 1;
  min-width: 0;
}

.page {
  max-width: 1480px;
  margin: 0 auto;
  padding: 26px;
}

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

.toolbar .actions,
.toolbar-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.toolbar-actions form {
  margin: 0;
}

.wallet-list,
.inline-stack {
  display: grid;
  gap: 7px;
}

.wallet-pill {
  display: inline-flex;
  width: fit-content;
  max-width: 100%;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #f8fafc;
  color: var(--text);
  font-size: 12px;
  white-space: normal;
}

.wallet-pill small {
  color: var(--muted);
}

.compact-line {
  margin: 0 0 8px;
}

.compact-line:last-child {
  margin-bottom: 0;
}

.inline-stack input,
.inline-stack select {
  width: min(260px, 100%);
}

.readonly-session-bar {
  max-width: 1480px;
  margin: 18px auto 0;
  padding: 0 26px;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
}

.readonly-session-bar span {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  padding: 7px 12px;
  border: 1px solid #fed7aa;
  border-radius: 999px;
  background: #fff7ed;
  color: #9a3412;
  font-size: 13px;
  font-weight: 850;
}

.readonly-session-bar form {
  margin: 0;
}

.readonly-session-bar button {
  min-height: 34px;
}

h1, h2, p { margin-top: 0; }
h1 {
  margin-bottom: 6px;
  font-size: 28px;
  line-height: 1.15;
  letter-spacing: 0;
}
h2 {
  margin-bottom: 10px;
  font-size: 16px;
  letter-spacing: 0;
}
p { margin-bottom: 10px; color: var(--muted); }

.eyebrow {
  display: block;
  margin-bottom: 5px;
  color: var(--accent-dark);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

button, .button {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  min-height: 38px;
  padding: 8px 12px;
  border-radius: 6px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-weight: 700;
}

button:hover, .button:hover { border-color: var(--line-strong); }

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

.metric-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.metric-strip > div,
.metric-strip > a {
  padding: 13px 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
}

.metric-strip > a.active {
  border-color: var(--accent);
  box-shadow: inset 3px 0 0 var(--accent);
}

.metric-strip span {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 12px;
}

.metric-strip strong {
  display: block;
  font-size: 22px;
  line-height: 1;
}

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
  padding-bottom: 2px;
}

.tabs a {
  min-width: max-content;
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--muted-strong);
}

.tabs a.active:not(.has-open) {
  border-color: #16a34a;
  background: #dcfce7;
  color: #14532d;
  font-weight: 800;
  box-shadow: inset 0 0 0 1px rgba(22, 163, 74, 0.22);
}

.tabs a.has-open {
  border-color: #f59e0b;
  background: #fff7ed;
  color: #9a3412;
  box-shadow: inset 0 0 0 1px rgba(245, 158, 11, 0.28);
}

.tabs a.has-open.active {
  border-color: #ea580c;
  background: #ffedd5;
  color: #9a3412;
  font-weight: 850;
  box-shadow: inset 0 0 0 2px rgba(234, 88, 12, 0.25);
}

.tabs strong {
  min-width: 24px;
  min-height: 22px;
  display: inline-grid;
  place-items: center;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--muted-strong);
  font-size: 12px;
}

.tabs a.has-open strong {
  background: #fed7aa;
  color: #7c2d12;
}

.tabs a.active:not(.has-open) strong {
  background: #bbf7d0;
  color: #14532d;
}

.tabs a.active.has-open strong {
  background: #fdba74;
  color: #7c2d12;
}

.tabs em {
  min-width: 20px;
  min-height: 20px;
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  background: #f97316;
  color: #fff;
  font-size: 11px;
  font-style: normal;
  font-weight: 850;
}

.filters {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 190px 210px 150px auto;
  gap: 10px;
  margin-bottom: 14px;
}

.queue-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
}

.queue-filters > input[name="q"] {
  flex: 1 1 340px;
  min-width: 260px;
}

.queue-filters > select {
  flex: 1 1 165px;
  min-width: 145px;
  max-width: 230px;
}

.queue-filters .date-filter {
  flex: 0 0 154px;
  display: flex;
  align-items: center;
  gap: 7px;
  min-height: 38px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

.queue-filters .date-filter:focus-within {
  border-color: var(--accent);
  outline: 3px solid rgba(15, 118, 110, 0.14);
}

.queue-filters .date-filter span {
  color: var(--muted-strong);
  font-size: 12px;
  font-weight: 850;
}

.queue-filters .date-filter input {
  min-height: auto;
  padding: 0;
  border: 0;
  border-radius: 0;
}

.queue-filters .date-filter input:focus {
  outline: 0;
}

.date-menu {
  position: relative;
  flex: 0 0 190px;
}

.date-menu summary {
  min-height: 38px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 28px 8px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  cursor: pointer;
  font-weight: 750;
  list-style: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

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

.date-menu summary::after {
  content: "";
  position: absolute;
  right: 11px;
  top: 16px;
  width: 7px;
  height: 7px;
  border-right: 2px solid var(--muted-strong);
  border-bottom: 2px solid var(--muted-strong);
  transform: rotate(45deg);
}

.date-menu[open] summary {
  border-color: var(--accent);
  outline: 3px solid rgba(15, 118, 110, 0.14);
}

.date-menu-panel {
  position: absolute;
  z-index: 35;
  top: calc(100% + 6px);
  left: 0;
  width: 330px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 14px 34px rgba(15, 23, 42, 0.16);
}

.date-input-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 8px;
}

.date-input-grid label {
  display: grid;
  gap: 4px;
  color: var(--muted-strong);
  font-size: 12px;
  font-weight: 850;
}

.date-presets {
  display: grid;
  gap: 2px;
}

.date-presets button {
  width: 100%;
  justify-content: flex-start;
  border: 0;
  background: transparent;
  color: var(--muted-strong);
  text-align: left;
}

.date-presets button:hover,
.date-presets button.active {
  background: #e6f7f3;
  color: var(--accent-dark);
}

.queue-filters .filter-check {
  flex: 0 0 auto;
  min-height: 38px;
  padding: 0 8px;
}

.queue-filters .filter-actions {
  flex: 0 0 auto;
}

.policy-filters {
  display: flex;
  flex-wrap: wrap;
}

.policy-filters input[type="search"] {
  flex: 1 1 340px;
  min-width: 260px;
}

.refund-search-form select {
  flex: 1 1 280px;
  min-width: 240px;
}

.account-filter-field {
  flex: 0 1 260px;
  display: grid;
  gap: 4px;
}

.account-filter-field span {
  color: var(--muted-strong);
  font-size: 12px;
  font-weight: 850;
}

.sku-tool-form {
  display: grid;
  gap: 10px;
  margin-bottom: 16px;
}

.sku-tool-form textarea {
  width: 100%;
  resize: vertical;
}

.sku-import-files-panel {
  margin-bottom: 16px;
}

.sku-collapsible-panel {
  padding: 0;
  margin-bottom: 16px;
  overflow: hidden;
}

.sku-collapsible-panel > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px;
  cursor: pointer;
  list-style: none;
}

.sku-collapsible-panel > summary::-webkit-details-marker {
  display: none;
}

.sku-collapsible-panel > summary::after {
  content: "Rozwiń";
  flex: 0 0 auto;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--muted-strong);
  font-size: 12px;
  font-weight: 850;
}

.sku-collapsible-panel[open] > summary {
  border-bottom: 1px solid var(--line);
}

.sku-collapsible-panel[open] > summary::after {
  content: "Zwiń";
}

.sku-collapsible-panel > summary strong,
.sku-collapsible-panel > summary small {
  display: block;
}

.sku-collapsible-panel > summary small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
}

.sku-collapsible-body {
  padding: 16px;
}

.sku-import-file-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.sku-import-file-list .button {
  align-items: center;
  display: inline-flex;
  gap: 8px;
  white-space: nowrap;
}

.sku-import-file-list .button span {
  color: var(--muted);
  font-size: 12px;
}

.sku-file-search {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.sku-file-search input {
  min-width: min(360px, 100%);
}

.sku-import-file-table th:first-child,
.sku-import-file-table td:first-child {
  width: 72px;
  text-align: center;
}

.sku-file-name-input {
  width: min(360px, 100%);
}

.sku-file-replace-bar {
  border-top: 1px solid var(--line);
  display: grid;
  grid-template-columns: minmax(240px, 1fr) minmax(220px, 360px) auto;
  gap: 12px;
  align-items: center;
  padding-top: 14px;
  margin-top: 14px;
}

@media (max-width: 900px) {
  .sku-file-replace-bar {
    grid-template-columns: 1fr;
  }
}

.sort-menu {
  position: relative;
  flex: 0 0 104px;
}

.sort-menu summary {
  min-height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px 28px 8px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  cursor: pointer;
  font-weight: 750;
  list-style: none;
}

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

.sort-menu summary::after {
  content: "";
  position: absolute;
  right: 11px;
  top: 50%;
  width: 7px;
  height: 7px;
  border-right: 2px solid var(--muted-strong);
  border-bottom: 2px solid var(--muted-strong);
  transform: translateY(-65%) rotate(45deg);
}

.sort-menu[open] summary {
  border-color: var(--accent);
  outline: 3px solid rgba(15, 118, 110, 0.14);
}

.sort-menu-options {
  position: absolute;
  z-index: 30;
  top: calc(100% + 6px);
  right: 0;
  width: 240px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 14px 34px rgba(15, 23, 42, 0.16);
}

.sort-menu-options button {
  width: 100%;
  justify-content: flex-start;
  border: 0;
  background: transparent;
  text-align: left;
}

.sort-menu-options button:hover,
.sort-menu-options button.active {
  background: #e6f7f3;
  color: var(--accent-dark);
}

.filter-actions {
  display: flex;
  gap: 8px;
  align-items: stretch;
}

input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  min-height: 38px;
  padding: 8px 10px;
  background: #fff;
  color: var(--text);
  font: inherit;
}

textarea {
  min-height: 150px;
  resize: vertical;
}

.inline-form-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.sku-tool-form .inline-form-row input[type="text"] {
  width: min(100%, 180px);
}

input:focus, select:focus, textarea:focus {
  outline: 3px solid rgba(15, 118, 110, 0.14);
  border-color: var(--accent);
}

.ticket-list,
.conversation,
.side-panel > *,
.settings-card,
.auth-panel,
.form-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.ticket-list { overflow: hidden; }

.ticket-row {
  display: grid;
  grid-template-columns: 24px 42px minmax(0, 1fr) 260px;
  gap: 14px;
  align-items: start;
  padding: 13px 16px;
  border-bottom: 1px solid var(--line);
  color: var(--text);
}

.ticket-row:last-child { border-bottom: 0; }
.ticket-row:hover { background: var(--surface-soft); }
.ticket-row.unread {
  background: #eefaf8;
  box-shadow: inset 4px 0 0 var(--accent);
}

.ticket-row.rating-negative {
  box-shadow: inset 4px 0 0 var(--danger);
}

.ticket-row.rating-positive {
  box-shadow: inset 4px 0 0 #15803d;
}

.ticket-row.open-status {
  background: #ecfdf3;
  box-shadow: inset 4px 0 0 #16a34a;
}

.ticket-row.open-status:hover {
  background: #e5f8eb;
}

.ticket-row.open-status .channel-token {
  background: #dcfce7;
  color: #14532d;
}

.channel-token {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: #e8edf3;
  color: #243044;
  font-weight: 850;
  text-transform: uppercase;
}

.bulk-form,
.ghost-bulk-form { margin: 0; }

.ghost-bulk-actions {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 12px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.bulk-bar {
  display: grid;
  grid-template-columns: minmax(170px, 0.9fr) minmax(250px, 1.2fr) 240px auto;
  gap: 10px;
  align-items: center;
  margin-bottom: 12px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.check-line,
.row-check,
.checkbox-row {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted-strong);
  font-weight: 750;
}

.check-line input,
.row-check input,
.checkbox-row input {
  width: 16px;
  min-height: 16px;
  height: 16px;
  padding: 0;
}

.ghost-filters {
  grid-template-columns: minmax(220px, 1fr) minmax(180px, 260px) auto auto;
}

.account-config-list {
  max-height: 360px;
  overflow: auto;
  display: grid;
  gap: 8px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.ghost-row-alert {
  background: #fff7ed;
}

.row-check {
  min-height: 40px;
  justify-content: center;
}

.row-check-placeholder {
  pointer-events: none;
}

.ticket-link {
  display: block;
  color: var(--text);
}

.ticket-main, .ticket-side {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.ticket-main strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: normal;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.ticket-side { align-items: flex-end; text-align: right; }

.quick-status {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) auto;
  gap: 6px;
  width: 100%;
  max-width: 250px;
}

.quick-status select,
.quick-status button {
  min-height: 32px;
  font-size: 12px;
}

.ticket-title-line {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex-wrap: wrap;
}

.source {
  color: var(--accent-dark);
  font-size: 11px;
  font-weight: 850;
  text-transform: uppercase;
}

.unread-dot {
  border-radius: 999px;
  padding: 2px 7px;
  background: var(--accent);
  color: #fff;
  font-size: 11px;
  font-weight: 800;
}

.mini-chip,
.rating-pill {
  border-radius: 999px;
  padding: 2px 7px;
  background: #eef2f7;
  color: var(--muted-strong);
  font-size: 11px;
  font-weight: 800;
}

.used-chip {
  border-radius: 999px;
  padding: 2px 8px;
  background: #ffedd5;
  color: #9a3412;
  border: 1px solid #fdba74;
  font-size: 11px;
  font-weight: 850;
  white-space: nowrap;
}

.rating-pill.positive {
  background: #dcfce7;
  color: #166534;
}

.rating-pill.negative {
  background: #fee2e2;
  color: var(--danger);
}

.stars {
  color: #b45309;
  font-size: 13px;
  letter-spacing: 0;
  white-space: nowrap;
}

.ticket-preview {
  display: block;
  max-width: 920px;
  overflow: hidden;
  color: var(--muted-strong);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ticket-preview b {
  color: var(--text);
}

.ticket-facts,
.context-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 2px;
}

.ticket-facts span,
.context-strip span {
  min-width: 0;
  max-width: 100%;
  padding: 3px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--muted-strong);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ticket-facts b,
.context-strip b {
  color: var(--text);
}

.copy-login {
  min-height: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--accent-dark);
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

.copy-login:hover {
  text-decoration: underline;
}

.copy-login.copied {
  color: #15803d;
}

.baselinker-link {
  min-height: 24px;
  padding: 2px 8px;
  border-color: #bfdbfe;
  background: #eff6ff;
  color: #1d4ed8;
  font-size: 11px;
  font-weight: 850;
}

.inline-offer-link {
  color: #0f766e;
  font-weight: 850;
  margin-left: 4px;
}

.inline-offer-link:hover {
  text-decoration: underline;
}

.side-badges {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: flex-end;
  gap: 6px;
}

.badge {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  max-width: 100%;
  background: var(--badge, #64748b);
  color: #fff;
  border-radius: 999px;
  padding: 4px 9px;
  line-height: 1.15;
  font-size: 12px;
  font-weight: 800;
}

.badge.alert-error { --badge: var(--danger); }
.badge.alert-muted { --badge: var(--muted); }

.detail-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 348px;
  gap: 18px;
  align-items: start;
}

.ticket-nav {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  margin-bottom: 12px;
}

.ticket-nav > div {
  display: flex;
  gap: 8px;
}

.ticket-back-group {
  align-items: flex-start;
  flex-direction: column;
}

.button.disabled {
  opacity: 0.45;
  cursor: default;
  pointer-events: none;
}

.readonly-pill {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 7px 12px;
  border: 1px solid #fed7aa;
  border-radius: 999px;
  background: #fff7ed;
  color: #9a3412;
  font-size: 13px;
  font-weight: 850;
}

.readonly-panel {
  border-top: 1px solid var(--line);
  margin-top: 16px;
  padding: 16px 0 0;
  color: var(--muted-strong);
}

.readonly-panel strong {
  color: var(--text);
}

.reply-template-menu {
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 8px;
  box-shadow: 0 14px 34px rgba(15, 23, 42, 0.14);
  margin-top: -8px;
  margin-bottom: 12px;
  max-height: 280px;
  overflow-y: auto;
  padding: 6px;
  position: relative;
  z-index: 20;
}

.reply-template-option {
  display: grid;
  gap: 2px;
  width: 100%;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text);
  padding: 9px 10px;
  text-align: left;
}

.reply-template-option:hover,
.reply-template-option.active {
  background: #e6f7f3;
  color: var(--primary-dark);
}

.reply-template-option strong {
  font-size: 13px;
}

.reply-template-option span {
  color: var(--muted-strong);
  font-size: 12px;
  line-height: 1.35;
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-top: 14px;
  color: var(--muted-strong);
}

.conversation { padding: 18px; }

.ticket-heading {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 14px;
  margin-bottom: 16px;
}

.ticket-heading .side-badges {
  flex: 0 0 auto;
}

.messages {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 18px;
}

.message {
  max-width: 78%;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.message.inbound {
  border-left: 4px solid var(--blue);
}

.message.outbound {
  margin-left: auto;
  background: #ecfdf5;
  border-color: #b7e4d6;
}

.message.internal {
  margin-inline: auto;
  background: #fff7ed;
  border-color: #fed7aa;
}

.message-meta {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 8px;
}

.message-body { white-space: normal; word-break: break-word; }

.translation-box {
  margin-top: 10px;
  padding: 10px;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  background: #eff6ff;
  color: #1e3a8a;
}

.translation-box strong {
  display: block;
  margin-bottom: 5px;
}

.inline-message-action {
  margin-top: 10px;
}

.button.small {
  min-height: 28px;
  padding: 4px 9px;
  font-size: 12px;
}

.attachments {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 10px;
}

.attachment-link {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 5px 9px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-soft);
  color: var(--text);
  font-size: 12px;
  font-weight: 750;
}

.rating-summary {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
}

.reply-box {
  border-top: 1px solid var(--line);
  padding-top: 16px;
}

.composer-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.side-panel {
  display: flex;
  flex-direction: column;
  gap: 14px;
  position: sticky;
  top: 18px;
}

.side-panel > *,
.auth-panel,
.form-panel {
  padding: 16px;
}

.allegro-issue-actions {
  display: grid;
  gap: 14px;
}

.allegro-issue-actions form {
  display: grid;
  gap: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.allegro-issue-actions form:first-of-type {
  border-top: 0;
  padding-top: 0;
}

.allegro-issue-actions h3 {
  margin: 0;
  font-size: 14px;
  color: var(--primary-dark);
}

.allegro-issue-actions textarea,
.allegro-issue-actions select,
.allegro-issue-actions input {
  width: 100%;
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.settings-card { padding: 16px; }

.compatibility-auto-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
  margin-bottom: 14px;
}

.compatibility-auto-panel h2 {
  margin: 2px 0 6px;
}

.compatibility-auto-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.compatibility-account-actions {
  min-width: 150px;
}

.compatibility-account-actions form {
  margin: 0 0 6px;
}

.compatibility-account-actions button {
  width: 100%;
}

.danger-lite {
  color: #991b1b;
  border-color: #fecaca;
  background: #fff5f5;
}

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

.guide-card {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.guide-card h2 {
  margin-bottom: 6px;
}

.rule-condition {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.rule-condition span {
  padding: 3px 7px;
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--muted-strong);
  font-size: 12px;
  font-weight: 750;
}

.rule-muted {
  color: var(--muted);
}

.table-panel {
  overflow-x: auto;
  padding: 0;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
}

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

.data-table th {
  background: var(--surface-soft);
  color: var(--muted-strong);
  font-size: 12px;
  text-transform: uppercase;
}

.sku-diagnostics-card {
  margin-bottom: 16px;
}

.sku-progress {
  width: 100%;
  height: 14px;
  margin: 4px 0 14px;
  accent-color: var(--accent);
}

.sku-progress-small {
  max-width: 160px;
  height: 10px;
  margin: 0 8px 0 0;
  vertical-align: middle;
}

.sku-diagnostics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
}

.sku-diagnostics-grid > div {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.sku-diagnostics-grid span {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 12px;
}

.sku-diagnostics-grid strong {
  font-size: 18px;
}

.sku-status-stack {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.sku-status-stack span {
  padding: 3px 7px;
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--muted-strong);
  font-size: 12px;
  font-weight: 750;
}

.sku-message-table td:last-child {
  min-width: 320px;
}

.strong-link {
  color: var(--text);
  font-weight: 850;
}

.quality-summary > div:nth-child(1) strong,
.quality-summary > div:nth-child(2) strong {
  color: var(--accent-dark);
}

.quality-alert-strip {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.quality-alert-card {
  display: block;
  padding: 12px 14px;
  border: 1px solid #fed7aa;
  border-radius: 8px;
  background: #fff7ed;
  color: #9a3412;
}

.quality-alert-card.severity-error {
  border-color: #fecaca;
  background: #fef2f2;
  color: #991b1b;
}

.quality-alert-card strong,
.quality-alert-card span {
  display: block;
}

.quality-alert-card span {
  margin-top: 3px;
  font-size: 13px;
}

.quality-row.quality-good td {
  background: #ecfdf5;
}

.quality-row.quality-bad td {
  background: #fef2f2;
}

.quality-row.quality-warning td {
  background: #fff7ed;
}

.quality-row.quality-unknown td {
  background: #f8fafc;
}

.quality-row.quality-retry td {
  background: #eff6ff;
}

.quality-pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 850;
}

.quality-pill-good {
  background: #bbf7d0;
  color: #14532d;
}

.quality-pill-bad {
  background: #fecaca;
  color: #991b1b;
}

.quality-pill-warning {
  background: #fed7aa;
  color: #9a3412;
}

.quality-pill-unknown {
  background: #e2e8f0;
  color: #475569;
}

.quality-pill-retry {
  background: #bfdbfe;
  color: #1e3a8a;
}

.quality-pill-muted {
  background: #e5e7eb;
  color: #4b5563;
}

.compatibility-workspace {
  display: grid;
  grid-template-columns: minmax(210px, 260px) minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}

.compatibility-sidebar {
  position: sticky;
  top: 12px;
}

.compatibility-status-panel {
  padding: 0;
  overflow: hidden;
}

.compatibility-status-panel summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 16px;
  cursor: pointer;
  font-weight: 900;
}

.compatibility-status-panel summary::marker {
  color: var(--accent-dark);
}

.compatibility-status-panel summary strong {
  padding: 3px 8px;
  border-radius: 999px;
  background: #dbeafe;
  color: #1e3a8a;
  font-size: 12px;
}

.compatibility-status-list {
  display: grid;
  gap: 6px;
  padding: 0 12px 14px;
}

.compatibility-status-list a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  color: var(--text);
  font-weight: 800;
}

.compatibility-status-list a.active {
  border-color: #0f766e;
  background: #ecfdf5;
  color: #064e3b;
}

.compatibility-status-list a strong {
  min-width: 34px;
  padding: 2px 7px;
  border-radius: 999px;
  background: #e2e8f0;
  color: #334155;
  text-align: center;
  font-size: 12px;
}

.compatibility-status-list a.active strong {
  background: #bbf7d0;
  color: #14532d;
}

.compatibility-table-panel {
  min-width: 0;
}

.compatibility-account-status-panel {
  margin-bottom: 14px;
  overflow-x: auto;
}

.compatibility-account-live-list {
  overflow-x: auto;
}

.compatibility-account-collapsible,
.compatibility-account-history {
  margin-top: 12px;
}

.compatibility-account-collapsible > summary,
.compatibility-account-history > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 44px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  color: var(--ink);
  cursor: pointer;
  font-weight: 900;
}

.compatibility-account-collapsible > summary::-webkit-details-marker,
.compatibility-account-history > summary::-webkit-details-marker {
  display: none;
}

.compatibility-account-collapsible > summary::after,
.compatibility-account-history > summary::after {
  content: "Rozwiń";
  flex: 0 0 auto;
  padding: 5px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--accent-dark);
  font-size: 12px;
}

.compatibility-account-collapsible[open] > summary::after,
.compatibility-account-history[open] > summary::after {
  content: "Zwiń";
}

.compatibility-account-collapsible > summary strong,
.compatibility-account-history > summary strong {
  padding: 3px 9px;
  border-radius: 999px;
  background: #dbeafe;
  color: #1e3a8a;
  font-size: 13px;
}

.compatibility-account-collapsible .compatibility-account-table,
.compatibility-account-history .data-table {
  margin-top: 10px;
}

.compatibility-account-table td {
  vertical-align: top;
}

.compatibility-account-table td:nth-child(1) {
  min-width: 180px;
}

.compatibility-account-table td:nth-child(3) {
  min-width: 190px;
}

.compatibility-account-table td:nth-child(6) {
  min-width: 180px;
}

.compatibility-progress {
  width: 100%;
  height: 8px;
  border-radius: 999px;
  background: #e2e8f0;
  overflow: hidden;
  margin-bottom: 5px;
}

.compatibility-progress > div {
  height: 100%;
  min-width: 2px;
  border-radius: inherit;
  background: linear-gradient(90deg, #0f766e, #2563eb);
}

.compatibility-filters {
  grid-template-columns: minmax(260px, 1fr) auto auto;
}

.compatibility-items-table td:nth-child(3) {
  min-width: 250px;
}

.compatibility-items-table td:nth-child(6) {
  min-width: 190px;
}

@media (max-width: 980px) {
  .compatibility-workspace {
    grid-template-columns: 1fr;
  }

  .compatibility-sidebar {
    position: static;
  }
}

.refund-claim-summary small,
.refund-claim-money small {
  display: block;
  margin-top: 4px;
  color: var(--muted-strong);
  font-size: 12px;
  font-weight: 800;
}

.refund-claim-money {
  margin-top: 12px;
}

.refund-claim-filters {
  grid-template-columns: minmax(260px, 1.6fr) repeat(6, minmax(150px, 1fr)) auto auto;
}

.refund-claim-table td {
  min-width: 130px;
}

.refund-claim-table td:nth-child(5) {
  min-width: 260px;
}

.refund-monitor-tabs {
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}

.refund-monitor-filters {
  grid-template-columns: minmax(280px, 1.7fr) repeat(7, minmax(130px, 1fr)) auto auto;
}

.bulk-actions-panel {
  display: grid;
  grid-template-columns: minmax(150px, auto) minmax(220px, 280px) minmax(220px, 1fr) auto;
  gap: 10px;
  align-items: center;
  margin: 12px 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.checkbox-inline {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 800;
}

.refund-monitor-table td {
  min-width: 120px;
}

.refund-monitor-table td:nth-child(7) {
  min-width: 260px;
}

.refund-monitor-table td:nth-child(5),
.refund-monitor-table td:nth-child(6),
.refund-monitor-table td:nth-child(9) {
  min-width: 210px;
}

.refund-actions-cell {
  display: grid;
  gap: 6px;
  min-width: 150px;
}

.refund-actions-cell form,
.refund-actions-cell button,
.refund-actions-cell .button {
  width: 100%;
}

.refund-detail-grid {
  grid-template-columns: minmax(0, 1fr) minmax(320px, 0.8fr);
}

.detail-list {
  display: grid;
  grid-template-columns: minmax(130px, 220px) minmax(0, 1fr);
  gap: 10px 14px;
  margin: 0;
}

.detail-list dt {
  color: var(--muted-strong);
  font-size: 12px;
  font-weight: 850;
  text-transform: uppercase;
}

.detail-list dd {
  margin: 0;
  min-width: 0;
}

.detail-list-wide {
  grid-template-columns: minmax(180px, 260px) minmax(0, 1fr);
}

.stacked-form {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}

.stacked-form label {
  display: grid;
  gap: 5px;
  color: var(--muted-strong);
  font-size: 12px;
  font-weight: 850;
}

.stacked-form .checkbox-row {
  display: inline-flex;
  align-items: center;
}

.refund-items-table td:first-child {
  min-width: 300px;
}

.deadline {
  font-weight: 850;
}

.deadline-good {
  color: #166534;
}

.deadline-warning {
  color: #9a3412;
}

.deadline-bad {
  color: #991b1b;
}

.deadline-unknown {
  color: var(--muted);
}

.claim-status-stack {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

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

.vertical-actions form,
.vertical-actions button {
  width: 100%;
}

.delta-positive {
  color: var(--accent-dark);
  font-weight: 800;
}

.delta-negative {
  color: var(--danger);
  font-weight: 800;
}

.quality-detail-grid {
  grid-template-columns: minmax(0, 1.4fr) minmax(320px, 0.8fr);
}

.analytics-tabs {
  margin-bottom: 16px;
}

.analytics-filter-panel {
  display: grid;
  grid-template-columns: minmax(180px, 240px) minmax(260px, 1.2fr) minmax(180px, 220px) minmax(150px, 170px) minmax(150px, 170px) auto;
  gap: 10px;
  align-items: end;
  margin-bottom: 16px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.analytics-filter-panel > label,
.analytics-account-picker {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.analytics-filter-panel label > span,
.analytics-account-picker > span {
  color: var(--muted-strong);
  font-size: 12px;
  font-weight: 850;
}

.analytics-account-picker select[multiple] {
  min-height: 156px;
  padding: 6px;
}

.analytics-account-picker small {
  color: var(--muted);
}

.analytics-date-menu {
  align-self: end;
  width: 100%;
}

.analytics-filter-actions {
  display: flex;
  align-items: stretch;
  gap: 8px;
  flex-wrap: wrap;
}

.mini-button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.mini-button-row button {
  min-height: 30px;
  padding: 5px 8px;
  font-size: 12px;
}

.analytics-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 14px;
}

.analytics-card {
  margin-bottom: 14px;
}

.analytics-js-chart {
  width: 100%;
  min-height: 350px;
  padding: 4px 0 0;
  outline: none;
}

.chart-loading {
  min-height: 280px;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-weight: 800;
}

.chart-js-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin: 0 0 8px 2px;
}

.chart-js-legend span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--muted-strong);
  font-size: 13px;
  font-weight: 850;
}

.chart-js-legend i {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: var(--chart-color);
}

.chart-js-meta {
  margin: 0 0 8px 2px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
}

.chart-js-frame {
  width: 100%;
  overflow: hidden;
}

.analytics-chart-svg {
  display: block;
  max-width: 100%;
  height: auto;
  overflow: visible;
}

.chart-axis-line {
  stroke: #94a3b8;
  stroke-width: 1;
}

.chart-grid-line-vertical {
  stroke: #e8edf3;
}

.chart-series-line {
  filter: drop-shadow(0 1px 1px rgba(15, 23, 42, 0.08));
}

.analytics-chart-hit {
  cursor: crosshair;
  transition: r 0.16s ease, opacity 0.16s ease;
}

.analytics-chart-hit:hover {
  opacity: 0.9;
}

.analytics-chart-scroll {
  width: 100%;
  overflow: hidden;
  padding: 8px 0 4px;
  cursor: zoom-in;
}

.analytics-line-chart {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  height: auto;
  display: block;
  overflow: visible;
}

.analytics-line-chart rect {
  opacity: 0.86;
}

.analytics-line-chart rect:hover {
  opacity: 1;
}

.chart-grid-line {
  stroke: #dbe3ec;
  stroke-width: 1;
}

.chart-axis-label {
  fill: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.chart-y-label {
  fill: #334155;
  font-size: 11px;
  font-weight: 850;
}

.chart-x-label {
  fill: #334155;
  font-size: 12px;
  font-weight: 850;
}

.chart-point-label {
  font-size: 12px;
  font-weight: 900;
  paint-order: stroke;
  stroke: #fff;
  stroke-width: 4px;
  stroke-linejoin: round;
}

.analytics-card .chart-point-label {
  display: none;
}

.analytics-chart-point,
.analytics-chart-bar {
  cursor: crosshair;
}

.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 8px;
}

.chart-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted-strong);
  font-size: 13px;
  font-weight: 850;
}

.chart-legend i {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--chart-color);
}

.chart-range-note {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  margin: -2px 0 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.chart-range-note strong {
  color: var(--text);
}

.chart-expand-button {
  min-height: 30px;
  padding: 5px 10px;
  font-size: 12px;
}

.chart-modal-open {
  overflow: hidden;
}

.chart-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: none;
}

.chart-modal.is-open {
  display: block;
}

.chart-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.72);
}

.chart-modal-panel {
  position: absolute;
  inset: 20px;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  overflow: hidden;
  border: 1px solid rgba(203, 213, 225, 0.9);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: 0 24px 80px rgba(15, 23, 42, 0.38);
}

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

.chart-modal-head h2 {
  margin: 0;
  font-size: 22px;
}

.chart-modal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chart-modal-actions button {
  min-height: 34px;
  padding: 6px 10px;
}

.chart-modal-frame {
  min-height: 0;
  overflow: auto;
  padding: 16px;
  background: #f8fafc;
}

.chart-modal-content {
  min-width: 920px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.chart-modal-content.is-modal-chart {
  width: max-content;
  min-width: min(1180px, 100%);
}

.chart-modal-content.is-modal-chart .chart-js-frame {
  overflow: visible;
}

.chart-modal-content.is-modal-chart .analytics-chart-svg {
  max-width: none;
}

.chart-modal-content .chart-point-label {
  display: block;
}

.chart-modal-content svg {
  display: block;
  transform-origin: top left;
}

.chart-tooltip {
  position: fixed;
  z-index: 1100;
  max-width: min(360px, calc(100vw - 24px));
  padding: 8px 10px;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  background: #0f172a;
  color: #fff;
  font-size: 12px;
  font-weight: 850;
  line-height: 1.35;
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.24);
  pointer-events: none;
}

.analytics-stacked-list {
  display: grid;
  gap: 7px;
  max-height: 420px;
  overflow: auto;
  padding-right: 4px;
}

.analytics-stacked-row {
  display: grid;
  grid-template-columns: 54px minmax(160px, 1fr) minmax(180px, auto);
  gap: 10px;
  align-items: center;
}

.analytics-stacked-row > span {
  color: var(--muted-strong);
  font-weight: 850;
}

.analytics-stacked-row > strong {
  color: var(--muted-strong);
  font-size: 12px;
}

.analytics-stacked-bar {
  height: 22px;
  display: flex;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #f1f5f9;
}

.analytics-stacked-bar i {
  display: block;
  min-width: 0;
}

.stack-good { background: #22c55e; }
.stack-bad { background: #ef4444; }
.stack-unknown { background: #cbd5e1; }

.analytics-table-panel {
  margin-bottom: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.inside-table-head {
  padding: 12px 14px 0;
}

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

.table-actions form {
  margin: 0;
}

.danger-button {
  border-color: #fecaca;
  background: #fef2f2;
  color: var(--danger);
}

.danger-button:hover {
  border-color: #fca5a5;
}

.empty-cell {
  color: var(--muted);
  text-align: center;
}

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

.section-head h2 { margin-bottom: 0; }

.refund-orders {
  display: grid;
  gap: 14px;
  margin-bottom: 18px;
}

.refund-order-card {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.refund-order-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 0.8fr);
  gap: 16px;
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.refund-order-head h2 {
  margin-bottom: 4px;
  font-size: 20px;
}

.refund-order-meta {
  display: grid;
  gap: 6px;
  color: var(--muted-strong);
  font-size: 13px;
}

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

.refund-order-form {
  display: grid;
  gap: 12px;
}

.refund-provider-wallets {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: -4px 0 12px;
  padding: 10px;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  background: #eff6ff;
}

.refund-provider-wallets strong {
  color: #1e3a8a;
}

.refund-funds-strip {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
}

.refund-line-list {
  display: grid;
  gap: 8px;
}

.refund-line-item {
  display: grid;
  grid-template-columns: 22px 74px minmax(0, 1fr) minmax(92px, 120px) minmax(150px, 180px) minmax(170px, 210px);
  gap: 12px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.refund-line-item:has(input[type="checkbox"]:checked) {
  border-color: var(--accent);
  background: #ecfdf5;
}

.refund-thumb {
  width: 74px;
  height: 58px;
  object-fit: contain;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

.refund-thumb-placeholder {
  display: inline-grid;
  place-items: center;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-align: center;
}

.refund-line-main {
  display: grid;
  gap: 4px;
}

.refund-line-main strong {
  line-height: 1.25;
}

.refund-line-main small,
.refund-line-quantity small,
.refund-line-unit small,
.refund-line-price small {
  color: var(--muted-strong);
}

.refund-line-quantity {
  display: grid;
  gap: 4px;
}

.refund-line-unit {
  display: grid;
  gap: 4px;
}

.refund-line-unit > span {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px;
  align-items: center;
}

.refund-line-price {
  display: grid;
  gap: 4px;
}

.refund-line-price > span {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px;
  align-items: center;
}

.refund-line-price em {
  color: var(--muted-strong);
  font-style: normal;
  font-weight: 850;
}

.refund-line-unit em {
  color: var(--muted-strong);
  font-style: normal;
  font-weight: 850;
}

.refund-action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: flex-end;
}

.refund-action-row input {
  flex: 1 1 280px;
}

.refund-action-row select {
  flex: 0 1 220px;
}

.refund-live-summary {
  flex: 1 1 320px;
  min-height: 42px;
  display: grid;
  gap: 2px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.refund-live-summary strong {
  font-size: 14px;
}

.refund-live-summary span {
  color: var(--muted-strong);
  font-size: 12px;
  font-weight: 800;
}

.refund-live-summary.is-ok {
  border-color: #86efac;
  background: #ecfdf5;
}

.refund-live-summary.is-ok span {
  color: #166534;
}

.refund-live-summary.is-warning {
  border-color: #fecaca;
  background: #fef2f2;
}

.refund-live-summary.is-warning span {
  color: #991b1b;
}

.refund-monitor-panel {
  overflow-x: visible;
}

.refund-monitor-table {
  table-layout: fixed;
}

.refund-monitor-table th,
.refund-monitor-table td {
  overflow-wrap: anywhere;
}

.refund-monitor-table .col-select {
  width: 42px;
}

.refund-monitor-table .col-date {
  width: 116px;
}

.refund-monitor-table .col-status {
  width: 120px;
}

.refund-monitor-table .col-account {
  width: 150px;
}

.refund-monitor-table .col-client {
  width: 150px;
}

.refund-monitor-table .col-products {
  width: auto;
}

.refund-monitor-table .col-amount {
  width: 120px;
}

.refund-monitor-table .col-funds {
  width: 220px;
}

.refund-order-link {
  display: inline-block;
  margin-bottom: 5px;
}

.refund-product-list {
  display: grid;
  gap: 5px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.refund-product-list li {
  display: grid;
  gap: 2px;
}

.refund-product-list strong {
  line-height: 1.25;
}

.refund-product-list span,
.refund-monitor-table small {
  color: var(--muted-strong);
  font-size: 12px;
  font-weight: 750;
}

.refund-inline-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.refund-inline-actions form {
  margin: 0;
}

.refund-inline-actions button {
  white-space: nowrap;
}

.claim-detail-list {
  display: grid;
  gap: 10px;
  margin: 0;
}

.claim-detail-list > div {
  display: grid;
  grid-template-columns: 170px minmax(0, 1fr);
  gap: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.claim-detail-list dt {
  color: var(--muted-strong);
  font-weight: 850;
}

.claim-detail-list dd {
  margin: 0;
}

.appeal-form {
  display: grid;
  gap: 10px;
}

.appeal-form label {
  display: grid;
  gap: 5px;
  color: var(--muted-strong);
  font-weight: 850;
}

.appeal-form textarea {
  width: 100%;
  resize: vertical;
}

.attachment-list {
  display: grid;
  gap: 7px;
}

.list-line {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 7px 0;
  border-bottom: 1px solid var(--line);
  color: var(--text);
}

.list-line:last-child { border-bottom: 0; }
.list-line span { color: var(--muted); }

.mini-action {
  font-weight: 800;
  white-space: nowrap;
}

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

.empty-state strong {
  display: block;
  margin-bottom: 4px;
  color: var(--text);
}

.flash {
  max-width: 1480px;
  margin: 14px auto 0;
  padding: 0 26px;
}

.flash-item {
  padding: 10px 12px;
  border-radius: 6px;
  background: #eef2ff;
  border: 1px solid #c7d2fe;
}

.flash-item.error { background: #fef2f2; border-color: #fecaca; color: var(--danger); }
.flash-item.success { background: #ecfdf5; border-color: #bbf7d0; color: var(--accent-dark); }
.flash-item.warning { background: #fff7ed; border-color: #fed7aa; color: var(--amber); }

.form p { margin-bottom: 12px; }
.form label {
  display: block;
  color: var(--text);
  font-weight: 750;
  margin-bottom: 5px;
}

.form-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.form #id_color {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 6px 0 12px;
}

.form #id_color > div {
  margin: 0;
}

.form #id_color label {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-soft);
  cursor: pointer;
  font-weight: 750;
}

.status-color-radio {
  width: 18px;
  height: 18px;
  min-height: 18px;
  padding: 0;
  border: 2px solid #fff;
  border-radius: 999px;
  outline: 1px solid var(--line-strong);
  appearance: none;
  background: var(--swatch);
}

.status-color-radio:checked {
  outline: 3px solid rgba(15, 118, 110, 0.28);
}

.auth-panel {
  width: min(420px, calc(100vw - 32px));
  margin: 9vh auto;
  box-shadow: var(--shadow);
}

.form-panel {
  max-width: 760px;
  box-shadow: var(--shadow);
}

.knowledge-summary {
  grid-template-columns: repeat(6, minmax(150px, 1fr));
}

.knowledge-layout {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}

.knowledge-category-panel {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.knowledge-category-panel h3 {
  margin: 14px 0 7px;
  color: var(--muted-strong);
  font-size: 12px;
  text-transform: uppercase;
}

.knowledge-category-link {
  display: grid;
  gap: 2px;
  padding: 8px 9px;
  border-radius: 6px;
  color: var(--text);
}

.knowledge-category-link:hover,
.knowledge-category-link.active {
  background: #ecfdf5;
  color: var(--accent-dark);
}

.knowledge-table td:first-child {
  min-width: 320px;
}

.knowledge-scope,
.knowledge-status,
.knowledge-ai-ready {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 850;
  line-height: 1;
}

.knowledge-scope-private {
  background: #eef2ff;
  color: #3730a3;
}

.knowledge-scope-company {
  background: #ecfdf5;
  color: var(--accent-dark);
}

.knowledge-status-ok,
.knowledge-ai-ready {
  background: #dcfce7;
  color: #166534;
}

.knowledge-status-warning {
  background: #ffedd5;
  color: #9a3412;
}

.knowledge-status-danger {
  background: #fee2e2;
  color: #991b1b;
}

.knowledge-status-muted {
  background: #e5e7eb;
  color: #374151;
}

.knowledge-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 7px;
}

.knowledge-tags span {
  padding: 3px 7px;
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--muted-strong);
  font-size: 12px;
  font-weight: 750;
}

.knowledge-detail-layout {
  grid-template-columns: minmax(0, 1fr) 340px;
}

.knowledge-article-body {
  display: grid;
  gap: 18px;
}

.knowledge-article-body h2,
.knowledge-category-panel h2 {
  margin: 0 0 8px;
}

.knowledge-content {
  max-width: 880px;
  font-size: 15px;
  line-height: 1.65;
  white-space: normal;
}

.knowledge-summary-box {
  padding: 12px;
  border: 1px solid #bbf7d0;
  border-radius: 8px;
  background: #ecfdf5;
}

.knowledge-review-note {
  border-color: #fed7aa;
  background: #fff7ed;
}

.knowledge-reject-form {
  margin-top: 12px;
}

.knowledge-form-panel {
  max-width: 980px;
}

.form-grid.two {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.meta-box p { overflow-wrap: anywhere; }

@media (max-width: 1080px) {
  .sidebar {
    width: 210px;
  }
  .metric-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .detail-layout,
  .settings-grid,
  .analytics-grid,
  .analytics-filter-panel,
  .knowledge-layout,
  .knowledge-detail-layout {
    grid-template-columns: 1fr;
  }
  .refund-order-head,
  .refund-line-item,
  .claim-detail-list > div {
    grid-template-columns: 1fr;
  }
  .refund-line-item {
    align-items: start;
  }
  .quality-alert-strip {
    grid-template-columns: 1fr;
  }
  .analytics-stacked-row {
    grid-template-columns: 54px minmax(120px, 1fr);
  }
  .analytics-stacked-row > strong {
    grid-column: 2;
  }
  .side-panel {
    position: static;
  }
}

@media (max-width: 760px) {
  .app-shell {
    display: block;
  }
  .sidebar {
    position: static;
    width: 100%;
    min-height: 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  }
  .side-nav {
    flex-direction: row;
    overflow-x: auto;
  }
  .sidebar-footer {
    display: none;
  }
  .page {
    padding: 16px;
  }
  .readonly-session-bar {
    margin-top: 12px;
    padding: 0 16px;
    justify-content: flex-start;
    flex-wrap: wrap;
  }
  .toolbar {
    flex-direction: column;
  }
  .filters,
  .ticket-row,
  .bulk-bar,
  .metric-strip,
  .form-grid.two {
    grid-template-columns: 1fr;
  }
  .filter-actions,
  .ticket-nav,
  .ticket-nav > div {
    flex-direction: column;
  }
  .date-menu {
    flex: 1 1 100%;
  }
  .date-menu-panel {
    width: min(330px, calc(100vw - 32px));
  }
  .ticket-side {
    align-items: flex-start;
    text-align: left;
  }
  .message {
    max-width: 100%;
  }
}
