*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Inter', sans-serif;
  background: #e8edf6;
  color: #1a2040;
  min-height: 100vh;
}

a { text-decoration: none; color: inherit; }

/* ── Login page ── */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.login-card {
  background: #fff;
  border-radius: 1rem;
  box-shadow: 0 8px 40px rgba(20, 44, 85, 0.12);
  padding: 2rem 2rem 2.25rem;
  width: 100%;
  max-width: 400px;
}

.login-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid #e8edf6;
}

.login-logo {
  width: 44px;
  height: 44px;
  flex-shrink: 0;
}

.login-header-text h1 {
  font-size: 1rem;
  font-weight: 700;
  color: #142C55;
  line-height: 1.2;
}

.login-header-text p {
  font-size: 0.75rem;
  color: #6b7280;
  margin-top: 2px;
}

.login-error {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #b91c1c;
  border-radius: 0.5rem;
  padding: 0.625rem 0.875rem;
  font-size: 0.8125rem;
  margin-bottom: 1.25rem;
}

.login-field {
  margin-bottom: 1.125rem;
}

.login-field label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 600;
  color: #374151;
  margin-bottom: 0.375rem;
}

.login-field input {
  width: 100%;
  padding: 0.6875rem 0.875rem;
  border: 1.5px solid #d1d5db;
  border-radius: 0.5rem;
  font-family: inherit;
  font-size: 0.9375rem;
  color: #1a2040;
  background: #fff;
  transition: border-color 0.15s;
  outline: none;
}

