:root {
  --ink: #253029;
  --muted: #6e786f;
  --paper: #fffefb;
  --line: #dce0da;
  --cream: #f4f1e9;
  --sage: #dce6dd;
  --sage-dark: #385446;
  --rust: #ba684c;
  --shadow: 0 24px 70px rgba(45, 58, 49, 0.16);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  background: #e8ece7;
  font-family: "DM Sans", Arial, sans-serif;
}

button,
input {
  font: inherit;
}

.app-shell {
  display: grid;
  grid-template-columns: 360px minmax(680px, 1fr);
  min-height: 100vh;
}

.editor-panel {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  padding: 34px 26px 28px;
  color: #f8f8f4;
  background: var(--ink);
}

.editor-heading h1 {
  margin: 8px 0 8px;
  font: 700 34px/1.12 "DM Sans", Arial, sans-serif;
}

.editor-heading > p:last-child {
  margin: 0 0 24px;
  color: #bdc8c0;
  font-size: 13px;
  line-height: 1.6;
}

.eyebrow,
.section-label {
  margin: 0;
  color: var(--rust);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.editor-card {
  display: grid;
  gap: 14px;
  margin-top: 14px;
  padding: 18px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
}

label {
  display: grid;
  gap: 7px;
  color: #cdd6cf;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

input {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 5px;
  outline: none;
  color: #f9faf8;
  background: rgba(255, 255, 255, 0.07);
  font-size: 14px;
  letter-spacing: normal;
  text-transform: none;
  transition: border-color 160ms ease, background 160ms ease;
}

input:focus {
  border-color: #9fb7a6;
  background: rgba(255, 255, 255, 0.11);
}

input::placeholder {
  color: #93a097;
}

input[type="date"] {
  color-scheme: dark;
}

.money-input {
  display: flex;
  align-items: center;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.07);
}

.money-input span {
  padding-left: 12px;
  color: #afbeb4;
  font-size: 13px;
}

.money-input input {
  border: 0;
  background: transparent;
}

.card-title {
  display: flex;
  align-items: center;
  gap: 9px;
}

.card-title h2 {
  margin: 0;
  color: #eff3ef;
  font-size: 14px;
}

.step-number {
  color: var(--rust);
  font-size: 11px;
  font-weight: 700;
}

.button {
  cursor: pointer;
  padding: 11px 13px;
  border: 1px solid transparent;
  border-radius: 5px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.05em;
  transition: transform 160ms ease, background 160ms ease;
}

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

.button-primary {
  color: #fff;
  background: var(--rust);
}

.button-secondary {
  color: #e7ece7;
  border-color: rgba(255, 255, 255, 0.2);
  background: transparent;
}

.button-dark {
  color: var(--ink);
  background: var(--sage);
}

.editor-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
  margin-top: 16px;
}

.save-note {
  display: flex;
  align-items: center;
  gap: 7px;
  color: #a9b7ad;
  font-size: 11px;
  line-height: 1.5;
}

.save-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #79a489;
}

.preview-area {
  overflow: auto;
  padding: 46px;
}

.quote-sheet {
  width: min(100%, 850px);
  min-height: 1098px;
  margin: 0 auto;
  padding: 58px 62px 42px;
  background: var(--paper);
  box-shadow: var(--shadow);
}

.quote-header,
.quote-meta,
.summary-section,
.quote-footer {
  display: flex;
  justify-content: space-between;
}

.quote-header {
  align-items: flex-start;
  padding-bottom: 48px;
}

