:root {
  --green-950: #113e34;
  --green-900: #174f40;
  --green-700: #267c51;
  --green-100: #e8f3eb;
  --line: #bdd2ca;
  --cream: #fffdf5;
  --ink: #173c36;
  --muted: #687b76;
  --surface: #ffffff;
  --app-bg: #edf2ef;
  --shadow: 0 18px 50px rgba(23, 62, 52, 0.12);
}

* {
  box-sizing: border-box;
}

html {
  color-scheme: light;
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--app-bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

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

button {
  touch-action: manipulation;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 max(20px, env(safe-area-inset-left));
  background: rgba(255, 255, 255, 0.94);
  border-bottom: 1px solid rgba(23, 79, 64, 0.12);
  backdrop-filter: blur(14px);
}

.brand-mini {
  display: flex;
  align-items: center;
  gap: 11px;
}

.brand-mini>span:last-child {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}

.brand-mini strong {
  font-size: 15px;
  letter-spacing: -0.01em;
}

.brand-mini small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
}

.brand-dot {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: var(--green-900);
  color: white;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.06em;
}

.top-actions {
  display: flex;
  gap: 8px;
}

.button {
  min-height: 42px;
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: 11px;
  cursor: pointer;
  font-weight: 750;
  font-size: 13px;
  transition: transform 120ms ease, box-shadow 120ms ease, background 120ms ease;
}

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

.button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: 3px solid rgba(38, 124, 81, 0.25);
  outline-offset: 1px;
}

.button.primary {
  background: var(--green-900);
  color: white;
  box-shadow: 0 6px 18px rgba(23, 79, 64, 0.18);
}

.button.primary:hover {
  background: var(--green-950);
}

.button.ghost {
  border-color: #cbd9d4;
  background: white;
  color: var(--ink);
}

.button.share {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: #25d366;
  color: #06331a;
  box-shadow: 0 6px 18px rgba(37, 211, 102, 0.24);
}

.button.share:hover {
  background: #1fbb5a;
}

.button.share[aria-busy="true"] {
  opacity: 0.7;
  pointer-events: none;
}

.button.share svg {
  width: 17px;
  height: 17px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.toolbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.button.doc-switch {
  display: inline-grid;
  place-items: center;
  border-color: #cbd9d4;
  background: #f7faf8;
  color: var(--green-900);
  text-decoration: none;
}

.button.wide {
  width: 100%;
}

.app-shell {
  width: min(1540px, 100%);
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(350px, 440px) minmax(720px, 1fr);
  align-items: start;
  gap: 24px;
  padding: 24px;
}

.editor-panel {
  min-width: 0;
  padding-bottom: 48px;
}

.editor-intro {
  padding: 8px 4px 16px;
}

.editor-intro .eyebrow {
  margin: 0 0 5px;
  color: var(--green-700);
  font-size: 11px;
  font-weight: 850;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.editor-intro h1 {
  margin: 0;
  font-size: 27px;
  line-height: 1.15;
  letter-spacing: -0.03em;
}

.editor-intro p:last-child {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.form-card {
  margin: 0 0 14px;
  padding: 19px;
  border: 1px solid #d6e2de;
  border-radius: 17px;
  background: var(--surface);
  box-shadow: 0 8px 25px rgba(23, 62, 52, 0.045);
}

.form-card legend {
  float: left;
  width: 100%;
  margin: 0 0 15px;
  padding: 0;
  color: var(--ink);
  font-size: 15px;
  font-weight: 850;
}

.form-card legend+* {
  clear: both;
}

.form-grid {
  display: grid;
  gap: 12px;
  margin-top: 12px;
}

.form-grid:first-of-type {
  margin-top: 0;
}

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

.form-grid.three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.form-card>label {
  display: block;
}

label {
  color: #49625b;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.025em;
}

input,
textarea,
select {
  width: 100%;
  margin-top: 6px;
  border: 1px solid #cbdad5;
  border-radius: 10px;
  background: #fbfdfc;
  color: var(--ink);
  font-size: 14px;
  font-weight: 600;
}

input,
select {
  height: 44px;
  padding: 0 11px;
}

textarea {
  min-height: 84px;
  padding: 11px;
  resize: vertical;
  line-height: 1.4;
}

input:hover,
textarea:hover,
select:hover {
  border-color: #a9c2b9;
}

.date-input-wrap {
  position: relative;
  display: block;
}

.date-input-wrap input[data-date-field] {
  padding-right: 44px;
}

.date-picker-trigger {
  position: absolute;
  right: 6px;
  bottom: 6px;
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--green-700);
  cursor: pointer;
}

.date-picker-trigger:hover {
  background: var(--green-100);
}

.date-picker-trigger:focus-visible {
  outline: 3px solid rgba(38, 124, 81, 0.25);
  outline-offset: 1px;
}

.date-picker-trigger svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
}

.memo-app .memo-date-picker-trigger:hover {
  background: rgba(123, 40, 30, 0.1);
}

.memo-app .memo-date-picker-trigger:focus-visible {
  outline-color: rgba(123, 40, 30, 0.3);
}

.date-picker-native {
  position: absolute;
  right: 14px;
  bottom: 2px;
  width: 1px;
  height: 1px;
  min-height: 0;
  margin: 0;
  padding: 0;
  border: 0;
  opacity: 0;
  pointer-events: none;
}

.item-editors {
  display: grid;
  gap: 10px;
}

.item-editor {
  padding: 13px;
  border: 1px solid #d8e5e0;
  border-radius: 13px;
  background: #f8fbf9;
}

.item-editor summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  list-style: none;
  font-size: 13px;
  font-weight: 850;
}

