* { box-sizing: border-box; }

/* Atrybut hidden musi wygrywac z kazdym naszym display:flex/grid itp. -
   bez !important reguly autora przebijaja domyslne [hidden]{display:none}
   przegladarki i "ukryte" elementy (np. panele edycji kafelkow) sa widoczne. */
[hidden] { display: none !important; }

body {
  font-family: -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  margin: 0;
  background: #f4f5f7;
  color: #1c1c1e;
}

.topbar {
  background: #1c2530;
  color: white;
  display: flex;
  align-items: center;
  padding: 0 24px;
  height: 56px;
}
.logo { font-weight: 700; font-size: 18px; margin-right: 32px; }
.version-badge {
  font-size: 11px;
  font-weight: 400;
  color: #8fa0b3;
  vertical-align: middle;
}
.topbar nav a {
  color: #b8c0cc;
  text-decoration: none;
  margin-right: 20px;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 14px;
}
.topbar nav a.active, .topbar nav a:hover { background: #33465c; color: white; }

main { max-width: 1100px; margin: 24px auto; padding: 0 16px; }

.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }

/* Reakcja na klikniecie: kazdy przycisk lekko "wciska sie" i blyska, wyslany formularz pokazuje kolko */
button, .refresh-btn, .quick-reply-chip { transition: transform .08s ease, filter .08s ease, box-shadow .12s ease; }
button:active, .refresh-btn:active, .quick-reply-chip:active { transform: scale(.96); filter: brightness(.92); }
.is-pressed { animation: press-flash .45s ease-out; }
@keyframes press-flash {
  0% { box-shadow: 0 0 0 0 rgba(255, 90, 0, .55); transform: scale(.96); }
  100% { box-shadow: 0 0 0 10px rgba(255, 90, 0, 0); transform: scale(1); }
}
.is-busy { opacity: .75; cursor: progress; }
.spinner {
  display: inline-block; width: 12px; height: 12px; border: 2px solid currentColor; border-right-color: transparent;
  border-radius: 50%; vertical-align: -2px; animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.inline-form { display: inline; margin: 0; }
.undo-btn { cursor: pointer; font-family: inherit; }
.refresh-btn {
  color: #dfe6ee;
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 6px;
  padding: 6px 12px;
  font-size: 13px;
  text-decoration: none;
  white-space: nowrap;
}
.refresh-btn:hover { background: rgba(255,255,255,.16); color: white; }
.flash { background: #d4edda; color: #155724; padding: 10px 16px; border-radius: 6px; margin-bottom: 16px; }
.flash.error { background: #f8d7da; color: #721c24; }
.error-card { max-width: 900px; }
.error-details { white-space: pre-wrap; word-break: break-word; background: #f7f8fa; border: 1px solid #e3e7ec; border-radius: 6px; padding: 12px; font-size: 13px; }
.error-box { background: #f8d7da; color: #721c24; padding: 10px 16px; border-radius: 6px; margin-bottom: 16px; }

.orders-bar {
  background: white;
  border-radius: 10px;
  padding: 16px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  box-shadow: 0 1px 3px rgba(0,0,0,.08);
}
.orders-count { font-size: 24px; font-weight: 700; margin-right: 6px; }
.orders-amount { color: #2e7d32; font-weight: 600; margin-left: 12px; }
.orders-sources { display: flex; gap: 8px; }
.source-pill {
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  color: white;
  background: #888;
}
.source-pill.source-allegro { background: #ff5a00; }
.source-pill.source-shop { background: #2e7d32; }
.source-pill.source-empik { background: #e30613; }
.source-pill.source-erli_connector { background: #7b2ff7; }
.source-pill.source-blconnect { background: #607d8b; }
.source-pill.source-email { background: #2e7d32; }

.sprawy-list { display: flex; flex-direction: column; gap: 6px; }
.sprawa-row {
  display: flex;
  align-items: center;
  gap: 14px;
  background: white;
  padding: 12px 16px;
  border-radius: 8px;
  text-decoration: none;
  color: #1c1c1e;
  box-shadow: 0 1px 2px rgba(0,0,0,.06);
}
.sprawa-row.unread { border-left: 4px solid #ff5a00; font-weight: 600; }
.sprawa-row.overdue .age-flag { color: white; background: #d32f2f; padding: 2px 8px; border-radius: 999px; font-size: 11px; margin-left: 8px; }

.avatar {
  width: 32px; height: 32px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: white; font-weight: 700; flex-shrink: 0;
}
.avatar.source-allegro { background: #ff5a00; }
.avatar.source-empik { background: #e30613; }
.avatar.source-erli_connector { background: #7b2ff7; }
.avatar.source-email { background: #2e7d32; }

.row-main { flex: 1; display: flex; align-items: center; gap: 24px; min-width: 0; }
.row-top { flex: 1; display: flex; align-items: baseline; justify-content: flex-start; gap: 12px; min-width: 0; }
.row-bottom { display: flex; align-items: center; gap: 16px; flex-shrink: 0; }

/* Nazwa klienta ma stala szerokosc, wiec data zaczyna sie tuz za nia i we wszystkich
   wierszach konczy w tym samym miejscu (wyrownana do prawej); plakietka dni ma wlasna
   kolumne, zeby nie przesuwac daty. */
.client { flex: 0 1 300px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.date { flex: 0 0 130px; color: #666; font-size: 13px; white-space: nowrap; text-align: right; }
.age-slot { flex: 0 0 70px; white-space: nowrap; }
.age-slot .age-flag { margin-left: 0; }

/* Podglad ostatniej wymiany po najechaniu na symbol kanalu */
.avatar { cursor: help; }
.preview-pop {
  position: absolute; z-index: 50; width: 460px; max-width: calc(100vw - 32px);
  background: white; border: 1px solid #dbe0e6; border-radius: 10px; box-shadow: 0 8px 24px rgba(0,0,0,.14);
  padding: 12px 14px; font-size: 13px; line-height: 1.45; color: #222; font-weight: 400;
}
.preview-pop .preview-head { font-size: 11px; text-transform: uppercase; letter-spacing: .5px; color: #8fa0b3; margin-bottom: 2px; }
.preview-pop .preview-head strong { color: #33465c; }
.preview-pop .preview-text { white-space: pre-wrap; word-break: break-word; background: #f7f8fa; border-radius: 6px; padding: 8px 10px; margin-bottom: 10px; }
.preview-pop .preview-mine .preview-text { background: #e3f2fd; }
.preview-pop .preview-reply .preview-text { background: #fff8e1; }
.preview-pop .preview-info { color: #7a5a00; font-weight: 600; }
.preview-pop .preview-muted { color: #888; }
/* Stale szerokosci kolumn - typ, ikonki, status - zeby wiersze byly wyrownane niezaleznie od tego,
   ktore ikonki sie pojawiaja. */
.type-label { width: 150px; flex-shrink: 0; font-size: 13px; color: #444; }
.flags-slot { width: 170px; flex-shrink: 0; display: inline-flex; align-items: center; gap: 6px; }
.flags-slot .note-flag { margin-left: 0; }
.status-label { width: 240px; flex-shrink: 0; font-size: 12px; color: #444; text-align: right; font-weight: 600; white-space: nowrap; }
.status-label.status-new { color: #d32f2f; }
.status-label.status-customer_replied { color: #c2185b; }
.status-label.status-auto_replied { color: #d32f2f; }
.auto-badge {
  display: inline-block; width: 18px; height: 18px; line-height: 18px; text-align: center; margin-right: 6px;
  border-radius: 50%; background: #e6a700; color: white; font-size: 11px; font-weight: 800; vertical-align: middle;
}
.status-label.status-replied { color: #2e7d32; font-weight: 500; }
.status-label.status-advisor_replied { color: #1565c0; font-weight: 500; }
.status-label.status-closed { color: #888; font-weight: 500; }

/* wiadomosci w watku */
.message.is-auto { border-left: 3px solid #e6a700; }
.auto-tag { display: inline-block; font-size: 11px; background: #fff3cd; color: #7a5a00; padding: 1px 7px; border-radius: 999px; }

/* ustawienia */
.settings-form { background: white; border-radius: 10px; padding: 16px 20px; box-shadow: 0 1px 3px rgba(0,0,0,.08); display: flex; flex-direction: column; gap: 14px; margin-bottom: 28px; }
.settings-form fieldset { border: 1px solid #e3e7ec; border-radius: 8px; padding: 10px 14px; display: flex; flex-direction: column; gap: 8px; }
.settings-form legend { font-size: 12px; color: #8fa0b3; text-transform: uppercase; letter-spacing: .5px; padding: 0 6px; }
.settings-form label { font-size: 14px; display: flex; flex-direction: column; gap: 4px; }
.settings-form fieldset label { flex-direction: row; flex-wrap: wrap; align-items: center; gap: 8px; }
.settings-form small { display: block; flex-basis: 100%; font-size: 12px; color: #888; }
.settings-form input[type="number"], .settings-form textarea { padding: 8px 10px; border: 1px solid #ccc; border-radius: 8px; font-family: inherit; font-size: 14px; }
.settings-form input[type="number"] { width: 120px; }
.btn-primary { align-self: flex-start; background: #1c2530; color: white; border: none; padding: 10px 24px; border-radius: 8px; cursor: pointer; }
.candidate-disabled td { color: #aaa; }

/* ===== Mobile ===== */
/* Waskie okno: naglowek zawija sie w uporzadkowane wiersze (logo + przyciski, pod spodem menu),
   zamiast nakladac linki na siebie. */
@media (max-width: 900px) {
  .topbar { flex-wrap: wrap; height: auto; padding: 8px 12px; row-gap: 6px; }
  .logo { margin-right: 12px; font-size: 16px; }
  .topbar nav { order: 3; flex: 1 1 100%; display: flex; flex-wrap: wrap; gap: 4px; }
  .topbar nav a { margin-right: 0; padding: 6px 10px; font-size: 13px; white-space: nowrap; }
  .topbar-actions { order: 2; margin-left: auto; }
  .refresh-btn { padding: 5px 10px; font-size: 12px; }
}

/* Srednia szerokosc (okno zwezone, ale nie telefon): wiersz Skrzynki nie miesci obu grup kolumn
   obok siebie (nazwa+data+dni ~500 px, typ+ikonki+status ~560 px) - ukladamy je jedna pod druga,
   zamiast pozwalac im nachodzic na siebie. */
@media (max-width: 1150px) {
  .row-main { flex-direction: column; align-items: stretch; gap: 6px; }
  .row-top { justify-content: flex-start; }
  .client { flex: 1 1 auto; }
  .date { flex: 0 0 auto; }
  .row-bottom { justify-content: flex-start; width: 100%; }
  .status-label { margin-left: auto; }
}

@media (max-width: 640px) {
  main { margin: 12px auto; padding: 0 10px; }
  body { overflow-x: hidden; }

  .lp { display: none; }
  .flags-slot { width: auto; flex-wrap: wrap; }
  .status-label { white-space: normal; }
  .row-bottom { flex-wrap: wrap; gap: 8px; }

  .orders-bar { flex-direction: column; align-items: flex-start; gap: 10px; padding: 14px 16px; }
  .orders-sources { flex-wrap: wrap; }

  .sprawa-row { padding: 14px; gap: 12px; align-items: flex-start; }
  .avatar { width: 38px; height: 38px; font-size: 15px; }
  .row-main { flex-direction: column; align-items: stretch; gap: 6px; }
  .row-top { flex-direction: row; flex-wrap: wrap; }
  .client { flex: 1 1 100%; font-size: 15px; font-weight: 600; white-space: normal; }
  .date { flex: 0 0 auto; font-size: 12px; text-align: left; }
  .age-slot { flex: 0 0 auto; }
  .row-bottom { justify-content: space-between; width: 100%; }
  .type-label, .status-label { width: auto; text-align: left; background: #eef1f5; padding: 3px 10px; border-radius: 6px; font-size: 12px; }

  .channel-row { flex-wrap: wrap; }
  .channel-name { width: auto; flex: 1 1 100%; }
  .channel-status { width: auto; flex: 1 1 100%; }
  .channel-desc { flex: 1 1 100%; }

  .summary-cards { flex-wrap: wrap; gap: 10px; }
  .summary-card { flex: 1 1 calc(50% - 10px); padding: 12px 14px; }

  .reply-form { flex-direction: column; }
  .reply-form textarea { min-height: 120px; font-size: 16px; }   /* 16px: iPhone nie przybliza pola */
  .reply-form button { padding: 14px 24px; font-size: 16px; }
  .reply-form .quick-reply-chip { padding: 9px 12px; font-size: 14px; }
  .reply-form .quick-reply-edit-btn { padding: 9px 8px; }
  .message { max-width: 96%; }
  .message-text, .question-text { font-size: 16px; }
  .archive-box .secondary-btn { padding: 10px 12px; }
  .note-form input[type=text] { font-size: 16px; }
  .preview-pop { width: calc(100vw - 24px); left: 12px !important; }
  .customer-panel { gap: 10px; }
  .topbar-actions .refresh-btn { padding: 7px 10px; }
  .back-link { display: inline-block; padding: 6px 0; }

  .orders-table thead { display: none; }
  .orders-table, .orders-table tbody, .orders-table tr, .orders-table td { display: block; width: 100%; }
  .orders-table tr { background: white; margin-bottom: 10px; border-radius: 8px; padding: 6px 0; box-shadow: 0 1px 2px rgba(0,0,0,.06); }
  .orders-table td { display: flex; justify-content: space-between; border-bottom: none; padding: 6px 14px; }
  .orders-table td::before { content: attr(data-label); color: #888; font-size: 12px; }
}

.back-link { display: inline-block; margin-bottom: 16px; color: #33465c; text-decoration: none; }

h2 { overflow-wrap: anywhere; }

.thread { display: flex; flex-direction: column; gap: 10px; margin-bottom: 20px; }
.message { background: white; padding: 10px 14px; border-radius: 8px; max-width: 70%; }
.message.from-me { align-self: flex-end; background: #dff0ff; }
.message.from-client { align-self: flex-start; }
.message-meta { font-size: 12px; color: #888; margin-bottom: 4px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

.case-age { margin: 0 0 16px 0; }
.elapsed-pill {
  display: inline-block;
  font-size: 12px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 999px;
  color: white;
  white-space: nowrap;
}
.elapsed-pill.elapsed-start { background: #607d8b; }
.elapsed-pill.elapsed-fast { background: #2e7d32; }
.elapsed-pill.elapsed-medium { background: #e6a700; }
.elapsed-pill.elapsed-slow { background: #d32f2f; }
.message-text { white-space: pre-wrap; }

.reply-form { display: flex; flex-direction: column; gap: 8px; }
.reply-form textarea { min-height: 70px; padding: 10px; border-radius: 8px; border: 1px solid #ccc; font-family: inherit; }
.quick-replies { display: flex; flex-wrap: wrap; gap: 6px; }
.quick-reply-item {
  position: relative;
  display: inline-flex;
  align-items: stretch;
  background: #eef1f5;
  border: 1px solid #dbe0e6;
  border-radius: 999px;
}
.reply-form .quick-reply-chip {
  background: transparent;
  border: none;
  color: #33465c;
  font-size: 12px;
  padding: 5px 6px 5px 12px;
  cursor: pointer;
  border-radius: 999px 0 0 999px;
}
.reply-form .quick-reply-chip:hover { background: #dde3ea; }
.reply-form .quick-reply-edit-btn {
  background: transparent;
  border: none;
  border-left: 1px solid #dbe0e6;
  color: #8fa0b3;
  font-size: 13px;
  padding: 5px 10px;
  cursor: pointer;
  line-height: 1;
  border-radius: 0 999px 999px 0;
}
.reply-form .quick-reply-edit-btn:hover { background: #dde3ea; color: #33465c; }

.quick-reply-edit-panel {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  z-index: 30;
  width: 260px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: white;
  border: 1px solid #dbe0e6;
  border-radius: 8px;
  padding: 10px;
  box-shadow: 0 4px 14px rgba(0,0,0,.14);
}
.quick-reply-edit-panel input[type="text"],
.quick-reply-edit-panel textarea.qr-edit-text {
  border: 1px solid #ccc;
  border-radius: 6px;
  padding: 6px 8px;
  font-family: inherit;
  font-size: 13px;
  width: 100%;
  box-sizing: border-box;
}
.quick-reply-edit-panel textarea.qr-edit-text { min-height: 70px; resize: vertical; }
.quick-reply-chip { cursor: grab; }
.quick-reply-item.dragging { opacity: .45; }
.paste-hint { font-size: 12px; color: #2e7d32; margin-left: 8px; }

/* ===== Uwagi (prywatne notatki do rozmowy) ===== */
.notes-box { background: #fffbea; border: 1px solid #f0dc9a; border-radius: 10px; padding: 12px 16px; margin: 16px 0; }
.notes-box h3 { margin: 0 0 8px; font-size: 14px; display: flex; align-items: center; gap: 8px; }
.notes-count { background: #7a5a00; color: white; border-radius: 999px; font-size: 11px; padding: 1px 7px; }
.notes-list { list-style: none; padding: 0; margin: 0 0 10px; display: flex; flex-direction: column; gap: 8px; }
.notes-list li { background: white; border: 1px solid #f0e2b0; border-radius: 8px; padding: 8px 10px; }
.note-head { display: flex; justify-content: space-between; align-items: center; }
.note-time { font-size: 11px; color: #8a7a4a; }
.note-delete-form { margin: 0; }
.note-delete { background: none; border: none; color: #999; font-size: 16px; line-height: 1; cursor: pointer; padding: 0 4px; }
.note-delete:hover { color: #b3261e; }
.note-text { font-size: 13px; line-height: 1.45; white-space: pre-wrap; margin-top: 2px; }
.note-files { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.note-thumb { max-height: 90px; max-width: 160px; border: 1px solid #e3e7ec; border-radius: 4px; display: block; }
.note-file { font-size: 12px; color: #33465c; text-decoration: none; background: #f2f4f7; border-radius: 6px; padding: 3px 8px; }
.note-file:hover { text-decoration: underline; }
.note-form { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.note-form input[type=text] { flex: 1 1 320px; padding: 8px 10px; border: 1px solid #d9dee5; border-radius: 6px; font-size: 13px; }
.note-form button { background: #7a5a00; color: white; border: none; border-radius: 6px; padding: 8px 14px; font-size: 13px; cursor: pointer; }
.note-form button:hover { background: #5f4600; }
.note-file-label { font-size: 13px; }
.note-form .attachment-hint { flex-basis: 100%; margin: 0; font-size: 11px; color: #8a7a4a; }
.message-subject { font-size: 12px; color: #666; margin-bottom: 4px; }
/* Mail z formularza kontaktowego: dane nadawcy drobne, samo pytanie duze i wyroznione */
.form-fields { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: 12px; color: #6b7a8a; margin-bottom: 10px; }
.form-key { color: #9aa7b4; }
.question-label { font-size: 11px; text-transform: uppercase; letter-spacing: .5px; color: #ff5a00; font-weight: 700; margin-bottom: 4px; }
.question-text {
  font-size: 17px; line-height: 1.5; white-space: pre-wrap; word-break: break-word; color: #111;
  background: #fff7f2; border-left: 4px solid #ff5a00; border-radius: 6px; padding: 12px 14px;
}
.form-footer { font-size: 11px; color: #9aa7b4; margin-top: 10px; }
.message-attachments { margin-top: 6px; display: flex; flex-wrap: wrap; gap: 6px; }
.returned-flag { font-size: 10px; background: #e8eaf6; color: #283593; border: 1px solid #c5cae9; border-radius: 999px; padding: 0 5px; line-height: 14px; white-space: nowrap; align-self: center; }
.archive-box { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; margin: 4px 0 14px; }
.archive-state { font-size: 13px; color: #283593; font-weight: 600; }
.marketing-state { color: #6d4c41; }
.archive-btn { background: #e3f2fd; border-color: #90caf9; color: #0d47a1; box-shadow: 0 1px 3px rgba(13,71,161,.15); }
.archive-btn:hover { background: #bbdefb; }
.lp { width: 34px; flex-shrink: 0; text-align: right; font-size: 12px; color: #9aa7b4; font-weight: 400; }
.rows-summary { margin: 0 0 8px; font-size: 13px; color: #666; }
.rows-count { font-size: 13px; font-weight: 600; color: #8fa0b3; margin-left: 6px; }
.secondary-btn { background: #eef1f5; color: #33465c; border: 1px solid #d9dee5; border-radius: 6px; padding: 6px 12px; font-size: 13px; cursor: pointer; font-family: inherit; }
.secondary-btn:hover { background: #e3e7ec; }
.confirm-btn.armed { background: #d32f2f !important; color: white !important; border-color: #d32f2f !important; }
.page-title { margin: 0 0 4px; }

/* ===== Zwroty Allegro ===== */
.zwroty-filters { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0 16px; }
.filter-pill { background: white; border: 1px solid #d9dee5; border-radius: 999px; padding: 6px 14px; font-size: 13px; color: #33465c; text-decoration: none; }
.filter-pill span { color: #8fa0b3; margin-left: 4px; font-weight: 600; }
.filter-pill.active { background: #1c2530; border-color: #1c2530; color: white; }
.filter-pill.active span { color: #cfd8e3; }
.filter-pill.attention:not(.active) { border-color: #ff5a00; color: #c24400; }
.zwroty-list { display: flex; flex-direction: column; gap: 12px; }
.zwrot-card { background: white; border-radius: 10px; padding: 16px 20px; box-shadow: 0 1px 3px rgba(0,0,0,.08); border-left: 4px solid transparent; }
.zwrot-card.needs-action { border-left-color: #ff5a00; }
.zwrot-card.rejected { border-left-color: #b3261e; }
.zwrot-head { display: flex; flex-wrap: wrap; gap: 12px 32px; align-items: flex-end; padding-bottom: 12px; border-bottom: 1px solid #eef1f5; }
.zwrot-head > div { display: flex; flex-direction: column; gap: 2px; font-size: 14px; }
.zwrot-label { font-size: 11px; color: #8fa0b3; text-transform: uppercase; letter-spacing: .4px; }
.zwrot-number { font-size: 16px; }
.zwrot-status { margin-left: auto; align-self: center; font-size: 12px; font-weight: 700; padding: 4px 12px; border-radius: 999px; background: #eef1f5; color: #33465c; white-space: nowrap; }
.zwrot-status.status-doreczone { background: #fff0e6; color: #c24400; }
.zwrot-status.status-w_drodze { background: #e3f2fd; color: #0d47a1; }
.zwrot-status.status-zgloszone { background: #fff8e1; color: #7a5a00; }
.zwrot-status.status-zakonczone { background: #e8f5e9; color: #2e7d32; }
.zwrot-card.rejected .zwrot-status { background: #fdecea; color: #b3261e; }
.zwrot-items { list-style: none; margin: 12px 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.zwrot-item-main { font-size: 14px; }
.zwrot-item-main a { color: #222; text-decoration: none; }
.zwrot-item-main a:hover { text-decoration: underline; }
.zwrot-reason { font-size: 13px; color: #444; margin-top: 2px; }
.zwrot-body { display: grid; grid-template-columns: minmax(220px, 1fr) minmax(0, 2fr); gap: 20px; padding-top: 12px; border-top: 1px solid #eef1f5; }
.zwrot-steps { list-style: none; margin: 0; padding: 0 0 0 4px; }
.zwrot-steps li { position: relative; padding: 0 0 12px 22px; font-size: 13px; color: #9aa7b4; border-left: 2px solid #e3e7ec; margin-left: 5px; }
.zwrot-steps li:last-child { border-left-color: transparent; padding-bottom: 0; }
.zwrot-steps li::before { content: ""; position: absolute; left: -7px; top: 2px; width: 12px; height: 12px; border-radius: 50%; background: #d9dee5; }
.zwrot-steps li.done { color: #33465c; border-left-color: #3f5bd9; }
.zwrot-steps li.done::before { background: #3f5bd9; }
.zwrot-steps li.current { color: #111; font-weight: 700; }
.zwrot-steps li.current::before { background: #3f5bd9; box-shadow: 0 0 0 3px rgba(63,91,217,.2); }
.zwrot-steps li.rejected-step::before { background: #b3261e; box-shadow: 0 0 0 3px rgba(179,38,30,.2); }
.zwrot-details { display: flex; flex-direction: column; gap: 6px; font-size: 13px; }
.zwrot-details a { color: #33465c; }
.waybill { font-family: Consolas, monospace; user-select: all; }
.zwrot-total { font-weight: 700; margin-top: 4px; }
.zwrot-banner { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; background: #fff8e1; border: 1px solid #f0d78c; border-radius: 10px; padding: 10px 14px; margin: 0 0 14px; font-size: 13px; }
.zwrot-banner.needs-action { background: #fff0e6; border-color: #ffb98a; }
.zwrot-banner .zwrot-status { margin-left: 0; }
.zwrot-banner-reason { color: #444; }
.zwrot-flag { font-size: 10px; background: #fff8e1; color: #7a5a00; border: 1px solid #f0d78c; border-radius: 999px; padding: 0 5px; line-height: 14px; white-space: nowrap; align-self: center; cursor: help; }
.zwrot-flag.needs-action { background: #fff0e6; color: #c24400; border-color: #ffb98a; }
@media (max-width: 640px) {
  .zwrot-body { grid-template-columns: 1fr; }
  .zwrot-status { margin-left: 0; }
}
.field-group { border: 1px solid #e3e7ec; border-radius: 10px; padding: 12px 16px 16px; margin: 0 0 16px; }
.field-group legend { font-weight: 700; padding: 0 6px; }
.field-row { display: flex; flex-wrap: wrap; gap: 12px 20px; align-items: flex-end; }
.field-row .field { flex: 0 0 auto; }
.field-row small { flex-basis: 100%; }
.error-text { color: #b3261e; }
.login-card { max-width: 420px; margin: 60px auto; background: white; border-radius: 12px; padding: 24px 28px; box-shadow: 0 2px 8px rgba(0,0,0,.08); }
.login-form { display: flex; flex-direction: column; gap: 14px; }
.login-form input[type=password] { padding: 10px 12px; border: 1px solid #d9dee5; border-radius: 6px; font-size: 15px; width: 100%; box-sizing: border-box; }
.note-flag { font-size: 12px; background: #fff8e1; color: #7a5a00; border: 1px solid #f0d78c; border-radius: 999px; padding: 1px 8px; margin-left: 8px; cursor: help; white-space: nowrap; }
.qr-edit-actions { display: flex; gap: 8px; justify-content: flex-end; align-items: center; }
.qr-status { margin-right: auto; font-size: 12px; color: #6b7a8a; }
.qr-status.error { color: #b3261e; font-weight: 600; }
.reply-form .qr-edit-actions button {
  font-size: 12px;
  padding: 5px 14px;
  border-radius: 6px;
  border: none;
  cursor: pointer;
}
.reply-form .qr-save-btn { background: #1c2530; color: white; }
.reply-form .qr-cancel-btn { background: #eef1f5; color: #33465c; border: 1px solid #dbe0e6; }

.reply-form .quick-reply-add-btn {
  background: #eef1f5;
  border: 1px dashed #b7c1cc;
  color: #33465c;
  font-size: 15px;
  font-weight: 700;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  cursor: pointer;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}
.reply-form .quick-reply-add-btn:hover { background: #dde3ea; }

.reply-actions { display: flex; align-items: center; gap: 12px; }
.reply-actions input[type="file"] { flex: 1; font-size: 13px; }
.reply-form button { background: #1c2530; color: white; border: none; padding: 10px 24px; border-radius: 8px; cursor: pointer; }
.attachment-hint { font-size: 12px; color: #888; margin: 0; }

.channels-list { display: flex; flex-direction: column; gap: 8px; }
.channel-row { display: flex; align-items: center; gap: 12px; background: white; padding: 14px 18px; border-radius: 8px; box-shadow: 0 1px 2px rgba(0,0,0,.06); }
.channel-dot { width: 12px; height: 12px; border-radius: 50%; flex-shrink: 0; }
.channel-name { width: 220px; font-weight: 600; }
.channel-status { width: 260px; font-size: 13px; }
.channel-status.ok { color: #2e7d32; }
.channel-status.warn { color: #b8860b; }
.channel-status.bad { color: #b71c1c; }
.channel-desc { color: #666; font-size: 13px; }

.summary-cards { display: flex; gap: 14px; margin-bottom: 24px; }
.summary-card { background: white; border-radius: 10px; padding: 16px 22px; box-shadow: 0 1px 3px rgba(0,0,0,.08); flex: 1; }
.summary-label { font-size: 13px; color: #666; }
.summary-count { font-size: 26px; font-weight: 700; }
.summary-amount { color: #2e7d32; font-weight: 600; }

.orders-table { width: 100%; border-collapse: collapse; background: white; border-radius: 8px; overflow: hidden; }
.orders-table th, .orders-table td { padding: 10px 14px; text-align: left; border-bottom: 1px solid #eee; font-size: 14px; }
.orders-table th { background: #f0f1f3; font-size: 12px; text-transform: uppercase; color: #666; }

.empty { color: #888; padding: 20px; }

/* ===== Panel klienta obok rozmowy ===== */
.conversation-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 20px; align-items: start; }
.conversation-main { min-width: 0; }
.customer-panel { position: sticky; top: 16px; display: flex; flex-direction: column; gap: 14px; }
.contact-lines { margin: 0; font-size: 13px; line-height: 1.9; }
.contact-lines a { color: #33465c; text-decoration: none; }
.contact-lines a:hover { text-decoration: underline; }
.order-link { display: inline-block; margin-top: 4px; font-size: 12px; color: #ff5a00; text-decoration: none; font-weight: 600; }
.order-link:hover { text-decoration: underline; }
.panel-box { background: white; border-radius: 10px; padding: 14px 16px; box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.panel-box h3 { margin: 0 0 8px; font-size: 15px; display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.panel-source { font-size: 11px; font-weight: 700; color: #8fa0b3; text-transform: uppercase; letter-spacing: .5px; }
.panel-note { margin: 0 0 2px; font-size: 12px; color: #33465c; font-weight: 600; }
.panel-muted { margin: 0 0 8px; font-size: 12px; color: #888; }
.order-items { list-style: none; padding: 0; margin: 0 0 8px; display: flex; flex-direction: column; gap: 6px; }
.order-items li { font-size: 13px; line-height: 1.45; }
.item-qty { font-weight: 700; color: #33465c; margin-right: 4px; }
.item-price { color: #666; white-space: nowrap; margin-left: 4px; }
.item-state { display: inline-block; font-size: 11px; background: #fff3cd; color: #7a5a00; padding: 1px 7px; border-radius: 999px; margin-left: 4px; }
.order-total { margin: 0; font-weight: 700; font-size: 13px; border-top: 1px solid #eee; padding-top: 8px; }
.panel-box-inner { margin-top: 12px; padding: 12px 14px; box-shadow: none; border: 1px solid #e3e7ec; background: #f7f8fa; }
.panel-box-inner h4 { margin: 0 0 6px; font-size: 11px; text-transform: uppercase; color: #8fa0b3; letter-spacing: .5px; }
.panel-box-inner p { margin: 0; font-size: 13px; line-height: 1.45; }
.customer-status.first { border-color: #2e7d32; background: #e8f5e9; }
.customer-status.returning { border-color: #1565c0; background: #e3f2fd; }
.customer-status.none { border-color: #e6a700; background: #fff8e1; }

@media (max-width: 640px) {
  .conversation-layout { grid-template-columns: 1fr; }
  .customer-panel { position: static; }
}
