:root {
  color-scheme: dark;
  --bg: #0b1118;
  --surface: #121826;
  --surface-2: #0f1622;
  --surface-strong: #0f1624;
  --border: rgba(148, 163, 184, 0.18);
  --text: #e2e8f0;
  --muted: #94a3b8;
  --primary: #2563eb;
  --primary-strong: #1d4ed8;
  --success: #22c55e;
  --warning: #f59e0b;
  --danger: #ef4444;
  --shadow: 0 16px 38px rgba(2, 6, 23, 0.45);
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 0;
  overflow-x: hidden;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(900px at 8% -15%, rgba(37, 99, 235, 0.12), transparent 55%),
    radial-gradient(800px at 90% 0%, rgba(15, 118, 110, 0.12), transparent 60%),
    var(--bg);
  color: var(--text);
  overflow-x: hidden;
}

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

img,
svg,
canvas,
video {
  max-width: 100%;
}

input,
select,
textarea,
button {
  font: inherit;
  max-width: 100%;
}

.admin-layout {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 260px 1fr;
  min-width: 0;
}

.admin-sidebar {
  padding: 24px 18px;
  background: rgba(12, 17, 26, 0.96);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 18px;
  position: sticky;
  top: 0;
  z-index: 20;
  height: 100vh;
  overflow: hidden;
}

.sidebar-brand {
  display: grid;
  gap: 4px;
}

.brand-name {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.brand-role {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--muted);
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding-right: 6px;
  scrollbar-width: thin;
  scrollbar-color: rgba(96, 165, 250, 0.38) transparent;
}

.sidebar-nav::-webkit-scrollbar {
  width: 8px;
}

.sidebar-nav::-webkit-scrollbar-track {
  background: transparent;
}

.sidebar-nav::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.22);
  border-radius: 999px;
}

.sidebar-nav::-webkit-scrollbar-thumb:hover {
  background: rgba(96, 165, 250, 0.38);
}

.nav-item {
  padding: 10px 12px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 14px;
  color: var(--muted);
  touch-action: manipulation;
  transition: background 0.15s ease, color 0.15s ease;
}

.nav-item:hover,
.nav-item.active {
  background: rgba(37, 99, 235, 0.16);
  color: var(--text);
}

.nav-section {
  margin-top: 10px;
  display: grid;
  gap: 6px;
}

.nav-section:last-child {
  margin-top: auto;
  padding-top: 8px;
}

.nav-section-title {
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 10px 8px 4px;
}

.admin-main {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-width: 0;
  position: relative;
  z-index: 0;
}

.admin-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  padding: 20px 28px;
  border-bottom: 1px solid var(--border);
  background: rgba(12, 17, 26, 0.9);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 10;
}

.admin-header-left h1 {
  margin: 8px 0 0;
  font-size: 28px;
}

.breadcrumb {
  font-size: 11px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted);
}

.admin-subtitle {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.admin-header-right {
  display: grid;
  gap: 8px;
  justify-items: end;
  text-align: right;
}

.admin-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(34, 197, 94, 0.12);
  border: 1px solid rgba(34, 197, 94, 0.35);
  color: #bbf7d0;
  font-size: 12px;
  font-weight: 600;
}

.admin-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 8px rgba(34, 197, 94, 0.6);
}

.admin-meta {
  font-size: 12px;
  color: var(--muted);
}

.admin-content {
  flex: 1;
  padding: 24px 28px 40px;
  min-width: 0;
  width: 100%;
}

.admin-footer {
  padding: 16px 28px 22px;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 12px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  background: rgba(12, 17, 26, 0.9);
}

.admin-footer-brand {
  display: grid;
  gap: 4px;
}

.footer-meta {
  opacity: 0.8;
}

.admin-footer-contact {
  display: grid;
  gap: 8px;
  justify-items: end;
}

.footer-contato h4 {
  margin: 0;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  line-height: 1.2;
  text-transform: uppercase;
}

.footer-contact-links {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 14px;
  flex-wrap: wrap;
}

.footer-contact-link {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 24px;
  max-width: 100%;
  color: #ccc;
  font-size: 12px;
  line-height: 1.4;
  text-decoration: none;
  transition: color 0.18s ease, transform 0.18s ease;
}

.footer-contact-link span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.footer-contact-link:hover,
.footer-contact-link:focus-visible {
  color: #fff;
}

.footer-contact-link:focus-visible {
  outline: 2px solid rgba(96, 165, 250, 0.7);
  outline-offset: 3px;
}

.footer-contact-icon {
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
}

.table-footer-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding-top: 12px;
  border-top: 1px solid rgba(148, 163, 184, 0.14);
}