.item-editor summary::-webkit-details-marker {
  display: none;
}

.item-editor summary::after {
  content: "+";
  font-size: 20px;
  line-height: 1;
  color: var(--green-700);
}

.item-editor[open] summary::after {
  content: "−";
}

.item-editor summary span {
  max-width: 70%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.item-editor .item-amount {
  color: var(--green-700);
  font-size: 12px;
}

.item-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  padding-top: 13px;
}

.item-fields .wide-field {
  grid-column: 1 / -1;
}

.mobile-create,
.mobile-switch {
  display: none;
}

.invoice-stage {
  min-width: 0;
  padding: 0 0 64px;
}

.preview-toolbar {
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 0 auto 10px;
  width: min(100%, 794px);
  color: #587069;
  font-size: 12px;
  font-weight: 700;
}

.preview-toolbar span {
  display: flex;
  align-items: center;
  gap: 7px;
}

.preview-toolbar i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #2aa266;
  box-shadow: 0 0 0 4px rgba(42, 162, 102, .12);
}

.preview-toolbar .button {
  min-height: 36px;
}

.invoice-shell {
  position: relative;
  width: min(100%, 794px);
  aspect-ratio: 210 / 297;
  min-height: 1123px;
  margin: 0 auto;
  padding: 37px;
  overflow: hidden;
  background: var(--cream) url("/invoice-paper.png") center / cover no-repeat;
  color: #143d36;
  box-shadow: var(--shadow);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 10px;
}

.invoice-header {
  min-height: 116px;
  display: grid;
  grid-template-columns: 88px 1fr 180px;
  align-items: center;
  gap: 14px;
  padding: 15px 20px;
  border-radius: 16px;
  background: var(--green-900);
  color: white;
}

.seller-heading h2 {
  margin: 0 0 10px;
  font-size: 23px;
  letter-spacing: .015em;
  line-height: 1;
}

.seller-heading p {
  margin: 0 0 5px;
  font-size: 12px;
}

.seller-heading strong {
  display: block;
  margin-top: 8px;
  font-size: 12px;
}

.invoice-title {
  align-self: stretch;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 11px;
}

.invoice-title strong {
  display: grid;
  place-items: center;
  min-width: 150px;
  min-height: 46px;
  padding: 0 12px;
  border-radius: 12px;
  background: #fffdf5;
  color: var(--green-900);
  font-size: 18px;
}

.invoice-title small {
  font-size: 9px;
  font-weight: 800;
  color: #d7ebdf;
}

.corn-logo {
  position: relative;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: #fff7d9;
  overflow: hidden;
}

.corn-logo::before,
.corn-logo::after {
  content: "";
  position: absolute;
  bottom: 7px;
  width: 42px;
  height: 58px;
  border-radius: 90% 10% 90% 10%;
  background: #4a9c6e;
}

.corn-logo::before {
  left: 7px;
  transform: rotate(-24deg);
}

.corn-logo::after {
  right: 7px;
  transform: scaleX(-1) rotate(-24deg);
}

.corn-cob {
  position: absolute;
  z-index: 2;
  left: 25px;
  top: 8px;
  width: 27px;
  height: 61px;
  border: 1px solid #d59322;
  border-radius: 50% 50% 42% 42%;
  background-color: #f1b943;
  background-image: radial-gradient(circle, #ffe791 0 2px, transparent 2.4px);
  background-size: 9px 9px;
  box-shadow: inset 4px 0 rgba(255, 255, 255, .28);
}

.invoice-meta {
  display: grid;
  margin-top: 13px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, .72);
}

