:root {
  --chrome: #121922;
  --chrome-2: #1a2430;
  --surface: #ffffff;
  --surface-soft: #f5f7f9;
  --line: #dce2e8;
  --text: #1b2533;
  --muted: #6d7885;
  --accent: #13999a;
  --accent-dark: #087879;
  --gold: #c99a3d;
  --danger: #bc3d3d;
  --shadow: 0 18px 46px rgba(18, 25, 34, 0.16);
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  background: #eef2f5;
  color: var(--text);
  font-family: Arial, Helvetica, sans-serif;
}

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

button {
  cursor: pointer;
}

code {
  color: #0b6870;
  font-size: 0.95em;
}

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px;
  background:
    linear-gradient(135deg, rgba(18, 25, 34, 0.78), rgba(18, 25, 34, 0.9)),
    repeating-linear-gradient(90deg, rgba(255,255,255,0.04) 0 1px, transparent 1px 82px),
    #121922;
}

.login-panel {
  width: min(440px, 100%);
  padding: 34px;
  background: #fff;
  border: 1px solid rgba(255, 255, 255, 0.16);
  box-shadow: var(--shadow);
}

.login-brand,
.topbar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.login-brand img,
.topbar-brand img {
  width: 40px;
  height: 40px;
  object-fit: cover;
}

.login-brand strong,
.topbar-brand strong {
  display: block;
  letter-spacing: 0;
}

.login-brand span,
.topbar-brand span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.login-panel h1 {
  margin: 28px 0 10px;
  color: #14212e;
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 34px;
  line-height: 1.08;
}

.login-panel p {
  margin: 0 0 24px;
  color: var(--muted);
  line-height: 1.55;
}

.login-form {
  display: grid;
  gap: 14px;
}

.login-form label,
.inspector label {
  display: grid;
  gap: 7px;
  color: #42505d;
  font-size: 12px;
  font-weight: 700;
}

.login-form input,
.inspector input,
.inspector select,
.search-box input,
textarea {
  width: 100%;
  min-height: 38px;
  border: 1px solid #d8e0e7;
  background: #fff;
  color: var(--text);
  padding: 9px 10px;
  outline: none;
}

.login-form input:focus,
.inspector input:focus,
.inspector select:focus,
.search-box input:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(19, 153, 154, 0.12);
}

.form-message {
  min-height: 20px;
  color: var(--danger) !important;
  font-weight: 700;
}

.setup-note {
  margin-top: 18px !important;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  font-size: 13px;
}

.app-shell {
  height: 100vh;
  display: grid;
  grid-template-columns: 290px minmax(520px, 1fr) 340px;
  grid-template-rows: 58px 1fr;
  overflow: hidden;
}

.topbar {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 0 16px;
  background: linear-gradient(90deg, var(--chrome), var(--chrome-2));
  color: #fff;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.topbar-brand span {
  color: #aab7c4;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.ghost-button,
.accent-button,
.gold-button,
.danger-button,
.icon-button,
.mini-button,
.upload-button,
.primary-button {
  min-height: 38px;
  border: 1px solid transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 13px;
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
}

.ghost-button {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.13);
  color: #e9eef3;
}

.ghost-button:hover,
.icon-button:hover {
  background: rgba(255, 255, 255, 0.12);
}

.accent-button,
.primary-button,
.upload-button {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent-dark);
}

.gold-button {
  background: var(--gold);
  color: #fff;
  border-color: #ac7f2c;
}

.danger-button {
  background: #fff;
  color: var(--danger);
  border-color: rgba(188, 61, 61, 0.38);
}

.icon-button,
.mini-button {
  width: 38px;
  padding: 0;
  background: transparent;
  color: inherit;
  border-color: rgba(255, 255, 255, 0.14);
}

.mini-button {
  width: auto;
  min-width: 34px;
  background: #fff;
  border-color: #d9e1e8;
  color: #344251;
}

.full-button {
  width: 100%;
}

.sidebar,
.inspector {
  min-height: 0;
  overflow: auto;
  background: #fff;
}

.sidebar {
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--line);
}

.inspector {
  border-left: 1px solid var(--line);
}

.sidebar-section,
.inspector-section {
  padding: 16px;
  border-bottom: 1px solid var(--line);
}

.grow-section {
  flex: 1;
  min-height: 250px;
  display: flex;
  flex-direction: column;
}

.section-title,
.workspace-toolbar,
.toolbar-group {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.section-title h2,
.inspector-section h2 {
  margin: 0;
  font-size: 15px;
  line-height: 1.2;
}

.search-box {
  position: relative;
  display: block;
  margin: 14px 0;
}

.search-box svg,
.search-box .icon-search {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
}

.search-box input {
  padding-left: 35px;
}

.offer-list {
  display: grid;
  gap: 6px;
}

.offer-row {
  display: grid;
  grid-template-columns: 28px 1fr;
  gap: 10px;
  width: 100%;
  min-height: 58px;
  padding: 10px;
  border: 1px solid transparent;
  background: #fff;
  text-align: left;
}

.offer-row:hover,
.offer-row.is-active {
  background: #ecf8f8;
  border-color: rgba(19, 153, 154, 0.28);
}

.offer-row strong,
.offer-row small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.offer-row strong {
  font-size: 13px;
}

.offer-row small {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.row-icon svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
}

.empty-list {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.upload-box {
  margin: 16px;
  padding: 18px 14px;
  display: grid;
  place-items: center;
  gap: 10px;
  border: 1px dashed #b8c5cf;
  background: #f8fafb;
  text-align: center;
}

.upload-box.is-drag {
  border-color: var(--accent);
  background: #eefafa;
}

.upload-box p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

textarea {
  flex: 1;
  resize: none;
  min-height: 220px;
  margin-top: 12px;
  font-family: 'Courier New', Courier, monospace;
  font-size: 12px;
  line-height: 1.5;
}

.workspace {
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-rows: 48px 1fr;
  background:
    linear-gradient(90deg, rgba(18, 25, 34, 0.04) 1px, transparent 1px),
    linear-gradient(rgba(18, 25, 34, 0.04) 1px, transparent 1px),
    #edf1f4;
  background-size: 28px 28px;
}

.workspace-toolbar {
  padding: 0 16px;
  background: #fff;
  border-bottom: 1px solid var(--line);
  color: #445260;
  font-size: 13px;
  font-weight: 800;
}

.toolbar-group {
  justify-content: flex-start;
}

#statusText {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

#statusText[data-type="ok"] {
  color: var(--accent-dark);
}

#statusText[data-type="warn"] {
  color: #ad7a20;
}

#statusText[data-type="error"] {
  color: var(--danger);
}

.preview-viewport {
  min-height: 0;
  overflow: auto;
  padding: 28px;
}

.preview-pages {
  zoom: var(--preview-zoom, 1);
  width: 210mm;
  margin: 0 auto;
  display: grid;
  gap: 18px;
}

.proposal-page {
  width: 210mm;
  min-height: 297mm;
  background: var(--doc-bg);
  color: var(--doc-body);
  box-shadow: var(--shadow);
  font-family: var(--doc-font);
  font-size: var(--doc-font-size);
  line-height: var(--doc-line-height);
  letter-spacing: var(--doc-letter-spacing);
}

.page-inner {
  min-height: 297mm;
  position: relative;
  padding: var(--doc-margin-top) var(--doc-margin-right) var(--doc-margin-bottom) var(--doc-margin-left);
}

.doc-header {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--doc-heading);
}

.doc-header img {
  width: 44px;
  height: 44px;
}

