/*!
 * Theme Name: RMA — System Reklamacji i Zwrotów
 * Theme URI: https://returia.com
 * Description: System zarządzania reklamacjami (RMA) — Industrial Minimalism
 * Version: 2.0.0
 * Author: Returia Development
 * Author URI: https://returia.com
 * License: GPL v2 or later
 * License URI: http://www.gnu.org/licenses/gpl-2.0.html
 * Text Domain: rma
 * Domain Path: /languages
 * Requires PHP: 7.4
 * Requires at least: 5.0
 */

/* ─── Design Tokens ─── */
:root {
  --bg-app:     #F5F4F0;
  --bg-surface: #FFFFFF;
  --bg-muted:   #F1EFE8;
  --bg-hover:   #F5F4F0;

  --accent:       #185FA5;
  --accent-bg:    #E6F1FB;
  --accent-focus: #B5D4F4;

  --status-new:           #185FA5;
  --status-new-bg:        #E6F1FB;
  --status-progress:      #854F0B;
  --status-progress-bg:   #FAEEDA;
  --status-resolved:      #3B6D11;
  --status-resolved-bg:   #EAF3DE;
  --status-closed:        #888780;
  --status-closed-bg:     #F1EFE8;

  --danger:        #A32D2D;
  --danger-strong: #E24B4A;

  --text-primary:   #1A1A18;
  --text-secondary: #5A584F;
  --text-muted:     #888780;

  --border:        0.5px solid rgba(0,0,0,0.12);
  --border-strong: 0.5px solid rgba(0,0,0,0.18);

  --radius-sm: 8px;
  --radius-md: 12px;

  --font-sans: 'DM Sans', system-ui, sans-serif;
  --font-mono: 'DM Mono', ui-monospace, monospace;
}

/* ─── Reset ─── */
*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg-app);
  font-family: var(--font-sans);
  color: var(--text-primary);
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  letter-spacing: -0.005em;
}

/* ─── WP Site Header ─── */
.site-header {
  height: 56px;
  background: var(--bg-surface);
  border-bottom: var(--border);
  display: flex;
  align-items: center;
  padding: 0 28px;
  gap: 24px;
  position: sticky;
  top: 0;
  z-index: 50;
}

.site-header .site-branding {
  display: flex;
  align-items: center;
  gap: 8px;
}

.site-header .site-logo-img {
  max-width: 120px;
  max-height: 36px;
  width: auto;
  height: auto;
  display: block;
}

.site-header .site-logo-mark {
  width: 24px;
  height: 24px;
  background: var(--text-primary);
  color: #fff;
  border-radius: 5px;
  display: grid;
  place-items: center;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
}

.site-header .site-name {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
  text-decoration: none;
  letter-spacing: -0.01em;
}

.site-header .site-nav {
  flex: 1;
}

.site-header .site-nav ul {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  gap: 2px;
}

.site-header .site-nav a {
  font-size: 13px;
  color: var(--text-secondary);
  text-decoration: none;
  padding: 5px 10px;
  border-radius: 6px;
  font-weight: 400;
}

.site-header .site-nav a:hover {
  background: var(--bg-muted);
  color: var(--text-primary);
}

.site-header .site-nav .current-menu-item a {
  background: var(--accent-bg);
  color: var(--accent);
  font-weight: 500;
}

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

/* ─── WP Admin Bar fix ─── */
.admin-bar .site-header {
  top: 32px;
}

@media screen and (max-width: 782px) {
  .admin-bar .site-header { top: 46px; }
}