.invoice-meta.grid-three {
  grid-template-columns: repeat(3, 1fr);
}

.invoice-meta.grid-two {
  grid-template-columns: 1.25fr 1fr;
  margin-top: 10px;
}

.invoice-meta>div {
  min-width: 0;
  padding: 8px 10px;
  border-right: 1px solid var(--line);
}

.invoice-meta>div:last-child {
  border-right: 0;
}

.invoice-meta label,
.buyer-block label,
.amount-panel label {
  display: block;
  margin-bottom: 5px;
  color: #63756f;
  font-size: 9px;
}

.invoice-meta span {
  min-height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px;
  border: 1px solid #c7d7d1;
  background: rgba(255, 253, 245, .9);
  font-size: 11px;
  font-weight: 500;
}

.buyer-block {
  min-height: 130px;
  display: grid;
  grid-template-columns: 1.6fr 1fr;
  margin-top: 10px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, .72);
}

.buyer-main {
  padding: 12px;
  background: rgba(232, 243, 235, .72);
}

.buyer-main label {
  color: var(--green-700);
}

.buyer-main span {
  min-height: 87px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px;
  border: 1px solid #c7d7d1;
  background: rgba(255, 253, 245, .9);
  text-align: center;
  white-space: pre-line;
  line-height: 1.35;
  font-size: 11px;
}

.buyer-side {
  display: grid;
  grid-template-rows: repeat(4, 1fr);
}

.buyer-side>div {
  display: grid;
  grid-template-columns: 100px 1fr;
  align-items: center;
  gap: 6px;
  padding: 5px 9px;
  border-bottom: 1px solid var(--line);
}

.buyer-side>div:last-child {
  border-bottom: 0;
}

.buyer-side label {
  margin: 0;
}

.buyer-side span {
  min-height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2px 5px;
  border: 1px solid #c7d7d1;
  background: rgba(255, 253, 245, .9);
  text-align: center;
}

.section-label {
  margin: 11px 3px 7px;
  color: var(--green-700);
  font-size: 10px;
}

.items-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  table-layout: fixed;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, .73);
}

.items-table .col-serial {
  width: 5.5%;
}

.items-table .col-particulars {
  width: 27%;
}

.items-table .col-hsn {
  width: 11.5%;
}

.items-table .col-bags {
  width: 8.3%;
}

.items-table .col-uom {
  width: 8.8%;
}

.items-table .col-qty {
  width: 11%;
}

.items-table .col-rate {
  width: 11.5%;
}

.items-table .col-value {
  width: 16.4%;
}

.items-table th {
  height: 42px;
  padding: 4px;
  border-right: 1px solid white;
  background: var(--green-900);
  color: white;
  font-size: 9px;
  line-height: 1.15;
}

.items-table th:last-child {
  border-right: 0;
}

.items-table td {
  height: 36px;
  padding: 4px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  text-align: center;
  vertical-align: middle;
  font-size: 9.5px;
  word-break: break-word;
}

.items-table td:last-child {
  border-right: 0;
}

.items-table tr:last-child td {
  border-bottom: 0;
}

.totals-area {
  display: grid;
  grid-template-columns: 1.55fr .95fr;
  gap: 10px;
  margin-top: 10px;
}

.amount-panel,
.tax-panel {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, .72);
}

.payment-row {
  min-height: 43px;
  display: grid;
  grid-template-columns: 145px 1fr;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  border-bottom: 1px solid var(--line);
}

.payment-row label,
.words-row label {
  margin: 0;
  color: var(--green-700);
}

.payment-row span {
  min-height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3px;
  border: 1px solid #c7d7d1;
  background: rgba(255, 253, 245, .9);
  font-size: 10px;
}

.words-row {
  min-height: 70px;
  padding: 10px 12px;
}

.words-row strong {
  min-height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 7px;
  padding: 5px 10px;
  border: 1px solid #c7d7d1;
  background: rgba(255, 253, 245, .9);
  text-align: center;
  font-size: 9.5px;
  line-height: 1.35;
}

.tax-panel>div {
  min-height: 23px;
  display: grid;
  grid-template-columns: 70px 37px 12px 1fr;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-bottom: 1px solid var(--line);
}

.tax-panel>div:last-child {
  border-bottom: 0;
}

.tax-panel label {
  color: var(--green-900);
  font-size: 9px;
}