.doc-header strong {
  display: block;
  font-size: 18pt;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.doc-header span {
  display: block;
  color: var(--doc-muted);
  font-size: 7pt;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.pdf-cover-page {
  background: #dd0939;
  color: #fff;
  font-family: Arial, Helvetica, sans-serif;
}

.pdf-cover-page .page-inner {
  min-height: 297mm;
  padding: 0;
  overflow: hidden;
}

.pdf-cover-content {
  position: absolute;
  left: 31mm;
  top: 48mm;
  right: 24mm;
  color: #fff;
}

.pdf-cover-content h1,
.proposal-section h2,
.price-summary h2 {
  margin: 0;
  color: var(--doc-heading);
  font-weight: 500;
  letter-spacing: var(--doc-heading-spacing);
}

.pdf-cover-content h1 {
  color: #fff;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 38pt;
  font-weight: 800;
  line-height: 1.05;
  letter-spacing: 0;
}

.cover-kicker {
  margin: 9mm 0 0;
  color: #fff;
  font-size: 18pt;
  font-style: italic;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: none;
}

.pdf-cover-client {
  margin-top: 73mm;
}

.pdf-cover-client h2 {
  margin: 0 0 6mm;
  color: #fff;
  font-size: 27pt;
  font-style: italic;
  font-weight: 800;
  line-height: 1.08;
}

.pdf-cover-client p {
  margin: 0 0 3mm;
  max-width: 145mm;
  color: #fff;
  font-size: 14pt;
  font-style: italic;
  font-weight: 800;
  line-height: 1.28;
}

.pdf-cover-logo {
  position: absolute;
  right: 22mm;
  bottom: 26mm;
  width: 64mm;
  height: 64mm;
  object-fit: cover;
}

.date-line {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10mm;
  color: var(--doc-muted);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 7.5pt;
}

.date-line span {
  width: 2.1mm;
  height: 2.1mm;
  border-radius: 50%;
  background: var(--doc-accent);
}

.proposal-section h2,
.price-summary h2 {
  padding-bottom: 0;
  border-bottom: 0;
  color: var(--doc-heading);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 16pt;
  font-weight: 800;
  line-height: 1.18;
}

.section-body {
  margin-top: 7mm;
}

.section-body p {
  margin: 0 0 4.2mm;
  text-align: justify;
}

.section-body ul,
.note-list ul {
  margin: 0 0 5mm 0;
  padding-left: 5mm;
}

.section-body li,
.note-list li {
  margin: 0 0 2.2mm;
}

.price-summary {
  margin-bottom: 13mm;
}

.price-summary strong {
  display: block;
  margin: 13mm 0 6mm;
  color: var(--doc-heading);
  font-size: 32pt;
  font-weight: 500;
  letter-spacing: 0.12em;
}

.price-summary p {
  max-width: 130mm;
  margin: 0 0 8mm;
  color: var(--doc-muted);
}

.price-summary dl {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0;
  border: 1px solid rgba(102, 114, 125, 0.26);
}

.price-summary dl div {
  padding: 5mm;
  border-right: 1px solid rgba(102, 114, 125, 0.26);
}

.price-summary dl div:last-child {
  border-right: 0;
}

.price-summary dt {
  color: var(--doc-muted);
  font-size: 8pt;
  text-transform: uppercase;
}

.price-summary dd {
  margin: 2mm 0 0;
  color: var(--doc-heading);
  font-weight: 700;
}

.optional-list h3,
.note-list h3 {
  margin: 0 0 5mm;
  color: var(--doc-heading);
  font-size: 13pt;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.price-table {
  width: 100%;
  margin: 0 0 12mm;
  border-collapse: collapse;
  color: var(--doc-body);
}

.price-table th {
  padding: 3mm 3.5mm;
  background: var(--doc-heading);
  color: #fff;
  font-size: 8pt;
  text-align: left;
}

.price-table td {
  padding: 3.2mm 3.5mm;
  border: 1px solid rgba(102, 114, 125, 0.22);
  vertical-align: top;
}

.price-table th:nth-child(2),
.price-table td:nth-child(2) {
  width: 18mm;
  text-align: center;
}

.price-table th:nth-child(3),
.price-table th:nth-child(4),
.price-table td:nth-child(3),
.price-table td:nth-child(4) {
  width: 32mm;
  text-align: right;
}

.optional-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10mm;
  padding: 5mm 0;
  border-top: 1px solid rgba(102, 114, 125, 0.22);
}

.optional-item strong {
  color: var(--doc-heading);
  font-size: 12pt;
}

.optional-item p {
  margin: 2mm 0 0;
  color: var(--doc-muted);
}

.optional-item span {
  color: var(--doc-accent);
  font-size: 13pt;
  font-weight: 700;
  white-space: nowrap;
}

.doc-footer {
  position: absolute;
  left: var(--doc-margin-left);
  right: var(--doc-margin-right);
  bottom: 9mm;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 4mm;
  border-top: 1px solid rgba(102, 114, 125, 0.22);
  color: var(--doc-muted);
  font-size: 7.5pt;
}

.inspector-form {
  display: grid;
}

.inspector-section {
  display: grid;
  gap: 13px;
}


.template-help {
  margin: -4px 0 0;
  padding: 10px 11px;
  border: 1px solid rgba(19, 153, 154, 0.18);
  background: #f2fbfb;
  color: #51606d;
  font-size: 12px;
  line-height: 1.45;
}

.two-col,
.four-col {
  display: grid;
  gap: 10px;
}

.two-col {
  grid-template-columns: 1fr 1fr;
}

.four-col {
  grid-template-columns: repeat(4, 1fr);
}

.inspector input[type="color"] {
  padding: 4px;
}

.editor-list {
  display: grid;
  gap: 6px;
  max-height: 178px;
  overflow: auto;
}

.editor-row {
  display: grid;
  grid-template-columns: 24px 1fr;
  gap: 8px;
  align-items: center;
  width: 100%;
  padding: 8px;
  border: 1px solid #dbe3ea;
  background: #fff;
  color: var(--text);
  text-align: left;
}

.editor-row:hover,
.editor-row.is-active {
  border-color: rgba(19, 153, 154, 0.35);
  background: #ecf8f8;
}

.editor-row span {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  background: #eef2f5;
  color: #53616e;
  font-size: 11px;
  font-weight: 800;
}

.editor-row strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
}

.inspector .editor-textarea {
  flex: initial;
  min-height: 180px;
  margin-top: 0;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 12px;
}

.price-editor {
  display: grid;
  gap: 10px;
}

.price-editor-row {
  display: grid;
  gap: 9px;
  padding: 10px;
  border: 1px solid #dbe3ea;
  background: #fafcfd;
}

.price-row-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.price-row-head strong {
  font-size: 12px;
}

.price-row-grid {
  display: grid;
  grid-template-columns: 0.6fr 1fr 1fr;
  gap: 8px;
}

.icon-plus::before {
  content: "+";
  font-size: 21px;
  line-height: 0;
}

.icon-file::before {
  content: "";
  width: 13px;
  height: 16px;
  border: 2px solid currentColor;
  border-top-right-radius: 5px;
  display: inline-block;
}

.icon-spark::before {
  content: "*";
  font-size: 18px;
}

.icon-save::before {
  content: "\2713";
}

.icon-pdf::before {
  content: "";
  width: 14px;
  height: 16px;
  border: 2px solid currentColor;
  display: inline-block;
  box-shadow: inset 0 -5px 0 rgba(255, 255, 255, 0.18);
}

.icon-refresh::before {
  content: "\21bb";
}

.icon-upload::before {
  content: "\2191";
  font-size: 20px;
}

.icon-search::before {
  content: "\2315";
}

.icon-logout::before {
  content: "\2192";
  font-size: 18px;
}

@media (max-width: 1180px) {
  .app-shell {
    grid-template-columns: 250px minmax(430px, 1fr);
    grid-template-rows: 58px minmax(0, 1fr) 380px;
  }

  .inspector {
    grid-column: 1 / -1;
    grid-row: 3;
    display: block;
    border-top: 1px solid var(--line);
    border-left: 0;
  }

  .topbar-actions {
    overflow-x: auto;
    padding-bottom: 2px;
  }
}

@media (max-width: 820px) {
  .app-shell {
    height: auto;
    min-height: 100vh;
    display: block;
    overflow: visible;
  }

  .topbar,
  .sidebar,
  .workspace {
    position: static;
  }

  .topbar {
    flex-wrap: wrap;
    min-height: 58px;
    padding: 10px;
  }

  .sidebar {
    max-height: none;
  }

  .workspace {
    min-height: 80vh;
  }

  .preview-viewport {
    padding: 16px;
  }

  .preview-pages {
    zoom: 0.58;
    margin: 0;
  }
}


/* Additional proposal template: Social Media */
.social-cover-page,
.social-content-page,
.social-price-page {
  font-family: Arial, Helvetica, sans-serif;
}

.social-cover-page {
  color: #fff;
  background: #111827;
}

.social-cover-page .page-inner {
  min-height: 297mm;
  padding: 0;
  overflow: hidden;
}

.social-cover-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  display: block;
}

