:root {
  --ink: #12345b;
  --muted: #687891;
  --paper: #f4f8fd;
  --panel: #ffffff;
  --line: #d7e2f0;
  --moss: #ff7a32;
  --moss-soft: #fff0e7;
  --blue: #2468b2;
  --orange: #ff7a32;
  --shadow: 0 24px 70px rgba(24, 75, 132, 0.11);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 10% 4%, rgba(255, 122, 50, 0.16), transparent 26rem),
    radial-gradient(circle at 92% 22%, rgba(36, 104, 178, 0.12), transparent 30rem),
    var(--paper);
  font-family: system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

button,
input,
select {
  font: inherit;
}

button {
  color: inherit;
}

button,
select,
input[type="range"],
input[type="color"] {
  cursor: pointer;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
canvas:focus-visible {
  outline: 3px solid rgba(99, 127, 180, 0.3);
  outline-offset: 3px;
}

.page-shell {
  width: min(1440px, 100%);
  min-height: 100vh;
  margin: 0 auto;
  padding: 0 42px;
}

.topbar {
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}

.brand {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  color: inherit;
  font-size: 0.88rem;
  font-weight: 700;
  text-decoration: none;
  letter-spacing: -0.03em;
}

.brand-mark {
  position: relative;
  width: 22px;
  height: 22px;
  display: block;
  transform: rotate(-7deg);
}

.brand-mark i {
  position: absolute;
  inset: 2px 8px 7px 4px;
  display: block;
  border: 2px solid var(--ink);
  border-radius: 50% 50% 4px 50%;
}

.brand-mark i:last-child {
  inset: 8px 2px 1px 10px;
  background: var(--moss);
}

.topbar-note {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-family: ui-monospace, monospace;
  font-size: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.privacy-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--blue);
  box-shadow: 0 0 0 4px rgba(36, 104, 178, 0.13);
}

.hero {
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 430px);
  align-items: center;
  gap: 34px;
  padding: 22px 0 24px;
}

.kicker {
  margin: 0 0 7px;
  color: #e86625;
  font-family: ui-monospace, monospace;
  font-size: 0.58rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.hero h1 {
  max-width: 820px;
  margin: 0;
  font-size: clamp(1.55rem, 3vw, 2.55rem);
  line-height: 1.05;
  letter-spacing: -0.05em;
}

.hero h1 em {
  color: #e86625;
  font-family: serif;
  font-weight: 600;
}

.hero-copy {
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.5;
}

.workflow-grid {
  display: grid;
  grid-template-columns: minmax(420px, 0.82fr) minmax(540px, 1.18fr);
  gap: 20px;
  align-items: start;
}

.setup-column {
  display: grid;
  gap: 16px;
  min-width: 0;
}

.panel,
.preview-card {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.94);
}

.panel {
  padding: 22px;
}

.panel-heading {
  display: grid;
  grid-template-columns: 35px 1fr auto;
  gap: 12px;
  align-items: start;
}

.panel-heading h2,
.preview-head h2,
.results-heading h2,
.modal h2 {
  margin: 0;
  font-size: 1.14rem;
  letter-spacing: -0.035em;
}

.panel-heading p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 0.78rem;
}

.step-number,
.dimension-label,
.file-type,
.status-pill {
  font-family: ui-monospace, monospace;
}

.step-number {
  padding-top: 2px;
  color: var(--blue);
  font-size: 0.75rem;
}

