@font-face {
  font-family: "Open Sans Local";
  src: url("../fonts/open-sans-regular.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Open Sans Local";
  src: url("../fonts/open-sans-semibold.ttf") format("truetype");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Times New Roman MT";
  src: url("../fonts/times-new-roman.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Times New Roman MT";
  src: url("../fonts/times-new-roman-bold.ttf") format("truetype");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Times New Roman MT";
  src: url("../fonts/times-new-roman-italic.ttf") format("truetype");
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: "Times New Roman MT";
  src: url("../fonts/times-new-roman-bold-italic.ttf") format("truetype");
  font-weight: 700;
  font-style: italic;
  font-display: swap;
}
:root {
  --platinum-0: #fbfaf8;
  --platinum-1: #f3f1ed;
  --platinum-2: #ebe8e2;
  --graphite-950: #24252a;
  --graphite-900: #2c2d32;
  --graphite-700: #4d4d52;
  --ink: #343238;
  --muted: #858078;
  --gold: #b18a51;
  --gold-dark: #8b6939;
  --gold-soft: #e9dcc3;
  --line: #d8d3ca;
  --shadow: 0 20px 50px rgba(44, 39, 31, .11);
  --shadow-sm: 0 8px 20px rgba(44, 39, 31, .09);
  --radius: 8px;
}
* { box-sizing: border-box; }
html, body { min-height: 100%; margin: 0; }
body {
  background: var(--platinum-1);
  color: var(--ink);
  font-family: "Open Sans Local", "Helvetica Neue", sans-serif;
}
button, input { font: inherit; }
button { cursor: pointer; }
button:focus-visible, input:focus-visible, label:focus-within { outline: 2px solid var(--gold); outline-offset: 2px; }
.app-shell { min-height: 100vh; background: linear-gradient(135deg, #f5f3ef 0%, #faf9f7 48%, #ece9e3 100%); }
.topbar {
  height: 70px;
  padding: 0 30px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: #f6f4ef;
  background: var(--graphite-950);
  border-bottom: 1px solid rgba(233, 220, 195, .22);
}
.brand-lockup, .brand-lockup > div, .topbar-meta, .toolbar-actions, .preview-status, .section-label-row, .sidebar-heading { display: flex; align-items: center; }
.brand-lockup { gap: 12px; }
.brand-lockup > div { flex-direction: column; align-items: flex-start; gap: 2px; }
.brand-mark {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(233, 220, 195, .74);
  color: var(--gold-soft);
  font-family: Georgia, serif;
  font-size: 20px;
  font-weight: 700;
}
.brand-lockup strong { color: #fffdf8; font-size: 16px; letter-spacing: .2em; }
.brand-lockup span:not(.brand-mark) { color: #bcb6aa; font-size: 11px; letter-spacing: .02em; }
.topbar-meta { gap: 10px; color: #bcb6aa; font-size: 11px; }
.connection-dot { width: 7px; height: 7px; border-radius: 50%; background: #8fd1a3; box-shadow: 0 0 0 4px rgba(143, 209, 163, .14); }
.topbar-divider { width: 1px; height: 13px; background: rgba(233, 220, 195, .28); }
.workspace {
  width: min(1580px, calc(100% - 40px));
  min-height: calc(100vh - 94px);
  margin: 12px auto 20px;
  display: grid;
  grid-template-columns: 250px minmax(480px, 1fr) 322px;
  gap: 14px;
}
.sidebar, .preview-area {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 254, 252, .92);
  box-shadow: var(--shadow);
}
.sidebar { padding: 19px 16px; display: flex; flex-direction: column; min-height: 0; }
.left-sidebar { border-top: 3px solid var(--gold); }
.inspector-sidebar { border-top: 3px solid var(--graphite-700); }
.sidebar-heading { justify-content: space-between; gap: 12px; }
.sidebar-heading h1, .sidebar-heading h2 { margin: 5px 0 0; color: var(--graphite-950); font-size: 23px; letter-spacing: -.04em; }
.sidebar-heading h2 { font-size: 19px; }
.eyebrow { display: block; color: var(--gold-dark); font-size: 10px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; }
.count-badge, .live-chip { display: inline-grid; place-items: center; min-width: 29px; height: 24px; padding: 0 7px; border: 1px solid #ceb98f; border-radius: 4px; color: var(--gold-dark); font-size: 11px; font-weight: 600; }
.live-chip { border-color: #b9b6b0; color: var(--graphite-700); letter-spacing: .08em; }
.library-metrics { margin-top: 18px; display: grid; grid-template-columns: 1fr 1fr; border: 1px solid var(--line); background: var(--platinum-1); }
.library-metrics div { padding: 10px 9px; display: flex; flex-direction: column; gap: 4px; }
.library-metrics div + div { border-left: 1px solid var(--line); }
.library-metrics span { color: var(--muted); font-size: 9px; letter-spacing: .1em; text-transform: uppercase; }
.library-metrics strong { color: var(--graphite-900); font-size: 11px; font-weight: 600; }
.sidebar-section { margin-top: 20px; }
.section-label-row { justify-content: space-between; gap: 10px; color: var(--graphite-900); font-size: 12px; font-weight: 600; }
.section-label-row small { color: var(--muted); font-size: 10px; font-weight: 400; }
.language-list { margin-top: 10px; display: flex; flex-direction: column; gap: 7px; }
.language-section { border: 1px solid var(--line); background: #fbfaf8; }
.language-section.is-open { border-color: #c9b27f; background: #f7f2e8; }
.language-trigger { width: 100%; padding: 11px; display: flex; align-items: center; justify-content: space-between; gap: 8px; border: 0; background: transparent; color: var(--ink); text-align: left; }
.language-trigger:disabled { cursor: default; opacity: .58; }
.language-identity { display: flex; align-items: center; gap: 9px; }
.flag { width: 26px; height: 26px; display: grid; place-items: center; border: 1px solid #d4c7ac; border-radius: 4px; background: #fffefb; font-size: 14px; }
.language-text { display: flex; flex-direction: column; gap: 2px; }
.language-text strong { font-size: 12px; font-weight: 600; }
.language-text small { color: var(--muted); font-size: 10px; }
.language-actions { display: flex; align-items: center; gap: 7px; }
.usage-badge { color: var(--gold-dark); font-size: 10px; }
.language-arrow { color: var(--gold-dark); transition: transform 160ms ease; }
.language-section.is-open .language-arrow { transform: rotate(180deg); }
.vip-grid { padding: 0 10px 10px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 5px; }
.vip-btn { min-height: 31px; border: 1px solid #d3c5aa; border-radius: 4px; background: #fffefc; color: var(--graphite-700); font-size: 10px; transition: border-color 140ms ease, background 140ms ease, color 140ms ease, transform 140ms ease; }
.vip-btn:hover, .vip-btn.active { border-color: var(--gold-dark); background: var(--gold-dark); color: #fffdf8; transform: translateY(-1px); }
.language-empty { padding: 0 11px 11px; color: var(--muted); font-size: 10px; }
.cache-section { margin-top: auto; padding-top: 15px; border-top: 1px solid var(--line); }
.cache-track { height: 6px; margin-top: 9px; overflow: hidden; border-radius: 3px; background: #e3ded4; }
.cache-track span { display: block; width: 0; height: 100%; border-radius: 3px; background: var(--gold); transition: width 180ms ease; }
.cache-section p { margin: 8px 0 0; color: var(--muted); font-size: 10px; line-height: 1.5; }
.preview-area { min-width: 0; padding: 15px; display: flex; flex-direction: column; }
.preview-toolbar { min-height: 42px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.preview-toolbar strong { display: block; margin-top: 4px; color: var(--graphite-950); font-size: 15px; }
.toolbar-actions { gap: 7px; }
.ghost-button, .primary-button, .export-button, .upload-button, .icon-button { border: 1px solid #d2ccc1; border-radius: 4px; background: #fffefc; color: var(--graphite-700); transition: transform 140ms ease, border-color 140ms ease, background 140ms ease, box-shadow 140ms ease; }
.ghost-button, .primary-button { min-height: 35px; padding: 0 14px; font-size: 11px; }
.primary-button { border-color: var(--graphite-900); background: var(--graphite-900); color: #fffdf8; }
.ghost-button:hover, .primary-button:hover, .export-button:hover, .upload-button:hover, .icon-button:hover { border-color: var(--gold-dark); transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.canvas-stage { position: relative; flex: 1; min-height: 0; margin-top: 13px; display: flex; align-items: center; justify-content: center; padding: 31px 28px 20px; overflow: hidden; border: 1px solid var(--line); border-radius: 5px; background: #e7e3dc; }
#certificateCanvas { display: block; width: min(100%, 520px); max-height: calc(100vh - 171px); height: auto; background: #fff; box-shadow: 0 18px 42px rgba(41, 36, 29, .22); cursor: grab; touch-action: none; }
#certificateCanvas.is-dragging { cursor: grabbing; }
.canvas-ruler { position: absolute; color: #9d9589; font-size: 9px; pointer-events: none; }
.ruler-top { top: 10px; left: 28px; right: 28px; display: flex; justify-content: space-between; }
.ruler-side { top: 31px; bottom: 20px; left: 8px; display: flex; flex-direction: column; justify-content: space-between; }
.state-overlay { position: absolute; inset: 28px; display: grid; place-items: center; background: rgba(244, 241, 235, .86); }
.hidden { display: none; }
.state-card { min-width: 190px; padding: 20px; border: 1px solid var(--line); border-radius: 5px; background: #fffefc; text-align: center; box-shadow: var(--shadow-sm); }
.state-card p { margin: 8px 0 0; color: var(--muted); font-size: 11px; line-height: 1.5; }
.state-error strong { display: block; color: #9d4b46; }
.state-error .ghost-button { margin-top: 12px; }
.spinner { width: 23px; height: 23px; display: block; margin: 0 auto; border: 2px solid #ddd6ca; border-top-color: var(--gold-dark); border-radius: 50%; animation: spin 800ms linear infinite; }
.preview-status { justify-content: space-between; gap: 10px; padding: 10px 2px 0; color: var(--gold-dark); font-size: 10px; }
.preview-status span:last-child { color: var(--muted); }
.inspector-heading { margin-bottom: 4px; }
.inspector-section { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); }
.upload-button { width: 100%; min-height: 36px; margin-top: 9px; display: flex; align-items: center; justify-content: space-between; padding: 0 11px; font-size: 11px; }
.upload-button span { color: var(--muted); font-size: 10px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.text-input { width: 100%; height: 38px; margin-top: 9px; padding: 0 11px; border: 1px solid #bdb5a8; border-radius: 4px; outline: none; color: var(--graphite-950); background: #f7f4ee; font-size: 12px; box-shadow: inset 0 0 0 1px rgba(255,255,255,.72); }
.text-input::placeholder { color: #9d9589; }
.text-input:focus, .field-grid input:focus { border-color: var(--gold-dark); background: #fffefb; box-shadow: 0 0 0 3px rgba(177, 138, 81, .17), inset 0 0 0 1px rgba(255,255,255,.9); }
.field-grid { margin-top: 8px; display: grid; gap: 6px; }
.field-grid.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.field-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.field-grid label { color: var(--muted); font-size: 9px; }
.field-grid input { width: 100%; height: 29px; margin-top: 4px; padding: 0 5px; border: 1px solid #c1baae; border-radius: 3px; outline: none; color: var(--graphite-700); background: #f8f5ef; font-size: 10px; box-shadow: inset 0 0 0 1px rgba(255,255,255,.72); }
.control-row { margin-top: 8px; display: grid; grid-template-columns: repeat(4, 1fr) 1fr 1fr; gap: 5px; }
.icon-button { height: 29px; display: grid; place-items: center; padding: 0; color: var(--gold-dark); font-size: 14px; line-height: 1; }
.icon-button.wide { font-size: 16px; }
.export-section { margin-top: auto; }
.export-button { width: 100%; min-height: 40px; margin-top: 9px; border-color: var(--gold-dark); background: #f5eee1; color: var(--gold-dark); font-size: 11px; font-weight: 600; }
.hint { margin: 8px 0 0; color: var(--muted); font-size: 10px; line-height: 1.55; }
.coords { margin: 14px 0 0; padding: 10px; border: 1px solid var(--line); border-radius: 4px; background: #f6f3ee; color: var(--muted); font: 10px/1.55 ui-monospace, SFMono-Regular, Menlo, monospace; white-space: pre-wrap; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (max-width: 1180px) {
  .workspace { grid-template-columns: 220px minmax(420px, 1fr) 294px; width: min(1140px, calc(100% - 24px)); }
  .sidebar { padding: 15px 12px; }
}
@media (max-width: 940px) {
  .workspace { grid-template-columns: 1fr; width: min(680px, calc(100% - 20px)); }
  .left-sidebar, .inspector-sidebar { min-height: auto; }
  .cache-section, .export-section { margin-top: 18px; }
  #certificateCanvas { max-height: none; width: min(100%, 520px); }
  .canvas-stage { min-height: 680px; }
}
@media (max-width: 560px) {
  .topbar { height: 60px; padding: 0 16px; }
  .topbar-meta span:not(.connection-dot):not(.topbar-divider):last-child { display: none; }
  .workspace { margin-top: 8px; }
  .preview-area { padding: 10px; }
  .preview-toolbar { align-items: flex-start; flex-direction: column; }
  .toolbar-actions { width: 100%; }
  .toolbar-actions button { flex: 1; }
  .canvas-stage { min-height: 600px; padding-left: 22px; padding-right: 22px; }
  .ruler-top { left: 22px; right: 22px; }
}
