/* ── Reset & base ──────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ── Utilitário de visibilidade (substitui style="display:none" inline) ── */
.is-hidden { display: none !important; }

:root {
  /* Tema claro — base lilás/roxo */
  --bg:           #e3d4f9;
  --surface:      #f8f3fd;
  --panel:        #ffffff;
  --panel-raised: #ffffff;
  --border:       #cfb8f4;
  --border-soft:  #e3d4f9;

  --text:        #371267;
  --text-muted:  #532194;
  --text-dim:    #8b6bae;

  --primary:      #532194;
  --primary-hover:#6b2fba;
  --primary-soft: rgba(83, 33, 148, .10);
  --primary-border:rgba(83, 33, 148, .35);

  /* Acento secundário — variedade visual em destaques pontuais */
  --accent:       #ae76e5;
  --accent-soft:  rgba(174, 118, 229, .18);

  --success:      #178a4c;
  --success-soft: rgba(23, 138, 76, .12);
  --warning:      #b45309;
  --warning-soft: rgba(180, 83, 9, .12);
  --danger:       #b91c1c;
  --danger-soft:  rgba(185, 28, 28, .12);

  --shadow-color: 55, 18, 103;

  --radius:      10px;
  --radius-sm:   7px;
  --radius-lg:   12px;

  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

html { font-size: 15px; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  min-height: 100vh;
  line-height: 1.5;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Navbar ────────────────────────────────────────────────────── */
.navbar {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: .5rem 1.5rem;
  position: sticky;
  top: 0;
  z-index: 200;
}

.navbar-brand { display: flex; align-items: center; flex-shrink: 0; }
.brand-logo-sm { height: 68px; width: auto; object-fit: contain; }

.navbar-worker {
  display: flex;
  align-items: center;
  gap: .55rem;
  padding-left: 1rem;
  border-left: 1px solid var(--border-soft);
  min-width: 0;
}

.navbar-worker-text {
  display: flex;
  flex-direction: column;
  line-height: 1.25;
  min-width: 0;
}

.worker-status-text { font-size: .85rem; font-weight: 600; color: var(--text); }
.navbar-worker-meta {
  font-size: .7rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.navbar-actions {
  display: flex;
  align-items: center;
  gap: .5rem;
  flex-wrap: wrap;
}

.navbar-live {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: .15rem;
  margin-left: auto;
  flex-shrink: 0;
}

/* ── Live indicator ────────────────────────────────────────────── */
.live-badge {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  font-size: .75rem;
  color: var(--text-muted);
}

.live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--text-dim);
  flex-shrink: 0;
}

.live-badge.connected    .live-dot { background: var(--success); box-shadow: 0 0 6px var(--success); animation: pulse-dot 2s infinite; }
.live-badge.disconnected .live-dot { background: var(--danger); }

.update-time { font-size: .7rem; color: var(--text-dim); }

/* ── Main ──────────────────────────────────────────────────────── */
.main {
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
  padding: 1.5rem;
  max-width: 1440px;
  margin: 0 auto;
  width: 100%;
}

/* ── Top row: conteúdo (stats + filtro + tabela) + ranking ──────── */
.top-row {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 1rem;
  align-items: stretch;
}

.content-col {
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
  min-width: 0;
}

/* ── Stats grid ────────────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: .875rem;
}

.stats-grid.flash { animation: flash-update .5s ease; }

.stat-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: .3rem;
  cursor: pointer;
  user-select: none;
  transition: border-color .15s, background .15s;
}

.stat-card:hover { border-color: var(--primary-border); }

#cardTotal              { border-top: 2px solid var(--accent);  }
.stat-card.stat-pending { border-top: 2px solid var(--warning); }
.stat-card.stat-success { border-top: 2px solid var(--success); }
.stat-card.stat-danger  { border-top: 2px solid var(--danger);  }

.stat-card.active                { border-color: var(--primary);  background: var(--primary-soft); }
.stat-card.stat-pending.active   { border-color: var(--warning);  background: var(--warning-soft); }
.stat-card.stat-success.active   { border-color: var(--success);  background: var(--success-soft); }
.stat-card.stat-danger.active    { border-color: var(--danger);   background: var(--danger-soft);  }

.stat-label {
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-muted);
}

.stat-value {
  font-size: 1.9rem;
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -.03em;
  color: var(--text);
}

.stat-card.stat-pending .stat-value { color: var(--warning); }
.stat-card.stat-success .stat-value { color: var(--success); }
.stat-card.stat-danger  .stat-value { color: var(--danger);  }

/* ── Ranking (card compacto) ───────────────────────────────────── */
.ranking-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .9rem 1rem;
  display: flex;
  flex-direction: column;
  gap: .7rem;
  height: 100%;
}

