:root {
  color-scheme: light;
  --ink: #28252d;
  --muted: #77717d;
  --accent: #8b5cf6;
  --accent-dark: #7041db;
  --surface: #ffffff;
  --background: #f7f5fa;
  --border: #e9e4ef;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--background);
  color: var(--ink);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  box-shadow: 0 12px 36px rgba(40, 25, 65, .06);
}
.login-panel { width: min(100%, 430px); padding: 34px; }
.brand-mark {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border-radius: 16px;
  background: #eee7ff;
  color: var(--accent-dark);
  font-weight: 800;
  letter-spacing: -.05em;
}
.brand-mark.small { width: 36px; height: 36px; border-radius: 11px; }
.eyebrow {
  margin: 24px 0 8px;
  color: var(--accent-dark);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .16em;
}
h1 { margin: 0 0 10px; font-size: clamp(27px, 5vw, 34px); letter-spacing: -.04em; }
h2 { margin-top: 0; }
.muted { color: var(--muted); line-height: 1.6; }
form { display: grid; gap: 12px; }
label { font-size: 14px; font-weight: 650; margin-top: 7px; }
input:not([type=hidden]) {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--border);
  border-radius: 11px;
  padding: 11px 13px;
  background: #fff;
  color: var(--ink);
  font: inherit;
}
input:focus { outline: 2px solid #c4b5fd; border-color: var(--accent); }
button {
  min-height: 46px;
  border: 0;
  border-radius: 11px;
  padding: 11px 16px;
  background: var(--accent);
  color: white;
  font: inherit;
  font-weight: 750;
  cursor: pointer;
}
button:hover { background: var(--accent-dark); }
.error {
  border-radius: 10px;
  background: #fff0f0;
  color: #a32929;
  padding: 11px 13px;
  font-size: 14px;
}
.footnote { margin: 20px 0 0; text-align: center; color: var(--muted); font-size: 12px; }
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px clamp(18px, 4vw, 48px);
  background: white;
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 11px; color: var(--ink); text-decoration: none; font-weight: 800; }
.topbar form { display: block; }
.button-secondary { background: #f0ebf7; color: var(--ink); }
.button-secondary:hover { background: #e4dcf0; }
.content { max-width: 1080px; margin: 0 auto; padding: 28px 22px 48px; }
.content .eyebrow { margin-top: 8px; }
.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin: 26px 0; }
.stat-card { padding: 22px; background: white; border: 1px solid var(--border); border-radius: 16px; }
.stat-card p { margin: 0 0 12px; color: var(--muted); font-size: 14px; }
.stat-card strong { font-size: 32px; letter-spacing: -.04em; }
.next-panel { padding: 24px; line-height: 1.65; }
@media (max-width: 640px) {
  .login-panel { padding: 25px; }
  .stats { grid-template-columns: 1fr; gap: 11px; }
  .stat-card { padding: 18px; }
  .stat-card strong { font-size: 28px; }
}

/* Área de produtos */
.nav-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}
.nav-actions form { display: block; }
.button-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 11px 16px;
  border-radius: 11px;
  text-decoration: none;
  font-weight: 750;
}
.form-panel, .list-panel {
  padding: 24px;
  margin-top: 22px;
}
.form-panel { max-width: 760px; }
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}
.form-hint {
  margin: 0;
  font-size: 13px;
}
.success {
  margin: 18px 0;
  padding: 12px 15px;
  border-radius: 10px;
  background: #e8f8ed;
  color: #176534;
}
.table-scroll {
  width: 100%;
  overflow-x: auto;
}
.product-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 14px;
}
.product-table th, .product-table td {
  padding: 14px 12px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.product-table th {
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}
.table-subtitle {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}
@media (max-width: 640px) {
  .nav-actions { gap: 6px; }
  .nav-actions .button-link, .nav-actions button {
    padding: 10px 12px;
    font-size: 13px;
  }
  .form-panel, .list-panel { padding: 18px; }
  .form-grid { grid-template-columns: 1fr; gap: 0; }
  .product-table th, .product-table td { padding: 12px 9px; }
}

/* Formulário de entrada de mercadorias */
.stock-form {
  display: grid;
  grid-template-columns: minmax(90px, 110px) minmax(140px, 1fr) auto;
  align-items: center;
  gap: 8px;
  min-width: 390px;
}
.stock-form input:not([type=hidden]) {
  min-height: 40px;
  padding: 8px 10px;
  font-size: 13px;
}
.stock-form button {
  min-height: 40px;
  padding: 8px 12px;
  font-size: 13px;
}
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ==================================================
   CdebCompany — Painel roxo moderno
   ================================================== */
:root {
  --ink: #241b35;
  --muted: #777087;
  --accent: #8054e9;
  --accent-dark: #693bd1;
  --surface: #ffffff;
  --background: #f7f5fc;
  --border: #e9e3f3;
  --sidebar-bg: #24163b;
  --sidebar-text: #d9d0ec;
  --sidebar-active: #8054e9;
}

body {
  background: var(--background);
  color: var(--ink);
}

.topbar {
  background: var(--surface);
  border-bottom-color: var(--border);
}

.brand-mark {
  background: #eee7ff;
  color: var(--accent-dark);
}

.button-link,
button:not(.button-secondary):not(.sidebar-logout) {
  transition: background .18s ease, transform .18s ease, box-shadow .18s ease;
}

.button-link:not(.button-secondary) {
  background: var(--accent);
  color: #fff;
}

.button-link:not(.button-secondary):hover {
  background: var(--accent-dark);
  box-shadow: 0 5px 14px rgba(105, 59, 209, .18);
}

.button-secondary {
  background: #f0ebf8;
  color: #35264b;
}

.panel,
.stat-card {
  border-color: var(--border);
  box-shadow: 0 8px 28px rgba(42, 25, 69, .045);
}

.stat-card {
  border-radius: 18px;
  transition: transform .18s ease, box-shadow .18s ease;
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 30px rgba(42, 25, 69, .08);
}

.stat-card strong {
  color: var(--ink);
}

.eyebrow {
  color: var(--accent-dark);
}

.product-table th {
  background: #faf8fe;
}

.product-table tbody tr:hover {
  background: #faf8fe;
}

input:not([type=hidden]):focus,
select:focus,
textarea:focus {
  outline: 2px solid #cbb8ff;
  outline-offset: 1px;
  border-color: var(--accent);
}

/* Menu lateral compartilhado */
.app-layout {
  min-height: 100vh;
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 100;
  display: flex;
  flex-direction: column;
  width: 258px;
  padding: 24px 16px;
  overflow-y: auto;
  background: var(--sidebar-bg);
  color: #fff;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 4px 8px 28px;
  color: #fff;
  text-decoration: none;
}

.sidebar-brand .brand-mark {
  flex: 0 0 auto;
  background: #a78bfa;
  color: #24163b;
}

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

.sidebar-brand-text strong {
  font-size: 15px;
  letter-spacing: -.02em;
}

.sidebar-brand-text small {
  color: #bdb0d5;
  font-size: 12px;
}

.sidebar-label {
  margin: 8px 10px 12px;
  color: #a99abd;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .14em;
}

.sidebar-nav {
  display: grid;
  gap: 6px;
}

.sidebar-link,
.sidebar-logout {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 46px;
  padding: 11px 12px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--sidebar-text);
  text-align: left;
  text-decoration: none;
  font: inherit;
  font-size: 13px;
  font-weight: 650;
}