.tax-panel .tax-rate,
.tax-panel strong {
  min-height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1px 3px;
  border: 1px solid #c7d7d1;
  background: rgba(255, 253, 245, .9);
  font-size: 9px;
  font-weight: 500;
}

.tax-panel b {
  color: #73857f;
  font-size: 9px;
}

.tax-panel .grand-total {
  background: rgba(232, 243, 235, .85);
}

.tax-panel .grand-total label,
.tax-panel .grand-total strong {
  font-weight: 850;
}

.footer-area {
  display: grid;
  grid-template-columns: 1.25fr .9fr;
  gap: 10px;
  margin-top: 10px;
}

.bank-panel,
.sign-panel {
  min-height: 134px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, .75);
}

.bank-panel {
  background: rgba(232, 243, 235, .77);
}

.bank-panel h3,
.sign-panel h3 {
  margin: 0 0 11px;
  color: var(--green-700);
  font-size: 9px;
}

.bank-panel dl {
  display: grid;
  grid-template-columns: 105px 1fr;
  gap: 9px 10px;
  margin: 0;
}

.bank-panel dt {
  color: #687b75;
  font-size: 9px;
  font-weight: 700;
}

.bank-panel dd {
  margin: 0;
  font-size: 10px;
  font-weight: 850;
}

.sign-panel {
  display: flex;
  flex-direction: column;
}

.sign-panel img {
  width: 155px;
  height: 72px;
  object-fit: contain;
  align-self: center;
  mix-blend-mode: multiply;
}

.sign-panel p {
  margin: auto 8px 0;
  padding-top: 7px;
  border-top: 1px dashed #79a28e;
  color: #6a7a76;
  text-align: center;
  font-size: 9px;
}

.invoice-footnote {
  display: flex;
  justify-content: space-between;
  margin-top: 10px;
  color: #657772;
  font-size: 8px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 50;
  max-width: calc(100% - 30px);
  padding: 10px 15px;
  border-radius: 10px;
  background: var(--green-950);
  color: white;
  font-size: 13px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, .2);
  transform: translate(-50%, 20px);
  opacity: 0;
  pointer-events: none;
  transition: .2s ease;
}

.toast.show {
  transform: translate(-50%, 0);
  opacity: 1;
}

@media (max-width: 1180px) {
  .app-shell {
    grid-template-columns: 370px minmax(680px, 1fr);
    padding: 18px;
    gap: 18px;
  }
}

@media (max-width: 960px) {
  .topbar {
    height: 62px;
    padding: 0 14px;
  }

  .top-actions .ghost {
    display: none;
  }

  .top-actions .button {
    min-height: 40px;
    padding: 0 13px;
  }

  .brand-mini small {
    display: none;
  }

  .mobile-switch {
    position: sticky;
    top: 62px;
    z-index: 25;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 5px;
    padding: 7px 14px;
    background: rgba(237, 242, 239, .95);
    backdrop-filter: blur(12px);
  }

  .switch-button {
    min-height: 39px;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: #60736d;
    font-weight: 800;
    font-size: 13px;
  }

  .switch-button.active {
    background: white;
    color: var(--green-900);
    box-shadow: 0 3px 12px rgba(23, 62, 52, .08);
  }

  .app-shell {
    display: block;
    width: 100%;
    padding: 14px;
  }

  .editor-panel {
    max-width: 680px;
    margin: 0 auto;
    padding-bottom: 86px;
  }

  .invoice-stage {
    display: none;
    padding: 0 0 80px;
    overflow-x: auto;
  }

  body.view-preview .editor-panel {
    display: none;
  }

  body.view-preview .invoice-stage {
    display: block;
  }

  .preview-toolbar {
    position: sticky;
    left: 0;
    width: 100%;
    min-width: 0;
  }

  .invoice-shell {
    width: 794px;
    min-width: 794px;
    transform-origin: top left;
  }

  .mobile-create {
    display: block;
    position: fixed;
    left: 14px;
    right: 14px;
    bottom: max(14px, env(safe-area-inset-bottom));
    z-index: 20;
  }
}

@media (max-width: 560px) {
  .brand-mini strong {
    font-size: 14px;
  }

  .brand-dot {
    width: 34px;
    height: 34px;
    border-radius: 10px;
  }

  .form-grid.two,
  .form-grid.three {
    grid-template-columns: 1fr;
  }

  .form-card {
    padding: 16px;
    border-radius: 15px;
  }

  .item-fields {
    grid-template-columns: 1fr 1fr;
  }
}

