:root {
  --gold: #e8b923;
  --gold-2: #f5d76e;
  --gold-3: #c47a0a;
  --gold-deep: #8a5a12;
  --yellow: #ffcc33;
  --black: #050506;
  --charcoal: #121214;
  --ink: #f7f4ec;
  --muted: #a39b8b;
  --line: rgba(255, 255, 255, 0.14);
  --danger: #ff6b6b;
  --ok: #3ddc97;
  --info: #6cb6ff;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
  --radius: 18px;
  --radius-sm: 12px;
  --header-h: 72px;
  --bottom-nav-h: 0px;
  --font: "Outfit", system-ui, sans-serif;
  --serif: "Playfair Display", Georgia, serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
  --grad: linear-gradient(135deg, #ffe38a 0%, #e8b923 42%, #c47a0a 100%);
  --grad-soft: linear-gradient(180deg, rgba(232, 185, 35, 0.18), rgba(232, 185, 35, 0.02));
  --bg: #070708;
  --bg-2: #0e0e11;
  --card: rgba(24, 22, 18, 0.84);
  --card-solid: #141418;
  --text: #f7f4ec;
  --text-2: #c9c1b0;
  --glass: rgba(255, 255, 255, 0.04);
  --glow: 0 0 0 1px rgba(232, 185, 35, 0.28), 0 0 28px rgba(232, 185, 35, 0.12);
}

[data-theme="light"] {
  --bg: #f3eee3;
  --bg-2: #fffaf0;
  --card: rgba(255, 252, 245, 0.78);
  --card-solid: #fffdf8;
  --text: #161513;
  --text-2: #5c5648;
  --muted: #7a7364;
  --line: rgba(40, 30, 10, 0.1);
  --glass: rgba(255, 255, 255, 0.55);
  --ink: #161513;
  --shadow: 0 16px 40px rgba(80, 60, 10, 0.12);
  --glow: 0 0 0 1px rgba(196, 122, 10, 0.22), 0 0 20px rgba(232, 185, 35, 0.15);
}

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

html,
body {
  margin: 0;
  min-height: 100%;
}

html {
  background: var(--bg);
}

body {
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  letter-spacing: 0.01em;
  overflow-x: hidden;
}

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

img {
  max-width: 100%;
}

button {
  cursor: pointer;
}

a {
  color: inherit;
}

.app-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(1200px 600px at 10% -10%, rgba(232, 185, 35, 0.16), transparent 55%),
    radial-gradient(900px 500px at 110% 0%, rgba(196, 122, 10, 0.12), transparent 50%),
    radial-gradient(700px 400px at 50% 120%, rgba(255, 204, 51, 0.07), transparent 50%),
    var(--bg);
}

.app-bg::before {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.22;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='56' height='98' viewBox='0 0 56 98'%3E%3Cpath fill='none' stroke='%23e8b923' stroke-opacity='0.35' stroke-width='0.6' d='M28 2l26 15v30L28 62 2 47V17zM28 62v34'/%3E%3C/svg%3E");
  background-size: 56px 98px;
  mask-image: radial-gradient(circle at 50% 30%, black, transparent 75%);
}

#particles {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
}

.app-shell {
  position: relative;
  z-index: 2;
  min-height: 100vh;
  padding-bottom: calc(28px + var(--bottom-nav-h));
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 40;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 16px;
  min-height: var(--header-h);
  padding: 10px 22px;
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--line);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand-logo {
  height: 52px;
  width: auto;
  max-width: 200px;
  border-radius: 10px;
  object-fit: contain;
  border: 1px solid rgba(255, 255, 255, 0.16);
  box-shadow: var(--glow);
  background: #000;
  padding: 4px 8px;
}

.brand-copy {
  min-width: 0;
}

.brand-copy strong {
  display: block;
  font-size: 15px;
  letter-spacing: 0.08em;
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.brand-copy span {
  display: block;
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.header-title {
  text-align: center;
}

.header-title h1 {
  margin: 0;
  font-size: 18px;
  font-weight: 650;
  letter-spacing: 0.04em;
}

.ai-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 10px;
  letter-spacing: 0.16em;
  font-weight: 700;
  color: #1a1406;
  background: var(--grad);
  box-shadow: 0 8px 18px rgba(232, 185, 35, 0.25);
}

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

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid var(--line);
  background: var(--glass);
  color: var(--text);
  border-radius: 12px;
  padding: 9px 14px;
  font-size: 13px;
  font-weight: 560;
  transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease, border-color 0.18s ease;
  white-space: nowrap;
}

