/* Trạng thái đang chờ font */
.fonts-loading #cert {
  opacity: 0.25;
  filter: blur(3px);
  transition: opacity .25s ease, filter .25s ease;
}

#cert {
  transition: opacity .25s ease, filter .25s ease;
}

:root {
  --bg: #0d0f13;
  --bg-2: #12151b;
  --panel: #171b22;
  --panel-2: #1d222b;
  --border: #262c38;
  --border-2: #2f3644;
  --text: #e8ebf2;
  --muted: #8b94a7;
  --accent: #e0a800;
  --accent-2: #b32d2d;
  --radius: 12px;
  --shadow: 0 20px 60px rgba(0, 0, 0, 0.55);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: radial-gradient(1200px 600px at 80% -10%, #1a1f2a 0%, var(--bg) 55%) fixed;
  color: var(--text);
  font-family: 'Be Vietnam Pro', system-ui, -apple-system, sans-serif;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ===== Topbar ===== */
.topbar {
  max-width: 1500px;
  margin: 0 auto;
  padding: 22px 24px 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.logo {
  font-size: 34px;
  filter: drop-shadow(0 4px 12px rgba(224, 168, 0, 0.35));
}

.topbar h1 {
  margin: 0;
  font-size: 20px;
  letter-spacing: 0.2px;
  font-weight: 700;
}

.topbar p {
  margin: 2px 0 0;
  font-size: 13px;
  color: var(--muted);
}

.badge {
  padding: 8px 14px;
  font-size: 11px;
  letter-spacing: 1.4px;
  font-weight: 700;
  color: var(--accent);
  background: rgba(224, 168, 0, 0.08);
  border: 1px solid rgba(224, 168, 0, 0.35);
  border-radius: 999px;
  white-space: nowrap;
}

/* ===== Layout ===== */
.layout {
  max-width: 1500px;
  margin: 0 auto;
  padding: 18px 24px 40px;
  display: grid;
  grid-template-columns: 380px 1fr;
  gap: 26px;
  align-items: start;
}

@media (max-width: 1000px) {
  .layout { grid-template-columns: 1fr; }
}

/* ===== Panel ===== */
.panel {
  background: linear-gradient(180deg, var(--panel) 0%, var(--bg-2) 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  position: sticky;
  top: 20px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}

@media (max-width: 1000px) {
  .panel { position: static; }
}

.panel-title {
  margin: 0 0 16px;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--muted);
  font-weight: 600;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}

.field label {
  font-size: 12.5px;
  color: var(--muted);
  font-weight: 500;
  letter-spacing: 0.3px;
}

.field input,
.field select {
  width: 100%;
  padding: 10px 12px;
  background: var(--panel-2);
  border: 1px solid var(--border-2);
  border-radius: 9px;
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.field input::placeholder { color: #5a6373; }

.field input:focus,
.field select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(224, 168, 0, 0.15);
}

.field select {
  appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position:
    calc(100% - 18px) 50%,
    calc(100% - 13px) 50%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 32px;
}

.row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.row .field { margin-bottom: 14px; }

/* ===== Actions ===== */
.actions {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 10px;
  margin-top: 6px;
}

.btn {
  padding: 11px 14px;
  border-radius: 10px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: transform 0.06s ease, filter 0.15s ease, background 0.15s ease;
}

.btn:active { transform: translateY(1px); }

.btn-primary {
  background: linear-gradient(180deg, #f2b90d 0%, #cf9c00 100%);
  color: #1a1400;
  box-shadow: 0 8px 22px rgba(224, 168, 0, 0.25);
}

.btn-primary:hover { filter: brightness(1.06); }

.btn-ghost {
  background: var(--panel-2);
  border-color: var(--border-2);
  color: var(--text);
}

.btn-ghost:hover {
  background: #232937;
  border-color: #3a4254;
}

/* ===== Note ===== */
.note {
  margin: 16px 0 0;
  font-size: 12px;
  line-height: 1.5;
  color: var(--muted);
  padding: 10px 12px;
  background: rgba(179, 45, 45, 0.06);
  border: 1px dashed rgba(179, 45, 45, 0.35);
  border-radius: 9px;
}

/* ===== Preview ===== */
.preview {
  display: flex;
  justify-content: center;
  align-items: flex-start;
}

#cert {
  width: 100%;
  max-width: 1100px;
  height: auto;
  display: block;
  border-radius: 14px;
  box-shadow: var(--shadow);
  background: #f7f1e3;
}