.status-pill {
  padding: 6px 9px;
  border: 1px solid #d5e0ec;
  border-radius: 999px;
  color: #718097;
  background: #f1f5fa;
  font-size: 0.59rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.status-pill.ready {
  border-color: #b8d0ed;
  color: #1d5a9b;
  background: #eaf3ff;
}

.dropzone {
  width: 100%;
  min-height: 92px;
  margin-top: 18px;
  padding: 17px 19px;
  display: flex;
  align-items: center;
  gap: 15px;
  text-align: left;
  border: 1px dashed #b9cce0;
  border-radius: 13px;
  background: #f8fbff;
  transition: 160ms ease;
}

.dropzone:hover,
.dropzone.dragging {
  border-color: var(--orange);
  background: #fff6f0;
  transform: translateY(-1px);
}

.upload-icon {
  width: 44px;
  height: 44px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 11px;
  background: var(--moss-soft);
  font-size: 1.4rem;
}

.upload-icon.sheet {
  background: #eaf2fd;
  color: var(--blue);
}

.dropzone strong,
.dropzone small {
  display: block;
}

.dropzone strong {
  font-size: 0.83rem;
  font-weight: 700;
}

.dropzone small {
  margin-top: 5px;
  color: var(--muted);
  font-size: 0.69rem;
}

.file-row {
  min-height: 66px;
  margin-top: 17px;
  padding: 11px 2px 0;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 12px;
  border-top: 1px solid var(--line);
}

.file-row:not([hidden]) {
  display: grid;
}

.file-row strong,
.file-row small {
  display: block;
}

.file-row strong {
  max-width: 240px;
  overflow: hidden;
  font-size: 0.76rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-row small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.66rem;
}

.file-type {
  padding: 7px 8px;
  border-radius: 5px;
  color: #a34216;
  background: var(--moss-soft);
  font-size: 0.54rem;
}

.text-button,
.inline-link,
.soft-button,
.icon-button {
  border: 0;
  background: transparent;
}

.text-button,
.inline-link {
  padding: 5px;
  color: var(--blue);
  font-size: 0.68rem;
  font-weight: 700;
}

.inline-link {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.format-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-top: 12px;
  color: #728198;
  font-size: 0.64rem;
}

.format-row b {
  color: var(--blue);
}

.field-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  margin-top: 19px;
  padding: 4px;
  border-radius: 10px;
  background: #edf2f8;
}

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

.field-tab {
  padding: 9px 10px;
  border: 0;
  border-radius: 7px;
  color: var(--muted);
  background: transparent;
  font-size: 0.72rem;
  font-weight: 700;
}

.field-tab.active {
  color: var(--ink);
  background: var(--panel);
  box-shadow: 0 2px 8px rgba(28, 76, 130, 0.08);
}

.control-grid,
.typography-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-top: 16px;
}

.control-grid label,
.typography-grid label,
.edit-modal form label {
  display: grid;
  gap: 7px;
}

.control-grid label > span:first-child,
.typography-grid label > span:first-child,
.text-content-field > span,
.edit-modal form label > span {
  color: #5e6f86;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

select,
input[type="text"],
input[type="search"],
input[type="password"],
textarea {
  width: 100%;
  border: 1px solid #d8dbd2;
  border-radius: 9px;
  color: var(--ink);
  background: #fff;
}

select,
input[type="text"],
input[type="password"] {
  height: 39px;
  padding: 0 10px;
  font-size: 0.74rem;
}

textarea {
  min-height: 62px;
  padding: 10px;
  resize: vertical;
  font-size: 0.74rem;
  line-height: 1.45;
}

.api-setup {
  margin-top: 18px;
  padding: 14px;
  border: 1px solid #f0c4a9;
  border-radius: 11px;
  background: #fff7f1;
}

.api-setup > label {
  display: block;
  margin-bottom: 7px;
  color: #9c471e;
  font-size: 0.65rem;
  font-weight: 700;
}

.api-key-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 7px;
}

.api-key-row input {
  min-width: 0;
  height: 42px;
  padding: 0 10px;
}

.api-setup p {
  margin: 9px 0 0;
  color: #806f66;
  font-size: 0.59rem;
  line-height: 1.5;
}

.api-setup code {
  padding: 2px 4px;
  border-radius: 4px;
  color: #8d3c17;
  background: #ffe9dc;
  overflow-wrap: anywhere;
}

.font-loading {
  min-height: 88px;
  margin-top: 16px;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border-radius: 11px;
  color: var(--blue);
  background: #f1f7ff;
  font-size: 0.7rem;
  font-weight: 700;
}

.font-loading:not([hidden]) {
  display: flex;
}

.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid #c5d9ef;
  border-top-color: var(--orange);
  border-radius: 50%;
  animation: spin 700ms linear infinite;
}

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

.font-error {
  margin-top: 14px;
  padding: 11px 12px;
  border: 1px solid #f2c3ae;
  border-radius: 9px;
  color: #994523;
  background: #fff2eb;
  font-size: 0.66rem;
  line-height: 1.5;
}

.font-browser {
  margin-top: 17px;
}

.font-search {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 11px;
  border: 1px solid #cbd9e8;
  border-radius: 9px;
  background: #fff;
}

.font-search input {
  height: 42px;
  padding: 0;
  border: 0;
}

.font-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.font-filters button {
  padding: 7px 9px;
  border: 1px solid #d4e0ec;
  border-radius: 999px;
  color: #63758d;
  background: #f7faff;
  font-size: 0.58rem;
  font-weight: 700;
}

