:root {
  --navy: #4d4d4d;
  --navy-2: #333333;
  --gold: #ef7622;
  --gold-soft: #f4a56a;
  --paper: #ffffff;
  --ink: #4d4d4d;
  --muted: #6e6e6e;
  --hint: #949494;
  --line: #e6e6e6;
  --white: #ffffff;
  --danger: #9b2c2c;
  --ok: #276749;
  --orange: #ef7622;
  --orange-dark: #d46516;
  --charcoal: #4d4d4d;
}

html, body {
  background: var(--paper);
  color: var(--ink);
  font-family: "Source Serif 4", "Iowan Old Style", Georgia, serif;
}

body.app-body {
  min-height: 100vh;
}

.sans, .btn, .form-control, .form-select, .nav, .badge, table, input, label, textarea {
  font-family: "Source Sans 3", "Segoe UI", sans-serif;
}

.site-header {
  background: var(--white);
  color: var(--charcoal);
  border-bottom: 3px solid var(--orange);
  box-shadow: 0 1px 0 rgba(77, 77, 77, 0.04);
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  min-width: 0;
}

.brand-logo {
  height: 64px;
  width: auto;
  display: block;
  flex-shrink: 0;
}

.brand-mark {
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-size: 0.72rem;
  color: var(--orange);
}

.brand-title {
  font-weight: 650;
  font-size: 1.2rem;
  margin: 0;
  color: var(--charcoal);
}

.nav-link, .navbar-brand, .site-header a.nav-link {
  color: var(--charcoal) !important;
}

.nav-link.active, .nav-link:hover {
  color: var(--orange) !important;
}

.site-header .user-chip {
  color: var(--muted);
}

.page-wrap {
  max-width: 1120px;
}

.hero {
  background:
    linear-gradient(120deg, rgba(77, 77, 77, 0.94), rgba(77, 77, 77, 0.82)),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='80' height='80'%3E%3Cpath fill='none' stroke='%23ef7622' stroke-opacity='0.35' d='M0 80L80 0'/%3E%3C/svg%3E");
  color: var(--white);
  border-radius: 18px;
  padding: 3rem 2.4rem;
  margin-top: 1.5rem;
}

.hero h1 {
  font-size: clamp(2rem, 4vw, 3.1rem);
  line-height: 1.15;
}

.hero .brand-mark {
  color: var(--gold-soft);
}

.card-quiet {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 10px 30px rgba(77, 77, 77, 0.06);
}

.form-card {
  overflow: hidden;
}

.form-strip {
  background: var(--orange);
  padding: 1.35rem 1.5rem 1rem;
}

.form-card-body {
  padding: 0.85rem 1.5rem 1.5rem;
}

.form-lead {
  color: #000;
  margin-bottom: 0.25rem;
}

.form-strip .brand-mark {
  color: #fff;
  font-weight: 700;
  font-size: 0.72rem;
  margin-bottom: 0.35rem;
}

.form-strip h1 {
  color: #fff;
  font-weight: 700;
  line-height: 1.25;
}

@media (min-width: 768px) {
  .form-strip {
    padding: 1.6rem 3rem 1rem;
  }

  .form-card-body {
    padding: 0.9rem 3rem 3rem;
  }
}

.btn-gold {
  background: var(--orange);
  color: var(--white);
  border: none;
  font-weight: 650;
}

.btn-gold:disabled,
.btn-gold.disabled {
  background: #c9c9c9;
  color: #fff;
  opacity: 1;
}

.generating-overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  background: rgba(51, 51, 51, 0.55);
}

.generating-overlay.d-none {
  display: none !important;
}

.generating-card {
  background: var(--white);
  border-radius: 16px;
  max-width: 26rem;
  width: 100%;
  padding: 1.75rem 1.5rem;
  text-align: center;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.18);
}

.generating-spinner {
  width: 2.4rem;
  height: 2.4rem;
  margin: 0 auto 1rem;
  border: 3px solid var(--line);
  border-top-color: var(--orange);
  border-radius: 50%;
  animation: cert-spin 0.8s linear infinite;
}

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

.submit-success {
  text-align: center;
  padding: 0.5rem 0 0.25rem;
}

.success-mark {
  width: 3rem;
  height: 3rem;
  margin: 0 auto 1rem;
  border-radius: 50%;
  background: #e8f6ee;
  color: var(--ok);
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 3rem;
}

.btn-navy {
  background: var(--charcoal);
  color: var(--white);
  border: none;
}

.btn-navy:hover {
  background: var(--navy-2);
  color: var(--white);
}

.site-header .btn-outline-light {
  color: var(--charcoal);
  border-color: var(--charcoal);
}

.site-header .btn-outline-light:hover {
  background: var(--charcoal);
  color: var(--white);
}

.status-pill {
  font-size: 0.78rem;
  font-weight: 650;
  letter-spacing: 0.02em;
  border-radius: 999px;
  padding: 0.28rem 0.7rem;
}

.status-DRAFT { background: #edf2f7; color: #2d3748; }
.status-PENDING_APPROVAL { background: #fff4e8; color: #9a4b12; }
.status-APPROVED { background: #dcfce7; color: #166534; }

.table thead th {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  border-bottom-color: var(--line);
}

.align-stage {
  position: relative;
  display: inline-block;
  max-width: 100%;
  user-select: none;
}

.align-stage img {
  max-width: 100%;
  height: auto;
  display: block;
  border-radius: 8px;
}

.field-box {
  position: absolute;
  border: 1px dashed var(--orange);
  background: rgba(239, 118, 34, 0.08);
  cursor: grab;
  min-height: 28px;
  padding: 2px 6px;
  overflow: hidden;
  white-space: nowrap;
}

.field-box.active {
  border-style: solid;
  box-shadow: 0 0 0 2px rgba(239, 118, 34, 0.4);
}

.field-box .handle {
  position: absolute;
  right: -5px;
  top: 0;
  bottom: 0;
  width: 10px;
  cursor: ew-resize;
}

.cert-form .form-control, .cert-form .form-select {
  border-radius: 10px;
  border-color: var(--line);
  padding: 0.7rem 0.85rem;
}

.cert-form .form-control:focus, .cert-form .form-select:focus {
  border-color: var(--orange);
  box-shadow: 0 0 0 0.2rem rgba(239, 118, 34, 0.2);
}

.cert-form .form-label {
  color: #000;
  font-weight: 700;
}

.form-hint,
.cert-form .form-text,
.cert-form .form-control::placeholder {
  color: var(--hint);
}

.expired-panel {
  text-align: center;
  padding: 4rem 1.5rem;
}

.site-footer {
  border-top: 1px solid var(--line);
  margin-top: 2rem;
}

.footer-logo {
  height: 48px;
  width: auto;
}

.footer-note {
  color: var(--muted);
  font-size: 0.85rem;
}

.link-box {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.86rem;
  background: #f7f7f7;
  border-radius: 8px;
  padding: 0.55rem 0.7rem;
  word-break: break-all;
}

.pager-bar {
  border-top: 1px solid var(--line);
  background: #fafafa;
}

.col-actions {
  width: 13rem;
  min-width: 13rem;
  white-space: nowrap;
}

.row-actions {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.5rem;
}

.row-actions form {
  display: flex;
  align-items: center;
  margin: 0;
}

@media (max-width: 767px) {
  .hero { padding: 2rem 1.2rem; }
  .brand-logo { height: 52px; }
  .brand-title { font-size: 1rem; }
}