:root {
  --memo-ink: #6e211b;
  --memo-deep: #521712;
  --memo-paper: #fff3a6;
  --memo-line: #7c291f;
}

.memo-app {
  --green-900: var(--memo-ink);
  --green-950: var(--memo-deep);
  --green-700: #9a3c25;
}

.memo-dot,
.memo-primary {
  background: var(--memo-ink) !important;
}

.memo-eyebrow {
  color: #a54525 !important;
}

.block-gap {
  display: block;
  margin-top: 12px;
}

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

.memo-items-toolbar p {
  margin: 0;
  color: #5c4237;
  font-size: 11px;
  font-weight: 700;
}

.memo-add-item {
  min-height: 36px;
  flex: 0 0 auto;
  padding: 0 12px;
  border-color: var(--memo-ink);
  background: #fff3a6;
  color: var(--memo-ink);
}

.memo-add-item:disabled {
  cursor: not-allowed;
  opacity: .48;
}

.memo-item-editors {
  display: grid;
  gap: 11px;
}

.memo-item-card {
  padding: 13px;
  border: 1px solid rgba(110, 33, 27, .38);
  border-radius: 13px;
  background: #fffbdf;
}

.memo-item-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 11px;
}

.memo-item-card-head strong {
  color: var(--memo-ink);
  font-size: 13px;
}

.memo-remove-item {
  min-height: 30px;
  padding: 0 9px;
  border: 1px solid rgba(110, 33, 27, .38);
  border-radius: 8px;
  background: transparent;
  color: var(--memo-ink);
  cursor: pointer;
  font-size: 11px;
  font-weight: 800;
}

.memo-remove-item:disabled {
  visibility: hidden;
}

.memo-item-card>label {
  display: block;
}

.memo-item-card .manual-total-item[hidden] {
  display: none !important;
}

.memo-item-card .form-grid {
  margin-top: 10px;
}

.memo-item-calculated {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 11px;
  padding-top: 9px;
  border-top: 1px dashed rgba(110, 33, 27, .35);
  color: #5c4237;
  font-size: 11px;
  font-weight: 800;
}

.memo-item-calculated>div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.memo-item-calculated output {
  color: var(--memo-ink);
  font-size: 14px;
  font-weight: 900;
}

.memo-freight-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 13px;
  padding-top: 13px;
  border-top: 2px solid rgba(110, 33, 27, .28);
}

.memo-freight-summary>label {
  grid-column: 1 / -1;
}

.memo-freight-summary>div {
  min-height: 52px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 8px 11px;
  border: 1px solid rgba(110, 33, 27, .3);
  border-radius: 10px;
  background: #fff3a6;
}

.memo-freight-summary span {
  color: #5c4237;
  font-size: 10px;
  font-weight: 800;
}

.memo-freight-summary>div>small {
  margin-top: 1px;
  color: var(--memo-ink);
  font-size: 9px;
  font-weight: 800;
}

.memo-freight-summary output {
  margin-top: 2px;
  color: var(--memo-ink);
  font-size: 16px;
  font-weight: 900;
}

.memo-freight-summary .balance-summary-card {
  grid-column: 1 / -1;
}

.memo-shell {
  position: relative;
  width: 794px;
  min-width: 794px;
  min-height: 1123px;
  margin: 0 auto;
  padding: 30px;
  overflow: hidden;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, .1), transparent 26%, rgba(223, 165, 35, .06) 52%, transparent 72%),
    var(--memo-paper);
  color: var(--memo-ink);
  box-shadow: 0 18px 50px rgba(92, 34, 18, 0.18);
  font-family: "Nirmala UI", Mangal, "Kohinoor Devanagari", Arial, sans-serif;
  font-size: 13px;
}

.memo-frame {
  min-height: 1063px;
  display: flex;
  flex-direction: column;
  padding: 8px;
  border: 5px double var(--memo-line);
  background: rgba(255, 239, 121, .3);
}

.memo-topline {
  min-height: 38px;
  display: grid;
  grid-template-columns: 1fr minmax(160px, auto) 1fr;
  align-items: center;
  gap: 8px;
  padding: 0 9px;
  border-bottom: 2px solid var(--memo-line);
  font-size: 11px;
  font-weight: 800;
}

.memo-topline .shree-mark {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--memo-deep);
  text-align: center;
  white-space: nowrap;
  font-size: 19px;
  letter-spacing: .06em;
}