/* ─── Buttons ─── */
.btn {
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 500;
  height: 34px;
  padding: 0 14px;
  border-radius: var(--radius-sm);
  border: var(--border);
  background: var(--bg-surface);
  color: var(--text-primary);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  letter-spacing: -0.005em;
  transition: background 0.08s;
  text-decoration: none;
  white-space: nowrap;
}
.btn:hover { background: var(--bg-muted); color: var(--text-primary); text-decoration: none; }
.btn-primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn-primary:hover { background: #144d85; color: #fff; }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-ghost:hover { background: var(--bg-muted); }
.btn-danger { color: var(--danger); }
.btn-danger:hover { background: #fbeeee; }
.btn-sm { height: 28px; padding: 0 10px; font-size: 12px; }

/* ─── Inputs ─── */
.input, .select, .textarea {
  font-family: var(--font-sans);
  font-size: 13px;
  width: 100%;
  height: 36px;
  padding: 0 12px;
  border-radius: var(--radius-sm);
  border: var(--border);
  background: var(--bg-surface);
  color: var(--text-primary);
  outline: none;
  transition: box-shadow 0.1s, border-color 0.1s;
  -webkit-appearance: none;
  appearance: none;
}
.textarea {
  height: auto;
  padding: 10px 12px;
  resize: vertical;
  min-height: 90px;
  line-height: 1.5;
}
.input:focus, .select:focus, .textarea:focus {
  box-shadow: 0 0 0 2px var(--accent-focus);
  border-color: var(--accent);
}
.input.error, .textarea.error { border-color: var(--danger-strong); }
.input.mono, .select.mono { font-family: var(--font-mono); }

.label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 6px;
  display: block;
  letter-spacing: 0.005em;
}

.field-error {
  font-size: 11px;
  color: var(--danger);
  margin-top: 5px;
}

/* ─── Status pills ─── */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 22px;
  padding: 0 9px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 500;
  letter-spacing: 0.01em;
  white-space: nowrap;
}
.pill::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.85;
  flex: none;
}
.pill-new      { color: var(--status-new);      background: var(--status-new-bg); }
.pill-progress { color: var(--status-progress);  background: var(--status-progress-bg); }
.pill-resolved { color: var(--status-resolved);  background: var(--status-resolved-bg); }
.pill-closed   { color: var(--status-closed);    background: var(--status-closed-bg); }

/* ─── Type tags ─── */
.tag {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 9px;
  border-radius: var(--radius-sm);
  font-size: 11.5px;
  font-weight: 500;
  background: var(--bg-muted);
  color: var(--text-secondary);
  border: var(--border);
}

.mono { font-family: var(--font-mono); font-feature-settings: "tnum"; }

/* ─── Admin Frame (used in page template) ─── */
.rma-admin-frame {
  display: flex;
  height: calc(100vh - 56px);
  background: var(--bg-app);
  overflow: hidden;
}

.admin-bar .rma-admin-frame {
  height: calc(100vh - 56px - 32px);
}

@media screen and (max-width: 782px) {
  .admin-bar .rma-admin-frame { height: calc(100vh - 56px - 46px); }
}

/* ─── Sidebar ─── */
.sidebar {
  width: 220px;
  flex: 0 0 220px;
  background: var(--bg-app);
  border-right: var(--border);
  padding: 20px 14px;
  display: flex;
  flex-direction: column;
  gap: 22px;
  overflow-y: auto;
}
.sidebar-brand { padding: 4px 8px 0; }
.sidebar-brand .logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 500;
  font-size: 14px;
  letter-spacing: -0.01em;
}
.sidebar-brand .logo-mark {
  width: 22px;
  height: 22px;
  background: var(--text-primary);
  color: #fff;
  border-radius: 5px;
  display: grid;
  place-items: center;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  flex: none;
}
.sidebar-brand:not(.has-logo) .logo img {
  width: 22px;
  height: 22px;
  border-radius: 5px;
  object-fit: contain;
  flex: none;
}
.sidebar-brand .subtitle {
  font-size: 11.5px;
  color: var(--text-muted);
  margin-top: 4px;
  margin-left: 30px;
}

/* Gdy ustawiono własne logo — tekst spada pod obraz */
.sidebar-brand.has-logo .logo {
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
}
.sidebar-brand.has-logo .logo img {
  display: block;
  width: auto;
  height: auto;
  max-width: 144px;
  border-radius: 0;
}
.sidebar-brand.has-logo .subtitle {
  margin-left: 0;
  margin-top: 2px;
}
.sidebar-section { display: flex; flex-direction: column; gap: 1px; }
.sidebar-section-title {
  font-size: 10.5px;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 4px 10px 6px;
}
.sidebar-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 13px;
  color: var(--text-primary);
  cursor: pointer;
  font-weight: 400;
  letter-spacing: -0.005em;
  text-decoration: none;
  border: none;
  background: transparent;
  width: 100%;
  font-family: var(--font-sans);
}
.sidebar-item:hover { background: rgba(0,0,0,0.035); color: var(--text-primary); text-decoration: none; }
.sidebar-item.active {
  background: var(--accent-bg);
  color: var(--accent);
  font-weight: 500;
}
.sidebar-item .left { display: flex; align-items: center; gap: 9px; }
.sidebar-item .dot  { width: 7px; height: 7px; border-radius: 50%; flex: none; }
.sidebar-item .badge {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  background: rgba(0,0,0,0.06);
  color: var(--text-secondary);
  padding: 1px 6px;
  border-radius: 4px;
  min-width: 22px;
  text-align: center;
}
.sidebar-item.active .badge  { background: rgba(24,95,165,0.14); color: var(--accent); }
.sidebar-item .badge-new      { background: var(--status-new-bg);      color: var(--status-new); }
.sidebar-item .badge-progress { background: var(--status-progress-bg); color: var(--status-progress); }

