/* ============================================================
   simby.css — Design System + Layout Completo

   Paleta, cinzentos, tipografia (fs-xs a fs-3xl), sombra, raio e
   transição vêm de css/tokens.css, partilhado com simby.pt e
   carregado antes deste ficheiro. Aqui ficam só os tokens
   exclusivos da app.
   ============================================================ */

/* ---- Custom Properties ---- */
:root {
  --sidebar-w: 240px;
  --topbar-h:  60px;
}

/* ---- Reset ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; }
body {
  font-family: 'Inter', sans-serif;
  color: var(--text-main);
  background: var(--bg-light);
  line-height: 1.5;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
ul { list-style: none; }
button { cursor: pointer; font-family: inherit; }
input, select, textarea { font-family: inherit; }

/* ============================================================
   LAYOUT
   ============================================================ */

/* Sidebar */
.sidebar {
  position: fixed;
  top: 0; left: 0;
  width: var(--sidebar-w);
  height: 100vh;
  background: var(--green-dark);
  display: flex;
  flex-direction: column;
  z-index: 200;
  overflow-y: auto;
  transition: transform var(--transition);
}

.sidebar-logo {
  padding: 24px 20px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  display: flex;
  align-items: center;
  justify-content: center;
}

.sidebar-logo img {
  height: 40px;
  width: auto;
  object-fit: contain;
  background: white;
  border-radius: 8px;
  padding: 6px 12px;
}

.sidebar-logo-text {
  display: none;
}

.sidebar-nav {
  flex: 1;
  padding: 16px 0;
}

.sidebar-section-label {
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: rgba(255,255,255,0.58);
  padding: 10px 20px 4px;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 20px;
  color: rgba(255,255,255,0.75);
  font-size: 0.82rem;
  font-weight: 500;
  border-radius: 0;
  transition: background var(--transition), color var(--transition);
  margin: 1px 8px;
  border-radius: var(--radius-sm);
}

.sidebar-link:hover {
  background: rgba(255,255,255,0.08);
  color: var(--white);
}

.sidebar-link.active {
  /* green-mid em vez de green-accent: branco sobre accent falhava
     contraste WCAG (2.6:1); green-mid passa (~6.4:1) */
  background: var(--green-mid);
  color: var(--white);
  box-shadow: inset 3px 0 0 var(--green-accent);
}

.sidebar-link .icon {
  font-size: 0.9rem;
  width: 18px;
  text-align: center;
  flex-shrink: 0;
}

/* Ícones SVG (substituem emoji — sprite injetado por js/sidebar.js) */
svg.icon {
  width: 17px;
  height: 17px;
  flex-shrink: 0;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid rgba(255,255,255,0.1);
  font-size: 0.75rem;
  color: rgba(255,255,255,0.58);
}

/* Topbar */
.topbar {
  position: fixed;
  top: 0;
  left: var(--sidebar-w);
  right: 0;
  height: var(--topbar-h);
  background: var(--white);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  z-index: 100;
  box-shadow: var(--shadow-sm);
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.topbar-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-main);
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.user-name {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-main);
}

.user-role {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.user-info {
  text-align: right;
}

.notif-bell { position: relative; display: flex; }
.notif-badge {
  position: absolute; top: -2px; right: -2px;
  background: #dc3545; color: var(--white);
  font-size: 0.62rem; font-weight: 700; line-height: 1;
  padding: 2px 4px; border-radius: 50px; min-width: 14px; text-align: center;
}
.notif-dropdown {
  position: absolute; top: calc(100% + 8px); right: 0;
  width: 320px; max-height: 400px; overflow-y: auto;
  background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow-lg);
  border: 1px solid var(--border); z-index: 500;
}
.notif-dropdown-loading, .notif-dropdown-empty {
  padding: 20px; text-align: center; color: var(--gray-500); font-size: var(--fs-sm);
}
.notif-item {
  display: block; padding: 12px 16px; border-bottom: 1px solid var(--gray-200);
  color: var(--text-main);
}
.notif-item:last-child { border-bottom: none; }
.notif-item:hover { background: var(--bg-light); }
.notif-item.unread { background: #f0f9f4; }
.notif-item-title { font-weight: 600; font-size: var(--fs-sm); color: var(--green-dark); }
.notif-item-sub { font-size: var(--fs-xs); color: var(--gray-500); margin-top: 2px; }

.avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--green-mid);
  color: var(--white);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.8rem;
  flex-shrink: 0;
}

