:root {
  color-scheme: light;
  --ink: #172820;
  --muted: #4e6257;
  --accent: #235944;
  --dark: #101f1a;
  --line: #d3ddd4;
  --paper: #f1f3ea;
  --white: #fff;
  --lime: #d8ef9c;
  font-family:
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    sans-serif;
}
* {
  box-sizing: border-box;
}
html {
  scroll-padding-top: 16px;
}
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  line-height: 1.5;
}
.shell {
  width: min(1120px, calc(100% - 32px));
  margin-inline: auto;
}
.masthead {
  background: var(--dark);
  color: var(--white);
}
.masthead header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 66px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 0.45em;
  font-weight: 800;
  letter-spacing: 0.055em;
}
.brand-symbol {
  font-size: 1.5em;
  line-height: 1;
  color: var(--lime);
}
.brand-pro {
  color: var(--lime);
}
.header-button {
  background: transparent;
  color: var(--white);
  border: 1px solid #65786c;
  font-size: 0.85rem;
}
.intro {
  padding-block: 32px 22px;
}
.machine {
  color: var(--accent);
  font-weight: 670;
  font-size: 0.87rem;
  margin: 0;
}
.machine span {
  margin-inline: 0.15em;
}
h1 {
  font-size: clamp(2.1rem, 7vw, 3.65rem);
  line-height: 1.06;
  letter-spacing: -0.052em;
  margin: 0.22em 0 0.32em;
}
h2 {
  font-size: 1.22rem;
  letter-spacing: -0.025em;
  margin: 0 0 12px;
}
h3 {
  font-size: 1rem;
  margin: 18px 0 6px;
}
nav {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
}
nav a {
  color: var(--accent);
  font-weight: 650;
  text-underline-offset: 3px;
  padding-block: 5px;
}
.layout {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
  padding-bottom: 32px;
}
.panel {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 15px;
  padding: 20px;
  margin-bottom: 14px;
}
.chatpanel {
  border-color: #afc8b5;
}
.chatpanel > p.sub {
  margin-top: -5px;
}
.fields,
.result-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
label {
  display: block;
  font-size: 0.87rem;
  font-weight: 680;
  color: var(--ink);
}
input,
select,
button,
textarea {
  font: inherit;
}
input,
select,
textarea {
  display: block;
  width: 100%;
  margin-top: 5px;
  padding: 10px;
  border: 1px solid #a9bbad;
  border-radius: 8px;
  background: var(--white);
  color: var(--ink);
  min-width: 0;
  min-height: 44px;
  font-size: 1rem;
}
input[type="file"] {
  border-style: dashed;
  background: #f4f8f2;
  max-width: 100%;
}
input::file-selector-button {
  color: var(--ink);
  border: 0;
  border-radius: 5px;
  padding: 6px;
  background: #e4ede3;
  font: inherit;
}
textarea {
  min-height: 130px;
  resize: vertical;
}
button {
  border: 1px solid transparent;
  background: var(--accent);
  color: var(--white);
  padding: 10px 14px;
  border-radius: 8px;
  font-weight: 680;
  min-height: 44px;
  cursor: pointer;
}
button.secondary {
  background: #e8f0e7;
  color: #224c3b;
}
button.text-button {
  background: transparent;
  color: var(--accent);
}
button:disabled {
  opacity: 0.55;
  cursor: default;
}
:focus-visible {
  outline: 3px solid #457c62;
  outline-offset: 3px;
}
.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}
.sub,
.hint,
small {
  color: var(--muted);
}
small,
.hint,
#ratestatus,
#status {
  font-size: 0.85rem;
}
small {
  display: block;
  margin-top: 7px;
}
.reference {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}
#referencepreview img {
  height: auto;
  max-height: 210px;
}
.result {
  background: var(--dark);
  color: var(--white);
  border-color: var(--dark);
}
.result .sub,
.result small {
  color: #d4e0d6;
}
.price {
  font-size: clamp(2.1rem, 6vw, 3.25rem);
  font-weight: 800;
  letter-spacing: -0.055em;
  line-height: 1.1;
  margin-block: 8px;
  color: var(--lime);
}
.price[data-preliminary="true"] + .sub::after {
  content: " · Preliminar";
}
.line {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding-block: 7px;
  border-bottom: 1px solid #e5ebe3;
  font-size: 0.88rem;
  font-variant-numeric: tabular-nums;
}
.line:last-child {
  border: 0;
}
.line strong {
  text-align: right;
}
.note {
  background: #edf4eb;
  color: #244437;
  padding: 11px;
  border-radius: 8px;
  margin-top: 12px;
  font-size: 0.9rem;
}
.warn,
.missing {
  color: #70421a;
  background: #fff4e4;
}
.hidden {
  display: none !important;
}
summary {
  cursor: pointer;
  font-weight: 720;
}
#groups .line {
  align-items: center;
  overflow-wrap: anywhere;
}
#groups select {
  max-width: 140px;
  margin: 0;
}
#measure {
  position: absolute;
  left: -100000px;
  top: 0;
  opacity: 0;
  pointer-events: none;
}
#printout {
  display: none;
}
.preview {
  display: flex;
  gap: 8px;
  overflow: auto;
}
.preview img {
  height: 88px;
  max-width: 100%;
  object-fit: contain;
  border: 1px solid var(--line);
  border-radius: 8px;
  margin-top: 10px;
}
.result-fields {
  gap: 7px;
  margin-top: 12px;
}
.result-fields div {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px;
  overflow-wrap: anywhere;
}
.result-fields b {
  display: block;
  font-size: 0.76rem;
}
progress {
  width: 100%;
  margin-top: 10px;
  accent-color: var(--accent);
}
.chat-help {
  margin-top: 15px;
  font-size: 0.86rem;
}
#ratestatus:empty,
#status:empty {
  display: none;
}
dialog {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0;
  color: var(--ink);
  width: min(450px, calc(100% - 30px));
  max-height: 85dvh;
}
dialog::backdrop {
  background: rgb(16 31 26 / 0.66);
}
.dialog-inner {
  padding: 20px;
}
@media (max-width: 760px) {
  .layout {
    grid-template-columns: 1fr;
    gap: 0;
  }
  .intro {
    padding-block: 25px 16px;
  }
  .panel {
    padding: 16px;
  }
}
@media (max-width: 350px) {
  .shell {
    width: calc(100% - 20px);
  }
  .brand {
    font-size: 0.86rem;
  }
  .fields {
    grid-template-columns: 1fr;
  }
}
@media print {
  body {
    background: #fff;
    color: #000;
  }
  .masthead,
  .intro,
  .layout,
  dialog,
  #measure {
    display: none !important;
  }
  #printout {
    display: block;
    white-space: pre-wrap;
    font:
      13pt/1.65 system-ui,
      sans-serif;
  }
}