/* ─── Topbar ─── */
.rma-topbar {
  height: 60px;
  border-bottom: var(--border);
  padding: 0 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: var(--bg-surface);
  flex: none;
}
.rma-topbar h1 {
  font-size: 17px;
  font-weight: 500;
  margin: 0;
  letter-spacing: -0.012em;
  display: flex;
  align-items: baseline;
  gap: 10px;
}
.rma-topbar h1 .count {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 400;
  font-family: var(--font-mono);
}
.topbar-search {
  position: relative;
  width: 300px;
}
.topbar-search .input {
  height: 32px;
  padding-left: 32px;
  font-size: 12.5px;
  background: var(--bg-app);
  border-color: transparent;
}
.topbar-search .input:focus { background: #fff; }
.topbar-search .search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
  display: flex;
}
.topbar-right { display: flex; gap: 10px; align-items: center; }

/* ─── Admin Main ─── */
.admin-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
}
.admin-content {
  flex: 1;
  padding: 22px 28px 28px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  overflow-y: auto;
}

/* ─── Stats cards ─── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}
.stat-card {
  background: var(--bg-muted);
  border-radius: var(--radius-md);
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  border: var(--border);
}
.stat-card .stat-label {
  font-size: 11.5px;
  color: var(--text-secondary);
  letter-spacing: 0.005em;
  display: flex;
  align-items: center;
  gap: 6px;
}
.stat-card .stat-label .dot { width: 7px; height: 7px; border-radius: 50%; }
.stat-card .stat-value {
  font-size: 24px;
  font-weight: 500;
  font-family: var(--font-mono);
  letter-spacing: -0.02em;
  line-height: 1;
}
.stat-card .stat-meta {
  font-size: 11px;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

/* ─── Filter bar ─── */
.filter-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.filter-pills {
  display: flex;
  gap: 4px;
  background: var(--bg-muted);
  padding: 3px;
  border-radius: var(--radius-sm);
}
.filter-pill {
  font-size: 12.5px;
  padding: 5px 11px;
  border-radius: 6px;
  cursor: pointer;
  color: var(--text-secondary);
  border: none;
  background: transparent;
  font-family: var(--font-sans);
  font-weight: 400;
  letter-spacing: -0.005em;
  text-decoration: none;
  white-space: nowrap;
}
.filter-pill.active {
  background: var(--bg-surface);
  color: var(--text-primary);
  font-weight: 500;
  box-shadow: 0 0 0 0.5px rgba(0,0,0,0.12);
}
.filter-pill .pill-count { color: var(--text-muted); margin-left: 5px; font-family: var(--font-mono); font-size: 11px; }
.filter-pill.active .pill-count { color: var(--text-secondary); }

/* ─── Card ─── */
.card {
  background: var(--bg-surface);
  border-radius: var(--radius-md);
  border: var(--border);
  overflow: hidden;
}