.memo-topline .shree-mark::before,
.memo-topline .shree-mark::after {
  content: "";
  width: 28px;
  height: 4px;
  border-top: 1px solid var(--memo-line);
  border-bottom: 1px solid var(--memo-line);
}

.memo-topline span:last-child {
  text-align: right;
}

.memo-number-row {
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 4px 12px;
  border-bottom: 1.5px solid var(--memo-line);
  font-weight: 800;
}

.memo-number-row b {
  min-width: 120px;
  display: inline-block;
  padding: 3px 8px;
  border-bottom: 1px solid var(--memo-line);
  color: #2f2822;
  text-align: center;
  font-size: 16px;
}

.party-lines {
  padding: 5px 10px;
  border-bottom: 2px solid var(--memo-line);
}

.party-lines>div {
  min-height: 35px;
  display: grid;
  grid-template-columns: auto minmax(170px, 1fr) auto minmax(120px, .6fr);
  align-items: center;
  gap: 7px;
}

.party-lines>div:last-child {
  grid-template-columns: auto 1fr;
}

.party-lines label {
  color: var(--memo-ink);
  font-size: 12px;
}

.party-lines span {
  min-height: 27px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2px 8px;
  border-bottom: 1px solid var(--memo-line);
  color: #29231f;
  text-align: center;
  white-space: pre-line;
  font-size: 14px;
  font-weight: 700;
}

.memo-brand-row {
  min-height: 101px;
  display: grid;
  grid-template-columns: 1fr 95px;
  align-items: center;
  gap: 10px;
  padding: 8px 13px;
  border-bottom: 2px solid var(--memo-line);
  background: rgba(255, 228, 71, .28);
}

.memo-brand-row h2 {
  margin: 0 0 6px;
  text-align: center;
  font-size: 23px;
  line-height: 1.15;
}

.memo-brand-row p {
  margin: 0;
  text-align: center;
  font-size: 12px;
  font-weight: 800;
}

.memo-brand-row .memo-mobile {
  width: max-content;
  margin: 6px auto 0;
  padding: 2px 13px;
  border: 1px solid var(--memo-line);
  border-radius: 999px;
  background: rgba(255, 248, 188, .55);
  font-size: 11.5px;
  letter-spacing: .05em;
  line-height: 1.35;
}

.memo-brand-row .memo-mobile strong {
  font-size: 12.5px;
  letter-spacing: .08em;
}

.memo-number {
  min-height: 56px;
  display: grid;
  place-items: center;
  border: 2px solid var(--memo-line);
  background: rgba(255, 248, 188, .55);
  color: #4d3022;
  font-size: 27px;
}

.transport-lines {
  padding: 5px 10px 7px;
  border-bottom: 2px solid var(--memo-line);
}

.transport-lines p {
  min-height: 34px;
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  font-size: 12.5px;
  font-weight: 750;
}

.transport-lines span {
  min-width: 130px;
  min-height: 25px;
  display: inline-flex;
  flex: 1;
  align-items: center;
  justify-content: center;
  padding: 1px 7px;
  border-bottom: 1px solid var(--memo-line);
  color: #29231f;
  text-align: center;
  font-size: 14px;
  font-weight: 700;
}

.memo-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  border-top: 1px solid var(--memo-line);
  border-bottom: 2px solid var(--memo-line);
}

.memo-table .goods-col {
  width: 36%;
}

.memo-table .bags-col {
  width: 9%;
}

.memo-table .rate-col {
  width: 12%;
}

.memo-table .total-col {
  width: 14%;
}

.memo-table .advance-col {
  width: 14%;
}

.memo-table .balance-col {
  width: 15%;
}

.memo-table th,
.memo-table td {
  border-right: 1.25px solid var(--memo-line);
  border-bottom: 1.5px solid var(--memo-line);
}

.memo-table th:last-child,
.memo-table td:last-child {
  border-right: 0;
}

.memo-table th {
  height: 62px;
  padding: 7px 4px;
  background: linear-gradient(180deg, rgba(255, 224, 48, .38), rgba(255, 239, 121, .22));
  color: var(--memo-deep);
  text-align: center;
  vertical-align: middle;
  line-height: 1.15;
}

.memo-table th span {
  display: block;
  white-space: nowrap;
  font-size: 11.5px;
  font-weight: 900;
}

.memo-table th small {
  min-height: 13px;
  display: block;
  margin-top: 4px;
  color: var(--memo-ink);
  white-space: nowrap;
  font-size: 9px;
  font-weight: 800;
  line-height: 1.1;
}

