@font-face {
  font-family: "Museo";
  src: url("assets/Museo300-Regular.woff") format("woff");
  font-weight: 300;
  font-display: swap;
}

@font-face {
  font-family: "Museo";
  src: url("assets/Museo700-Regular.woff") format("woff");
  font-weight: 700;
  font-display: swap;
}

:root {
  --bordeaux: #8b1538;
  --bordeaux-dark: #6e102c;
  --orange: #e85d2f;
  --ink: #2e2a28;
  --muted: #756b64;
  --beige: #f5f1ea;
  --paper: #fffefb;
  --line: rgba(139, 21, 56, 0.16);
  --surface: rgba(255, 254, 251, 0.94);
  --surface-solid: #fffefb;
  --shadow-soft: 0 12px 34px rgba(65, 44, 36, 0.09);
  --shadow: 0 28px 80px rgba(65, 44, 36, 0.17);
  --radius: 14px;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  min-width: 320px;
  background: var(--beige);
}

body {
  margin: 0;
  color: var(--ink);
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  line-height: 1.5;
  text-rendering: optimizeLegibility;
}

html.auth-locked {
  overflow: hidden;
}

html.auth-locked .blueprint-bg,
html.auth-locked .app-header,
html.auth-locked .app-nav,
html.auth-locked .app-main {
  visibility: hidden;
}

.auth-gate {
  position: fixed;
  z-index: 100;
  display: grid;
  place-items: center;
  inset: 0;
  padding: 24px;
  background:
    linear-gradient(rgba(245, 241, 234, 0.9), rgba(245, 241, 234, 0.94)),
    url("assets/blueprint-bg-light.png") center / cover;
}

.auth-card {
  display: grid;
  width: min(440px, 100%);
  padding: 38px;
  border: 1px solid rgba(139, 21, 56, 0.14);
  border-radius: 20px;
  background: rgba(255, 254, 251, 0.98);
  box-shadow: 0 28px 80px rgba(65, 44, 36, 0.2);
}

.auth-logo {
  width: 170px;
  max-height: 72px;
  margin-bottom: 24px;
  object-fit: contain;
  object-position: left center;
}

.auth-card h1 {
  margin: 5px 0 8px;
  color: var(--bordeaux);
  font-family: Museo, Georgia, serif;
  font-size: 2rem;
  line-height: 1.08;
}

.auth-card > p,
.auth-card > small {
  color: var(--muted);
}

.auth-card > p {
  margin: 0 0 24px;
}

.auth-card > small {
  margin-top: 18px;
  text-align: center;
}

.auth-form {
  display: grid;
  gap: 8px;
}

.auth-form label {
  margin-top: 6px;
  font-size: 0.76rem;
  font-weight: 750;
}

.auth-form input {
  width: 100%;
  min-height: 46px;
  padding: 10px 12px;
  border: 1px solid rgba(139, 21, 56, 0.2);
  border-radius: 9px;
  outline: none;
  background: #fff;
}

.auth-form input:focus {
  border-color: var(--bordeaux);
  box-shadow: 0 0 0 4px rgba(139, 21, 56, 0.08);
}

.auth-form .button {
  min-height: 48px;
  margin-top: 12px;
}

.auth-error {
  margin: 4px 0 0;
  color: #a01f2f;
  font-size: 0.76rem;
  font-weight: 700;
}

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

button {
  cursor: pointer;
}

button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: 3px solid rgba(232, 93, 47, 0.25);
  outline-offset: 2px;
}

::selection {
  background: rgba(139, 21, 56, 0.16);
  color: var(--bordeaux-dark);
}

.blueprint-bg {
  position: fixed;
  z-index: -1;
  inset: 0;
  background:
    linear-gradient(rgba(245, 241, 234, 0.76), rgba(245, 241, 234, 0.76)),
    url("assets/blueprint-bg-light.png") center / cover;
}

.app-header {
  position: sticky;
  z-index: 10;
  top: 0;
  border-bottom: 1px solid rgba(139, 21, 56, 0.1);
  background: rgba(252, 250, 247, 0.9);
  box-shadow: 0 8px 28px rgba(65, 44, 36, 0.07);
  backdrop-filter: blur(18px) saturate(1.25);
}

.app-header__inner {
  display: flex;
  align-items: center;
  width: min(1460px, 100%);
  min-height: 76px;
  margin: auto;
  padding: 10px 28px;
  gap: 18px;
}

.app-logo {
  width: 144px;
  height: auto;
  filter: drop-shadow(0 4px 10px rgba(65, 44, 36, 0.08));
}

.app-header__title {
  display: grid;
  padding-left: 18px;
  border-left: 1px solid var(--line);
}

.app-header__title strong {
  font-family: Museo, sans-serif;
  font-size: 1rem;
  font-weight: 700;
}

.eyebrow,
.section-label {
  color: var(--bordeaux);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.toolbar {
  display: flex;
  align-items: center;
  margin-left: auto;
  gap: 9px;
}

.app-nav {
  position: sticky;
  z-index: 9;
  top: 76px;
  display: flex;
  justify-content: center;
  gap: 6px;
  padding: 9px 20px;
  border-bottom: 1px solid var(--line);
  background: rgba(245, 241, 234, 0.88);
  box-shadow: 0 8px 24px rgba(65, 44, 36, 0.035);
  backdrop-filter: blur(16px) saturate(1.2);
}

.nav-tab {
  position: relative;
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 7px 15px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 750;
  gap: 7px;
  transition: color 160ms ease, background 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.nav-tab:hover {
  background: rgba(255, 255, 255, 0.68);
  color: var(--bordeaux);
}

.nav-tab.is-active {
  background: #fff;
  color: var(--bordeaux);
  box-shadow: 0 6px 20px rgba(65, 44, 36, 0.09);
  transform: translateY(-1px);
}

.nav-tab.is-active::after {
  position: absolute;
  right: 15px;
  bottom: -10px;
  left: 15px;
  height: 2px;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--bordeaux), var(--orange));
  content: "";
}