.ranking-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
}

.ranking-title {
  display: flex;
  align-items: center;
  gap: .4rem;
  font-size: .74rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--text-muted);
  white-space: nowrap;
}

.ranking-title i { color: var(--warning); }

.ranking-select {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--font);
  font-size: .72rem;
  font-weight: 600;
  padding: .3rem .5rem;
  outline: none;
  cursor: pointer;
  min-width: 0;
}

.ranking-select:focus { border-color: var(--primary); }

.ranking-custom-range {
  display: flex;
  align-items: center;
  gap: .35rem;
}

.ranking-date {
  flex: 1;
  min-width: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--font);
  font-size: .72rem;
  padding: .3rem .4rem;
  color-scheme: light;
  outline: none;
}

.ranking-date:focus { border-color: var(--primary); }

.btn-ranking-apply {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  background: var(--primary);
  border: none;
  border-radius: var(--radius-sm);
  color: #fff;
  cursor: pointer;
  font-size: .8rem;
}

.btn-ranking-apply:hover { background: var(--primary-hover); }

.ranking-summary {
  display: flex;
  gap: 1rem;
  font-size: .74rem;
  color: var(--text-muted);
}

.ranking-summary strong { color: var(--text); font-size: .88rem; }

.ranking-list {
  display: flex;
  flex-direction: column;
  gap: .35rem;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}

.ranking-item {
  display: grid;
  grid-template-columns: 22px 1fr auto;
  align-items: center;
  gap: .5rem;
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  padding: .4rem .6rem;
  font-size: .8rem;
}

.ranking-pos {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: rgba(83, 33, 148, .08);
  color: var(--text-muted);
  font-size: .68rem;
  font-weight: 700;
}

