@import "https://fonts.cdnfonts.com/css/nasalization";

:root {
  --ink: #1b3042;
  --muted: #536a7b;
  --paper: #f5f8fa;
  --panel: #ffffff;
  --line: rgba(25, 58, 82, 0.15);
  --blue: #1583c5;
  --blue-dark: #135c8f;
  --gold: #2d79af;
  --green: #24779a;
  --topbar: 76px;
  --brand-font: "Nasalization Rg", "Nasalization", "Audiowide", "Orbitron", sans-serif;
  color: var(--ink);
  background: var(--paper);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  overflow-x: hidden;
}

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

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

.topbar {
  position: fixed;
  z-index: 20;
  top: 0;
  right: 0;
  left: 0;
  min-height: var(--topbar);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 16px clamp(18px, 5vw, 72px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.18);
  background: #1e2a31;
  color: #fff;
  backdrop-filter: blur(18px);
}

.brand {
  display: inline-flex;
  flex-direction: column;
  gap: 2px;
}

.brand-mark {
  font-family: var(--brand-font);
  color: #ffffff;
  font-size: clamp(1.45rem, 2vw, 2rem);
  font-weight: 900;
  line-height: 0.95;
  text-shadow: 0 0 5px rgba(255, 255, 255, 0.35), 0 1px 10px rgba(255, 255, 255, 0.22);
}

.brand-mark.small {
  display: block;
  margin-bottom: 6px;
  font-size: 1.4rem;
}

.brand-subtitle {
  color: #d6a16b;
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: clamp(12px, 2.4vw, 28px);
  align-items: center;
  font-size: 0.88rem;
  font-weight: 800;
}

.management-link {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  padding: 0 16px;
  background: var(--blue);
  color: #fff;
}

.management-link:hover {
  background: #0f6fa8;
}

.hero {
  min-height: 0;
  aspect-ratio: 3 / 2;
  margin-top: var(--topbar);
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 380px);
  align-items: end;
  gap: clamp(28px, 6vw, 80px);
  padding: 110px clamp(18px, 6vw, 86px) 70px;
  color: #fff;
  background:
    linear-gradient(90deg, rgba(12, 20, 27, 0.58), rgba(12, 20, 27, 0.24) 42%, rgba(12, 20, 27, 0.02) 68%),
    url("assets/header-montek-servicos.png") center / cover no-repeat;
  background-color: #08141d;
}

.hero-copy {
  width: min(40vw, 560px);
  max-width: 100%;
}