.nav-tab span {
  display: inline-grid;
  place-items: center;
  min-width: 19px;
  height: 19px;
  padding: 0 5px;
  border-radius: 10px;
  background: rgba(139, 21, 56, 0.09);
  font-size: 0.65rem;
}

.app-view[hidden] {
  display: none !important;
}

.save-status {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  margin-right: 6px;
  padding: 5px 10px;
  border: 1px solid rgba(67, 126, 86, 0.13);
  border-radius: 999px;
  background: rgba(67, 126, 86, 0.07);
  color: #4d6655;
  font-size: 0.7rem;
  font-weight: 700;
  gap: 7px;
}

.save-status::before {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #4f9d69;
  box-shadow: 0 0 0 3px rgba(79, 157, 105, 0.12);
  content: "";
}

.button {
  min-height: 42px;
  padding: 9px 16px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  font-size: 0.82rem;
  font-weight: 750;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease, color 160ms ease, box-shadow 160ms ease;
}

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

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

.button--ghost {
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.8);
  box-shadow: 0 3px 10px rgba(65, 44, 36, 0.035);
}

.button--ghost:hover {
  border-color: var(--bordeaux);
  color: var(--bordeaux);
}

.button--primary {
  background: linear-gradient(135deg, var(--bordeaux), var(--bordeaux-dark));
  color: #fff;
  box-shadow: 0 8px 22px rgba(139, 21, 56, 0.22);
}

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

.workspace {
  display: grid;
  grid-template-columns: minmax(250px, 310px) minmax(680px, 940px);
  justify-content: center;
  align-items: start;
  gap: 26px;
  padding: 42px 28px 72px;
}

.settings-card {
  position: sticky;
  top: 118px;
  display: grid;
  overflow: hidden;
  gap: 20px;
  padding: 26px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(14px);
}

.settings-card::before {
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--bordeaux) 0 72%, var(--orange) 72%);
  content: "";
}

.client-block__head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 7px;
  gap: 14px;
}

.client-block__head .section-label {
  margin: 0;
}

.text-button {
  padding: 3px 0;
  border: 0;
  border-bottom: 1px solid rgba(139, 21, 56, 0.28);
  background: transparent;
  color: var(--bordeaux);
  font-size: 0.64rem;
  font-weight: 750;
}

.text-button:hover {
  color: var(--orange);
}

.settings-card h1 {
  margin: 4px 0 6px;
  color: #1a1a1a;
  font-family: Museo, Georgia, serif;
  font-size: 1.55rem;
  line-height: 1.2;
}

.settings-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.85rem;
}

.settings-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.settings-group {
  display: grid;
  gap: 6px;
}

.settings-group label {
  font-size: 0.72rem;
  font-weight: 750;
}

.settings-group input,
.settings-group select,
.settings-group textarea {
  width: 100%;
  min-height: 42px;
  padding: 8px 10px;
  border: 1px solid #d8d0c9;
  border-radius: 10px;
  outline: none;
  background: #fff;
  font-size: 0.85rem;
  transition: border-color 150ms ease, box-shadow 150ms ease, background 150ms ease;
}

.settings-group input:hover,
.settings-group select:hover,
.settings-group textarea:hover {
  border-color: rgba(139, 21, 56, 0.32);
}

.settings-group input:focus,
.settings-group select:focus,
.settings-group textarea:focus {
  border-color: var(--bordeaux);
  box-shadow: 0 0 0 3px rgba(139, 21, 56, 0.09);
}

.settings-group textarea {
  resize: vertical;
}

.field-help {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.68rem;
  line-height: 1.4;
}

.document-type-control {
  display: none;
}

.tip {
  padding: 16px;
  border-left: 3px solid var(--orange);
  border-radius: 0 10px 10px 0;
  background: rgba(232, 93, 47, 0.07);
}

.tip--warning {
  border-color: rgba(196, 118, 20, 0.32);
  background: rgba(255, 244, 220, 0.78);
}

.tip--warning strong {
  color: #8a520b;
}

.tip strong {
  display: block;
  margin-bottom: 4px;
  color: var(--bordeaux);
  font-size: 0.76rem;
}

.invoice-shell {
  width: 100%;
}

.preview-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: 42px;
  padding: 8px 14px;
  border: 1px solid rgba(139, 21, 56, 0.1);
  border-bottom: 0;
  border-radius: 12px 12px 0 0;
  background: rgba(255, 254, 251, 0.9);
  color: var(--muted);
  font-size: 0.68rem;
  box-shadow: 0 10px 28px rgba(65, 44, 36, 0.06);
  backdrop-filter: blur(12px);
}

.preview-bar span {
  display: inline-flex;
  align-items: center;
  color: var(--ink);
  font-weight: 750;
  gap: 8px;
}

.preview-bar i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--orange);
  box-shadow: 0 0 0 4px rgba(232, 93, 47, 0.1);
}