/* ─── Table ─── */
.tbl {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.tbl thead th {
  text-align: left;
  font-weight: 500;
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 11px 16px;
  border-bottom: var(--border);
  background: #FAFAF7;
}
.tbl tbody td {
  padding: 12px 16px;
  border-bottom: var(--border);
  vertical-align: middle;
}
.tbl tbody tr:last-child td { border-bottom: none; }
.tbl tbody tr:hover { background: var(--bg-hover); }
.tbl .col-id { width: 130px; }
.tbl .col-actions { width: 130px; text-align: right; }
.tbl a.id-link {
  color: var(--accent);
  text-decoration: none;
  font-family: var(--font-mono);
  font-size: 12.5px;
}
.tbl a.id-link:hover { text-decoration: underline; }
.client-cell { display: flex; flex-direction: column; line-height: 1.3; }
.client-cell .name  { font-weight: 500; font-size: 13px; }
.client-cell .email { font-size: 11.5px; color: var(--text-muted); }
.timestamp { font-family: var(--font-mono); font-size: 11.5px; color: var(--text-secondary); }
.row-actions { display: flex; gap: 2px; justify-content: flex-end; }
.icon-btn {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border: none;
  background: transparent;
  border-radius: 6px;
  cursor: pointer;
  color: var(--text-secondary);
  padding: 0;
}
.icon-btn:hover { background: var(--bg-muted); color: var(--text-primary); }
.icon-btn.danger:hover { background: #fbeeee; color: var(--danger); }
.tbl .hidden-row { display: none; }

/* ─── Pagination ─── */
.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-top: var(--border);
  font-size: 12px;
  color: var(--text-secondary);
  background: #FAFAF7;
}
.pagination .pages { font-family: var(--font-mono); }
.pagination-btn-group { display: flex; align-items: center; gap: 6px; }
.icon-btn:disabled { opacity: 0.4; cursor: default; }

/* ─── Modal ─── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.35);
  display: none;
  place-items: center;
  z-index: 200;
  padding: 20px;
}
.modal-overlay.open { display: grid; }
.modal {
  width: 540px;
  max-width: calc(100% - 40px);
  background: var(--bg-surface);
  border-radius: var(--radius-md);
  border: var(--border-strong);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 40px);
}
.modal-sm { width: 420px; }
.modal-header {
  padding: 18px 22px 14px;
  border-bottom: var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex: none;
}
.modal-header h2 {
  font-size: 15px;
  font-weight: 500;
  margin: 0;
  letter-spacing: -0.005em;
  display: flex;
  align-items: center;
  gap: 10px;
}
.modal-header h2 .ticket-id {
  font-family: var(--font-mono);
  color: var(--accent);
  font-size: 13px;
}
.modal-body {
  padding: 18px 22px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
  flex: 1;
}
.modal-body p { margin: 0; font-size: 13px; color: var(--text-secondary); line-height: 1.55; }
.modal-footer {
  padding: 14px 22px;
  border-top: var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  background: #FAFAF7;
  flex: none;
}
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.id-inline {
  font-family: var(--font-mono);
  color: var(--text-primary);
  background: var(--bg-muted);
  padding: 1px 6px;
  border-radius: 4px;
}
.modal-body .btn-danger-confirm {
  background: var(--danger);
  border-color: var(--danger);
  color: #fff;
}
.modal-body .btn-danger-confirm:hover { background: #8b2424; }

/* ─── Customer / Public Form ─── */
.rma-public-page {
  min-height: calc(100vh - 56px);
  background: var(--bg-app);
  padding: 48px 24px 64px;
  display: flex;
  justify-content: center;
}
.admin-bar .rma-public-page { min-height: calc(100vh - 56px - 32px); }
.rma-public-card {
  width: 560px;
  max-width: 100%;
  background: var(--bg-surface);
  border-radius: var(--radius-md);
  border: var(--border);
  padding: 36px 40px 32px;
  display: flex;
  flex-direction: column;
  gap: 22px;
}
.public-header {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding-bottom: 18px;
  border-bottom: var(--border);
}
.public-header .brand {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  letter-spacing: -0.005em;
}
.public-header h1 {
  font-size: 22px;
  font-weight: 500;
  margin: 0;
  letter-spacing: -0.018em;
  line-height: 1.2;
}
.public-header p {
  font-size: 13px;
  color: var(--text-secondary);
  margin: 0;
  line-height: 1.5;
}
.form-grid { display: flex; flex-direction: column; gap: 16px; }
.form-row  { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.helper {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 5px;
  display: flex;
  justify-content: space-between;
  font-family: var(--font-mono);
}
.checkbox-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 12.5px;
  color: var(--text-secondary);
  line-height: 1.5;
}
.checkbox-row input[type="checkbox"] {
  margin-top: 2px;
  accent-color: var(--accent);
  width: 14px;
  height: 14px;
  flex: none;
}
.checkbox-row a { color: var(--accent); text-decoration: none; }
.upload-zone {
  border: 0.5px dashed rgba(0,0,0,0.22);
  border-radius: var(--radius-sm);
  padding: 18px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  background: #FAFAF7;
  cursor: pointer;
  transition: background 0.08s;
}
.upload-zone:hover { background: var(--bg-muted); }
.upload-zone .upload-title { font-size: 12.5px; font-weight: 500; }
.upload-zone .upload-sub { font-size: 11px; color: var(--text-muted); font-family: var(--font-mono); }
.btn-submit {
  height: 44px;
  font-size: 14px;
  width: 100%;
  justify-content: center;
}
.public-footer {
  text-align: center;
  font-size: 11px;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

/* ─── Success Screen ─── */
.success-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 48px 0;
  text-align: center;
}
.success-icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--status-resolved-bg);
  color: var(--status-resolved);
  display: grid;
  place-items: center;
}
.success-rma-id {
  font-family: var(--font-mono);
  font-size: 17px;
  color: var(--accent);
  background: var(--accent-bg);
  padding: 10px 18px;
  border-radius: 8px;
  letter-spacing: 0.02em;
}
.success-screen h1 { font-size: 22px; font-weight: 500; margin: 0; letter-spacing: -0.018em; }
.success-screen .sub { font-size: 13.5px; color: var(--text-secondary); margin: 0; line-height: 1.55; max-width: 380px; }
.success-screen .note { font-size: 12.5px; color: var(--text-muted); margin: 0; font-family: var(--font-mono); }