.social-cover-badge {
  position: absolute;
  z-index: 1;
  top: 31mm;
  left: 22mm;
  padding: 3mm 5mm;
  border: 1px solid rgba(255, 255, 255, 0.45);
  border-radius: 999px;
  color: #fff;
  font-size: 8pt;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.social-cover-content {
  position: absolute;
  z-index: 1;
  left: 22mm;
  top: 70mm;
  right: 32mm;
}

.social-cover-content p {
  margin: 0 0 7mm;
  color: rgba(255, 255, 255, 0.72);
  font-size: 12pt;
  font-weight: 800;
}

.social-cover-content h1 {
  max-width: 150mm;
  margin: 0;
  color: #fff;
  font-size: 42pt;
  font-weight: 900;
  line-height: 0.98;
  letter-spacing: -0.04em;
}

.social-cover-content span {
  display: block;
  max-width: 130mm;
  margin-top: 9mm;
  color: rgba(255, 255, 255, 0.82);
  font-size: 15pt;
  font-weight: 700;
  line-height: 1.35;
}

.social-client-card {
  position: absolute;
  z-index: 1;
  left: 22mm;
  right: 24mm;
  bottom: 38mm;
  padding: 9mm 10mm;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.10);
}

.social-client-card small,
.social-client-card strong,
.social-client-card em {
  display: block;
}

.social-client-card small {
  color: rgba(255, 255, 255, 0.68);
  font-size: 8pt;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.social-client-card strong {
  margin-top: 3mm;
  color: #fff;
  font-size: 22pt;
  font-weight: 900;
}

.social-client-card em {
  margin-top: 2mm;
  color: rgba(255, 255, 255, 0.76);
  font-size: 11pt;
  font-style: normal;
}

.social-cover-logo {
  position: absolute;
  z-index: 1;
  right: 20mm;
  bottom: 14mm;
  width: 34mm;
  height: 34mm;
  object-fit: cover;
}

.social-page-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12mm;
  margin-bottom: 13mm;
  padding-bottom: 5mm;
  border-bottom: 1px solid rgba(17, 24, 39, 0.12);
  color: var(--doc-muted);
  font-size: 8pt;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.social-page-top strong {
  color: var(--doc-accent);
}

.social-section-card {
  position: relative;
  min-height: 190mm;
  padding: 13mm 13mm 18mm;
  border: 1px solid rgba(17, 24, 39, 0.10);
  background: #fff;
}

.social-section-card::before,
.social-price-hero::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  width: 4mm;
  height: 100%;
  background: var(--doc-accent);
}

.social-eyebrow {
  margin: 0 0 5mm;
  color: var(--doc-accent);
  font-size: 8pt;
  font-weight: 900;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.social-section-card h2 {
  max-width: 145mm;
  margin: 0 0 8mm;
  color: var(--doc-heading);
  font-size: 25pt;
  font-weight: 900;
  line-height: 1.05;
  letter-spacing: -0.03em;
}

.social-section-card .section-body {
  margin-top: 0;
  color: var(--doc-body);
}

.social-price-hero {
  position: relative;
  margin-bottom: 10mm;
  padding: 12mm 13mm;
  background: #111827;
  color: #fff;
}

.social-price-hero .social-eyebrow {
  color: #fda4af;
}

.social-price-hero h2 {
  margin: 0;
  color: #fff;
  font-size: 33pt;
  font-weight: 900;
  letter-spacing: -0.03em;
}

.social-price-hero p {
  max-width: 130mm;
  margin: 5mm 0 8mm;
  color: rgba(255, 255, 255, 0.78);
}

.social-price-hero dl {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0;
  margin: 0;
  border: 1px solid rgba(255, 255, 255, 0.20);
}

.social-price-hero dl div {
  padding: 4mm;
  border-right: 1px solid rgba(255, 255, 255, 0.20);
}

.social-price-hero dl div:last-child {
  border-right: 0;
}

.social-price-hero dt {
  color: rgba(255, 255, 255, 0.56);
  font-size: 7pt;
  font-weight: 800;
  text-transform: uppercase;
}

.social-price-hero dd {
  margin: 2mm 0 0;
  color: #fff;
  font-weight: 800;
}

.proposal-template-social-media .price-table th {
  background: #111827;
}

.proposal-template-social-media .optional-item span {
  color: var(--doc-accent);
}

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

@media print {
  body {
    background: #fff;
  }

  .topbar,
  .sidebar,
  .inspector,
  .workspace-toolbar {
    display: none !important;
  }

  .app-shell,
  .workspace,
  .preview-viewport,
  .preview-pages {
    display: block;
    width: auto;
    height: auto;
    padding: 0;
    margin: 0;
    overflow: visible;
    background: #fff;
    zoom: 1 !important;
  }

  .proposal-page {
    width: 210mm;
    min-height: 297mm;
    box-shadow: none;
    page-break-after: always;
    break-after: page;
  }
}

/* UI/UX final adjustments: mobile tabs, optional services editor, print color fidelity */
.mobile-tabs {
  display: none;
}

.optional-editor {
  display: grid;
  gap: 10px;
}

.optional-editor-row {
  display: grid;
  gap: 9px;
  padding: 10px;
  border: 1px solid #dbe3ea;
  background: #fafcfd;
}

.optional-textarea {
  flex: initial;
  min-height: 86px;
  margin-top: 0;
  resize: vertical;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 12px;
}

.optional-list,
.note-list {
  break-inside: avoid;
  page-break-inside: avoid;
}

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

@media screen and (max-width: 820px) {
  body.is-app {
    overflow-x: hidden;
    background: #eef2f5;
  }

  .topbar {
    align-items: flex-start;
    gap: 10px;
  }

  .topbar-brand {
    width: 100%;
    min-width: 0;
  }

  .topbar-brand span {
    max-width: 220px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .topbar-actions {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 7px;
    overflow: visible;
  }

  .topbar-actions .ghost-button,
  .topbar-actions .accent-button,
  .topbar-actions .gold-button,
  .topbar-actions .icon-button {
    min-width: 0;
    min-height: 36px;
    padding: 0 8px;
    font-size: 12px;
  }

  .topbar-actions .icon-button {
    width: auto;
  }

  .mobile-tabs {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 7px;
    padding: 10px;
    background: #fff;
    border-bottom: 1px solid var(--line);
  }

  .mobile-tab {
    min-height: 38px;
    border: 1px solid #dbe3ea;
    background: #f7fafb;
    color: #334250;
    font-size: 13px;
    font-weight: 800;
  }

  .mobile-tab.is-active {
    border-color: rgba(19, 153, 154, 0.42);
    background: #ecf8f8;
    color: var(--accent-dark);
  }

  .sidebar,
  .workspace,
  .inspector {
    display: none;
    width: 100%;
    border: 0;
  }

  body[data-mobile-tab="source"] .sidebar {
    display: flex;
  }

  body[data-mobile-tab="preview"] .workspace {
    display: grid;
    min-height: calc(100vh - 150px);
  }

  body[data-mobile-tab="edit"] .inspector {
    display: block;
  }

  .sidebar-section,
  .inspector-section {
    padding: 14px;
  }

  .upload-box {
    margin: 14px;
  }

  .grow-section {
    min-height: 360px;
  }

  textarea#rawText {
    min-height: 320px;
  }

  .workspace-toolbar {
    min-height: auto;
    flex-wrap: wrap;
    gap: 8px;
    padding: 10px 12px;
  }

  .toolbar-group {
    width: 100%;
  }

  #statusText {
    width: 100%;
  }

  .preview-viewport {
    padding: 14px;
    overflow-x: auto;
  }

  .preview-pages {
    width: 210mm;
    margin: 0;
    gap: 14px;
  }

  .two-col,
  .four-col,
  .price-row-grid {
    grid-template-columns: 1fr;
  }

  .inspector .editor-textarea {
    min-height: 190px;
  }

  .advanced-section {
    background: #fbfcfd;
  }

  .advanced-section h2::after {
    content: " · Gelişmiş";
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
  }
}

