:root {
  --ink: #2c234d;
  --muted: #64676c;
  --line: #e1ebf7;
  --paper: #ffffff;
  --section: #f7f7fd;
  --panel: #ffffff;
  --card: #ffffff;
  --navy: #000c20;
  --theme: #f15f22;
  --theme-strong: #ff5f13;
  --theme-deep: #e0581e;
  --blue-text: #10285d;
  --danger: #f44a40;
  --radius: 6px;
  --shadow: 0 10px 30px rgba(25, 25, 25, 0.08);
  --font: "Barlow", sans-serif;
  --display: "Teko", sans-serif;
}

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

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: var(--font);
  color: var(--ink);
  background: var(--paper);
}

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

button {
  cursor: pointer;
}

.metta-section {
  background: var(--section);
  padding: 80px 0 100px;
}

/* Align hero title with secondary pages */
.metta-hero .hero-cap h2 {
  font-size: 70px;
}

@media (max-width: 767px) {
  .metta-hero .hero-cap h2 {
    font-size: 35px;
  }
}

.shell {
  display: block;
  min-height: 0;
}

/* ——— Workspace ——— */
.workspace {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  position: relative;
  overflow-x: clip;
  max-width: none;
  margin: 0;
  background: transparent;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 22px 28px;
  margin-bottom: 24px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.section-label {
  display: block;
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--theme);
}

.brand-inline h1 {
  margin: 6px 0 0;
  font-family: var(--display);
  font-size: 2rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  line-height: 1.1;
  color: var(--ink);
  text-transform: uppercase;
}

.topbar > div:first-child {
  min-width: 0;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  flex-shrink: 0;
}

.view-toggle {
  display: inline-flex;
  padding: 4px;
  border-radius: 5px;
  background: var(--section);
  border: 1px solid var(--line);
}

.toggle {
  border: 0;
  background: transparent;
  border-radius: 4px;
  padding: 8px 16px;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.toggle.active {
  background: var(--theme);
  color: #fff;
}

.content {
  flex: 1;
  padding: 0;
  min-height: 0;
  overflow: visible;
}

.form-view,
.preview-view {
  display: none;
}

.form-view.active {
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: 100%;
  max-width: none;
  margin: 0;
}

.form-view.active .panel {
  display: block;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 28px 28px;
  box-shadow: none;
}

.panel-intro {
  margin-bottom: 18px;
}

.panel-intro.row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
}

.panel-intro h3 {
  margin: 0 0 6px;
  font-family: var(--display);
  font-size: 1.65rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--ink);
}

.panel-intro p {
  margin: 0;
  color: var(--muted);
  max-width: 48ch;
  line-height: 1.5;
}

.field-grid {
  display: grid;
  gap: 14px;
}

.cols-1 {
  grid-template-columns: 1fr;
}

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