.btn:hover {
  transform: translateY(-1px);
  border-color: rgba(232, 185, 35, 0.45);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.18);
}

.btn:active {
  transform: translateY(0);
}

.btn-gold {
  background: var(--grad);
  color: #1a1406;
  border-color: transparent;
  font-weight: 700;
  box-shadow: 0 10px 24px rgba(232, 185, 35, 0.22);
}

.btn-gold:hover {
  filter: brightness(1.05);
}

.btn-ghost {
  background: transparent;
}

.btn-danger {
  background: rgba(255, 107, 107, 0.12);
  border-color: rgba(255, 107, 107, 0.3);
  color: #ff8d8d;
}

.btn-ok {
  background: rgba(61, 220, 151, 0.12);
  border-color: rgba(61, 220, 151, 0.28);
  color: var(--ok);
}

.btn-icon {
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: 12px;
}

.btn-sm {
  padding: 6px 10px;
  font-size: 12px;
  border-radius: 10px;
}

.tagline {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 10px 22px 0;
}

.tagline p {
  margin: 0;
  color: var(--text-2);
  font-size: 13px;
}

.tagline .dots {
  color: var(--gold);
  font-size: 12px;
}

.save-status {
  font-size: 12px;
  color: var(--ok);
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 18px;
}

.save-status.idle {
  color: var(--muted);
}

main {
  padding: 18px 22px 32px;
}

.view {
  display: none;
  animation: fadeIn 0.35s ease;
}

.view.active {
  display: block;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes pulseGlow {
  0%,
  100% {
    box-shadow: 0 0 0 1px rgba(232, 185, 35, 0.25), 0 0 18px rgba(232, 185, 35, 0.08);
  }
  50% {
    box-shadow: 0 0 0 1px rgba(245, 215, 110, 0.55), 0 0 28px rgba(232, 185, 35, 0.22);
  }
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes checkPop {
  0% {
    transform: scale(0.4);
    opacity: 0;
  }
  70% {
    transform: scale(1.12);
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

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

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
  animation: slideUp 0.45s ease both;
}

.stat-card {
  padding: 18px;
  position: relative;
  overflow: hidden;
}

.stat-card::after {
  content: "";
  position: absolute;
  right: -20px;
  top: -20px;
  width: 90px;
  height: 90px;
  border-radius: 50%;
  background: var(--grad-soft);
}

.stat-card .label {
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.stat-card .value {
  font-size: 28px;
  font-weight: 720;
  margin-top: 8px;
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.quick-row,
.preset-row {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 12px;
  margin-top: 18px;
}

.quick-card,
.preset-card {
  padding: 16px;
  text-align: left;
  color: var(--text);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.quick-card:hover,
.preset-card:hover {
  transform: translateY(-3px);
  border-color: rgba(232, 185, 35, 0.45);
  box-shadow: var(--glow);
}

.quick-card i,
.preset-card i {
  color: var(--gold);
  font-size: 18px;
  margin-bottom: 10px;
}

.quick-card strong,
.preset-card strong {
  display: block;
  font-size: 13px;
}

.quick-card span,
.preset-card span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin: 28px 0 12px;
}

.section-head h2 {
  margin: 0;
  font-size: 18px;
}

.quote-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(420px, 0.92fr);
  gap: 18px;
  align-items: start;
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.panel {
  padding: 18px;
}

.panel h3 {
  margin: 0 0 14px;
  font-size: 14px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gold-2);
}

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

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

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  position: relative;
}

.field.full {
  grid-column: 1 / -1;
}

.field label {
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.field input,
.field select,
.field textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.18);
  color: var(--text);
  border-radius: 12px;
  padding: 10px 12px;
  outline: none;
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
}

[data-theme="light"] .field input,
[data-theme="light"] .field select,
[data-theme="light"] .field textarea {
  background: rgba(255, 255, 255, 0.8);
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: rgba(232, 185, 35, 0.7);
  box-shadow: 0 0 0 3px rgba(232, 185, 35, 0.12);
}

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

.combo {
  position: relative;
}

.combo-menu,
.suggest-menu {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 6px);
  z-index: 20;
  max-height: 320px;
  overflow: auto;
  background: var(--card-solid);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
  display: none;
}

.combo-menu.open,
.suggest-menu.open {
  display: block;
  animation: fadeIn 0.16s ease;
}

.combo-group {
  padding: 8px 10px 4px;
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--gold);
}

.combo-item {
  width: 100%;
  text-align: left;
  background: transparent;
  border: 0;
  color: var(--text);
  padding: 9px 12px;
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 13px;
}