.sidebar-link:hover {
  background: rgba(255, 255, 255, .08);
  color: #fff;
}

.sidebar-link.is-active {
  background: var(--sidebar-active);
  color: #fff;
  box-shadow: 0 6px 16px rgba(0, 0, 0, .14);
}

.sidebar-icon {
  display: inline-grid;
  flex: 0 0 22px;
  place-items: center;
  font-size: 20px;
  line-height: 1;
}

.sidebar-footer {
  margin-top: auto;
  padding-top: 24px;
}

.sidebar-footer form {
  display: block;
}

.sidebar-logout {
  cursor: pointer;
}

.sidebar-logout:hover {
  background: rgba(255, 255, 255, .08);
  color: #fff;
}

.app-main {
  min-width: 0;
  min-height: 100vh;
  margin-left: 258px;
}

.app-main .content {
  max-width: 1440px;
  padding: 34px clamp(20px, 3vw, 44px) 52px;
}

.app-page-heading {
  margin-bottom: 28px;
}

.app-page-heading h1 {
  margin-bottom: 8px;
}

.app-page-heading .eyebrow {
  margin-top: 0;
}

@media (max-width: 760px) {
  .sidebar {
    position: relative;
    inset: auto;
    width: 100%;
    padding: 14px 14px 12px;
    overflow: visible;
  }

  .sidebar-brand {
    padding: 2px 4px 14px;
  }

  .sidebar-label {
    margin: 4px 6px 8px;
  }

  .sidebar-nav {
    display: flex;
    gap: 7px;
    overflow-x: auto;
    padding-bottom: 5px;
  }

  .sidebar-link {
    flex: 0 0 auto;
    width: auto;
    min-height: 42px;
    padding: 9px 11px;
    white-space: nowrap;
  }

  .sidebar-icon {
    flex-basis: auto;
    font-size: 17px;
  }

  .sidebar-footer {
    padding-top: 8px;
  }

  .sidebar-logout {
    min-height: 40px;
  }

  .app-main {
    margin-left: 0;
  }

  .app-main .content {
    padding: 24px 16px 36px;
  }
}

