:root {
  color-scheme: dark;
  --bg-deep: #0f172a;
  --surface-slate: #1e293b;
  --surface-hover: #26354d;
  --primary-indigo: #4f46e5;
  --primary-indigo-light: #818cf8;
  --accent-coral: #ff6b6b;
  --accent-coral-hover: #ff8989;
  --text-primary: #f8fafc;
  --text-secondary: #a9b8cd;
  --border-subtle: rgb(148 163 184 / 19%);
  --border-indigo: rgb(129 140 248 / 45%);
  --shadow-card: 0 16px 36px -12px rgb(0 0 0 / 60%);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(ellipse at 86% 4%, rgb(79 70 229 / 23%), transparent 48%),
    radial-gradient(ellipse at 5% 85%, rgb(255 107 107 / 11%), transparent 45%),
    linear-gradient(to right, rgb(148 163 184 / 4%) 1px, transparent 1px) 0 0 / 36px 36px,
    linear-gradient(to bottom, rgb(148 163 184 / 4%) 1px, transparent 1px) 0 0 / 36px 36px,
    var(--bg-deep);
  color: var(--text-primary);
  font: 15px/1.5 system-ui, sans-serif;
}

header {
  background: rgb(15 23 42 / 85%);
  border-bottom: 1px solid var(--border-subtle);
}

.bar, main { max-width: 1080px; margin: auto; padding-inline: 24px; }
.bar, nav { display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.bar { min-height: 68px; flex-wrap: wrap; padding-block: 10px; }
.bar strong { display: flex; align-items: center; gap: 9px; font-size: 21px; letter-spacing: -.5px; }
.bar strong::before {
  content: "";
  width: 12px;
  height: 14px;
  background: var(--accent-coral);
  clip-path: polygon(0 0, 100% 50%, 0 100%);
}

main { padding-block: 48px; }
h1 { font-size: clamp(30px, 5vw, 44px); font-weight: 800; letter-spacing: -.045em; line-height: 1.12; margin: 0 0 24px; }
h2 { font-size: 20px; margin: 0 0 18px; }
p, small { color: var(--text-secondary); }
a { color: #a5b4fc; }

.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr)); gap: 20px; }
.card {
  padding: 24px;
  background: var(--surface-slate);
  border: 1px solid var(--border-subtle);
  border-radius: 16px;
  box-shadow: var(--shadow-card);
  overflow-wrap: anywhere;
}

main:has(.login) {
  display: grid;
  place-items: center;
  min-height: calc(100dvh - 69px);
}

.login {
  width: min(100%, 440px);
  margin-block: 0;
  padding: clamp(24px, 6vw, 36px);
  border-color: var(--border-indigo);
}

.login h1 { position: relative; font-size: clamp(32px, 6vw, 40px); }
.login h1::before {
  content: "";
  display: block;
  width: 36px;
  height: 4px;
  margin-bottom: 16px;
  border-radius: 8px;
  background: linear-gradient(90deg, var(--primary-indigo-light), var(--accent-coral));
}

label { display: grid; gap: 7px; margin: 0 0 16px; font-weight: 600; }
small { display: block; margin: -7px 0 16px; }
input, select, button { min-height: 44px; border-radius: 10px; font: inherit; padding: 9px 13px; }
input, select {
  width: 100%;
  border: 1px solid var(--border-subtle);
  background: var(--bg-deep);
  color: var(--text-primary);
}
input:hover, select:hover { border-color: var(--border-indigo); }
button {
  background: var(--accent-coral);
  color: #21111b;
  border: 1px solid transparent;
  font-weight: 700;
  cursor: pointer;
  transition: background-color .18s ease, box-shadow .18s ease;
}
button:hover { background: var(--accent-coral-hover); box-shadow: 0 8px 24px -6px rgb(255 107 107 / 50%); }
.secondary { background: var(--bg-deep); border-color: var(--border-indigo); color: var(--text-primary); }
.secondary:hover { background: var(--surface-hover); box-shadow: none; }
.login button { width: 100%; margin-top: 6px; }
:focus-visible { outline: 2px solid var(--primary-indigo-light); outline-offset: 3px; }