.login-field input::placeholder { color: #9ca3af; }
.login-field input:focus { border-color: #142C55; }

.login-field-pw {
  position: relative;
}

.login-field-pw input { padding-right: 2.75rem; }

.login-pw-toggle {
  position: absolute;
  right: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  color: #9ca3af;
  display: flex;
  align-items: center;
  padding: 0;
  transition: color 0.15s;
}

.login-pw-toggle:hover { color: #374151; }
.login-pw-toggle svg { width: 18px; height: 18px; }

.login-btn {
  width: 100%;
  padding: 0.75rem;
  background: #142C55;
  color: #fff;
  border: none;
  border-radius: 0.5rem;
  font-family: inherit;
  font-size: 0.9375rem;
  font-weight: 600;
  cursor: pointer;
  margin-top: 0.5rem;
  transition: opacity 0.15s;
}

.login-btn:hover { opacity: 0.88; }

/* ── Dashboard layout ── */
.dash-layout {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.dash-header {
  background: #142C55;
  padding: 0 1.5rem;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-shrink: 0;
}

.dash-header-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.dash-header-logo {
  width: 32px;
  height: 32px;
  filter: brightness(0) invert(1) opacity(0.9);
}

.dash-header-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: rgba(255,255,255,0.92);
}

.dash-header-sub {
  font-size: 0.6875rem;
  color: rgba(255,255,255,0.45);
}

.dash-header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.dash-sync-btn {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.4375rem 0.875rem;
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.15);
  color: rgba(255,255,255,0.8);
  border-radius: 0.35rem;
  font-family: inherit;
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  cursor: pointer;
  transition: background 0.15s;
}

.dash-sync-btn:hover { background: rgba(255,255,255,0.18); }
.dash-sync-btn svg { width: 13px; height: 13px; }

.dash-logout-btn {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.4375rem 0.875rem;
  background: transparent;
  border: 1px solid rgba(255,255,255,0.2);
  color: rgba(255,255,255,0.65);
  border-radius: 0.35rem;
  font-family: inherit;
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}

.dash-logout-btn:hover { color: #fff; border-color: rgba(255,255,255,0.4); }
.dash-logout-btn svg { width: 13px; height: 13px; }

.dash-main {
  flex: 1;
  padding: 2rem 1.5rem;
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
}

/* ── Tabs ── */
.dash-tabs {
  display: flex;
  gap: 0.25rem;
  margin-bottom: 1.75rem;
  border-bottom: 2px solid #dde1ee;
  padding-bottom: 0;
}

.dash-tab-btn {
  padding: 0.5rem 1rem;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  font-family: inherit;
  font-size: 0.8125rem;
  font-weight: 600;
  color: #6b7280;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
  white-space: nowrap;
}

.dash-tab-btn:hover { color: #142C55; }
.dash-tab-btn.active { color: #142C55; border-bottom-color: #142C55; }

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

/* ── Docs ── */
.docs-wrap {
  background: #fff;
  border-radius: 0.75rem;
  border: 1px solid #dde1ee;
  padding: 2rem;
}

.docs-wrap h2 {
  font-size: 1.125rem;
  font-weight: 700;
  color: #142C55;
  margin: 0 0 0.25rem;
}

.docs-wrap .docs-intro {
  font-size: 0.875rem;
  color: #6b7280;
  margin-bottom: 2rem;
  border-bottom: 1px solid #dde1ee;
  padding-bottom: 1.25rem;
}

.docs-section {
  margin-bottom: 2rem;
}

.docs-section:last-child { margin-bottom: 0; }

.docs-section h3 {
  font-size: 0.9375rem;
  font-weight: 700;
  color: #1a2040;
  margin: 0 0 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.docs-section h3::before {
  content: '';
  display: inline-block;
  width: 3px;
  height: 1em;
  background: #142C55;
  border-radius: 2px;
  flex-shrink: 0;
}

.docs-section p {
  font-size: 0.8125rem;
  color: #374151;
  line-height: 1.6;
  margin: 0 0 0.625rem;
}

.docs-section p:last-child { margin-bottom: 0; }

.docs-section ul, .docs-section ol {
  font-size: 0.8125rem;
  color: #374151;
  line-height: 1.6;
  margin: 0.375rem 0 0.625rem;
  padding-left: 1.375rem;
}

.docs-section li { margin-bottom: 0.25rem; }

.docs-code {
  background: #f3f4f8;
  border: 1px solid #dde1ee;
  border-radius: 0.5rem;
  padding: 1rem 1.25rem;
  margin: 0.75rem 0;
  font-family: 'Courier New', monospace;
  font-size: 0.75rem;
  color: #1a2040;
  overflow-x: auto;
  white-space: pre;
  line-height: 1.5;
}

.docs-icons-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0.75rem 0;
}

.docs-icon-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.2rem 0.625rem;
  background: #f0f2fa;
  border: 1px solid #dde1ee;
  border-radius: 0.3rem;
  font-family: 'Courier New', monospace;
  font-size: 0.75rem;
  color: #142C55;
  font-weight: 600;
}

.docs-warn {
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: 0.5rem;
  padding: 0.75rem 1rem;
  font-size: 0.8125rem;
  color: #92400e;
  margin: 0.75rem 0;
}

.docs-divider {
  border: none;
  border-top: 1px solid #dde1ee;
  margin: 1.75rem 0;
}

/* ── Stats bar ── */
.dash-stats {
  display: flex;
  gap: 1rem;
  margin-bottom: 1.75rem;
  flex-wrap: wrap;
}

.dash-stat {
  background: #fff;
  border-radius: 0.625rem;
  padding: 1rem 1.5rem;
  border: 1px solid #dde1ee;
  min-width: 120px;
}

.dash-stat-value {
  font-size: 1.75rem;
  font-weight: 700;
  color: #142C55;
  line-height: 1;
}

.dash-stat-label {
  font-size: 0.6875rem;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-top: 0.25rem;
}

/* ── Table ── */
.dash-table-wrap {
  background: #fff;
  border-radius: 0.75rem;
  border: 1px solid #dde1ee;
  overflow: hidden;
}

.dash-table-head {
  padding: 1rem 1.5rem 0.75rem;
  border-bottom: 1px solid #dde1ee;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.dash-table-head h2 {
  font-size: 0.9375rem;
  font-weight: 600;
  color: #142C55;
}

table {
  width: 100%;
  border-collapse: collapse;
}

thead th {
  text-align: left;
  padding: 0.75rem 1.5rem;
  font-size: 0.625rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #6b7280;
  background: #f8f9fc;
  border-bottom: 1px solid #dde1ee;
}

tbody tr { transition: background 0.1s; }
tbody tr:hover { background: #f8f9fc; }

tbody td {
  padding: 0.875rem 1.5rem;
  font-size: 0.8125rem;
  color: #374151;
  border-bottom: 1px solid #f0f2fa;
  vertical-align: middle;
}

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

.td-mono {
  font-family: 'Roboto Mono', 'Courier New', monospace;
  font-size: 0.8125rem;
  font-weight: 600;
  color: #142C55;
  letter-spacing: 0.04em;
}

.td-url {
  font-size: 0.75rem;
  color: #6b7280;
}

.td-url a { color: #142C55; }
.td-url a:hover { text-decoration: underline; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.2rem 0.625rem;
  border-radius: 999px;
  font-size: 0.6875rem;
  font-weight: 600;
}

.badge-active {
  background: #dcfce7;
  color: #166534;
}

.badge-inactive {
  background: #f3f4f6;
  color: #6b7280;
}

.td-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.act-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.3125rem 0.625rem;
  border-radius: 0.3rem;
  font-family: inherit;
  font-size: 0.6875rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  white-space: nowrap;
  transition: opacity 0.15s, background 0.15s;
}

.act-btn svg { width: 12px; height: 12px; flex-shrink: 0; }

.act-btn-gallery {
  background: #f0f2fa;
  color: #142C55;
  border-color: #dde1ee;
}

.act-btn-gallery:hover { background: #e2e6f3; }

.act-btn-qr {
  background: #142C55;
  color: #fff;
}

.act-btn-qr:hover { opacity: 0.85; }

.empty-row td {
  text-align: center;
  padding: 3rem;
  color: #9ca3af;
  font-size: 0.875rem;
}

/* ── QR Modal (same as public, reused) ── */
.qr-modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: rgba(20, 44, 85, 0.6);
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  backdrop-filter: blur(4px);
}

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

.qr-modal-card {
  background: #fff;
  border-radius: 0.75rem;
  width: 100%;
  max-width: 360px;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  box-shadow: 0 24px 48px rgba(20, 44, 85, 0.25);
}

.qr-modal-header { display: flex; align-items: center; justify-content: space-between; }

.qr-modal-title { font-size: 0.9375rem; font-weight: 600; color: #142C55; }

.qr-modal-gallery-name {
  font-size: 0.75rem;
  color: #6b7280;
  margin-top: 2px;
}

.qr-modal-close {
  width: 30px; height: 30px;
  background: none; border: none; color: #9ca3af;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  border-radius: 50%; transition: background 0.15s, color 0.15s;
}

.qr-modal-close:hover { background: #f0f2fa; color: #1a2040; }
.qr-modal-close svg { width: 16px; height: 16px; }

#qr-canvas {
  width: 100%; height: auto; border-radius: 0.5rem;
  border: 1px solid #dde1ee; display: block;
  background: repeating-conic-gradient(#e9ebf0 0% 25%, #fff 0% 50%) 0 0 / 16px 16px;
  image-rendering: pixelated;
}

.qr-options { display: flex; flex-direction: column; gap: 0.875rem; }

.qr-option-row { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; }

.qr-option-label {
  font-size: 0.6875rem; font-weight: 600;
  color: #6b7280; text-transform: uppercase; letter-spacing: 0.1em; white-space: nowrap;
}

.qr-swatches { display: flex; align-items: center; gap: 0.4rem; }

.qr-swatch {
  width: 24px; height: 24px; border-radius: 50%;
  border: 2px solid rgba(0,0,0,0.12);
  cursor: pointer; padding: 0; outline: none;
  -webkit-appearance: none; appearance: none;
  transition: transform 0.15s, box-shadow 0.15s; flex-shrink: 0;
}

.qr-swatch:hover { transform: scale(1.12); }
.qr-swatch.active { transform: scale(1.12); box-shadow: 0 0 0 2px #fff, 0 0 0 4px rgba(0,0,0,0.3); }

.qr-color-input {
  width: 26px; height: 26px; border: 2px solid #dde1ee; border-radius: 50%;
  padding: 0; cursor: pointer; background: none;
  -webkit-appearance: none; appearance: none; overflow: hidden; flex-shrink: 0;
}

.qr-color-input::-webkit-color-swatch-wrapper { padding: 0; }
.qr-color-input::-webkit-color-swatch { border: none; border-radius: 50%; }

.qr-toggle-row { cursor: pointer; user-select: none; }
.qr-toggle { position: relative; flex-shrink: 0; }
.qr-toggle input { position: absolute; opacity: 0; width: 0; height: 0; }
.qr-toggle-track {
  display: block; width: 36px; height: 20px; background: #dde1ee;
  border-radius: 999px; transition: background 0.2s; position: relative;
}
.qr-toggle-track::after {
  content: ''; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px;
  background: #fff; border-radius: 50%; transition: transform 0.2s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.18);
}
.qr-toggle input:checked + .qr-toggle-track { background: #142C55; }
.qr-toggle input:checked + .qr-toggle-track::after { transform: translateX(16px); }

.qr-url-display {
  font-size: 0.6875rem;
  color: #6b7280;
  background: #f8f9fc;
  border: 1px solid #dde1ee;
  border-radius: 0.35rem;
  padding: 0.5rem 0.75rem;
  font-family: 'Courier New', monospace;
  word-break: break-all;
}

.qr-download-btn {
  display: flex; align-items: center; justify-content: center; gap: 0.5rem;
  width: 100%; padding: 0.6875rem 1rem;
  background: #142C55; color: #fff; border: none; border-radius: 0.2rem;
  font-family: 'Inter', sans-serif; font-size: 0.75rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.1em; cursor: pointer; transition: opacity 0.15s;
}

.qr-download-btn:hover { opacity: 0.85; }
.qr-download-btn svg { width: 14px; height: 14px; }

/* ── Responsive ── */

/* Tablet — tabela rola horizontalmente */
@media (max-width: 900px) {
  .dash-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  table { min-width: 640px; }
}

/* Mobile */
@media (max-width: 640px) {
  .dash-header {
    padding: 0 1rem;
    height: auto;
    min-height: 56px;
    flex-wrap: wrap;
    gap: 0.625rem;
    padding-top: 0.75rem;
    padding-bottom: 0.75rem;
  }

  .dash-header-sub { display: none; }

  .dash-header-actions { gap: 0.5rem; }

  .dash-sync-btn,
  .dash-logout-btn {
    padding: 0.375rem 0.625rem;
    font-size: 0.625rem;
  }

  .dash-main { padding: 1rem; }

  .dash-stats { gap: 0.75rem; }
  .dash-stat { padding: 0.75rem 1rem; flex: 1; min-width: 80px; }
  .dash-stat-value { font-size: 1.5rem; }
  .dash-stat-label { font-size: 0.625rem; }

  .dash-table-head { padding: 0.875rem 1rem 0.625rem; }
  .dash-table-head h2 { font-size: 0.875rem; }

  thead th, tbody td { padding-left: 0.875rem; padding-right: 0.875rem; }

  .td-actions { gap: 0.375rem; }

  .act-btn { padding: 0.25rem 0.5rem; font-size: 0.625rem; }

  /* QR modal ocupa mais da tela em mobile */
  .qr-modal { padding: 1rem; }
  .qr-modal-card { padding: 1.25rem; gap: 1rem; }
}
