:root {
  color-scheme: light;
  --ink: #142a27;
  --muted: #52645d;
  --green: #1d5e4d;
  --green-dark: #164738;
  --line: #d3dfd5;
  --paper: #fff;
  --wash: #f4f6f2;
  --sand: #f3eee1;
  --red: #8a2930;
  font: 16px/1.55 system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--wash);
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
a { color: var(--green-dark); text-underline-offset: .2em; }
button, input, select, textarea { font: inherit; }
button, summary { cursor: pointer; }
:focus-visible { outline: 3px solid #226d58; outline-offset: 3px; }
.skip { position: absolute; top: .55rem; left: .55rem; z-index: 3; transform: translateY(-200%); padding: .6rem .85rem; background: white; }
.skip:focus { transform: translateY(0); }
.wrap { width: min(1170px, calc(100% - 2rem)); margin-inline: auto; }
#main {
  position: relative;
  isolation: isolate;
  display: flow-root;
}
#main::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: clamp(16rem, 28vw, 20rem);
  z-index: -1;
  background: url("./ttn-road.jpg") center 61% / cover no-repeat;
  opacity: .2;
  pointer-events: none;
  mask-image: linear-gradient(black 64%, transparent), linear-gradient(90deg, transparent, black 2%, black 98%, transparent);
  mask-composite: intersect;
}
.top { background: var(--paper); border-bottom: 1px solid var(--line); }
.top-inner, .section-line, .actions, .upload-bottom, .footer .wrap { display: flex; align-items: center; flex-wrap: wrap; gap: .55rem .85rem; }
.top-inner, .section-line, .upload-bottom, .footer .wrap { justify-content: space-between; }
.top-inner { min-height: 4.25rem; }
.top nav { font-size: .93rem; }
.brand { display: inline-flex; align-items: center; gap: .55rem; font-weight: 780; line-height: 1.15; text-decoration: none; }
.mark { display: grid; place-items: center; width: 2.3rem; height: 2.3rem; border-radius: .6rem; background: var(--green); color: white; font-size: 1.65rem; }
.brand-subtitle { display: block; margin-top: .22rem; font-size: .64rem; letter-spacing: .067em; font-weight: 620; }
.breadcrumb { display: flex; align-items: center; gap: .55rem; margin-block: 1.35rem 1rem; color: var(--muted); font-size: .875rem; }
h1, h2, h3, p { margin: 0; overflow-wrap: anywhere; }
h1, h2, h3 { line-height: 1.16; letter-spacing: -.027em; }
h1 { font-size: clamp(2.05rem, 4.9vw, 3.7rem); }
h2 { font-size: clamp(1.2rem, 2.4vw, 1.48rem); }
h3 { font-size: 1.08rem; }
.lead { margin: .7rem 0 1.55rem; max-width: 63ch; color: var(--muted); font-size: clamp(1rem, 2.1vw, 1.18rem); }
.intro-grid { display: grid; grid-template-columns: minmax(0, 1.8fr) minmax(0, 1fr); gap: 1rem; margin-bottom: 1.1rem; }
.card { min-width: 0; padding: clamp(1rem, 2.5vw, 1.45rem); border: 1px solid var(--line); border-radius: 1rem; background: var(--paper); box-shadow: 0 4px 16px #16392d08; }
.guide { background: var(--sand); border-color: #e1d9c6; }
.guide ol { margin: .8rem 0 1rem; padding-left: 1.25rem; font-size: .95rem; }
.guide li + li { margin-top: .33rem; }
.examples { display: grid; gap: .4rem; margin-top: .9rem; font-size: .88rem; font-weight: 650; }
.drop {
  display: grid;
  grid-template-columns: max-content minmax(0,1fr) max-content;
  align-items: center;
  column-gap: 1rem;
  row-gap: .65rem;
  min-height: 7.5rem;
  margin-top: .85rem;
  padding: 1rem;
  border: 1.5px dashed #86a997;
  border-radius: .75rem;
  background: #f0f6f1;
}
.drop.dragging { background: #dfefe5; border-color: var(--green); }
.file-mark { display: grid; place-items: end center; width: 2.65rem; height: 3.15rem; padding-bottom: .45rem; border: 1px solid #a1baa7; border-radius: .35rem .8rem .35rem .35rem; color: var(--green-dark); background: #e2efe4; font-size: .66rem; font-weight: 780; }
.upload-bottom { margin-top: .75rem; }
.lock { display: inline-block; position: relative; width: .66rem; height: .55rem; margin-right: .4rem; border: 1px solid; border-radius: .13rem; vertical-align: baseline; }
.lock::before { content: ""; position: absolute; left: .12rem; top: -.36rem; width: .33rem; height: .41rem; border: 1px solid; border-radius: .24rem .24rem 0 0; }
.muted { color: var(--muted); font-size: .89rem; }
.section-line .muted { margin-top: .3rem; }
.primary, .secondary {
  min-height: 2.55rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: .47rem .8rem;
  border: 1px solid var(--line);
  border-radius: .52rem;
  font-weight: 640;
  text-decoration: none;
  text-align: center;
}
.primary { color: white; background: var(--green); border-color: var(--green); }
.primary:hover { background: var(--green-dark); border-color: var(--green-dark); }
.secondary { color: var(--green-dark); background: white; }
.secondary:hover { background: #e9f3ed; border-color: #a1b9aa; }
.text-button { color: var(--green-dark); border: 0; background: none; padding: .2rem 0; font-size: .88rem; font-weight: 670; text-decoration: underline; text-underline-offset: .2em; }
.notice { margin-top: .7rem; padding: .6rem .72rem; border-radius: .5rem; background: #edf5ee; color: #214c3c; font-size: .92rem; overflow-wrap: anywhere; }
.notice[data-kind="warn"] { background: #fbf2de; color: #6a4b21; }
.notice[data-kind="error"] { color: var(--red); background: #fdf0f0; }
.notice[data-kind="neutral"] { background: var(--wash); color: var(--muted); }
.draft-layout { display: grid; align-items: start; grid-template-columns: minmax(0, 1fr) minmax(15.6rem, .40fr); gap: 1rem; margin-top: 1rem; }
#editor, #trip-fields { display: grid; gap: 1rem; min-width: 0; }
.check-card { position: sticky; top: 1rem; display: grid; gap: .72rem; }
.check-card .notice { margin: 0; }
.check-label { display: grid; grid-template-columns: auto 1fr; align-items: start; gap: .5rem; font-size: .91rem; line-height: 1.4; }
.check-label input { width: 1rem; height: 1rem; margin: .15rem 0 0; accent-color: var(--green); }
.check-card .actions > button { flex-grow: 1; }
.error-list { color: var(--red); font-size: .87rem; }
.error-list ul { margin: 0; padding-left: 1.05rem; }
.error-list li + li { margin-top: .25rem; }
.error-list button { color: inherit; display: inline; text-align: left; }
.access-card { margin-bottom: 1.1rem; }
.access-card > [role="status"] { margin-top: .55rem; }
.checkout-dialog { width: min(27rem, calc(100% - 2rem)); color: var(--ink); }
.checkout-dialog::backdrop { background: #142a2770; }
.checkout-dialog > .muted { margin-top: .65rem; }
.checkout-form { display: grid; gap: .45rem; margin-top: .8rem; }
.checkout-form label { font-size: .9rem; font-weight: 620; }
.checkout-form input { width: 100%; min-height: 2.55rem; padding: .44rem .65rem; border: 1px solid #96a99d; border-radius: .52rem; }
.checkout-form button { justify-self: start; }
.checkout-actions { margin-top: .7rem; }
summary { font-weight: 680; }
.mapping-inner, .fields { display: grid; gap: .75rem; min-width: 0; }
.mapping-inner { margin-top: .9rem; }
.mapping-inner .primary { justify-self: start; }
.fields { grid-template-columns: repeat(2, minmax(0, 1fr)); margin-top: .7rem; }
.compact-fields { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.mapping-fields { grid-template-columns: repeat(auto-fit, minmax(min(100%, 11rem), 1fr)); }
.fields label, .item-main label { min-width: 0; display: flex; flex-direction: column; gap: .25rem; font-size: .88rem; font-weight: 640; line-height: 1.3; }
.fields small, .item-main small { color: var(--muted); font-weight: 450; }
.wide { grid-column: 1 / -1; }
.fields input, .fields select, .fields textarea, .item-main input, .item-main textarea {
  width: 100%;
  min-width: 0;
  min-height: 2.55rem;
  padding: .4rem .55rem;
  border: 1px solid #a4b8aa;
  border-radius: .45rem;
  background: white;
  color: var(--ink);
  font-size: 1rem;
  font-weight: 430;
}
.item-main textarea { resize: vertical; overflow-wrap: anywhere; }
[data-origin]:not([data-origin=""]) { background: #f0f7f1 !important; }
.fields [aria-invalid="true"], .item-main [aria-invalid="true"] { border-color: #a6353c; background: #fff5f5; }
.import-notices { margin: .72rem 0 .3rem; padding: .58rem .75rem .58rem 1.85rem; border-radius: .5rem; background: #fbf3df; color: #694a24; font-size: .88rem; }
.items { display: grid; gap: .65rem; margin: .9rem 0 .7rem; }
.item { padding: .75rem; border-radius: .62rem; border: 1px solid var(--line); background: #fcfdfb; }
.item-head { display: flex; justify-content: space-between; gap: .6rem; align-items: baseline; margin-bottom: .55rem; }
.item-head b { font-size: .9rem; }
.item-head > div { display: flex; flex-wrap: wrap; align-items: baseline; gap: .45rem; }
.item-main { display: grid; grid-template-columns: minmax(0, 1fr) minmax(4.2rem, .26fr) minmax(4rem, .23fr) minmax(5rem, .28fr); gap: .55rem; align-items: start; }
.item details { margin-top: .65rem; font-size: .89rem; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: .5rem; }
.table-wrap table { width: 100%; border-collapse: collapse; text-align: left; font-size: .87rem; }
.table-wrap :is(th, td) { padding: .36rem .57rem; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; min-width: 4rem; max-width: 16rem; }
.table-wrap th { background: var(--wash); }
.table-wrap tr:last-child > td { border-bottom: none; }
.preview { margin-top: 1rem; }
.preview-scroll { overflow-x: auto; display: grid; gap: 1rem; margin-top: .75rem; padding: 1rem; background: #e8ece8; border-radius: .6rem; }
.footnote { margin-block: 1.15rem; color: var(--muted); font-size: .88rem; }
.footer { border-top: 1px solid var(--line); color: var(--muted); background: var(--paper); padding-block: .9rem 1.2rem; font-size: .88rem; }

#print-document { display: none; }
.ttn-sheet { font: 11pt/1.32 "Segoe UI", Arial, sans-serif; color: #172022; background: white; }
.preview-scroll .ttn-sheet { min-width: 860px; padding: 1.6rem; border: 1px solid #c8cfca; }
.ttn-sheet h2 { margin: .45em 0 .35em; font-size: 19pt; text-align: center; }
.ttn-sheet h3 { margin: .75em 0 .45em; font-size: 12pt; text-align: center; }
.doc-num { margin-bottom: .55em; font-weight: 670; text-align: center; }
.doc-meta { display: flex; align-items: flex-start; justify-content: space-between; gap: .7rem; font-size: 9pt; }
.doc-mark { margin-bottom: .3em; text-align: center; color: #52645d; font-size: 9pt; font-weight: 700; letter-spacing: .07em; }
.doc-field { min-width: 0; min-height: 1.75em; display: flex; flex-wrap: wrap; align-content: start; gap: .04em .45em; margin-top: .17em; break-inside: avoid; }
.doc-field b { font-weight: 640; }
.doc-value { flex: 1; min-width: 7em; border-bottom: 1px solid #a9afab; overflow-wrap: anywhere; white-space: pre-line; }
.doc-pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .65em; break-inside: avoid; }
.doc-signature { display: grid; gap: .2em; margin-top: .65em; min-width: 0; break-inside: avoid; }
.doc-signature span { min-height: 1.2em; overflow-wrap: anywhere; }
.doc-signature small { font-size: 9pt; }
.ttn-sheet table { width: 100%; border-collapse: collapse; table-layout: fixed; font-size: 9pt; }
.ttn-sheet :is(th,td) { padding: .23em .3em; border: 1px solid #666; vertical-align: top; overflow-wrap: anywhere; text-align: left; }
.ttn-sheet .doc-totals th { text-align: right; }
.ttn-sheet thead { background: #eef1ee; }
.ttn-sheet tr { break-inside: avoid; }
.ttn-sheet .cargo-table th:first-child { white-space: nowrap; font-size: 8.2pt; }
.ttn-sheet .cargo-table .doc-totals th { font-size: inherit; }
.ttn-sheet .doc-index td { text-align: center; font-size: 8pt; }
.ttn-sheet .doc-reference { font-weight: 650; padding-block: .42em; }
.ttn-sheet .doc-qty { display: block; margin-top: .15em; font-size: .9em; }
.operations-table th:first-child { width: 22%; }
.doc-notes { margin-top: .65em; font-size: 8.5pt; break-inside: avoid; }

@media (max-width: 850px) {
  .draft-layout { grid-template-columns: minmax(0, 1fr); }
  .check-card { position: static; }
}
@media (max-width: 700px) {
  #main::before { background-position-x: 80%; }
  .intro-grid { grid-template-columns: minmax(0, 1fr); }
  .compact-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 510px) {
  .wrap { width: calc(100% - 1.2rem); }
  .drop { grid-template-columns: max-content minmax(0,1fr); column-gap: .75rem; min-height: 0; }
  .drop .primary { grid-column: 1 / -1; }
  .fields { grid-template-columns: minmax(0, 1fr); }
  .item-main { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .item-main label:first-child { grid-column: 1 / -1; }
  .section-line .secondary { min-height: 2.3rem; }
}
@media print {
  @page { size: A4 landscape; margin: 11mm; }
  :root, body { background: white; }
  #interface { display: none !important; }
  #print-document { display: block; }
  .ttn-sheet { break-before: page; }
  .ttn-sheet:first-child { break-before: auto; }
  .ttn-sheet thead { display: table-header-group; }
  .ttn-sheet .doc-pair { margin-top: .12em; }
  .ttn-sheet h2 { break-after: avoid; }
}