/* ─── Toast notifications ─── */
.rma-toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  background: var(--text-primary);
  color: #fff;
  padding: 12px 18px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-family: var(--font-sans);
  max-width: 320px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.22);
  animation: toastIn 0.18s ease;
}
.rma-toast.success { background: var(--status-resolved); }
.rma-toast.error   { background: var(--danger); }
@keyframes toastIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ─── WP Home / CTA Page ─── */
.rma-home {
  max-width: 700px;
  margin: 80px auto;
  padding: 0 24px;
  text-align: center;
}
.rma-home h1 {
  font-size: 32px;
  font-weight: 500;
  letter-spacing: -0.02em;
  margin: 0 0 16px;
}
.rma-home .lead {
  font-size: 15px;
  color: var(--text-secondary);
  margin-bottom: 32px;
  line-height: 1.6;
}
.rma-home .cta-buttons {
  display: flex;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
}
.rma-home .feature-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-top: 48px;
  text-align: left;
}
.rma-home .feature-card {
  background: var(--bg-surface);
  border: var(--border);
  border-radius: var(--radius-md);
  padding: 20px;
}
.rma-home .feature-card h3 {
  font-size: 14px;
  font-weight: 500;
  margin: 0 0 8px;
}
.rma-home .feature-card p {
  font-size: 12.5px;
  color: var(--text-secondary);
  margin: 0;
  line-height: 1.5;
}