.combo-item:hover,
.combo-item.active {
  background: rgba(232, 185, 35, 0.12);
}

.combo-item small {
  color: var(--muted);
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 14px;
}

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

table.data th,
table.data td {
  padding: 8px 8px;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
  vertical-align: middle;
}

table.data th {
  text-align: left;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.03);
}

table.data input {
  width: 100%;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text);
  padding: 7px 6px;
  border-radius: 8px;
}

table.data input:focus {
  border-color: rgba(232, 185, 35, 0.5);
  background: rgba(0, 0, 0, 0.15);
  outline: none;
}

table.data .num {
  text-align: right;
  width: 88px;
}

.row-actions {
  display: flex;
  gap: 4px;
}

.ai-panel {
  position: relative;
  overflow: hidden;
}

.ai-panel::before {
  content: "";
  position: absolute;
  inset: -2px;
  border-radius: inherit;
  background: conic-gradient(from var(--angle, 0deg), #f5d76e, transparent 28%, #c47a0a, transparent 62%, #ffe38a);
  animation: spin 8s linear infinite;
  opacity: 0.55;
}

.ai-panel .ai-inner {
  position: relative;
  z-index: 1;
  margin: 1px;
  padding: 16px;
  border-radius: calc(var(--radius) - 1px);
  background: var(--card-solid);
}

.ai-panel textarea {
  min-height: 88px;
}

.ai-status {
  min-height: 22px;
  font-size: 12px;
  color: var(--gold-2);
  margin-top: 8px;
}

.suggestion-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.suggestion-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
}

.totals {
  display: grid;
  gap: 8px;
}

.total-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  font-size: 13px;
}

.total-row.grand {
  padding-top: 8px;
  border-top: 1px dashed rgba(232, 185, 35, 0.35);
  font-size: 16px;
  font-weight: 700;
  color: var(--gold-2);
}

.inline-fields {
  display: flex;
  gap: 8px;
  align-items: center;
}

.inline-fields input,
.inline-fields select {
  width: 110px;
}

.preview-col {
  position: sticky;
  top: 86px;
}

.preview-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.mobile-quote-actions {
  display: none;
}

.qs-brand-row {
  display: flex;
  gap: 14px;
  align-items: center;
  min-width: 0;
}

.preview-scroll {
  max-height: calc(100vh - 170px);
  overflow: auto;
  padding: 8px;
  border-radius: 18px;
  background: rgba(0, 0, 0, 0.2);
}

.quote-sheet {
  width: 794px;
  min-height: 1123px;
  margin: 0 auto;
  background: #fff;
  color: #161513;
  border-radius: 4px;
  overflow: hidden;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.35);
  transform-origin: top center;
}

.qs-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 22px 28px;
  background: linear-gradient(135deg, #0a0a0c, #1a1408 60%, #3a2a0c);
  color: #f7f4ec;
  flex-wrap: wrap;
}

.qs-header img {
  width: 72px;
  height: 72px;
  border-radius: 12px;
  object-fit: cover;
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: #000;
}

.qs-biz h2 {
  margin: 0;
  font-family: var(--serif);
  font-size: 26px;
  color: #f5d76e;
  word-break: break-word;
}

.qs-biz p {
  margin: 4px 0 0;
  font-size: 12px;
  color: #d9d1c2;
  line-height: 1.5;
}

.qs-meta {
  text-align: right;
}

.qs-meta .q-label {
  letter-spacing: 0.22em;
  font-size: 11px;
  color: #f5d76e;
}

.qs-meta .q-no {
  font-size: 20px;
  font-weight: 700;
  color: #ffe38a;
  margin-top: 4px;
}

.qs-body {
  padding: 22px 28px 28px;
}

.qs-grid {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 18px;
  margin-bottom: 18px;
}

.qs-box h4 {
  margin: 0 0 8px;
  font-size: 11px;
  letter-spacing: 0.16em;
  color: #8a5a12;
}

.qs-box p {
  margin: 0;
  font-size: 13px;
  line-height: 1.55;
}

table.qs-items {
  width: 100%;
  border-collapse: collapse;
  margin: 8px 0 16px;
}

table.qs-items th {
  background: #111;
  color: #f5d76e;
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 9px 8px;
}

table.qs-items td {
  padding: 8px;
  border-bottom: 1px solid #eee4d0;
  font-size: 12px;
}

table.qs-items .r {
  text-align: right;
}

.qs-bottom {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 18px;
}