.font-filters button.active {
  border-color: var(--blue);
  color: #fff;
  background: var(--blue);
}

.font-results-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin: 14px 1px 8px;
  color: var(--muted);
  font-size: 0.58rem;
}

.font-results-meta span:first-child {
  color: var(--ink);
  font-weight: 700;
}

.font-list {
  max-height: 380px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
  overflow-y: auto;
  padding: 2px 3px 2px 1px;
}

.font-item {
  min-width: 0;
  min-height: 67px;
  padding: 9px 10px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  gap: 5px;
  border: 1px solid #d8e2ed;
  border-radius: 9px;
  background: #fff;
  text-align: left;
}

.font-item:hover,
.font-item.selected {
  border-color: var(--orange);
  background: #fff8f3;
}

.font-item strong {
  width: 100%;
  overflow: hidden;
  font-size: 1rem;
  font-weight: 400;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.font-item small {
  color: #7c8a9e;
  font-family: system-ui, sans-serif;
  font-size: 0.52rem;
  text-transform: capitalize;
}

.load-more-fonts {
  width: 100%;
  margin-top: 9px;
}

.text-content-field {
  display: grid;
  gap: 7px;
  margin-top: 15px;
}

.text-content-field > small {
  color: var(--muted);
  font-size: 0.58rem;
}

.active-font-card {
  margin-top: 14px;
  padding: 12px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 3px 12px;
  align-items: center;
  border: 1px solid #d5e2f0;
  border-radius: 10px;
  background: linear-gradient(135deg, #eff6ff, #fff6f0);
}

.active-font-card > span {
  color: var(--muted);
  font-size: 0.56rem;
}

.active-font-card strong {
  grid-column: 1;
  overflow: hidden;
  font-size: 0.95rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.active-font-card button {
  grid-column: 2;
  grid-row: 1 / span 2;
}

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

.format-toggles {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 7px;
  margin-top: 15px;
}

.format-toggles button {
  min-height: 39px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 1px solid #d4e0ec;
  border-radius: 8px;
  color: #5d6f86;
  background: #f8fbff;
  font-size: 0.64rem;
}

.format-toggles button[aria-pressed="true"] {
  border-color: var(--blue);
  color: #fff;
  background: var(--blue);
}

input[type="range"] {
  width: 100%;
  height: 4px;
  margin-top: 12px;
  accent-color: var(--orange);
}

.color-control {
  height: 39px;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 4px 8px;
  border: 1px solid #d8dbd2;
  border-radius: 9px;
  background: #fff;
}

.color-control input[type="color"] {
  width: 24px;
  height: 24px;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
}

.color-control input[type="text"] {
  height: auto;
  padding: 0;
  border: 0;
}

.style-actions {
  display: flex;
  gap: 8px;
  margin-top: 16px;
}

.alignment-panel {
  display: grid;
  gap: 11px;
  margin-top: 17px;
  padding: 14px;
  border: 1px solid #d7e3f1;
  border-radius: 11px;
  background: linear-gradient(135deg, #eef5ff, #fff5ee);
}

.alignment-panel strong,
.alignment-panel small {
  display: block;
}

.alignment-panel strong {
  color: var(--ink);
  font-size: 0.7rem;
}

.alignment-panel small {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.62rem;
}

.alignment-buttons {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
}

.alignment-buttons .soft-button:first-child {
  border-color: #bad1eb;
  color: #1f5c9e;
  background: #f1f7ff;
}

.alignment-buttons .soft-button:last-child {
  border-color: #f2c4aa;
  color: #ae4c1c;
  background: #fff6f0;
}

.soft-button {
  padding: 9px 12px;
  border: 1px solid #d5e0ec;
  border-radius: 8px;
  color: #536982;
  background: #f5f8fc;
  font-size: 0.68rem;
  font-weight: 700;
}

.soft-button:hover {
  background: #eaf1f8;
}

.preview-column {
  position: sticky;
  top: 18px;
  width: 100%;
  min-width: 0;
}

.preview-card {
  width: 100%;
  min-width: 0;
  overflow: hidden;
  padding: 25px;
  box-shadow: var(--shadow);
}

.preview-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.preview-head .kicker {
  margin-bottom: 6px;
}

.dimension-label {
  color: #838a82;
  font-size: 0.61rem;
}

.canvas-stage {
  position: relative;
  width: 100%;
  min-width: 0;
  height: clamp(320px, 38vw, 520px);
  min-height: 0;
  display: grid;
  place-items: center;
  overflow: hidden;
  padding: 12px;
  border-radius: 11px;
  background-color: #edf2f7;
  background-image:
    linear-gradient(45deg, #e2e9f1 25%, transparent 25%),
    linear-gradient(-45deg, #e2e9f1 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #e2e9f1 75%),
    linear-gradient(-45deg, transparent 75%, #e2e9f1 75%);
  background-position: 0 0, 0 8px, 8px -8px, -8px 0;
  background-size: 16px 16px;
}

#editorCanvas {
  display: none;
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  background: #fff;
  box-shadow: 0 14px 35px rgba(24, 40, 32, 0.15);
  touch-action: none;
}

.preview-empty {
  width: 100%;
  height: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #717971;
}

.preview-empty strong {
  margin-top: 17px;
  font-size: 0.8rem;
}

.preview-empty small {
  margin-top: 5px;
  font-size: 0.66rem;
}

.empty-sheet {
  position: relative;
  width: 76px;
  height: 54px;
  border: 1px solid #aeb4aa;
  border-radius: 3px;
  background: #f8f8f2;
  transform: rotate(-3deg);
  box-shadow: 9px 8px 0 #dfe2d9;
}

.empty-sheet::before,
.empty-sheet::after {
  content: "";
  position: absolute;
  left: 16px;
  right: 16px;
  height: 1px;
  background: #c6cbc2;
}

.empty-sheet::before {
  top: 19px;
}

.empty-sheet::after {
  top: 30px;
}

.canvas-help {
  min-height: 33px;
  display: flex;
  gap: 16px;
  align-items: flex-end;
  color: #7b837b;
  font-size: 0.63rem;
}

.help-dot {
  width: 7px;
  height: 7px;
  display: inline-block;
  margin-right: 4px;
  border-radius: 2px;
}

.help-dot.name {
  background: var(--blue);
}

.help-dot.date {
  background: var(--orange);
}

.drag-hint {
  margin-left: auto;
}

.generate-button {
  position: relative;
  width: 100%;
  min-height: 73px;
  margin-top: 12px;
  padding: 0 25px;
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: 18px;
  overflow: hidden;
  border: 0;
  border-radius: 14px;
  color: #fff;
  background: var(--ink);
  text-align: left;
  transition: transform 160ms ease, opacity 160ms ease;
}

.generate-button:not(:disabled):hover {
  transform: translateY(-2px);
}

.generate-button:disabled {
  cursor: not-allowed;
  opacity: 0.43;
}

.generate-button > span:first-child {
  font-size: 0.87rem;
  font-weight: 700;
}

.generate-button > span:nth-child(2) {
  color: #bdc6bd;
  font-family: ui-monospace, monospace;
  font-size: 0.58rem;
  text-transform: uppercase;
}

.generate-button i {
  font-size: 1.35rem;
  font-style: normal;
}

.results-section {
  padding: 90px 0 42px;
}

.results-heading {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 30px;
  margin-bottom: 22px;
}

.results-heading h2 {
  font-size: clamp(2rem, 3.6vw, 3.3rem);
}

.results-heading h2 span {
  color: #8b9683;
  font-family: ui-monospace, monospace;
  font-size: 0.85rem;
  vertical-align: top;
}

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

.search-box {
  min-width: 230px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
}

.search-box input {
  height: 40px;
  padding: 0;
  border: 0;
  cursor: text;
  font-size: 0.73rem;
}

.dark-button {
  min-height: 42px;
  padding: 0 15px;
  border: 0;
  border-radius: 9px;
  color: #fff;
  background: var(--ink);
  font-size: 0.69rem;
  font-weight: 700;
}

.dark-button span {
  margin-left: 8px;
  color: #b9c1b9;
  font-family: ui-monospace, monospace;
  font-size: 0.54rem;
}

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

.certificate-item {
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.96);
  transition: transform 160ms ease, box-shadow 160ms ease;
}

.certificate-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 35px rgba(24, 40, 32, 0.07);
}

.thumb-wrap {
  display: grid;
  min-height: 170px;
  place-items: center;
  overflow: hidden;
  border-radius: 8px;
  background: #e9f0f7;
}

.thumb-wrap canvas {
  max-width: 100%;
  max-height: 210px;
  box-shadow: 0 6px 15px rgba(24, 40, 32, 0.13);
}

.item-info {
  min-width: 0;
  padding: 14px 2px 11px;
}

.item-info strong,
.item-info span {
  display: block;
}

.item-info strong {
  overflow: hidden;
  font-size: 0.79rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.item-info span {
  margin-top: 4px;
  color: var(--muted);
  font-family: ui-monospace, monospace;
  font-size: 0.58rem;
}

.item-buttons {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

.item-buttons button {
  min-height: 34px;
  padding: 0 7px;
  border: 1px solid #daddd4;
  border-radius: 7px;
  background: #fafaf5;
  font-size: 0.61rem;
  font-weight: 700;
}

.item-buttons button:hover {
  background: #eef1e7;
}

.item-buttons button:last-child {
  border-color: var(--ink);
  color: #fff;
  background: var(--ink);
}

.no-results {
  padding: 60px 20px;
  color: var(--muted);
  text-align: center;
}

footer {
  min-height: 110px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.67rem;
}

footer > span {
  color: var(--ink);
  font-size: 0.85rem;
  font-weight: 700;
}

.toast {
  position: fixed;
  z-index: 50;
  right: 24px;
  bottom: 24px;
  max-width: min(380px, calc(100vw - 48px));
  padding: 13px 16px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 9px;
  color: #fff;
  background: var(--ink);
  box-shadow: 0 16px 40px rgba(24, 40, 32, 0.2);
  font-size: 0.72rem;
  opacity: 0;
  pointer-events: none;
  transform: translateY(12px);
  transition: 180ms ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.toast.error {
  background: #8d4532;
}

.modal {
  width: min(920px, calc(100vw - 36px));
  padding: 23px;
  border: 1px solid var(--line);
  border-radius: 17px;
  color: var(--ink);
  background: var(--panel);
  box-shadow: 0 35px 100px rgba(24, 40, 32, 0.25);
}

.modal::backdrop {
  background: rgba(11, 39, 72, 0.72);
  backdrop-filter: blur(5px);
}

.modal-head {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: flex-start;
  margin-bottom: 18px;
}

.modal-head .kicker {
  margin-bottom: 5px;
}

.icon-button {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: #eff0ea;
  font-size: 1.35rem;
  line-height: 1;
}

.modal-canvas-wrap {
  max-height: 68vh;
  display: grid;
  place-items: center;
  overflow: auto;
  padding: 14px;
  border-radius: 10px;
  background: #e9ebe4;
}

#viewCanvas {
  max-width: 100%;
  max-height: 65vh;
  box-shadow: 0 10px 30px rgba(24, 40, 32, 0.15);
}

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

.edit-modal {
  width: min(500px, calc(100vw - 36px));
}

.edit-modal form {
  display: grid;
  gap: 15px;
}

.edit-modal form input {
  height: 44px;
  cursor: text;
}

.edit-modal form p {
  margin: 0;
  color: var(--muted);
  font-size: 0.67rem;
}

@media (max-width: 1080px) {
  .page-shell {
    padding: 0 24px;
  }

  .workflow-grid {
    grid-template-columns: 1fr;
  }

  .preview-column {
    position: static;
  }

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

@media (max-width: 700px) {
  .page-shell {
    padding: 0 15px;
  }

  .topbar {
    height: 48px;
  }

  .topbar-note {
    font-size: 0.52rem;
  }

  .hero {
    min-height: 0;
    grid-template-columns: 1fr;
    gap: 10px;
    padding: 18px 0 20px;
  }

  .hero-copy {
    max-width: 520px;
    font-size: 0.72rem;
  }

  .workflow-grid {
    display: block;
  }

  .preview-column {
    margin-top: 16px;
  }

  .panel,
  .preview-card {
    padding: 18px;
  }

  .panel-heading {
    grid-template-columns: 28px 1fr;
  }

  .panel-heading .status-pill {
    display: none;
  }

  .control-grid,
  .typography-grid {
    grid-template-columns: 1fr;
  }

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

  .font-list {
    grid-template-columns: 1fr;
  }

  .api-key-row {
    grid-template-columns: 1fr;
  }

  .canvas-stage {
    height: 260px;
  }

  .preview-empty {
    height: 100%;
    min-height: 0;
  }

  .drag-hint {
    display: none;
  }

  .results-section {
    padding-top: 65px;
  }

  .results-heading,
  .results-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .search-box {
    min-width: 0;
  }

  .certificate-list {
    grid-template-columns: 1fr;
  }

  .thumb-wrap {
    min-height: 190px;
  }

  footer {
    align-items: flex-start;
    flex-direction: column;
    justify-content: center;
  }
}