/* Main Content */
.main-content {
  margin-left: var(--sidebar-w);
  margin-top: var(--topbar-h);
  padding: 28px;
  min-height: calc(100vh - var(--topbar-h));
}

/* Page Header */
.page-header {
  margin-bottom: 24px;
}

.page-header h1 {
  font-family: 'Inter', sans-serif;
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--green-dark);
  margin-bottom: 4px;
}

.page-header p {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

/* ============================================================
   CARDS KPI
   ============================================================ */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

.kpi-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition);
}

.kpi-card:hover {
  box-shadow: var(--shadow-md);
}

.kpi-label {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

.kpi-value {
  font-family: 'Inter', sans-serif;
  font-size: 2rem;
  font-weight: 700;
  color: var(--green-mid);
  line-height: 1;
  margin-bottom: 6px;
}

.kpi-sub {
  font-size: 0.78rem;
  color: var(--text-secondary);
}

/* ============================================================
   CARDS GENÉRICOS
   ============================================================ */
.card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 24px;
  margin-bottom: 20px;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.card-title {
  font-family: 'Inter', sans-serif;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--green-dark);
}

/* ============================================================
   TABELA
   ============================================================ */
.table-wrapper {
  overflow-x: auto;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

thead th {
  background: var(--bg-light);
  padding: 12px 16px;
  text-align: left;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.th-sortable {
  cursor: pointer;
  user-select: none;
}
.th-sortable::after {
  content: '↕';
  opacity: 0.35;
  margin-left: 5px;
  font-size: 0.7rem;
}
.th-sortable[aria-sort="ascending"]::after  { content: '▲'; opacity: 1; color: var(--green-accent); }
.th-sortable[aria-sort="descending"]::after { content: '▼'; opacity: 1; color: var(--green-accent); }

tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background var(--transition);
}

tbody tr:last-child { border-bottom: none; }

tbody tr:nth-child(odd) { background: var(--white); }
tbody tr:nth-child(even) { background: #fafbfc; }

tbody tr:hover { background: #f0f7f4; }

tbody td {
  padding: 12px 16px;
  color: var(--text-main);
  vertical-align: middle;
}

/* ============================================================
   FORMULÁRIOS
   ============================================================ */
.form-group {
  margin-bottom: 18px;
}

.form-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-main);
  margin-bottom: 6px;
}

.form-label .required {
  color: #dc3545;
  margin-left: 2px;
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  color: var(--text-main);
  background: var(--white);
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  border-color: var(--green-accent);
  box-shadow: 0 0 0 3px rgba(82,183,136,0.15);
}

.form-textarea {
  resize: vertical;
  min-height: 100px;
}

.form-hint {
  font-size: 0.78rem;
  color: var(--text-secondary);
  margin-top: 4px;
}

.form-error {
  font-size: 0.78rem;
  color: #dc3545;
  margin-top: 4px;
}

.form-input.invalid,
.form-select.invalid,
.form-textarea.invalid {
  border-color: #dc3545;
  box-shadow: 0 0 0 3px rgba(220,53,69,0.12);
}

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

.form-row-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 16px;
}

/* Radio group */
.radio-group {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.radio-option {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 0.875rem;
}

.radio-option input[type="radio"] {
  accent-color: var(--green-accent);
  width: 16px;
  height: 16px;
}

/* ============================================================
   BADGES DE ESTADO
   ============================================================ */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 50px;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  white-space: nowrap;
}