.qs-terms li {
  font-size: 11px;
  color: #444;
  margin: 0 0 6px;
}

.qs-totals {
  border: 1px solid #efe3c4;
  border-radius: 10px;
  overflow: hidden;
}

.qs-totals div {
  display: flex;
  justify-content: space-between;
  padding: 7px 12px;
  font-size: 12px;
}

.qs-totals .grand {
  background: linear-gradient(135deg, #111, #2a210c);
  color: #ffe38a;
  font-weight: 700;
  font-size: 14px;
}

.qs-pay {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid #efe3c4;
  font-size: 12px;
}

.qs-qr {
  width: 92px;
  height: 92px;
  object-fit: cover;
  border: 1px solid #efe3c4;
  border-radius: 8px;
  background: #fff;
}

.qs-sign {
  margin-top: 28px;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
}

.qs-sign img {
  max-height: 54px;
}

.qs-thanks {
  margin-top: 18px;
  text-align: center;
  font-family: var(--serif);
  color: #8a5a12;
}

.empty {
  padding: 36px 18px;
  text-align: center;
  color: var(--muted);
}

.empty h3 {
  margin: 0 0 8px;
  color: var(--text);
}

.toolbar select,
#history-status,
#catalog-category {
  border: 1px solid var(--line);
  background: var(--glass);
  color: var(--text);
  border-radius: 12px;
  padding: 10px 12px;
}

.toolbar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.searchbox {
  flex: 1;
  min-width: 180px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.04em;
}

.status-draft {
  background: rgba(108, 182, 255, 0.15);
  color: var(--info);
}
.status-sent {
  background: rgba(232, 185, 35, 0.15);
  color: var(--gold-2);
}
.status-accepted {
  background: rgba(61, 220, 151, 0.15);
  color: var(--ok);
}
.status-rejected {
  background: rgba(255, 107, 107, 0.15);
  color: var(--danger);
}
.status-expired {
  background: rgba(163, 155, 139, 0.18);
  color: var(--muted);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: rgba(0, 0, 0, 0.55);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 18px;
}

.modal-backdrop.open {
  display: flex;
  animation: fadeIn 0.2s ease;
}

.modal {
  width: min(640px, 100%);
  max-height: min(86vh, 820px);
  overflow: auto;
  background: var(--card-solid);
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: var(--shadow);
  padding: 18px;
  animation: slideUp 0.24s ease;
}

.modal.wide {
  width: min(920px, 100%);
}

.modal h3 {
  margin: 0 0 12px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 16px;
}

.toasts {
  position: fixed;
  right: 16px;
  bottom: calc(16px + var(--bottom-nav-h));
  z-index: 90;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  min-width: 240px;
  padding: 10px 14px;
  border-radius: 12px;
  background: var(--card-solid);
  border: 1px solid rgba(232, 185, 35, 0.28);
  box-shadow: var(--shadow);
  font-size: 13px;
  animation: slideUp 0.2s ease;
}

.toast.ok {
  border-color: rgba(61, 220, 151, 0.4);
}
.toast.err {
  border-color: rgba(255, 107, 107, 0.45);
}

.bottom-nav {
  display: none;
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 50;
  height: 64px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(16px);
  border-top: 1px solid var(--line);
}

.bottom-nav button {
  flex: 1;
  border: 0;
  background: transparent;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  font-size: 10px;
  letter-spacing: 0.04em;
}

.bottom-nav button.active,
.bottom-nav button:hover {
  color: var(--gold-2);
}

.more-sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 64px;
  z-index: 49;
  display: none;
  padding: 12px;
}

.more-sheet.open {
  display: block;
}

.more-sheet .card {
  padding: 8px;
}

.more-sheet button {
  width: 100%;
  justify-content: flex-start;
  background: transparent;
  border: 0;
  color: var(--text);
  padding: 12px;
  border-radius: 10px;
}

.hidden {
  display: none !important;
}

.overlay-preview {
  position: fixed;
  inset: 0;
  z-index: 70;
  background: rgba(0, 0, 0, 0.72);
  display: none;
  overflow: auto;
  padding: 18px 12px 80px;
}

.overlay-preview.open {
  display: block;
}

#overlay-sheet-host {
  overflow: hidden;
  display: flex;
  justify-content: center;
}

.pdf-loader {
  position: fixed;
  inset: 0;
  z-index: 95;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.55);
}

.pdf-loader.open {
  display: flex;
}

.loader-box {
  background: var(--card-solid);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 22px 28px;
  text-align: center;
}

