:root {
  --bg: #efe5d7;
  --paper: #fffdf9;
  --paper-deep: #fffaf2;
  --ink: #1e1915;
  --muted: #6c6258;
  --line: rgba(44, 31, 21, 0.28);
  --line-strong: rgba(44, 31, 21, 0.45);
  --accent: #b64926;
  --accent-dark: #7d2d18;
  --sender: #ed1748;
  --consignee: #0082c8;
  --carrier: #00a94f;
  --archive: #22201f;
  --shadow: 0 28px 80px rgba(53, 30, 12, 0.14);
  --radius-xl: 26px;
  --radius-lg: 18px;
  --radius-md: 12px;
  --sheet-width: 1040px;
  --cargo-grid: 1.7fr 0.95fr 1.25fr 1.3fr 1fr 0.95fr 0.9fr;
}

* {
  box-sizing: border-box;
}

html {
  color-scheme: light;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "IBM Plex Sans", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(237, 23, 72, 0.12), transparent 26%),
    radial-gradient(circle at top right, rgba(0, 130, 200, 0.12), transparent 24%),
    linear-gradient(180deg, #f7f2ea 0%, var(--bg) 100%);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.14) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.14) 1px, transparent 1px);
  background-size: 28px 28px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.32), transparent 90%);
}

.page-shell {
  width: min(1360px, calc(100% - 32px));
  margin: 0 auto;
  padding: 26px 0 40px;
}

.studio-header {
  display: grid;
  grid-template-columns: 1.4fr 0.82fr;
  gap: 20px;
  margin-bottom: 20px;
}

.studio-copy,
.studio-side,
.cmr-form {
  border: 1px solid rgba(255, 255, 255, 0.45);
  border-radius: var(--radius-xl);
  backdrop-filter: blur(16px);
  box-shadow: var(--shadow);
}

.studio-copy {
  padding: 30px 32px;
  background:
    linear-gradient(135deg, rgba(255, 251, 245, 0.96), rgba(255, 247, 239, 0.86)),
    linear-gradient(180deg, rgba(182, 73, 38, 0.08), transparent);
}

.studio-side {
  padding: 28px;
  background: linear-gradient(180deg, rgba(255, 254, 250, 0.92), rgba(251, 245, 236, 0.88));
}

.eyebrow {
  margin: 0 0 12px;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent-dark);
}

h1,
h2 {
  margin: 0;
  font-family: "Space Grotesk", sans-serif;
  letter-spacing: -0.03em;
}

h1 {
  max-width: 11ch;
  font-size: clamp(2.5rem, 5vw, 4.6rem);
  line-height: 0.96;
}

h2 {
  font-size: clamp(1.15rem, 2vw, 1.55rem);
}

.studio-text,
.status-text,
.side-note,
.toolbar-copy p,
.box-title,
.document-copy p,
.document-legal,
.blank-note,
.settlement-visual {
  color: var(--muted);
}

.studio-text {
  max-width: 58ch;
  margin: 18px 0 0;
  font-size: 1.04rem;
  line-height: 1.65;
}

.status-label {
  margin: 0;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent-dark);
}

.status-text {
  margin: 10px 0 0;
  font-size: 1rem;
  font-weight: 700;
}

.side-note {
  margin: 18px 0 0;
  line-height: 1.55;
}

.cmr-form {
  padding: 18px;
  background:
    linear-gradient(180deg, rgba(255, 252, 246, 0.96), rgba(255, 248, 240, 0.9)),
    linear-gradient(135deg, rgba(182, 73, 38, 0.05), transparent 60%);
}

.toolbar {
  position: sticky;
  top: 14px;
  z-index: 10;
  display: flex;
  justify-content: flex-end;
  gap: 20px;
  align-items: flex-start;
  padding: 18px 20px;
  margin-bottom: 18px;
  border: 1px solid rgba(255, 255, 255, 0.55);
  border-radius: 20px;
  background: rgba(255, 250, 244, 0.88);
  backdrop-filter: blur(18px);
  box-shadow: 0 20px 36px rgba(91, 53, 28, 0.08);
}

.toolbar-copy p {
  margin: 8px 0 0;
  max-width: 60ch;
}

.copy-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}

.copy-chip {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 10px 14px;
  border-radius: 999px;
  font-size: 0.92rem;
  font-weight: 700;
  color: white;
}

.copy-chip.sender {
  background: var(--sender);
}

.copy-chip.consignee {
  background: var(--consignee);
}

.copy-chip.carrier {
  background: var(--carrier);
}

.copy-chip.archive {
  background: var(--archive);
}

.toolbar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: flex-end;
}

.button {
  appearance: none;
  border: 0;
  border-radius: 999px;
  padding: 15px 22px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  transition:
    transform 160ms ease,
    box-shadow 160ms ease,
    opacity 160ms ease;
}

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

.button:active {
  transform: translateY(0);
}

.button-primary {
  color: white;
  background: linear-gradient(135deg, var(--accent), #d67030);
  box-shadow: 0 18px 38px rgba(182, 73, 38, 0.28);
}

.button-secondary {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid rgba(30, 25, 21, 0.12);
}

.sheet-scroll {
  overflow-x: auto;
  padding-bottom: 6px;
}

.cmr-sheet {
  width: var(--sheet-width);
  margin: 0 auto;
  padding: 22px;
  border: 2px solid rgba(77, 47, 22, 0.18);
  border-radius: 24px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(255, 251, 245, 0.96)),
    repeating-linear-gradient(
      0deg,
      rgba(145, 117, 88, 0.04),
      rgba(145, 117, 88, 0.04) 2px,
      transparent 2px,
      transparent 16px
    );
  box-shadow: 0 24px 62px rgba(72, 44, 18, 0.1);
}