.invoice {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  aspect-ratio: 210 / 297;
  min-height: 0;
  overflow: hidden;
  padding: 58px 64px 198px;
  background: #fff url("assets/letterhead-bg.png?v=20260731-2") top center / 100% auto repeat-y;
  border: 1px solid rgba(139, 21, 56, 0.08);
  border-radius: 0 0 8px 8px;
  box-shadow: var(--shadow);
}

.invoice.is-el-animo {
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.98) 0 68%, rgba(139, 21, 56, 0.045) 100%),
    repeating-linear-gradient(135deg, transparent 0 22px, rgba(46, 42, 40, 0.025) 22px 23px),
    #fff;
}

.invoice.is-el-animo.invoice--continuation::before {
  position: absolute;
  top: 68px;
  left: 64px;
  content: "EL ANIMO SRL";
  color: #1f1c1a;
  font-family: Museo, Georgia, serif;
  font-size: 1.45rem;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.invoice--continuation {
  margin-top: 30px;
  border-radius: 8px;
}

.continuation-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  padding-top: 145px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--line);
  gap: 30px;
}

.continuation-header div {
  display: grid;
  gap: 5px;
}

.continuation-header span {
  color: var(--bordeaux);
  font-family: Museo, Georgia, serif;
  font-size: 1.35rem;
  font-weight: 700;
}

.continuation-header strong,
.continuation-header small {
  font-size: 0.7rem;
  letter-spacing: 0.06em;
}

.continuation-header small {
  color: var(--muted);
}

.continuation-items-wrap,
.continuation-free-content {
  margin-top: 24px;
}

.invoice__accent {
  display: none;
}

.invoice__header {
  display: flex;
  justify-content: space-between;
  gap: 40px;
  padding-top: 145px;
  padding-bottom: 30px;
  border-bottom: 1px solid var(--line);
}

.company {
  display: grid;
  gap: 20px;
}

.company__logo {
  display: none;
}