.memo-table .balance-heading small {
  width: max-content;
  margin: 5px auto 0;
  padding: 2px 6px;
  border-top: 1px solid rgba(110, 33, 27, .48);
  background: rgba(255, 248, 188, .44);
  border-radius: 5px;
}

.memo-table tbody tr {
  height: calc(213px / var(--memo-item-count, 1));
}

.memo-table td {
  height: auto;
  padding: 8px 5px;
  color: #29231f;
  text-align: center;
  vertical-align: middle;
  font-size: 16px;
  font-weight: 750;
  word-break: break-word;
}

.memo-table tbody td:nth-child(even) {
  background: rgba(255, 255, 255, .08);
}

.memo-table .goods-value {
  padding: 12px;
  text-align: center;
  vertical-align: middle;
}

.memo-table .settlement-cell {
  background: rgba(255, 239, 121, .14);
}

.memo-table .row-balance-value {
  background: rgba(255, 224, 48, .18);
  font-weight: 900;
}

.memo-table .rate-value small {
  display: block;
  margin-top: 4px;
  color: #6e211b;
  white-space: nowrap;
  font-size: 9px;
  font-weight: 800;
}

.goods-value strong {
  display: block;
  min-height: 0;
  white-space: pre-line;
  text-align: center;
  font-size: 18px;
  line-height: 1.5;
}

.goods-value span {
  display: block;
  margin-top: 7px;
  text-align: center;
  font-size: 16px;
}

.goods-value small {
  display: block;
  margin-top: 10px;
  color: #5c4237;
  white-space: pre-line;
  text-align: center;
  font-size: 12px;
  line-height: 1.35;
}

.memo-table.multiple-items .goods-value {
  padding: 6px 9px;
  vertical-align: middle;
}

