html {
  -webkit-print-color-adjust: exact;
  print-color-adjust: exact;
}

body {
  min-width: 320px;
  margin: 0;
  color: #1d252c;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.app-shell {
  background:
    linear-gradient(135deg, rgb(31 79 70 / 7%), transparent 34%),
    linear-gradient(315deg, rgb(201 111 82 / 8%), transparent 28%),
    #f2f5f4;
}

.workspace-grid {
  display: grid;
  grid-template-columns: minmax(0, 460px) minmax(0, 1fr);
  gap: 1.5rem;
  max-width: 1500px;
  margin: 0 auto;
  padding: 1.25rem 1.5rem;
}

.editor-panel {
  border: 1px solid #d9e1df;
  border-radius: 8px;
  background: rgb(255 255 255 / 86%);
  padding: 1rem;
  box-shadow: 0 16px 45px rgb(21 40 38 / 9%);
  backdrop-filter: blur(18px);
}

.editor-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
  border-bottom: 1px solid #dce4e1;
  padding-bottom: 1.25rem;
}

.editor-header h1 {
  margin: 0;
  color: #1d252c;
  font-size: 1.55rem;
  font-weight: 760;
  line-height: 1.15;
}

.editor-header p {
  margin: 0.28rem 0 0;
  color: #64736f;
  font-size: 0.9rem;
}

.header-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.5rem;
}

.compact-button {
  width: auto;
}

.logout-link {
  padding: 0.55rem 0.2rem;
  color: #64736f;
  font-size: 0.82rem;
  font-weight: 700;
  text-decoration: none;
}

.logout-link:hover {
  color: #1d252c;
  text-decoration: underline;
}

.archive-panel {
  margin-bottom: 1rem;
  border: 1px solid #dce4e1;
  border-radius: 8px;
  background: #ffffff;
  padding: 0.9rem;
}

.archive-heading {
  display: grid;
  gap: 0.8rem;
}

.archive-heading h2 {
  margin: 0;
  color: #1d252c;
  font-size: 1rem;
}

.archive-heading p {
  margin: 0.2rem 0 0;
  color: #687873;
  font-size: 0.78rem;
}

.archive-heading p.is-error,
.archive-error {
  color: #a24327;
}

.archive-filters {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  align-items: end;
  gap: 0.5rem;
}

.archive-filters label {
  font-size: 0.75rem;
}

.invoice-archive {
  display: grid;
  gap: 0.45rem;
  max-height: 230px;
  margin-top: 0.8rem;
  overflow: auto;
}

.archive-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  width: 100%;
  border: 1px solid #e1e8e6;
  border-radius: 6px;
  background: #fbfdfc;
  padding: 0.62rem 0.7rem;
  color: #1d252c;
  text-align: left;
  cursor: pointer;
}

.archive-item:hover,
.archive-item.is-current {
  border-color: #8ca79f;
  background: #edf5f2;
}

.archive-item span {
  min-width: 0;
}

.archive-item strong,
.archive-item small {
  display: block;
}

.archive-item small {
  margin-top: 0.15rem;
  overflow: hidden;
  color: #687873;
  font-size: 0.72rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.archive-item b {
  flex: none;
  color: #1f4f46;
  font-size: 0.82rem;
}

.archive-empty {
  margin: 0;
  padding: 0.7rem;
  color: #687873;
  font-size: 0.8rem;
  text-align: center;
}

#invoiceForm {
  display: grid;
  gap: 1rem;
}

.field-grid {
  display: grid;
  gap: 0.75rem;
}

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

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

.color-picker-row {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  align-items: center;
  gap: 0.75rem;
}

.color-picker-row input[type="color"] {
  height: 44px;
  padding: 0.22rem;
  cursor: pointer;
}

.color-picker-row output {
  color: #51615d;
  font-size: 0.9rem;
  font-weight: 750;
}

.color-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 0.62rem;
}

.color-presets button {
  width: 34px;
  height: 34px;
  border: 3px solid #ffffff;
  border-radius: 50%;
  background: var(--preset-color);
  box-shadow: 0 0 0 1px #ccd7d3;
  cursor: pointer;
  transition: transform 140ms ease, box-shadow 140ms ease;
}

