/* ========== base ========== */
:root {
  --bg: #fafaf9;
  --surface: #ffffff;
  --text: #1c1917;
  --muted: #78716c;
  --border: #e7e5e4;
  --accent: #b45309;
  --accent-soft: #fffbeb;
  --success: #15803d;
  --danger: #b91c1c;
  --info: #0369a1;
  --radius: 12px;
  --radius-lg: 16px;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.08);
  --font: "DM Sans", system-ui, -apple-system, sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  color: var(--text);
  background: var(--bg);
  line-height: 1.45;
  min-height: 100dvh;
}

.layout-brinde {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

a {
  color: var(--info);
  -webkit-tap-highlight-color: transparent;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ========== header (Hotmart / Baratieri) ========== */
.app-header {
  padding: 12px 16px;
  background: linear-gradient(135deg, #1c1917 0%, #292524 100%);
  color: #fafaf9;
  box-shadow: var(--shadow-md);
}

.site-header-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
}

.brand-link {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  text-decoration: none;
  color: inherit;
  border-radius: 12px;
  outline-offset: 3px;
}

.brand-link:focus-visible {
  outline: 2px solid #fdba74;
}

.app-header-brand {
  min-width: 0;
}

.app-header img {
  height: 75px;
  width: auto;
  object-fit: contain;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
}

.app-header-text {
  display: flex;
  flex-direction: column;
  align-self: center;
  gap: 0;
  min-width: 0;
}

.app-title {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #a8a29e;
}

.app-sub {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.app-tagline {
  display: block;
  font-size: 11px;
  font-weight: 500;
  line-height: 1.35;
  color: #a8a29e;
  margin-top: 4px;
  max-width: 46ch;
}

/* faixa de título */
.page-hero {
  background: linear-gradient(180deg, #fffbeb 0%, #fafaf9 100%);
  border-bottom: 1px solid var(--border);
  padding: 20px 16px 22px;
}

.page-hero-title {
  margin: 0 auto 8px;
  max-width: 1200px;
  font-size: clamp(1.2rem, 2.6vw, 1.45rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--text);
}

.page-hero-lead {
  margin: 0 auto;
  max-width: min(1200px, 65ch);
  font-size: 14px;
  color: var(--muted);
  line-height: 1.55;
}

.main-grow {
  flex: 1 0 auto;
}

/* rodapé institucional */
.site-footer {
  flex-shrink: 0;
  margin-top: 28px;
  background: linear-gradient(180deg, #292524 0%, #1c1917 100%);
  color: #d6d3d1;
  padding: 28px 16px 20px;
  border-top: 3px solid #78350f;
}

.site-footer-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  justify-content: space-evenly;
  gap: 24px 20px;
}

@media (max-width: 768px) {
  .site-footer-inner {
    grid-template-columns: 1fr;
  }

  .app-tagline {
    max-width: none;
  }
}

.site-footer-kicker {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color:  #a8a29e;
  margin: 0 0 8px;
}

.site-footer-copy,
.site-footer-note {
  margin: 0 0 10px;
  font-size: 13px;
  line-height: 1.5;
  color: #a8a29e;
}

.site-footer-note {
  font-size: 12px;
  margin-bottom: 0;
}

.site-footer-heading {
  margin: 0 0 10px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #fafaf9;
}

.site-footer-links {
  max-width: 1200px;
  display: flex;
  justify-content: space-between;
  list-style: none;
  margin: auto;
  padding-bottom:10px;
}


.site-footer a {
  color: #fdba74;
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
}

.site-footer a:hover {
  text-decoration: underline;
}

.site-footer-cta-wrap {
  margin: 0 0 10px;
}



.site-footer-legal {
  max-width: 1200px;
  margin: auto;
  padding-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  font-size: 11px;
  line-height: 1.45;
  color: #78716c;
  text-align: center;
}

.site-footer-divider {
  opacity: 0.45;
}

.site-footer-help {
  list-style: none;
  margin: 0 auto 12px;
  padding: 5px 10px;
  max-width: 1200px;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  padding-bottom: 14px;
}

.site-footer-help-btn {
  margin: 0;
  padding: 0;
  border: none;
  background: none;
  cursor: pointer;
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  color: #fdba74;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.site-footer-help-btn:hover {
  color: #fed7aa;
}

.site-footer-col-wide {
  display: flex;
  justify-content: center;
  gap: 20px;
  max-width: 1200px;
  margin: auto;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  font-size: 11px;
  line-height: 1.45;
  color: #78716c;
  text-align: center;
}

.fab {
  flex-shrink: 0;
  border: none;
  background: linear-gradient(180deg, #ea580c 0%, #c2410c 100%);
  color: #fff;
  font-weight: 600;
  font-size: 14px;
  padding: 10px 14px;
  border-radius: 10px;
  box-shadow: 0 2px 8px rgba(194, 65, 12, 0.35);
}

.fab:active {
  transform: scale(0.98);
}

/* ========== main ========== */
.main-area {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 16px;
  box-sizing: border-box;
  min-width: 0;
}

.section-title {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin: 8px 0 12px;
}

/* ========== tela de acesso (códigos) ========== */
.auth-gate {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px max(16px, env(safe-area-inset-right, 0px)) max(24px, env(safe-area-inset-bottom, 0px))
    max(16px, env(safe-area-inset-left, 0px));
  background: linear-gradient(180deg, #1c1917 0%, #292524 45%, #fafaf9 45%);
  box-sizing: border-box;
}

/* display:flex acima ganha do [hidden] padrão — sem isso o login nunca “some” */
.auth-gate[hidden] {
  display: none !important;
}

#app-shell[hidden] {
  display: none !important;
}

.auth-gate-card {
  width: 100%;
  max-width: 400px;
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 28px 22px 24px;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border);
  text-align: center;
}

.auth-gate-logo {
  height: 64px;
  width: auto;
  object-fit: contain;
  border-radius: 10px;
  margin-bottom: 14px;
}

.auth-gate-title {
  margin: 0 0 8px;
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--text);
}

.auth-gate-lead {
  margin: 0 0 20px;
  font-size: 14px;
  color: var(--muted);
  line-height: 1.5;
}

.auth-gate-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  text-align: left;
}

.auth-gate-form input {
  width: 100%;
  padding: 14px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  font-size: 16px;
  box-sizing: border-box;
}

.auth-gate-form input:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.auth-gate-submit {
  width: 100%;
  padding: 14px;
  border: none;
  border-radius: var(--radius);
  background: linear-gradient(180deg, #ea580c 0%, #c2410c 100%);
  color: #fff;
  font-weight: 600;
  font-size: 15px;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(194, 65, 12, 0.35);
}

.auth-gate-submit:active {
  transform: scale(0.99);
}

.auth-gate-msg {
  margin: 14px 0 0;
  min-height: 1.35em;
  font-size: 13px;
  color: var(--muted);
}

.auth-gate-msg.is-error {
  color: var(--danger);
  font-weight: 600;
}

.auth-gate-hint {
  margin: 16px 0 0;
  padding: 12px 14px;
  text-align: left;
  background: var(--accent-soft);
  border: 1px solid #fcd34d;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.auth-gate-hint-text {
  margin: 0;
  font-size: 13px;
  line-height: 1.45;
  color: var(--text);
}

.auth-gate-hint-sub {
  margin: 8px 0 0;
  font-size: 12px;
  line-height: 1.4;
  color: var(--muted);
}

.auth-gate-hint-link {
  color: var(--accent);
  font-weight: 700;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

.auth-gate-hint-link:hover {
  color: #92400e;
}

.auth-gate-hint-link:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 2px;
}

.auth-gate-help {
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
  text-align: left;
}

.auth-gate-help-title {
  margin: 0 0 6px;
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
}

.auth-gate-contact {
  margin: 0;
  font-size: 13px;
  line-height: 1.55;
  color: var(--muted);
  word-break: break-word;
}

.auth-gate-contact-link {
  color: var(--accent);
  font-weight: 600;
  text-decoration: none;
}

.auth-gate-contact-link:hover {
  text-decoration: underline;
}

.auth-gate-contact-sep {
  margin: 0 0.28em;
  color: var(--muted);
  font-weight: 400;
}

/* ========== modo local ========== */
.local-hint {
  margin: 0 0 10px;
  padding: 10px 14px;
  font-size: 13px;
  line-height: 1.45;
  color: #92400e;
  background: linear-gradient(90deg, #fffbeb 0%, #fef3c7 100%);
  border: 1px solid #fcd34d;
  border-radius: var(--radius);
  max-height: 200px;
  opacity: 1;
  overflow: hidden;
  transition: opacity 0.35s ease, max-height 0.35s ease, margin 0.35s ease, padding 0.35s ease, border-color 0.35s ease;
}

.local-hint.is-dismissed {
  opacity: 0;
  max-height: 0;
  margin: 0;
  padding: 0;
  border-color: transparent;
  pointer-events: none;
}

/* ========== toolbar ========== */
.toolbar {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 8px;
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

.toolbar-search {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
  min-width: 0;
}

.search-icon {
  position: absolute;
  left: 12px;
  font-size: 16px;
  color: var(--muted);
  pointer-events: none;
}

#busca {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  padding: 12px 12px 12px 40px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

#busca:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.toolbar-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: stretch;
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

.toolbar-select {
  flex: 1 1 200px;
  min-width: 0;
  max-width: 100%;
  padding: 11px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.btn-toolbar {
  border: none;
  background: var(--text);
  color: #fafaf9;
  font-weight: 600;
  font-size: 14px;
  padding: 11px 14px;
  border-radius: var(--radius);
  flex: 0 1 auto;
  min-width: 0;
  text-align: center;
  line-height: 1.25;
}

.btn-toolbar-secondary {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  font-weight: 500;
}

/* ========== form overlay ========== */
#form-container {
  position: fixed;
  inset: 0;
  background: var(--bg);
  z-index: 900;
  display: none;
  overflow-y: auto;
}

#form-container.is-open {
  display: block;
}

.form-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 1;
}

.form-header h2,
#form-title {
  font-size: 17px;
  font-weight: 600;
  margin: 0;
  flex: 1;
}

.btn-icon {
  border: none;
  background: transparent;
  font-size: 22px;
  line-height: 1;
  padding: 4px 8px;
  color: var(--text);
  border-radius: 8px;
}

.btn-icon:hover {
  background: var(--bg);
}

.form-app {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 16px;
  padding-bottom: 32px;
}

.field-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  margin-top: 8px;
}

.field-label-nest {
  margin-top: 0;
  margin-bottom: 4px;
  font-size: 11px;
  font-weight: 600;
  color: #a8a29e;
}

.instr-tipo-select {
  width: 100%;
}

.instr-grid {
  display: grid;
  grid-template-columns: 1fr 96px 1fr;
  gap: 10px;
  margin-bottom: 2px;
}

.instr-grid-cell {
  min-width: 0;
}

@media (max-width: 560px) {
  .instr-grid {
    grid-template-columns: 1fr;
  }

  .instr-ano-wrap {
    max-width: 160px;
  }
}

.field-label .hint {
  font-weight: 400;
  color: #a8a29e;
}

.field-autocomplete-wrap {
  position: relative;
  width: 100%;
}

.cliente-suggestions {
  position: absolute;
  left: 0;
  right: 0;
  top: 100%;
  margin-top: 4px;
  z-index: 40;
  max-height: 220px;
  overflow-y: auto;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.14);
}

