:root {
  --bg: #f4f7fb;
  --bg-strong: #dce8f6;
  --surface: rgba(255, 255, 255, 0.86);
  --surface-strong: #ffffff;
  --surface-soft: rgba(244, 248, 252, 0.94);
  --border: rgba(20, 52, 88, 0.12);
  --text: #17324d;
  --text-soft: #60758c;
  --text-muted: #7f93a8;
  --primary: #0e6ba8;
  --primary-dark: #0a4f7d;
  --accent: #f28f3b;
  --danger: #b42318;
  --success: #157347;
  --shadow: 0 24px 60px rgba(23, 50, 77, 0.12);
  --radius-xl: 28px;
  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 10px;
  --container: 1320px;
}

body.theme-dark {
  --bg: #0b1620;
  --bg-strong: #122333;
  --surface: rgba(12, 24, 36, 0.88);
  --surface-strong: #16293c;
  --surface-soft: rgba(20, 38, 55, 0.96);
  --border: rgba(161, 194, 223, 0.16);
  --text: #ecf5ff;
  --text-soft: #a7bed2;
  --text-muted: #7f97ad;
  --primary: #63b3e9;
  --primary-dark: #318fc9;
  --accent: #ffbb6b;
  --danger: #ff928c;
  --success: #59ca8f;
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.34);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  font-size: 16px;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Manrope", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(242, 143, 59, 0.14), transparent 28%),
    radial-gradient(circle at top right, rgba(14, 107, 168, 0.18), transparent 30%),
    linear-gradient(180deg, #f7fbff 0%, var(--bg) 100%);
}

body.theme-dark {
  background:
    radial-gradient(circle at top left, rgba(255, 187, 107, 0.08), transparent 26%),
    radial-gradient(circle at top right, rgba(99, 179, 233, 0.14), transparent 28%),
    linear-gradient(180deg, #08111a 0%, var(--bg) 100%);
}

body.auth-locked #appScreen {
  display: none !important;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.page-shell {
  width: min(100%, calc(var(--container) + 48px));
  margin: 0 auto;
  min-height: 100vh;
  padding: 24px;
  display: flex;
  flex-direction: column;
}

.screen {
  display: none;
}

.screen--active {
  display: block;
}

.screen--centered {
  min-height: calc(100vh - 48px);
  display: grid;
  align-items: center;
}

#loginScreen.screen--centered {
  position: relative;
  flex: 1 0 auto;
  place-items: center;
  padding-bottom: 56px;
}

.hero-card {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(320px, 420px);
  gap: 28px;
  align-items: stretch;
}

.hero-card--login {
  width: min(100%, 1080px);
  max-width: 1080px;
  margin: 0 auto;
}

#loginScreen .panel {
  display: flex;
  flex-direction: column;
  justify-content: center;
  text-align: center;
}

#loginScreen .panel__header {
  text-align: center;
}

#loginScreen #loginForm {
  width: 100%;
  max-width: 340px;
  margin: 0 auto;
}

#loginScreen #loginForm .field {
  text-align: center;
  padding-left: 0;
}

.hero-copy,
.panel,
.app-header,
.tabs,
.alert {
  backdrop-filter: blur(18px);
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.hero-copy {
  border-radius: var(--radius-xl);
  padding: clamp(28px, 5vw, 54px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  min-height: 520px;
  text-align: center;
  background:
    linear-gradient(140deg, rgba(255, 255, 255, 0.94), rgba(220, 232, 246, 0.9)),
    var(--surface);
}

body.theme-dark .hero-copy {
  background:
    linear-gradient(145deg, rgba(10, 23, 35, 0.96), rgba(18, 42, 60, 0.92)),
    var(--surface);
}

.hero-copy__logo-wrap {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: min(100%, 360px);
  max-width: 100%;
  padding: 20px 24px;
  margin: 0 0 22px;
}

.hero-copy__logo-wrap,
.hero-copy__title-wrap {
  transform: translateY(-58px);
}

.hero-copy__logo {
  display: block;
  width: min(100%, 330px);
  max-height: 138px;
  object-fit: contain;
  margin: 0 auto;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  width: fit-content;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(14, 107, 168, 0.1);
  color: var(--primary-dark);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

body.theme-dark .eyebrow {
  background: rgba(99, 179, 233, 0.14);
  color: #d7eeff;
}

.hero-copy h1,
.app-header h1 {
  margin: 18px 0 10px;
  line-height: 1;
  font-size: 35px;
}

.hero-copy h1 {
  margin: 0;
}

.hero-copy p,
.panel__header p,
.user-badge,
.empty-state,
.result-item__meta,
.subtle,
.alert {
  color: var(--text-soft);
}

.hero-copy p {
  max-width: 560px;
  font-size: 1.05rem;
  line-height: 1.7;
}

.app-signature {
  margin-top: auto;
  align-self: center;
  width: auto;
  max-width: calc(100% - 24px);
  text-align: center;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-soft);
  padding: 0;
  pointer-events: none;
}

.panel {
  border-radius: var(--radius-lg);
  padding: 24px;
}

.panel--sticky {
  position: sticky;
  top: 20px;
}

.panel__header {
  margin-bottom: 18px;
}

.panel__header h2 {
  margin: 0;
  font-size: 1.2rem;
}

.panel__header p {
  margin: 8px 0 0;
  line-height: 1.5;
}

.app-header {
  border-radius: var(--radius-xl);
  padding: 14px 18px;
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
  flex-wrap: nowrap;
}

.app-header__brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1 1 auto;
}

.app-header .eyebrow {
  padding: 4px 8px;
  font-size: 0.66rem;
  letter-spacing: 0.05em;
  flex: 0 0 auto;
}

.app-header h1 {
  margin: 0;
  font-size: clamp(1rem, 1.6vw, 1.35rem);
  line-height: 1.1;
  font-weight: 800;
  white-space: nowrap;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: nowrap;
  justify-content: flex-end;
  flex: 0 0 auto;
}

.user-badge {
  padding: 8px 10px;
  border-radius: 999px;
  background: rgba(14, 107, 168, 0.08);
  border: 1px solid rgba(14, 107, 168, 0.08);
  font-weight: 700;
  font-size: 0.86rem;
  line-height: 1.2;
}

#logoutButton,
#themeToggleButton {
  min-height: 38px;
  padding: 0 12px;
  font-size: 0.84rem;
}