.color-presets button:hover,
.color-presets button.is-selected {
  transform: scale(1.08);
  box-shadow: 0 0 0 2px #27332f;
}

.color-presets button[data-primary-color="#1f4f46"] { --preset-color: #1f4f46; }
.color-presets button[data-primary-color="#2457a6"] { --preset-color: #2457a6; }
.color-presets button[data-primary-color="#6f42a6"] { --preset-color: #6f42a6; }
.color-presets button[data-primary-color="#a3445d"] { --preset-color: #a3445d; }
.color-presets button[data-primary-color="#A96800"] { --preset-color: #A96800; }
.color-presets button[data-primary-color="#4d5866"] { --preset-color: #4d5866; }

.field-help {
  margin: 0;
  color: #71807c;
  font-size: 0.78rem;
  line-height: 1.45;
}

.template-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.5rem;
}

.items-editor-list {
  display: grid;
  gap: 0.75rem;
}

.preview-column {
  min-width: 0;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid #d3dcd9;
  border-radius: 6px;
  background: #ffffff;
  padding: 0.64rem 0.72rem;
  font: inherit;
  color: #1d252c;
  outline: none;
  transition: border-color 140ms ease, box-shadow 140ms ease, background 140ms ease;
}

textarea {
  resize: vertical;
}

select {
  min-height: 42px;
}

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

input:focus,
textarea:focus,
select:focus {
  border-color: #1f4f46;
  box-shadow: 0 0 0 3px rgb(31 79 70 / 14%);
}

label {
  display: grid;
  gap: 0.38rem;
  color: #51615d;
  font-size: 0.83rem;
  font-weight: 650;
}

.editor-section {
  display: grid;
  gap: 0.9rem;
  border: 1px solid #e1e8e6;
  border-radius: 8px;
  background: #ffffff;
  padding: 1rem;
}

.editor-section legend {
  padding: 0 0.28rem;
  color: #1d252c;
  font-size: 0.96rem;
  font-weight: 750;
}

.primary-button,
.secondary-button,
.danger-button,
.ghost-button {
  border: 0;
  cursor: pointer;
  min-height: 42px;
  border-radius: 6px;
  padding: 0.62rem 0.9rem;
  font-size: 0.88rem;
  font-weight: 750;
  transition: transform 140ms ease, background 140ms ease, border-color 140ms ease, color 140ms ease, box-shadow 140ms ease;
}

.primary-button {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: #1f4f46;
  color: #ffffff;
  box-shadow: 0 10px 24px rgb(31 79 70 / 18%);
}

.primary-button:hover {
  background: #193f38;
  transform: translateY(-1px);
}

.secondary-button {
  border: 1px solid #1f4f46;
  background: #f7fbfa;
  color: #1f4f46;
}

.secondary-button:hover {
  background: #e5f0ed;
}

.ghost-button {
  width: 100%;
  border: 1px dashed #9bb0aa;
  background: #fbfdfc;
  color: #35544e;
}

.ghost-button:hover {
  border-color: #1f4f46;
  background: #edf5f2;
}

.danger-button {
  min-height: 34px;
  border: 1px solid #df9b85;
  padding: 0.35rem 0.62rem;
  color: #a24327;
}

.danger-button:hover {
  background: #fff1ec;
}

.item-editor {
  display: grid;
  gap: 0.78rem;
  border: 1px solid #e4ebe8;
  border-radius: 8px;
  background: linear-gradient(180deg, #ffffff, #fbfdfc);
  padding: 0.9rem;
}

.item-editor-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.item-fields {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 120px;
  gap: 0.75rem;
}

.item-editor strong {
  color: #1f4f46;
}

.item-total-box {
  align-self: end;
  min-height: 42px;
  border: 1px solid #e1e8e6;
  border-radius: 6px;
  background: #f3f7f6;
  padding: 0.46rem 0.65rem;
}

.item-total-box span {
  display: block;
  color: #6b7d78;
  font-size: 0.72rem;
  font-weight: 700;
}

.item-total-box strong {
  color: #1d252c;
  font-size: 0.92rem;
}

.preview-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
  color: #53635f;
  font-size: 0.9rem;
  font-weight: 650;
}

.preview-stage {
  overflow: auto;
  border: 1px solid #d8e1de;
  border-radius: 8px;
  background:
    linear-gradient(45deg, #e8eeec 25%, transparent 25%),
    linear-gradient(-45deg, #e8eeec 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #e8eeec 75%),
    linear-gradient(-45deg, transparent 75%, #e8eeec 75%);
  background-color: #f7faf9;
  background-position: 0 0, 0 10px, 10px -10px, -10px 0;
  background-size: 20px 20px;
  padding: 1rem;
  box-shadow: inset 0 1px 8px rgb(27 46 42 / 7%);
}

.invoice-preview {
  --invoice-primary: #1f4f46;
  --invoice-muted: #6f7976;
  --invoice-label: #5f7872;
  --invoice-border: #dce8e5;
  --invoice-accent1: #bdd6cf;
  --invoice-accent2: #a8c4bd;
  --invoice-surface1: #f8fbfa;
  --invoice-surface2: #f2f8f6;
  --invoice-summary1: #f7fbfa;
  --invoice-summary2: #eef6f4;
  --invoice-summary3: #e6f0ed;
  --invoice-summary4: #ddeae7;
  --invoice-summary5: #d4e4e0;
  display: grid;
  gap: 1rem;
  justify-content: center;
}

.invoice-page-frame {
  position: relative;
  margin: 0 auto;
  overflow: hidden;
  background: #ffffff;
  box-shadow: 0 24px 60px rgb(21 40 38 / 18%);
}

.invoice-page-frame .invoice-page {
  margin: 0;
  box-shadow: none;
  transform: scale(var(--preview-scale, 1));
  transform-origin: top left;
}

.invoice-page-frame:not(:last-child) .invoice-page {
  break-after: page;
  page-break-after: always;
}

.invoice-page-frame:last-child .invoice-page {
  break-after: auto;
  page-break-after: auto;
}

.invoice-page {
  position: relative;
  width: 210mm;
  min-height: 297mm;
  margin: 0 auto;
  background: #ffffff;
  color: #20252a;
  padding: 17mm 16mm 15mm;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 13px;
  line-height: 1.45;
  box-shadow: 0 24px 60px rgb(21 40 38 / 18%);
  break-after: page;
  page-break-after: always;
}

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

.invoice-hero {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12mm;
  margin-bottom: 5mm;
}

.invoice-hero h2 {
  color: var(--invoice-muted);
  font-size: 20px;
  font-weight: 800;
  letter-spacing: 0;
  line-height: 1;
}

.invoice-hero p {
  margin: 0;
  color: var(--invoice-muted);
  font-size: 20px;
  font-weight: 750;
  line-height: 1;
  text-align: right;
}

.party-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9mm;
  margin-bottom: 4.5mm;
}

.party-card {
  border: 1px solid var(--invoice-border);
  border-left: 3px solid var(--invoice-accent1);
  border-radius: 8px;
  background: var(--invoice-surface1);
  padding: 5mm;
}

.customer-card {
  border: 1px solid var(--invoice-border);
  border-left: 3px solid var(--invoice-accent2);
  border-radius: 8px;
  background: var(--invoice-surface2);
  color: #20252a;
  padding: 5mm;
}

.customer-card .section-label {
  color: var(--invoice-label);
}

.section-label {
  margin-bottom: 3mm;
  color: var(--invoice-label);
  font-size: 11.5px;
  font-weight: 850;
  letter-spacing: 0;
  text-transform: uppercase;
}

.party-block {
  font-size: 13px;
  font-weight: 400;
  line-height: 1.45;
}

.party-name {
  margin-bottom: 1mm;
  font-weight: 750;
}

.payment-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 28mm;
  gap: 3mm;
  align-items: center;
  margin: 0 0 3.5mm;
}

.payment-sentence {
  margin: 0;
  font-size: 15px;
  font-weight: 750;
}

.payment-line-break {
  display: block;
}

.payment-qr {
  display: block;
  width: 28mm;
  height: 28mm;
  justify-self: end;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0;
  margin: 0 0 12mm;
  overflow: visible;
}

.summary-grid div {
  position: relative;
  min-height: 18mm;
  border: 1px solid var(--invoice-border);
  padding: 4mm 3mm;
  box-shadow: -3mm 0 0 rgb(255 255 255 / 36%);
}

.summary-grid div:first-child {
  border-radius: 8px;
  box-shadow: none;
  z-index: 5;
}

.summary-grid div:not(:first-child) {
  margin-left: -3mm;
  padding-left: 6mm;
  border-radius: 0 8px 8px 0;
}

.summary-grid div:nth-child(2) {
  z-index: 4;
}

.summary-grid div:nth-child(3) {
  z-index: 3;
}

.summary-grid div:nth-child(4) {
  z-index: 2;
}

.summary-grid div:nth-child(5) {
  z-index: 1;
}

.summary-grid div:nth-child(1) {
  background: var(--invoice-summary1);
}

.summary-grid div:nth-child(2) {
  background: var(--invoice-summary2);
}

.summary-grid div:nth-child(3) {
  background: var(--invoice-summary3);
}

.summary-grid div:nth-child(4) {
  background: var(--invoice-summary4);
}

.summary-grid div:nth-child(5) {
  background: var(--invoice-summary5);
}

.summary-grid dt {
  margin-bottom: 3mm;
  color: var(--invoice-label);
  font-size: 11.5px;
  font-weight: 800;
}

.summary-grid dd {
  margin: 0;
  color: #20252a;
  font-size: 13px;
  font-weight: 400;
  white-space: nowrap;
}

.items-section h3 {
  margin-bottom: 1.45em;
  color: #20252a;
  font-size: 15px;
  font-weight: 800;
}

.items-section table {
  width: 100%;
  border-collapse: collapse;
  page-break-inside: auto;
}

.items-section th {
  border-bottom: 2px solid var(--invoice-primary);
  padding: 2.7mm 0;
  color: var(--invoice-label);
  font-size: 11.5px;
  font-weight: 850;
  text-align: left;
  text-transform: uppercase;
}

.items-section td {
  border-bottom: 1px solid var(--invoice-border);
  padding: 4mm 0;
  font-size: 13px;
  vertical-align: middle;
}

.items-section tr {
  break-inside: avoid;
  page-break-inside: avoid;
}

.items-section tbody tr:nth-child(even) td {
  background: var(--invoice-surface1);
}

.qty-col {
  width: 27mm;
}

.money-col {
  width: 30mm;
  text-align: right;
  white-space: nowrap;
}

.invoice-total {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 35mm;
  column-gap: 8mm;
  align-items: baseline;
  margin-top: 0;
  padding-top: 4mm;
  border-top: 2px solid var(--invoice-primary);
  font-size: 13px;
}

.invoice-total span {
  color: var(--invoice-label);
  font-weight: 750;
  text-align: right;
}

.invoice-total strong {
  color: var(--invoice-primary);
  font-size: 13px;
  font-weight: 800;
  text-align: right;
}

.legal-note {
  margin-top: 13mm;
  max-width: 172mm;
  color: #3f4644;
  font-size: 13px;
}

.items-section .legal-note-inline {
  margin: -0.7em 0 5mm;
}

.signature {
  margin-top: 15mm;
  font-size: 13px;
  line-height: 1.45;
}

.signature p {
  margin: 0;
  color: var(--invoice-label);
}

.signature strong {
  color: #20252a;
  display: block;
  margin-top: 0;
  font-size: 13px;
  line-height: 1.45;
}

.continuation-label {
  margin: 0 0 6mm;
  color: var(--invoice-muted);
  font-size: 13px;
  font-weight: 750;
}

.page-number {
  position: absolute;
  right: 16mm;
  bottom: 8mm;
  margin: 0;
  color: #7c8783;
  font-size: 11px;
}

@media (max-width: 900px) {
  .workspace-grid {
    grid-template-columns: 1fr;
    padding: 1rem;
  }

  .editor-panel {
    border-radius: 0;
  }

  .preview-stage {
    padding: 0.75rem;
  }

}

@media (max-width: 640px) {
  .field-grid-2,
  .field-grid-3,
  .template-row,
  .item-fields,
  .payment-row {
    grid-template-columns: 1fr;
  }

  .archive-filters {
    grid-template-columns: 1fr 1fr;
  }

  .archive-filters .compact-button {
    grid-column: 1 / -1;
  }
}

/* Modern application chrome. Invoice document styles above intentionally stay unchanged. */
.app-shell {
  min-height: 100vh;
  background:
    radial-gradient(circle at 8% 3%, rgb(31 79 70 / 8%), transparent 24rem),
    radial-gradient(circle at 95% 20%, rgb(92 116 143 / 7%), transparent 28rem),
    #f5f6f7;
}

.workspace-grid {
  grid-template-columns: minmax(440px, 500px) minmax(0, 1fr);
  gap: 1.25rem;
  max-width: 1680px;
  padding: 1.25rem;
}

.editor-panel {
  border: 1px solid rgb(28 42 38 / 8%);
  border-radius: 20px;
  background: rgb(255 255 255 / 94%);
  padding: 0;
  box-shadow:
    0 1px 2px rgb(20 35 31 / 4%),
    0 20px 55px rgb(20 35 31 / 8%);
  backdrop-filter: blur(24px);
  scrollbar-color: #cbd5d1 transparent;
  scrollbar-width: thin;
}

.editor-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: grid;
  gap: 1rem;
  margin: 0;
  border-bottom: 1px solid #edf0ef;
  border-radius: 20px 20px 0 0;
  background: rgb(255 255 255 / 94%);
  padding: 1.25rem 1.25rem 1rem;
  backdrop-filter: blur(20px);
}

.app-identity {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.app-mark {
  display: grid;
  flex: none;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 13px;
  background: #1f4f46;
  color: #ffffff;
  font-size: 1.05rem;
  font-weight: 800;
  box-shadow: 0 8px 18px rgb(31 79 70 / 20%);
}

.app-kicker {
  display: block;
  margin-bottom: 0.18rem;
  color: #86928e;
  font-size: 0.66rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.editor-header h1 {
  font-size: 1.35rem;
  font-weight: 720;
  letter-spacing: -0.035em;
}

.editor-header .user-status {
  margin-top: 0.28rem;
  color: #8a9591;
  font-size: 0.76rem;
}

.user-status strong {
  color: #53635f;
  font-weight: 750;
}

.header-actions {
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr);
  gap: 0.5rem;
}

.header-actions .primary-button {
  justify-content: center;
}

.account-actions {
  display: flex;
  grid-column: 1 / -1;
  gap: 0.9rem;
  padding-top: 0.1rem;
}

.logout-link {
  padding: 0;
  color: #8a9591;
  font-size: 0.72rem;
  font-weight: 650;
}

.logout-link:hover {
  color: #1f4f46;
  text-decoration: none;
}

.archive-panel {
  margin: 0;
  border: 0;
  border-bottom: 1px solid #edf0ef;
  border-radius: 0;
  background: #fafbfb;
  padding: 1.15rem 1.25rem;
}

.archive-heading {
  gap: 0.9rem;
}

.archive-heading h2 {
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.archive-heading p {
  margin-top: 0.25rem;
  color: #8a9591;
  font-size: 0.74rem;
}

.archive-filters {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
  gap: 0.55rem;
}

.archive-filters label {
  color: #8a9591;
  font-size: 0.68rem;
}

.invoice-archive {
  gap: 0.35rem;
  max-height: 210px;
  margin-top: 0.75rem;
}

.archive-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: stretch;
  border: 1px solid transparent;
  border-radius: 10px;
  transition: border-color 140ms ease, background 140ms ease, transform 140ms ease;
}

.archive-row:hover {
  border-color: #e3e9e7;
  background: #ffffff;
  transform: translateX(2px);
}

.archive-row.is-current {
  border-color: #cbded8;
  background: #edf5f2;
}

.archive-item {
  min-width: 0;
  border: 0;
  border-radius: 10px;
  background: transparent;
  padding: 0.62rem 0.7rem;
  transition: background 140ms ease;
}

.archive-item:hover {
  background: rgb(255 255 255 / 55%);
}

.archive-delete {
  display: grid;
  width: 32px;
  height: 32px;
  align-self: center;
  place-items: center;
  margin-right: 0.4rem;
  border: 1px solid #efd8d1;
  border-radius: 8px;
  background: #fff8f6;
  padding: 0;
  color: #a04d3a;
  cursor: pointer;
  transition: border-color 140ms ease, background 140ms ease, color 140ms ease, transform 140ms ease;
}

.archive-delete svg {
  width: 17px;
  height: 17px;
  fill: currentColor;
}

.archive-delete:hover {
  border-color: #e6b8aa;
  background: #fff0ec;
  color: #843723;
  transform: translateY(-1px);
}

.archive-delete:focus-visible {
  outline: 3px solid rgb(160 77 58 / 18%);
  outline-offset: 2px;
}

.archive-item strong {
  font-size: 0.82rem;
  font-weight: 750;
}

.archive-item small {
  color: #8a9591;
  font-size: 0.69rem;
}

.archive-item b {
  color: #355f57;
  font-size: 0.78rem;
  font-weight: 750;
}

.confirmation-dialog {
  width: min(calc(100% - 2rem), 430px);
  border: 0;
  border-radius: 18px;
  background: transparent;
  padding: 0;
  color: #24312d;
  box-shadow: 0 26px 80px rgb(20 35 31 / 24%);
}

.confirmation-dialog::backdrop {
  background: rgb(20 29 27 / 48%);
  backdrop-filter: blur(4px);
}

.confirmation-dialog-card {
  display: grid;
  gap: 1.2rem;
  background: #ffffff;
  padding: 1.6rem;
}

.confirmation-dialog-card h2 {
  margin: 0.2rem 0 0.45rem;
  font-size: 1.25rem;
}

.confirmation-dialog-card p {
  margin: 0;
  color: #6d7975;
  font-size: 0.84rem;
  line-height: 1.5;
}

.confirmation-kicker {
  color: #a04d3a;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.confirmation-error:empty {
  display: none;
}

.confirmation-dialog-card .confirmation-error {
  color: #a24327;
}

.confirmation-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem;
}

.confirmation-actions button {
  width: 100%;
}

.confirmation-actions button:disabled {
  cursor: not-allowed;
  opacity: 0.42;
}

#invoiceForm {
  gap: 0;
  padding: 0 1.25rem 1.5rem;
}

.editor-section {
  gap: 0.9rem;
  margin: 0;
  border: 0;
  border-bottom: 1px solid #edf0ef;
  border-radius: 0;
  background: transparent;
  padding: 1.35rem 0;
}

.editor-section:last-child {
  border-bottom: 0;
}

.editor-section legend {
  width: 100%;
  margin-bottom: 0.1rem;
  padding: 0;
  color: #25332f;
  font-size: 0.86rem;
  font-weight: 780;
  letter-spacing: -0.01em;
}

label {
  gap: 0.42rem;
  color: #6d7975;
  font-size: 0.73rem;
  font-weight: 680;
}

input,
textarea,
select {
  border: 1px solid #e2e7e5;
  border-radius: 10px;
  background: #f8f9f9;
  padding: 0.7rem 0.78rem;
  color: #24312d;
  font-size: 0.86rem;
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 75%);
}

input:hover,
textarea:hover,
select:hover {
  border-color: #cdd7d3;
  background: #ffffff;
}

input:focus,
textarea:focus,
select:focus {
  border-color: #7ba398;
  background: #ffffff;
  box-shadow: 0 0 0 4px rgb(31 79 70 / 9%);
}

textarea {
  line-height: 1.5;
}

.primary-button,
.secondary-button,
.danger-button,
.ghost-button {
  min-height: 40px;
  border-radius: 10px;
  padding: 0.62rem 0.88rem;
  font-size: 0.78rem;
  font-weight: 760;
}

.primary-button {
  background: #1f4f46;
  box-shadow: 0 8px 18px rgb(31 79 70 / 17%);
}

.primary-button:hover {
  background: #193f38;
  box-shadow: 0 10px 22px rgb(31 79 70 / 22%);
}

.secondary-button {
  border: 1px solid #d4dfdb;
  background: #ffffff;
  color: #315b53;
}

.secondary-button:hover {
  border-color: #b9cdc6;
  background: #f4f8f7;
}

.ghost-button {
  border: 1px solid #e0e6e4;
  background: #f7f9f8;
  color: #5b6a65;
}

.ghost-button:hover {
  border-color: #c8d5d1;
  background: #ffffff;
}

.danger-button {
  min-height: 30px;
  border: 0;
  border-radius: 8px;
  background: #fff2ee;
  color: #ac5137;
}

.danger-button:hover {
  background: #ffe7e0;
}

.field-grid,
.template-row,
.items-editor-list {
  gap: 0.65rem;
}

.color-picker-row {
  grid-template-columns: 54px minmax(0, 1fr);
  gap: 0.65rem;
}

.color-picker-row input[type="color"] {
  height: 42px;
  border-radius: 10px;
  background: #ffffff;
}

.color-picker-row output {
  color: #7a8782;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.75rem;
}

.color-presets {
  gap: 0.5rem;
}

.color-presets button {
  width: 29px;
  height: 29px;
  border-width: 2px;
  box-shadow: 0 0 0 1px #dce3e0;
}

.color-presets button:hover,
.color-presets button.is-selected {
  box-shadow: 0 0 0 2px #51635d;
}

.field-help {
  color: #95a09c;
  font-size: 0.7rem;
}

.item-editor {
  gap: 0.72rem;
  border: 1px solid #e8eceb;
  border-radius: 12px;
  background: #fafbfb;
  padding: 0.85rem;
}

.item-editor-head strong {
  color: #324b44;
  font-size: 0.78rem;
}

.item-total-box {
  min-height: 42px;
  border: 1px solid #e1e7e5;
  border-radius: 10px;
  background: #ffffff;
  padding: 0.5rem 0.65rem;
}

.item-total-box span {
  color: #99a39f;
  font-size: 0.62rem;
  text-transform: uppercase;
}

.item-total-box strong {
  color: #31473f;
  font-size: 0.82rem;
}

.preview-column {
  position: sticky;
  top: 1.25rem;
  align-self: start;
  min-width: 0;
}

.preview-toolbar {
  margin: 0 0 0.65rem;
  padding: 0 0.2rem;
  color: #4d5d58;
  font-size: 0.76rem;
}

.preview-toolbar > span:first-child {
  display: flex;
  align-items: baseline;
  gap: 0.55rem;
}

.preview-toolbar strong {
  font-size: 0.78rem;
}

.preview-toolbar small {
  color: #9aa4a0;
  font-size: 0.68rem;
  font-weight: 600;
}

#pdfStatus {
  color: #55756c;
}

.preview-stage {
  overflow-x: hidden;
  overflow-y: auto;
  max-height: calc(100vh - 4.4rem);
  border: 1px solid rgb(31 47 42 / 7%);
  border-radius: 20px;
  background: #e9eceb;
  padding: 1.4rem;
  box-shadow:
    inset 0 1px 0 rgb(255 255 255 / 50%),
    0 15px 42px rgb(30 45 40 / 7%);
}

@media (max-width: 1160px) {
  .workspace-grid {
    grid-template-columns: minmax(390px, 460px) minmax(0, 1fr);
    padding: 0.85rem;
  }
}

@media (max-width: 900px) {
  .workspace-grid {
    grid-template-columns: 1fr;
    padding: 0.75rem;
  }

  .editor-panel {
    border-radius: 16px;
  }

  .editor-header {
    position: static;
    border-radius: 16px 16px 0 0;
  }

  .preview-column {
    position: static;
  }

  .preview-stage {
    max-height: none;
    border-radius: 16px;
    padding: 0.75rem;
  }
}

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

  .header-actions .primary-button {
    grid-column: 1 / -1;
  }

  .archive-filters {
    grid-template-columns: 1fr 1fr;
  }

  .archive-filters .compact-button {
    grid-column: 1 / -1;
  }
}

@media print {
  body,
  .app-shell {
    background: #ffffff;
  }

  .no-print {
    display: none !important;
  }

  .preview-stage {
    border: 0;
    padding: 0;
    background: #ffffff;
    box-shadow: none;
  }

  .invoice-page {
    width: 210mm;
    min-height: 297mm;
    box-shadow: none;
  }

  .invoice-page-frame {
    width: auto !important;
    height: auto !important;
    overflow: visible;
    background: transparent;
    box-shadow: none;
    break-after: page;
    page-break-after: always;
  }

  .invoice-page-frame .invoice-page {
    margin: 0 auto;
    transform: none;
  }

  .invoice-page-frame:not(:last-child) .invoice-page,
  .invoice-page-frame:last-child .invoice-page {
    break-after: auto;
    page-break-after: auto;
  }

  .invoice-page-frame:last-child {
    break-after: auto;
    page-break-after: auto;
  }
}

.login-body {
  display: grid;
  min-width: 320px;
  min-height: 100vh;
  place-items: center;
  margin: 0;
  background:
    linear-gradient(135deg, rgb(31 79 70 / 12%), transparent 40%),
    #f2f5f4;
  padding: 1rem;
}

.login-card {
  width: min(100%, 390px);
  border: 1px solid #d9e1df;
  border-radius: 10px;
  background: #ffffff;
  padding: 1.5rem;
  box-shadow: 0 20px 55px rgb(21 40 38 / 12%);
}

.login-card h1 {
  margin: 0;
  color: #1d252c;
  font-size: 1.6rem;
}

.login-card > p {
  margin: 0.45rem 0 1.25rem;
  color: #64736f;
}

.login-card form {
  display: grid;
  gap: 1rem;
}

.login-card .primary-button {
  justify-content: center;
}

.login-card .login-error {
  border: 1px solid #efb7a5;
  border-radius: 6px;
  background: #fff3ef;
  padding: 0.7rem;
  color: #a24327;
  font-size: 0.85rem;
}

.login-card .login-success {
  border: 1px solid #aed4c8;
  border-radius: 6px;
  background: #eff8f5;
  padding: 0.7rem;
  color: #1f4f46;
  font-size: 0.85rem;
}

.login-body {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(circle at 20% 10%, rgb(31 79 70 / 14%), transparent 32rem),
    radial-gradient(circle at 90% 90%, rgb(91 113 139 / 10%), transparent 28rem),
    #f5f6f7;
  padding: 1.5rem;
}

.login-body::before {
  position: absolute;
  width: 460px;
  height: 460px;
  border: 1px solid rgb(31 79 70 / 9%);
  border-radius: 50%;
  content: "";
  transform: translate(-48vw, -40vh);
}

.login-card {
  position: relative;
  box-sizing: border-box;
  width: min(100%, 410px);
  border: 1px solid rgb(28 42 38 / 8%);
  border-radius: 22px;
  background: rgb(255 255 255 / 94%);
  padding: 2.25rem;
  text-align: center;
  box-shadow:
    0 1px 2px rgb(20 35 31 / 4%),
    0 24px 70px rgb(20 35 31 / 10%);
  backdrop-filter: blur(24px);
}

.login-card::before {
  display: grid;
  width: 44px;
  height: 44px;
  margin: 0 auto 1.2rem;
  place-items: center;
  border-radius: 14px;
  background: #1f4f46;
  color: #ffffff;
  content: "F";
  font-size: 1.05rem;
  font-weight: 800;
  box-shadow: 0 9px 20px rgb(31 79 70 / 20%);
}

.login-card h1 {
  color: #25332f;
  font-size: 1.55rem;
  font-weight: 740;
  letter-spacing: -0.04em;
}

.login-card > p {
  margin: 0.45rem 0 1.5rem;
  color: #89948f;
  font-size: 0.84rem;
  line-height: 1.5;
}

.login-card form {
  gap: 1rem;
  text-align: left;
}

.login-card label,
.login-card input,
.login-card button {
  box-sizing: border-box;
  min-width: 0;
  max-width: 100%;
}

.login-card input {
  width: 100%;
}

.login-card .primary-button {
  width: 100%;
  margin-top: 0.2rem;
}

.login-card .logout-link {
  justify-self: center;
  padding: 0.3rem;
}

.login-card .login-error,
.login-card .login-success {
  border-radius: 10px;
  padding: 0.75rem 0.85rem;
  font-size: 0.76rem;
  text-align: left;
}

@media (max-width: 520px) {
  .login-body {
    padding: 1rem;
  }

  .login-card {
    padding: 1.5rem;
  }
}