@media print {
  html,
  body,
  .proposal-page,
  .proposal-page * {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
    color-adjust: exact !important;
  }

  .pdf-cover-page {
    background: #dd0939 !important;
    color: #fff !important;
  }

  .pdf-cover-content,
  .pdf-cover-content h1,
  .cover-kicker,
  .pdf-cover-client h2,
  .pdf-cover-client p {
    color: #fff !important;
  }

  .social-cover-page,
  .social-price-hero,
  .proposal-template-social-media .price-table th {
    background: #111827 !important;
    color: #fff !important;
  }

  .social-cover-content,
  .social-cover-content h1,
  .social-cover-content p,
  .social-cover-content span,
  .social-client-card,
  .social-client-card small,
  .social-client-card strong,
  .social-client-card em,
  .social-price-hero h2,
  .social-price-hero p,
  .social-price-hero dt,
  .social-price-hero dd {
    color: #fff !important;
  }

  .price-table th {
    background: var(--doc-heading) !important;
    color: #fff !important;
  }

  .date-line span {
    background: var(--doc-accent) !important;
  }

  .preview-pages {
    gap: 0 !important;
  }
}

.pdf-cover-fill-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  display: block;
}

.pdf-cover-content,
.pdf-cover-logo {
  z-index: 1;
}

/* ===== 2026 UI refresh overrides ===== */
:root {
  --ui-bg: #f5f5f7;
  --ui-card: #ffffff;
  --ui-border: #e7e7ea;
  --ui-soft: #f1f1f4;
  --ui-text: #19191d;
  --ui-muted: #777984;
  --ui-red: #e4003f;
  --ui-red-soft: #ffe8ee;
  --ui-dark: #121315;
  --ui-dark-2: #1b1c20;
  --ui-shadow: 0 10px 35px rgba(12, 16, 24, 0.08);
}

body.is-app {
  background: linear-gradient(180deg, #efefef 0%, #f9f9fb 100%);
  color: var(--ui-text);
}

.app-shell {
  max-width: 1800px;
  margin: 18px auto;
  padding: 0 14px 18px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 18px 28px;
  border-radius: 26px 26px 0 0;
  background: radial-gradient(circle at center, rgba(228,0,63,0.08), transparent 32%), linear-gradient(90deg, #151515, #23242a 45%, #141414);
  color: #fff;
  box-shadow: var(--ui-shadow);
}

.topbar-brand-wrap,
.topbar-actions,
.topbar-title-row,
.user-chip,
.topbar-quick-actions,
.section-title-spread,
.section-actions-inline,
.txt-toolbar,
.toolbar-group-spaced {
  display: flex;
  align-items: center;
}

.topbar-brand-wrap {
  gap: 18px;
  min-width: 0;
  flex: 1 1 auto;
}

.topbar-brand {
  flex: 0 0 auto;
  width: 126px;
}

.topbar-brand img {
  width: 100%;
  height: auto;
  object-fit: contain;
  display: block;
}

.topbar-divider {
  width: 1px;
  align-self: stretch;
  background: rgba(255,255,255,0.14);
}

.topbar-title-row { gap: 14px; }
.topbar-doc-icon {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.16);
  background: rgba(255,255,255,0.06);
  font-size: 15px;
}

.topbar-heading strong {
  display: block;
  font-size: 18px;
  font-weight: 800;
  margin-bottom: 4px;
}

.topbar-heading span {
  display: block;
  color: rgba(255,255,255,0.72);
  font-size: 13px;
}

.topbar-actions {
  gap: 18px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.topbar-quick-actions { gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.user-chip {
  gap: 10px;
  padding-left: 8px;
}
.user-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--ui-red);
  color: #fff;
  font-weight: 800;
}
.user-meta { display:flex; flex-direction:column; line-height:1.1; }
.user-meta strong { font-size: 14px; }
.user-meta small { color: rgba(255,255,255,0.7); font-size: 12px; }
.theme-button {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.14);
  background: rgba(255,255,255,0.05);
  color: #fff;
  cursor: default;
}

.app-grid {
  display: grid;
  grid-template-columns: 400px minmax(0, 1fr) 420px;
  gap: 18px;
  align-items: start;
  padding-top: 14px;
}

.sidebar,
.inspector,
.workspace {
  min-width: 0;
}

.sidebar,
.inspector {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.sidebar-card,
.inspector-section,
.page-thumbs-card,
.preview-viewport,
.workspace-toolbar {
  background: var(--ui-card);
  border: 1px solid var(--ui-border);
  border-radius: 18px;
  box-shadow: 0 4px 18px rgba(14, 18, 25, 0.04);
}

.sidebar-card,
.inspector-section {
  padding: 18px;
}

.section-title h2,
.inspector-section h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 800;
  color: var(--ui-text);
}