.company__wordmark {
  display: block;
  margin: 0;
  color: #1f1c1a;
  font-family: Museo, Georgia, serif;
  font-size: 1.65rem;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.invoice.is-el-animo .company {
  gap: 10px;
}

.invoice.is-el-animo .company__details {
  color: #514a46;
}

.company__details {
  display: grid;
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.55;
}

.company__details strong {
  color: var(--bordeaux);
  font-size: 0.76rem;
}

.invoice-title {
  min-width: 220px;
  text-align: right;
}

.invoice-title span {
  display: block;
  margin-bottom: 3px;
  color: var(--orange);
  font-size: 0.61rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.invoice-title h2 {
  margin: 0;
  color: var(--bordeaux);
  font-family: Museo, Georgia, serif;
  font-size: 3rem;
  font-weight: 300;
  line-height: 1;
}

.invoice-title strong {
  display: block;
  margin-top: 12px;
  font-size: 0.82rem;
  letter-spacing: 0.08em;
}

.invoice-meta {
  display: grid;
  grid-template-columns: 1.35fr 1fr;
  gap: 54px;
  padding: 34px 0 38px;
}

.client-block {
  display: grid;
  gap: 5px;
}

.section-label {
  display: block;
  margin-bottom: 7px;
}

.paper-input,
.item-description,
.item-details,
.item-quantity,
.item-price {
  width: 100%;
  border: 1px solid transparent;
  border-radius: 7px;
  outline: none;
  background: rgba(255, 255, 255, 0.54);
}

.paper-input {
  padding: 5px 7px;
  resize: vertical;
  font-size: 0.78rem;
}

textarea.paper-input,
.item-description,
.item-details,
#quoteFreeText {
  overflow: hidden;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.paper-input--strong {
  color: #1a1a1a;
  font-size: 1rem;
  font-weight: 750;
}

.paper-input:hover,
.paper-input:focus,
.item-description:hover,
.item-description:focus,
.item-details:hover,
.item-details:focus,
.item-quantity:hover,
.item-quantity:focus,
.item-price:hover,
.item-price:focus {
  border-color: rgba(139, 21, 56, 0.28);
  background: #fff;
}

::placeholder {
  color: #9d938c;
  opacity: 1;
}

.date-block {
  display: grid;
  align-content: start;
  margin: 0;
  border-top: 1px solid var(--line);
}

.date-block div {
  display: flex;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
  gap: 18px;
}

.date-block dt {
  color: var(--muted);
  font-size: 0.7rem;
}

.date-block dd {
  margin: 0;
  font-size: 0.73rem;
  font-weight: 750;
  text-align: right;
}

.line-items-wrap {
  overflow: visible;
}

.line-items {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.line-items th {
  padding: 11px 8px;
  border-bottom: 2px solid var(--bordeaux);
  color: var(--bordeaux);
  font-size: 0.62rem;
  letter-spacing: 0.09em;
  text-align: left;
  text-transform: uppercase;
}

.line-items th:first-child {
  width: 43%;
  padding-left: 4px;
}

.line-items th:nth-child(3) {
  width: 12%;
}

.line-items th:nth-child(4) {
  width: 19%;
}

.line-items th:nth-child(5) {
  width: 19%;
}

.line-items th.action-column {
  width: 7%;
}

.number-column {
  text-align: right !important;
}

.line-item td {
  padding: 13px 8px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

.line-item {
  break-inside: avoid;
  page-break-inside: avoid;
}

.line-item td:first-child {
  padding-left: 0;
}

.item-description {
  min-height: 48px;
  padding: 7px;
  resize: vertical;
  font-size: 0.75rem;
}

.quote-details-column,
.quote-details-cell {
  display: none;
}

.item-details {
  min-height: 76px;
  padding: 7px;
  resize: vertical;
  font-size: 0.72rem;
}

.item-quantity,
.item-price {
  min-height: 36px;
  padding: 6px;
  font-size: 0.74rem;
  text-align: right;
}

.money-input {
  display: flex;
  align-items: center;
}

.money-input span {
  margin-left: -22px;
  color: var(--muted);
  font-size: 0.7rem;
  pointer-events: none;
}

.money-input input {
  padding-right: 24px;
}

.item-total {
  font-size: 0.75rem;
  font-weight: 750;
  text-align: right;
  white-space: nowrap;
}

.line-action {
  text-align: right;
}

.remove-line {
  width: 29px;
  height: 29px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: #9d938c;
  font-size: 1.15rem;
  line-height: 1;
}

.remove-line:hover {
  background: rgba(139, 21, 56, 0.08);
  color: var(--bordeaux);
}

.add-line {
  display: inline-flex;
  align-items: center;
  align-self: flex-start;
  margin-top: 15px;
  padding: 8px 12px;
  border: 1px dashed rgba(139, 21, 56, 0.32);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.5);
  color: var(--bordeaux);
  font-size: 0.71rem;
  font-weight: 750;
  gap: 7px;
  transition: 160ms ease;
}

.add-line:hover {
  border-color: var(--bordeaux);
  background: #fff;
  box-shadow: 0 6px 18px rgba(139, 21, 56, 0.08);
  transform: translateY(-1px);
}

.add-line span {
  color: var(--orange);
  font-size: 1rem;
}

.add-section {
  margin-top: 9px;
  border-color: rgba(46, 42, 40, 0.28);
  color: #262220;
}

.service-section-row td {
  padding: 0 !important;
  border: 0 !important;
  background: #fff !important;
}

.service-section-row.is-active-section td {
  box-shadow: 0 0 0 2px rgba(239, 92, 50, 0.42);
}

.service-section-free-text-row td {
  padding: 0 !important;
  border: 0 !important;
  background: #fff !important;
}

.service-section-free-content {
  margin: 0;
  border-top: 0;
  border-right: 1px solid rgba(46, 42, 40, 0.32);
  border-bottom: 1px solid rgba(46, 42, 40, 0.32);
  border-left: 1px solid rgba(46, 42, 40, 0.32);
  background: rgba(255, 255, 255, 0.78);
}

.service-section-heading {
  display: grid;
  grid-template-columns: 32px 1fr 34px;
  align-items: center;
  padding: 10px 9px;
  background: var(--bordeaux);
  gap: 10px;
}

.service-section-number {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  background: #fff;
  color: var(--bordeaux);
  font-weight: 800;
}

.service-section-title {
  width: 100%;
  min-height: 34px;
  padding: 7px 9px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.34);
  border-radius: 4px;
  outline: none;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  font-size: 0.78rem;
  font-weight: 750;
  resize: none;
}

.service-section-title::placeholder {
  color: rgba(255, 255, 255, 0.78);
}

.service-section-title:focus {
  border-color: #fff;
  background: rgba(255, 255, 255, 0.17);
}

.remove-section {
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font-size: 1.15rem;
}

.remove-section:hover {
  background: #fff;
  color: var(--bordeaux);
}

.invoice-summary {
  display: grid;
  grid-template-columns: 1fr minmax(270px, 0.85fr);
  align-items: start;
  margin-top: 38px;
  gap: 48px;
}

.notes-block textarea {
  min-height: 74px;
}

.totals {
  display: grid;
  margin: 0;
}

.totals > div {
  display: flex;
  justify-content: space-between;
  padding: 9px 4px;
  border-bottom: 1px solid var(--line);
  gap: 20px;
}

.totals dt {
  color: var(--muted);
  font-size: 0.72rem;
}

.totals dd {
  margin: 0;
  font-size: 0.75rem;
  font-weight: 750;
  white-space: nowrap;
}

.totals .totals__grand {
  align-items: center;
  margin-top: 9px;
  padding: 15px 14px;
  border: 0;
  border-radius: 5px;
  background: var(--bordeaux);
  color: #fff;
}

.totals__grand dt {
  color: #fff;
  font-size: 0.78rem;
  font-weight: 750;
}

.totals__grand dd {
  font-size: 1.16rem;
}

.invoice__footer {
  display: flex;
  justify-content: space-between;
  align-items: end;
  margin-top: auto;
  padding-top: 40px;
  border-top: 1px solid var(--line);
  gap: 30px;
  color: var(--muted);
  font-size: 0.66rem;
  visibility: hidden;
}

.invoice__footer p {
  margin: 0;
}

.invoice__footer strong {
  color: var(--bordeaux);
}

.invoice__footer > span {
  color: var(--bordeaux);
  font-family: Museo, sans-serif;
  font-weight: 700;
  white-space: nowrap;
}

.quote-introduction {
  margin-bottom: 32px;
  font-size: 0.77rem;
  line-height: 1.55;
}

.quote-introduction > p {
  margin: 0 0 10px;
}

.quote-facts {
  display: flex;
  flex-wrap: wrap;
  margin-top: 18px;
  border: 1px solid rgba(46, 42, 40, 0.36);
}

.quote-facts span {
  flex: 1 1 190px;
  padding: 9px 12px;
  border-right: 1px solid rgba(46, 42, 40, 0.22);
}

.quote-section-heading {
  display: flex;
  align-items: flex-start;
  margin: 0 0 12px;
  gap: 12px;
}

.quote-section-heading > span {
  display: grid;
  flex: 0 0 28px;
  place-items: center;
  width: 28px;
  height: 28px;
  background: #222;
  color: #fff;
  font-weight: 700;
}

.quote-section-heading h3 {
  margin: 1px 0 3px;
  font-size: 1rem;
}

.quote-section-heading p {
  margin: 0;
  color: var(--muted);
  font-size: 0.7rem;
}

.invoice.is-quote .invoice__header {
  padding-bottom: 24px;
  border-bottom: 0;
}

.invoice.is-quote .invoice-title h2 {
  color: #222;
  font-size: 2.55rem;
  font-weight: 700;
  text-transform: uppercase;
}

.invoice.is-quote .invoice-title span {
  color: var(--bordeaux);
}

.invoice.is-quote .invoice-meta {
  padding: 20px 0 24px;
  border: 1px solid rgba(46, 42, 40, 0.42);
}

.invoice.is-quote .client-block,
.invoice.is-quote .date-block {
  padding: 0 16px;
}

.invoice.is-quote .line-items {
  border: 0;
}

.invoice.is-quote .quote-section-heading {
  margin-bottom: 0;
  padding: 14px 16px;
  border: 1px solid rgba(46, 42, 40, 0.28);
  border-bottom: 0;
  background: rgba(255, 255, 255, 0.94);
}

.invoice.is-quote .line-items-wrap {
  overflow: visible;
  border: 1px solid rgba(46, 42, 40, 0.32);
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 8px 22px rgba(46, 42, 40, 0.06);
}

.invoice.is-quote .line-items th {
  border-bottom: 0;
  background: #222;
  color: #fff;
  letter-spacing: 0.02em;
  text-transform: none;
}

.invoice.is-quote .quote-details-column,
.invoice.is-quote .quote-details-cell {
  display: table-cell;
}

.invoice.is-quote .line-items th:nth-child(1) {
  width: 32%;
}

.invoice.is-quote .line-items th:nth-child(2) {
  width: 43%;
}

.invoice.is-quote .line-items th:nth-child(4) {
  width: 19%;
}

.invoice.is-quote .line-items th:nth-child(3),
.invoice.is-quote .line-items th:nth-child(5),
.invoice.is-quote .line-item td:nth-child(3),
.invoice.is-quote .line-item td:nth-child(5) {
  display: none;
}

.invoice.is-quote .line-item td {
  border-right: 1px solid rgba(46, 42, 40, 0.22);
  border-bottom-color: rgba(46, 42, 40, 0.3);
  background: rgba(255, 255, 255, 0.96);
  vertical-align: top;
}

.invoice.is-quote .item-description,
.invoice.is-quote .item-details,
.invoice.is-quote .item-quantity,
.invoice.is-quote .item-price {
  border-color: rgba(46, 42, 40, 0.22);
  background: #fff;
  color: #211e1c;
}

.invoice.is-quote .item-description::placeholder,
.invoice.is-quote .item-details::placeholder,
.invoice.is-quote .item-quantity::placeholder,
.invoice.is-quote .item-price::placeholder {
  color: #756c66;
}

.invoice.is-quote .line-item td:nth-child(4) {
  vertical-align: middle;
}

.invoice.is-quote .invoice-summary {
  grid-template-columns: 1fr minmax(250px, 0.65fr);
}

.invoice.is-quote .totals__grand {
  border-radius: 0;
  background: #222;
}

.quote-free-content {
  margin: 4px 0 24px;
  padding: 18px 20px;
  border: 1px solid rgba(46, 42, 40, 0.32);
  background: rgba(255, 255, 255, 0.62);
  color: #25211f;
  font-size: 0.76rem;
  line-height: 1.62;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.quote-free-content p {
  margin: 0 0 12px;
  white-space: pre-wrap;
  break-inside: avoid;
  page-break-inside: avoid;
}

.quote-free-content p:last-child {
  margin-bottom: 0;
}

.legal-details {
  position: absolute;
  right: 64px;
  bottom: 4px;
  left: 64px;
  display: grid;
  margin: 0;
  padding: 6px 12px;
  border-left: 3px solid var(--bordeaux);
  background: rgba(139, 21, 56, 0.045);
  color: #4b4541;
  font-size: 0.61rem;
  line-height: 1.35;
  gap: 0;
  break-inside: avoid;
  page-break-inside: avoid;
}

.legal-details--repeated {
  pointer-events: none;
}

.legal-details strong {
  color: var(--bordeaux);
}

.legal-details p {
  margin: 3px 0 0;
  padding-top: 4px;
  border-top: 1px solid rgba(139, 21, 56, 0.2);
  color: #1f1c1a;
  font-size: 0.59rem;
  font-weight: 750;
}

.management-view {
  width: min(1240px, calc(100% - 48px));
  min-height: 650px;
  margin: 42px auto 70px;
  padding: 34px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--surface);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

.management-head {
  display: flex;
  justify-content: space-between;
  align-items: end;
  padding-bottom: 28px;
  border-bottom: 1px solid var(--line);
  gap: 30px;
}

.management-head h2 {
  margin: 5px 0 4px;
  color: #1a1a1a;
  font-family: Museo, Georgia, serif;
  font-size: 2rem;
  font-weight: 300;
}

.management-head p {
  margin: 0;
  color: var(--muted);
  font-size: 0.84rem;
}

.management-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.search-input {
  width: 220px;
  min-height: 42px;
  padding: 8px 12px;
  border: 1px solid #d8d0c9;
  border-radius: 10px;
  outline: none;
  background: #fff;
  font-size: 0.8rem;
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

.search-input:focus {
  border-color: var(--bordeaux);
  box-shadow: 0 0 0 3px rgba(139, 21, 56, 0.08);
}

.empty-state {
  display: grid;
  align-content: center;
  place-items: center;
  min-height: 320px;
  text-align: center;
  gap: 8px;
}

.empty-state strong {
  color: var(--bordeaux);
  font-family: Museo, Georgia, serif;
  font-size: 1.25rem;
}

.empty-state p {
  max-width: 460px;
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
}

.client-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  padding-top: 24px;
}

.client-card {
  display: grid;
  align-content: start;
  min-height: 215px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: linear-gradient(180deg, #fff, rgba(255, 254, 251, 0.92));
  box-shadow: 0 7px 22px rgba(65, 44, 36, 0.04);
  transition: transform 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
}

.client-card:hover {
  border-color: rgba(139, 21, 56, 0.28);
  box-shadow: 0 14px 30px rgba(65, 44, 36, 0.09);
  transform: translateY(-3px);
}

.client-card__initial {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  margin-bottom: 14px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--bordeaux), var(--orange));
  color: #fff;
  box-shadow: 0 7px 16px rgba(139, 21, 56, 0.18);
  font-family: Museo, sans-serif;
  font-weight: 700;
}

.client-card h3 {
  margin: 0 0 8px;
  font-family: Museo, Georgia, serif;
  font-size: 1.06rem;
}

.client-card p {
  margin: 2px 0;
  color: var(--muted);
  font-size: 0.73rem;
  white-space: pre-line;
}

.card-actions {
  display: flex;
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  gap: 8px;
}

.mini-button {
  padding: 6px 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--bordeaux);
  font-size: 0.68rem;
  font-weight: 750;
  transition: border-color 150ms ease, background 150ms ease, color 150ms ease;
}

.mini-button:hover {
  border-color: var(--bordeaux);
  background: rgba(139, 21, 56, 0.05);
}

.mini-button--danger {
  margin-left: auto;
  color: #8a514b;
}

.history-table-wrap {
  overflow-x: auto;
  padding-top: 20px;
}

.history-table {
  width: 100%;
  border-collapse: collapse;
}

.history-table tbody tr {
  transition: background 140ms ease;
}

.history-table tbody tr:hover {
  background: rgba(139, 21, 56, 0.035);
}

.history-table th,
.history-table td {
  padding: 13px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  white-space: nowrap;
}

.history-table th {
  color: var(--bordeaux);
  font-size: 0.65rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.history-table td {
  font-size: 0.76rem;
}

.history-table td:nth-child(2) {
  max-width: 230px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.history-table td:nth-child(5) {
  font-weight: 750;
}

.status-select {
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: #fff;
  color: var(--bordeaux);
  font-size: 0.68rem;
  font-weight: 750;
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

.status-select:focus {
  border-color: var(--bordeaux);
  box-shadow: 0 0 0 3px rgba(139, 21, 56, 0.08);
}

.table-actions {
  display: flex;
  gap: 6px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 16px;
  padding: 25px 0;
}

.stat-card {
  min-height: 145px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: linear-gradient(180deg, #fff, rgba(255, 254, 251, 0.94));
  box-shadow: 0 7px 22px rgba(65, 44, 36, 0.04);
  transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
}

.stat-card:hover {
  border-color: rgba(139, 21, 56, 0.25);
  box-shadow: 0 15px 32px rgba(65, 44, 36, 0.09);
  transform: translateY(-3px);
}

.stat-card--accent {
  border-color: transparent;
  background:
    radial-gradient(circle at 100% 0, rgba(232, 93, 47, 0.42), transparent 52%),
    linear-gradient(145deg, var(--bordeaux), var(--bordeaux-dark));
  color: #fff;
  box-shadow: 0 15px 34px rgba(139, 21, 56, 0.23);
}

.stat-card span,
.stat-card small {
  display: block;
  color: var(--muted);
  font-size: 0.68rem;
}

.stat-card--accent span,
.stat-card--accent small {
  color: rgba(255, 255, 255, 0.75);
}

.stat-card strong {
  display: block;
  margin: 13px 0 9px;
  font-family: Museo, Georgia, serif;
  font-size: 1.45rem;
  font-weight: 300;
}

.chart-card,
.summary-card {
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: linear-gradient(180deg, #fff, rgba(255, 254, 251, 0.94));
  box-shadow: 0 8px 24px rgba(65, 44, 36, 0.045);
}

.chart-card__head {
  display: flex;
  justify-content: space-between;
  align-items: end;
}

.chart-card h3,
.summary-card h3 {
  margin: 4px 0 0;
  font-family: Museo, Georgia, serif;
  font-size: 1.08rem;
}

.chart-card__head > span {
  color: var(--muted);
  font-size: 0.74rem;
}

.monthly-chart {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  align-items: end;
  height: 220px;
  margin-top: 24px;
  padding-top: 18px;
  border-bottom: 1px solid var(--line);
  gap: 9px;
}

.chart-column {
  display: grid;
  grid-template-rows: 1fr auto;
  align-items: end;
  height: 100%;
  gap: 7px;
}

.chart-bar-wrap {
  display: flex;
  align-items: end;
  height: 100%;
}

.chart-bar {
  width: 100%;
  min-height: 3px;
  border-radius: 5px 5px 0 0;
  background: linear-gradient(var(--orange), var(--bordeaux));
  box-shadow: 0 -5px 14px rgba(139, 21, 56, 0.11);
  transition: filter 160ms ease, transform 160ms ease;
  transform-origin: bottom;
}

.chart-column:hover .chart-bar {
  filter: saturate(1.2) brightness(1.05);
  transform: scaleX(1.06);
}

.chart-column span {
  color: var(--muted);
  font-size: 0.61rem;
  text-align: center;
  text-transform: uppercase;
}

.stats-lower {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 16px;
}

.payment-summary,
.top-clients {
  display: grid;
  gap: 11px;
  margin-top: 20px;
}

.summary-row {
  display: grid;
  grid-template-columns: 1fr auto;
  padding-bottom: 9px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.75rem;
  gap: 16px;
}

.summary-row strong {
  color: var(--ink);
}

.summary-row small {
  grid-column: 1 / -1;
  margin-top: -8px;
}

.status-chart .summary-row {
  grid-template-columns: 100px 1fr auto;
  align-items: center;
}

.status-chart .summary-row small {
  grid-column: auto;
  margin: 0;
}

.status-track {
  height: 9px;
  overflow: hidden;
  border-radius: 8px;
  background: var(--beige);
}

.status-fill {
  height: 100%;
  min-width: 3px;
  border-radius: inherit;
  background: var(--bordeaux);
  transition: width 280ms ease;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}

.status-fill--pending {
  background: var(--orange);
}

.status-fill--overdue {
  background: #a83b32;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

@media (max-width: 1100px) {
  .workspace {
    grid-template-columns: 1fr;
    max-width: 940px;
    margin: auto;
  }

  .settings-card {
    position: static;
    grid-template-columns: 1.4fr 1fr 1fr;
    align-items: end;
  }

  .settings-card .tip {
    grid-column: 1 / -1;
  }

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

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

@media (max-width: 760px) {
  .app-header {
    position: static;
  }

  .app-header__inner {
    flex-wrap: wrap;
    padding: 12px 16px;
  }

  .app-nav {
    position: static;
    justify-content: flex-start;
    overflow-x: auto;
    padding-inline: 12px;
  }

  .nav-tab {
    flex: 0 0 auto;
  }

  .app-header__title {
    display: none;
  }

  .toolbar {
    width: 100%;
    margin: 0;
  }

  .save-status {
    display: none;
  }

  .button {
    flex: 1;
    padding-inline: 9px;
  }

  .workspace {
    padding: 20px 12px 45px;
  }

  .settings-card {
    grid-template-columns: 1fr;
  }

  .settings-card .tip {
    grid-column: auto;
  }

  .management-view {
    width: calc(100% - 24px);
    margin: 20px auto 45px;
    padding: 22px 16px;
  }

  .management-head,
  .management-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .search-input {
    width: 100%;
  }

  .client-grid,
  .stats-grid,
  .stats-lower {
    grid-template-columns: 1fr;
  }

  .monthly-chart {
    gap: 4px;
  }

  .button--mail {
    display: none;
  }

  .preview-bar {
    border-radius: 10px 10px 0 0;
  }

  .preview-bar small {
    display: none;
  }

  .invoice {
    min-height: auto;
    height: auto;
    aspect-ratio: auto;
    overflow: visible;
    padding: 42px 22px 28px;
  }

  .legal-details {
    position: static;
    margin-top: 24px;
  }

  .invoice--continuation {
    margin-top: 18px;
  }

  .invoice__header,
  .invoice__footer {
    flex-direction: column;
    align-items: flex-start;
  }

  .invoice-title {
    min-width: 0;
    text-align: left;
  }

  .invoice-meta,
  .invoice-summary {
    grid-template-columns: 1fr;
    gap: 28px;
  }

  .line-items thead {
    display: none;
  }

  .line-items,
  .line-items tbody,
  .line-item,
  .line-item td {
    display: block;
    width: 100%;
  }

  .line-item {
    position: relative;
    padding: 14px 38px 14px 0;
    border-bottom: 1px solid var(--line);
  }

  .line-item td {
    display: grid;
    grid-template-columns: 110px 1fr;
    align-items: center;
    padding: 4px 0;
    border: 0;
    gap: 8px;
  }

  .line-item td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 0.64rem;
    font-weight: 700;
    text-transform: uppercase;
  }

  .line-item .line-action {
    position: absolute;
    top: 12px;
    right: 0;
    display: block;
    width: auto;
  }

  .item-total {
    text-align: right;
  }

  .line-item .quote-details-cell {
    display: none;
  }

  .invoice.is-quote .line-item .quote-details-cell {
    display: grid;
  }

  .service-section-row,
  .service-section-row td {
    display: block !important;
    width: 100% !important;
  }

  .service-section-row td::before {
    display: none;
  }

  .invoice.is-quote .line-items-wrap {
    padding: 10px 12px;
  }

  .invoice.is-quote .line-item td {
    background: transparent;
  }
}

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

@media print {
  html,
  body {
    width: 210mm;
    min-width: 0;
    background: #fff;
  }

  .blueprint-bg,
  .auth-gate,
  .app-header,
  .app-nav,
  .settings-card,
  .management-view,
  .preview-bar,
  .add-line,
  .remove-line,
  .text-button,
  .invoice__footer {
    display: none !important;
  }

  .workspace,
  .invoice-shell {
    display: block;
    width: 100%;
    margin: 0;
    padding: 0;
  }

  .invoice {
    width: 210mm;
    min-height: 297mm;
    height: 297mm;
    aspect-ratio: auto;
    overflow: hidden;
    padding: 14mm 16mm 49mm;
    background: #fff url("assets/letterhead-bg.png?v=20260731-2") top center / 210mm 297mm repeat-y;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    print-color-adjust: exact;
    -webkit-print-color-adjust: exact;
  }

  .invoice.is-el-animo {
    background:
      linear-gradient(145deg, rgba(255, 255, 255, 0.98) 0 68%, rgba(139, 21, 56, 0.045) 100%),
      repeating-linear-gradient(135deg, transparent 0 6mm, rgba(46, 42, 40, 0.025) 6mm 6.3mm),
      #fff;
  }

  .invoice.is-el-animo.invoice--continuation::before {
    top: 18mm;
    left: 16mm;
  }

  .legal-details {
    position: absolute;
    right: 16mm;
    bottom: 1mm;
    left: 16mm;
    margin: 0;
  }

  .invoice--continuation {
    margin-top: 0;
    break-before: page;
    page-break-before: always;
  }

  .continuation-header {
    padding-top: 30mm;
    padding-bottom: 7mm;
  }

  .paper-input,
  .item-description,
  .item-details,
  .item-quantity,
  .item-price {
    border-color: transparent !important;
    background: transparent !important;
    resize: none;
  }

  .paper-input::placeholder,
  .item-description::placeholder,
  .item-details::placeholder,
  .item-quantity::placeholder,
  .item-price::placeholder {
    color: transparent;
  }

  .invoice__header {
    flex-direction: row;
    justify-content: space-between;
    align-items: flex-start;
    padding-top: 30mm;
    padding-bottom: 7mm;
  }

  .invoice-title {
    min-width: 58mm;
    text-align: right;
  }

  .invoice-meta {
    grid-template-columns: 1.35fr 1fr;
    gap: 14mm;
    padding: 8mm 0;
  }

  .invoice.is-quote .invoice-meta {
    padding: 4mm 0;
  }

  .invoice.is-quote .client-block,
  .invoice.is-quote .date-block {
    padding-right: 3mm;
    padding-left: 3mm;
  }

  .client-block .paper-input:placeholder-shown {
    display: none;
  }

  .line-items {
    display: table;
    width: 100%;
  }

  .line-items-wrap,
  .continuation-items-wrap {
    max-height: none !important;
    overflow: visible !important;
  }

  .line-items thead {
    display: table-header-group;
  }

  .line-items tbody {
    display: table-row-group;
  }

  .line-item {
    display: table-row;
    width: auto;
    padding: 0;
    border: 0;
    break-inside: avoid;
    page-break-inside: avoid;
  }

  .service-section-row {
    display: table-row !important;
    width: auto !important;
    break-inside: avoid;
    page-break-inside: avoid;
  }

  .service-section-row td {
    display: table-cell !important;
    width: auto !important;
  }

  .service-section-free-text-row:not([hidden]) {
    display: table-row !important;
    break-inside: avoid;
    page-break-inside: avoid;
  }

  .service-section-free-text-row[hidden] {
    display: none !important;
  }

  .service-section-free-text-row td {
    display: table-cell !important;
    width: auto !important;
  }

  .line-item td {
    position: static;
    display: table-cell;
    width: auto;
    padding-top: 2.7mm;
    padding-bottom: 2.7mm;
  }

  .line-item td::before {
    display: none;
    content: none;
  }

  .line-items th.action-column,
  .line-item .line-action,
  .remove-section {
    display: none !important;
  }

  .invoice.is-quote .line-items th:nth-child(1) {
    width: 34%;
  }

  .invoice.is-quote .line-items th:nth-child(2) {
    width: 46%;
  }

  .invoice.is-quote .line-items th:nth-child(4) {
    width: 20%;
  }

  .line-items th.action-column,
  .line-item .line-action {
    width: 0 !important;
    padding: 0 !important;
    border: 0 !important;
  }

  .service-section-title {
    border-color: transparent;
    background: transparent;
    color: #fff;
  }

  .service-section-row.is-active-section td {
    box-shadow: none;
  }

  .quote-details-column,
  .quote-details-cell {
    display: none !important;
  }

  .invoice.is-quote .quote-details-column,
  .invoice.is-quote .quote-details-cell {
    display: table-cell !important;
  }

  .invoice.is-quote .line-items-wrap,
  .invoice.is-quote .quote-section-heading {
    background: #fff;
    box-shadow: none;
  }

  .invoice-summary {
    grid-template-columns: 1fr minmax(64mm, 0.85fr);
    gap: 12mm;
    margin-top: 7mm;
    break-inside: avoid;
    page-break-inside: avoid;
  }

  .invoice.is-quote .invoice-summary {
    grid-template-columns: 1fr minmax(58mm, 0.7fr);
  }

  .totals,
  .notes-block,
  .quote-introduction,
  .quote-section-heading,
  .legal-details,
  .quote-free-content p {
    break-inside: avoid;
    page-break-inside: avoid;
  }

  .quote-free-content {
    white-space: pre-wrap;
    overflow: visible;
  }
}