body.theme-dark .user-badge {
  background: rgba(99, 179, 233, 0.1);
  border-color: rgba(99, 179, 233, 0.16);
  color: var(--text-soft);
}

.tabs {
  margin-top: 18px;
  border-radius: 20px;
  padding: 10px;
  display: flex;
  gap: 10px;
  overflow-x: auto;
}

.tab-btn {
  border: 0;
  border-radius: 14px;
  padding: 13px 18px;
  background: transparent;
  color: var(--text-soft);
  font-weight: 800;
  white-space: nowrap;
}

.tab-btn--active {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff;
}

.alert {
  margin-top: 18px;
  border-radius: var(--radius-md);
  padding: 14px 18px;
}

.alert--error {
  color: var(--danger);
  border-color: rgba(180, 35, 24, 0.18);
  background: rgba(253, 242, 240, 0.95);
}

.alert--success {
  color: var(--success);
  border-color: rgba(21, 115, 71, 0.18);
  background: rgba(240, 253, 244, 0.95);
}

.app-grid {
  margin-top: 18px;
}

.tab-pane {
  display: none;
}

.tab-pane--active {
  display: block;
}

.pane-grid {
  display: grid;
  gap: 18px;
}

.wizard-step {
  display: none;
}

.wizard-step--active {
  display: block;
}

.step-pillbar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.step-pill {
  padding: 9px 12px;
  border-radius: 999px;
  background: rgba(23, 50, 77, 0.06);
  color: var(--text-soft);
  font-size: 0.8rem;
  font-weight: 800;
}

.step-pill--active {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff;
}

.pane-grid--search,
.pane-grid--users {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.pane-grid--simulator {
  grid-template-columns: minmax(320px, 380px) minmax(0, 1fr);
}

.pane-grid--embedded {
  margin-top: 18px;
}

.form-stack,
.form-grid {
  display: grid;
  gap: 14px;
}

#buscaSimulacaoStep .form-stack {
  margin: 0 0 18px;
}

.form-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.field {
  display: grid;
  gap: 8px;
}

.field--inline {
  display: flex;
  align-items: center;
  gap: 10px;
}

.field--inline span {
  margin: 0;
  white-space: nowrap;
}

.field--inline select {
  width: auto;
  min-width: 120px;
}

.field span {
  font-size: 0.92rem;
  font-weight: 800;
}

input,
select {
  width: 100%;
  min-height: 48px;
  border-radius: 12px;
  border: 1px solid rgba(23, 50, 77, 0.16);
  padding: 0 14px;
  background: var(--surface-soft);
  color: var(--text);
  caret-color: var(--primary-dark);
  font-weight: 600;
}

input:focus,
select:focus {
  outline: 2px solid rgba(14, 107, 168, 0.2);
  border-color: var(--primary);
}

body.theme-dark input,
body.theme-dark select {
  border-color: rgba(161, 194, 223, 0.18);
  color: var(--text);
  -webkit-text-fill-color: var(--text);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.02);
}

input::placeholder {
  color: var(--text-muted);
  opacity: 1;
}

body.theme-dark input::placeholder {
  color: var(--text-muted);
}

input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
select:-webkit-autofill,
select:-webkit-autofill:hover,
select:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--text);
  transition: background-color 9999s ease-out 0s;
  box-shadow: 0 0 0 1000px var(--surface-soft) inset;
}

.searchbar,
.action-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.searchbar {
  margin-bottom: 16px;
}

.searchbar input {
  flex: 1 1 240px;
}

.action-row--compact {
  margin-bottom: 14px;
}

.btn {
  min-height: 48px;
  border: 0;
  border-radius: 12px;
  padding: 0 18px;
  font-weight: 800;
  transition: transform 0.18s ease, opacity 0.18s ease, background 0.18s ease;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

.btn--block {
  width: 100%;
}

.btn--primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff;
}

.btn--secondary {
  background: rgba(14, 107, 168, 0.08);
  color: var(--primary-dark);
}