.ranking-nome {
  color: var(--text);
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ranking-total {
  color: var(--text-muted);
  font-size: .76rem;
  font-weight: 700;
}

.ranking-item.top-1 .ranking-pos { background: rgba(180, 83, 9, .2);  color: #92400e; }
.ranking-item.top-2 .ranking-pos { background: rgba(100, 116, 139, .2); color: #475569; }
.ranking-item.top-3 .ranking-pos { background: rgba(146, 64, 14, .2);  color: #7c2d12; }

.ranking-item.top-1 { border-color: rgba(180, 83, 9, .35); }

.ranking-empty {
  color: var(--text-dim);
  font-size: .8rem;
  padding: .5rem 0;
  text-align: center;
}

/* ── Filter bar ────────────────────────────────────────────────── */
.search-wrap {
  position: relative;
  display: flex;
  align-items: center;
  flex: 1 1 180px;
  min-width: 0;
}

.search-wrap .filter-input {
  flex: 1;
  width: 100%;
}

.search-spinner {
  display: none;
  position: absolute;
  right: .6rem;
  width: 14px;
  height: 14px;
  border: 2px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin .6s linear infinite;
  pointer-events: none;
}

.search-spinner.is-visible { display: block; }

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

.filter-bar {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .875rem 1rem;
}

.filter-bar form {
  display: flex;
  align-items: center;
  gap: .6rem;
  flex-wrap: wrap;
}

.filter-input,
.filter-select {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: .875rem;
  padding: .45rem .75rem;
  outline: none;
  transition: border-color .15s;
}

.filter-input  { flex: 1; min-width: 160px; }
.filter-select { min-width: 130px; cursor: pointer; }

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

.filter-input::placeholder { color: var(--text-dim); }

.filter-date-wrap {
  display: flex;
  align-items: center;
  gap: .45rem;
}

.filter-date {
  flex: 0 0 auto;
  min-width: 140px;
  color-scheme: light;
}

.filter-date-sep {
  font-size: .78rem;
  color: var(--text-dim);
}

/* ── Table ─────────────────────────────────────────────────────── */
.table-wrapper {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.orders-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .875rem;
}

.orders-table thead tr {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.orders-table th {
  padding: .75rem 1rem;
  text-align: left;
  font-size: .68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-muted);
  white-space: nowrap;
}

.orders-table tbody tr {
  border-bottom: 1px solid var(--border-soft);
  transition: background .12s;
}

.orders-table tbody tr:last-child { border-bottom: none; }
.orders-table tbody tr:hover { background: rgba(83, 33, 148, .04); }

.orders-table td {
  padding: .75rem 1rem;
  vertical-align: middle;
}

.col-order strong { font-weight: 700; color: var(--text); }
.col-center { text-align: center; }
.col-muted  { color: var(--text-muted); font-size: .8rem; }
.col-error  { max-width: 200px; }

/* ── Status chip ───────────────────────────────────────────────── */
.status-chip {
  display: inline-block;
  background: rgba(83, 33, 148, .06);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 2px 8px;
  font-size: .78rem;
  color: var(--text-muted);
  white-space: nowrap;
}

/* ── Pills ─────────────────────────────────────────────────────── */
.pill {
  display: inline-block;
  border-radius: 20px;
  padding: 2px 9px;
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .03em;
  white-space: nowrap;
}

.pill-ok      { background: var(--success-soft); color: #146c3e; border: 1px solid rgba(23,138,76,.3);  }
.pill-pending { background: var(--warning-soft); color: #92400e; border: 1px solid rgba(180,83,9,.3);   }
.pill-error   { background: var(--danger-soft);  color: #991b1b; border: 1px solid rgba(185,28,28,.3);  }

/* ── Error snippet ─────────────────────────────────────────────── */
.error-snippet {
  font-size: .75rem;
  color: #991b1b;
  cursor: help;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ── Dots ──────────────────────────────────────────────────────── */
.dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
}

.dot.running { background: var(--success); box-shadow: 0 0 8px var(--success); animation: pulse-dot 2s infinite; }
.dot.busy    { background: var(--warning); box-shadow: 0 0 8px var(--warning); animation: pulse-dot .8s infinite; }
.dot.stopped { background: var(--text-dim); }

/* ── Buttons ───────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .4rem;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-family: var(--font);
  font-size: .825rem;
  font-weight: 600;
  padding: .5rem 1rem;
  transition: background .15s, opacity .15s, transform .1s, border-color .15s;
  white-space: nowrap;
  text-decoration: none;
}

.btn:active:not(:disabled) { transform: scale(.97); }

.btn:disabled,
.btn[disabled] { opacity: .4; cursor: not-allowed; pointer-events: none; }

/* Sistema unificado: primary = ação principal · outline = secundária/utilitária */
.btn-primary {
  background: var(--primary);
  color: #fff;
}
.btn-primary:hover { background: var(--primary-hover); }

.btn-outline {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
}
.btn-outline:hover { border-color: var(--text-muted); }

.btn-stop {
  background: var(--danger-soft);
  border: 1px solid rgba(185, 28, 28, .35);
  color: #991b1b;
}
.btn-stop:hover { background: rgba(185, 28, 28, .18); }

.btn-start {
  background: var(--success-soft);
  border: 1px solid rgba(23, 138, 76, .35);
  color: #146c3e;
}
.btn-start:hover { background: rgba(23, 138, 76, .18); }

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

.btn-clear {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: .45rem .65rem;
}

.btn-clear:hover { color: var(--text); border-color: var(--text-muted); text-decoration: none; }

.btn-page {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: .8rem;
  padding: .4rem .85rem;
  cursor: pointer;
}

.btn-page.disabled { opacity: .35; cursor: default; pointer-events: none; }
.btn-page:hover:not(.disabled) { background: var(--panel); text-decoration: none; }

/* ── Dropdown (navbar "Ações") ────────────────────────────────── */
.dropdown { position: relative; }

.dropdown-toggle { position: relative; }
.dropdown-caret { font-size: .6rem; transition: transform .15s; }
.dropdown.open .dropdown-caret { transform: rotate(180deg); }

.dropdown-menu {
  display: none;
  position: absolute;
  top: calc(100% + .4rem);
  right: 0;
  min-width: 220px;
  background: var(--panel-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 16px 40px rgba(var(--shadow-color), .18);
  padding: .4rem;
  z-index: 300;
}

.dropdown.open .dropdown-menu { display: flex; flex-direction: column; gap: .1rem; }

.dropdown-item {
  display: flex;
  align-items: center;
  gap: .6rem;
  background: none;
  border: none;
  border-radius: var(--radius-sm);
  color: var(--text);
  cursor: pointer;
  font-family: var(--font);
  font-size: .82rem;
  font-weight: 500;
  padding: .55rem .7rem;
  text-align: left;
  transition: background .12s;
  width: 100%;
}

.dropdown-item:hover:not(:disabled) { background: rgba(83, 33, 148, .07); }
.dropdown-item:disabled { opacity: .4; cursor: not-allowed; }
.dropdown-item i { width: 16px; text-align: center; color: var(--text-muted); }

.dropdown-sep {
  height: 1px;
  background: var(--border-soft);
  margin: .3rem .2rem;
}

/* ── Retry labels ──────────────────────────────────────────────── */
.col-nuvem { white-space: nowrap; }

.btn-verify-row {
  display: inline-flex;
  align-items: center;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  cursor: pointer;
  font-size: .72rem;
  padding: 2px 5px;
  margin-left: .3rem;
  vertical-align: middle;
  transition: color .15s, border-color .15s;
}
.btn-verify-row:hover { color: var(--text); border-color: var(--primary); }

.retry-ready,
.retry-waiting {
  display: block;
  font-size: .67rem;
  margin-top: .25rem;
  white-space: nowrap;
}

.retry-ready   { color: var(--success); }
.retry-waiting { color: var(--text-muted); }

/* ── Toast ─────────────────────────────────────────────────────── */
#toastContainer {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: .5rem;
  pointer-events: none;
}

.toast {
  background: var(--panel-raised);
  border: 1px solid var(--border);
  border-left: 3px solid var(--primary);
  border-radius: var(--radius-sm);
  padding: .7rem 1rem;
  color: var(--text);
  font-size: .82rem;
  max-width: 340px;
  opacity: 0;
  transform: translateX(16px);
  transition: opacity .25s ease, transform .25s ease;
  pointer-events: auto;
  box-shadow: 0 12px 30px rgba(var(--shadow-color), .18);
}

.toast.toast-visible  { opacity: 1; transform: none; }
.toast.toast-success  { border-left-color: var(--success); }
.toast.toast-error    { border-left-color: var(--danger); }

/* ── Pagination ────────────────────────────────────────────────── */
.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: .75rem;
  padding: .875rem 1rem;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: .825rem;
}

.page-info  { color: var(--text-muted); }
.page-total { font-size: .75rem; }
.page-nav   { display: flex; gap: .5rem; }

/* ── Empty state ───────────────────────────────────────────────── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .75rem;
  padding: 3rem 1rem;
  color: var(--text-muted);
  font-size: .9rem;
}

.empty-icon { font-size: 2.5rem; }

/* ── Animations ────────────────────────────────────────────────── */
@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50%       { opacity: .35; }
}

@keyframes flash-update {
  0%   { opacity: 1; }
  25%  { opacity: .55; }
  100% { opacity: 1; }
}

/* ── Modal ─────────────────────────────────────────────────────── */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(40, 12, 74, .5);
  z-index: 500;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal-overlay.open { display: flex; }

.modal-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  width: 100%;
  max-width: 480px;
  box-shadow: 0 24px 60px rgba(var(--shadow-color), .3);
  display: flex;
  flex-direction: column;
  gap: 0;
  overflow: hidden;
}

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

.modal-title {
  font-size: .9rem;
  font-weight: 700;
  color: var(--text);
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  padding: 0 .25rem;
  transition: color .15s;
}
.modal-close:hover { color: var(--text); }

/* Abas */
.modal-tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
}

.modal-tab {
  flex: 1;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-family: var(--font);
  font-size: .8rem;
  font-weight: 600;
  padding: .65rem 1rem;
  transition: color .15s, border-color .15s;
}
.modal-tab:hover { color: var(--text); }
.modal-tab.active { color: var(--primary); border-bottom-color: var(--primary); }

/* Painéis */
.modal-panel {
  display: flex;
  flex-direction: column;
  gap: .9rem;
  padding: 1.25rem;
}

.modal-desc {
  font-size: .8rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.modal-form {
  display: flex;
  flex-direction: column;
  gap: .6rem;
}

.modal-form-row {
  flex-direction: row;
  gap: .75rem;
}

.modal-field {
  display: flex;
  flex-direction: column;
  gap: .35rem;
  flex: 1;
}

.modal-label {
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--text-muted);
}

.modal-input {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--font);
  font-size: .875rem;
  padding: .5rem .75rem;
  outline: none;
  transition: border-color .15s;
  width: 100%;
}
.modal-input:focus { border-color: var(--primary); }
.modal-input[type="date"] { color-scheme: light; }

/* Feedback */
.modal-feedback {
  font-size: .8rem;
  min-height: 1.2rem;
}
.modal-feedback.ok    { color: var(--success); }
.modal-feedback.error { color: var(--danger); }

/* Progress */
.modal-progress {
  display: flex;
  flex-direction: column;
  gap: .4rem;
}

.modal-progress-bar-wrap {
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
}

.modal-progress-bar {
  height: 100%;
  background: var(--primary);
  border-radius: 3px;
  width: 0%;
  transition: width .3s ease;
}

.modal-progress-text {
  font-size: .75rem;
  color: var(--text-muted);
}

/* Ações */
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: .5rem;
  padding-top: .25rem;
}

.btn-modal-cancel {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: .45rem .9rem;
}
.btn-modal-cancel:hover { border-color: var(--text-muted); color: var(--text); }

.btn-modal-ok {
  background: var(--primary);
  color: #fff;
  padding: .45rem 1.1rem;
}
.btn-modal-ok:hover { background: var(--primary-hover); }

/* ── Scrollbar ─────────────────────────────────────────────────── */
::-webkit-scrollbar           { width: 5px; height: 5px; }
::-webkit-scrollbar-track     { background: transparent; }
::-webkit-scrollbar-thumb     { background: var(--border); border-radius: 4px; }

/* ── Responsive: tablet ────────────────────────────────────────── */
@media (max-width: 1100px) {
  .main { padding: 1.1rem; }
  .top-row { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .navbar-worker-meta { display: none; }
  .ranking-card { height: auto; }
  .ranking-list { flex: none; max-height: 220px; }
}

/* ── Responsive: mobile ────────────────────────────────────────── */
@media (max-width: 768px) {
  .navbar { padding: .55rem .875rem; gap: .75rem; }
  .navbar-worker { padding-left: .75rem; }
  .navbar-worker-text { display: none; }
  .btn-label { display: none; }
  .navbar-live { align-items: flex-end; }
  .update-time { display: none; }

  .main { padding: .875rem; gap: .875rem; }

  .stats-grid { grid-template-columns: repeat(2, 1fr); gap: .625rem; }
  .stat-value { font-size: 1.6rem; }
  .stat-card { padding: .9rem 1rem; }

  .filter-bar form    { gap: .5rem; }
  .search-wrap        { flex: 1 1 100%; min-width: 0; }
  .filter-input       { min-width: 0; flex: 1 1 100%; }
  .filter-select       { min-width: 0; flex: 1 1 auto; }
  .filter-date-wrap    { flex: 1 1 100%; }
  .filter-date         { min-width: 0; }

  .orders-table th,
  .orders-table td { padding: .6rem .75rem; }

  .col-error { display: none; }
}

@media (max-width: 480px) {
  .stat-value { font-size: 1.4rem; }
  .stat-label { font-size: .65rem; }
  .pagination { flex-direction: column; align-items: flex-start; }
}