/* ─── Responsive ─── */
@media (max-width: 900px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 768px) {
  /* Layout */
  .rma-admin-frame { flex-direction: column; height: auto; min-height: 100vh; }

  /* Sidebar — poziomy scrollowalny pasek */
  .sidebar {
    width: 100%;
    flex: none;
    height: auto;
    flex-direction: row;
    align-items: center;
    overflow-x: auto;
    overflow-y: visible;
    padding: 0 12px;
    border-right: none;
    border-bottom: var(--border);
    gap: 0;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    background: var(--bg-surface);
  }
  .sidebar::-webkit-scrollbar { display: none; }
  .sidebar-brand { display: none; }
  .sidebar-section {
    flex-direction: row;
    align-items: center;
    gap: 0;
    flex: none;
  }
  .sidebar-section + .sidebar-section {
    border-left: var(--border);
    margin-left: 6px;
    padding-left: 6px;
  }
  .sidebar-section-title { display: none; }
  .sidebar-item {
    flex: none;
    width: auto;
    height: 44px;
    padding: 0 11px;
    border-radius: 0;
    white-space: nowrap;
    font-size: 13px;
    justify-content: center;
  }
  .sidebar-item svg { display: none; }
  .sidebar-item .left { gap: 5px; }
  .sidebar-item .dot { display: inline-block; }
  .sidebar-item.active {
    box-shadow: inset 0 -2px 0 var(--accent);
    background: transparent;
    border-radius: 0;
  }
  .sidebar-item .badge { margin-left: 5px; }

  /* Topbar */
  .rma-topbar { padding: 0 16px; height: 52px; gap: 10px; }
  .rma-topbar h1 { font-size: 15px; }
  .rma-topbar h1 .count { display: none; }
  .topbar-search { width: 140px; }
  .topbar-right { gap: 6px; }

  /* Content */
  .admin-content { padding: 16px; }

  /* Stats */
  .stats-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .stat-card { padding: 12px 14px; }
  .stat-card .stat-value { font-size: 20px; }

  /* Filter bar */
  .filter-bar { flex-wrap: wrap; gap: 8px; }
  .filter-pills { overflow-x: auto; -webkit-overflow-scrolling: touch; }

  /* Tabela */
  .tbl .col-order,
  .tbl .col-type,
  .tbl .col-id { display: none; }
  .tbl thead th,
  .tbl tbody td { padding: 10px 12px; }

  /* Formularz i pola */
  .form-row { grid-template-columns: 1fr; }
  .field-row { grid-template-columns: 1fr; }

  /* Karta szczegółów */
  .detail-body { grid-template-columns: 1fr; overflow: visible; }
  .detail-col-main { border-right: none; border-bottom: var(--border); padding: 20px 16px 24px; overflow-y: visible; }
  .detail-col-aside { padding: 20px 16px 24px; overflow-y: visible; background: var(--bg-app); }
  .detail-topbar { padding: 0 16px; height: 52px; }
  .detail-topbar-right { gap: 6px; }
  .ticket-detail { position: fixed; overflow-y: auto; }

  /* Publiczne */
  .rma-public-card { padding: 24px 20px; }
  .rma-home .feature-grid { grid-template-columns: 1fr; }
}

@media (max-width: 500px) {
  .stats-grid { grid-template-columns: 1fr; }
  .topbar-search { display: none; }
  .rma-topbar { height: 48px; }
  .tbl .col-actions { width: 60px; }
  .detail-topbar-title { display: none; }
}

/* ─── Empty state ─── */
.empty-state {
  padding: 48px 28px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
}

/* ─── Ticket Detail Panel ─── */
.admin-main { position: relative; }

.ticket-detail {
  position: absolute;
  inset: 0;
  background: var(--bg-app);
  display: none;
  flex-direction: column;
  overflow: hidden;
  z-index: 10;
}
.ticket-detail.open { display: flex; }

.detail-topbar {
  height: 60px;
  background: var(--bg-surface);
  border-bottom: var(--border);
  padding: 0 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex: none;
}
.detail-topbar-left {
  display: flex;
  align-items: center;
  gap: 14px;
}
.detail-topbar-title {
  font-size: 15px;
  font-weight: 500;
  letter-spacing: -0.01em;
  font-family: var(--font-mono);
  color: var(--accent);
}
.detail-topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.detail-body {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 320px;
  overflow: hidden;
}
.detail-col-main {
  overflow-y: auto;
  padding: 24px 28px 32px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  border-right: var(--border);
}
.detail-col-aside {
  overflow-y: auto;
  padding: 24px 22px 32px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  background: var(--bg-surface);
}

.detail-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.detail-section-title {
  font-size: 10.5px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding-bottom: 8px;
  border-bottom: var(--border);
}

.detail-loading {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 13px;
  font-family: var(--font-mono);
}