.btn--ghost {
  background: rgba(23, 50, 77, 0.06);
  color: var(--text);
}

body.theme-dark .btn--ghost {
  background: rgba(161, 194, 223, 0.08);
  color: var(--text);
}

.btn--danger {
  background: rgba(180, 35, 24, 0.08);
  color: var(--danger);
}

.btn--icon {
  min-height: 32px;
  width: 32px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  font-size: 0.95rem;
  line-height: 1;
}

.result-list,
.selection-list {
  display: grid;
  gap: 12px;
  min-height: 90px;
}

.result-list--wide {
  gap: 14px;
}

.result-item,
.selection-item {
  background: var(--surface-soft);
  border: 1px solid rgba(23, 50, 77, 0.1);
  border-radius: 16px;
  padding: 16px;
}

.result-item--selected,
.selection-item--selected {
  border-color: rgba(14, 107, 168, 0.55);
  box-shadow: 0 18px 36px rgba(14, 107, 168, 0.14);
  background: linear-gradient(180deg, rgba(243, 249, 255, 0.98), rgba(255, 255, 255, 0.96));
  transform: translateY(-2px);
}

.result-item {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
}

.result-item--actionable {
  cursor: pointer;
}

.result-item__content {
  min-width: 0;
}

.result-item__content strong,
.selection-item__title {
  display: block;
  font-size: 1rem;
  margin-bottom: 6px;
}

.result-item__meta,
.selection-item__meta {
  font-size: 0.9rem;
  line-height: 1.55;
}

.empty-state {
  min-height: 90px;
  display: grid;
  place-items: center;
  border: 1px dashed rgba(23, 50, 77, 0.16);
  border-radius: 16px;
  padding: 20px;
  text-align: center;
}

.empty-state--compact {
  margin-bottom: 14px;
  min-height: 70px;
}

.cliente-resumo {
  margin-bottom: 10px;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid rgba(14, 107, 168, 0.18);
  background: rgba(14, 107, 168, 0.06);
}

.cliente-resumo__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.cliente-resumo__head strong {
  display: block;
  font-size: 0.95rem;
  line-height: 1.3;
}

.cliente-resumo__change {
  min-height: 32px;
  padding: 0 10px;
  font-size: 0.76rem;
  flex: 0 0 auto;
}

.cliente-resumo__meta {
  display: grid;
  gap: 4px;
  margin-top: 8px;
  font-size: 0.82rem;
  color: var(--text-soft);
}

.cliente-resumo__meta b {
  color: var(--text);
}

body.theme-dark .cliente-resumo {
  background: rgba(99, 179, 233, 0.08);
  border-color: rgba(99, 179, 233, 0.18);
}

.user-item {
  display: flex;
  flex-direction: column;
  padding: 14px;
  gap: 12px;
  align-items: stretch;
}

.user-item__line {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: baseline;
  font-size: 0.82rem;
  line-height: 1.35;
  color: var(--text-soft);
}

.user-item__line + .user-item__line {
  margin-top: 6px;
}

.user-item__line strong {
  margin: 0;
  font-size: 0.96rem;
  line-height: 1.2;
  color: var(--text);
}

.user-item__actions {
  width: 100%;
  gap: 8px;
  align-items: center;
  justify-content: flex-start;
  flex-direction: row;
}

.user-item__actions .btn {
  min-height: 36px;
  padding: 0 12px;
  font-size: 0.78rem;
}

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

.kpi-grid--compact {
  margin: 0 0 14px;
}

.panel--summary-float {
  padding: 12px 14px;
  border-radius: 16px;
  position: sticky;
  top: 5px;
  z-index: 6;
  background: rgba(255, 255, 255, 0.97);
  backdrop-filter: blur(22px);
  -webkit-backdrop-filter: blur(22px);
  box-shadow:
    0 18px 40px rgba(23, 50, 77, 0.16),
    0 -10px 24px rgba(244, 247, 251, 0.96);
}

body.theme-dark .panel--summary-float {
  background: rgba(22, 41, 60, 0.97);
  box-shadow:
    0 18px 40px rgba(0, 0, 0, 0.3),
    0 -10px 24px rgba(11, 22, 32, 0.96);
}

.panel--summary-float .panel__header {
  margin-bottom: 10px;
}

.panel--summary-float .panel__header h2 {
  font-size: 0.98rem;
}

.panel--summary-float .panel__header p {
  font-size: 0.78rem;
  line-height: 1.35;
}

.panel--summary-float .kpi-grid--compact {
  margin: 0;
  gap: 8px;
}

.panel--summary-float .kpi-card {
  padding: 10px 10px 9px;
  border-radius: 12px;
}

.panel--summary-float .kpi-card span {
  font-size: 0.64rem;
  margin-bottom: 4px;
  line-height: 1.2;
}

.panel--summary-float .kpi-card strong {
  font-size: 0.9rem;
}

.kpi-card {
  padding: 12px 14px;
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(239, 245, 252, 0.88));
  border: 1px solid rgba(23, 50, 77, 0.08);
}

.kpi-card span {
  display: block;
  font-size: 0.74rem;
  color: var(--text-soft);
  margin-bottom: 6px;
  font-weight: 800;
  line-height: 1.35;
}