.section-title-spread {
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.section-helper {
  color: var(--ui-muted);
  font-size: 12px;
}

.search-box {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 14px;
  height: 44px;
  border-radius: 12px;
  border: 1px solid var(--ui-border);
  background: #fbfbfc;
  margin-bottom: 12px;
}
.search-box input { border:0; outline:0; background:transparent; width:100%; }

.offer-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 320px;
  overflow: auto;
}
.offer-row {
  width: 100%;
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) 16px;
  align-items: center;
  gap: 12px;
  text-align: left;
  padding: 12px 12px;
  border-radius: 14px;
  border: 1px solid transparent;
  background: transparent;
  cursor: pointer;
}
.offer-row:hover { background: #fafafa; border-color: var(--ui-border); }
.offer-row.is-active { background: var(--ui-red-soft); border-color: #ffd3de; }
.offer-row strong { display:block; font-size:14px; line-height:1.2; }
.offer-row small { display:block; color: var(--ui-muted); margin-top: 3px; }
.offer-row-dots { color: #a3a5af; font-size: 16px; }

.template-gallery {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.template-gallery-card {
  border: 1px solid var(--ui-border);
  border-radius: 16px;
  padding: 10px;
  background: #fcfcfd;
}
.template-gallery-card.is-active {
  border-color: #ffbfd0;
  box-shadow: 0 0 0 2px rgba(228,0,63,0.08) inset;
}
.template-card-button {
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
}
.template-preview {
  height: 132px;
  border-radius: 12px;
  overflow: hidden;
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 12px;
  text-align: left;
}
.template-preview.is-classic {
  background: linear-gradient(180deg, #ed0b4f, #d80446);
  color: #fff;
}
.template-preview.is-social {
  background: linear-gradient(135deg, #121826, #332050 60%, #e4003f 120%);
  color: #fff;
}
.template-preview-brand { font-size: 28px; font-weight: 900; line-height: 1; }
.template-preview small { font-size: 11px; text-transform: uppercase; opacity: .9; letter-spacing: .06em; }
.template-card-meta { margin-top: 10px; }
.template-name-input {
  width: 100%;
  border: 1px solid transparent;
  border-radius: 10px;
  background: #fff;
  padding: 8px 10px;
  font-weight: 700;
  color: var(--ui-text);
}
.template-name-input:focus { outline: none; border-color: #ffc3d2; box-shadow: 0 0 0 3px rgba(228,0,63,0.08); }
.template-card-meta small { display:block; margin-top:6px; color: var(--ui-muted); line-height:1.35; }

.txt-mode-switch {
  display: inline-grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0;
  border: 1px solid var(--ui-border);
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 12px;
}
.txt-mode-switch span {
  text-align: center;
  padding: 10px 8px;
  background: #fff;
  color: var(--ui-muted);
  font-size: 12px;
  font-weight: 700;
}
.txt-mode-switch .is-active { color: var(--ui-red); background: #fff6f8; }

.upload-box {
  padding: 18px;
  border-radius: 16px;
  border: 1px dashed #d9dbe4;
  background: linear-gradient(180deg, #fbfbfc, #f7f7f9);
  text-align: center;
  margin-bottom: 12px;
}
.upload-box.is-drag { border-color: #f4a8ba; background: #fff6f8; }
.upload-button {
  min-height: 42px;
  padding: 0 16px;
  border-radius: 12px;
  border: 0;
  background: var(--ui-red);
  color: #fff;
  font-weight: 700;
}
#rawText {
  min-height: 260px;
  border-radius: 16px;
  border: 1px solid var(--ui-border);
  background: #fff;
  padding: 14px;
  resize: vertical;
}

.workspace {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.workspace-toolbar {
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.toolbar-group { display:flex; align-items:center; gap:10px; }
#statusText { margin: 0; color: var(--ui-muted); font-size: 13px; }
#statusText[data-type="warn"] { color: #c46000; }
#statusText[data-type="error"] { color: #bf1436; }
#statusText[data-type="ok"] { color: #17784a; }

.preview-viewport {
  padding: 18px;
  min-height: 760px;
  max-height: calc(100vh - 240px);
  overflow: auto;
  background: linear-gradient(180deg, #f1f1f3, #f8f8f9);
}
.preview-pages {
  align-items: center;
}
.preview-pages .proposal-page {
  box-shadow: 0 12px 28px rgba(16, 19, 27, 0.12);
  border-radius: 6px;
  overflow: hidden;
}

.page-thumbs-card {
  padding: 10px 12px;
}
.page-thumbs {
  display: flex;
  gap: 12px;
  overflow: auto;
  padding-bottom: 2px;
}
.page-thumb {
  flex: 0 0 96px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 8px;
  border: 1px solid var(--ui-border);
  border-radius: 14px;
  background: #fff;
  cursor: pointer;
}
.page-thumb.is-active {
  border-color: #f5b5c5;
  box-shadow: 0 0 0 2px rgba(228,0,63,0.08) inset;
}
.page-thumb-canvas {
  position: relative;
  display: block;
  width: 80px;
  height: 112px;
  overflow: hidden;
  border-radius: 8px;
  background: #f6f6f8;
  border: 1px solid #efeff2;
}
.page-thumb-canvas .proposal-page {
  transform: scale(0.1);
  transform-origin: top left;
  width: 210mm;
  min-height: 297mm;
  box-shadow: none;
}
.page-thumb small {
  display: block;
  text-align: center;
  color: var(--ui-muted);
  font-weight: 700;
}

.inspector-form { display:flex; flex-direction:column; gap:14px; }
.inspector-section label,
.price-editor-row label,
.optional-editor-row label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: var(--ui-muted);
  font-size: 12px;
  font-weight: 700;
}
.inspector-section input,
.inspector-section textarea,
.inspector-section select,
.price-editor-row input,
.optional-editor-row input,
.optional-editor-row textarea {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--ui-border);
  border-radius: 12px;
  padding: 10px 12px;
  background: #fbfbfc;
  color: var(--ui-text);
}
.inspector-section textarea,
.optional-editor-row textarea,
.editor-textarea { min-height: 100px; resize: vertical; }
.inspector-section input[type="color"] { min-height: 44px; padding: 6px; }
.inspector-section > label,
.inspector-section > .two-col,
.inspector-section > .four-col,
.inspector-section > .editor-list,
.inspector-section > .price-editor,
.inspector-section > .optional-editor,
.inspector-section > .template-help,
.inspector-section > button { margin-top: 12px; }
.template-help { margin: 0; color: var(--ui-muted); line-height: 1.4; }
.two-col { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:12px; }
.four-col { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:10px; }
.editor-list { display:flex; flex-wrap:wrap; gap:8px; }
.editor-row {
  display:flex; align-items:center; gap:8px; padding:10px 12px; border-radius:12px; border:1px solid var(--ui-border); background:#fff; cursor:pointer;
}
.editor-row.is-active { border-color:#ffbfd0; background: #fff6f8; }
.editor-row span { width:22px; height:22px; border-radius:50%; display:grid; place-items:center; background:#f1f1f4; color:var(--ui-muted); font-size:11px; font-weight:700; }
.editor-row strong { font-size:13px; }
.price-editor-row,
.optional-editor-row {
  border: 1px solid var(--ui-border);
  background: #fcfcfd;
  border-radius: 16px;
  padding: 12px;
}
.price-editor,
.optional-editor,
.modern-stack {
  display:flex;
  flex-direction:column;
  gap:10px;
}
.price-row-head {
  display:flex; align-items:center; justify-content:space-between; gap:10px; margin-bottom:10px;
}
.price-row-grid { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:10px; }
.empty-list { margin:0; color:var(--ui-muted); background:#fafafa; border:1px dashed var(--ui-border); border-radius:14px; padding:14px; }

.ghost-button,
.accent-button,
.gold-button,
.danger-button,
.mini-button,
.mini-ghost-button,
.icon-button {
  border-radius: 12px;
  border: 1px solid var(--ui-border);
  background: #fff;
  color: var(--ui-text);
  min-height: 40px;
  padding: 0 14px;
  font-weight: 700;
}
.mini-button,
.mini-ghost-button { min-height: 38px; padding: 0 12px; }
.icon-button { width: 42px; padding: 0; }
.ghost-button { background: #fff; }
.accent-button,
.gold-button,
.danger-button { border: none; }
.accent-button { background: #fff5f8; color: var(--ui-red); border: 1px solid #ffd4df; }
.gold-button { background: var(--ui-red); color: #fff; }
.danger-button { background: #121315; color: #fff; }
.full-button { width:100%; justify-content:center; }

.mobile-tabs {
  display:none;
  gap:8px;
  padding: 14px 2px 0;
}
.mobile-tab {
  flex:1 1 0;
  min-height: 42px;
  border-radius: 12px;
  border:1px solid var(--ui-border);
  background:#fff;
  font-weight:700;
}
.mobile-tab.is-active { background:#fff5f8; color: var(--ui-red); border-color:#ffd2dd; }

@media (max-width: 1380px) {
  .app-grid { grid-template-columns: 330px minmax(0, 1fr) 360px; }
  .template-gallery { grid-template-columns: 1fr; }
}

@media (max-width: 1100px) {
  .topbar { border-radius: 22px; }
  .topbar { flex-direction: column; align-items: stretch; }
  .topbar-actions { justify-content: space-between; }
  .app-grid { grid-template-columns: 1fr; }
  .mobile-tabs { display:flex; }
  body[data-mobile-tab="source"] .mobile-panel-preview,
  body[data-mobile-tab="source"] .mobile-panel-edit,
  body[data-mobile-tab="preview"] .mobile-panel-source,
  body[data-mobile-tab="preview"] .mobile-panel-edit,
  body[data-mobile-tab="edit"] .mobile-panel-source,
  body[data-mobile-tab="edit"] .mobile-panel-preview { display:none; }
  .preview-viewport { max-height: none; min-height: 0; }
}

@media (max-width: 720px) {
  .app-shell { margin: 0 auto; padding: 10px; }
  .topbar { padding: 16px; border-radius: 20px; }
  .topbar-brand-wrap { flex-direction: column; align-items: flex-start; }
  .topbar-divider { display:none; }
  .topbar-quick-actions { width:100%; }
  .topbar-quick-actions > button { flex:1 1 calc(50% - 8px); }
  .two-col,
  .four-col,
  .price-row-grid,
  .template-gallery { grid-template-columns: 1fr; }
  .sidebar-card,
  .inspector-section,
  .preview-viewport,
  .workspace-toolbar,
  .page-thumbs-card { padding: 14px; }
}

/* ===== viewport fit hotfix ===== */
html,
body.is-app {
  width: 100%;
  height: 100%;
  min-height: 100%;
  overflow: hidden;
}

body.is-app {
  margin: 0;
}

body.is-app .app-shell {
  width: 100vw;
  max-width: none;
  height: 100dvh;
  margin: 0;
  padding: 10px 12px 12px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
}

body.is-app .topbar {
  flex: 0 0 66px;
  min-height: 66px;
  max-height: 66px;
  padding: 0 18px;
  border-radius: 18px 18px 0 0;
  overflow: hidden;
}

.topbar-brand-wrap {
  min-width: 390px;
}

.topbar-brand-wordmark {
  width: 150px;
  height: 54px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 0 14px;
  border-radius: 0;
  background: var(--ui-red);
  color: #fff;
  line-height: 1;
  box-sizing: border-box;
}

.topbar-brand-wordmark strong {
  display: block;
  color: #fff;
  font-size: 29px;
  font-weight: 900;
  letter-spacing: -0.06em;
  line-height: 0.9;
}

.topbar-brand-wordmark strong span {
  color: #fff;
}

.topbar-brand-wordmark small {
  display: block;
  margin-top: 5px;
  color: rgba(255,255,255,0.88);
  font-size: 6px;
  font-weight: 800;
  letter-spacing: 0.08em;
  white-space: nowrap;
}

.topbar-heading strong {
  font-size: 17px;
  line-height: 1.05;
}

.topbar-heading span {
  font-size: 12px;
  white-space: nowrap;
}

body.is-app .app-grid {
  flex: 1 1 auto;
  min-height: 0;
  height: calc(100dvh - 88px);
  grid-template-columns: clamp(270px, 18vw, 340px) minmax(0, 1fr) clamp(300px, 20vw, 380px);
  gap: 12px;
  padding-top: 10px;
}

body.is-app .sidebar,
body.is-app .inspector,
body.is-app .workspace {
  height: 100%;
  min-height: 0;
}

body.is-app .sidebar,
body.is-app .inspector {
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 3px;
}

body.is-app .workspace {
  overflow: hidden;
}

body.is-app .workspace-toolbar {
  flex: 0 0 42px;
  min-height: 42px;
  padding: 6px 12px;
}

body.is-app .preview-viewport {
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
  height: auto;
  padding: 14px;
}

body.is-app .page-thumbs-card {
  flex: 0 0 114px;
  min-height: 114px;
  padding: 8px 10px;
}

body.is-app .page-thumb-canvas {
  width: 70px;
  height: 98px;
}

body.is-app .page-thumb {
  flex-basis: 86px;
  padding: 6px;
  gap: 5px;
}

body.is-app .preview-pages {
  gap: 12px;
}

body.is-app .sidebar-card,
body.is-app .inspector-section {
  padding: 14px;
  border-radius: 16px;
}

body.is-app .offer-list {
  max-height: 180px;
}

body.is-app #rawText {
  min-height: 190px;
}

body.is-app .upload-box {
  padding: 14px;
}

body.is-app .inspector-section input,
body.is-app .inspector-section textarea,
body.is-app .inspector-section select,
body.is-app .price-editor-row input,
body.is-app .optional-editor-row input,
body.is-app .optional-editor-row textarea {
  min-height: 38px;
}

body.is-app .inspector-section > label,
body.is-app .inspector-section > .two-col,
body.is-app .inspector-section > .four-col,
body.is-app .inspector-section > .editor-list,
body.is-app .inspector-section > .price-editor,
body.is-app .inspector-section > .optional-editor,
body.is-app .inspector-section > .template-help,
body.is-app .inspector-section > button {
  margin-top: 9px;
}

.topbar-quick-actions {
  flex-wrap: nowrap;
}

.topbar-quick-actions > button {
  min-height: 40px;
  white-space: nowrap;
}

.user-chip {
  flex: 0 0 auto;
}

@media (max-width: 1500px) {
  .topbar-heading span,
  .user-meta {
    display: none;
  }

  .topbar-brand-wrap {
    min-width: 285px;
  }

  body.is-app .app-grid {
    grid-template-columns: 280px minmax(0, 1fr) 320px;
  }

  .topbar-quick-actions > button {
    padding-left: 10px;
    padding-right: 10px;
  }
}

@media (max-width: 1100px) {
  html,
  body.is-app {
    height: auto;
    overflow: auto;
  }

  body.is-app .app-shell {
    height: auto;
    min-height: 100dvh;
    overflow: visible;
  }

  body.is-app .topbar {
    flex-basis: auto;
    min-height: 0;
    max-height: none;
    padding: 14px;
  }

  body.is-app .app-grid {
    height: auto;
    grid-template-columns: 1fr;
  }

  body.is-app .sidebar,
  body.is-app .inspector,
  body.is-app .workspace {
    height: auto;
    overflow: visible;
  }
}

/* cards for the existing PHP structure */
body.is-app .sidebar > .sidebar-section,
body.is-app .sidebar > .upload-box {
  background: var(--ui-card);
  border: 1px solid var(--ui-border);
  border-radius: 16px;
  box-shadow: 0 4px 18px rgba(14, 18, 25, 0.04);
}

body.is-app .sidebar > .sidebar-section {
  padding: 14px;
}

body.is-app .sidebar > .upload-box {
  margin-bottom: 0;
}

body.is-app .sidebar {
  gap: 10px;
}

body.is-app .inspector {
  gap: 10px;
}

body.is-app .workspace {
  gap: 10px;
}

/* ===== FINAL REFERENCE MATCH OVERRIDES ===== */
body.is-app {
  background: #ececef !important;
  min-height: 100vh;
  overflow: hidden;
}

.app-shell-reference {
  width: min(1820px, calc(100vw - 24px));
  height: calc(100vh - 24px);
  margin: 12px auto;
  padding: 0;
  display: flex;
  flex-direction: column;
  border-radius: 34px;
  overflow: hidden;
  box-shadow: 0 22px 80px rgba(15, 18, 26, 0.15);
  background: #f7f7f8;
}

.reference-topbar {
  flex: 0 0 94px;
  min-height: 94px;
  padding: 0 26px 0 22px !important;
  border-radius: 0 !important;
  background: radial-gradient(circle at 50% 50%, rgba(228,0,63,0.12), rgba(228,0,63,0) 28%), linear-gradient(90deg, #111217, #1a1b21 50%, #111216) !important;
  box-shadow: none !important;
}

.reference-topbar-right,
.user-utility-group,
.toolbar-left-cluster,
.left-search-row,
.action-buttons-row {
  display: flex;
  align-items: center;
}
.reference-topbar-right { gap: 16px; margin-left: auto; }
.user-utility-group { gap: 14px; }
.topbar-brand-wordmark {
  width: 148px;
  height: 56px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
}
.topbar-brand-wordmark strong {
  color: #fb0f4d !important;
  font-size: 56px !important;
  line-height: .72 !important;
  letter-spacing: -0.06em;
  font-weight: 900;
  display: block;
  margin: 0;
}
.topbar-brand-wordmark strong span { color: #fb0f4d !important; }
.topbar-brand-wordmark small {
  color: #fff;
  opacity: .92;
  font-size: 10px;
  letter-spacing: .08em;
  margin-top: 2px;
}
.topbar-brand-wordmark small span { margin-left: 10px; }
.topbar-brand-wordmark small em { font-style: normal; margin-left: 8px; }
.topbar-heading strong { font-size: 20px !important; }
.topbar-heading span { font-size: 14px !important; color: rgba(255,255,255,0.72) !important; }
.topbar-doc-icon {
  width: 44px !important;
  height: 44px !important;
  border-radius: 12px !important;
  background: rgba(255,255,255,0.06) !important;
  font-size: 18px !important;
}
.topbar-quick-actions { gap: 10px !important; }
.topbar-quick-actions > button,
.user-utility-group .theme-button,
.user-utility-group .icon-button {
  height: 44px;
  border-radius: 14px !important;
}
.topbar-quick-actions .ghost-button,
.topbar-quick-actions .accent-button,
.topbar-quick-actions .gold-button {
  padding: 0 18px !important;
  font-size: 14px;
  font-weight: 800;
  border: 1px solid rgba(255,255,255,0.08) !important;
}
.topbar-quick-actions .ghost-button {
  background: #fff !important;
  color: #15171d !important;
}
.topbar-quick-actions .accent-button {
  background: #fff0f5 !important;
  color: #df2458 !important;
}
.topbar-quick-actions .gold-button {
  background: #f40649 !important;
  color: #fff !important;
}
.theme-button,
.user-chip .icon-button {
  width: 44px;
  padding: 0;
  border: 1px solid rgba(255,255,255,0.14) !important;
  background: rgba(255,255,255,0.03) !important;
  color: #fff !important;
}
.user-chip {
  background: transparent !important;
  padding: 0 !important;
  gap: 10px !important;
}
.user-avatar {
  width: 42px !important;
  height: 42px !important;
  background: #f40649 !important;
}
.user-meta strong,
.user-meta small { color: #fff !important; }
.user-meta small { opacity: .75; }

.reference-grid {
  flex: 1 1 auto;
  min-height: 0;
  display: grid !important;
  grid-template-columns: 430px minmax(0, 1fr) 430px !important;
  gap: 0 !important;
  background: #f4f4f6;
}

.left-reference-panel,
.center-reference-panel,
.right-reference-panel {
  min-height: 0;
  padding: 14px;
}
.left-reference-panel,
.right-reference-panel { overflow: auto; }
.center-reference-panel { overflow: hidden; display: flex; flex-direction: column; gap: 12px; }

.ref-card,
.reference-toolbar,
.reference-preview-viewport,
.page-thumbs-card {
  background: #fff !important;
  border: 1px solid #e8e8ed !important;
  border-radius: 18px !important;
  box-shadow: 0 2px 10px rgba(20, 24, 33, 0.04) !important;
}
.sidebar-section.ref-card,
.inspector-section.ref-card { padding: 18px !important; }
.ref-card h2,
.workspace-toolbar .toolbar-title { font-size: 16px !important; font-weight: 800 !important; }
.section-helper,
.txt-info-icon { color: #9699a3 !important; font-size: 12px; }

.offers-panel .section-title-spread { margin-bottom: 14px; }
.left-search-row { gap: 12px; margin-bottom: 14px; }
.compact-search-box { flex: 1 1 auto; margin: 0 !important; height: 44px !important; }
.list-add-button,
.header-mini-button {
  flex: 0 0 auto;
  background: #fff !important;
  border: 1px solid #e7e8ee !important;
  height: 44px !important;
  color: #30323a !important;
  font-weight: 800;
}
.offer-list {
  max-height: none !important;
  overflow: visible !important;
}
.offer-row {
  padding: 12px 14px !important;
  border-radius: 14px !important;
  grid-template-columns: 22px minmax(0, 1fr) 12px !important;
}
.offer-row strong { font-size: 14px !important; }
.offer-row small { font-size: 12px !important; }
.offer-row.is-active {
  background: #ffeff3 !important;
  border: 1px solid #ffdce5 !important;
}

.template-gallery-reference {
  display: flex !important;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 2px;
}
.template-gallery-reference .template-gallery-card {
  min-width: 96px;
  width: 96px;
  padding: 0 !important;
  border: none !important;
  background: transparent !important;
  box-shadow: none !important;
}
.template-gallery-reference .template-card-button {
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid #ececf1;
  background: #fff;
  padding: 0 !important;
}
.template-gallery-reference .template-gallery-card.is-active .template-card-button {
  border-color: #ffb8c9;
  box-shadow: 0 0 0 2px rgba(244, 6, 73, 0.10) inset;
}
.template-gallery-reference .template-preview {
  height: 122px !important;
  border-radius: 14px !important;
  padding: 8px !important;
}
.template-gallery-reference .template-card-meta { margin-top: 6px !important; }
.template-gallery-reference .template-name-input {
  border: none !important;
  background: transparent !important;
  font-size: 11px !important;
  font-weight: 700 !important;
  padding: 0 !important;
  text-align: center;
  min-height: auto !important;
}
.template-gallery-reference .template-card-meta small { display: none !important; }
.template-dots {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 10px;
}
.template-dots span {
  width: 6px; height: 6px; border-radius: 999px; background: #d0d1d7;
}
.template-dots .is-active { background: #f40649; width: 16px; }

.txt-panel { display: flex; flex-direction: column; min-height: 0; }
.txt-tabs-fake {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0;
  border: 1px solid #e8e8ed;
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 12px;
}
.txt-tabs-fake span {
  padding: 10px 12px;
  font-size: 12px;
  font-weight: 700;
  text-align: center;
  color: #9a9da7;
  background: #fff;
}
.txt-tabs-fake .is-active { color: #f40649; background: #fff5f8; }
.upload-box {
  border: 1px dashed #dedfe6 !important;
  background: #fbfbfd !important;
  min-height: 142px;
  display: grid;
  place-items: center;
  margin-bottom: 12px;
}
.upload-box-inner { text-align: center; }
.upload-box-inner p { margin: 0 0 12px; color: #7c808b; line-height: 1.45; }
.upload-box-inner small { display: block; margin-top: 12px; color: #a0a3ac; }
.upload-button {
  background: #f40649 !important;
  border-radius: 12px !important;
  min-height: 44px !important;
  padding: 0 18px !important;
}
.txt-parse-bar { display: flex; justify-content: flex-end; margin-bottom: 10px; }
#rawText { flex: 1 1 auto; min-height: 240px !important; background: #fcfcfd !important; }

.reference-toolbar {
  flex: 0 0 auto;
  padding: 12px 16px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 16px;
}
.toolbar-left-cluster { gap: 14px; flex-wrap: wrap; }
.toolbar-title { color: #2f3137; }
.toolbar-pager,
.toolbar-zoom-group,
.toolbar-view-buttons {
  display: flex;
  align-items: center;
  gap: 8px;
}
.toolbar-page-readout {
  min-width: 76px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid #eaebef;
  border-radius: 12px;
  font-weight: 700;
  color: #5d606a;
  background: #fff;
}
.toolbar-nav-button,
.toolbar-icon-button,
.toolbar-zoom-group .mini-button {
  width: 38px;
  min-width: 38px;
  padding: 0 !important;
  height: 38px !important;
  border-radius: 12px !important;
}
#statusText { color: #8d919a !important; }
.reference-preview-viewport {
  flex: 1 1 auto;
  min-height: 0;
  padding: 20px 0 !important;
  overflow: auto;
  background:
    linear-gradient(rgba(209,214,222,.55) 1px, transparent 1px),
    linear-gradient(90deg, rgba(209,214,222,.55) 1px, transparent 1px),
    #eef1f4 !important;
  background-size: 28px 28px, 28px 28px, auto !important;
}
.preview-pages {
  align-items: center !important;
  gap: 18px !important;
}
.preview-pages .proposal-page {
  width: 520px !important;
  min-height: auto !important;
}
.page-thumbs-card {
  flex: 0 0 auto;
  padding: 10px 12px !important;
  display: flex;
  align-items: center;
  gap: 12px;
}
.page-thumbs {
  display: flex !important;
  gap: 12px;
  overflow-x: auto;
  flex: 1 1 auto;
}
.page-thumb {
  min-width: 92px !important;
  max-width: 92px !important;
  padding: 8px !important;
  border-radius: 14px !important;
}
.page-thumb-canvas { width: 74px !important; height: 106px !important; }
.page-thumb.is-active { border-color: #f4b1c2 !important; }
.thumbs-scroll-next {
  width: 36px; height: 36px; border-radius: 999px; border: 1px solid #e7e8ee; background: #fff; color: #5d606a; font-size: 22px;
}

.right-reference-panel .inspector-form { gap: 14px !important; }
.right-reference-panel .inspector-section { margin: 0 !important; }
.right-reference-panel .inspector-section label { font-size: 12px !important; color: #7d818c !important; }
.right-reference-panel .inspector-section input,
.right-reference-panel .inspector-section select,
.right-reference-panel .inspector-section textarea {
  background: #fbfbfd !important;
  border: 1px solid #e7e8ed !important;
  border-radius: 12px !important;
  min-height: 42px !important;
}
.template-help {
  padding: 10px 12px;
  border: 1px solid #d7e4e7;
  background: #f1f8f8;
  border-radius: 12px;
  margin-top: 12px !important;
}
.optional-editor-modern,
.price-editor {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.optional-editor-modern .optional-editor-row,
.price-editor .price-editor-row {
  padding: 12px !important;
  border: 1px solid #ebebef !important;
  border-radius: 14px !important;
  background: #fcfcfd !important;
}
.action-buttons-row { gap: 10px; }
.action-buttons-row > * { flex: 1 1 0; }
.inspector-hidden-tools { opacity: .98; }

@media (max-width: 1500px) {
  .reference-grid { grid-template-columns: 360px minmax(0, 1fr) 370px !important; }
  .preview-pages .proposal-page { width: 470px !important; }
}

@media (max-width: 1180px) {
  body.is-app { overflow: auto; }
  .app-shell-reference { height: auto; min-height: calc(100vh - 24px); overflow: visible; }
  .reference-topbar { padding: 14px 18px !important; }
  .reference-grid { grid-template-columns: 1fr !important; }
  .left-reference-panel,
  .right-reference-panel { overflow: visible; }
  .center-reference-panel { min-height: 700px; }
}

@media (max-width: 760px) {
  .reference-topbar { flex-wrap: wrap; }
  .reference-topbar-right { width: 100%; flex-direction: column; align-items: stretch; }
  .topbar-quick-actions { width: 100%; flex-wrap: wrap; }
  .topbar-quick-actions > button { flex: 1 1 calc(50% - 8px); }
  .left-search-row,
  .toolbar-left-cluster,
  .action-buttons-row,
  .user-utility-group { flex-wrap: wrap; }
  .page-thumbs-card { flex-direction: column; align-items: stretch; }
}

/* ===== BENG OFFICIAL LOGO OVERRIDES ===== */
.topbar-brand-official {
  width: 158px !important;
  height: 74px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  border-radius: 0 !important;
  overflow: hidden !important;
  background: #e4003f !important;
  flex: 0 0 158px !important;
}
.topbar-brand-official img {
  width: 100% !important;
  height: 100% !important;
  object-fit: cover !important;
  display: block !important;
}
.login-brand img {
  object-fit: cover !important;
  background: #e4003f !important;
}
.template-preview-logo {
  display: block;
  width: 100%;
  max-width: 82px;
  height: 62px;
  object-fit: cover;
  border-radius: 8px;
  margin-bottom: 6px;
}
.template-preview {
  justify-content: flex-end !important;
}
.template-preview.is-classic,
.template-preview.is-social {
  background: #e4003f !important;
}
.template-preview.is-social::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(15,16,24,.28), rgba(15,16,24,.04));
  pointer-events: none;
}
.template-preview-logo,
.template-preview small {
  position: relative;
  z-index: 1;
}
.pdf-cover-logo,
.social-cover-logo {
  object-fit: cover !important;
  background: #e4003f !important;
}
@media (max-width: 760px) {
  .topbar-brand-official {
    width: 136px !important;
    height: 64px !important;
    flex-basis: 136px !important;
  }
}

/* ===== PIXEL-ALIGN REFINEMENT PASS ===== */
body.is-app {
  background: #e9eaed !important;
}

.app-shell-reference {
  width: calc(100vw - 24px) !important;
  height: calc(100vh - 24px) !important;
  margin: 12px !important;
  border-radius: 34px !important;
  background: #f3f4f6 !important;
}

.reference-topbar {
  flex: 0 0 108px !important;
  min-height: 108px !important;
  padding: 0 22px !important;
  align-items: center !important;
}
.topbar-brand-wrap { gap: 18px !important; }
.topbar-brand-official {
  width: 152px !important;
  height: 70px !important;
  flex-basis: 152px !important;
  border-radius: 0 !important;
}
.topbar-divider {
  height: 54px !important;
  align-self: center !important;
}
.topbar-title-row { gap: 16px !important; }
.topbar-doc-icon {
  width: 40px !important;
  height: 40px !important;
  border-radius: 12px !important;
  font-size: 16px !important;
}
.topbar-heading strong { font-size: 18px !important; line-height: 1.1 !important; }
.topbar-heading span { font-size: 13px !important; }
.reference-topbar-right { gap: 12px !important; }
.topbar-quick-actions > button {
  min-height: 40px !important;
  height: 40px !important;
  border-radius: 14px !important;
  padding: 0 18px !important;
  font-size: 12px !important;
  gap: 8px !important;
}
.theme-button,
.user-chip .icon-button,
.user-avatar {
  width: 40px !important;
  height: 40px !important;
}
.user-meta strong { font-size: 13px !important; }
.user-meta small { font-size: 11px !important; }

.reference-grid {
  grid-template-columns: 410px minmax(0, 1fr) 404px !important;
}
.left-reference-panel,
.center-reference-panel,
.right-reference-panel {
  padding: 14px 12px !important;
}
.sidebar-section.ref-card,
.inspector-section.ref-card {
  padding: 18px 18px 16px !important;
}
.ref-card,
.reference-toolbar,
.reference-preview-viewport,
.page-thumbs-card {
  border-radius: 20px !important;
}
.ref-card h2,
.workspace-toolbar .toolbar-title { font-size: 15px !important; }
.section-title-spread { margin-bottom: 12px !important; }

.offers-panel { min-height: 352px; }
.left-search-row {
  display: grid !important;
  grid-template-columns: 1fr 145px;
  gap: 10px !important;
  margin-bottom: 12px !important;
}
.compact-search-box,
.list-add-button,
.header-mini-button {
  height: 42px !important;
  min-height: 42px !important;
  border-radius: 14px !important;
}
.offer-list {
  gap: 4px !important;
}
.offer-row {
  padding: 12px 10px !important;
  min-height: 52px;
}
.offer-row small { margin-top: 2px !important; }

.template-panel { min-height: 210px; }
.template-gallery-reference .template-gallery-card {
  min-width: 88px !important;
  width: 88px !important;
}
.template-gallery-reference .template-preview {
  height: 114px !important;
  padding: 7px !important;
}
.template-preview-logo {
  max-width: 74px !important;
  height: 58px !important;
  border-radius: 10px !important;
}
.template-gallery-reference .template-name-input {
  font-size: 10.5px !important;
  line-height: 1.15 !important;
}

.txt-panel {
  min-height: 300px;
}
.txt-tabs-fake span {
  padding: 9px 10px !important;
}
.upload-box {
  min-height: 132px !important;
  border-radius: 18px !important;
}
.upload-button {
  min-height: 42px !important;
  padding: 0 20px !important;
}
#rawText {
  min-height: 168px !important;
  border-radius: 16px !important;
}

.reference-toolbar {
  min-height: 50px !important;
  padding: 10px 14px !important;
}
.toolbar-left-cluster {
  gap: 10px !important;
  flex-wrap: nowrap !important;
}
.toolbar-page-readout {
  min-width: 84px !important;
  height: 36px !important;
}
.toolbar-nav-button,
.toolbar-icon-button,
.toolbar-zoom-group .mini-button {
  width: 36px !important;
  min-width: 36px !important;
  height: 36px !important;
}
#zoomValue {
  min-width: 44px;
  text-align: center;
  font-weight: 800;
  color: #374151;
}
.reference-preview-viewport {
  padding: 16px 10px !important;
}
.preview-pages .proposal-page {
  width: 420px !important;
  box-shadow: 0 10px 25px rgba(15, 23, 42, 0.12) !important;
}
.page-thumbs-card {
  min-height: 108px;
}
.page-thumb {
  min-width: 82px !important;
  max-width: 82px !important;
  gap: 6px !important;
}
.page-thumb-canvas {
  width: 66px !important;
  height: 88px !important;
}
.page-thumb small { font-size: 11px !important; }

.right-reference-panel .inspector-form {
  gap: 12px !important;
}
.right-reference-panel .inspector-section input,
.right-reference-panel .inspector-section select,
.right-reference-panel .inspector-section textarea {
  min-height: 40px !important;
  font-size: 13px !important;
}
.right-reference-panel .inspector-section label {
  gap: 5px !important;
}
.template-help {
  font-size: 12px !important;
  line-height: 1.35 !important;
}

.optional-editor-modern { gap: 8px !important; }
.optional-editor-row-reference {
  padding: 10px 12px !important;
}
.optional-inline-row {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr) 86px 48px 28px;
  align-items: center;
  gap: 10px;
}
.optional-drag {
  color: #9aa0a6;
  font-size: 14px;
  letter-spacing: -1px;
}
.optional-inline-title,
.optional-inline-price {
  width: 100%;
  min-height: 34px !important;
  height: 34px !important;
  padding: 6px 10px !important;
  background: #fff !important;
}
.optional-inline-price {
  text-align: right;
  font-weight: 700;
}
.optional-inline-textarea {
  margin-top: 8px;
  min-height: 56px !important;
  padding: 10px !important;
  background: #fff !important;
}
.optional-switch {
  position: relative;
  display: inline-flex;
  justify-content: center;
}
.optional-switch input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.optional-switch span {
  width: 38px;
  height: 22px;
  border-radius: 999px;
  background: #d8dbe1;
  position: relative;
  display: inline-block;
  transition: .2s ease;
}
.optional-switch span::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 4px rgba(0,0,0,0.15);
  transition: .2s ease;
}
.optional-switch input:checked + span {
  background: #f40649;
}
.optional-switch input:checked + span::after {
  transform: translateX(16px);
}
.icon-action {
  width: 28px;
  height: 28px;
  border-radius: 10px;
  border: 1px solid #ececf1;
  background: #fff;
  color: #6b7280;
  cursor: pointer;
  display: grid;
  place-items: center;
}

.action-bar-card .action-buttons-row {
  display: grid !important;
  grid-template-columns: 1.2fr 1fr 1fr;
  gap: 10px !important;
}
.action-bar-card .ghost-button,
.action-bar-card .accent-button,
.action-bar-card .gold-button,
.action-bar-card .danger-button {
  min-height: 42px !important;
  height: 42px !important;
}

@media (max-width: 1540px) {
  .reference-grid {
    grid-template-columns: 360px minmax(0, 1fr) 372px !important;
  }
  .preview-pages .proposal-page {
    width: 392px !important;
  }
}
