@font-face {
  font-family: "Union";
  src: url("Union-Regular.ttf") format("truetype");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Union";
  src: url("Union-Italic.ttf") format("truetype");
  font-style: italic;
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Union";
  src: url("Union-Bold.ttf") format("truetype");
  font-style: normal;
  font-weight: 700;
  font-display: swap;
}
@font-face {
  font-family: "Union";
  src: url("Union-BoldItalic.ttf") format("truetype");
  font-style: italic;
  font-weight: 700;
  font-display: swap;
}

:root {
  --canvas-ratio: 1080 / 1350;
  --header-h: 72px;
  --sidebar-w: 64px;
  --black: #050505;
  --panel: #ffffff;
  --soft: #f1f2f4;
  --line: #d8dade;
  --text: #111111;
  --muted: #676b73;
  --accent: #ff4e9a;
  --danger: #b51f2b;
  --shadow: 0 10px 30px rgba(0, 0, 0, .10);
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body {
  margin: 0;
  background: var(--soft);
  color: var(--text);
  font-family: "Union", Arial, Helvetica, sans-serif;
  overflow: hidden;
}
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }

.topbar {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 100;
  height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px 0 20px;
  color: #fff;
  background: #000;
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: #fff;
  background: transparent;
  border: 0;
  text-align: left;
}
.brand img {
  width: 45px;
  height: 43px;
  object-fit: contain;
}
.brand span { display: grid; gap: 2px; }
.brand strong { font-family: "Union", Arial Black, sans-serif; letter-spacing: .04em; }
.brand small { color: #c6c6c6; font-size: 11px; text-transform: uppercase; letter-spacing: .14em; }
.topbar-actions { display: flex; align-items: center; gap: 9px; font-size: 12px; color: #d6d6d6; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: #42cf72; }
.icon-button {
  width: 36px;
  height: 36px;
  margin-left: 8px;
  border: 1px solid #333;
  border-radius: 50%;
  color: #fff;
  background: #111;
}

.side-nav {
  position: fixed;
  z-index: 90;
  top: var(--header-h);
  bottom: 0;
  left: 0;
  width: var(--sidebar-w);
  background: #fff;
  box-shadow: 0 0 8px rgba(0,0,0,.25);
}
.nav-button {
  width: 64px;
  height: 64px;
  border: 0;
  border-bottom: 1px solid #eee;
  color: #111;
  background: #fff;
  font-size: 22px;
}
.nav-button:hover { background: #f2f2f2; }
.nav-button.active { color: #fff; background: #161616; }

.app-shell {
  height: 100vh;
  padding-top: var(--header-h);
  padding-left: var(--sidebar-w);
}
.view { height: calc(100vh - var(--header-h)); }
.hidden { display: none !important; }

.dashboard-view {
  overflow: auto;
  padding: 28px 32px 40px;
  background: #f5f6f7;
}
.dashboard-heading {
  max-width: 1180px;
  margin: 0 auto 18px;
}
.eyebrow {
  margin: 0 0 8px;
  color: #757982;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .18em;
}
.dashboard-heading h1 { margin: 0 0 6px; font-size: 28px; }
.dashboard-heading p:not(.eyebrow) { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.4; }
.primary-button {
  border: 1px solid #000;
  border-radius: 4px;
  padding: 12px 16px;
  color: #fff;
  background: #000;
  font-weight: 700;
}
.primary-button:hover { background: #232323; }
.secondary-button {
  border: 1px solid #c8cbd0;
  border-radius: 4px;
  padding: 10px 14px;
  background: #fff;
  font-weight: 700;
}
.dashboard-grid {
  max-width: 1180px;
  margin: 0 auto;
}

.template-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}
.project-card {
  overflow: hidden;
  border: 1px solid #dedfe2;
  border-radius: 6px;
  background: #fff;
  box-shadow: 0 5px 16px rgba(0, 0, 0, .06);
}
.project-card {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  min-height: 190px;
}
.project-preview {
  min-height: 190px;
  background: #111;
}
.project-preview img { width: 100%; height: 100%; object-fit: cover; display: block; }
.project-card-body {
  display: flex;
  min-width: 0;
  flex-direction: column;
  padding: 18px;
}
.project-label {
  margin: 0 0 7px;
  color: #777;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .14em;
}
.project-card h2 {
  margin: 0 0 7px;
  font-size: 19px;
}
.project-card-body > p:not(.project-label) {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}
.project-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid #eee;
  color: #777;
  font-size: 10px;
}

.editor-view {
  display: grid;
  grid-template-columns: 190px minmax(400px, 1fr) 400px;
  min-height: 0;
  background: #e8e9eb;
}
.slides-panel {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  border-right: 1px solid #d5d6d8;
  background: #fff;
}
.slides-panel-header, .editor-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 74px;
  padding: 15px 16px;
  border-bottom: 1px solid #e4e4e4;
}
.square-button {
  width: 34px;
  height: 34px;
  border: 1px solid #d4d5d7;
  border-radius: 4px;
  background: #fff;
  font-size: 20px;
}
.slide-list {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 12px;
}
.slide-item {
  width: 100%;
  margin-bottom: 10px;
  padding: 8px;
  border: 1px solid #d8dade;
  border-radius: 4px;
  background: #fff;
  text-align: left;
}
.slide-item.active {
  border-color: #111;
  outline: 2px solid #111;
}
.slide-thumb {
  position: relative;
  overflow: hidden;
  aspect-ratio: var(--canvas-ratio);
  margin-bottom: 8px;
  background:
    linear-gradient(to bottom, #c8c8c8 0 58%, #090909 58% 100%);
}
.slide-thumb::after {
  content: "";
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: 12px;
  height: 22%;
  background: repeating-linear-gradient(to bottom, #fff 0 4px, transparent 4px 9px);
  opacity: .85;
}
.slide-index {
  display: flex;
  justify-content: space-between;
  gap: 6px;
  font-size: 11px;
}
.slide-index strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.slide-index span { color: #777; text-transform: uppercase; }
.slide-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 12px; border-top: 1px solid #e4e4e4; }
.slide-actions button, .toolbar-group button, .button-row button, .export-grid button, .inline-control button {
  min-height: 34px;
  border: 1px solid #cfd1d4;
  border-radius: 4px;
  background: #fff;
}
.slide-actions button:hover, .toolbar-group button:hover, .button-row button:hover, .export-grid button:hover { background: #f4f4f4; }

.workspace {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.workspace-toolbar {
  min-height: 54px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 14px;
  border-bottom: 1px solid #d1d2d4;
  background: #f6f6f7;
}
.toolbar-group { display: flex; align-items: center; gap: 7px; }
.toolbar-group button { padding: 7px 10px; font-size: 12px; }
.toolbar-group span { min-width: 126px; text-align: center; font-size: 12px; color: #666; white-space: nowrap; }
.danger-text { color: var(--danger); }
.canvas-scroller {
  flex: 1;
  min-height: 0;
  overflow: auto;
  display: block;
  padding: 34px;
  background:
    linear-gradient(45deg, #dedfe1 25%, transparent 25%),
    linear-gradient(-45deg, #dedfe1 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #dedfe1 75%),
    linear-gradient(-45deg, transparent 75%, #dedfe1 75%);
  background-size: 24px 24px;
  background-position: 0 0, 0 12px, 12px -12px, -12px 0;
}
.canvas-wrap {
  width: 540px;
  height: 675px;
  margin: 0 auto;
  flex: 0 0 auto;
  box-shadow: 0 15px 45px rgba(0,0,0,.22);
  background: #fff;
}
#designCanvas {
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
}
.canvas-help {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  min-height: 38px;
  padding: 10px 16px;
  border-top: 1px solid #d1d2d4;
  background: #f6f6f7;
  color: #686c73;
  font-size: 11px;
}

.editor-panel {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  border-left: 1px solid #d5d6d8;
  border-left: 1px solid #d5d6d8;
  background: #fff;
}
.editor-panel.collapsed {
  width: 48px;
}
.editor-panel.collapsed .editor-scroll,
.editor-panel.collapsed .editor-panel-header > div { display: none; }
.editor-panel-header h2 { margin: 0; font-size: 16px; }
.editor-scroll { min-height: 0; overflow: auto; padding-bottom: 40px; }
.control-section { padding: 18px 20px; border-bottom: 1px solid #e7e7e7; }
.control-section h3 { margin: 0 0 14px; font-size: 13px; }
.field { display: grid; gap: 7px; margin-bottom: 13px; color: #42464d; font-size: 12px; }
.field > span { font-weight: 700; }
.field input, .field textarea, .field select, .inline-control input {
  width: 100%;
  border: 1px solid #cfd1d4;
  border-radius: 4px;
  padding: 9px 10px;
  color: #151515;
  background: #fff;
}
.field textarea { resize: vertical; line-height: 1.4; }
.field small, .helper-copy { color: #777c84; font-size: 11px; line-height: 1.45; }
.two-column { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.inline-control { display: grid; grid-template-columns: 1fr auto; gap: 7px; }
.inline-control button { padding: 0 12px; }
.image-source-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.image-source-grid .upload-box { min-height: 96px; }
.clipboard-button { width: 100%; font: inherit; }

.format-toolbar {
  display: flex;
  gap: 8px;
  margin-top: -2px;
  margin-bottom: 8px;
}
.format-button {
  min-width: 38px;
  height: 32px;
  border: 1px solid #cfd1d4;
  border-radius: 4px;
  background: #fff;
  color: #111;
  font-size: 14px;
  line-height: 1;
}
.format-button:hover { background: #f4f4f4; }
.format-button:active { transform: translateY(1px); }
body.panel-dark .format-button {
  color: #eee;
  border-color: #414141;
  background: #242424;
}

.toggle-row {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: -2px 0 14px;
  color: #42464d;
  font-size: 12px;
  cursor: pointer;
}
.toggle-row input { width: 16px; height: 16px; accent-color: #111; }
.toggle-row input:disabled + span { color: #a1a4aa; }
.author-control { margin-top: 4px; padding: 12px; border: 1px solid #e1e2e4; border-radius: 5px; background: #fafafa; }
.author-toggle-row { margin-top: 0; font-weight: 700; }
.font-status-card { padding: 14px; border: 1px solid #d9dadd; border-radius: 5px; background: #fafafa; }
.font-status-card > strong { display: block; margin-bottom: 10px; font-size: 12px; }
.font-chips { display: flex; flex-wrap: wrap; gap: 7px; }
.font-chips span { padding: 6px 9px; border: 1px solid #d7d8db; border-radius: 999px; background: #fff; font-size: 11px; }
.upload-box {
  display: grid;
  place-items: center;
  min-height: 88px;
  margin-bottom: 14px;
  padding: 14px;
  border: 1px dashed #aeb1b6;
  border-radius: 5px;
  color: #222;
  background: #fafafa;
  text-align: center;
  cursor: pointer;
}
.upload-box small { margin-top: 4px; color: #777; }
.upload-box.compact { min-height: 66px; }
.button-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.button-row.three-buttons { grid-template-columns: 1fr 1fr 1fr; }
.export-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.export-grid button { padding: 9px; font-size: 12px; }
.export-grid .primary-button {
  color: #fff;
  background: #000;
  border-color: #000;
}
.export-grid .primary-button:hover {
  background: #232323;
}

.toast {
  position: fixed;
  z-index: 999;
  right: 22px;
  bottom: 22px;
  max-width: 360px;
  padding: 12px 16px;
  border-radius: 5px;
  color: #fff;
  background: #111;
  box-shadow: var(--shadow);
  font-size: 13px;
  opacity: 0;
  transform: translateY(14px);
  pointer-events: none;
  transition: .2s ease;
}
.toast.show { opacity: 1; transform: translateY(0); }

body.panel-dark .editor-panel,
body.panel-dark .slides-panel { color: #eee; background: #151515; }
body.panel-dark .control-section,
body.panel-dark .editor-panel-header,
body.panel-dark .slides-panel-header,
body.panel-dark .slide-actions { border-color: #303030; }
body.panel-dark .field { color: #ddd; }
body.panel-dark .field input,
body.panel-dark .field textarea,
body.panel-dark .field select,
body.panel-dark .slide-item,
body.panel-dark .square-button,
body.panel-dark .button-row button,
body.panel-dark .export-grid button,
body.panel-dark .slide-actions button { color: #eee; border-color: #414141; background: #242424; }

@media (max-width: 1180px) {
  .editor-view { grid-template-columns: 150px minmax(360px, 1fr) 340px; }
  .dashboard-grid { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  body { overflow: auto; }
  .app-shell { height: auto; }
  .view { height: auto; min-height: calc(100vh - var(--header-h)); }
  .editor-view { display: block; }
  .slides-panel, .editor-panel { border: 0; }
  .slides-panel { min-height: 240px; }
  .slide-list { display: flex; gap: 10px; overflow-x: auto; }
  .slide-item { min-width: 130px; }
  .workspace { height: 760px; }
  .dashboard-view { padding: 28px 18px; }
  .dashboard-heading { align-items: flex-start; flex-direction: column; }
  .project-card { grid-template-columns: 1fr; }
  .project-preview { max-height: 440px; }
  .editor-panel { min-height: 700px; }
}

body.panel-dark 
.format-toolbar {
  display: flex;
  gap: 8px;
  margin-top: -2px;
  margin-bottom: 8px;
}
.format-button {
  min-width: 38px;
  height: 32px;
  border: 1px solid #cfd1d4;
  border-radius: 4px;
  background: #fff;
  color: #111;
  font-size: 14px;
  line-height: 1;
}
.format-button:hover { background: #f4f4f4; }
.format-button:active { transform: translateY(1px); }
body.panel-dark .format-button {
  color: #eee;
  border-color: #414141;
  background: #242424;
}

.toggle-row { color: #ddd; }
body.panel-dark .author-control,
body.panel-dark .font-status-card { border-color: #3d3d3d; background: #202020; }
body.panel-dark .font-chips span { border-color: #444; background: #292929; }


.range-number-control {
  display: grid;
  gap: 8px;
}

.range-slider-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
}

.number-range {
  width: 100%;
  min-width: 0;
  accent-color: #111111;
  cursor: pointer;
}

.range-value {
  min-width: 46px;
  padding: 3px 7px;
  border: 1px solid #d7d9dc;
  border-radius: 4px;
  color: #555a61;
  background: #f7f7f8;
  font-size: 10px;
  text-align: center;
}

body.panel-dark .number-range {
  accent-color: #ffffff;
}

body.panel-dark .range-value {
  color: #eeeeee;
  border-color: #414141;
  background: #242424;
}


.rich-text-editor {
  width: 100%;
  min-height: 92px;
  overflow: auto;
  border: 1px solid #cfd1d4;
  border-radius: 4px;
  padding: 9px 10px;
  color: #151515;
  background: #ffffff;
  font-family: "Union", Arial, Helvetica, sans-serif;
  font-size: 14px;
  line-height: 1.4;
  white-space: pre-wrap;
  word-break: break-word;
}
.rich-text-editor.rich-bold-base { font-weight: 700; }
.rich-text-editor.rich-editor-tall { min-height: 122px; }
.rich-text-editor.rich-editor-body { min-height: 220px; font-weight: 400; }
.rich-text-editor:empty::before {
  content: attr(data-placeholder);
  color: #9a9da3;
  font-weight: 400;
  font-style: normal;
  pointer-events: none;
}
.rich-text-editor:focus { outline: 2px solid rgba(17,17,17,.12); border-color: #111; }
.format-button.active { color: #fff; border-color: #111; background: #111; }
.partner-logo-preview {
  display: grid;
  place-items: center;
  min-height: 110px;
  margin-bottom: 14px;
  padding: 12px;
  border: 1px solid #e0e1e3;
  border-radius: 5px;
  background:
    linear-gradient(45deg, #f0f0f0 25%, transparent 25%),
    linear-gradient(-45deg, #f0f0f0 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #f0f0f0 75%),
    linear-gradient(-45deg, transparent 75%, #f0f0f0 75%), #fff;
  background-size: 16px 16px;
  background-position: 0 0, 0 8px, 8px -8px, -8px 0;
  color: #777b82;
  font-size: 11px;
  text-align: center;
}
.partner-logo-preview img { display:block; max-width:150px; max-height:90px; object-fit:contain; }
.full-width-button { width:100%; min-height:36px; border:1px solid #cfd1d4; border-radius:4px; background:#fff; }
.full-width-button:hover { background:#f4f4f4; }
body.panel-dark .rich-text-editor { color:#eee; border-color:#414141; background:#242424; }
body.panel-dark .rich-text-editor:focus { border-color:#eee; outline-color:rgba(255,255,255,.15); }
body.panel-dark .partner-logo-preview { color:#b8bbc0; border-color:#414141; background-color:#242424; }
body.panel-dark .full-width-button { color:#eee; border-color:#414141; background:#242424; }

#canvasFormatInput { font-weight: 700; }


.vertical-template {
  grid-template-columns: 240px 1fr;
  min-height: 360px;
}

.vertical-template .project-preview {
  min-height: 360px;
  background: #111111;
}

.vertical-template .project-preview img {
  object-fit: contain;
}

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

  .vertical-template .project-preview {
    min-height: 440px;
  }
}


.logo-placer-preview {
  background: #eeeeee;
}

.logo-placer-preview img {
  object-fit: contain;
}

body.logo-placer-mode .editor-view {
  grid-template-columns: minmax(400px, 1fr) 400px;
}

body.logo-placer-mode .slides-panel {
  display: none;
}

body.logo-placer-mode .workspace-toolbar .toolbar-group:first-child {
  visibility: hidden;
  pointer-events: none;
}

body.logo-placer-mode #slideSettingsSection,
body.logo-placer-mode #coverControls,
body.logo-placer-mode #contentControls,
body.logo-placer-mode #typographySection {
  display: none !important;
}

body.logo-placer-mode #partnerLogoToggleRow {
  display: none;
}

body.logo-placer-mode #partnerLogoControls {
  display: block !important;
}

body.logo-placer-mode #partnerLogoSection {
  border-top: 0;
}

body.logo-placer-mode .partner-logo-preview {
  min-height: 120px;
}


body.logo-placer-mode #photoSection {
  display: block !important;
}


.dashboard-view .vertical-template,
.dashboard-view .logo-placer-card {
  grid-template-columns: 150px minmax(0, 1fr);
  min-height: 190px;
}

.dashboard-view .vertical-template .project-preview,
.dashboard-view .logo-placer-card .project-preview {
  min-height: 190px;
  max-height: 190px;
}

.dashboard-view .vertical-template .project-preview img,
.dashboard-view .logo-placer-card .project-preview img {
  object-fit: contain;
}

.dashboard-view .secondary-button {
  padding: 7px 11px;
  font-size: 11px;
}

@media (max-width: 980px) {
  .template-list {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 620px) {
  .dashboard-view {
    padding: 22px 14px 32px;
  }

  .project-card,
  .dashboard-view .vertical-template,
  .dashboard-view .logo-placer-card {
    grid-template-columns: 120px minmax(0, 1fr);
    min-height: 170px;
  }

  .project-preview,
  .dashboard-view .vertical-template .project-preview,
  .dashboard-view .logo-placer-card .project-preview {
    min-height: 170px;
    max-height: 170px;
  }

  .project-card-body {
    padding: 14px;
  }
}