.kpi-card strong {
  font-size: clamp(1rem, 1.35vw, 1.2rem);
  line-height: 1.15;
}

.selection-item {
  display: grid;
  gap: 10px;
}

.selection-item--selected {
  border: 1px solid rgba(23, 50, 77, 0.08);
  border-radius: 16px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.78);
}

.selection-item__head,
.selection-item__totals {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}

.selection-item__head {
  align-items: flex-start;
}

.selection-item__actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.selection-item__totals {
  padding-top: 14px;
  border-top: 1px solid rgba(23, 50, 77, 0.08);
  font-size: 0.92rem;
}

.selection-item__totals--editor {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  align-items: end;
}

.selection-item__totals--editor .field {
  gap: 5px;
}

.selection-item__totals--editor .field span,
.selection-item__metric strong {
  font-size: 0.74rem;
}

.selection-item__totals--editor input {
  min-height: 40px;
  padding: 0 10px;
  font-size: 0.84rem;
}

.selection-item__metric {
  display: grid;
  align-content: center;
  gap: 4px;
  min-height: 40px;
  padding: 8px 10px;
  border-radius: 12px;
  background: rgba(23, 50, 77, 0.05);
  font-size: 0.84rem;
}

.selection-badge {
  display: inline-flex;
  align-items: center;
  padding: 8px 10px;
  border-radius: 999px;
  background: rgba(242, 143, 59, 0.12);
  color: #9a5416;
  font-size: 0.82rem;
  font-weight: 800;
}

.selection-badge--selected {
  background: rgba(14, 107, 168, 0.12);
  color: var(--primary-dark);
}

.history-grid {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: 8px;
}

.history-grid div {
  padding: 0;
  border-radius: 0;
  background: transparent;
  min-width: 0;
}

body.theme-dark .result-item,
body.theme-dark .selection-item {
  border-color: rgba(161, 194, 223, 0.1);
}

body.theme-dark .selection-item--selected {
  background: rgba(20, 38, 55, 0.92);
  border-color: rgba(161, 194, 223, 0.12);
}

body.theme-dark .selection-item__metric {
  background: rgba(161, 194, 223, 0.08);
}

body.theme-dark .selection-item__totals {
  border-top-color: rgba(161, 194, 223, 0.12);
}

body.theme-dark .selection-badge--selected {
  background: rgba(99, 179, 233, 0.14);
  color: #d7eeff;
}

.history-grid span {
  display: block;
  margin-bottom: 4px;
  font-size: 0.66rem;
  font-weight: 800;
  color: var(--text-soft);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.history-item {
  display: flex;
  flex-direction: column;
  margin-bottom: 10px;
  padding: 14px;
  gap: 12px;
  align-items: stretch;
  border-radius: 14px;
  border: 1px solid rgba(14, 107, 168, 0.18);
  background: rgba(14, 107, 168, 0.06);
}

.result-item.history-item {
  flex-direction: column;
  align-items: stretch;
}

.history-item__headline {
  display: grid;
  grid-template-columns: auto auto 1fr;
  gap: 6px 10px;
  align-items: baseline;
  font-size: 0.82rem;
  line-height: 1.3;
  color: var(--text-soft);
}

.history-item__headline strong {
  margin: 0;
  font-size: 0.95rem;
  line-height: 1.2;
  color: var(--text);
}

.history-item__desktop-meta {
  display: none;
}

.history-item__client-name {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text);
}

.history-item__seller-row {
  grid-column: 1 / -1;
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text);
}

.history-grid {
  display: grid;
  gap: 8px;
  grid-template-columns: minmax(0, 1fr);
}

.history-grid div {
  min-width: 0;
}

.history-item__table {
  display: grid;
  gap: 6px;
}

.history-item__table-head,
.history-item__detail {
  display: grid;
  grid-template-columns: 90px minmax(220px, 1fr) 60px 110px 110px 90px;
  gap: 10px;
  align-items: center;
}

.history-item__table-head > *,
.history-item__detail > * {
  text-align: left;
  justify-self: start;
}

.history-item__table-head {
  padding: 0 8px 3px;
  font-size: 0.64rem;
  font-weight: 800;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.history-item__detail {
  padding: 7px 8px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid rgba(23, 50, 77, 0.08);
  min-height: 38px;
}

.history-item__detail strong,
.history-item__detail span {
  min-width: 0;
  line-height: 1.35;
}

.history-item__detail strong {
  color: var(--text);
  font-size: 0.78rem;
  font-weight: 700;
}

.history-item__detail span {
  display: block;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text);
}

.history-item__detail-summary {
  display: none;
}

.history-item__detail span:nth-child(3),
.history-item__detail span:nth-child(4),
.history-item__detail span:nth-child(5),
.history-item__detail span:nth-child(6) {
  white-space: nowrap;
}

.history-item__actions {
  gap: 8px;
  align-items: center;
  width: 100%;
  justify-content: flex-start;
  flex-direction: row;
}

.history-item__actions .btn {
  min-height: 36px;
  padding: 0 12px;
  font-size: 0.78rem;
}

.history-item__detail-btn {
  display: none;
}

body.theme-dark .history-item {
  background: rgba(99, 179, 233, 0.08);
  border-color: rgba(99, 179, 233, 0.18);
}