/* CdebCompany — acabamento dos cartões do painel */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
  margin: 28px 0;
}

.dashboard-grid .stat-card {
  position: relative;
  min-width: 0;
  padding: 24px;
  overflow: hidden;
  border: 1px solid #e9e3f3;
  border-radius: 18px;
  background: linear-gradient(145deg, #ffffff 0%, #fcfaff 100%);
  box-shadow: 0 8px 24px rgba(42, 25, 69, .045);
  transition: transform .18s ease, box-shadow .18s ease;
}

.dashboard-grid .stat-card::before {
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: linear-gradient(180deg, #a78bfa, #8054e9);
  content: "";
}

.dashboard-grid .stat-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 15px 32px rgba(64, 38, 105, .09);
}

.dashboard-grid .stat-card p {
  margin: 0 0 15px;
  color: #777087;
  font-size: 13px;
  font-weight: 650;
  line-height: 1.5;
}

.dashboard-grid .stat-card strong {
  display: block;
  overflow-wrap: anywhere;
  color: #2d2042;
  font-size: clamp(24px, 2vw, 32px);
  font-weight: 800;
  letter-spacing: -.045em;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
}

.dashboard-grid .stat-card .table-subtitle {
  margin-top: 12px;
  color: #898198;
  font-size: 12px;
  line-height: 1.5;
}

.dashboard-grid + .panel {
  margin-top: 30px;
}

.app-main .next-panel {
  padding: 26px;
  border-radius: 18px;
}

.app-main .next-panel h2 {
  margin-bottom: 8px;
  color: #2d2042;
  font-size: 19px;
}

.app-main .next-panel > p {
  color: #777087;
}

@media (max-width: 1050px) {
  .dashboard-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
  }
}

@media (max-width: 520px) {
  .dashboard-grid {
    grid-template-columns: 1fr;
    gap: 12px;
    margin: 22px 0;
  }

  .dashboard-grid .stat-card {
    padding: 21px;
  }

  .app-main .next-panel {
    padding: 20px;
  }
}