.table-foot {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.table-foot strong {
  color: var(--text);
  font-weight: 600;
}

.table-pagination {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.table-wrapper,
.table-wrap,
.crud-table-wrap,
.vendas-table-wrap {
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.admin-main table {
  max-width: none;
}

.admin-main .card,
.admin-main .panel,
.admin-main .form-card,
.admin-main .modal-content,
.admin-main .modal,
.admin-main .table-wrapper,
.admin-main .table-wrap,
.admin-main .crud-table-wrap,
.admin-main .vendas-table-wrap {
  min-width: 0;
}

.pagination-button,
.page-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  min-width: 38px;
  height: 38px;
  padding: 0 12px;
  border-radius: 12px;
  border: 1px solid rgba(148, 163, 184, 0.24);
  background: rgba(15, 23, 42, 0.45);
  color: var(--text);
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  line-height: 1;
  white-space: nowrap;
  appearance: none;
  transition: border-color 0.2s ease, background 0.2s ease, color 0.2s ease, opacity 0.2s ease;
}

.pagination-button {
  cursor: pointer;
}

.pagination-button:hover:not([disabled]):not(.is-active),
.page-link:hover:not(.is-current):not(.is-disabled) {
  border-color: rgba(96, 165, 250, 0.45);
  background: rgba(30, 41, 59, 0.78);
  color: #f8fafc;
}

.pagination-button.is-active,
.page-link.is-current {
  border-color: rgba(59, 130, 246, 0.56);
  background: rgba(37, 99, 235, 0.2);
  color: #dbeafe;
}

.pagination-button[disabled],
.page-link.is-disabled {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
}

.pagination-ellipsis,
.page-separator {
  color: var(--muted);
  font-size: 13px;
  padding: 0 2px;
}

@media (max-width: 768px) {
  .admin-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .admin-sidebar {
    position: static;
    top: auto;
    height: auto;
    max-height: none;
    overflow: visible;
    border-right: 0;
    border-bottom: 1px solid var(--border);
    padding: 16px;
    gap: 12px;
  }

  .sidebar-nav {
    flex-direction: column;
    align-items: initial;
    gap: 8px;
    overflow-x: visible;
    overflow-y: visible;
    padding-right: 0;
    padding-bottom: 0;
    scroll-snap-type: none;
  }

  .nav-section {
    display: grid;
    flex: initial;
    gap: 8px;
    margin: 10px 0 0;
  }

  .nav-section:last-child {
    margin-top: 10px;
    padding-top: 8px;
  }

  .nav-section-title {
    display: block;
  }

  .nav-item {
    flex: initial;
    white-space: normal;
  }

  .admin-header {
    position: static;
  }

  .admin-content {
    padding: 22px 20px 34px;
  }
}

@media (max-width: 720px) {
  .admin-sidebar {
    padding: 14px;
    max-height: 48vh;
  }

  .sidebar-brand {
    grid-template-columns: minmax(0, 1fr);
  }

  .brand-name {
    font-size: 16px;
  }

  .admin-header {
    flex-direction: column;
    align-items: flex-start;
    padding: 18px 16px;
  }

  .admin-header-left,
  .admin-header-right {
    width: 100%;
    min-width: 0;
  }

  .admin-header-left h1 {
    font-size: 24px;
    overflow-wrap: anywhere;
  }

  .admin-header-right {
    justify-items: start;
    text-align: left;
  }

  .admin-content {
    padding: 18px 14px 28px;
  }

  .admin-footer {
    flex-direction: column;
    align-items: flex-start;
    padding: 16px;
  }

  .admin-footer-contact {
    justify-items: start;
    width: 100%;
  }

  .footer-contact-links {
    justify-content: flex-start;
  }

  .table-footer-bar {
    align-items: stretch;
    flex-direction: column;
  }

  .admin-main .form-grid,
  .admin-main .filters-grid,
  .admin-main .filter-grid,
  .admin-main .crud-grid,
  .admin-main .summary-grid,
  .admin-main .stats-grid,
  .admin-main .cards-grid {
    grid-template-columns: 1fr !important;
  }

  .admin-main .actions,
  .admin-main .form-actions,
  .admin-main .filter-actions,
  .admin-main .toolbar-actions,
  .admin-main .modal-actions {
    align-items: stretch;
    flex-direction: column;
    width: 100%;
  }

  .admin-main .actions .btn,
  .admin-main .form-actions .btn,
  .admin-main .filter-actions .btn,
  .admin-main .toolbar-actions .btn,
  .admin-main .modal-actions .btn,
  .admin-main .actions button,
  .admin-main .form-actions button,
  .admin-main .filter-actions button,
  .admin-main .toolbar-actions button,
  .admin-main .modal-actions button {
    width: 100%;
  }

  .admin-main .modal-content,
  .admin-main .modal {
    max-width: calc(100vw - 24px);
  }

  .table-pagination,
  .pagination-list {
    width: 100%;
    justify-content: flex-start;
  }

  .pagination-button,
  .page-link {
    min-width: 36px;
    height: 36px;
  }
}

@media (max-width: 640px) {
  .admin-sidebar {
    position: static;
    top: auto;
    z-index: 30;
    max-height: none;
    overflow: visible;
  }

  .sidebar-nav {
    scroll-padding-inline: 2px;
  }
}

@media (max-width: 520px) {
  .sidebar-nav {
    margin-inline: -2px;
  }

  .nav-item {
    padding: 9px 11px;
    font-size: 13px;
  }

  .admin-status {
    width: 100%;
    justify-content: center;
  }
}