body.theme-dark .history-item__detail {
  background: rgba(20, 38, 55, 0.58);
  border-color: rgba(161, 194, 223, 0.1);
}

body.theme-dark .kpi-card {
  background: rgba(20, 38, 55, 0.92);
}

@media (max-width: 1100px) {
  .hero-card,
  .pane-grid--search,
  .pane-grid--users,
  .pane-grid--simulator,
  .form-grid,
  .kpi-grid,
  .history-grid {
    grid-template-columns: 1fr 1fr;
  }

  .pane-grid--simulator {
    grid-template-columns: 1fr;
  }

  .panel--sticky {
    position: static;
  }

  .cliente-resumo {
    padding: 10px 12px;
  }

  .cliente-resumo__head strong {
    font-size: 0.9rem;
  }

  .cliente-resumo__meta {
    font-size: 0.78rem;
  }

  .cliente-resumo__head {
    flex-direction: column;
    align-items: stretch;
  }

  .cliente-resumo__change {
    width: 100%;
  }

  .panel--summary-float .kpi-grid--compact {
    grid-template-columns: 1fr 1fr 1fr;
  }

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

@media (min-width: 721px) {
  #appScreen {
    font-size: 0.94rem;
  }

  #appScreen .panel {
    padding: 18px;
    border-radius: 16px;
  }

  #appScreen .panel__header {
    margin-bottom: 14px;
  }

  #appScreen .panel__header h2 {
    font-size: 1.05rem;
  }

  #appScreen .panel__header p,
  #appScreen .result-item__meta,
  #appScreen .selection-item__meta,
  #appScreen .cliente-resumo__meta,
  #appScreen .user-item__line,
  #appScreen .history-item {
    font-size: 0.82rem;
  }

  #appScreen .app-header {
    padding: 11px 14px;
    border-radius: 20px;
  }

  #appScreen .app-header h1 {
    font-size: 1.08rem;
  }

  #appScreen .user-badge {
    padding: 7px 9px;
    font-size: 0.8rem;
  }

  #appScreen .tabs {
    margin-top: 14px;
    padding: 8px;
    border-radius: 16px;
    gap: 8px;
  }

  #appScreen .tab-btn {
    padding: 10px 14px;
    font-size: 0.88rem;
    border-radius: 12px;
  }

  #appScreen .app-grid,
  #appScreen .pane-grid--embedded {
    margin-top: 14px;
  }

  #appScreen input,
  #appScreen select {
    min-height: 42px;
    padding: 0 12px;
    font-size: 0.88rem;
  }

  #appScreen .btn {
    min-height: 42px;
    padding: 0 14px;
    font-size: 0.84rem;
  }

  #appScreen .result-item,
  #appScreen .selection-item,
  #appScreen .selection-item--selected,
  #appScreen .history-item,
  #appScreen .user-item,
  #appScreen .empty-state {
    padding: 12px;
    border-radius: 14px;
  }

  #appScreen .result-item__content strong,
  #appScreen .selection-item__title,
  #appScreen .cliente-resumo__head strong,
  #appScreen .history-item__headline strong {
    font-size: 0.92rem;
  }

  #appScreen .kpi-grid {
    gap: 8px;
    margin: 10px 0;
  }

  #appScreen .kpi-card {
    padding: 10px 12px;
    border-radius: 12px;
  }

  #appScreen .kpi-card span {
    font-size: 0.68rem;
  }

  #appScreen .kpi-card strong {
    font-size: 1rem;
  }

  #listaSelecionados + .action-row {
    margin-top: 18px;
  }

  #appScreen .selection-item__metric {
    display: grid;
    gap: 5px;
    min-height: auto;
    padding: 0;
    border: 0;
    background: transparent;
    font-size: 0.88rem;
    color: var(--text);
  }

  #appScreen .selection-item__metric > span {
    margin: 0;
  }

  #appScreen .selection-item__metric-value {
    min-height: 42px;
    display: flex;
    align-items: center;
    padding: 0 12px;
    border-radius: 12px;
    border: 1px solid rgba(23, 50, 77, 0.12);
    background: rgba(23, 50, 77, 0.05);
    font-size: 0.88rem;
    color: var(--text-soft);
    font-weight: 600;
  }

  body.theme-dark #appScreen .selection-item__metric {
    box-shadow: none;
    text-shadow: none;
  }

  body.theme-dark #appScreen .selection-item__metric > span {
    color: inherit;
  }

  body.theme-dark #appScreen .selection-item__metric-value {
    border-color: rgba(161, 194, 223, 0.14);
    background: rgba(161, 194, 223, 0.06);
    color: var(--text-soft);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.02);
  }

  #usuariosPane .panel {
    padding: 16px;
  }

  #usuariosPane .panel__header {
    margin-bottom: 12px;
  }

  #usuariosPane .panel__header h2 {
    font-size: 1rem;
  }

  #usuariosPane .panel__header p {
    font-size: 0.8rem;
  }

  #usuariosPane .form-grid {
    gap: 10px;
  }

  #usuariosPane .field span {
    font-size: 0.84rem;
  }

  #usuariosPane input,
  #usuariosPane select {
    min-height: 40px;
    font-size: 0.84rem;
  }

  #usuariosPane .action-row {
    margin-top: 10px;
    gap: 8px;
  }

  #usuariosPane .btn {
    min-height: 40px;
    font-size: 0.8rem;
    padding: 0 12px;
  }

  #usuariosPane .user-item {
    padding: 10px 12px;
    gap: 10px;
    border-radius: 12px;
  }

  #usuariosPane .user-item__line {
    font-size: 0.78rem;
  }

  #usuariosPane .user-item__line strong {
    font-size: 0.9rem;
  }

  #usuariosPane .user-item__actions .btn {
    min-height: 32px;
    font-size: 0.74rem;
  }

  #appScreen .history-item__headline {
    grid-template-columns: auto minmax(120px, auto) minmax(220px, auto) auto auto auto;
    justify-content: start;
    gap: 6px 10px;
    font-size: 0.92rem;
    align-items: center;
  }

  #appScreen .history-item__desktop-meta {
    display: inline-flex;
    align-items: center;
    white-space: nowrap;
    font-weight: 700;
    color: var(--text);
    text-align: left;
    justify-self: start;
    min-height: 32px;
    padding: 0 10px;
    border-radius: 10px;
    background: rgba(23, 50, 77, 0.06);
    border: 1px solid rgba(23, 50, 77, 0.06);
  }

  body.theme-dark #appScreen .history-item__desktop-meta {
    background: rgba(161, 194, 223, 0.08);
    border-color: rgba(161, 194, 223, 0.08);
    color: var(--text);
  }

  #appScreen .history-item__headline strong {
    font-size: 1.02rem;
    justify-self: start;
  }

  #appScreen .history-item__client-name {
    font-size: 0.86rem;
  }

  #appScreen .history-item__headline > span:nth-child(3) {
    font-size: 0.86rem;
    font-weight: 700;
    color: var(--text);
  }

  #appScreen .history-item__seller-row {
    font-size: 0.86rem;
    margin-bottom: 2px;
    grid-column: 1 / -1;
  }

  #appScreen .history-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 10px;
    font-size: 0.86rem;
  }

  #appScreen .history-grid div:first-child {
    white-space: normal;
    overflow-wrap: anywhere;
  }

  #appScreen .history-item__detail strong {
    font-size: 0.76rem;
  }

  #appScreen .history-item__detail span {
    font-size: 0.7rem;
  }

  #appScreen .history-item__detail {
    align-items: center;
    min-height: 34px;
  }
}