.badge-draft        { background: #f0f0f0; color: #666; }
.badge-pending      { background: #fff3cd; color: #856404; }
.badge-approved     { background: #cfe2ff; color: #084298; }
.badge-active       { background: #d1e7dd; color: #0a3622; }
.badge-closed       { background: #dee2e6; color: #444; }
.badge-archived     { background: #dee2e6; color: #444; }
.badge-cancelled    { background: #f8d7da; color: #842029; }
.badge-suspended    { background: #f8d7da; color: #842029; }
.badge-winning      { background: #d1e7dd; color: #0a3622; }
.badge-losing       { background: #fff3cd; color: #856404; }
.badge-won          { background: #d1e7dd; color: #0a3622; }
.badge-lost         { background: #f0f0f0; color: #666; }
.badge-seller        { background: #e8f4fd; color: #1565c0; }
.badge-buyer         { background: #e8f5e9; color: #2e7d32; }
.badge-admin        { background: #f3e5f5; color: #7b1fa2; }

/* ============================================================
   BOTÕES
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 20px;
  border-radius: 50px;
  font-size: 0.875rem;
  font-weight: 600;
  border: none;
  transition: all var(--transition);
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
}

.btn-primary {
  /* green-mid em vez de green-accent: branco sobre accent falhava
     contraste WCAG (2.6:1); green-mid passa (~6.4:1). accent fica para
     acentos/bordas/hover, não para preenchimentos com texto branco. */
  background: var(--green-mid);
  color: var(--white);
}
.btn-primary:hover {
  background: var(--green-dark);
  color: var(--white);
}

.btn-secondary {
  background: var(--white);
  color: var(--text-main);
  border: 1px solid var(--border);
}
.btn-secondary:hover {
  background: var(--bg-light);
  border-color: #adb5bd;
}

.btn-danger {
  background: #dc3545;
  color: var(--white);
}
.btn-danger:hover { background: #bb2d3b; }

.btn-success {
  background: #198754;
  color: var(--white);
}
.btn-success:hover { background: #146c43; }

.btn-warning {
  background: #ffc107;
  color: #212529;
}
.btn-warning:hover { background: #e0a800; }

.btn-sm {
  padding: 7px 14px;
  font-size: 0.78rem;
  min-height: 32px;
}

.btn-lg {
  padding: 13px 32px;
  font-size: 1rem;
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  pointer-events: none;
}

.btn-icon {
  background: none;
  border: none;
  padding: 6px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  transition: background var(--transition), color var(--transition);
}
.btn-icon:hover {
  background: var(--bg-light);
  color: var(--text-main);
}

/* ============================================================
   MODAL
   ============================================================ */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

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

.modal-card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  animation: modalIn 0.2s ease;
}

.modal-card-lg {
  max-width: 800px;
}

@keyframes modalIn {
  from { transform: translateY(-16px); opacity: 0; }
  to   { transform: translateY(0);     opacity: 1; }
}

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

.modal-title {
  font-family: 'Inter', sans-serif;
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--green-dark);
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.25rem;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  line-height: 1;
  transition: background var(--transition);
}
.modal-close:hover { background: var(--bg-light); }

.modal-body {
  padding: 24px;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

/* ============================================================
   WIZARD / STEPS
   ============================================================ */
.wizard-steps {
  display: flex;
  align-items: center;
  gap: 0;
  margin-bottom: 32px;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
  box-shadow: var(--shadow-sm);
}

.wizard-step {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
}

.wizard-step-num {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--border);
  color: var(--text-secondary);
  font-size: 0.85rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all var(--transition);
}

.wizard-step.active .wizard-step-num {
  background: var(--green-accent);
  color: var(--white);
}

.wizard-step.done .wizard-step-num {
  background: var(--green-mid);
  color: var(--white);
}

.wizard-step-label {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.wizard-step.active .wizard-step-label { color: var(--green-dark); font-weight: 600; }
.wizard-step.done .wizard-step-label   { color: var(--green-mid); }

.wizard-separator {
  flex: 1;
  height: 2px;
  background: var(--border);
  margin: 0 12px;
}

.wizard-panel {
  display: none;
}

.wizard-panel.active {
  display: block;
}

/* ============================================================
   FILTERS
   ============================================================ */
.filters-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.filters-bar .form-input,
.filters-bar .form-select {
  width: auto;
  min-width: 160px;
}

/* ============================================================
   PAGINATION
   ============================================================ */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 20px;
}

.pagination-btn {
  padding: 6px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--white);
  font-size: 0.875rem;
  cursor: pointer;
  transition: all var(--transition);
}

.pagination-btn:hover { border-color: var(--green-accent); color: var(--green-accent); }
.pagination-btn.active { background: var(--green-accent); color: var(--white); border-color: var(--green-accent); }
.pagination-btn:disabled { opacity: 0.4; cursor: not-allowed; }

.pagination-info {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

/* ============================================================
   TABS
   ============================================================ */
.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 2px solid var(--border);
  margin-bottom: 24px;
}

.tab-btn {
  padding: 10px 20px;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  cursor: pointer;
  transition: all var(--transition);
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
}

.tab-btn:hover { color: var(--text-main); background: var(--bg-light); }
.tab-btn.active { color: var(--green-accent); border-bottom-color: var(--green-accent); font-weight: 600; }

.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ============================================================
   TAB BAR (perfil, tutorial) — extraído de 4 páginas onde estava
   duplicado byte-a-byte (vendedor/comprador perfil e tutorial).
   Escopado sob .tab-bar para não colidir com .tabs/.tab-btn genérico
   (usado por admin-registos.html com valores diferentes).
   ============================================================ */
.tab-bar { display: flex; gap: 0; border-bottom: 2px solid var(--border); margin-bottom: 24px; }
.tab-bar .tab-btn {
  padding: 10px 24px;
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  font-size: var(--fs-md);
  font-weight: 600;
  color: var(--gray-500);
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}
.tab-bar .tab-btn.active { color: var(--green-dark); border-bottom-color: var(--green-accent); }
.tab-bar .tab-panel { display: none; }
.tab-bar .tab-panel.active { display: block; }

/* ---- Perfil (vendedor-perfil.html, comprador-perfil.html) ---- */
.profile-field {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding: 14px 0;
  border-bottom: 1px solid #f0f0f0;
}
.profile-field:last-child { border-bottom: none; }
.profile-field-label {
  width: 180px;
  flex-shrink: 0;
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--gray-500);
  padding-top: 2px;
}
.profile-field-value { flex: 1; font-size: var(--fs-md); color: var(--green-dark); }
.profile-field-input { flex: 1; }
.profile-field-input input,
.profile-field-input select {
  width: 100%;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  font-size: var(--fs-base);
  font-family: inherit;
  outline: none;
  box-sizing: border-box;
}
.profile-field-input input:focus,
.profile-field-input select:focus { border-color: var(--green-accent); }

.change-request-card {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px 20px;
  margin-bottom: 12px;
}
.change-request-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.change-request-date { font-size: var(--fs-sm); color: var(--gray-500); }
.change-field-row { display: flex; gap: 12px; font-size: var(--fs-sm); margin-bottom: 6px; flex-wrap: wrap; }
.change-field-name { font-weight: 600; color: var(--gray-700); min-width: 120px; }
.change-field-old { color: #dc3545; text-decoration: line-through; }
.change-field-new { color: #28a745; }
.change-admin-note {
  margin-top: 10px; padding: 8px 12px; background: #fff3cd;
  border-radius: 6px; font-size: 0.82rem; color: #664d03;
}
.edit-actions { display: flex; gap: 10px; margin-top: 20px; justify-content: flex-end; }
.info-box {
  background: #f0f9f4; border: 1px solid #b7e4c7; border-radius: var(--radius-sm);
  padding: 12px 16px; font-size: var(--fs-sm); color: var(--green-mid); margin-bottom: 20px;
}

/* ---- Tutorial (vendedor-tutorial.html, comprador-tutorial.html) ---- */
.steps-list { list-style: none; padding: 0; margin: 0; }
.step-item { display: flex; gap: 18px; align-items: flex-start; padding: 20px 0; border-bottom: 1px solid #f0f0f0; }
.step-item:last-child { border-bottom: none; }
.step-icon { font-size: 1.8rem; flex-shrink: 0; width: 48px; text-align: center; line-height: 1; padding-top: 2px; }
.step-num {
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--green-accent); color: var(--white);
  font-size: var(--fs-sm); font-weight: 700; flex-shrink: 0; margin-top: 4px;
}
.step-body h3 { margin: 0 0 6px; font-size: var(--fs-md); color: var(--green-dark); }
.step-body p { margin: 0; font-size: var(--fs-md); color: var(--gray-700); line-height: 1.6; }

.obrig-list { list-style: none; padding: 0; margin: 0; }
.obrig-item {
  display: flex; gap: 12px; align-items: flex-start; padding: 14px 0;
  border-bottom: 1px solid #f0f0f0; font-size: var(--fs-md); color: #333; line-height: 1.6;
}
.obrig-item:last-child { border-bottom: none; }
.obrig-bullet { color: var(--green-accent); font-size: 1.2rem; flex-shrink: 0; margin-top: 1px; }

/* ============================================================
   AUCTION CARDS (comprador explorar)
   ============================================================ */
.auction-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
}

.auction-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 20px;
  display: flex;
  flex-direction: column;
  transition: box-shadow var(--transition), transform var(--transition);
}

.auction-card-photo {
  height: 140px;
  margin: -20px -20px 14px;
  border-radius: var(--radius) var(--radius) 0 0;
  background-size: cover;
  background-position: center;
  background-color: var(--bg-light);
}
.auction-card-photo-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--gray-400);
}
.auction-card-photo-empty svg.icon { width: 32px; height: 32px; }

.auction-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.auction-card-title {
  font-family: 'Inter', sans-serif;
  font-size: 1rem;
  font-weight: 600;
  color: var(--green-dark);
  margin-bottom: 8px;
}

.auction-card-meta {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-bottom: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.auction-card-price {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--green-mid);
  font-family: 'Inter', sans-serif;
  margin-bottom: 8px;
}

.auction-card-countdown {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-bottom: 16px;
}

.auction-card-footer {
  margin-top: auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* Countdown display */
.countdown {
  font-family: 'Inter', sans-serif;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--green-mid);
  letter-spacing: 1px;
}

.countdown.urgent { color: #dc3545; }

/* Bid panel */
.bid-panel {
  background: var(--bg-light);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}

.bid-current-amount {
  font-family: 'Inter', sans-serif;
  font-size: 2rem;
  font-weight: 700;
  color: var(--green-mid);
  text-align: center;
  margin: 12px 0;
}

.bid-form-row {
  display: flex;
  gap: 10px;
  align-items: flex-end;
}

.bid-form-row .form-input { flex: 1; }

/* ============================================================
   DETAIL VIEW — 2 colunas
   ============================================================ */
.detail-layout {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 24px;
  align-items: start;
}

.detail-section {
  margin-bottom: 20px;
}

.detail-section-title {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-secondary);
  margin-bottom: 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}

.detail-row {
  display: flex;
  gap: 16px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.875rem;
}

.detail-row:last-child { border-bottom: none; }

.detail-row-label {
  color: var(--text-secondary);
  flex: 0 0 140px;
  font-weight: 500;
}

.detail-row-value {
  color: var(--text-main);
  flex: 1;
}

/* Live feed */
.live-feed {
  max-height: 280px;
  overflow-y: auto;
}

.feed-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.85rem;
}

.feed-item:last-child { border-bottom: none; }

.feed-amount {
  font-weight: 700;
  color: var(--green-mid);
}

.feed-time {
  color: var(--text-secondary);
  font-size: 0.78rem;
}

/* ============================================================
   ALERT / TOAST
   ============================================================ */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.alert-success { background: #d1e7dd; color: #0a3622; border: 1px solid #badbcc; }
.alert-error   { background: #f8d7da; color: #842029; border: 1px solid #f5c2c7; }
.alert-warning { background: #fff3cd; color: #664d03; border: 1px solid #ffecb5; }
.alert-info    { background: #cfe2ff; color: #084298; border: 1px solid #b6d4fe; }

/* Toast notification */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.toast {
  background: var(--green-dark);
  color: var(--white);
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  box-shadow: var(--shadow-lg);
  pointer-events: auto;
  animation: toastIn 0.25s ease;
  max-width: 320px;
}

.toast.error { background: #dc3545; }
.toast.success { background: #198754; }

@keyframes toastIn {
  from { transform: translateY(12px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

/* ============================================================
   EMPTY STATE
   ============================================================ */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-secondary);
}

.empty-state-icon {
  font-size: 3rem;
  margin-bottom: 12px;
  opacity: 0.5;
}

.empty-state h3 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text-main);
}

.empty-state p { font-size: 0.875rem; }

/* ============================================================
   LOADING SPINNER
   ============================================================ */
.spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid rgba(82,183,136,0.3);
  border-top-color: var(--green-accent);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

.spinner-lg {
  width: 36px;
  height: 36px;
  border-width: 3px;
}

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

.loading-row td {
  text-align: center;
  padding: 32px;
  color: var(--text-secondary);
}

/* ============================================================
   EQUIPMENT LINES (wizard passo 2)
   ============================================================ */
.equipment-lines {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.equipment-line {
  display: grid;
  grid-template-columns: 1fr auto auto auto;
  gap: 10px;
  align-items: center;
  background: var(--bg-light);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px;
}

.equipment-line .form-select,
.equipment-line .form-input { margin: 0; }

/* Summary list (wizard passo 3) */
.summary-section {
  background: var(--bg-light);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px;
  margin-bottom: 16px;
}

.summary-row {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  font-size: 0.875rem;
  border-bottom: 1px solid var(--border);
}

.summary-row:last-child { border-bottom: none; }
.summary-label { color: var(--text-secondary); }
.summary-value { font-weight: 500; }

/* ============================================================
   LOGIN PAGE
   ============================================================ */
.login-page {
  min-height: 100vh;
  background: linear-gradient(135deg, #1a3d2b 0%, #2d6a4f 60%, #3a8a65 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.login-card {
  background: var(--white);
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
  padding: 40px;
  width: 100%;
  max-width: 420px;
}

.login-logo {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 28px;
}

.login-logo img {
  width: 64px;
  height: 64px;
  object-fit: contain;
  margin-bottom: 12px;
}

.login-logo-name {
  font-family: 'Inter', sans-serif;
  font-size: 2rem;
  font-weight: 700;
  color: var(--green-dark);
  letter-spacing: -1px;
  line-height: 1;
}

.login-logo-tagline {
  font-family: 'Inter', sans-serif;
  font-style: italic;
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-top: 4px;
}

/* ============================================================
   STATS HIGHLIGHT
   ============================================================ */
.stat-highlight {
  text-align: center;
  padding: 16px;
}

.stat-highlight-value {
  font-family: 'Inter', sans-serif;
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--green-mid);
}

.stat-highlight-label {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-top: 4px;
}

/* ============================================================
   HAMBURGER (mobile)
   ============================================================ */
.hamburger {
  display: none;
  flex-direction: column;
  gap: 4px;
  background: none;
  border: none;
  padding: 6px;
  cursor: pointer;
}

.hamburger span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--text-main);
  border-radius: 2px;
  transition: all var(--transition);
}

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 150;
}

/* ============================================================
   ACESSIBILIDADE — focus visível global
   ============================================================ */
:where(a, button, input, select, textarea, [tabindex]):focus-visible {
  outline: 2px solid var(--green-accent);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* ============================================================
   UTILITÁRIOS — substituem os padrões inline mais repetidos
   ============================================================ */
.text-muted   { color: var(--gray-500); }
.text-sm      { font-size: var(--fs-sm); }
.flex         { display: flex; align-items: center; gap: 10px; }
.flex-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.btn-block    { width: 100%; justify-content: center; }
.td-empty     { text-align: center; color: var(--gray-500); padding: 20px; }
.grid-2       { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
@media (max-width: 768px) { .grid-2 { grid-template-columns: 1fr; } }

/* ============================================================
   CARTÃO INDICADORES AMBIENTAIS — era copiado inline em 3 dashboards
   ============================================================ */
.env-card {
  margin-top: 20px;
  background: linear-gradient(135deg, var(--green-dark) 0%, var(--green-mid) 100%);
  color: var(--white);
  border: none;
}
.env-card .card-header { border-bottom: 1px solid rgba(255,255,255,0.15); }
.env-card .card-title   { color: var(--white); }
.env-card-sub   { font-size: var(--fs-sm); color: rgba(255,255,255,0.78); }
.env-card .kpi-grid  { padding: 16px 0 0; }
.env-card .kpi-card  { background: rgba(255,255,255,0.1); border: 1px solid rgba(255,255,255,0.15); }
.env-card .kpi-label { color: rgba(255,255,255,0.85); }
.env-card .kpi-value { color: #d8f3dc; }
.env-card .kpi-sub   { color: rgba(255,255,255,0.7); }
.env-card-detail { font-size: var(--fs-xs); color: rgba(255,255,255,0.7); margin-top: 4px; }

/* ============================================================
   MATERIAIS — Histórico
   ============================================================ */
.price-history-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 320px;
  overflow-y: auto;
}

.price-history-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  background: var(--bg-light);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
/* Tablet — .detail-layout (2 colunas: conteúdo + painel 340px) espremia
   o conteúdo entre a sidebar (240px) e o painel fixo; breakpoint próprio
   em vez de só colapsar a partir de 768px */
@media (max-width: 1024px) {
  .detail-layout {
    grid-template-columns: 1fr;
  }
}

/* ---- Tabelas → cards em ecrãs pequenos (opt-in via .table-cards) ---- */
@media (max-width: 640px) {
  .table-cards thead { display: none; }
  .table-cards tr {
    display: block;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    margin-bottom: 10px;
    padding: 8px 12px;
  }
  .table-cards td {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 6px 0;
    border: none;
    text-align: right;
  }
  .table-cards td::before {
    content: attr(data-label);
    font-size: var(--fs-xs);
    font-weight: 600;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.4px;
    text-align: left;
  }
}

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }

  .sidebar.mobile-open {
    transform: translateX(0);
  }

  .sidebar-overlay.mobile-open {
    display: block;
  }

  .topbar {
    left: 0;
  }

  .main-content {
    margin-left: 0;
    padding: 16px;
  }

  .hamburger { display: flex; }

  .form-row, .form-row-3 {
    grid-template-columns: 1fr;
  }

  .detail-layout {
    grid-template-columns: 1fr;
  }

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

  .auction-grid {
    grid-template-columns: 1fr;
  }

  .equipment-line {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto auto;
  }
}

@media (max-width: 480px) {
  .kpi-grid { grid-template-columns: 1fr; }
  .login-card { padding: 28px 20px; }
  .tabs { overflow-x: auto; }
}