.cliente-suggestion-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  width: 100%;
  padding: 10px 12px;
  border: 0;
  border-bottom: 1px solid var(--border);
  background: transparent;
  text-align: left;
  cursor: pointer;
  font: inherit;
  color: var(--text);
}

.cliente-suggestion-item:last-child {
  border-bottom: 0;
}

.cliente-suggestion-item:hover,
.cliente-suggestion-item:focus-visible {
  background: var(--bg);
  outline: none;
}

.cj-nome {
  font-weight: 600;
  font-size: 14px;
}

.cj-meta {
  font-size: 12px;
  color: var(--muted);
}

.form-app input,
.form-app textarea,
.form-app select {
  padding: 12px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  width: 100%;
}

.form-app textarea {
  min-height: 88px;
  resize: vertical;
}

.textarea-notas {
  min-height: 72px;
  background: #fffbeb;
  border-color: #fcd34d;
}

.photo-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.photo-field-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 10px;
}

.photo-field-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  font-size: 13px;
}

.btn-photo-pick,
.btn-photo-remove {
  border: 1px solid var(--border);
  background: #fafaf9;
  border-radius: 10px;
  padding: 8px 10px;
  font-size: 12px;
  font-weight: 600;
}

.btn-photo-pick {
  width: 100%;
}