.hero .eyebrow { color: #fff; }

.eyebrow {
  margin: 0 0 12px;
  color: var(--gold);
  font-size: 0.78rem;
  font-weight: 1000;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 22px;
  max-width: 540px;
  font-size: clamp(2.05rem, 3.15vw, 3.2rem);
  line-height: 1.08;
  text-shadow: none;
}

h2 {
  margin-bottom: 16px;
  font-size: clamp(1.9rem, 3.8vw, 3.3rem);
  line-height: 1.05;
}

h3 {
  font-size: 1.35rem;
}

.hero p,
.contact-band p {
  max-width: 760px;
  color: #344d60;
  font-size: clamp(1rem, 1.5vw, 1.15rem);
  line-height: 1.55;
}

.hero p { color: #fff; }

.hero-copy > p:not(.eyebrow) {
  max-width: 430px;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 30px;
}

.button {
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 8px;
  padding: 0 18px;
  font-weight: 900;
  cursor: pointer;
}

.primary {
  background: var(--blue);
  color: #fff;
}

.secondary {
  border: 1px solid #9eb6c7;
  background: #fff;
  color: var(--blue-dark);
}

.secondary.light {
  border-color: var(--line);
  color: var(--ink);
}

.dark {
  background: var(--ink);
  color: #fff;
}

.hero-card {
  display: grid;
  gap: 12px;
  padding: 24px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  background: rgba(28, 40, 51, 0.88);
  backdrop-filter: blur(18px);
}

.hero-card strong {
  font-size: 1.2rem;
}

.hero-card span {
  padding: 12px 14px;
  border-radius: 8px;
  background: rgba(171, 194, 215, 0.22);
  font-weight: 800;
}

.quick-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  background: var(--line);
}

.quick-stats article {
  min-height: 170px;
  padding: 30px clamp(18px, 4vw, 48px);
  background: #fff;
}

.quick-stats span {
  display: block;
  margin-bottom: 12px;
  color: var(--blue-dark);
  font-weight: 1000;
}

.quick-stats strong {
  display: block;
  margin-bottom: 8px;
  font-size: 1.25rem;
}

.quick-stats p,
.section-heading p:not(.eyebrow),
.catalog-card p,
.service-band p,
.login-panel p,
footer p,
.record p {
  color: var(--muted);
  line-height: 1.6;
}

.section,
.service-band,
.workspace,
.contact-band,
footer {
  padding: 76px clamp(18px, 5vw, 72px);
}

.section-heading {
  max-width: 840px;
  margin-bottom: 30px;
}

.section-heading.compact {
  margin-bottom: 22px;
}

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

.catalog-card,
.login-panel,
.table-card,
.record,
.metric,
.report {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 22px 60px rgba(18, 32, 43, 0.09);
}

.catalog-card {
  min-height: 310px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 28px;
}

.catalog-card p {
  flex: 1;
}

.tag {
  display: inline-flex;
  margin-bottom: 18px;
  border-radius: 999px;
  padding: 8px 12px;
  background: #e4f5fb;
  color: var(--blue-dark);
  font-size: 0.82rem;
  font-weight: 900;
}

.service-band {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(320px, 1.1fr);
  gap: clamp(28px, 5vw, 64px);
  background: #eaf2f7;
  color: var(--ink);
}

.service-band p {
  color: var(--muted);
}

.service-list {
  display: grid;
  gap: 12px;
}

.service-list span {
  padding: 18px 20px;
  border-left: 4px solid var(--blue);
  background: #fff;
}

.workspace {
  background: #e7eef2;
}

.login-panel {
  max-width: 680px;
  margin: auto;
  padding: 30px;
}

.login-capabilities {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}
.login-capabilities strong { width: 100%; color: var(--ink); }
.login-capabilities span {
  padding: 7px 10px;
  border-radius: 6px;
  background: #e5f2fa;
  color: #145e8c;
  font-size: .86rem;
  font-weight: 800;
}

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

label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-weight: 800;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 13px 14px;
  background: #fff;
  color: var(--ink);
}

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

