:root {
  color-scheme: light;
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  color: #0b2142;
  background: #e9eef5;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 12% 0%, rgba(206, 159, 47, 0.12), transparent 25%),
    linear-gradient(145deg, #f7f9fc 0%, #e7edf5 100%);
}

.app-shell {
  width: min(1500px, calc(100% - 36px));
  margin: 30px auto;
  display: grid;
  gap: 22px;
}

.control-card,
.preview-card {
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(11, 33, 66, 0.1);
  border-radius: 18px;
  box-shadow: 0 20px 55px rgba(11, 33, 66, 0.1);
}

.control-card {
  padding: 24px;
  display: grid;
  grid-template-columns: auto minmax(240px, 0.8fr) minmax(420px, 1.4fr);
  gap: 18px 22px;
  align-items: center;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 62px;
  height: 62px;
  border: 2px solid #c39222;
  border-radius: 16px;
  background: #0b2142;
  color: #f1cf74;
  font-family: Georgia, serif;
  font-size: 23px;
  font-weight: 700;
  box-shadow: inset 0 0 0 4px #0b2142, inset 0 0 0 5px rgba(241, 207, 116, 0.35);
}

.eyebrow {
  margin: 0 0 4px;
  color: #a6720d;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

h1 { margin: 0; font-size: clamp(27px, 3vw, 38px); letter-spacing: -0.035em; }
.control-copy > p:last-child { margin: 6px 0 0; color: #647186; }

form { min-width: 0; }
label { display: block; margin-bottom: 7px; font-size: 14px; font-weight: 750; }
.form-row, .actions { display: flex; gap: 10px; }

.certificate-id-input {
  display: flex;
  align-items: center;
  min-width: 250px;
  border: 1px solid #aebaca;
  border-radius: 10px;
  background: #fbfcfe;
  overflow: hidden;
  transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.certificate-id-input:focus-within {
  border-color: #b17d13;
  background: #fff;
  box-shadow: 0 0 0 4px rgba(177, 125, 19, 0.13);
}

.certificate-prefix {
  align-self: stretch;
  display: flex;
  align-items: center;
  padding: 0 12px 0 14px;
  border-right: 1px solid rgba(174, 186, 202, 0.9);
  background: rgba(221, 193, 122, 0.18);
  color: #8e6711;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.1em;
}

.certificate-id-input input {
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.certificate-id-input input:focus {
  border-color: transparent;
  background: transparent;
  box-shadow: none;
}

input {
  min-width: 0;
  flex: 1;
  padding: 13px 15px;
  border: 1px solid #aebaca;
  border-radius: 10px;
  color: #0b2142;
  background: #fbfcfe;
  font: inherit;
  font-size: 17px;
  outline: none;
  transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

input:focus {
  border-color: #b17d13;
  background: #fff;
  box-shadow: 0 0 0 4px rgba(177, 125, 19, 0.13);
}

button {
  border: 0;
  border-radius: 10px;
  padding: 13px 19px;
  background: #0b2142;
  color: white;
  font: inherit;
  font-weight: 750;
  cursor: pointer;
  transition: transform 150ms ease, background 150ms ease, opacity 150ms ease;
}

button:hover:not(:disabled) { background: #173b68; transform: translateY(-1px); }
button:disabled { cursor: not-allowed; opacity: 0.42; }
button.secondary { color: #0b2142; background: #e6ebf2; }
button.secondary:hover:not(:disabled) { background: #d8e0ea; }

.form-note, .status {
  margin: 7px 0 0;
  color: #738096;
  font-size: 12px;
}

.actions { grid-column: 2 / 3; }
.status { grid-column: 3 / 4; margin: 0; text-align: right; }
.status.ready { color: #21734b; font-weight: 700; }

.preview-card { padding: 12px; overflow: auto; }
.preview-heading {
  display: flex;
  justify-content: space-between;
  padding: 2px 4px 11px;
  color: #536176;
  font-size: 13px;
  font-weight: 700;
}
.preview-size { color: #8792a3; font-weight: 500; }

canvas {
  display: block;
  width: 100%;
  min-width: 800px;
  height: auto;
  background: white;
  border-radius: 9px;
  box-shadow: 0 8px 24px rgba(11, 33, 66, 0.08);
}

@media (max-width: 1000px) {
  .control-card { grid-template-columns: auto 1fr; }
  form, .actions, .status { grid-column: 1 / -1; }
  .status { text-align: left; }
}

@media (max-width: 650px) {
  .control-card { grid-template-columns: 1fr; padding: 19px; }
  .brand-mark { width: 54px; height: 54px; }
  .form-row, .actions { flex-direction: column; }
  .app-shell { width: min(100% - 18px, 1500px); margin: 10px auto; }
}

html.embed-mode body,
body.embed-mode {
  background: #e9eef5;
}

html.embed-mode .app-shell,
body.embed-mode .app-shell {
  width: 100%;
  margin: 0;
}

html.embed-mode .control-card,
html.embed-mode .preview-heading,
body.embed-mode .control-card,
body.embed-mode .preview-heading {
  display: none;
}

html.embed-mode .preview-card,
body.embed-mode .preview-card {
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

html.embed-mode canvas,
body.embed-mode canvas {
  min-width: 0;
  border-radius: 0;
  box-shadow: none;
}

@media print {
  @page { size: landscape; margin: 0; }
  body { background: white; }
  .control-card, .preview-heading { display: none; }
  .app-shell, .preview-card { width: 100%; margin: 0; padding: 0; border: 0; box-shadow: none; }
  canvas { width: 100vw; min-width: 0; border-radius: 0; box-shadow: none; }
}