.btn-photo-remove {
  color: var(--danger);
  padding: 4px 8px;
}

.photo-preview {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 10px;
  border: 1px solid var(--border);
  margin-top: 8px;
}

/* ——— Tabela de serviços (checklist) ——— */
.checklist-servicos {
  padding: 0;
  background: transparent;
  border: none;
  border-radius: 0;
  max-height: none;
}

.checklist-table {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.checklist-head {
  display: grid;
  grid-template-columns: 1fr minmax(4.5rem, auto);
  gap: 12px;
  align-items: center;
  padding: 10px 14px 10px 16px;
  background: linear-gradient(180deg, #292524 0%, #1c1917 100%);
  color: #fafaf9;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.checklist-h-preco {
  text-align: right;
  padding-right: 2px;
}

.checklist-body {
  max-height: min(52vh, 360px);
  overflow-y: auto;
  scrollbar-width: thin;
}

.checklist-body::-webkit-scrollbar {
  width: 6px;
}

.checklist-body::-webkit-scrollbar-thumb {
  background: #d6d3d1;
  border-radius: 6px;
}

/* ——— Material / peças (formulário OS) ——— */
.materiais-wrap {
  margin-bottom: 12px;
}

.mat-head {
  display: grid;
  grid-template-columns: 1fr 3.5rem 5.25rem 2rem;
  gap: 8px;
  align-items: center;
  padding: 10px 14px 10px 16px;
  background: linear-gradient(180deg, #44403c 0%, #292524 100%);
  color: #fafaf9;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.mat-head span:nth-child(3) {
  text-align: right;
}

.materiais-body {
  max-height: min(40vh, 280px);
  overflow-y: auto;
  scrollbar-width: thin;
}

.materiais-body::-webkit-scrollbar {
  width: 6px;
}

.materiais-body::-webkit-scrollbar-thumb {
  background: #d6d3d1;
  border-radius: 6px;
}

.mat-row {
  display: grid;
  grid-template-columns: 1fr 3.5rem 5.25rem 2rem;
  gap: 8px;
  align-items: center;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.mat-row:last-child {
  border-bottom: none;
}

.mat-desc-cell {
  position: relative;
  min-width: 0;
}

.mat-desc-cell .mat-desc {
  width: 100%;
  box-sizing: border-box;
}

.peca-suggestions-float {
  position: fixed;
  z-index: 960;
  max-height: 220px;
  overflow-y: auto;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.18);
}

.peca-suggestions-empty {
  margin: 0;
  padding: 12px 14px;
  font-size: 13px;
  line-height: 1.45;
  color: var(--muted);
}

.mat-row .mat-qtd,
.mat-row .mat-unit {
  width: 100%;
}

.btn-mat-remove {
  border: 1px solid var(--border);
  background: #fafaf9;
  border-radius: 8px;
  padding: 6px 0;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  color: #57534e;
}

.btn-mat-remove:active {
  background: #e7e5e4;
}

.mat-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 16px;
  padding: 10px 14px 12px;
  border-top: 1px solid var(--border);
  background: #fafaf9;
}

.btn-mat-add {
  border: 1px solid #ea580c;
  background: #fff7ed;
  color: #9a3412;
  border-radius: 10px;
  padding: 8px 12px;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
}

.mat-somar-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: #44403c;
  cursor: pointer;
}

.mat-somar-label input {
  width: auto;
  accent-color: #ea580c;
}

.mat-linhas {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 4px;
  font-size: 13px;
  color: #44403c;
}

.mat-nao-soma {
  font-size: 12px;
  color: #78716c;
  margin: 4px 0 0;
}

.check-item {
  display: grid;
  grid-template-columns: 1fr minmax(4.5rem, auto);
  gap: 12px;
  align-items: start;
  padding: 12px 14px 12px 16px;
  margin: 0;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.12s ease, box-shadow 0.12s ease;
}

.check-item:last-child {
  border-bottom: none;
}

.check-item:hover {
  background: #fafaf9;
}

.check-item:has(.check-input:checked) {
  background: linear-gradient(90deg, #fffbeb 0%, #fff7ed 100%);
  box-shadow: inset 3px 0 0 0 #ea580c;
}

.check-item:has(.check-input:focus-visible) {
  outline: 2px solid #ea580c;
  outline-offset: -2px;
  z-index: 1;
  position: relative;
}

.check-main {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  min-width: 0;
}

.check-input {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
  opacity: 0.001;
}

.check-box {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  margin-top: 1px;
  border: 2px solid #a8a29e;
  border-radius: 6px;
  background: var(--surface);
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}

.check-item:hover .check-box {
  border-color: #78716c;
}

.check-input:checked + .check-box {
  background: #ea580c;
  border-color: #c2410c;
  box-shadow: 0 1px 3px rgba(194, 65, 12, 0.35);
}

.check-input:checked + .check-box::after {
  content: "";
  display: block;
  width: 5px;
  height: 10px;
  margin: 2px 0 0 6px;
  border: solid #fff;
  border-width: 0 2.5px 2.5px 0;
  transform: rotate(45deg);
}

.check-nome-wrap {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.check-nome {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.35;
  letter-spacing: -0.01em;
}

.check-desc {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.check-preco {
  font-size: 14px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: #1c1917;
  text-align: right;
  padding-top: 1px;
  letter-spacing: -0.02em;
}

.check-item:has(.check-input:checked) .check-preco {
  color: #9a3412;
}

.form-actions {
  display: flex;
  gap: 10px;
  margin-top: 16px;
}

.form-actions button {
  flex: 1;
  padding: 14px;
  border-radius: var(--radius);
  border: none;
  font-weight: 600;
}

.cancelar {
  background: #e7e5e4;
  color: var(--text);
}

.salvar,
button[type="submit"] {
  background: var(--success);
  color: #fff;
}

/* ========== kanban ========== */
.kanban {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 8px;
  scrollbar-width: thin;
}

.coluna {
  min-width: 280px;
  flex: 0 0 280px;
  background: #f5f5f4;
  padding: 12px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
}

.coluna h3 {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin: 0 0 10px;
}

/* ========== card ========== */
.card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 14px;
  margin-bottom: 10px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  font-size: 14px;
  transition: box-shadow 0.2s, transform 0.2s;
}

.card:hover {
  box-shadow: var(--shadow-md);
}

.card-os-id {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.04em;
  margin-bottom: 4px;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 8px;
}

.cliente {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.instrumento {
  display: block;
  font-size: 13px;
  color: var(--muted);
  margin-top: 2px;
}

.data {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}

.card-notas {
  margin: 8px 0;
  font-size: 13px;
  background: var(--accent-soft);
  border: 1px solid #fde68a;
  border-radius: var(--radius);
  overflow: hidden;
}

.card-notas summary {
  padding: 8px 10px;
  cursor: pointer;
  font-weight: 600;
  color: #92400e;
  list-style: none;
}

.card-notas summary::-webkit-details-marker {
  display: none;
}

.card-notas summary::after {
  content: " ▾";
  font-size: 10px;
  opacity: 0.7;
}

.card-notas[open] summary::after {
  content: " ▴";
}

.card-notas .notas-body {
  padding: 0 10px 10px;
  color: #44403c;
  white-space: pre-wrap;
}

.card-notas--plain {
  background: var(--surface);
  border-color: var(--border);
}

.card-notas--plain summary {
  color: #44403c;
}

.card-notas--plain .notas-body {
  white-space: normal;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.card-notas--plain.card-notas--serv-extra {
  background: linear-gradient(145deg, #fff7ed 0%, #fafaf9 52%, #fafaf9 100%);
  border-color: #fed7aa;
  box-shadow:
    0 1px 2px rgba(234, 88, 12, 0.06),
    0 3px 10px rgba(234, 88, 12, 0.07);
}

.card-notas--plain.card-notas--serv-extra summary {
  color: #9a3412;
}

.card-notas--plain.card-notas--material {
  background: linear-gradient(145deg, #f0f9ff 0%, #fafaf9 52%, #fafaf9 100%);
  border-color: #bae6fd;
  box-shadow:
    0 1px 2px rgba(3, 105, 161, 0.06),
    0 3px 10px rgba(3, 105, 161, 0.07);
}

.card-notas--plain.card-notas--material summary {
  color: #0369a1;
}

.card-linha-detalhe {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
  padding: 2px 0;
  font-size: 13px;
  color: #44403c;
}

.card-linha-valor {
  font-weight: 600;
  color: #292524;
  flex-shrink: 0;
}

.card-linha-extra {
  margin-top: 4px;
  padding-top: 8px;
  border-top: 1px dashed var(--border);
}

.card-linha-extra-tit {
  font-weight: 700;
  color: #c2410c;
}

.card-servicos {
  margin: 6px 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.card-fotos {
  display: flex;
  gap: 8px;
  margin: 8px 0;
}

.foto-chip {
  border: 1px solid var(--border);
  background: #fafaf9;
  border-radius: 10px;
  padding: 6px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.foto-chip img {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  object-fit: cover;
  flex-shrink: 0;
}

.foto-chip span {
  font-size: 12px;
  font-weight: 600;
}

.servico-header {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.servico-valor {
  font-weight: 700;
  color: var(--text);
}

.servico-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.tag-servico {
  font-size: 12px;
  background: #f5f5f4;
  padding: 5px 8px;
  border-radius: 8px;
  border: 1px solid var(--border);
}

.tag-extra {
  background: #ecfdf5;
  color: #166534;
  border-color: #bbf7d0;
}

.financeiro {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

.total {
  font-size: 15px;
  font-weight: 700;
}

.desconto {
  color: var(--danger);
  font-size: 12px;
  margin-bottom: 4px;
}

.sem-orcamento {
  color: var(--muted);
  font-weight: 500;
  font-size: 13px;
}

.pagamentos {
  margin-top: 8px;
}

.pagamento-item {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: start;
  gap: 6px;
  padding: 8px 0;
  border-top: 1px solid var(--border);
}

.pagamento-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.pagamento-linha {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px;
}

.pagamento-valor {
  font-weight: 600;
}

.data-pagamento {
  font-size: 12px;
  color: var(--muted);
}

.pagamento-forma {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--info);
}

.pagamento-obs {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.pagamento-acoes {
  display: flex;
  align-items: center;
  gap: 0;
}

.btn-editar-pag,
.btn-remover {
  border: none;
  background: transparent;
  font-size: 15px;
  line-height: 1;
  padding: 8px;
  opacity: 0.55;
  transition: opacity 0.15s;
}

.btn-editar-pag {
  color: var(--info);
}

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

.pagamento-item:hover .btn-editar-pag,
.pagamento-item:hover .btn-remover {
  opacity: 1;
}

@media (hover: none) {
  .btn-editar-pag,
  .btn-remover {
    opacity: 0.85;
  }
}

.falta {
  color: var(--danger);
  font-weight: 600;
  font-size: 13px;
  margin-top: 6px;
}

.pago-ok {
  color: var(--success);
  font-weight: 600;
  font-size: 13px;
  margin-top: 6px;
}

.barra {
  background: #e7e5e4;
  height: 6px;
  border-radius: 6px;
  overflow: hidden;
  margin-top: 8px;
}

.barra-fill {
  height: 100%;
  background: linear-gradient(90deg, #16a34a, #4ade80);
  transition: width 0.35s ease;
}

.card-footer {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}

.card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.card-actions .card-action {
  border: 1px solid var(--border);
  background: #fafaf9;
  padding: 8px 10px;
  border-radius: 10px;
  font-size: 15px;
  line-height: 1;
}

.card-actions .card-action:hover {
  background: #f5f5f4;
}

.card-actions .card-action.danger:hover {
  background: #fef2f2;
  border-color: #fecaca;
}

/* ========== modal ========== */
.modal-root {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0;
  pointer-events: none;
  visibility: hidden;
  opacity: 0;
  transition: opacity 0.2s, visibility 0.2s;
}

.modal-root.is-open {
  pointer-events: auto;
  visibility: visible;
  opacity: 1;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(28, 25, 23, 0.45);
  backdrop-filter: blur(2px);
}

.modal-dialog {
  position: relative;
  width: 100%;
  max-width: 420px;
  max-height: min(88vh, 640px);
  margin: auto auto 0;
  background: var(--surface);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  box-shadow: 0 -8px 40px rgba(0, 0, 0, 0.15);
  display: flex;
  flex-direction: column;
  transform: translateY(12px);
  transition: transform 0.25s ease;
}

.modal-root.is-open .modal-dialog {
  transform: translateY(0);
}

@media (min-width: 480px) {
  .modal-root {
    align-items: center;
    padding: 16px;
  }

  .modal-dialog {
    border-radius: var(--radius-lg);
    margin: auto;
    max-height: 85vh;
  }
}

.modal-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 16px 0;
}

.modal-title {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  flex: 1;
}

.modal-close {
  border: none;
  background: #f5f5f4;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  font-size: 22px;
  line-height: 1;
  color: var(--muted);
}

.modal-body {
  padding: 14px 16px;
  overflow-y: auto;
}

.modal-footer {
  display: flex;
  gap: 10px;
  padding: 12px 16px 18px;
  border-top: 1px solid var(--border);
}

.modal-footer button {
  flex: 1;
  padding: 14px;
  border-radius: var(--radius);
  border: none;
  font-weight: 600;
  font-size: 15px;
}

.btn-modal-secondary {
  background: #e7e5e4;
  color: var(--text);
}

.btn-modal-primary {
  background: var(--success);
  color: #fff;
}

.btn-modal-danger {
  background: var(--danger);
  color: #fff;
}

.modal-field {
  margin-bottom: 14px;
}

.modal-field label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 6px;
}

.modal-field input,
.modal-field select,
.modal-field textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.modal-field textarea {
  min-height: 64px;
  resize: vertical;
}

.modal-field.csv-export-opt {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: 10px;
  margin-top: 8px;
  margin-bottom: 0;
  cursor: pointer;
}

.modal-field.csv-export-opt input {
  width: auto;
  margin-top: 3px;
  flex-shrink: 0;
}

.modal-field.csv-export-opt span {
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  line-height: 1.35;
}

.modal-hint {
  font-size: 12px;
  color: var(--muted);
  margin-top: 6px;
}

.modal-body .modal-hint:first-child {
  margin-top: 0;
}

.modal-prose {
  font-size: 14px;
  line-height: 1.55;
  color: var(--text);
}

.modal-prose p {
  margin: 0 0 12px;
}

.modal-prose p:last-child {
  margin-bottom: 0;
}

.modal-prose-compact {
  font-size: 13px;
}

.modal-help-list {
  margin: 10px 0 0;
  padding-left: 1.2em;
  line-height: 1.6;
}

.modal-help-list li {
  margin-bottom: 6px;
}

.modal-help-list a {
  color: var(--accent);
  font-weight: 600;
}

.modal-help-steps {
  margin: 0;
  padding-left: 1.2em;
  line-height: 1.55;
}

.modal-help-steps li {
  margin-bottom: 10px;
}

.modal-help-steps li:last-child {
  margin-bottom: 0;
}

.catalog-sep {
  border: none;
  border-top: 1px solid var(--border);
  margin: 12px 0;
}

.catalog-row-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 10px;
}

.catalog-preco-wrap {
  flex: 1;
  min-width: 120px;
}

.catalog-preco-wrap label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 6px;
}

.catalog-row-tools .btn-cat-remove {
  flex-shrink: 0;
  padding: 10px 12px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 13px;
  font-weight: 600;
  color: var(--danger);
}

.catalog-add-btn {
  font-weight: 600;
}

/* ========== instalar PWA ========== */
.pwa-install-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 999;
  padding: max(12px, env(safe-area-inset-bottom, 0px)) 16px 16px;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  pointer-events: none;
}

.pwa-install-inner {
  max-width: 520px;
  margin: 0 auto;
  padding: 14px 16px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  pointer-events: auto;
}

.pwa-install-title {
  margin: 0 0 8px;
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
}

.pwa-install-text {
  margin: 0 0 12px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--muted);
}

.pwa-install-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

.pwa-install-btn {
  border: none;
  border-radius: var(--radius);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  padding: 10px 16px;
  cursor: pointer;
}

.pwa-install-btn-primary {
  background: linear-gradient(180deg, #ea580c 0%, #c2410c 100%);
  color: #fff;
  box-shadow: 0 2px 8px rgba(194, 65, 12, 0.3);
}

.pwa-install-btn-secondary {
  background: #f5f5f4;
  color: var(--text);
  border: 1px solid var(--border);
}

/* tela de login: cartão escuro atrás, banner continua legível no degradê claro */
.auth-gate ~ .pwa-install-banner .pwa-install-inner {
  box-shadow: 0 -4px 28px rgba(0, 0, 0, 0.12);
}

/* ========== toast ========== */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: #1c1917;
  color: #fafaf9;
  padding: 12px 20px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 500;
  box-shadow: var(--shadow-md);
  z-index: 1100;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s, transform 0.25s;
}

.toast.is-visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ========== arquivados ========== */
.topo-arquivados {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 16px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fff7ed;
}

.btn-voltar {
  border: 1px solid #fdba74;
  background: linear-gradient(180deg, #ea580c 0%, #c2410c 100%);
  color: #fff;
  padding: 10px 14px;
  border-radius: var(--radius);
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(194, 65, 12, 0.25);
}

.btn-voltar:hover {
  filter: brightness(1.05);
}

.valor {
  font-weight: 700;
  margin: 6px 0;
}

.mobile-col-title {
  text-align: center;
  font-size: 15px;
  font-weight: 700;
  margin: 12px 0;
  color: var(--muted);
}

/* ========== Mobile: smartphone e telas estreitas ========== */
@media (max-width: 768px) {
  /* Áreas seguras (notch / gestos na borda) */
  .app-header {
    padding-top: max(10px, env(safe-area-inset-top, 0px));
    padding-bottom: 10px;
    padding-left: max(12px, env(safe-area-inset-left, 0px));
    padding-right: max(12px, env(safe-area-inset-right, 0px));
  }

  .site-header-inner {
    align-items: flex-start;
    gap: 10px;
  }

  .brand-link {
    align-items: flex-start;
    gap: 10px;
  }

  .app-header img {
    height: 60px;
    width: auto;
    max-height: 52px;
  }

  .app-title {
    font-size: 10px;
    letter-spacing: 0.1em;
  }

  .app-sub {
    font-size: 14px;
    line-height: 1.25;
  }

  .app-tagline {
    font-size: 10px;
    line-height: 1.35;
    margin-top: 3px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  .fab {
    padding: 11px 12px;
    font-size: 13px;
    border-radius: 10px;
    align-self: center;
  }

  .page-hero {
    padding: 14px max(12px, env(safe-area-inset-left, 0px)) 16px max(12px, env(safe-area-inset-right, 0px));
  }

  .page-hero-title {
    font-size: 1.12rem;
    margin-bottom: 6px;
  }

  .page-hero-lead {
    font-size: 13px;
    line-height: 1.5;
  }

  .main-area {
    padding: 12px max(12px, env(safe-area-inset-left, 0px)) 14px max(12px, env(safe-area-inset-right, 0px));
  }

  .local-hint {
    font-size: 12px;
    padding: 9px 12px;
    line-height: 1.4;
  }

  .section-title {
    font-size: 11px;
    margin: 6px 0 10px;
  }

  /* Toolbar: grade 2 colunas, select em linha inteira */
  .toolbar-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    align-items: stretch;
  }

  .toolbar-select {
    grid-column: 1 / -1;
    flex: none;
    width: 100%;
    font-size: 16px;
    min-height: 44px;
  }

  .btn-toolbar {
    font-size: 13px;
    padding: 12px 8px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    white-space: normal;
    word-break: break-word;
    hyphens: auto;
  }

  /* Kanban em coluna única (modo mobile do app) */
  #kanban {
    display: block;
    padding-bottom: max(12px, env(safe-area-inset-bottom, 0px));
    min-width: 0;
  }

  .coluna {
    min-width: unset;
    flex: unset;
    padding: 10px;
    border-radius: var(--radius);
  }

  .mobile-col-title {
    font-size: 14px;
    margin: 10px max(0px, env(safe-area-inset-left, 0px)) 10px max(0px, env(safe-area-inset-right, 0px));
    padding: 0 4px;
  }

  .card {
    padding: 12px;
    font-size: 14px;
  }

  .card-header {
    gap: 8px;
  }

  .cliente {
    font-size: 15px;
  }

  .data {
    white-space: normal;
    text-align: right;
    font-size: 11px;
    max-width: 42%;
    line-height: 1.3;
  }

  .card-actions {
    gap: 8px;
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .card-actions .card-action {
    min-width: 44px;
    min-height: 44px;
    padding: 10px 12px;
    font-size: 17px;
    border-radius: 11px;
  }

  .pagamento-meta {
    min-width: 0;
  }

  .pagamento-linha {
    flex-wrap: wrap;
  }

  /* Formulário OS: checklist não ocupa a tela inteira */
  .checklist-body {
    max-height: min(42vh, 300px);
  }

  .check-item {
    padding: 10px 12px;
    gap: 8px;
    grid-template-columns: 1fr minmax(3.5rem, auto);
  }

  .check-nome {
    font-size: 13px;
  }

  .check-preco {
    font-size: 13px;
  }

  .form-app {
    padding: 12px max(12px, env(safe-area-inset-left, 0px)) max(24px, env(safe-area-inset-bottom, 12px)) max(12px, env(safe-area-inset-right, 0px));
  }

  .photo-fields {
    grid-template-columns: 1fr;
  }

  .form-header {
    padding-left: max(12px, env(safe-area-inset-left, 0px));
    padding-right: max(12px, env(safe-area-inset-right, 0px));
    padding-top: max(10px, env(safe-area-inset-top, 0px));
  }

  .form-actions button {
    min-height: 48px;
    font-size: 15px;
  }

  /* Modal */
  .modal-root.is-open .modal-dialog {
    max-height: min(92dvh, 100%);
  }

  .modal-body {
    padding-left: max(14px, env(safe-area-inset-left, 0px));
    padding-right: max(14px, env(safe-area-inset-right, 0px));
  }

  .modal-footer {
    padding-left: max(14px, env(safe-area-inset-left, 0px));
    padding-right: max(14px, env(safe-area-inset-right, 0px));
    padding-bottom: max(14px, env(safe-area-inset-bottom, 0px));
  }

  .modal-head {
    padding-left: max(14px, env(safe-area-inset-left, 0px));
    padding-right: max(14px, env(safe-area-inset-right, 0px));
  }

  /* Rodapé */
  .site-footer {
    padding-left: max(16px, env(safe-area-inset-left, 0px));
    padding-right: max(16px, env(safe-area-inset-right, 0px));
    padding-bottom: max(20px, env(safe-area-inset-bottom, 0px));
  }

  /* Toast acima da barra do sistema */
  .toast {
    left: max(12px, env(safe-area-inset-left, 0px));
    right: max(12px, env(safe-area-inset-right, 0px));
    width: auto;
    bottom: max(18px, env(safe-area-inset-bottom, 0px));
    transform: translateY(100px);
    font-size: 13px;
    padding: 11px 16px;
    border-radius: 14px;
    max-width: none;
  }

  .toast.is-visible {
    transform: translateY(0);
  }

  .topo-arquivados .btn-voltar {
    min-height: 44px;
  }
}

@media (max-width: 360px) {
  .main-area {
    padding-left: max(10px, env(safe-area-inset-left, 0px));
    padding-right: max(10px, env(safe-area-inset-right, 0px));
  }

  .btn-toolbar {
    font-size: 12px;
    padding: 11px 6px;
  }

  .app-header img {
    height: 44px;
  }

  .fab {
    font-size: 12px;
    padding: 10px 10px;
  }
}