.cmr-grid-top {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
}

.cmr-column,
.cmr-grid-bottom {
  display: grid;
  gap: 0;
}

.cmr-box {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 10px 12px 12px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.72);
}

.box-tall {
  min-height: 132px;
}

.box-medium {
  min-height: 98px;
}

.short-box {
  min-height: 86px;
}

.notes-box {
  min-height: 170px;
}

.document-box {
  min-height: 132px;
  justify-content: space-between;
}

.document-grid {
  display: grid;
  grid-template-columns: 1.3fr 0.8fr;
  gap: 14px;
  align-items: start;
}

.document-copy p,
.box-title p {
  margin: 0;
}

.document-kicker {
  font-weight: 700;
  color: var(--ink);
}

.document-legal {
  font-size: 0.72rem;
  line-height: 1.35;
}

.box-head {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 8px;
  align-items: start;
}

.box-number {
  min-width: 22px;
  font-family: "Space Grotesk", sans-serif;
  font-size: 1.15rem;
  font-weight: 700;
  color: #b03c25;
}

.box-title {
  display: grid;
  gap: 2px;
  font-size: 0.73rem;
  line-height: 1.18;
}

.cmr-entry {
  display: grid;
  gap: 6px;
}

.cmr-entry span:not(.sr-only) {
  font-size: 0.73rem;
  font-weight: 700;
  color: var(--accent-dark);
}

.cmr-entry input,
.cmr-entry textarea {
  width: 100%;
  border: 1px dashed rgba(182, 73, 38, 0.28);
  border-radius: 10px;
  padding: 9px 10px;
  font: inherit;
  color: var(--ink);
  background: rgba(255, 253, 248, 0.86);
  transition:
    border-color 160ms ease,
    box-shadow 160ms ease,
    background-color 160ms ease;
}

.cmr-entry textarea {
  min-height: 72px;
  resize: none;
  line-height: 1.35;
}

.cmr-entry input {
  min-height: 40px;
}

.cmr-entry input:focus,
.cmr-entry textarea:focus {
  outline: none;
  border-color: rgba(182, 73, 38, 0.65);
  box-shadow: 0 0 0 4px rgba(182, 73, 38, 0.12);
  background: #fff;
}

.inline-entry {
  margin-top: auto;
}

.cmr-number-entry {
  align-self: stretch;
}

.split-entry {
  display: grid;
  gap: 10px;
}

.split-entry-wide {
  grid-template-columns: 1.35fr 0.75fr;
}

.blank-box {
  justify-content: space-between;
}

.blank-note {
  margin: 0;
  font-size: 0.82rem;
  line-height: 1.45;
}

.cargo-section {
  margin-top: 0;
  border-left: 1px solid var(--line);
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.cargo-header,
.cargo-row {
  display: grid;
  grid-template-columns: var(--cargo-grid);
}

.cargo-head-cell {
  min-height: 74px;
  padding: 10px 10px 9px;
  border-top: 1px solid var(--line);
  border-right: 1px solid var(--line);
  background: rgba(255, 251, 244, 0.85);
  font-size: 0.72rem;
  line-height: 1.12;
  color: var(--muted);
}

.cargo-head-cell:last-child {
  border-right: 0;
}

.cargo-head-cell strong {
  display: block;
  margin-bottom: 6px;
  font-family: "Space Grotesk", sans-serif;
  font-size: 1rem;
  color: #b03c25;
}

.cargo-head-cell span {
  display: block;
}

.cargo-row {
  border-top: 1px solid var(--line);
}

.cargo-cell {
  border-right: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.64);
}

.cargo-cell:last-child {
  border-right: 0;
}

.cargo-cell input {
  min-height: 44px;
  border: 0;
  border-radius: 0;
  padding: 10px 10px;
  background: transparent;
  box-shadow: none;
}

.cargo-cell input:focus {
  background: rgba(255, 249, 240, 0.9);
  box-shadow: inset 0 0 0 1px rgba(182, 73, 38, 0.45);
}

.adr-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr 1fr;
  gap: 0;
  border-top: 1px solid var(--line);
}

.adr-row .cmr-entry {
  padding: 10px 10px 12px;
  border-right: 1px solid var(--line);
  background: rgba(255, 251, 244, 0.82);
}

.adr-row .cmr-entry:last-child {
  border-right: 0;
}

.adr-row .cmr-entry input {
  min-height: 38px;
}

.cmr-grid-bottom {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
}

.mini-settlement {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.settlement-entry-box {
  min-height: 164px;
}

.settlement-visual-box {
  min-height: 164px;
}

.settlement-visual {
  display: grid;
  gap: 7px;
  font-size: 0.78rem;
  line-height: 1.25;
}

.signature-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1.05fr;
  gap: 0;
}

.signature-box {
  min-height: 96px;
}

.signature-box .box-title {
  gap: 4px;
}

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

@media (max-width: 1120px) {
  .studio-header {
    grid-template-columns: 1fr;
  }

  .toolbar {
    position: static;
    flex-direction: column;
  }

  .toolbar-actions {
    width: 100%;
    justify-content: flex-start;
  }
}

@media (max-width: 760px) {
  .page-shell {
    width: min(100% - 18px, 100%);
    padding-top: 18px;
  }

  .studio-copy,
  .studio-side,
  .cmr-form {
    border-radius: 22px;
  }

  .studio-copy,
  .studio-side,
  .cmr-form {
    padding-left: 18px;
    padding-right: 18px;
  }

  .toolbar-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .button {
    width: 100%;
    text-align: center;
  }
}