/* ─── Media Grid ─── */
.media-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 7px;
}
.media-item {
  position: relative;
  border-radius: 6px;
  overflow: hidden;
  border: var(--border);
  background: var(--bg-muted);
  aspect-ratio: 1;
  cursor: default;
}
.media-item a img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.media-item-del {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: rgba(0,0,0,0.55);
  color: #fff;
  border: none;
  cursor: pointer;
  display: grid;
  place-items: center;
  opacity: 0;
  transition: opacity 0.12s;
  padding: 0;
}
.media-item:hover .media-item-del { opacity: 1; }
.media-item-file {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  height: 100%;
  padding: 8px;
}
.media-item-file .media-filename {
  font-size: 9.5px;
  font-family: var(--font-mono);
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  width: 100%;
  text-align: center;
}
.media-file-link {
  position: absolute;
  inset: 0;
}
.media-empty {
  grid-column: 1 / -1;
  font-size: 12px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  padding: 10px 0;
  text-align: center;
}
.media-upload-zone {
  border: 0.5px dashed rgba(0,0,0,0.2);
  border-radius: 6px;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  cursor: pointer;
  font-size: 12px;
  color: var(--text-secondary);
  background: #FAFAF7;
  transition: background 0.08s;
  font-family: var(--font-sans);
}
.media-upload-zone:hover { background: var(--bg-muted); }
.media-upload-status {
  font-size: 11px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  min-height: 16px;
}

@media (max-width: 900px) {
  .detail-body { grid-template-columns: 1fr; }
  .detail-col-aside { border-top: var(--border); }
}

/* ─── Settings Panel ─── */
.settings-body {
  flex: 1;
  overflow-y: auto;
  padding: 24px 28px 40px;
  display: flex;
  flex-direction: column;
  gap: 28px;
  max-width: 680px;
}

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

.status-row {
  display: grid;
  grid-template-columns: auto 1fr auto auto auto;
  gap: 10px;
  align-items: center;
  padding: 8px 12px;
  background: var(--bg-surface);
  border-radius: 8px;
  border: var(--border);
}

.status-label-input {
  height: 30px !important;
}

.status-colors {
  display: flex;
  gap: 6px;
  align-items: flex-end;
}

.status-colors label {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  cursor: pointer;
}

.status-colors label > span {
  font-size: 9px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.status-color-input {
  width: 32px;
  height: 24px;
  padding: 1px 2px;
  border: var(--border);
  border-radius: 5px;
  cursor: pointer;
  background: var(--bg-surface);
  -webkit-appearance: none;
  appearance: none;
}

.status-key-chip {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-muted);
  background: var(--bg-muted);
  padding: 3px 7px;
  border-radius: 4px;
  border: var(--border);
  white-space: nowrap;
}

.sp-logo-preview {
  display: flex;
  align-items: center;
}

.sp-logo-preview img {
  display: block;
  max-width: 144px;
  width: auto;
  height: auto;
}

.sp-logo-empty {
  font-family: var(--font-mono);
  font-size: 18px;
  font-weight: 500;
  color: var(--text-secondary);
}