.app-shell {
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.sidebar {
  position: sticky;
  top: calc(var(--topbar) + 18px);
  display: grid;
  gap: 8px;
  padding: 18px;
  border-radius: 8px;
  background: #0b1520;
  color: #fff;
}

.sidebar p {
  margin: 0 0 10px;
  color: rgba(255, 255, 255, 0.66);
}

.nav-button {
  min-height: 44px;
  border: 0;
  border-radius: 8px;
  padding: 0 12px;
  background: transparent;
  color: rgba(255, 255, 255, 0.78);
  text-align: left;
  font-weight: 800;
  cursor: pointer;
}

.nav-button.active,
.nav-button:hover {
  background: rgba(14, 165, 233, 0.16);
  color: #fff;
}

.nav-button.ghost {
  margin-top: 12px;
  border: 1px solid rgba(255, 255, 255, 0.18);
}

.panel {
  display: none;
}

.panel.active {
  display: grid;
  gap: 18px;
}

.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.metric-grid,
.report-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.report-subheading { margin: 26px 0 14px; }

.metric,
.report {
  padding: 20px;
}

.metric span,
.report span {
  display: block;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 800;
}

.metric strong,
.report strong {
  font-size: 1.8rem;
}

.data-form {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  align-items: end;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.data-form textarea,
.data-form button {
  grid-column: span 2;
}

.records {
  display: grid;
  gap: 10px;
}

.table-card {
  display: grid;
  gap: 12px;
  padding: 20px;
}

.record {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px;
  box-shadow: none;
}

.record strong {
  display: block;
  margin-bottom: 4px;
}

.record p {
  margin: 0;
}

.status {
  flex: none;
  border-radius: 999px;
  padding: 8px 10px;
  background: #e4f5fb;
  color: var(--blue-dark);
  font-size: 0.82rem;
  font-weight: 900;
}

.catalog-record-actions {
  display: flex;
  flex: none;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.catalog-record-actions .button {
  min-width: 76px;
  padding: 7px 12px;
}

.client-registration-item .record > div:first-child { min-width: 0; }
.client-registration-item .catalog-record-actions .button { white-space: nowrap; }

.contact-band {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
  background: #dfeef6;
  color: var(--ink);
}

.contact-band h2 {
  max-width: 820px;
}

footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  background: #fff;
}

footer strong {
  font-family: var(--brand-font);
  font-size: 1.35rem;
}

footer p {
  margin: 8px 0 0;
}

footer a {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 14px;
  font-weight: 900;
}

@media (max-width: 980px) {
  .hero,
  .quick-stats,
  .catalog-grid,
  .service-band,
  .app-shell,
  .metric-grid,
  .report-grid {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
  }

  .hero-copy {
    width: min(62vw, 620px);
  }

  .data-form {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 680px) {
  :root {
    --topbar: 118px;
  }

  .topbar,
  .panel-heading,
  .record,
  .contact-band,
  footer {
    align-items: flex-start;
    flex-direction: column;
  }

  nav {
    justify-content: flex-start;
  }

  h1 {
    font-size: 2.18rem;
  }

  .hero-copy {
    width: 100%;
  }

  .hero {
    aspect-ratio: auto;
    min-height: 82vh;
    padding-bottom: 48px;
  }

  .data-form,
  .data-form textarea,
  .data-form button {
    grid-column: auto;
    grid-template-columns: 1fr;
  }
}

[hidden] {
  display: none !important;
}
[hidden] { display: none !important; }
.item-editor { grid-column: 1 / -1; min-width: 0; }
.items-scroll {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior-inline: contain;
  touch-action: auto;
  -webkit-overflow-scrolling: touch;
}
.table-scroll-tools { display: none; }
.items-table { width: 100%; border-collapse: collapse; min-width: 650px; font-size: 14px; }
.items-table th, .items-table td { padding: 10px 8px; border-bottom: 1px solid #cbd5e1; text-align: left; }
.items-table th { background: #f1f5f9; color: #17202a; }
.items-table input, .items-table select { width: 100%; min-width: 80px; box-sizing: border-box; }
.items-table .item-description { min-width: 190px; }
.items-table .item-price { min-width: 130px; }
.items-table output { white-space: nowrap; }
.remove-item { border: 0; background: transparent; color: #b91c1c; font-size: 24px; cursor: pointer; }
.add-item { margin-top: 12px; }
.document-total { text-align: right; font-size: 18px; }
.data-form label { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.client-details { padding: 12px; border-bottom: 1px solid #cbd5e1; }
.client-details summary { cursor: pointer; }
.client-details dl { display: grid; grid-template-columns: minmax(100px, 160px) minmax(0, 1fr); gap: 8px; }
.client-details dd { margin: 0; overflow-wrap: anywhere; white-space: pre-wrap; }
.registration-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0; }
.registration-tabs [aria-pressed="true"] { background: #146c45; color: white; }
.catalog-picker { margin-bottom: 6px; max-width: 280px; }
.workspace .secondary {
  color: #12202b;
  border-color: #8799a5;
  background: #ffffff;
}
.workspace .secondary:hover { background: #e1edf3; }
.workspace .registration-tabs [aria-pressed="true"] {
  background: #146a9d;
  border-color: #146a9d;
  color: #ffffff;
}
.workspace label, .workspace .eyebrow { color: #354b59; }
.workspace input::placeholder, .workspace textarea::placeholder { color: #536775; opacity: 1; }
.workspace button:focus-visible { outline: 3px solid #075985; outline-offset: 3px; }
.postal-code-control { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 7px; }
.postal-code-control input { width: 100%; min-width: 0; }
.postal-code-search {
  display: grid;
  place-items: center;
  min-width: 128px;
  min-height: 48px;
  padding: 0 12px;
  border: 1px solid #1583c5;
  border-radius: 6px;
  background: #1583c5;
  color: #fff;
  font-size: .85rem;
  font-weight: 800;
  cursor: pointer;
}
.postal-code-search:hover { background: #126fa8; }
.postal-code-search:disabled { cursor: wait; opacity: .65; }
.postal-code-field small { min-height: 18px; color: #526775; font-size: .78rem; font-weight: 700; }
.postal-code-field small.error { color: #a52424; }
.postal-code-field small.success { color: #146c45; }

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

/* Commercial workspace */
.workspace { background: #f4f7f9; }
.app-shell {
  grid-template-columns: 230px minmax(0, 1fr);
  gap: 0;
  background: #f4f7f9;
  border: 1px solid #dce5ea;
  border-radius: 8px;
  overflow: clip;
}
.workspace-bar {
  grid-column: 1 / -1;
  position: sticky;
  z-index: 30;
  top: 0;
  display: flex;
  align-items: center;
  gap: 22px;
  min-height: 72px;
  padding: 12px 24px;
  background: #fff;
  border-bottom: 1px solid #dce5ea;
  box-shadow: 0 4px 12px rgba(15, 44, 61, 0.06);
}
.workspace-brand {
  flex: none;
  color: #0c4265;
  font-family: var(--brand-font);
  font-size: 1.32rem;
  font-weight: 900;
}
.workspace-current { display: grid; gap: 2px; min-width: 130px; }
.workspace-current strong { font-size: .94rem; color: #142c3b; }
.workspace-current span { font-size: .76rem; color: #627888; }
.workspace-menu { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.workspace-menu button {
  min-height: 40px;
  padding: 0 12px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #344b59;
  font-weight: 800;
  cursor: pointer;
}
.workspace-menu button:hover, .workspace-menu button:focus-visible { background: #e6f2f9; color: #135c8f; }
.app-shell > .panel { grid-column: 2; min-width: 0; padding: 28px; }
.app-shell > .sidebar {
  grid-column: 1;
  position: static;
  align-self: stretch;
  padding: 24px 14px;
  border-radius: 0;
  border-right: 1px solid #dce5ea;
  background: #fff;
  color: #172f3d;
  box-shadow: none;
}
.sidebar-heading { display: flex; align-items: center; gap: 11px; padding: 0 8px 18px; border-bottom: 1px solid #e6ecef; }
.sidebar-avatar { display: grid; place-items: center; flex: none; width: 42px; height: 42px; border-radius: 50%; background: #e2f0f9; color: #135c8f; font-weight: 900; }
.sidebar-heading strong { color: #135c8f; }
.app-shell .sidebar-heading p { margin: 3px 0 0; color: #637684; font-size: .8rem; }
.app-shell .sidebar-title { margin: 12px 8px 3px; color: #526775; font-size: .8rem; font-weight: 900; text-transform: uppercase; }
.app-shell .nav-button { color: #334a58; }
.app-shell .nav-button.active, .app-shell .nav-button:hover { background: #e6f2f9; color: #135c8f; }
.app-shell .nav-button.ghost { border-color: #dce5ea; }
.app-shell .panel-heading h2 { margin: 0; color: #172f3d; }
.overview-tabs { display: flex; gap: 24px; border-bottom: 1px solid #d5e1e7; color: #637786; font-weight: 800; }
.overview-tabs span { display: inline-block; padding: 12px 1px; }
.overview-tabs .selected { color: #135c8f; border-bottom: 3px solid #1583c5; }
.app-shell .metric-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.app-shell .metric, .app-shell .report, .app-shell .table-card { background: #fff; border: 1px solid #e0e8ed; box-shadow: none; }
.app-shell .metric { padding: 18px; min-height: 112px; }
.app-shell .metric strong { color: #17354a; }
.app-shell .table-card { border-radius: 8px; }
@media (max-width: 1080px) {
  .workspace-bar { flex-wrap: wrap; }
  .workspace-menu { width: 100%; }
  .app-shell .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 1100px) {
  .app-shell { grid-template-columns: minmax(0, 1fr); overflow: visible; }
  .workspace-bar { padding: 14px; gap: 12px; }
  .workspace-current { min-width: 0; }
  .workspace-menu { flex-wrap: nowrap; overflow-x: auto; }
  .workspace-menu button { white-space: nowrap; }
  .app-shell > .sidebar { grid-column: 1; display: flex; align-items: center; overflow-x: auto; gap: 6px; padding: 10px 14px; border-right: 0; border-bottom: 1px solid #dce5ea; }
  .sidebar-heading, .app-shell .sidebar-title { display: none; }
  .app-shell .nav-button { flex: none; white-space: nowrap; }
  .app-shell > .panel { grid-column: 1; width: 100%; max-width: 100vw; min-width: 0; padding: 18px 14px; overflow: visible; }
  .app-shell .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .items-scroll {
    margin-right: -14px;
    padding-right: 14px;
    scrollbar-width: thin;
    scrollbar-color: #1583c5 #dce6eb;
  }
  .items-scroll::-webkit-scrollbar { height: 8px; }
  .items-scroll::-webkit-scrollbar-track { background: #dce6eb; }
  .items-scroll::-webkit-scrollbar-thumb { border-radius: 4px; background: #1583c5; }
  .table-scroll-tools {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    margin: 0 0 8px;
  }
  .table-scroll-tools span { margin-right: auto; color: #496172; font-size: .82rem; font-weight: 700; }
  .table-scroll-tools button {
    width: 44px;
    height: 40px;
    border: 1px solid #1583c5;
    border-radius: 6px;
    background: #fff;
    color: #126ca3;
    font-size: 1.35rem;
    font-weight: 900;
  }
  .items-scroll.mobile-card-list,
  .items-scroll:has(> .service-list-table) {
    width: 100%;
    max-width: 100%;
    margin-right: 0;
    padding-right: 0;
    overflow: visible !important;
  }
  .service-list-table {
    display: block;
    width: 100%;
    min-width: 0;
    background: transparent;
  }
  .service-list-table thead { display: none; }
  .service-list-table tbody { display: grid; gap: 12px; }
  .service-list-table tr {
    display: block;
    overflow: hidden;
    border: 1px solid #cbdde7;
    border-radius: 7px;
    background: #fff;
  }
  .service-list-table td {
    display: grid;
    grid-template-columns: minmax(105px, 38%) minmax(0, 1fr);
    align-items: center;
    gap: 10px;
    min-height: 44px;
    padding: 10px 12px;
    border-bottom: 1px solid #e3ebef;
    overflow-wrap: anywhere;
    white-space: normal !important;
  }
  .service-list-table td:last-child { border-bottom: 0; }
  .service-list-table td::before {
    content: attr(data-label);
    color: #496172;
    font-size: .78rem;
    font-weight: 800;
    text-transform: uppercase;
  }
  .service-list-table td:empty { display: none; }
}
@media (max-width: 500px) {
  .app-shell .metric-grid { grid-template-columns: 1fr; }
}

body.app-mode .topbar,
body.app-mode main > :not(.workspace),
body.app-mode > footer { display: none; }
body.app-mode .workspace { min-height: 100vh; padding: 0; }
body.app-mode .app-shell { min-height: 100vh; border: 0; border-radius: 0; }

.document-heading { padding: 6px 0 10px; border-bottom: 1px solid #dce6eb; }
.document-heading h2 { font-size: clamp(1.4rem, 2.4vw, 2rem); }
.document-actions, .document-footer { display: flex; align-items: center; justify-content: flex-end; gap: 10px; }
.document-actions .button, .document-footer .button { min-width: 130px; }
.app-shell .document-form { gap: 16px; padding: 24px; box-shadow: none; }
.document-form .document-section {
  grid-column: 1 / -1;
  margin: 0;
  padding-bottom: 9px;
  border-bottom: 2px solid var(--blue);
  color: var(--blue-dark);
  font-weight: 900;
}
.document-form .document-client { grid-column: span 2; }
.document-form .document-wide, .document-form .item-editor, .document-form .document-footer { grid-column: 1 / -1; }
.document-form label { color: #314c5e; font-size: .92rem; }
.document-form input, .document-form select, .document-form textarea { border-color: #c9d9e4; }
.document-form textarea { min-height: 96px; }
.document-form .document-seller { background: #f2f6f8; color: #395569; }
.document-form .item-editor { padding-top: 18px; border-top: 1px solid #dce6eb; }
.document-form .item-editor h3 { margin-bottom: 14px; }
.document-form .document-footer { padding-top: 18px; border-top: 1px solid #dce6eb; }
@media (max-width: 980px) {
  .app-shell .document-form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 680px) {
  .app-shell .document-form { grid-template-columns: 1fr; padding: 18px; }
  .document-form .document-client { grid-column: 1; }
  .document-actions, .document-footer { width: 100%; }
  .document-actions .button, .document-footer .button { flex: 1; min-width: 0; }
}

.service-list-heading { margin-bottom: 18px; }
.service-list-heading h2 { margin: 0; font-size: clamp(1.45rem, 2.4vw, 2rem); }
.service-list-tools { display: flex; align-items: end; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.service-list-tools label { min-width: 220px; flex: 1; }
.service-list-tools label:first-child { flex: 2; }
.service-list-tools input, .service-list-tools select { min-height: 44px; }
.service-summary { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 4px; color: #4b6475; }
.service-summary strong { color: var(--blue-dark); }
.finance-totals { display: flex; flex-wrap: wrap; gap: 24px; padding: 14px 0 20px; border-bottom: 1px solid #dce6eb; margin-bottom: 18px; }
.finance-totals > div { min-width: 160px; display: grid; gap: 4px; }
.finance-totals span { color: #496172; font-size: .86rem; font-weight: 700; }
.finance-totals strong { color: #173e5b; font-size: 1.2rem; font-variant-numeric: tabular-nums; }
.finance-form { margin-top: 18px; padding: 20px 0; border-top: 1px solid #dce6eb; }
.finance-form h3, .finance-form p { grid-column: 1 / -1; margin: 0; }
.finance-form-actions { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 8px; }
.finance-row-actions { white-space: nowrap; }
.finance-row-actions button + button { margin-left: 7px; }
.service-list-table { width: 100%; min-width: 850px; border-collapse: collapse; background: #fff; font-size: .9rem; }
.service-list-table th { padding: 14px 12px; border-bottom: 2px solid #dce6eb; color: #496172; font-weight: 800; text-align: left; white-space: nowrap; }
.service-list-table td { padding: 14px 12px; border-bottom: 1px solid #e3ebef; color: #1d3445; }
.service-list-table tr:hover td { background: #f1f7fb; }
.service-list-table td:nth-child(6) { white-space: nowrap; }
.service-state { display: inline-block; padding: 6px 9px; border-radius: 5px; background: #e5f2fa; color: #135c8f; font-weight: 800; white-space: nowrap; }
.document-status-select { min-width: 128px; max-width: 100%; padding: 7px 24px 7px 9px; border: 1px solid #b5d2e3; border-radius: 5px; background: #f0f8fc; color: #135c8f; font: inherit; font-weight: 700; cursor: pointer; }
.document-status-select:focus-visible { outline: 2px solid #187cbb; outline-offset: 2px; }
.service-open { border: 0; background: transparent; color: var(--blue-dark); font-weight: 900; cursor: pointer; }
.service-open:hover { text-decoration: underline; }
.service-empty { text-align: center; padding: 36px 12px !important; color: var(--muted) !important; }
.service-details { margin-top: 20px; padding: 20px; border: 1px solid #dce6eb; border-radius: 8px; background: #fff; }
.service-details h3 { margin-bottom: 14px; }
.service-details .client-details { border-top: 1px solid #dce6eb; }
.document-reopen { margin: 0 0 14px; }
@media (max-width: 680px) {
  .service-list-tools { display: grid; }
  .service-list-heading { flex-direction: row; align-items: center; }
  .service-list-heading .button { white-space: nowrap; }
}

/* Keep operational lists readable on phones and on mobile browsers using a wide viewport. */
@media (max-width: 1100px) {
  .items-scroll.mobile-card-list,
  .items-scroll:has(> .service-list-table) {
    width: 100%;
    max-width: 100%;
    margin-right: 0;
    padding-right: 0;
    overflow: visible !important;
  }
  .items-scroll > .service-list-table {
    display: block;
    width: 100%;
    min-width: 0;
    border-collapse: separate;
    background: transparent;
  }
  .service-list-table thead { display: none; }
  .service-list-table tbody { display: grid; gap: 12px; }
  .service-list-table tr {
    display: block;
    overflow: hidden;
    border: 1px solid #cbdde7;
    border-radius: 7px;
    background: #fff;
  }
  .service-list-table td,
  .service-list-table td:nth-child(6) {
    display: grid;
    grid-template-columns: minmax(105px, 38%) minmax(0, 1fr);
    align-items: center;
    gap: 10px;
    min-height: 44px;
    padding: 10px 12px;
    border-bottom: 1px solid #e3ebef;
    overflow-wrap: anywhere;
    white-space: normal;
  }
  .service-list-table td:last-child { border-bottom: 0; }
  .service-list-table td::before {
    content: attr(data-label);
    color: #496172;
    font-size: .78rem;
    font-weight: 800;
    text-transform: uppercase;
  }
  .service-list-table td:empty { display: none; }

  #quoteList td:nth-child(1)::before, #orderList td:nth-child(1)::before, #serviceList td:nth-child(1)::before, #receiptList td:nth-child(1)::before { content: "Número"; }
  #quoteList td:nth-child(2)::before, #orderList td:nth-child(2)::before, #serviceList td:nth-child(2)::before, #receiptList td:nth-child(2)::before, #cashList td:nth-child(1)::before { content: "Data"; }
  #quoteList td:nth-child(3)::before { content: "Validade"; }
  #orderList td:nth-child(3)::before { content: "Entrega"; }
  #serviceList td:nth-child(3)::before { content: "Data prevista"; }
  #quoteList td:nth-child(4)::before, #orderList td:nth-child(4)::before, #serviceList td:nth-child(4)::before, #receiptList td:nth-child(3)::before, #receivableList td:nth-child(3)::before { content: "Cliente"; }
  #quoteList td:nth-child(5)::before, #serviceList td:nth-child(5)::before { content: "Serviço"; }
  #orderList td:nth-child(5)::before, #payableList td:nth-child(2)::before, #cashList td:nth-child(3)::before { content: "Descrição"; }
  #quoteList td:nth-child(6)::before, #orderList td:nth-child(6)::before, #serviceList td:nth-child(6)::before { content: "Total"; }
  #quoteList td:nth-child(7)::before, #orderList td:nth-child(7)::before, #serviceList td:nth-child(7)::before, #receivableList td:nth-child(8)::before, #payableList td:nth-child(7)::before { content: "Situação"; }
  #quoteList td:nth-child(8)::before, #orderList td:nth-child(8)::before, #serviceList td:nth-child(8)::before, #receivableList td:nth-child(9)::before, #payableList td:nth-child(8)::before, #cashList td:nth-child(8)::before, #receiptList td:nth-child(7)::before { content: "Ações"; }

  #receivableList td:nth-child(1)::before { content: "Documento"; }
  #receivableList td:nth-child(2)::before, #payableList td:nth-child(3)::before { content: "Vencimento"; }
  #receivableList td:nth-child(4)::before, #receiptList td:nth-child(5)::before { content: "Pagamento"; }
  #receivableList td:nth-child(5)::before, #payableList td:nth-child(4)::before, #receiptList td:nth-child(6)::before { content: "Valor"; }
  #receivableList td:nth-child(6)::before { content: "Recebido"; }
  #receivableList td:nth-child(7)::before, #payableList td:nth-child(6)::before { content: "Saldo"; }

  #payableList td:nth-child(1)::before { content: "Fornecedor"; }
  #payableList td:nth-child(5)::before { content: "Pago"; }
  #cashList td:nth-child(2)::before { content: "Tipo"; }
  #cashList td:nth-child(4)::before { content: "Forma"; }
  #cashList td:nth-child(5)::before { content: "Entrada"; }
  #cashList td:nth-child(6)::before { content: "Saída"; }
  #cashList td:nth-child(7)::before { content: "Origem"; }
  #receiptList td:nth-child(4)::before { content: "Referente a"; }
}

body.preview-open { overflow: hidden; }
#documentPreview { position: fixed; z-index: 100; inset: 0; overflow: auto; padding: 20px; background: #e7edf1; }
.preview-toolbar { position: sticky; z-index: 1; top: -20px; display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; max-width: 210mm; margin: 0 auto 14px; padding: 12px; border: 1px solid #cfdae2; border-radius: 7px; background: #fff; }
.preview-toolbar strong { color: #173e5b; }
.preview-controls { display: flex; gap: 6px; flex-wrap: wrap; }
.preview-controls button { min-height: 36px; padding: 0 10px; border: 1px solid #aabfcd; border-radius: 5px; background: #fff; color: #174b70; font-weight: 800; cursor: pointer; }
.preview-controls button[aria-pressed="true"], .preview-controls button[data-preview-print] { border-color: #126fa8; background: #126fa8; color: #fff; }
.preview-share { max-width: 210mm; margin: 0 auto 14px; padding: 16px; border: 1px solid #afc8d8; border-radius: 7px; background: #fff; color: #1b3445; }
.preview-share p { margin: 8px 0 14px; line-height: 1.45; }
.preview-share > div { display: flex; flex-wrap: wrap; gap: 8px; }
.preview-share button { min-height: 38px; padding: 8px 12px; border: 1px solid #126fa8; border-radius: 5px; background: #126fa8; color: #fff; font-weight: 800; cursor: pointer; }
.preview-share button + button { background: #fff; color: #126fa8; }
.print-sheet { width: min(100%, 210mm); min-height: 297mm; margin: auto; padding: 18mm; background: #fff; color: #182c3a; box-shadow: 0 12px 35px #1b344422; }
.print-header { display: flex; justify-content: space-between; gap: 20px; padding-bottom: 18px; border-bottom: 2px solid #126fa8; }
.print-header > div { display: grid; align-content: start; gap: 4px; }
.print-header > div:last-child { text-align: right; font-size: .8rem; }
.print-brand { color: #126fa8; font-family: var(--brand-font); font-size: 1.8rem; }
.print-header span { color: #4b6272; }
.print-title { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin: 24px 0; }
.print-title h1 { margin: 0; color: #1b3042; font-size: 1.4rem; line-height: 1.2; }
.print-title span { color: #526a7b; font-size: .82rem; }
.print-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0; border-top: 1px solid #b9cbd6; border-left: 1px solid #b9cbd6; }
.print-fields > div { display: grid; gap: 3px; min-height: 58px; padding: 9px 11px; border-right: 1px solid #b9cbd6; border-bottom: 1px solid #b9cbd6; overflow-wrap: anywhere; }
.print-fields span { color: #64798a; font-size: .72rem; font-weight: 800; text-transform: uppercase; }
.print-fields strong { font-size: .88rem; }
.print-section { margin-top: 25px; }
.print-section h2 { margin: 0 0 11px; color: #173e5b; font-size: 1rem; line-height: 1.3; }
.print-section p { white-space: pre-wrap; font-size: .86rem; line-height: 1.5; }
.print-section table { width: 100%; border-collapse: collapse; font-size: .78rem; }
.print-section th, .print-section td { padding: 8px 6px; border: 1px solid #b9cbd6; text-align: left; overflow-wrap: anywhere; }
.print-section th { background: #edf4f8; }
.print-items { table-layout: fixed; }
.print-items th, .print-items td { overflow-wrap: normal; word-break: normal; }
.print-items th:not(:nth-child(2)), .print-items td:not(:nth-child(2)) { white-space: nowrap; }
.print-items th:nth-child(2), .print-items td:nth-child(2) { overflow-wrap: break-word; }
.print-items-values th:nth-child(n+4), .print-items-values td:nth-child(n+4) { text-align: right; font-variant-numeric: tabular-nums; }
.print-total { text-align: right; font-size: 1rem !important; }
.print-signatures { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; margin-top: 64px; }
.print-signatures div { padding-top: 8px; border-top: 1px solid #7e95a5; text-align: center; font-size: .82rem; }
.print-footer { display: block; margin-top: 35px; padding: 10px 0 0; border-top: 1px solid #d6e0e6; color: #6a7e8b; font-size: .72rem; text-align: right; }
@media (max-width: 680px) {
  #documentPreview { padding: 8px; }
  .preview-toolbar { top: -8px; }
  .print-sheet { min-height: 0; padding: 20px; }
  .print-header, .print-title { flex-direction: column; }
  .print-header > div:last-child { text-align: left; }
  .print-fields { grid-template-columns: 1fr; }
}
@media print {
  @page { size: A4; margin: 0; }
  body { overflow: visible !important; background: #fff; }
  body > :not(#documentPreview) { display: none !important; }
  #documentPreview { position: static; display: block !important; overflow: visible; padding: 0; background: #fff; }
  .preview-toolbar, .preview-share { display: none !important; }
  .print-sheet { width: 100%; min-height: 0; margin: 0; padding: 12mm; box-shadow: none; }
  .print-section table tr, .print-fields > div { break-inside: avoid; }
}