.brand-block {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-mark {
  display: grid;
  width: 54px;
  height: 54px;
  place-items: center;
  border-radius: 50%;
  color: var(--paper);
  background: var(--sage-dark);
  font: 700 15px "DM Sans", Arial, sans-serif;
}

.brand-block h2,
.quote-title p {
  margin: 0;
  font-size: 20px;
  letter-spacing: 0.2em;
}

.brand-block p,
.quote-title span {
  margin: 5px 0 0;
  color: var(--muted);
  font: 500 13px "DM Sans", Arial, sans-serif;
}

.brand-block p span {
  padding: 0 3px;
  color: var(--rust);
}

.quote-title {
  text-align: right;
}

.quote-title p {
  color: var(--sage-dark);
  font-size: 22px;
  font-weight: 700;
}

.quote-meta {
  align-items: center;
  gap: 24px;
  padding: 25px 27px;
  background: var(--cream);
}

.meta-client h3 {
  margin: 8px 0 0;
  font: 600 20px "DM Sans", Arial, sans-serif;
}

.meta-details {
  min-width: 240px;
  text-align: right;
}

.meta-details p {
  margin: 4px 0;
  font-size: 12px;
}

.meta-details strong {
  margin-right: 4px;
  color: var(--sage-dark);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.items-section {
  margin-top: 45px;
}

.table-header,
.item-row {
  display: grid;
  grid-template-columns: 50px 1fr 110px 32px;
  gap: 12px;
  align-items: center;
}

.table-header {
  padding: 0 6px 11px;
  border-bottom: 2px solid var(--ink);
  color: var(--sage-dark);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

.item-row {
  min-height: 51px;
  padding: 9px 6px;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}

.item-index {
  color: var(--rust);
  font-weight: 700;
}

.item-value {
  font-weight: 700;
  text-align: right;
}

.delete-button {
  cursor: pointer;
  width: 26px;
  height: 26px;
  border: 0;
  border-radius: 50%;
  color: #a4614f;
  background: #f6e8e1;
  font-size: 17px;
  line-height: 1;
}

.empty-state {
  padding: 29px 6px;
  border-bottom: 1px solid var(--line);
  color: #929b94;
  font: 500 13px "DM Sans", Arial, sans-serif;
}

.summary-section {
  gap: 36px;
  margin-top: 33px;
}

.payment-condition {
  max-width: 370px;
}

.payment-condition p:last-child {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.totals {
  min-width: 210px;
  margin: 0;
}

.totals div {
  display: flex;
  justify-content: space-between;
  gap: 28px;
  margin-bottom: 9px;
}

.totals dt,
.totals dd {
  margin: 0;
  font-size: 13px;
}

.totals dt {
  color: var(--muted);
}

.totals dt span {
  font-size: 11px;
}

.totals dd {
  font-weight: 700;
}

.totals .grand-total {
  margin-top: 15px;
  padding-top: 13px;
  border-top: 2px solid var(--ink);
}

.grand-total dt,
.grand-total dd {
  color: var(--ink);
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.quote-footer {
  align-items: flex-end;
  margin-top: 202px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.quote-footer p {
  margin: 0;
  color: var(--sage-dark);
  font: 700 14px "DM Sans", Arial, sans-serif;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.quote-footer address {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 11px;
  font-style: normal;
  text-align: right;
}

@media (max-width: 1050px) {
  .app-shell {
    display: block;
  }

  .editor-panel {
    position: static;
    height: auto;
  }

  .editor-heading,
  .editor-panel > .editor-card,
  .editor-actions,
  .save-note {
    max-width: 620px;
    margin-right: auto;
    margin-left: auto;
  }
}

@media (max-width: 760px) {
  .preview-area {
    padding: 18px 8px;
  }

  .quote-sheet {
    min-height: 0;
    padding: 32px 24px;
  }

  .quote-header,
  .quote-meta,
  .summary-section,
  .quote-footer {
    gap: 19px;
  }

  .quote-header {
    padding-bottom: 30px;
  }

  .brand-mark {
    width: 42px;
    height: 42px;
    font-size: 13px;
  }

  .brand-block h2,
  .quote-title p {
    font-size: 15px;
  }

  .quote-title span {
    display: none;
  }

  .quote-meta,
  .summary-section,
  .quote-footer {
    display: block;
  }

  .meta-details {
    min-width: 0;
    margin-top: 20px;
    text-align: left;
  }

  .table-header,
  .item-row {
    grid-template-columns: 36px 1fr 86px 27px;
    gap: 7px;
  }

  .totals {
    margin-top: 24px;
  }

  .quote-footer {
    margin-top: 100px;
  }

  .quote-footer address {
    margin-top: 13px;
    text-align: left;
  }
}

@media print {
  @page {
    size: A4;
    margin: 0;
  }

  body {
    background: #fff;
  }

  .editor-panel {
    display: none;
  }

  .app-shell {
    display: block;
  }

  .preview-area {
    padding: 0;
  }

  .quote-sheet {
    width: 210mm;
    min-height: 297mm;
    padding: 16mm 17mm 12mm;
    box-shadow: none;
  }

  .action-column,
  .delete-button {
    display: none;
  }

  .table-header,
  .item-row {
    grid-template-columns: 50px 1fr 110px;
  }
}