/* ───────────────────────────── */
/* Auth screens (login/register/onboarding) */
/* ───────────────────────────── */
.rma-auth-main {
  min-height: calc(100vh - 64px);
  background: var(--bg-app, #F5F4F0);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 56px 16px 80px;
}
.rma-auth-shell { width: 100%; max-width: 420px; }
.rma-auth-shell.rma-onboarding-shell { max-width: 480px; }
.rma-auth-card {
  background: var(--bg-surface, #fff);
  border: 0.5px solid rgba(0,0,0,0.12);
  border-radius: 14px;
  padding: 32px 28px;
  box-shadow: 0 12px 40px -16px rgba(0,0,0,0.12);
}
.rma-auth-eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: 'DM Mono', ui-monospace, monospace;
  font-size: 11px; letter-spacing: 0.05em; color: var(--text-secondary, #5A584F);
  background: var(--bg-app, #F5F4F0);
  border: 0.5px solid rgba(0,0,0,0.10);
  padding: 4px 10px 4px 6px;
  border-radius: 999px;
  margin-bottom: 16px;
}
.rma-auth-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: #3B6D11;
  box-shadow: 0 0 0 3px rgba(59,109,17,0.18);
}
.rma-auth-title {
  font-size: 24px; font-weight: 500; line-height: 1.18;
  letter-spacing: -0.018em; margin: 0 0 6px;
}
.rma-auth-lead {
  font-size: 14px; color: var(--text-secondary, #5A584F);
  margin: 0 0 22px; line-height: 1.5;
}
.rma-auth-form { display: flex; flex-direction: column; gap: 14px; }
.rma-auth-field { display: flex; flex-direction: column; gap: 6px; }
.rma-auth-field label {
  font-size: 12.5px; font-weight: 500;
  color: var(--text-secondary, #5A584F); letter-spacing: 0.005em;
}
.rma-auth-field input[type="text"],
.rma-auth-field input[type="email"],
.rma-auth-field input[type="password"] {
  width: 100%; height: 40px; padding: 0 12px;
  border-radius: 8px;
  border: 0.5px solid rgba(0,0,0,0.16);
  background: var(--bg-surface, #fff);
  color: var(--text-primary, #1A1A18);
  font-size: 14px; font-family: inherit;
  outline: none; transition: border-color .12s, box-shadow .12s;
}
.rma-auth-field input:focus {
  border-color: var(--accent, #185FA5);
  box-shadow: 0 0 0 2px rgba(24,95,165,0.18);
}
.rma-auth-hint {
  font-size: 11.5px; color: var(--text-muted, #888780); margin-top: 2px;
}
.rma-auth-checkbox {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 13px; color: var(--text-secondary, #5A584F);
  cursor: pointer; user-select: none;
}
.rma-auth-checkbox input { width: 16px; height: 16px; accent-color: var(--accent, #185FA5); }
.rma-auth-submit {
  height: 44px; padding: 0 18px;
  background: var(--accent, #185FA5); color: #fff;
  border: 0; border-radius: 8px;
  font-size: 14px; font-weight: 500; letter-spacing: -0.005em;
  cursor: pointer; transition: background .12s;
  margin-top: 4px;
}
.rma-auth-submit:hover { background: #144d85; }
.rma-auth-submit:disabled { opacity: 0.6; cursor: not-allowed; }
.rma-auth-error {
  background: #FBEEEE; color: #A32D2D;
  border: 0.5px solid rgba(163,45,45,0.3);
  padding: 10px 12px; border-radius: 8px;
  font-size: 13px; line-height: 1.4;
}
.rma-auth-meta {
  margin-top: 18px; font-size: 13px; color: var(--text-secondary, #5A584F);
  text-align: center;
}
.rma-auth-meta a { color: var(--accent, #185FA5); text-decoration: none; }
.rma-auth-meta a:hover { text-decoration: underline; }
.rma-auth-sep { color: var(--text-muted, #888780); margin: 0 4px; }
.rma-auth-footer {
  text-align: center; margin: 18px 0 0;
  font-size: 12.5px; color: var(--text-muted, #888780);
}
.rma-auth-footer a { color: var(--text-secondary, #5A584F); text-decoration: none; }
.rma-auth-footer a:hover { color: var(--accent, #185FA5); }
.rma-auth-terms {
  font-size: 11.5px; color: var(--text-muted, #888780);
  line-height: 1.5; margin: 4px 0 0;
}
.rma-auth-terms a { color: var(--text-secondary, #5A584F); }

/* Logo uploader (onboarding) */
.rma-logo-uploader {
  display: flex; align-items: center; gap: 16px;
  padding: 12px;
  background: var(--bg-app, #F5F4F0);
  border: 0.5px dashed rgba(0,0,0,0.18);
  border-radius: 10px;
}
.rma-logo-preview {
  width: 88px; height: 88px; flex: none;
  border-radius: 10px;
  background: var(--bg-surface, #fff) center/contain no-repeat;
  border: 0.5px solid rgba(0,0,0,0.12);
  display: grid; place-items: center;
  font-size: 11px; color: var(--text-muted, #888780);
  text-align: center;
}
.rma-logo-actions { display: flex; flex-direction: column; gap: 6px; flex: 1; }
.rma-logo-pick {
  align-self: flex-start;
  padding: 8px 14px; height: 34px;
  background: var(--bg-surface, #fff);
  border: 0.5px solid rgba(0,0,0,0.16);
  border-radius: 8px;
  font-size: 13px; cursor: pointer; font-family: inherit;
}
.rma-logo-pick:hover { background: var(--bg-muted, #F1EFE8); }
.rma-logo-hint { font-size: 11.5px; color: var(--text-muted, #888780); }

/* Site branding link */
.site-brand-link { display: inline-flex; align-items: center; gap: 9px; color: inherit; text-decoration: none; }
.site-brand-link:hover { color: inherit; }

@media (max-width: 480px) {
  .rma-auth-main { padding: 32px 12px 56px; }
  .rma-auth-card { padding: 26px 22px; border-radius: 12px; }
  .rma-auth-title { font-size: 22px; }
}
