:root {
  --bg: #f4f6f8;
  --surface: #ffffff;
  --surface-soft: #eef3f7;
  --text: #18202a;
  --muted: #657282;
  --line: #d9e0e7;
  --primary: #0f766e;
  --primary-dark: #0b5f59;
  --accent: #b45309;
  --danger: #b42318;
  --shadow: 0 14px 34px rgba(24, 32, 42, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: Arial, Helvetica, sans-serif;
}

.hidden,
.locked {
  display: none !important;
}

.login-screen {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 20px;
  background: linear-gradient(135deg, #eef3f7 0%, #ffffff 100%);
}

.login-card {
  display: grid;
  width: min(420px, 100%);
  gap: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
  padding: 28px;
}

.login-error {
  min-height: 20px;
  margin: 0;
  color: var(--danger);
  font-weight: 700;
}

button,
input,
select {
  font: inherit;
}

button {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  padding: 0 14px;
}

button:hover {
  border-color: var(--primary);
}

.primary {
  border-color: var(--primary);
  background: var(--primary);
  color: #ffffff;
  font-weight: 700;
}

.primary:hover {
  background: var(--primary-dark);
}

.danger {
  color: var(--danger);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 24px clamp(18px, 4vw, 48px);
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--primary);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

h1,
h2,
h3 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: clamp(1.6rem, 3vw, 2.3rem);
}

h2 {
  font-size: clamp(1.35rem, 2.4vw, 1.9rem);
}

h3 {
  font-size: 1rem;
}

.summary-strip {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.summary-strip span,
.summary-strip strong {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 12px;
  border-radius: 6px;
  background: var(--surface-soft);
  white-space: nowrap;
}

.summary-strip strong {
  background: #fff7ed;
  color: var(--accent);
}

.layout {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  min-height: calc(100vh - 93px);
}

.sidebar {
  padding: 20px;
  background: #25313f;
}

.nav-button {
  width: 100%;
  justify-content: flex-start;
  margin-bottom: 8px;
  border-color: transparent;
  background: transparent;
  color: #dbe5ef;
  text-align: left;
}

.nav-button:hover,
.nav-button.active {
  background: #ffffff;
  color: #25313f;
}

.content {
  min-width: 0;
  padding: clamp(18px, 4vw, 36px);
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.section-heading.compact {
  align-items: center;
  margin-bottom: 12px;
}

.section-heading span {
  color: var(--muted);
}

.metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.metric,
.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.metric {
  padding: 18px;
}

.metric span {
  display: block;
  color: var(--muted);
  margin-bottom: 8px;
}

.metric strong {
  font-size: clamp(1.25rem, 2vw, 1.8rem);
}

.panel {
  padding: 18px;
  margin-bottom: 18px;
}

.form-grid,
.filters {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.filters {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  align-items: end;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
}

input,
select {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
  color: var(--text);
  padding: 0 11px;
}

input:focus,
select:focus {
  outline: 3px solid rgba(15, 118, 110, 0.16);
  border-color: var(--primary);
}

.wide {
  grid-column: 1 / -1;
}

.form-actions {
  display: flex;
  align-items: end;
  gap: 10px;
  grid-column: 1 / -1;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 12px 10px;
  text-align: left;
  vertical-align: middle;
}

th {
  color: var(--muted);
  font-size: 0.8rem;
  text-transform: uppercase;
}

tr:last-child td {
  border-bottom: 0;
}

.right {
  text-align: right;
}

.actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.empty {
  color: var(--muted);
  text-align: center;
}

@media (max-width: 840px) {
  .topbar,
  .section-heading {
    align-items: flex-start;
    flex-direction: column;
  }

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

  .sidebar {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 12px;
  }

  .nav-button {
    width: auto;
    min-width: max-content;
    margin-bottom: 0;
  }

  .metrics,
  .form-grid,
  .filters {
    grid-template-columns: 1fr;
  }
}

@media print {
  .topbar,
  .sidebar,
  .filters,
  #dashboard,
  #vendedores,
  #vendas {
    display: none !important;
  }

  .layout,
  .content,
  .view.active {
    display: block;
    padding: 0;
  }

  .panel,
  .metric {
    box-shadow: none;
  }
}