table { border-collapse: collapse; width: 100%; text-align: left; }
th, td { border-bottom: 1px solid var(--border-subtle); padding: 12px 8px; }
th { color: var(--text-secondary); }
.error { color: #ffadad; }
.success { color: #6ee7b7; }

/* Navegação autenticada */
.app-shell {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  grid-template-rows: auto 1fr;
  grid-template-areas: "header header" "sidebar main";
}
.app-shell:has(.sidebar-menu[open]) { grid-template-columns: clamp(160px, 23vw, 230px) minmax(0, 1fr); }
.app-shell > header { grid-area: header; }
.app-shell { font-size: 14px; }
.app-shell .bar { max-width: none; min-height: 54px; padding-block: 6px; }
.app-shell .bar strong { font-size: 18px; }
.app-shell .bar button { min-height: 36px; padding: 6px 10px; }
.app-shell h1 { font-size: clamp(24px, 4vw, 32px); margin-bottom: 16px; }
.app-shell h2 { font-size: 17px; }
.app-shell > main { grid-area: main; width: 100%; padding-block: 20px; overflow-wrap: anywhere; }
.panel-brand { color: var(--text-primary); text-decoration: none; }
.gear {
  display: grid;
  place-items: center;
  width: 44px;
  min-height: 44px;
  border: 1px solid var(--border-indigo);
  border-radius: 10px;
  font-size: 23px;
  text-decoration: none;
}
.gear:hover { background: var(--surface-hover); }
.sidebar { grid-area: sidebar; background: var(--bg-deep); border-right: 1px solid var(--border-subtle); padding: 12px 8px; }
.sidebar-menu > summary {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  cursor: pointer;
  list-style: none;
}
.sidebar-menu > summary::-webkit-details-marker { display: none; }
.sidebar-menu:not([open]) .sidebar-label { display: none; }
.sidebar nav { display: grid; gap: 4px; margin-top: 8px; }
.sidebar nav a, .admin-group > summary {
  display: block;
  padding: 9px 10px;
  color: var(--text-primary);
  text-decoration: none;
  border-radius: 8px;
  overflow-wrap: anywhere;
}
.sidebar nav a:hover, .sidebar-menu > summary:hover, .admin-group > summary:hover { background: var(--surface-hover); }
.sidebar nav a[aria-current="page"] { background: rgb(79 70 229 / 23%); box-shadow: inset 3px 0 var(--primary-indigo-light); }
.admin-group > summary { display: list-item; cursor: pointer; }
.admin-group > a { margin-inline-start: 12px; }
.welcome { margin: -12px 0 24px; }

@media (max-width: 540px) {
  .app-shell > main { padding-inline: 12px; }
  .app-shell .card { padding: 14px; }
  .app-shell:has(.sidebar-menu[open]) { grid-template-columns: 126px minmax(0, 1fr); }
  .sidebar nav a, .admin-group > summary { font-size: 13px; padding-inline: 6px; }
}


.inventory-actions, .inventory-actions form { display: flex; align-items: end; gap: 10px; flex-wrap: wrap; }
.inventory-actions { justify-content: space-between; }
.inventory-actions label { margin: 0; min-width: min(180px, 100%); }
.inventory-table { overflow-x: auto; }
.stock-card { padding: 16px; }
.stock-card button, .stock-card select { min-height: 34px; padding: 5px 9px; }
.stock-meta { margin: 10px 0; font-size: 12px; }
.stock-meta:last-child { margin-bottom: 0; }
.inventory-table table { min-width: 510px; }
.inventory-table th, .inventory-table td { padding: 6px 8px; vertical-align: middle; }
.inventory-table tbody th { color: var(--text-primary); font-weight: 600; }
.inventory-table .number { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.stock-product { display: flex; align-items: center; gap: 8px; }
.stock-thumb { flex: 0 0 36px; height: 36px; border-radius: 6px; overflow: hidden; background: var(--bg-deep); }
.stock-thumb img { display: block; width: 100%; height: 100%; object-fit: contain; }
.stock-sku { display: block; color: var(--text-secondary); font-size: 11px; font-weight: 400; }