.memo-table.multiple-items .goods-value strong {
  min-height: 0;
  display: -webkit-box;
  overflow: hidden;
  white-space: normal;
  font-size: 13px;
  line-height: 1.22;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.memo-table.multiple-items .goods-value span {
  margin-top: 3px;
  font-size: 10px;
}

.memo-table.multiple-items .goods-value small {
  margin-top: 3px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-size: 8.5px;
}

.memo-table.multiple-items td {
  padding: 5px 3px;
  font-size: 12.5px;
}

.memo-table tfoot th,
.memo-table tfoot td {
  height: 58px;
  border-top: 2px solid var(--memo-line);
  border-bottom: 0;
  background: rgba(255, 224, 48, .34);
  color: var(--memo-deep);
  font-weight: 900;
}

.memo-table tfoot th {
  padding: 5px 8px;
  text-align: center;
  vertical-align: middle;
}

.memo-table tfoot th span {
  font-size: 12px;
  letter-spacing: .03em;
}

.memo-table tfoot th small {
  min-height: 0;
  margin-top: 2px;
  font-size: 8.5px;
}

.memo-table tfoot td {
  padding: 4px 3px;
  text-align: center;
  vertical-align: middle;
}

.memo-table tfoot td span,
.memo-table tfoot td strong,
.memo-table tfoot td small {
  display: block;
  white-space: nowrap;
}

.memo-table tfoot td span {
  font-size: 8.5px;
  font-weight: 800;
}

.memo-table tfoot td strong {
  min-height: 17px;
  margin-top: 1px;
  font-size: 14px;
  line-height: 1.2;
}

.memo-table tfoot td small {
  margin-top: 1px;
  color: var(--memo-ink);
  font-size: 8px;
  font-weight: 800;
}

.memo-table tfoot .balance-summary-value {
  background: rgba(255, 216, 38, .5);
}

.memo-table tfoot .balance-summary-value small {
  width: max-content;
  margin: 2px auto 0;
  padding-top: 2px;
  border-top: 1px solid rgba(110, 33, 27, .5);
}

.memo-declaration {
  padding: 7px 10px;
  border-bottom: 2px solid var(--memo-line);
}

.memo-declaration p {
  margin: 0 0 6px;
  font-size: 10.5px;
  font-weight: 800;
  line-height: 1.45;
}

.memo-declaration p:last-child {
  margin-bottom: 0;
  padding-top: 5px;
  border-top: 1px solid rgba(110, 33, 27, .5);
}

.memo-signatures {
  min-height: 123px;
  flex: 1;
  display: grid;
  grid-template-columns: 1.5fr .8fr;
  align-items: center;
  gap: 15px;
  padding: 8px 12px;
}

.agent-sign {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 7px;
}

.agent-sign span {
  font-size: 12px;
  font-weight: 800;
}

.agent-sign strong {
  min-height: 29px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-bottom: 1px solid var(--memo-line);
  color: #29231f;
  font-size: 21px;
  letter-spacing: .06em;
}

.agent-sign strong:first-of-type {
  font-family: "Segoe Script", "Nirmala UI", cursive;
  font-size: 18px;
  letter-spacing: 0;
}

.agent-sign strong:last-of-type {
  font-size: 15px;
  letter-spacing: 0;
}

.owner-sign {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
}

.owner-sign img {
  width: 155px;
  height: 77px;
  object-fit: contain;
  mix-blend-mode: multiply;
}

.owner-sign span {
  width: 100%;
  padding-top: 4px;
  border-top: 1px solid var(--memo-line);
  text-align: center;
  font-size: 10px;
  font-weight: 800;
}

@media (max-width: 960px) {
  .memo-stage {
    overflow-x: hidden;
  }

  .memo-shell {
    transform-origin: top left;
  }
}

@media (max-width: 520px) {
  .memo-item-card .form-grid.two {
    grid-template-columns: 1fr;
  }

  .memo-items-toolbar {
    align-items: flex-start;
  }
}

/* The mobile action bar carries two buttons now, so it lays them out side by side. */
@media (max-width: 960px) {
  .mobile-create {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .mobile-create .button {
    padding: 0 10px;
    font-size: 12px;
  }
}

/* Android Chrome lays print out against the page box, not the screen viewport: any
   `width: auto` ancestor keeps the screen width and leaves a white band down the
   right and along the bottom, and any zoom below 1 pulls the sheet off the paper
   edge. Every box in the print chain is pinned to exact A4 with zoom locked at 1.
   html carries the memo paper tint so a printer's rounding never shows white. */
@media print {
  @page {
    size: A4 portrait;
    margin: 0;
  }

  html,
  body {
    width: 210mm;
    min-width: 210mm;
    max-width: 210mm;
    height: 297mm;
    min-height: 297mm;
    max-height: 297mm;
    margin: 0;
    padding: 0;
    overflow: hidden;
  }

  html {
    background: var(--memo-paper);
    print-color-adjust: exact;
    -webkit-print-color-adjust: exact;
  }

  body {
    background: transparent;
  }

  .topbar,
  .mobile-switch,
  .mobile-create,
  .editor-panel,
  .preview-toolbar,
  .toast {
    display: none !important;
  }

  .app-shell,
  .memo-stage {
    display: block !important;
    width: 210mm;
    min-width: 210mm;
    max-width: 210mm;
    height: 297mm;
    max-height: 297mm;
    margin: 0;
    padding: 0;
    overflow: hidden;
  }

  .memo-shell {
    width: 210mm;
    min-width: 210mm;
    max-width: 210mm;
    height: 297mm;
    /* The screen rule sets min-height: 1123px, a hair over 297mm (1122.52px) in print
       units. Left alone it spills a blank second page. */
    min-height: 297mm;
    max-height: 297mm;
    box-sizing: border-box;
    margin: 0 !important;
    padding: 8mm;
    overflow: hidden;
    zoom: 1 !important;
    transform: none !important;
    break-inside: avoid;
    page-break-inside: avoid;
    break-after: avoid;
    page-break-after: avoid;
    box-shadow: none;
    print-color-adjust: exact;
    -webkit-print-color-adjust: exact;
  }

  .memo-frame {
    min-height: 0;
    height: 100%;
    box-sizing: border-box;
  }

  /* Mobile print rasterizers mis-composite large alpha/gradient layers
     (banding artifacts), so print uses precomputed solid tints of --memo-paper. */
  .memo-shell {
    background: var(--memo-paper);
  }

  .memo-frame {
    background: #fff299;
  }

  .memo-brand-row {
    background: #ffef8b;
  }

  .memo-brand-row .memo-mobile,
  .memo-brand-row .memo-number {
    background: #fff6b2;
  }

  .memo-table th {
    background: #ffef8b;
  }

  .memo-table .balance-heading small {
    background: #fff5b0;
  }

  .memo-table tbody td:nth-child(even) {
    background: #fff4ad;
  }

  .memo-table .settlement-cell {
    background: #fff2a0;
  }

  .memo-table .row-balance-value {
    background: #fff091;
  }

  .memo-table tfoot th,
  .memo-table tfoot td {
    background: #ffed7e;
  }

  .memo-table tfoot .balance-summary-value {
    background: #ffe666;
  }

  .owner-sign img {
    mix-blend-mode: normal;
  }
}