:root {
  /* Tokens do app mapeados sobre o design system Stölben (--ds-*).
     Mantemos os nomes de variável do app para que toda a folha de
     estilo herde a paleta/raios do DS sem reescrever cada regra. */
  --bg: var(--ds-bg);
  --bg-soft: var(--ds-panel);
  --surface: var(--ds-surface);
  --surface-2: var(--ds-panel);
  --surface-strong: var(--ds-surface);
  --surface-strong-2: #f8fafc;
  --border: var(--ds-line);
  --border-strong: #dfe3ea;
  --text: var(--ds-text-900);
  --text-soft: var(--ds-text-700);
  --muted: var(--ds-text-500);
  --accent: var(--ds-blue);
  --accent-2: var(--ds-blue-light);
  --success: var(--ds-success);
  --danger: var(--ds-danger);
  --warning: var(--ds-warn-strong);
  --shadow: var(--ds-shadow-soft);
  --radius-xl: var(--ds-radius-xl);
  --radius-lg: var(--ds-radius-lg);
  --radius-md: var(--ds-radius-md);
  --radius-sm: 0.75rem;
  --max-width: 1180px;
  --transition: 240ms var(--ds-ease);
  --font-display: var(--ds-font-display);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--ds-font-sans);
  color: var(--text);
  background: var(--ds-bg);
  min-height: 100vh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

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

.container {
  width: min(calc(100% - 2rem), var(--max-width));
  margin: 0 auto;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(247, 251, 255, 0.94);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(71, 101, 138, 0.1);
  box-shadow: 0 1px 8px rgba(49, 88, 132, 0.07);
}

.nav {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0;
  min-height: 52px;
}

.nav-top {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
  margin-right: 0.75rem;
}

.nav-bottom {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: flex-start;
}

.brand {
  font-weight: 700;
  letter-spacing: -0.04em;
  font-size: 1.08rem;
}

.brand span {
  color: var(--accent);
}

.nav-toggle {
  display: none;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  border: 1px solid rgba(71, 101, 138, 0.2);
  background: rgba(255, 255, 255, 0.86);
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 4px;
  cursor: pointer;
}

.nav-toggle-bar {
  width: 18px;
  height: 2px;
  border-radius: 999px;
  background: var(--text);
}

.nav-links {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  list-style: none;
  color: var(--muted);
  font-size: 0.95rem;
  flex-wrap: wrap;
  min-width: 0;
}

.header-user-meta {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  color: var(--text-soft);
  flex-shrink: 0;
  margin-left: auto;
}

.header-user-info {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  flex-wrap: wrap;
}

.header-user-company {
  display: inline-flex;
  align-items: center;
}

.header-user-greeting {
  color: var(--text-soft);
}

.header-user-actions {
  display: inline-flex;
  align-items: center;
}

.header-user-actions form {
  display: inline-flex;
  margin: 0;
}

.header-company-switch {
  display: inline-flex;
  align-items: center;
  margin: 0;
}

.header-company-select {
  width: auto;
  min-height: 32px;
  padding: 0.26rem 1.8rem 0.26rem 0.7rem;
  border-radius: 999px;
  border: 1px solid rgba(71, 101, 138, 0.2);
  background-color: rgba(255, 255, 255, 0.74);
  color: var(--text-soft);
  font-size: 0.84rem;
  font-weight: 500;
  box-shadow: none;
  appearance: none;
  -webkit-appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, rgba(71, 101, 138, 0.58) 50%),
    linear-gradient(135deg, rgba(71, 101, 138, 0.58) 50%, transparent 50%);
  background-position:
    calc(100% - 0.95rem) 48%,
    calc(100% - 0.65rem) 48%;
  background-size: 0.34rem 0.34rem, 0.34rem 0.34rem;
  background-repeat: no-repeat;
}

.header-company-select:hover {
  border-color: rgba(71, 101, 138, 0.34);
  color: var(--text);
}

.header-company-select:focus-visible {
  border-color: rgba(47, 120, 219, 0.45);
  box-shadow: 0 0 0 3px rgba(47, 120, 219, 0.12);
}

.header-company-select option {
  color: var(--text);
}

.header-separator {
  color: var(--muted);
}

.user-role {
  display: inline-flex;
  align-items: center;
  color: var(--ds-blue-dark);
  background: var(--ds-blue-50);
  border: 1px solid var(--ds-blue-100);
  padding: 0.12rem 0.55rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.nav-links a {
  position: relative;
  padding: 0.45rem 0.7rem;
  border-radius: 999px;
  transition: color var(--transition);
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--text);
  background: rgba(47, 120, 219, 0.1);
}

.nav-logout {
  border: 1px solid rgba(71, 101, 138, 0.2);
  background: rgba(255, 255, 255, 0.82);
  color: var(--text-soft);
  font: inherit;
  cursor: pointer;
  padding: 0.24rem 0.62rem;
  border-radius: 999px;
  min-height: 32px;
  width: auto;
}

.nav-logout:hover {
  color: var(--text);
  border-color: rgba(71, 101, 138, 0.3);
}

main {
  padding-top: 2.8rem;
  padding-bottom: 3rem;
}

.flash-stack {
  margin-bottom: 1rem;
}

.flash-list {
  list-style: none;
  display: grid;
  gap: 0.35rem;
  margin: 0;
  padding: 0;
}

.flash-message {
  margin: 0;
  padding: 0.3rem 0 0.32rem 0.62rem;
  border-left: 2px solid rgba(47, 120, 219, 0.4);
  color: #2b5d93;
  font-size: 0.9rem;
  font-weight: 500;
  line-height: 1.45;
}

.flash-message.flash-success {
  border-left-color: rgba(79, 165, 106, 0.5);
  color: #2f7e4b;
}

.flash-message.flash-warning {
  border-left-color: rgba(182, 120, 28, 0.5);
  color: #966015;
}

.flash-message.flash-error,
.flash-message.flash-danger {
  border-left-color: rgba(209, 69, 69, 0.55);
  color: #a33333;
}

section {
  padding: 1rem 0;
}

.section-heading {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 1rem;
  margin-bottom: 1.4rem;
}

.section-heading h2 {
  font-size: clamp(1.7rem, 3vw, 2.5rem);
  letter-spacing: -0.045em;
}

.section-heading p {
  color: var(--text-soft);
  max-width: 700px;
  line-height: 1.7;
}

.panel {
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-strong);
  background: linear-gradient(180deg, var(--surface-strong), var(--surface-strong-2));
  padding: 1.4rem;
  box-shadow: var(--shadow);
}

.panel h3 {
  font-size: 1.08rem;
  margin-bottom: 0.75rem;
  letter-spacing: -0.03em;
}

.panel p,
.panel li,
.panel td,
.panel .muted,
.panel small {
  color: var(--text-soft);
}

.panel h2,
.panel h3,
.panel strong,
.panel th,
.panel label {
  color: var(--text);
}

.form-panel form {
  display: grid;
  gap: 1rem;
}

.form-panel {
  padding: 1.35rem 1.45rem;
  border-radius: 24px;
  border: 1px solid var(--border-strong);
  background: linear-gradient(180deg, #ffffff, #f7faff);
  box-shadow: var(--shadow);
}

.form-panel-compact {
  max-width: 760px;
}

.form-note {
  padding: 0.95rem 1rem;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(251, 191, 36, 0.32);
  background: var(--ds-warn-soft);
  color: var(--text);
  font-size: 0.94rem;
  line-height: 1.6;
}

.form-note strong {
  color: var(--ds-warn-strong);
}

.form-panel p {
  margin-bottom: 0;
}

.form-panel ul.errorlist {
  list-style: none;
  margin-top: 0.5rem;
  padding: 0.75rem 0.9rem;
  border-radius: var(--ds-radius-md);
  border: 1px solid var(--ds-danger-border);
  background: var(--ds-danger-soft);
  color: var(--ds-danger);
  font-size: 0.92rem;
  line-height: 1.55;
}

.form-panel ul.errorlist li {
  color: inherit;
}

.form-panel fieldset {
  border: 0;
}

.form-submenu {
  margin-top: 1rem;
  border: 1px solid rgba(71, 101, 138, 0.14);
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(250, 252, 255, 0.98), rgba(244, 248, 255, 0.96));
  overflow: hidden;
}

.form-submenu summary {
  list-style: none;
  cursor: pointer;
  padding: 1rem 1.15rem;
  font-weight: 700;
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.form-submenu summary::-webkit-details-marker {
  display: none;
}

.form-submenu summary::after {
  content: "";
  width: 0.65rem;
  height: 0.65rem;
  border-right: 2px solid var(--accent);
  border-bottom: 2px solid var(--accent);
  transform: rotate(45deg);
  transition: transform var(--transition);
}

.form-submenu[open] summary::after {
  transform: rotate(225deg);
}

.form-submenu-body {
  padding: 0 1.15rem 1.15rem;
}

.form-panel form.is-collapsed fieldset,
.form-panel form.is-collapsed .inline-actions {
  display: none;
}

.muted {
  color: var(--text-soft);
}

.editor-shell {
  display: grid;
  gap: 1rem;
}

.editor-grid {
  display: grid;
  gap: 1rem;
}

.editor-sidebar {
  display: grid;
  gap: 1rem;
  align-content: start;
}

.inline-actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  align-items: center;
}

.btn {
  min-height: 44px;
  padding: 0 1rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition), background var(--transition), color var(--transition);
  cursor: pointer;
  font-weight: 600;
  letter-spacing: -0.01em;
}

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

.btn:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
button:focus-visible,
summary:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--ds-blue);
  outline-offset: 2px;
}

.btn-primary {
  background: linear-gradient(180deg, rgba(235, 244, 255, 0.98) 0%, rgba(222, 236, 255, 0.98) 100%);
  border-color: rgba(47, 120, 219, 0.18);
  color: #2d6bbf;
  box-shadow: 0 10px 24px rgba(118, 169, 255, 0.12);
}

.btn-primary:hover {
  background: linear-gradient(180deg, rgba(229, 240, 255, 1) 0%, rgba(214, 231, 255, 1) 100%);
  box-shadow: 0 12px 28px rgba(118, 169, 255, 0.16);
}

.btn-primary-lite {
  min-height: 40px;
  padding: 0 0.9rem;
  background: rgba(232, 242, 255, 0.96);
  color: #2d6bbf;
  border-color: rgba(47, 120, 219, 0.16);
  box-shadow: none;
}

.btn-primary-lite:hover {
  box-shadow: none;
  background: rgba(223, 237, 255, 0.98);
}

.btn-soft {
  min-height: 40px;
  padding: 0 0.95rem;
  background: rgba(240, 247, 255, 0.98);
  color: #316dbf;
  border-color: rgba(47, 120, 219, 0.14);
  box-shadow: none;
}

.btn-soft:hover {
  box-shadow: none;
  background: rgba(231, 241, 255, 0.98);
}

.btn-status-draft {
  min-height: 40px;
  background: rgba(108, 130, 154, 0.12);
  color: #6c829a;
  border-color: rgba(108, 130, 154, 0.22);
  box-shadow: none;
}

.btn-status-draft:hover {
  background: rgba(108, 130, 154, 0.18);
  border-color: rgba(108, 130, 154, 0.28);
  box-shadow: none;
}

.btn-status-approved {
  min-height: 40px;
  background: var(--ds-success-soft);
  color: var(--ds-success);
  border-color: var(--ds-success-border);
  box-shadow: none;
}

.btn-status-approved:hover {
  background: color-mix(in srgb, var(--ds-success) 16%, white);
  box-shadow: none;
}

.btn-status-rejected {
  min-height: 40px;
  background: var(--ds-danger-soft);
  color: var(--ds-danger);
  border-color: var(--ds-danger-border);
  box-shadow: none;
}

.btn-status-rejected:hover {
  background: color-mix(in srgb, var(--ds-danger) 16%, white);
  box-shadow: none;
}

.btn-status-cancelled {
  min-height: 40px;
  background: rgba(96, 116, 136, 0.12);
  color: #607488;
  border-color: rgba(96, 116, 136, 0.22);
  box-shadow: none;
}