.cols-3 {
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

.span-2 {
  grid-column: span 2;
}

.span-3 {
  grid-column: span 3;
}

.span-all {
  grid-column: 1 / -1;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.field > span {
  font-size: 0.84rem;
  font-weight: 600;
  color: #57667e;
  text-transform: capitalize;
}

.field input,
.field select,
.field textarea,
.data-table input {
  width: 100%;
  border: 1px solid #efebeb;
  border-radius: 5px;
  background: #fff;
  color: #222;
  padding: 12px 14px;
  font-weight: 500;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.field input::placeholder,
.field textarea::placeholder {
  color: #616875;
  font-weight: 400;
}

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

.field input:focus,
.field select:focus,
.field textarea:focus,
.data-table input:focus {
  outline: none;
  border-color: var(--theme);
  box-shadow: 0 0 0 3px rgba(241, 95, 34, 0.18);
}

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

.card {
  background: #f9f9f9;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
}

.card h4 {
  margin: 0 0 14px;
  font-family: var(--display);
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--ink);
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.card-head h4 {
  margin: 0;
}

.switch {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--muted);
}

.switch input {
  width: 16px;
  height: 16px;
  accent-color: var(--theme);
}

.table-card {
  overflow: auto;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(24, 39, 48, 0.04);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
}

.data-table th,
.data-table td {
  padding: 10px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

.data-table th {
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  background: rgba(24, 78, 91, 0.04);
}

.data-table input {
  min-width: 72px;
  padding: 9px 10px;
}

.btn-icon {
  border: 0;
  background: transparent;
  color: var(--danger);
  font-size: 1.2rem;
  line-height: 1;
  padding: 4px 8px;
}

.btn {
  border: 1px solid transparent;
  border-radius: 5px;
  padding: 12px 18px;
  font-weight: 600;
  font-size: 0.88rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.btn:hover {
  transform: none;
}

.btn:active {
  transform: none;
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn-soft {
  background: #fff;
  border-color: var(--line);
  color: var(--ink);
}

.btn-soft:hover {
  border-color: var(--theme);
  color: var(--theme);
}

.panel .btn-soft {
  background: #fff;
  border-color: var(--line);
  color: var(--ink);
}

.panel .btn-soft:hover {
  border-color: var(--theme);
  color: var(--theme);
}

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

.topbar .btn-primary,
.btn-primary {
  background: var(--theme-strong);
  color: #fff;
  border-color: var(--theme-strong);
}

.topbar .btn-primary:hover,
.btn-primary:hover {
  background: var(--theme-deep);
  border-color: var(--theme-deep);
  color: #fff;
}

/* ——— Preview ——— */
.preview-view.active {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.preview-toolbar {
  margin-bottom: 12px;
}

.preview-toolbar p {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.preview-scroll {
  flex: 1;
  overflow: auto;
  padding: 24px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: #fff;
}

/* ——— Meta Shipping PDF (match original) ——— */
.bl-doc {
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 24px;
  font-family: Arial, Helvetica, sans-serif;
  width: 765px;
}

.bl-page {
  background: #fff;
  color: #111;
  box-shadow: var(--shadow);
}

.bl-page-1 {
  width: 765px;
  min-height: 990px;
  padding: 14px 16px 12px;
  box-sizing: border-box;
}

.bl-page-2 {
  width: 765px;
  min-height: 990px;
  padding: 36px 40px;
  box-sizing: border-box;
}

.ms-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 8px;
  padding-bottom: 6px;
}

.ms-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.ms-logo {
  width: 72px;
  height: auto;
  display: block;
}

.ms-brand-name {
  font-size: 22px;
  font-weight: 700;
  color: #111;
}

.ms-title {
  margin: 0;
  font-size: 26px;
  font-weight: 700;
  color: #1f4e79;
  letter-spacing: 0.02em;
}

.ms-sheet {
  border: 1px solid #2f5597;
  width: 100%;
  box-sizing: border-box;
}

.ms-row {
  display: flex;
  border-bottom: 1px solid #2f5597;
}

.ms-row:last-child {
  border-bottom: 0;
}

.ms-cell {
  padding: 3px 6px 5px;
  border-right: 1px solid #2f5597;
  min-width: 0;
}

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

.ms-label {
  font-size: 9px;
  font-style: italic;
  font-weight: 700;
  color: #2f5597;
  line-height: 1.2;
  text-transform: none;
}

.ms-val {
  font-size: 11px;
  font-weight: 700;
  color: #111;
  line-height: 1.25;
  text-transform: uppercase;
  word-break: break-word;
}

.ms-pre {
  white-space: pre-wrap;
  text-transform: uppercase;
}

.ms-row-shipper > .ms-shipper {
  width: 52%;
}

.ms-row-shipper > .ms-right-stack {
  width: 48%;
  display: flex;
  flex-direction: column;
  border-right: 0;
}

.ms-right-stack {
  min-width: 0;
}

.ms-right-stack > .ms-row {
  border-bottom: 1px solid #2f5597;
}

.ms-right-stack > .ms-row .ms-cell {
  width: 50%;
}

.ms-right-stack > .ms-cell {
  border-right: 0;
  border-bottom: 1px solid #2f5597;
}

.ms-right-stack > .ms-cell:last-child {
  border-bottom: 0;
}

.ms-right-stack > .ms-row {
  border-bottom: 1px solid #2f5597;
}

.ms-grow {
  flex: 1;
}

.ms-row-consignee > .ms-consignee {
  width: 52%;
  min-height: 110px;
}

.ms-row-consignee > .ms-right-stack {
  width: 48%;
  display: flex;
  flex-direction: column;
}

.ms-row-notify > .ms-cell {
  width: 50%;
  min-height: 54px;
}

.ms-half {
  width: 50%;
}

.ms-empty {
  min-height: 34px;
}

.ms-row-3 > .ms-cell {
  width: 33.333%;
}

.ms-row-4 > .ms-cell {
  width: 25%;
}

.ms-particulars-head {
  border-bottom: 1px solid #2f5597;
  text-align: center;
  font-size: 10px;
  font-weight: 700;
  color: #2f5597;
  padding: 3px 6px;
  letter-spacing: 0.02em;
}

.ms-cargo-head,
.ms-cargo-body,
.ms-cargo-foot {
  display: grid;
  grid-template-columns: 1.1fr 0.7fr 2.4fr 0.85fr 0.85fr;
}

.ms-cargo-head {
  border-bottom: 1px solid #2f5597;
}

.ms-cargo-head > div {
  padding: 3px 5px;
  font-size: 9px;
  font-style: italic;
  font-weight: 700;
  color: #2f5597;
  border-right: 1px solid #2f5597;
}

.ms-cargo-head > div:last-child,
.ms-cargo-body > div:last-child {
  border-right: 0;
}

.ms-cargo-body {
  border-bottom: 1px solid #2f5597;
  min-height: 150px;
}

.ms-cargo-body > div {
  padding: 5px;
  border-right: 1px solid #2f5597;
}

.ms-spacer {
  height: 10px;
}

.ms-cargo-foot {
  border-bottom: 1px solid #2f5597;
  grid-template-columns: 1.8fr 1fr;
  min-height: 70px;
}

.ms-terms-left,
.ms-terms-right {
  padding: 6px 8px;
}

.ms-terms-left {
  border-right: 1px solid #2f5597;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 4px;
}

.ms-terms-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: flex-end;
  text-align: right;
  gap: 4px;
}

.ms-cob {
  text-align: right;
}

.ms-dash {
  font-size: 10px;
  color: #111;
  letter-spacing: 0;
}

.ms-cargo-weight,
.ms-cargo-cbm {
  text-align: left;
}

.ms-orig {
  margin-top: 8px;
  text-align: right;
  width: 100%;
}

.field-with-unit {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 8px;
}

.field-with-unit .unit {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: 0.04em;
}

.ms-bottom {
  display: grid;
  grid-template-columns: 1.05fr 1.35fr;
  min-height: 220px;
}

.ms-charges {
  border-right: 1px solid #2f5597;
  display: flex;
  flex-direction: column;
}

.ms-charge-head,
.ms-charge-body,
.ms-charge-total {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr;
}

.ms-charge-head {
  border-bottom: 1px solid #2f5597;
}

.ms-charge-head > div,
.ms-charge-body > div,
.ms-charge-total > div {
  padding: 4px 6px;
  border-right: 1px solid #2f5597;
  font-size: 10px;
  font-weight: 700;
  color: #2f5597;
  min-height: 22px;
}

.ms-charge-head > div:last-child,
.ms-charge-body > div:last-child,
.ms-charge-total > div:last-child {
  border-right: 0;
}

.ms-charge-body {
  flex: 1;
  border-bottom: 1px solid #2f5597;
}

.ms-freight-arranged {
  font-size: 13px;
  font-weight: 700;
  color: #111;
  text-transform: uppercase;
  padding-top: 18px !important;
}

.ms-charge-total > div:first-child {
  text-align: right;
  color: #111;
}

.ms-legal {
  padding: 6px 8px 4px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 8.5px;
  line-height: 1.25;
  color: #111;
}

.ms-ear {
  font-size: 8px;
  font-weight: 700;
  text-transform: uppercase;
}

.ms-surrender,
.ms-witness,
.ms-attention {
  font-size: 8px;
}

.ms-signblock {
  margin-top: 4px;
}

.ms-sign-company {
  font-size: 13px;
  font-weight: 700;
  color: #1f4e79;
  text-transform: none;
}

.ms-sign-line {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 10px;
  font-size: 11px;
  font-weight: 700;
}

.ms-for-co {
  text-align: right;
  font-size: 9px;
  margin-top: 4px;
  border-top: 1px solid #2f5597;
  padding-top: 2px;
}

.ms-attention {
  border: 1px solid #2f5597;
  padding: 4px 6px;
  margin-top: 4px;
}

.ms-attention strong {
  font-weight: 700;
}

/* Page 2 container list */
.cl-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 14px;
}

.cl-head h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.cl-blno {
  font-size: 14px;
  font-weight: 700;
}

.cl-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
}

.cl-table th,
.cl-table td {
  border: 1px solid #2f5597;
  padding: 6px 8px;
  vertical-align: middle;
}

.cl-table th {
  color: #1f4e79;
  font-weight: 700;
  text-align: left;
  font-size: 11px;
}

.cl-table td.num,
.cl-table th:nth-child(4),
.cl-table th:nth-child(6),
.cl-table th:nth-child(7) {
  text-align: right;
}

.cl-total-label {
  font-weight: 700;
  text-align: center;
}

.cl-table tfoot td {
  font-weight: 700;
}

.exporting,
.exporting body {
  overflow: hidden !important;
}

.exporting .shell,
.exporting .workspace,
.exporting .content,
.exporting .preview-view,
.exporting .preview-scroll {
  overflow: visible !important;
  height: auto !important;
  max-height: none !important;
}

.exporting .workspace {
  overflow-x: visible !important;
}

.exporting .preview-toolbar,
.exporting .header-area,
.exporting #preloader-active,
.exporting .topbar,
.exporting .slider-area,
.exporting footer {
  display: none !important;
}

.exporting .metta-section {
  background: transparent;
  padding: 0;
}

.exporting .bl-doc {
  width: 765px !important;
  max-width: none !important;
  margin: 0 !important;
  gap: 0;
}

.exporting .bl-page {
  box-shadow: none;
  width: 765px !important;
  height: 990px !important;
  min-height: 990px !important;
  max-height: 990px !important;
  overflow: hidden !important;
  page-break-after: always;
  break-after: page;
}

.exporting .bl-page:last-child {
  page-break-after: auto;
  break-after: auto;
}

#pdfExportMount,
#pdfExportMount .bl-page {
  -webkit-font-smoothing: antialiased;
}

.hidden-cob #cleanOnBoardBlock {
  display: none;
}

@media (max-width: 860px) {
  .metta-section {
    padding: 50px 0 70px;
  }

  .workspace {
    max-width: none;
  }

  .brand-inline h1 {
    font-size: 1.55rem;
  }

  .cards,
  .cols-3,
  .cols-2 {
    grid-template-columns: 1fr;
  }

  .span-2,
  .span-3 {
    grid-column: auto;
  }

  .topbar {
    flex-direction: column;
    align-items: flex-start;
    padding: 18px;
  }

  .content {
    padding: 0;
  }
}