@media (max-width: 720px) {
  .page-shell {
    padding: 10px;
  }

  .screen--centered {
    min-height: auto;
    padding: 4px 0;
  }

  .hero-card,
  .pane-grid--search,
  .pane-grid--users,
  .form-grid,
  .kpi-grid,
  .history-grid {
    grid-template-columns: 1fr;
  }

  .step-pillbar {
    position: sticky;
    top: 8px;
    z-index: 5;
    gap: 6px;
    margin-bottom: 12px;
    padding: 8px;
    border-radius: 16px;
    background: var(--surface);
    border: 1px solid var(--border);
    box-shadow: 0 12px 32px rgba(23, 50, 77, 0.08);
  }

  .step-pill {
    flex: 1 1 0;
    justify-content: center;
    font-size: 0.7rem;
    padding: 8px 6px;
    text-align: center;
  }

  .hero-copy {
    min-height: auto;
    align-items: center;
    text-align: center;
  }

  .hero-copy__logo-wrap,
  .hero-copy__title-wrap {
    transform: none;
  }

  .hero-copy__logo-wrap {
    width: fit-content;
    padding: 14px 16px;
    margin: 0 0 16px;
  }

  .hero-copy__logo {
    width: min(100%, 200px);
    max-height: 82px;
    margin: 0 auto;
  }

  .hero-copy h1 {
    margin: 0;
    font-size: 1.45rem;
    line-height: 1.05;
  }

  .app-signature {
    margin-top: 18px;
    font-size: 0.64rem;
    line-height: 1.35;
  }

  .searchbar {
    gap: 6px;
    margin-bottom: 10px;
  }

  .searchbar input {
    min-height: 38px;
    padding: 0 11px;
    font-size: 0.84rem;
    line-height: 1.2;
  }

  .searchbar .btn {
    min-height: 38px;
    padding: 0 12px;
    font-size: 0.82rem;
  }

  #produtoMarcaBusca {
    min-height: 38px;
    padding: 0 11px;
    font-size: 0.84rem;
    line-height: 1.2;
    appearance: none;
    -webkit-appearance: none;
    background-image: none;
    box-sizing: border-box;
  }

  .panel {
    padding: 14px;
    border-radius: 16px;
    box-shadow: 0 12px 26px rgba(23, 50, 77, 0.08);
  }

  .panel__header {
    margin-bottom: 12px;
  }

  .panel__header h2 {
    font-size: 1rem;
  }

  .panel__header p {
    margin-top: 4px;
    font-size: 0.82rem;
    line-height: 1.4;
  }

  .field--inline {
    gap: 8px;
  }

  .field--inline span {
    font-size: 0.8rem;
  }

  .field--inline select {
    min-height: 36px;
    width: auto;
    min-width: 148px;
    max-width: 100%;
    padding: 0 10px;
    font-size: 0.8rem;
  }

  .panel--summary-float {
    padding: 10px 12px;
    border-radius: 14px;
    position: sticky;
    top: 10px;
    z-index: 4;
    background: var(--surface-strong);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }

  .panel--summary-float .panel__header {
    margin-bottom: 8px;
  }

  .panel--summary-float .panel__header h2 {
    font-size: 0.88rem;
  }

  .panel--summary-float .panel__header p {
    font-size: 0.74rem;
  }

  .panel--summary-float .kpi-grid--compact {
    gap: 6px;
    margin: 0;
  }

  .panel--summary-float .kpi-card {
    padding: 8px 8px 7px;
    border-radius: 10px;
  }

  .panel--summary-float .kpi-card span {
    font-size: 0.6rem;
    margin-bottom: 3px;
  }

  .panel--summary-float .kpi-card strong {
    font-size: 0.82rem;
  }

  .app-header,
  .selection-item__head,
  .selection-item__totals {
    flex-direction: column;
    align-items: stretch;
  }

  .app-header {
    padding: 10px 12px;
    gap: 8px;
    flex-wrap: wrap;
    border-radius: 18px;
  }

  .app-header h1 {
    font-size: 0.88rem;
    white-space: normal;
  }

  .header-actions {
    justify-content: space-between;
    flex-direction: row;
    align-items: center;
    flex-wrap: wrap;
    width: 100%;
  }

  .header-actions > * {
    width: auto;
  }

  .user-badge {
    min-width: 0;
    flex: 1 1 auto;
    font-size: 0.76rem;
    padding: 6px 8px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  #logoutButton {
    flex: 0 0 auto;
    min-height: 36px;
    padding: 0 11px;
    font-size: 0.82rem;
  }

  #themeToggleButton {
    min-height: 36px;
    padding: 0 11px;
    font-size: 0.82rem;
  }

  .selection-item__actions {
    width: 100%;
    justify-content: space-between;
  }

  .action-row {
    gap: 8px;
    margin-top: 8px;
  }

  .action-row .btn {
    width: 100%;
    min-height: 36px;
    padding: 0 10px;
    font-size: 0.8rem;
  }

  #usuariosPane .panel {
    padding: 12px;
    border-radius: 14px;
  }

  #usuariosPane .panel__header {
    margin-bottom: 10px;
  }

  #usuariosPane .panel__header h2 {
    font-size: 0.94rem;
  }

  #usuariosPane .panel__header p {
    font-size: 0.78rem;
  }

  #usuariosPane .form-grid {
    gap: 8px;
  }

  #usuariosPane .field span {
    font-size: 0.78rem;
  }

  #usuariosPane input,
  #usuariosPane select {
    min-height: 36px;
    font-size: 0.8rem;
    padding: 0 10px;
  }

  #usuariosPane .action-row {
    margin-top: 8px;
    gap: 6px;
  }

  #usuariosPane .btn {
    min-height: 36px;
    font-size: 0.78rem;
    padding: 0 10px;
  }

  #usuariosPane .user-item {
    padding: 10px;
    gap: 8px;
    border-radius: 12px;
  }

  #usuariosPane .user-item__line {
    font-size: 0.74rem;
  }

  #usuariosPane .user-item__line strong {
    font-size: 0.86rem;
  }

  #usuariosPane .user-item__actions .btn {
    min-height: 30px;
    font-size: 0.72rem;
  }

  .selection-item__totals--editor {
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 6px;
  }

  .selection-item__totals--editor .field:nth-child(1),
  .selection-item__totals--editor .field:nth-child(2) {
    grid-column: span 3;
  }

  #appScreen .selection-item__metric {
    grid-column: span 2;
  }

  .selection-item {
    gap: 8px;
    padding: 12px;
    border-radius: 14px;
  }

  .selection-item__meta,
  .result-item__meta {
    font-size: 0.78rem;
    line-height: 1.4;
  }

  .selection-item__title {
    margin-bottom: 4px;
    font-size: 0.92rem;
  }

  .selection-item__totals {
    padding-top: 10px;
    gap: 8px;
  }

  .selection-item__totals--editor input {
    min-height: 36px;
    font-size: 0.8rem;
    padding: 0 9px;
  }

  #appScreen .selection-item__totals--editor .field span,
  #appScreen .selection-item__metric > span {
    margin: 0;
    font-size: 0.68rem;
    color: inherit;
  }

  #appScreen .selection-item__metric {
    min-height: auto;
    padding: 0;
    font-size: 0.78rem;
    background: transparent !important;
    border: 0 !important;
    gap: 4px;
    box-shadow: none !important;
    text-shadow: none !important;
  }

  #appScreen .selection-item__metric-value {
    width: 100%;
    box-sizing: border-box;
    min-height: 36px;
    display: flex;
    align-items: center;
    padding: 0 9px;
    border-radius: 10px;
    border: 1px solid rgba(23, 50, 77, 0.12);
    background: rgba(23, 50, 77, 0.05);
    font-size: 0.8rem;
    color: var(--text-soft);
    font-weight: 600;
  }

  body.theme-dark #appScreen .selection-item__metric-value {
    border-color: rgba(161, 194, 223, 0.14);
    background: rgba(161, 194, 223, 0.06);
    color: var(--text-soft);
    -webkit-text-fill-color: var(--text-soft);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.02);
  }

  .kpi-grid {
    gap: 6px;
    margin: 10px 0;
  }

  .kpi-card {
    padding: 10px;
    border-radius: 12px;
  }

  .kpi-card span {
    font-size: 0.66rem;
    margin-bottom: 4px;
  }

  .kpi-card strong {
    font-size: 0.92rem;
  }

  .result-item {
    flex-direction: row;
    align-items: center;
    gap: 8px;
    padding: 9px 10px;
    border-radius: 12px;
  }

  .result-item__content {
    flex: 1 1 auto;
    min-width: 0;
  }

  .result-item__content strong {
    margin-bottom: 2px;
    font-size: 0.84rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .result-item__meta {
    display: block;
    font-size: 0.72rem;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .result-item .action-row {
    flex: 0 0 auto;
    flex-direction: row;
  }

  .result-item .btn {
    min-height: 32px;
    padding: 0 10px;
    font-size: 0.76rem;
    border-radius: 10px;
  }

  .user-item {
    padding: 12px;
    align-items: stretch;
  }

  .user-item__line {
    font-size: 0.76rem;
    gap: 8px;
  }

  .user-item__line strong {
    font-size: 0.9rem;
  }

  .user-item__actions {
    width: 100%;
    justify-content: flex-start;
    gap: 6px;
    flex-direction: row;
  }

  .user-item__actions .btn {
    min-height: 32px;
    font-size: 0.74rem;
    flex: 1 1 0;
  }

  .history-item {
    padding: 12px;
    gap: 10px;
    align-items: stretch;
  }

  .history-item__table {
    display: none;
  }

  .history-item__table-head {
    display: none;
  }

  .history-grid {
    display: none;
  }

  .history-item__detail-summary {
    display: block;
    font-size: 0.72rem;
    line-height: 1.35;
  }

  .history-item__headline {
    display: flex;
    flex-wrap: wrap;
    gap: 5px 8px;
    align-items: flex-start;
  }

  .history-item__seller-row {
    flex: 1 0 100%;
    line-height: 1.25;
  }

  .history-item__headline strong {
    flex: 0 0 auto;
    line-height: 1.2;
  }

  .history-item__headline > span:nth-child(3) {
    flex: 0 0 auto;
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--text);
  }

  .history-item__client-name {
    flex: 0 1 auto;
    line-height: 1.25;
  }

  .history-item__headline strong,
  .history-item__seller-row,
  .history-item__client-name,
  .history-item__desktop-meta {
    justify-self: start;
    white-space: normal;
  }

  .history-item__desktop-meta {
    display: block;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 6px 7px;
    border-radius: 10px;
    background: rgba(14, 107, 168, 0.08);
    border: 1px solid rgba(14, 107, 168, 0.12);
    min-width: 0;
  }

  .history-item__desktop-meta:nth-child(5),
  .history-item__desktop-meta:nth-child(6),
  .history-item__desktop-meta:nth-child(7) {
    order: 10;
    flex: 1 1 88px;
  }

  .history-item__seller-row {
    font-size: 0.8rem;
    margin-bottom: 0;
  }

  .history-item__client-name {
    font-size: 0.82rem;
  }

  .history-item__detail-btn {
    display: inline-flex;
    background: rgba(23, 50, 77, 0.06);
    color: var(--primary-dark);
  }

  .history-item__actions .history-item__detail-btn {
    background: rgba(23, 50, 77, 0.06);
    color: var(--primary-dark);
    justify-content: center;
    text-align: center;
  }

  .history-item__actions {
    width: 100%;
    justify-content: flex-start;
    gap: 6px;
    flex-direction: row;
  }

  .history-item__actions .btn {
    min-height: 32px;
    padding: 0 10px;
    font-size: 0.74rem;
    flex: 1 1 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-align: center;
  }

  .history-item__detail-btn {
    display: inline-flex;
  }

  .btn--icon {
    min-height: 30px;
    width: 30px;
    font-size: 0.9rem;
  }

  .result-list {
    min-height: 0;
  }

  .result-list .empty-state {
    min-height: 38px;
    padding: 8px 10px;
    border-radius: 12px;
    font-size: 0.78rem;
  }

  .selection-badge {
    padding: 6px 8px;
    font-size: 0.74rem;
  }

  .searchbar {
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
  }

  .searchbar input {
    flex: 1 1 auto;
    min-width: 0;
  }

  .searchbar .btn {
    flex: 0 0 auto;
    min-width: 74px;
  }

  .action-row {
    flex-direction: column;
  }

  .action-row > * {
    width: 100%;
  }

  .tabs {
    margin-top: 10px;
    padding: 6px;
    border-radius: 16px;
  }

  .tab-btn {
    flex: 1 0 auto;
    border-radius: 12px;
    padding: 11px 12px;
    font-size: 0.8rem;
  }

  .alert {
    margin-top: 10px;
    padding: 12px 14px;
    border-radius: 12px;
    font-size: 0.84rem;
  }

  .app-grid {
    margin-top: 12px;
  }
}