.btn-status-cancelled:hover {
  background: rgba(96, 116, 136, 0.18);
  box-shadow: none;
}

.btn-icon {
  min-width: 44px;
  padding: 0;
}

.btn-icon-action {
  min-width: 40px;
  width: 40px;
  min-height: 40px;
  padding: 0;
}

.action-icon {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.92);
  color: var(--text);
  border-color: rgba(71, 101, 138, 0.22);
}

.btn-compact {
  min-height: 38px;
  padding: 0 0.8rem;
  gap: 0.38rem;
  font-size: 0.9rem;
}

.btn-danger {
  background: var(--ds-danger-soft);
  color: var(--ds-danger);
  border-color: var(--ds-danger-border);
}

.btn-danger:hover {
  background: color-mix(in srgb, var(--ds-danger) 14%, white);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-bottom: 1rem;
}

.stat-card {
  border-radius: var(--radius-md);
  border: 1px solid var(--border-strong);
  background: linear-gradient(180deg, #ffffff, #f6faff);
  padding: 1rem;
}

.stat-card .label {
  color: var(--text-soft);
  font-size: 0.9rem;
  font-weight: 700;
}

.stat-card .value {
  display: block;
  margin-top: 0.35rem;
  font-size: 1.65rem;
  font-weight: 700;
  letter-spacing: -0.04em;
  color: var(--text);
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.form-grid .full {
  grid-column: 1 / -1;
}

form p {
  margin-bottom: 1rem;
}

label {
  display: block;
  margin-bottom: 0.45rem;
  color: var(--text);
  font-weight: 600;
}

.required-mark {
  color: var(--ds-danger);
  margin-left: 0.2rem;
}

input,
select,
textarea {
  width: 100%;
  min-height: 46px;
  padding: 0.82rem 0.95rem;
  border-radius: 14px;
  border: 1px solid var(--border-strong);
  background: #ffffff;
  color: var(--text);
  outline: none;
  transition: border-color var(--transition), background var(--transition), box-shadow var(--transition);
}

input[data-force-uppercase="1"] {
  text-transform: uppercase;
}

textarea {
  min-height: 120px;
  resize: vertical;
}

input::placeholder,
textarea::placeholder {
  color: #8aa0b8;
}

input:focus,
select:focus,
textarea:focus {
  background: #ffffff;
  border-color: rgba(118, 169, 255, 0.55);
  box-shadow: 0 0 0 4px rgba(118, 169, 255, 0.14);
}

select option {
  background: #ffffff;
  color: var(--text);
}

input[type="checkbox"],
input[type="radio"] {
  width: auto;
  min-height: auto;
  padding: 0;
  border: none;
  background: transparent;
  box-shadow: none;
  accent-color: var(--accent);
  transform: scale(1.08);
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin-top: 0.3rem;
}

.checkbox-row label {
  margin-bottom: 0;
  font-weight: 500;
}

.filters-form {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.compact-filters {
  margin-bottom: 0;
}

.filters-form input {
  flex: 1 1 320px;
}

.filters-form select {
  width: auto;
  min-width: 180px;
}

.table-wrap {
  overflow-x: auto;
  border-radius: 18px;
  -webkit-overflow-scrolling: touch;
}

table {
  width: 100%;
  border-collapse: collapse;
  border-radius: 18px;
  overflow: hidden;
  border: 1px solid var(--border-strong);
  background: rgba(255, 255, 255, 0.96);
}

th,
td {
  padding: 0.9rem;
  border-bottom: 1px solid rgba(71, 101, 138, 0.12);
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--text);
  background: #f3f8ff;
  font-size: 0.92rem;
}

td {
  color: var(--text-soft);
}

tr:hover td {
  background: rgba(47, 120, 219, 0.04);
}

.money {
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.36rem 0.68rem;
  border-radius: 999px;
  background: rgba(47, 120, 219, 0.08);
  border: 1px solid rgba(47, 120, 219, 0.1);
  color: var(--text);
  font-size: 0.82rem;
  line-height: 1.1;
  text-align: center;
}

.badge-warning {
  background: rgba(182, 120, 28, 0.1);
  border-color: rgba(182, 120, 28, 0.14);
  color: #925d16;
}

.badge-success {
  background: rgba(79, 165, 106, 0.12);
  border-color: rgba(79, 165, 106, 0.18);
  color: #2f7d49;
}

.badge-info {
  background: rgba(47, 120, 219, 0.1);
  border-color: rgba(47, 120, 219, 0.14);
  color: #2d6bbf;
}

.badge-danger {
  background: rgba(209, 69, 69, 0.12);
  border-color: rgba(209, 69, 69, 0.18);
  color: #b63e3e;
}

.badge-danger-soft {
  background: rgba(209, 69, 69, 0.1);
  border-color: rgba(209, 69, 69, 0.16);
  color: #b63e3e;
}

.category-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.34rem 0.62rem;
  border-radius: 999px;
  background: color-mix(in srgb, var(--category-color, #2563eb) 12%, white);
  border: 1px solid color-mix(in srgb, var(--category-color, #2563eb) 18%, white);
  color: var(--text);
  font-size: 0.82rem;
  line-height: 1.1;
}

.category-chip-inline {
  padding: 0.22rem 0.5rem;
  font-size: 0.76rem;
}

.category-chip-dot,
.category-color-preview {
  width: 0.72rem;
  height: 0.72rem;
  border-radius: 999px;
  background: var(--category-color, #2563eb);
  flex: 0 0 auto;
}

.category-color-preview {
  display: inline-block;
  width: 1rem;
  height: 1rem;
  border: 2px solid rgba(255, 255, 255, 0.75);
  box-shadow: 0 0 0 1px rgba(71, 101, 138, 0.14);
}

.status-rascunho { color: #445f7d; }
.status-em_elaboracao { color: #a16b18; }
.status-enviado { color: #2f78db; }
.status-aprovado { color: #3d8f56; }
.status-rejeitado { color: #be4444; }
.status-cancelado { color: #607488; }

.modal-panel {
  margin-top: 1rem;
  background: linear-gradient(180deg, #ffffff, #f6faff);
  border: 1px solid rgba(71, 101, 138, 0.16);
  box-shadow: var(--shadow);
}

.item-entry-panel {
  display: grid;
  gap: 1rem;
  padding: 1.25rem 1.35rem;
  border-radius: 22px;
  border: 1px solid var(--border-strong);
  background:
    radial-gradient(circle at top right, rgba(47, 120, 219, 0.08), transparent 35%),
    linear-gradient(180deg, #ffffff, #f6faff);
  box-shadow: var(--shadow);
}

.item-entry-panel-compact {
  width: min(100%, 760px);
  padding: 1rem 1.1rem;
  border-radius: 20px;
}

.editor-shell > #item-create-panel-region {
  display: none;
}

.item-entry-panel-compact .section-heading h3,
.item-entry-panel-compact .item-block-header h4 {
  font-size: 0.96rem;
}

.item-entry-panel-compact .form-grid {
  gap: 0.8rem;
}

.item-entry-panel-compact .form-grid,
.item-entry-panel-compact .catalog-picker,
.item-entry-panel-compact .item-builder-grid,
.item-entry-panel-compact .inline-feedback,
.item-entry-panel-compact .item-builder {
  padding-left: 0.35rem;
  padding-right: 0.35rem;
}

.item-entry-panel-compact textarea {
  min-height: 92px;
}

.item-entry-panel-compact textarea[name="descricao"] {
  min-height: 3.8rem;
}

.item-builder {
  display: grid;
  gap: 1rem;
}

.item-builder-intro {
  display: block;
}

.item-builder-preview,
.catalog-summary {
  padding: 1rem 1.1rem;
  border-radius: 18px;
  border: 1px solid var(--border-strong);
  background: rgba(247, 250, 255, 0.92);
}

.catalog-summary[data-category-active="1"] {
  background: color-mix(in srgb, var(--category-color, #2563eb) 12%, white);
  border-color: color-mix(in srgb, var(--category-color, #2563eb) 24%, white);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--category-color, #2563eb) 10%, white);
}

.item-builder-preview strong,
.catalog-summary strong {
  display: block;
  color: var(--text);
  margin-bottom: 0.35rem;
}

.item-builder-preview {
  display: grid;
  align-content: center;
}

.item-builder-preview strong {
  font-size: 1.55rem;
  letter-spacing: -0.04em;
}

.preview-label {
  color: var(--muted);
  font-size: 0.84rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.preview-inline {
  margin-top: 1rem;
}

.item-builder-grid {
  display: grid;
  gap: 1rem;
}

.item-block {
  padding: 0.9rem 0;
  border-top: 1px solid rgba(71, 101, 138, 0.14);
  background: transparent;
}

.item-builder-grid .item-block:first-child {
  padding-top: 0;
  border-top: 0;
}

.item-block-header {
  margin-bottom: 0.7rem;
}

.item-block-header h4 {
  font-size: 1rem;
  letter-spacing: -0.03em;
  margin-bottom: 0.25rem;
}

.item-block-header p,
.catalog-summary small,
.item-builder-preview small {
  color: var(--text-soft);
}

.catalog-picker {
  display: grid;
  gap: 0.9rem;
  margin-bottom: 1rem;
}

.catalog-search-row {
  display: grid;
  grid-template-columns: minmax(0, 24rem) 40px;
  align-items: center;
  gap: 0.65rem;
  justify-content: start;
  width: min(100%, calc(24rem + 40px + 0.65rem));
}

.catalog-search-row input {
  width: 100%;
  min-width: 0;
}

.catalog-search-row .btn {
  width: 40px;
  min-width: 40px;
  justify-self: start;
}

.catalog-summary {
  min-height: 84px;
}

.catalog-summary small {
  display: block;
}

.actions-col {
  min-width: 220px;
  text-align: center;
}

.status-col {
  min-width: 220px;
  text-align: center;
}

.status-cell {
  display: grid;
  gap: 0.65rem;
  justify-items: center;
}

.actions-stack {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
  align-items: stretch;
}

.actions-stack-inline {
  flex-wrap: wrap;
}

.actions-stack form {
  display: inline-flex;
}

.actions-stack .btn,
.actions-stack form .btn {
  min-width: 132px;
  min-height: 40px;
}

.actions-stack .btn-icon-action,
.actions-stack form .btn-icon-action {
  min-width: 40px;
}

.table-subline {
  display: block;
  margin-top: 0.2rem;
  color: var(--text-soft);
  line-height: 1.45;
}

.table-subline-muted {
  font-size: 0.83rem;
  color: var(--muted);
}

.table-subline-warning {
  font-size: 0.83rem;
  color: #a16b18;
}

.budget-main-cell,
.budget-meta-cell,
.budget-title-cell,
.budget-total-cell {
  min-width: 0;
}

.budget-main-cell strong,
.budget-meta-cell strong,
.budget-title-cell strong,
.budget-total-cell strong {
  color: var(--text);
}

.simple-list {
  display: grid;
  gap: 0.75rem;
}

.simple-list-item {
  padding: 0.85rem 1rem;
  border-radius: 16px;
  border: 1px solid var(--border-strong);
  background: rgba(255,255,255,0.92);
}

.empty-state {
  color: var(--text-soft);
  padding: 0.5rem 0;
}

.auth-shell {
  width: 100%;
  min-height: calc(100vh - 180px);
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 2rem 0;
}

.auth-card {
  width: min(100%, 460px);
  padding: 2rem;
  border-radius: 28px;
  box-shadow: var(--shadow);
}

.auth-header {
  margin-bottom: 1.5rem;
}

.auth-header h2 {
  font-size: clamp(1.8rem, 4vw, 2.4rem);
  letter-spacing: -0.045em;
  margin-bottom: 0.4rem;
}

.auth-header p {
  color: var(--text-soft);
}

.auth-form {
  display: grid;
  gap: 1rem;
}

.auth-submit {
  width: 100%;
  margin-top: 0.5rem;
}

.auth-visitor-section {
  margin-top: 1.25rem;
  padding-top: 1.1rem;
  border-top: 1px solid rgba(71, 101, 138, 0.14);
}

.auth-visitor-section p {
  color: var(--text-soft);
  margin-bottom: 0.35rem;
}

.auth-disclaimer {
  margin-top: 1.25rem;
  padding: 0.95rem 1rem;
  border-radius: 16px;
  border: 1px solid rgba(71, 101, 138, 0.12);
  background: rgba(244, 248, 255, 0.86);
}

.auth-disclaimer p {
  color: var(--text-soft);
  font-size: 0.92rem;
  line-height: 1.65;
}

.form-errors {
  margin-bottom: 1rem;
  padding: 0.9rem 1rem;
  border-radius: var(--ds-radius-md);
  border: 1px solid var(--ds-danger-border);
  background: var(--ds-danger-soft);
  color: var(--ds-danger);
}

.form-errors p + p {
  margin-top: 0.35rem;
}

.inline-feedback {
  min-height: 1.25rem;
  margin-bottom: 0.75rem;
  color: var(--accent-2);
  font-size: 0.92rem;
}

.inline-feedback-inline {
  min-height: 0;
  margin-bottom: 0;
}

.item-feedback-success {
  border-color: rgba(144, 211, 164, 0.28);
  background: rgba(144, 211, 164, 0.10);
}

.preview-warning {
  color: #ffd9a1;
}

.is-loading {
  opacity: 0.7;
  pointer-events: none;
}

.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;
}

.adjustment-badges {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.items-compact-table td strong {
  color: var(--text);
}

.item-row-detail td {
  padding: 0;
  background: rgba(243, 248, 255, 0.96);
}

.item-row-inline-edit td {
  padding: 0;
  background: rgba(243, 248, 255, 0.96);
}

.item-row-detail.is-hidden {
  display: none;
}

.item-row-card {
  padding: 1rem;
}

.item-modal[hidden] {
  display: none;
}

.item-modal {
  position: fixed;
  inset: 0;
  z-index: 80;
}

.item-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(23, 48, 74, 0.42);
  backdrop-filter: blur(8px);
}

.item-modal-dialog {
  position: relative;
  z-index: 1;
  width: min(920px, calc(100vw - 2rem));
  max-height: calc(100vh - 3rem);
  margin: 1.5rem auto;
  overflow: auto;
}

.item-modal-content .item-entry-panel {
  border-radius: 24px;
  border: 1px solid rgba(71, 101, 138, 0.18);
  background: linear-gradient(180deg, #ffffff, #f7faff);
  box-shadow: 0 24px 48px rgba(23, 48, 74, 0.18);
}

.item-modal-content .item-builder {
  background: transparent;
  border: 0;
  box-shadow: none;
}

.modal-open {
  overflow: hidden;
}

.item-row-card-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}

.item-row-card-grid p + p {
  margin-top: 0.35rem;
}

.report-status-card {
  margin-bottom: 1rem;
  padding: 1rem 1.1rem;
  border-radius: 18px;
  border: 1px solid var(--border-strong);
  background: rgba(255,255,255,0.9);
}

.report-status-card strong {
  display: block;
  margin-bottom: 0.35rem;
}

.report-status-success {
  border-color: rgba(79, 165, 106, 0.18);
  background: rgba(79, 165, 106, 0.08);
}

.report-status-info {
  border-color: rgba(47, 120, 219, 0.18);
  background: rgba(47, 120, 219, 0.08);
}

.report-status-warning {
  border-color: rgba(182, 120, 28, 0.18);
  background: rgba(182, 120, 28, 0.08);
}

.report-status-danger {
  border-color: rgba(209, 69, 69, 0.18);
  background: rgba(209, 69, 69, 0.08);
}

.report-summary-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
}

.report-meta-card {
  margin-top: 1rem;
  padding: 1rem 1.1rem;
  border-radius: 18px;
  border: 1px solid var(--border-strong);
  background: rgba(255,255,255,0.9);
}

.report-logo-card {
  margin-bottom: 1rem;
  padding: 1rem;
  border-radius: 18px;
  border: 1px solid var(--border-strong);
  background: rgba(255,255,255,0.9);
  display: flex;
  justify-content: center;
  align-items: center;
}

.report-logo {
  max-width: 220px;
  max-height: 96px;
  object-fit: contain;
}

.report-export-list {
  display: grid;
  gap: 0.65rem;
}

.report-export-list-compact {
  justify-items: center;
}

.report-export-list-compact .btn {
  min-width: 140px;
}

.pagination {
  margin-top: 1rem;
  display: flex;
  gap: 0.75rem;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
}

.pagination-summary {
  color: var(--text-soft);
}

#totais-card-region {
  margin-bottom: 0.5rem;
}

.section-heading-compact {
  margin-bottom: 1rem;
  align-items: center;
}

.section-heading-title-row {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-wrap: wrap;
}

.item-modal-heading {
  margin-bottom: 0;
}

.item-modal-title-row {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-wrap: wrap;
}

.table-section {
  display: grid;
  gap: 1rem;
}

#item-feedback-region {
  margin-top: 0.25rem;
}

.editor-shell > .inline-actions > .btn {
  width: 100%;
  justify-content: center;
}

.totals-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
}

.totals-category-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  margin-bottom: 1rem;
}

.totals-strip-general {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.totals-card {
  padding: 1rem 1.1rem;
  border-radius: 20px;
  border: 1px solid var(--border-strong);
  background: linear-gradient(180deg, #ffffff, #f7faff);
  box-shadow: var(--shadow);
}

.totals-card strong {
  display: block;
  margin-top: 0.25rem;
  font-size: 1.35rem;
  letter-spacing: -0.04em;
}

.totals-card small {
  display: block;
  margin-top: 0.2rem;
  color: var(--text-soft);
}

.totals-card-emphasis {
  background: linear-gradient(180deg, #eef5ff, #deebff);
}

.actions-cluster {
  display: grid;
  gap: 0.65rem;
}

.actions-stack-status {
  padding-top: 0.65rem;
  border-top: 1px solid rgba(71, 101, 138, 0.12);
}

.auth-error-text {
  margin-bottom: 1rem;
  color: #c43d3d;
  font-size: 0.95rem;
  font-weight: 600;
}

.dashboard-welcome {
  display: flex;
  gap: 0.5rem;
  align-items: baseline;
  margin-bottom: 1rem;
  color: var(--text-soft);
}

.dashboard-welcome strong {
  color: var(--text);
}

.manual-grid {
  margin-bottom: 1rem;
}

.manual-grid p,
.manual-role-card p {
  margin-top: 0.45rem;
  color: var(--text-soft);
}

.manual-list {
  padding-left: 1.15rem;
}

.manual-list li {
  padding-left: 0.15rem;
}

.manual-icon-label {
  display: inline-block;
}

.manual-icon-label .action-icon {
  width: 18px;
  height: 18px;
  margin-right: 0.55rem;
  vertical-align: text-bottom;
}

.report-options-group + .report-options-group {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.report-options-divider {
  height: 1px;
  margin: 1.1rem 0;
  background: var(--border);
}

.report-options-group h4 {
  margin-bottom: 0.25rem;
  color: var(--text);
  letter-spacing: -0.02em;
}

.report-options-helper {
  margin-bottom: 0.6rem;
  color: var(--text-soft);
  font-size: 0.92rem;
  line-height: 1.55;
}

.manual-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1rem;
}

.manual-roles {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}

.inline-actions-end {
  justify-content: flex-end;
}

.manual-status-flow {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 1rem;
}

.manual-status-flow p {
  margin-top: 0.35rem;
}

.manual-panel-gap {
  margin-top: 1.35rem;
}

.manual-role-card {
  padding: 1rem 1.1rem;
  border-radius: 18px;
  border: 1px solid var(--border-strong);
  background: rgba(255, 255, 255, 0.88);
}

.list-footer-toggle {
  display: flex;
  justify-content: flex-end;
  margin-top: 0.75rem;
}

.list-footer-toggle a {
  color: var(--accent);
  font-size: 0.95rem;
}

@media (max-width: 1024px) {
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }

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

  .item-builder-intro {
    grid-template-columns: 1fr;
  }

  .item-row-card-grid {
    grid-template-columns: 1fr;
  }

  .report-summary-grid {
    grid-template-columns: 1fr;
  }

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

@media (max-width: 900px) {
  .nav {
    flex-wrap: wrap;
    gap: 0;
    min-height: 48px;
    padding: 0;
  }

  .nav-top {
    flex: 1;
    justify-content: space-between;
    margin-right: 0;
    min-height: 48px;
  }

  .brand { font-size: 1rem; }

  .nav-toggle { display: inline-flex; }

  .header-user-meta,
  .nav-bottom {
    display: none;
    width: 100%;
  }

  .nav.nav-open .nav-bottom {
    display: flex;
    justify-content: flex-start;
    flex-wrap: wrap;
    padding: 0.5rem 0;
    border-top: 1px solid rgba(71, 101, 138, 0.1);
  }

  .nav.nav-open .nav-links { gap: 0.25rem; flex-wrap: wrap; }

  .nav.nav-open .header-user-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.45rem 0 0.7rem;
    border-top: 1px solid rgba(71, 101, 138, 0.08);
    margin-left: 0;
  }

  .header-separator,
  .header-logout {
    display: none;
  }

  .header-user-meta .header-company-select {
    max-width: min(84vw, 320px);
  }
}

@media (max-width: 760px) {
  .table-wrap > table:not(.items-compact-table) {
    border: 0;
    background: transparent;
  }

  .table-wrap > table:not(.items-compact-table) thead {
    display: none;
  }

  .table-wrap > table:not(.items-compact-table) tbody,
  .table-wrap > table:not(.items-compact-table) tr,
  .table-wrap > table:not(.items-compact-table) td {
    display: block;
    width: 100%;
  }

  .table-wrap > table:not(.items-compact-table) tr {
    margin-bottom: 0.8rem;
    border: 1px solid var(--border-strong);
    border-radius: 14px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.96);
  }

  .table-wrap > table:not(.items-compact-table) tr:hover td {
    background: transparent;
  }

  .table-wrap > table:not(.items-compact-table) td {
    margin: 0;
    padding: 0.6rem 0.75rem;
    border-bottom: 1px solid rgba(71, 101, 138, 0.1);
    text-align: left;
  }

  .table-wrap > table:not(.items-compact-table) td:last-child {
    border-bottom: 0;
  }

  .table-wrap > table:not(.items-compact-table) td::before {
    content: attr(data-label);
    display: block;
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 0.2rem;
    letter-spacing: 0.01em;
  }

  .table-wrap > table:not(.items-compact-table) td[data-label=""]::before {
    display: none;
  }

  .table-wrap > table.items-compact-table {
    border: 0;
    background: transparent;
  }

  .table-wrap > table.items-compact-table thead {
    display: none;
  }

  .table-wrap > table.items-compact-table tbody,
  .table-wrap > table.items-compact-table tr,
  .table-wrap > table.items-compact-table td {
    display: block;
    width: 100%;
  }

  .table-wrap > table.items-compact-table tr {
    margin-bottom: 0.8rem;
    border: 1px solid var(--border-strong);
    border-radius: 14px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.96);
  }

  .table-wrap > table.items-compact-table tr:hover td {
    background: transparent;
  }

  .table-wrap > table.items-compact-table td {
    margin: 0;
    padding: 0.6rem 0.75rem;
    border-bottom: 1px solid rgba(71, 101, 138, 0.1);
    text-align: left;
  }

  .table-wrap > table.items-compact-table td:last-child {
    border-bottom: 0;
  }

  .table-wrap > table.items-compact-table td::before {
    content: attr(data-label);
    display: block;
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 0.2rem;
    letter-spacing: 0.01em;
  }

  .table-wrap > table.items-compact-table td[data-label=""]::before {
    display: none;
  }

  .actions-col,
  .status-col {
    min-width: 0;
    text-align: left;
  }

  .status-cell {
    justify-items: start;
  }

  .actions-stack {
    justify-content: flex-start;
  }
}

@media (max-width: 700px) {
  .container {
    width: min(calc(100% - 1.25rem), var(--max-width));
  }

  main {
    padding-top: 1.45rem;
    padding-bottom: 2rem;
  }

  .panel,
  .form-panel,
  .item-entry-panel {
    padding: 1rem;
    border-radius: 18px;
  }

  .nav-top {
    flex: 1;
    width: 100%;
  }

  .brand {
    max-width: calc(100% - 50px);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .header-separator {
    display: none;
  }

  .header-user-meta .header-company-select,
  .header-company-select {
    width: auto !important;
    max-width: 92vw;
    min-height: 30px !important;
    line-height: 1.35 !important;
  }

  .user-role,
  .header-logout {
    width: auto;
  }

  .nav-links {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    justify-content: stretch;
    gap: 0.45rem;
    flex-wrap: wrap;
    width: 100%;
    padding: 0 0.1rem 0.18rem;
  }

  .nav-links li {
    min-width: 0;
  }

  .nav-links a {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 40px;
    line-height: 1.25;
    text-align: center;
    white-space: normal;
  }

  .section-heading h2 {
    font-size: clamp(1.45rem, 6vw, 1.75rem);
  }

  .stats-grid,
  .form-grid,
  .totals-strip {
    grid-template-columns: 1fr;
  }

  .filters-form {
    display: grid;
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .filters-form input,
  .filters-form select,
  .filters-form button {
    width: 100%;
    min-width: 0;
    flex: initial;
  }

  .filters-form .btn-icon-action {
    min-width: 44px;
    justify-content: center;
  }

  .manual-layout,
  .manual-roles,
  .manual-status-flow {
    grid-template-columns: 1fr;
  }

  .section-heading {
    flex-direction: column;
    align-items: start;
  }

  .inline-actions {
    width: 100%;
    align-items: stretch;
  }

  .inline-actions .btn,
  .inline-actions form {
    width: 100%;
  }

  .inline-actions form .btn {
    width: 100%;
  }

  .catalog-search-row {
    grid-template-columns: 1fr 44px;
    width: 100%;
  }

  .catalog-search-row .btn {
    width: 44px;
    min-width: 44px;
  }

  .actions-stack .btn,
  .actions-stack form .btn {
    min-width: 44px;
  }

  .actions-col {
    min-width: 130px;
  }

  .status-col {
    min-width: 160px;
  }

  .pagination {
    justify-content: center;
  }

  .auth-shell {
    min-height: auto;
    padding-top: 1rem;
    padding-bottom: 1rem;
  }

  .auth-card {
    padding: 1.3rem;
    border-radius: 20px;
  }

  .auth-header {
    margin-bottom: 1.1rem;
  }

  .auth-header h2 {
    font-size: clamp(1.45rem, 7vw, 1.9rem);
    margin-bottom: 0.2rem;
  }

  .auth-header p {
    font-size: 0.92rem;
    line-height: 1.45;
  }

  .auth-form {
    gap: 0.8rem;
  }

  .auth-visitor-section {
    margin-top: 0.95rem;
    padding-top: 0.9rem;
  }

  .auth-disclaimer {
    margin-top: 0.95rem;
    padding: 0.8rem 0.85rem;
  }

  .auth-disclaimer p {
    font-size: 0.86rem;
    line-height: 1.52;
  }
}

@media (max-width: 420px) {
  .auth-shell {
    padding-top: 0.55rem;
    padding-bottom: 0.8rem;
  }

  .auth-card {
    padding: 1rem;
    border-radius: 16px;
  }

  .auth-submit.btn {
    min-height: 42px;
  }
}

@media (max-width: 420px) {
  .nav-links {
    grid-template-columns: 1fr;
  }
}

/* Header company switch: keep this override at the end to beat generic form controls */
.header-user-meta .header-company-switch {
  display: inline-flex;
  align-items: center;
  margin: 0;
}

.header-user-meta .header-company-select {
  width: auto !important;
  min-height: 34px !important;
  min-width: 10ch !important;
  padding: 0.24rem 0.72rem !important;
  border-radius: 999px !important;
  border: 1px solid rgba(71, 101, 138, 0.2) !important;
  border-bottom: 1px solid rgba(71, 101, 138, 0.2) !important;
  background: rgba(255, 255, 255, 0.88) !important;
  color: var(--text-soft) !important;
  font-size: 0.92em !important;
  font-weight: 500 !important;
  line-height: inherit !important;
  letter-spacing: 0.01em !important;
  box-shadow: none !important;
  appearance: auto !important;
  -webkit-appearance: menulist !important;
  background-image: none !important;
  background-position: initial !important;
  background-size: initial !important;
  background-repeat: no-repeat !important;
  flex: 0 0 auto !important;
  transition: border-color var(--transition), color var(--transition), box-shadow var(--transition);
  text-align: left !important;
  text-align-last: left !important;
}

.header-user-meta .header-company-select option {
  text-align: left;
}

.header-user-meta .header-company-select:hover {
  border-color: rgba(71, 101, 138, 0.34) !important;
  color: var(--text) !important;
}

.header-user-meta .header-company-select:focus,
.header-user-meta .header-company-select:focus-visible {
  border-color: rgba(47, 120, 219, 0.55) !important;
  box-shadow: 0 0 0 3px rgba(47, 120, 219, 0.12) !important;
  background: rgba(255, 255, 255, 0.94) !important;
}

@media (max-width: 700px) {
  .header-user-meta .header-company-switch {
    width: auto;
    justify-content: center;
  }

  .header-user-meta .header-company-select {
    width: auto !important;
    max-width: 92vw !important;
  }
}

/* =================================================================
   CAMADA DE TEMA STÖLBEN
   Re-skin sobre os tokens --ds-* sem alterar a estrutura/JS.
   Mantém os nomes de classe existentes; apenas reestiliza.
   ================================================================= */

/* ---- Tipografia de display (Manrope) ---- */
h1, h2, h3,
.brand,
.section-heading h2,
.section-heading-compact h3,
.stat-card .value,
.totals-card strong,
.item-builder-preview strong,
.auth-header h2 {
  font-family: var(--font-display);
  letter-spacing: -0.03em;
}

/* ---- Shell: header full-bleed fora do shell; mantém sticky ---- */
.ds-shell { overflow: visible; }

/* ---- NAVBAR: clara e translúcida (combina com o shell claro do DS) ---- */
.site-header {
  background: rgba(247, 248, 250, 0.82);
  -webkit-backdrop-filter: var(--ds-blur);
  backdrop-filter: var(--ds-blur);
  border-bottom: 1px solid var(--ds-line);
  box-shadow: 0 10px 30px rgba(15, 17, 21, 0.05);
}

.brand { color: var(--ds-text-900); font-weight: 600; }
.brand span { color: var(--ds-blue); }

.nav-links { color: var(--ds-text-500); }
.nav-links a {
  color: var(--ds-text-500);
  font-weight: 500;
}
.nav-links a:hover {
  color: var(--ds-text-900);
  background: rgba(15, 17, 21, 0.04);
}
.nav-links a.active {
  color: var(--ds-blue-dark);
  background: var(--ds-blue-50);
}

.header-user-greeting { color: var(--ds-text-500); }
.user-role { color: var(--ds-blue); font-weight: 600; }

.nav-toggle {
  border-color: var(--ds-line);
  background: #fff;
}
.nav-toggle-bar { background: var(--ds-text-700); }

.nav-logout {
  border-color: var(--ds-line);
  background: #fff;
  color: var(--ds-text-700);
}
.nav-logout:hover {
  border-color: var(--ds-blue-100);
  background: var(--ds-blue-50);
  color: var(--ds-blue-dark);
}

/* ---- BOTÕES ---- */
/* Primário sólido com elevação sutil; ganha leve realce no hover
   (antes usava o glow forte fixo, que competia com o conteúdo). */
.btn-primary {
  background: var(--ds-blue);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 6px 16px rgba(37, 99, 235, 0.22);
}
.btn-primary:hover {
  background: var(--ds-blue-dark);
  box-shadow: 0 10px 22px rgba(37, 99, 235, 0.30);
}

.btn-primary-lite,
.btn-soft {
  background: var(--ds-blue-50);
  color: var(--ds-blue-dark);
  border-color: var(--ds-blue-100);
}
.btn-primary-lite:hover,
.btn-soft:hover {
  background: var(--ds-blue-100);
}

.btn-secondary {
  background: #fff;
  color: var(--text);
  border-color: var(--ds-line);
}
.btn-secondary:hover {
  background: var(--ds-blue-50);
  border-color: var(--ds-blue-100);
}

/* ---- SUPERFÍCIES: achatar gradientes antigos -> visual DS limpo ---- */
.panel,
.form-panel,
.modal-panel,
.stat-card,
.totals-card,
.item-entry-panel,
.report-meta-card,
.report-logo-card,
.manual-role-card,
.item-builder-preview,
.catalog-summary,
.simple-list-item {
  background: var(--ds-surface);
  border: 1px solid var(--ds-line);
  border-radius: var(--ds-radius-lg);
  box-shadow: var(--ds-shadow-soft);
}

/* Superfícies secundárias: só borda, sem sombra (hierarquia mais leve) */
.stat-card,
.report-meta-card,
.report-logo-card,
.manual-role-card,
.item-builder-preview,
.catalog-summary,
.simple-list-item {
  box-shadow: none;
}

.stat-card { transition: border-color var(--transition), transform var(--transition); }
.stat-card:hover { border-color: var(--ds-blue-100); transform: translateY(-2px); }
.stat-card .label {
  color: var(--ds-text-500);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 0.74rem;
}
.stat-card .value { color: var(--ds-text-900); }

.totals-card-emphasis { background: var(--ds-blue-50); border-color: var(--ds-blue-100); }

.form-submenu {
  background: var(--ds-surface);
  border-color: var(--ds-line);
  border-radius: var(--ds-radius-md);
}

/* ---- TABELAS / LISTAS: cabeçalho discreto, linhas arejadas ---- */
.table-wrap {
  border: 1px solid var(--ds-line);
  border-radius: var(--ds-radius-lg);
  background: var(--ds-surface);
  box-shadow: var(--ds-shadow-soft);
}
table { border: 0; border-radius: 0; background: transparent; }
thead th {
  background: var(--ds-panel);
  color: var(--ds-text-500);
  border-bottom: 1px solid var(--ds-line);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-size: 0.72rem;
  font-weight: 600;
}
td { color: var(--ds-text-700); border-bottom: 1px solid var(--ds-line); }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: var(--ds-blue-50); }
td strong,
.budget-main-cell strong,
.items-compact-table td strong { color: var(--ds-text-900); }

/* ---- FORMULÁRIOS ---- */
input, select, textarea { border-radius: var(--ds-radius-md); border-color: var(--ds-line); }
input:focus,
select:focus,
textarea:focus {
  border-color: var(--ds-blue-light);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.14);
}
label { color: var(--ds-text-900); font-weight: 600; }
.form-note { border-radius: var(--ds-radius-md); }

/* ---- BADGES de status: pílulas semânticas ---- */
.badge {
  gap: 0.4rem;
  padding: 0.3rem 0.7rem;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.01em;
}
.badge.status-rascunho,
.badge.status-cancelado {
  background: #eef1f5; border-color: #e1e6ee; color: #51617a;
}
.badge.status-em_elaboracao {
  background: var(--ds-warn-soft); border-color: rgba(251, 191, 36, 0.32); color: #8a5a0b;
}
.badge.status-enviado {
  background: var(--ds-blue-50); border-color: var(--ds-blue-100); color: var(--ds-blue-dark);
}
.badge.status-aprovado {
  background: rgba(79, 165, 106, 0.12); border-color: rgba(79, 165, 106, 0.3); color: #2f7d49;
}
.badge.status-rejeitado {
  background: rgba(209, 69, 69, 0.1); border-color: rgba(209, 69, 69, 0.28); color: #b03636;
}

/* ---- LISTAS / VAZIO ---- */
.simple-list-item { padding: 0.95rem 1.1rem; }
.empty-state {
  border: 1px dashed var(--ds-line-dash);
  border-radius: var(--ds-radius-lg);
  background: var(--ds-surface);
  padding: 2rem;
  text-align: center;
  color: var(--ds-text-500);
}

/* No modo card mobile o wrapper já vira "moldura"; remove dupla borda. */
@media (max-width: 760px) {
  .table-wrap { border: 0; border-radius: 0; background: transparent; box-shadow: none; }
}

/* ---- HERO (telas-vitrine: dashboard e login) ---- */
.page-hero {
  position: relative;
  padding: clamp(1.75rem, 4vw, 2.75rem);
  margin-bottom: 1.25rem;
}
.page-hero-inner {
  position: relative;
  z-index: 2;
  display: grid;
  gap: 0.5rem;
}
.page-hero .ds-h1 {
  font-size: clamp(1.9rem, 4vw, 2.8rem);
  color: #fff;
}
.page-hero p {
  color: var(--ds-on-dark-soft);
  max-width: 60ch;
}
.page-hero .ds-kicker { color: var(--ds-on-dark-soft); }
.page-hero .ds-glow { width: 24rem; height: 24rem; }

/* Login: empilha hero + cartão centralizados */
.auth-stack {
  display: grid;
  gap: 1.25rem;
  width: min(100%, 460px);
}
.auth-stack .auth-card { width: 100%; }
.auth-hero { margin-bottom: 0; }

/* =================================================================
   POLIMENTO UI/UX (passe 2026-06) — refinamentos sobre o passe "ds1".
   Mantém o tema; melhora legibilidade, hierarquia, estados e foco.
   ================================================================= */

/* ---- TABELAS: valores monetários alinhados à direita (leitura de números)
   No card mobile (<=760px) a regra de maior especificidade mantém à esquerda. */
td.money { text-align: right; }
th.money { text-align: right; }

/* ---- EMPTY STATE: um pouco mais convidativo e consistente ---- */
.empty-state {
  font-size: 0.95rem;
  line-height: 1.6;
}
/* Quando houver ícone (svg) no estado vazio, padroniza o tamanho/cor. */
.empty-state svg {
  width: 1.75rem;
  height: 1.75rem;
  display: block;
  margin: 0 auto 0.6rem;
  color: var(--ds-text-400);
  stroke: currentColor;
  fill: none;
  stroke-width: 1.6;
}

/* ---- DECORAÇÃO: telas de trabalho ficam limpas; grade/linhas tracejadas
   ficam reservadas às telas-vitrine (.is-vitrine = dashboard e login). ---- */
.ds-root:not(.is-vitrine) .ds-lines { display: none; }
.ds-root:not(.is-vitrine) .ds-shell {
  border-left: 0;
  border-right: 0;
  background: var(--ds-bg);
}

/* ---- ESTADO DE CARREGAMENTO: além do esmaecer, cursor de progresso e
   spinner em botões para feedback claro de ação em andamento. ---- */
.is-loading {
  opacity: 0.7;
  pointer-events: none;
  cursor: progress;
}
.btn.is-loading {
  position: relative;
  color: transparent !important;
}
.btn.is-loading::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 1.05rem;
  height: 1.05rem;
  margin: -0.525rem 0 0 -0.525rem;
  border-radius: 50%;
  border: 2px solid var(--ds-blue);
  border-top-color: transparent;
  opacity: 0.85;
  animation: ds-spin 0.6s linear infinite;
}
.btn-primary.is-loading::after { border-color: #fff; border-top-color: transparent; }
@keyframes ds-spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
  .btn.is-loading::after { animation: none; }
}

/* =================================================================
   POLIMENTO UI/UX — passe 3 (achados da auditoria com walkthrough real)
   ================================================================= */

/* #4 Inputs de arquivo com aparência do DS (antes nativo "Choose File") */
input[type="file"] {
  padding: 0.5rem 0.6rem;
  cursor: pointer;
  color: var(--ds-text-500);
}
input[type="file"]::file-selector-button {
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  margin-right: 0.85rem;
  padding: 0.5rem 1rem;
  border-radius: var(--ds-radius-pill);
  border: 1px solid var(--ds-blue-100);
  background: var(--ds-blue-50);
  color: var(--ds-blue-dark);
  transition: background 160ms ease, border-color 160ms ease;
}
input[type="file"]::file-selector-button:hover {
  background: var(--ds-blue-100);
  border-color: var(--ds-blue-light);
}

/* #6 Exportar (relatório central): botões em linha, não empilhados/centralizados */
.report-export-list { display: flex; flex-wrap: wrap; gap: 0.6rem; }
.report-export-list .btn { min-width: 0; }

/* #8 Campos curtos não ocupam a largura toda (afordância de tamanho) */
#id_estado, #id_uf { max-width: 8rem; }
#id_numero, #id_cep { max-width: 13rem; }

/* #8 Subcabeçalhos de seção dentro de um .form-grid (agrupa campos) */
.form-subhead {
  grid-column: 1 / -1;
  font-family: var(--ds-font-display);
  font-weight: 600;
  color: var(--ds-text-900);
  margin-top: 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--ds-line);
}
.form-subhead:first-child { margin-top: 0; }

/* #12 Não quebrar documento/telefone/valores em colunas estreitas */
.nowrap { white-space: nowrap; }
th.money { white-space: nowrap; }

/* #9 Separador sutil entre saudação, empresa e perfil no cabeçalho */
.header-sep { color: var(--ds-text-400); margin: 0 0.15rem; }

/* #3 Divisor entre o grupo de ações de status e as ações de CRUD na linha */
.actions-divider { width: 1px; align-self: stretch; min-height: 1.4rem; background: var(--ds-line); margin: 0 0.1rem; }

/* #7 Cabeçalho em grid-areas: no mobile o bloco do usuário (com "Sair")
   vai para o fim, depois dos links de navegação. */
.nav {
  display: grid;
  grid-template-columns: auto 1fr auto;
  grid-template-areas: "brand links user";
  align-items: center;
  column-gap: 1rem;
}
.nav .nav-top { grid-area: brand; }
.nav .header-user-meta { grid-area: user; }
.nav .nav-bottom { grid-area: links; }
@media (max-width: 1024px) {
  .nav { grid-template-columns: 1fr; grid-template-areas: "brand" "links" "user"; column-gap: 1rem; }
  .header-sep { display: none; }
}

/* #5 Páginas de erro (404/403/500) com a identidade do sistema */
.error-page { display: flex; justify-content: center; align-items: center; min-height: 50vh; padding: 2.5rem 0; }
.error-card { width: min(100%, 520px); text-align: center; display: grid; gap: 0.75rem; justify-items: center; }
.error-card h2 { font-family: var(--ds-font-display); font-size: clamp(1.6rem, 3vw, 2.3rem); letter-spacing: -0.03em; }
.error-card p { color: var(--ds-text-500); max-width: 42ch; }
.error-card .inline-actions { margin-top: 0.5rem; }

/* =================================================================
   POLIMENTO UI/UX — passe 4
   Cabeçalho escuro (barra única), faixa de título por página, blocos
   escuros (total final / cards / seções), back-link e declutter.
   ================================================================= */

/* ---- CABEÇALHO: barra escura única (tema Infra Premium) ---- */
.site-header {
  background: var(--ds-ink);
  border-bottom: 1px solid var(--ds-border-dark);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.28);
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}
.nav { padding: 0.7rem 0; }
.brand { color: #fff; }
.brand span { color: var(--ds-blue-light); }
.nav-bottom { justify-content: center; }
.nav-links { color: var(--ds-on-dark-mute); flex-wrap: nowrap; gap: 0.3rem; font-size: 0.9rem; }
.nav-links a { color: var(--ds-on-dark-mute); padding: 0.4rem 0.65rem; white-space: nowrap; }
.nav-links a:hover { color: #fff; background: rgba(255, 255, 255, 0.08); }
.nav-links a.active { color: #fff; background: rgba(37, 99, 235, 0.35); }
/* saudação fica só no menu mobile; na barra desktop economiza espaço */
.header-user-greeting, .header-sep { color: var(--ds-on-dark-soft); display: none; }
.header-user-company span { color: var(--ds-on-dark-mute); }
.user-role {
  color: #bfdbfe;
  background: rgba(59, 130, 246, 0.16);
  border-color: rgba(59, 130, 246, 0.34);
}
.header-company-select {
  background-color: rgba(255, 255, 255, 0.08);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.2);
  background-image:
    linear-gradient(45deg, transparent 50%, rgba(255, 255, 255, 0.65) 50%),
    linear-gradient(135deg, rgba(255, 255, 255, 0.65) 50%, transparent 50%);
}
.header-company-select:hover { color: #fff; border-color: rgba(255, 255, 255, 0.34); }
.header-company-select option { color: var(--ds-text-900); }
.nav-logout {
  background: rgba(255, 255, 255, 0.06);
  color: var(--ds-on-dark-mute);
  border-color: rgba(255, 255, 255, 0.2);
}
.nav-logout:hover { background: rgba(255, 255, 255, 0.14); color: #fff; border-color: rgba(255, 255, 255, 0.34); }
.nav-toggle { background: rgba(255, 255, 255, 0.08); border-color: rgba(255, 255, 255, 0.2); }
.nav-toggle-bar { background: #fff; }
@media (max-width: 1024px) {
  .nav.nav-open .header-user-info {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.12);
  }
  .nav.nav-open .header-user-greeting { display: inline; }
}

/* ---- FAIXA DE TÍTULO POR PÁGINA (bloco escuro) ---- */
.page-head {
  align-items: center;
  position: relative;
  overflow: hidden;
  background: var(--ds-ink);
  color: var(--ds-on-dark);
  border-radius: var(--ds-radius-lg);
  padding: clamp(1.1rem, 2.6vw, 1.65rem) clamp(1.25rem, 3vw, 2rem);
  margin-bottom: 1.6rem;
}
.page-head::after {
  content: "";
  position: absolute;
  top: -40%;
  right: -10%;
  width: 22rem;
  height: 22rem;
  border-radius: 50%;
  background: rgba(37, 99, 235, 0.22);
  filter: blur(90px);
  pointer-events: none;
}
.page-head > div { position: relative; z-index: 1; }
.page-head h2 { color: #fff; }
.page-head p { color: var(--ds-on-dark-soft); max-width: 70ch; }
.page-head .ds-kicker { color: var(--ds-on-dark-soft); }
.page-back {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--ds-on-dark-mute);
  font-size: 0.85rem;
  font-weight: 500;
  margin-bottom: 0.55rem;
  transition: color 160ms ease;
}
.page-back:hover { color: #fff; }
.page-back svg { width: 1rem; height: 1rem; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
/* botões secundários ficam legíveis sobre o bloco escuro */
.page-head .btn-secondary {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.22);
}
.page-head .btn-secondary:hover { background: rgba(255, 255, 255, 0.18); border-color: rgba(255, 255, 255, 0.34); }

/* ---- TOTAL FINAL em bloco escuro (ponto focal financeiro) ---- */
.totals-card-emphasis {
  background: var(--ds-ink);
  border-color: transparent;
  color: var(--ds-on-dark);
  box-shadow: var(--ds-shadow-soft);
}
.totals-card-emphasis .preview-label { color: var(--ds-on-dark-soft); }
.totals-card-emphasis strong { color: #fff; }

/* ---- TÍTULOS DE SEÇÃO de formulário: barra escura slim com acento azul ---- */
.form-subhead {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-family: var(--ds-font-display);
  font-weight: 600;
  font-size: 0.9rem;
  letter-spacing: 0.01em;
  color: #fff;
  background: var(--ds-ink-soft);
  border: 0;
  border-left: 3px solid var(--ds-blue);
  border-radius: var(--ds-radius-md);
  padding: 0.6rem 0.9rem;
  margin-top: 1.25rem;
}
.form-subhead:first-child { margin-top: 0; }

/* ---- CARDS DE INDICADORES em destaque escuro ---- */
.stat-card--dark { background: var(--ds-ink); border-color: transparent; }
.stat-card--dark:hover { border-color: transparent; transform: translateY(-2px); }
.stat-card--dark .label { color: var(--ds-on-dark-soft); }
.stat-card--dark .value { color: #fff; }

/* =================================================================
   POLIMENTO UI/UX — passe 5
   Darks mais claros/azulados (menos preto puro), cabeçalho "glass" com
   efeito de rolagem (como o site_stolben), imagem na hero da dashboard,
   rodapé (estilo divisor_pdf), nome do usuário no cabeçalho de volta,
   sem barras laterais tracejadas (ds-lines/ds-shell).
   ================================================================= */

:root {
  --app-dark: #1b2236;        /* dark azulado p/ blocos (não preto puro) */
  --app-dark-soft: #252e44;   /* um tom acima p/ subheads/áreas interativas */
}

/* ---- DARKS MAIS CLAROS (substituem o quase-preto --ds-ink) ---- */
.page-head,
.totals-card-emphasis,
.stat-card--dark { background: var(--app-dark); }
.ds-root.is-vitrine .page-hero.ds-panel-dark { background: var(--app-dark); }
.form-subhead { background: var(--app-dark-soft); }
.page-head::after { background: rgba(59, 130, 246, 0.28); }

/* hero da dashboard: gradiente sobre a imagem usa o dark azulado */
.page-hero .ds-media { background: var(--app-dark); }
.page-hero .ds-media img { opacity: 0.42; }
.page-hero .ds-media-grad {
  background: linear-gradient(to top, var(--app-dark) 4%, rgba(27, 34, 54, 0.55) 50%, rgba(27, 34, 54, 0.78));
}

/* ---- CABEÇALHO "GLASS" + EFEITO DE ROLAGEM (estilo site_stolben) ---- */
.site-header {
  background: rgba(27, 34, 54, 0.74);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  backdrop-filter: blur(14px) saturate(140%);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  box-shadow: none;
  transition: background 280ms ease, box-shadow 280ms ease, border-color 280ms ease;
}
.site-header.is-scrolled {
  background: rgba(20, 26, 42, 0.92);
  border-bottom-color: rgba(255, 255, 255, 0.1);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.32);
}

/* ---- NOME DO USUÁRIO de volta na barra (desktop) ---- */
.header-user-greeting { display: inline; color: var(--ds-on-dark-mute); font-weight: 500; }
.header-sep { display: inline; color: var(--ds-on-dark-soft); }

/* ---- SEM BARRAS LATERAIS (tracejado / ds-lines) em todo o app ---- */
.ds-shell {
  border-left: 0;
  border-right: 0;
  background: var(--ds-bg);
  overflow: visible;
}
.ds-lines { display: none; }

/* ---- RODAPÉ (estilo divisor_pdf, adaptado ao tema claro) ---- */
.site-footer {
  margin-top: 3rem;
  padding: 2.25rem 0;
  border-top: 1px solid var(--ds-line);
}
.site-footer-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem;
}
.site-footer-brand {
  font-family: var(--ds-font-display);
  font-weight: 600;
  font-size: 1.1rem;
  color: var(--ds-text-900);
  letter-spacing: -0.02em;
}
.site-footer-copy { color: var(--ds-text-500); font-size: 0.85rem; margin-top: 0.15rem; }
.site-footer-copy a { color: var(--ds-blue-dark); text-decoration: none; }
.site-footer-copy a:hover { text-decoration: underline; }
.site-footer-points { list-style: none; display: flex; flex-wrap: wrap; gap: 1.25rem; padding: 0; margin: 0; }
.site-footer-points li {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--ds-text-500);
  font-size: 0.8rem;
}
.site-footer-dot { width: 0.4rem; height: 0.4rem; border-radius: 50%; background: var(--ds-blue); flex-shrink: 0; }

/* ---- MODAL DE PAINEL (edição de categoria/item em sobreposição) ---- */
.panel-modal[hidden] { display: none; }
.panel-modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  animation: panel-modal-fade 160ms ease;
}
@keyframes panel-modal-fade { from { opacity: 0; } to { opacity: 1; } }
.panel-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(20, 26, 42, 0.5);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}
.panel-modal-dialog {
  position: relative;
  z-index: 1;
  width: min(760px, calc(100vw - 2rem));
  max-height: calc(100vh - 3rem);
  margin: 1.5rem auto;
  overflow: auto;
}
.panel-modal-close {
  position: absolute;
  top: 0.85rem;
  right: 0.85rem;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(20, 26, 42, 0.85);
  color: #fff;
  cursor: pointer;
  z-index: 3;
  transition: background 160ms ease;
}
.panel-modal-close:hover { background: rgba(20, 26, 42, 1); }
.panel-modal-close svg { width: 1.1rem; height: 1.1rem; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; }
/* a faixa de título escura vira o cabeçalho do modal; o "Voltar" é redundante */
.panel-modal .page-back { display: none; }
.panel-modal section { margin: 0; }
.panel-modal .form-panel { box-shadow: 0 24px 48px rgba(20, 26, 42, 0.28); }
.panel-modal-loader {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 220px;
  background: var(--ds-surface);
  border-radius: var(--ds-radius-lg);
}
.panel-modal-loader[hidden] { display: none; }
.panel-modal-spinner {
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  border: 3px solid var(--ds-blue-100);
  border-top-color: var(--ds-blue);
  animation: spin 0.7s linear infinite;
}

/* =================================================================
   POLIMENTO UI/UX — passe 7
   Modais padronizados e centralizados (sombra limpa, X bem formatado),
   cabeçalho flutuante alinhado ao conteúdo, cards da dashboard
   compactos, listas mais densas e menu do usuário no mobile.
   ================================================================= */

/* ---- CABEÇALHO: pílula alinhada ao conteúdo (sem inset lateral extra) ---- */
.site-header { padding: 0.9rem 0 0; }

/* ---- MODAIS: um padrão só — card centralizado, sombra arredondada ---- */
.panel-modal,
.item-modal {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
}
.panel-modal[hidden],
.item-modal[hidden] { display: none; }

.panel-modal-dialog,
.item-modal-dialog {
  width: min(720px, 100%);
  max-height: calc(100vh - 2.5rem);
  margin: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: var(--ds-radius-lg);
  background: var(--ds-surface);
  box-shadow: 0 30px 70px rgba(15, 20, 35, 0.45);
  animation: panel-modal-rise 200ms ease;
}
.item-modal-dialog { width: min(840px, 100%); }
@keyframes panel-modal-rise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }

/* o conteúdo injetado vira o corpo rolável do card */
#panel-modal-content {
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex: 1 1 auto;
  overflow: hidden;
}
.panel-modal section {
  display: flex;
  flex-direction: column;
  min-height: 0;
  margin: 0;
}
.panel-modal .page-head {
  margin: 0;
  border-radius: 0;
  flex: 0 0 auto;
  padding: 1.15rem 3.25rem 1.15rem 1.5rem;
}
.panel-modal .form-panel {
  margin: 0;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  background: transparent;
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
}
.panel-modal-loader { border-radius: 0; min-height: 240px; }

/* item-modal (orçamento) no mesmo padrão de card */
.item-modal-content {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
}
.item-modal-content .item-entry-panel {
  border-radius: 0;
  border: 0;
  box-shadow: none;
  background: transparent;
}

/* X de fechar — círculo translúcido bem formatado sobre a faixa escura */
.panel-modal-close {
  position: absolute;
  top: 0.9rem;
  right: 0.9rem;
  width: 2.1rem;
  height: 2.1rem;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: #fff;
  cursor: pointer;
  z-index: 5;
  transition: background 160ms ease, border-color 160ms ease;
}
.panel-modal-close:hover { background: rgba(255, 255, 255, 0.26); border-color: rgba(255, 255, 255, 0.5); }
.panel-modal-close svg { width: 1rem; height: 1rem; stroke: currentColor; fill: none; stroke-width: 2.2; stroke-linecap: round; }

/* ---- CARDS DA DASHBOARD: menores e melhor distribuídos ---- */
.stat-card { padding: 0.8rem 0.95rem; border-radius: var(--ds-radius-md); }
.stat-card .label { font-size: 0.74rem; letter-spacing: 0.04em; }
.stat-card .value { font-size: 1.3rem; margin-top: 0.15rem; }

/* ---- LISTAS: mais densas (menos espaçamento) ---- */
.table-wrap th,
.table-wrap td { padding: 0.55rem 0.8rem; }
.table-subline { margin-top: 0.05rem; font-size: 0.8rem; line-height: 1.3; }
.page-head { margin-bottom: 1.15rem; }

@media (max-width: 1024px) {
  .site-header { padding: 0.7rem 0 0; }

  /* menu colapsável: informações do usuário organizadas e sem o "·" solto */
  .nav.nav-open .header-sep { display: none; }
  .nav.nav-open .header-user-info {
    gap: 0.5rem;
    padding: 0.85rem 0.9rem;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.06);
  }
  .nav.nav-open .header-user-greeting { color: #fff; font-weight: 600; font-size: 0.98rem; }
  .nav.nav-open .header-user-company span { color: var(--ds-on-dark-mute); font-size: 0.88rem; }
  .nav.nav-open .user-role { margin-top: 0.1rem; }
}

@media (max-width: 700px) {
  /* dois cards lado a lado no mobile (em vez de empilhados e enormes) */
  .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 0.6rem; }
  .stat-card { padding: 0.7rem 0.8rem; }
  .stat-card .value { font-size: 1.2rem; }
}

/* =================================================================
   POLIMENTO UI/UX — passe 6
   Cabeçalho FLUTUANTE (pílula escura) — legível sobre o fundo claro,
   no mesmo espírito do site_stolben/divisor_pdf, porém adaptado a um
   app de fundo claro (a pílula é escura para garantir contraste).
   ================================================================= */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 60;
  padding: 0.9rem 0 0;
  background: transparent;
  border: 0;
  box-shadow: none;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
  pointer-events: none;
}
.site-header.is-scrolled { background: transparent; box-shadow: none; }
.site-header > .container { pointer-events: none; }
.nav {
  pointer-events: auto;
  background: rgba(24, 31, 50, 0.86);
  -webkit-backdrop-filter: blur(16px) saturate(140%);
  backdrop-filter: blur(16px) saturate(140%);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 1.4rem;
  box-shadow: 0 16px 40px rgba(20, 26, 42, 0.22);
  padding: 0.5rem 1.1rem;
  transition: background 280ms ease, box-shadow 280ms ease, border-color 280ms ease;
}
.site-header.is-scrolled .nav {
  background: rgba(16, 21, 35, 0.94);
  border-color: rgba(255, 255, 255, 0.13);
  box-shadow: 0 20px 46px rgba(0, 0, 0, 0.32);
}
/* espaço para o conteúdo não ficar sob a pílula fixa */
.ds-shell { padding-top: 5.5rem; }

@media (max-width: 1024px) {
  .site-header { padding: 0.7rem 0 0; }
  .nav { border-radius: 1.2rem; padding: 0.55rem 0.9rem; }
  .ds-shell { padding-top: 4.75rem; }
}

/* =================================================================
   POLIMENTO UI/UX — passe 8
   Unifica o modal de item do orçamento com os demais (faixa escura +
   X), remove a linha branca acima da faixa do título e refaz a
   experiência mobile (modais em tela cheia, faixas/listas enxutas,
   alvos de toque maiores).
   ================================================================= */

/* ---- LINHA BRANCA acima da faixa escura: a <section> injetada tinha
   padding-top herdado; zera dentro do modal. ---- */
.panel-modal section { padding: 0; margin: 0; }

/* ---- MODAL DE ITEM DO ORÇAMENTO: mesmo padrão (faixa escura + X) ---- */
.item-modal-content { overflow: hidden; display: flex; flex-direction: column; min-height: 0; flex: 1 1 auto; }
.item-modal-content .item-entry-panel,
.item-modal .item-entry-panel-compact {
  width: 100%;
  padding: 0;
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex: 1 1 auto;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  background: transparent;
}
.item-modal .item-builder { display: flex; flex-direction: column; min-height: 0; flex: 1 1 auto; gap: 0; padding: 0; }
.item-modal .item-modal-heading {
  margin: 0;
  border: 0;
  border-radius: 0;
  background: var(--app-dark);
  color: #fff;
  padding: 1.15rem 3.25rem 1.15rem 1.5rem;
  flex: 0 0 auto;
  align-items: center;
}
.item-modal .item-modal-heading h3 { color: #fff; margin: 0; }
.item-modal .item-modal-title-row { align-items: center; }
.item-modal .item-builder-form {
  background: var(--ds-surface);
  padding: 1.35rem 1.5rem 1.6rem;
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
}

/* ---- MOBILE: experiência totalmente revista ---- */
@media (max-width: 700px) {
  /* MODAIS em tela cheia: muito mais fáceis de usar */
  .panel-modal,
  .item-modal { padding: 0; align-items: stretch; justify-content: stretch; }
  .panel-modal-dialog,
  .item-modal-dialog {
    width: 100%;
    max-width: 100%;
    height: 100%;
    max-height: 100%;
    border-radius: 0;
    box-shadow: none;
  }
  .panel-modal .page-head,
  .item-modal .item-modal-heading { padding: 1rem 3.25rem 1rem 1.1rem; }
  .panel-modal .form-panel,
  .item-modal .item-builder-form { padding: 1.1rem 1.1rem 2.5rem; }
  .panel-modal-close { top: 0.85rem; right: 0.85rem; width: 2.3rem; height: 2.3rem; }

  /* FAIXA DE TÍTULO (page-head) mais enxuta no mobile */
  .page-head { padding: 1rem 1.1rem; margin-bottom: 1rem; border-radius: 16px; }
  .page-head .ds-h1,
  .page-head h2 { font-size: 1.4rem; }
  .page-head p { font-size: 0.86rem; }
  .page-head .inline-actions { width: 100%; }
  .page-head .inline-actions .btn,
  .page-head .inline-actions form,
  .page-head .inline-actions form .btn { width: 100%; justify-content: center; }

  /* HERO da dashboard mais compacto */
  .page-hero { padding: 1.25rem 1.1rem; }
  .page-hero .ds-h1 { font-size: 1.6rem; }

  /* LISTAS em cards: mais enxutas e legíveis */
  .table-wrap > table:not(.items-compact-table) tr {
    border-radius: 14px;
    padding: 0.35rem 0.2rem;
    margin-bottom: 0.7rem;
  }
  .table-wrap > table:not(.items-compact-table) td {
    padding: 0.3rem 0.85rem;
  }
  .table-wrap > table:not(.items-compact-table) td::before {
    font-size: 0.68rem;
    letter-spacing: 0.06em;
    opacity: 0.7;
    margin-bottom: 0.05rem;
  }

  /* INPUTS: 16px evita zoom automático do iOS e melhora leitura/toque */
  input, select, textarea { font-size: 16px; min-height: 44px; }
  textarea { min-height: 88px; }

  /* BOTÕES de ação com alvo de toque confortável */
  .actions-stack .btn,
  .actions-stack form .btn,
  .btn-icon-action { min-width: 44px; min-height: 44px; }

  /* filtros e busca ocupam a largura toda já tratados; remove respiro extra */
  main { padding-bottom: 1.5rem; }
}

/* =================================================================
   POLIMENTO UI/UX — passe 9
   Cards compactos para TODAS as listas no mobile (rótulo à esquerda,
   valor à direita; 1ª célula vira título) e bloco de usuário enxuto
   no menu colapsável.
   ================================================================= */

/* ---- USER INFO no menu mobile: uma linha, sutil, sem moldura, Sair à direita ---- */
@media (max-width: 1024px) {
  .nav.nav-open .header-user-meta {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 0.6rem;
    width: 100%;
    margin-top: 0.35rem;
    padding-top: 0.6rem;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
  }
  .nav.nav-open .header-user-info {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: baseline;
    justify-items: initial;
    text-align: left;
    gap: 0.1rem 0.4rem;
    padding: 0;
    border: 0;
    background: transparent;
    min-width: 0;
    flex: 1 1 auto;
  }
  .nav.nav-open .header-user-greeting { width: auto; font-size: 0.88rem; font-weight: 600; color: #fff; }
  .nav.nav-open .header-sep { display: inline; color: var(--ds-on-dark-soft); }
  .nav.nav-open .header-user-company span { color: var(--ds-on-dark-mute); font-weight: 400; font-size: 0.84rem; }
  .nav.nav-open .user-role { display: none; }
  .nav.nav-open .header-user-actions {
    width: auto;
    flex: 0 0 auto;
    margin: 0;
    justify-content: flex-end;
  }
  .nav.nav-open .header-user-actions form { width: auto; }
  .nav.nav-open .header-user-actions .nav-logout {
    width: auto;
    max-width: none;
    padding: 0.32rem 0.8rem;
    font-size: 0.82rem;
  }
}

/* ---- LISTAS COMO CARDS COMPACTOS (mobile) ---- */
@media (max-width: 760px) {
  .ds-root .table-wrap { overflow: visible; }

  .ds-root .table-wrap > table tr {
    display: block;
    padding: 0.7rem 0.9rem;
    margin-bottom: 0.6rem;
    border: 1px solid var(--border-strong);
    border-radius: 14px;
    background: #fff;
    box-shadow: 0 6px 16px rgba(20, 26, 42, 0.06);
  }

  /* campo padrão: rótulo à esquerda, valor à direita, em uma linha só */
  .ds-root .table-wrap > table td {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 1rem;
    width: 100%;
    padding: 0.22rem 0;
    border: 0;
    text-align: right;
    color: var(--text);
    font-size: 0.9rem;
  }
  .ds-root .table-wrap > table td::before {
    content: attr(data-label);
    display: inline;
    flex: 0 0 auto;
    margin: 0 0.5rem 0 0;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-soft);
    text-align: left;
    letter-spacing: 0;
  }
  .ds-root .table-wrap > table td[data-label=""]::before { display: none; }

  /* 1ª célula = título do card (linha cheia, em destaque) */
  .ds-root .table-wrap > table td:first-child {
    display: block;
    text-align: left;
    font-size: 1rem;
    font-weight: 700;
    color: var(--text);
    padding: 0 0 0.4rem;
    margin-bottom: 0.35rem;
    border-bottom: 1px solid var(--ds-line);
  }
  .ds-root .table-wrap > table td:first-child::before { display: none; }
  .ds-root .table-wrap > table td:first-child .table-subline {
    font-size: 0.8rem;
    font-weight: 400;
    margin-top: 0.1rem;
  }

  /* status e ações: blocos no rodapé do card */
  .ds-root .table-wrap > table td.status-col,
  .ds-root .table-wrap > table td.actions-col {
    display: block;
    text-align: left;
    padding: 0.55rem 0 0;
    margin-top: 0.45rem;
    border-top: 1px solid var(--ds-line);
  }
  .ds-root .table-wrap > table td.actions-col::before { display: none; }
  .ds-root .table-wrap > table td.status-col::before { display: block; margin: 0 0 0.4rem; }
  .ds-root .table-wrap > table td .actions-stack,
  .ds-root .table-wrap > table td .status-cell {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    justify-content: flex-start;
    align-items: center;
  }

  /* tabela de ITENS DO ORÇAMENTO: "Ordem" é número -> some no card;
     o título passa a ser a 2ª coluna ("Item"). */
  .ds-root .table-wrap > table.items-compact-table td:first-child { display: none; }
  .ds-root .table-wrap > table.items-compact-table td:nth-child(2) {
    display: block;
    text-align: left;
    font-size: 1rem;
    font-weight: 700;
    color: var(--text);
    padding: 0 0 0.4rem;
    margin-bottom: 0.35rem;
    border-bottom: 1px solid var(--ds-line);
  }
  .ds-root .table-wrap > table.items-compact-table td:nth-child(2)::before { display: none; }
}

/* =================================================================
   POLIMENTO UI/UX — passe 10
   Visualização em CARDS controlada por classe (.cards-mode no <html>):
   mobile usa sempre; no desktop é opcional via alternador (tabela/cards).
   Cards mostram só a informação (sem rótulos), com a principal em
   destaque, ocultando campos vazios e "Ativo/Ativa".
   ================================================================= */

/* ---- ALTERNADOR tabela/cards (visível só no desktop) ---- */
.list-view-toggle { display: none; justify-content: flex-end; gap: 0.3rem; margin: 0 0 0.85rem; }
@media (min-width: 761px) { .list-view-toggle { display: flex; } }
.list-view-toggle button {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.4rem 0.75rem;
  border: 1px solid var(--ds-line);
  background: #fff;
  color: var(--text-soft);
  border-radius: 999px;
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 500;
  transition: background 160ms ease, color 160ms ease, border-color 160ms ease;
}
.list-view-toggle button svg { width: 1rem; height: 1rem; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.list-view-toggle button:hover { border-color: var(--ds-blue-100); color: var(--text); }
.list-view-toggle button.is-active { background: var(--app-dark, #1b2236); color: #fff; border-color: transparent; }

/* ---- ESTRUTURA do card ---- */
.cards-mode .table-wrap { overflow: visible; border: 0; background: transparent; box-shadow: none; }
.cards-mode .table-wrap > table { border: 0; background: transparent; border-radius: 0; }
.cards-mode .table-wrap > table thead { display: none; }
.cards-mode .table-wrap > table tbody,
.cards-mode .table-wrap > table tr,
.cards-mode .table-wrap > table td { display: block; width: 100%; }

.cards-mode .table-wrap > table tr {
  position: relative;
  margin: 0 0 0.7rem;
  padding: 0.85rem 1rem;
  border: 1px solid var(--ds-line);
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 6px 18px rgba(20, 26, 42, 0.06);
  overflow: hidden;
}
.cards-mode .table-wrap > table tr:hover td { background: transparent; }

/* no desktop, cards em grade aproveitando a largura */
@media (min-width: 761px) {
  .cards-mode .table-wrap > table tbody {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 0.9rem;
  }
  .cards-mode .table-wrap > table tr { margin: 0; }
}

/* células: só a informação, sem rótulo */
.cards-mode .table-wrap > table td {
  padding: 0.1rem 0;
  border: 0;
  text-align: left;
  font-size: 0.86rem;
  color: var(--text-soft);
}
.cards-mode .table-wrap > table td::before { content: none !important; display: none !important; }

/* informação principal (1ª célula) em destaque */
.cards-mode .table-wrap > table td:first-child {
  font-size: 1.02rem;
  font-weight: 700;
  color: var(--text);
  padding: 0;
  border: 0;
  margin-bottom: 0.3rem;
}
.cards-mode .table-wrap > table td:first-child .table-subline {
  font-size: 0.8rem;
  font-weight: 400;
  color: var(--text-soft);
  margin-top: 0.05rem;
}

/* valores monetários com leve destaque */
.cards-mode .table-wrap > table td.money,
.cards-mode .table-wrap > table td.budget-total-cell {
  font-weight: 700;
  color: var(--text);
  font-size: 0.94rem;
  margin-top: 0.12rem;
}

/* ocultas no card: vazias / "-" (marcadas via JS) e "Ativo/Ativa" */
.cards-mode .table-wrap > table td.card-hide,
.cards-mode .table-wrap > table td[data-label="Ativo"],
.cards-mode .table-wrap > table td[data-label="Ativa"] { display: none; }

/* status + ações no rodapé do card */
.cards-mode .table-wrap > table td.status-col,
.cards-mode .table-wrap > table td.actions-col {
  margin-top: 0.55rem;
  padding-top: 0.55rem;
  border-top: 1px solid var(--ds-line);
}
.cards-mode .table-wrap > table td .actions-stack,
.cards-mode .table-wrap > table td .status-cell {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
  justify-content: flex-start;
}

/* itens do orçamento: "Ordem" some, 2ª coluna ("Item") vira o título */
.cards-mode .table-wrap > table.items-compact-table td:first-child { display: none; }
.cards-mode .table-wrap > table.items-compact-table td:nth-child(2) {
  font-size: 1.02rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 0.3rem;
}

/* =================================================================
   POLIMENTO UI/UX — passe 11
   - Bloco de usuário no mobile: nome em cima (com Sair à direita),
     empresa e perfil formatados embaixo.
   - Alternador tabela/cards vira um SLIDER deslizante.
   - Cards do Orçamento (Título principal, ações arrumadas) e do Item
     (Nome principal, preço + unidade) com layout dedicado.
   ================================================================= */

/* ---- USER INFO mobile: nome (linha 1) + empresa · perfil (linha 2) ---- */
@media (max-width: 1024px) {
  .nav.nav-open .header-user-info {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.05rem 0.4rem;
  }
  .nav.nav-open .header-user-greeting {
    width: 100%;
    font-weight: 600;
    color: #fff;
    font-size: 0.92rem;
    margin-bottom: 0.12rem;
  }
  .nav.nav-open .header-sep { display: none; }
  .nav.nav-open .header-user-company { width: auto; }
  .nav.nav-open .header-user-company span { color: var(--ds-on-dark-mute); font-size: 0.82rem; font-weight: 400; }
  .nav.nav-open .user-role {
    display: inline-flex;
    align-items: center;
    background: transparent;
    border: 0;
    padding: 0;
    margin: 0;
    color: var(--ds-on-dark-soft);
    font-size: 0.82rem;
    letter-spacing: 0;
  }
  .nav.nav-open .user-role::before { content: "·"; margin: 0 0.35rem; color: var(--ds-on-dark-soft); }
}

/* ---- SLIDER tabela/cards (desktop) ---- */
.list-view-bar { display: none; justify-content: flex-end; margin: 0 0 0.85rem; }
@media (min-width: 761px) { .list-view-bar { display: flex; } }
.view-switch {
  position: relative;
  display: inline-flex;
  background: var(--ds-line);
  border-radius: 999px;
  padding: 3px;
}
.view-switch button {
  position: relative;
  z-index: 1;
  border: 0;
  background: transparent;
  cursor: pointer;
  min-width: 86px;
  padding: 0.42rem 1rem;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-soft);
  text-align: center;
  transition: color 0.25s ease;
}
.view-switch button.is-active { color: #fff; }
.view-switch-thumb {
  position: absolute;
  z-index: 0;
  top: 3px;
  bottom: 3px;
  left: 3px;
  width: calc(50% - 3px);
  background: var(--app-dark, #1b2236);
  border-radius: 999px;
  box-shadow: 0 4px 12px rgba(20, 26, 42, 0.25);
  transition: transform 0.25s ease;
}
.view-switch.is-cards .view-switch-thumb { transform: translateX(100%); }

/* ---- CARD do ORÇAMENTO: Título é a informação principal ---- */
.cards-mode .table-wrap > table.orc-list-table tbody tr { display: flex; flex-direction: column; }
.cards-mode .table-wrap > table.orc-list-table td.budget-title-cell {
  order: -3;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 0.12rem;
}
.cards-mode .table-wrap > table.orc-list-table td.budget-meta-cell {
  order: -2;
  font-size: 0.86rem;
  color: var(--text-soft);
}
.cards-mode .table-wrap > table.orc-list-table td.budget-meta-cell strong { font-weight: 600; color: var(--text); }
.cards-mode .table-wrap > table.orc-list-table td.budget-main-cell {
  order: -1;
  font-size: 0.8rem;
  font-weight: 400;
  color: var(--text-soft);
  padding: 0;
  border: 0;
  margin-top: 0.15rem;
}
.cards-mode .table-wrap > table.orc-list-table td.budget-main-cell strong { font-weight: 600; color: var(--text-soft); }
.cards-mode .table-wrap > table.orc-list-table td.budget-main-cell .table-subline {
  display: inline;
  font-size: 0.78rem;
  margin: 0 0 0 0.5rem;
}
.cards-mode .table-wrap > table.orc-list-table td.budget-total-cell {
  order: 1;
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  margin-top: 0.45rem;
}
.cards-mode .table-wrap > table.orc-list-table td.status-col {
  order: 2;
  margin-top: 0.55rem;
  padding-top: 0.55rem;
  border-top: 1px solid var(--ds-line);
}
.cards-mode .table-wrap > table.orc-list-table td.actions-col {
  order: 3;
  margin-top: 0.55rem;
  padding-top: 0;
  border-top: 0;
}
/* status: selo + botões de status na mesma linha, sem divisória dupla */
.cards-mode .table-wrap > table.orc-list-table td.status-col .status-cell {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem;
}

/* ---- CARD do ITEM: Nome principal + preço/unidade juntos ---- */
.cards-mode .table-wrap > table.catalog-items-table tbody tr { display: flex; flex-direction: column; }
.cards-mode .table-wrap > table.catalog-items-table td:nth-child(2) {
  order: -2;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 0.12rem;
}
.cards-mode .table-wrap > table.catalog-items-table td:first-child {
  order: -1;
  font-size: 0.8rem;
  font-weight: 400;
  color: var(--text-soft);
  padding: 0;
  border: 0;
}
.cards-mode .table-wrap > table.catalog-items-table td:nth-child(3) { order: 1; font-size: 0.85rem; }
.cards-mode .table-wrap > table.catalog-items-table td.money {
  order: 2;
  font-size: 0.96rem;
  font-weight: 700;
  color: var(--text);
  margin-top: 0.3rem;
}
.cards-mode .table-wrap > table.catalog-items-table td.actions-col {
  order: 3;
  margin-top: 0.55rem;
  padding-top: 0.55rem;
  border-top: 1px solid var(--ds-line);
}
.value-unit { font-weight: 400; color: var(--text-soft); font-size: 0.86rem; }

/* ---- BREADCRUMB ---- */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.85rem;
  color: var(--text-soft, #6b7280);
  margin-bottom: 1.1rem;
  flex-wrap: wrap;
}
.breadcrumb a {
  color: var(--text-soft, #6b7280);
  text-decoration: none;
}
.breadcrumb a:hover { color: var(--primary, #2563eb); text-decoration: underline; }
.breadcrumb-sep { color: var(--border, #d1d5db); user-select: none; }
.breadcrumb-current { color: var(--text, #111827); font-weight: 500; }

/* ---- STAT CARD STATES ---- */
.stat-card--alert {
  border-color: rgba(209, 69, 69, 0.35) !important;
  background: rgba(209, 69, 69, 0.06) !important;
}
.stat-card--alert .value { color: #b63e3e; }

.stat-card--processing {
  border-color: rgba(47, 120, 219, 0.35) !important;
  background: rgba(47, 120, 219, 0.06) !important;
}
.stat-card--processing .value { color: #2d6bbf; }

/* ---- MARKDOWN CONTENT ---- */
.md-content { line-height: 1.65; }
.md-content p { margin: 0 0 0.75rem; }
.md-content p:last-child { margin-bottom: 0; }
.md-content h1, .md-content h2, .md-content h3,
.md-content h4, .md-content h5, .md-content h6 {
  margin: 1.1rem 0 0.4rem;
  font-weight: 600;
  color: var(--text, #111827);
}
.md-content ul, .md-content ol { padding-left: 1.4rem; margin: 0 0 0.75rem; }
.md-content li { margin-bottom: 0.25rem; }
.md-content code {
  background: rgba(0,0,0,0.06);
  border-radius: 4px;
  padding: 0.1em 0.35em;
  font-size: 0.88em;
  font-family: monospace;
}
.md-content pre {
  background: rgba(0,0,0,0.06);
  border-radius: 6px;
  padding: 0.75rem 1rem;
  overflow-x: auto;
  margin: 0 0 0.75rem;
}
.md-content pre code { background: none; padding: 0; }
.md-content blockquote {
  border-left: 3px solid var(--border, #e5e7eb);
  margin: 0 0 0.75rem;
  padding: 0.4rem 0.75rem;
  color: var(--text-soft, #6b7280);
}
.md-content strong { font-weight: 600; }
.md-content table { border-collapse: collapse; width: 100%; margin-bottom: 0.75rem; }
.md-content th, .md-content td { border: 1px solid var(--border, #e5e7eb); padding: 0.4rem 0.6rem; font-size: 0.9rem; }
.md-content th { background: rgba(0,0,0,0.04); font-weight: 600; }

/* ---- BADGE DE STATUS DAS QUESTÕES ---- */
.badge-concluida { background: rgba(79,165,106,0.12); border-color: rgba(79,165,106,0.18); color: #2f7d49; }
.badge-em_revisao { background: rgba(182,120,28,0.1); border-color: rgba(182,120,28,0.14); color: #925d16; }
.badge-na_fila { background: rgba(47,120,219,0.1); border-color: rgba(47,120,219,0.14); color: #2d6bbf; }
.badge-processando { background: rgba(47,120,219,0.08); border-color: rgba(47,120,219,0.14); color: #2d6bbf; }
.badge-erro { background: rgba(209,69,69,0.12); border-color: rgba(209,69,69,0.18); color: #b63e3e; }

/* ---- PROGRESS BAR ---- */
.progress-bar-wrap {
  margin: 0.65rem 0;
}
.progress-bar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.35rem;
  font-size: 0.84rem;
}
.progress-bar-title { font-weight: 500; color: var(--text); }
.progress-bar-counts { color: var(--text-soft); }

.progress-bar-track {
  height: 7px;
  border-radius: 999px;
  background: rgba(47, 120, 219, 0.12);
  overflow: hidden;
  position: relative;
}
.progress-bar-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--ds-blue, #2563eb), #60a5fa);
  transition: width 0.4s ease;
  min-width: 0;
}
@keyframes pb-slide {
  0%   { transform: translateX(-100%); }
  100% { transform: translateX(350%); }
}
.progress-bar-indeterminate {
  width: 30% !important;
  animation: pb-slide 1.4s ease-in-out infinite;
}

.upload-progress-wrap {
  margin: 0.75rem 0 0.25rem;
}
.progress-label {
  font-size: 0.82rem;
  color: var(--text-soft);
  margin-top: 0.35rem;
  display: block;
}

.imp-progress-bar {
  margin-top: 0.4rem;
}

/* ---- PREVISÃO DE CUSTO ---- */
.cost-preview {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-top: 0.75rem;
  padding: 0.5rem 0.8rem;
  border-radius: 10px;
  background: rgba(47, 120, 219, 0.06);
  border: 1px solid rgba(47, 120, 219, 0.14);
  font-size: 0.84rem;
  color: var(--text);
  flex-wrap: wrap;
}
#cost-summary {
  font-weight: 600;
  color: var(--ds-blue-dark, #1d4ed8);
}
.cost-note {
  color: var(--text-soft);
  font-size: 0.8rem;
}

/* ---- HEADER — espaçamento uniforme ---- */
.site-header { border-bottom-width: 1px; }

.nav {
  gap: 0;
  padding: 0.55rem 0;
  min-height: auto;
}

.nav-top {
  margin-right: 1.25rem;
  gap: 0;
}

.brand {
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  padding: 0.3rem 0;
  color: var(--ds-text-900, var(--text));
}

.nav-bottom { gap: 0; }

.nav-links {
  gap: 0.1rem;
  font-size: 0.9rem;
}

.nav-links a {
  padding: 0.32rem 0.7rem;
  font-weight: 500;
  border-radius: 8px;
  transition: background 0.15s, color 0.15s;
}

.nav-links a:hover { background: rgba(47, 120, 219, 0.07); }

.nav-links a.active {
  background: rgba(47, 120, 219, 0.1);
  color: var(--ds-blue-dark, #1d4ed8);
}

.header-user-meta {
  gap: 0.5rem;
  font-size: 0.85rem;
}

.header-user-greeting {
  font-size: 0.84rem;
  color: var(--text-soft);
}

.nav-logout {
  font-size: 0.84rem;
  padding: 0.22rem 0.7rem;
  min-height: 28px;
  border-radius: 7px;
}

.header-user-actions form { display: inline-flex; }