.spinner {
  width: 28px;
  height: 28px;
  border: 3px solid rgba(232, 185, 35, 0.2);
  border-top-color: var(--gold);
  border-radius: 50%;
  margin: 0 auto 10px;
  animation: spin 0.8s linear infinite;
}

.settings-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.radio-row {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  font-size: 13px;
}

.found-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 12px 0;
}

.found-list div {
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(61, 220, 151, 0.08);
  border: 1px solid rgba(61, 220, 151, 0.18);
}

.logo-preview,
.sig-preview,
.qr-preview {
  width: 72px;
  height: 72px;
  object-fit: cover;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #000;
}

.check-ok {
  display: inline-block;
  animation: checkPop 0.35s ease;
  color: var(--ok);
}

@media (max-width: 1180px) {
  .grid-stats {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .quick-row,
  .preset-row {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .quote-layout {
    grid-template-columns: 1fr;
  }
  .preview-col {
    position: static;
  }
}

@media (max-width: 820px) {
  :root {
    --bottom-nav-h: 64px;
  }
  .app-header {
    grid-template-columns: minmax(0, 1fr) auto;
    padding: 10px 12px;
  }
  .brand-logo {
    height: 40px;
    max-width: 132px;
    padding: 3px 6px;
  }
  .brand-copy strong {
    max-width: 46vw;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .header-title {
    display: none;
  }
  .header-actions {
    gap: 6px;
  }
  .header-actions .btn-text {
    display: none;
  }
  .btn,
  .btn-icon {
    min-height: 44px;
    min-width: 44px;
  }
  .field input,
  .field select,
  .field textarea,
  table.data input,
  .toolbar select,
  #history-search,
  #customer-search,
  #catalog-search {
    font-size: 16px;
    min-height: 44px;
  }
  main {
    padding: 12px 12px 88px;
  }
  .tagline {
    padding: 10px 12px 0;
    flex-direction: column;
    align-items: flex-start;
  }
  .grid-stats {
    grid-template-columns: 1fr 1fr;
  }
  .grid-stats .stat-card:last-child {
    grid-column: 1 / -1;
  }
  .quick-row,
  .preset-row {
    grid-template-columns: 1fr 1fr;
  }
  .form-grid,
  .form-grid.three,
  .qs-grid,
  .qs-bottom {
    grid-template-columns: 1fr;
  }
  .inline-fields {
    flex-wrap: wrap;
  }
  .inline-fields textarea {
    width: 100%;
    min-width: 0;
  }
  .bottom-nav {
    display: flex;
  }
  .mobile-quote-actions {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
    position: sticky;
    top: calc(var(--header-h) - 8px);
    z-index: 25;
    margin: 0 0 12px;
    padding: 8px;
    background: color-mix(in srgb, var(--bg) 88%, transparent);
    backdrop-filter: blur(12px);
    border: 1px solid var(--line);
    border-radius: 14px;
  }
  .mobile-quote-actions .btn {
    padding: 8px 6px;
    font-size: 12px;
    white-space: nowrap;
  }
  .preview-col .preview-toolbar {
    flex-wrap: wrap;
  }
  .table-wrap {
    -webkit-overflow-scrolling: touch;
  }
  table.data {
    min-width: 640px;
  }
  .preview-scroll {
    position: absolute;
    left: -10000px;
    top: 0;
    width: 820px;
    max-height: none;
    overflow: visible;
    opacity: 0;
    pointer-events: none;
  }
  .quote-sheet {
    width: 794px;
    min-height: 1123px;
  }
  .modal {
    width: 100%;
    max-height: 88vh;
    padding: 16px;
    border-radius: 16px 16px 0 0;
    align-self: flex-end;
  }
  .toasts {
    left: 12px;
    right: 12px;
  }
  .toast {
    min-width: 0;
  }
}

@media print {
  .app-bg,
  #particles,
  .app-header,
  .tagline,
  .bottom-nav,
  .toasts,
  .modal-backdrop,
  .preview-toolbar,
  .stack,
  .more-sheet,
  .pdf-loader,
  .overlay-preview {
    display: none !important;
  }
  body,
  html,
  .app-shell,
  main,
  .view,
  .quote-layout,
  .preview-col,
  .preview-scroll {
    background: #fff !important;
    padding: 0 !important;
    margin: 0 !important;
    overflow: visible !important;
    position: static !important;
    max-height: none !important;
    height: auto !important;
    box-shadow: none !important;
  }
  #view-quote {
    display: block !important;
  }
  .quote-sheet {
    box-shadow: none !important;
    width: 210mm !important;
    min-height: 297mm;
  }
}
