:root {
  --bg: #0b1220;
  --bg-elev: #121b2d;
  --bg-card: #162238;
  --line: #2a3b57;
  --text: #e8eef8;
  --muted: #9aadc8;
  --accent: #c9a24a;
  --accent-soft: rgba(201, 162, 74, 0.14);
  --ok: #2f9e6b;
  --ok-bg: rgba(47, 158, 107, 0.12);
  --bad: #c45b5b;
  --bad-bg: rgba(196, 91, 91, 0.12);
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
  --serif: "Libre Baskerville", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --sans: "Source Sans 3", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background:
    radial-gradient(1200px 500px at 50% -10%, rgba(201, 162, 74, 0.12), transparent 60%),
    linear-gradient(180deg, #0d1526 0%, var(--bg) 45%, #090f1a 100%);
  color: var(--text);
  font-family: var(--sans);
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.wrap {
  width: min(920px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 2.5rem 0 4rem;
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--line);
}

.brand-mark {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.brand-mark strong {
  font-family: var(--serif);
  font-size: 1.15rem;
  letter-spacing: 0.02em;
  font-weight: 700;
}

.brand-mark span {
  color: var(--muted);
  font-size: 0.82rem;
}

.nav-links {
  display: flex;
  gap: 1rem;
  font-size: 0.9rem;
}

/* —— Public Certificate (CGA portal reference: Figtree + slate/sky) —— */
@font-face {
  font-family: "Figtree";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/static/fonts/figtree-latin-400-normal.woff2") format("woff2");
}
@font-face {
  font-family: "Figtree";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("/static/fonts/figtree-latin-500-normal.woff2") format("woff2");
}
@font-face {
  font-family: "Figtree";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("/static/fonts/figtree-latin-600-normal.woff2") format("woff2");
}
@font-face {
  font-family: "Figtree";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("/static/fonts/figtree-latin-700-normal.woff2") format("woff2");
}
@font-face {
  font-family: "Source Serif 4";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/static/fonts/source-serif-4-latin-400-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Source Serif 4";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/static/fonts/source-serif-4-latin-ext-400-normal.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Source Serif 4";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("/static/fonts/source-serif-4-latin-500-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Source Serif 4";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("/static/fonts/source-serif-4-latin-ext-500-normal.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

html:has(body.public-page),
html.public-html,
body.public-page {
  background: #f8fafc !important; /* slate-50 */
  background-image: none !important;
  color: #0f172a; /* slate-900 */
}

body.public-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  padding: 0;
  margin: 0;
  font-family: "Figtree", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
}

body.public-page a {
  color: #0369a1; /* sky-700 */
}

.coo-main {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 3rem 1rem; /* py-12 px-4 */
}

.coo-wrap {
  width: min(64rem, 100%); /* max-w-5xl */
  margin: 0 auto;
  padding: 0;
  display: flex;
  flex-direction: column;
  align-items: stretch;
}

.coo-card {
  width: 100%;
  max-width: 64rem; /* max-w-5xl */
  margin: 0 auto;
  background: #ffffff;
  border-radius: 0; /* sharp rectangle — match official COO card */
  padding: 2rem; /* p-8 */
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.08), 0 2px 6px rgba(15, 23, 42, 0.04); /* subtle soft shadow */
  outline: 1px solid #e2e8f0; /* ring-1 ring-slate-200 */
}

.coo-logo-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
}

.coo-logo {
  display: block;
  width: 340px;
  max-width: 100%;
  height: auto;
  max-height: 140px;
  object-fit: contain;
  background: transparent;
  border: 0;
  box-shadow: none;
}

.coo-title {
  margin: 1.5rem 0 0; /* mt-6 */
  text-align: center;
  font-family: "Figtree", ui-sans-serif, system-ui, sans-serif;
  font-size: 1.875rem; /* text-3xl */
  line-height: 2.25rem;
  font-weight: 600; /* font-semibold */
  color: #0369a1; /* sky-700 */
  letter-spacing: 0;
}

.coo-body {
  margin: 1.5rem 0 0; /* mt-6 */
  font-size: 1.125rem; /* text-lg */
  line-height: 1.625; /* leading-relaxed */
  color: #334155; /* slate-700 */
  text-align: left;
}

.coo-body b,
.coo-body strong {
  color: #334155;
  font-weight: 700;
}

.coo-meta {
  margin-top: 1.5rem;
}

.coo-status {
  margin: 0;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  vertical-align: middle;
  margin-left: 0.25rem;
  padding: 0.25rem 0.75rem; /* py-1 px-3 */
  border-radius: 9999px; /* rounded-full */
  font-size: 0.75rem; /* text-xs */
  font-weight: 600;
  letter-spacing: 0;
  line-height: 1rem;
  border: none;
}

.status-pill.ok,
.status-pill.status-active {
  color: #065f46; /* emerald-800 */
  background: #d1fae5; /* emerald-100 */
}

.status-pill.status-withdrawn,
.status-pill.status-suspended {
  color: #334155;
  background: #e2e8f0;
}

.status-pill.status-revoked,
.status-pill.bad {
  color: #991b1b;
  background: #fee2e2;
}

.coo-footer {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-top: 1.5rem;
  padding: 0;
  border: none;
}

.coo-footer-seal {
  display: block;
  line-height: 0;
  text-decoration: none;
  margin-top: 0.5rem;
}

.coo-footer-seal img {
  display: block;
  width: 155px;
  height: 100px;
  max-width: 100%;
  object-fit: contain;
  border-radius: 0;
}

.page-footer {
  margin-top: 2.5rem; /* mt-10 */
  padding: 0 1rem 2rem;
  text-align: center;
  color: #64748b; /* slate-500 */
  font-size: 0.875rem; /* text-sm */
  line-height: 1.5;
}

.page-footer-copy {
  margin: 0 0 0.25rem;
}

.page-footer-links {
  margin: 0;
}

.page-footer-links a {
  color: #0369a1; /* sky-700 */
  text-decoration: none;
}

.page-footer-links a:hover {
  color: #075985; /* sky-800 */
  text-decoration: none;
}

.page-footer-dot {
  color: #94a3b8; /* slate-400 */
  margin: 0 0.35rem;
}

.embed-box {
  margin: 0.75rem 0 1.25rem;
  padding: 0.9rem 1rem;
  background: rgba(0,0,0,0.18);
  border: 1px solid rgba(42, 59, 87, 0.8);
  border-radius: 4px;
}

.embed-box .label {
  color: var(--accent);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin: 0 0 0.35rem;
}

.embed-box textarea {
  margin-top: 0.25rem;
  min-height: 64px;
  font-size: 0.78rem;
}

/* —— Legacy / admin dark components —— */
.cert-card {
  background: linear-gradient(180deg, rgba(255,255,255,0.03), transparent 40%), var(--bg-card);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  border-radius: 4px;
  padding: 2.25rem 2rem;
  position: relative;
  overflow: hidden;
}

.cert-card::before {
  content: "";
  position: absolute;
  inset: 10px;
  border: 1px solid rgba(201, 162, 74, 0.28);
  pointer-events: none;
}

.cert-top {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 1.75rem;
  align-items: center;
  margin-bottom: 1.75rem;
}

.seal {
  width: 130px;
  height: auto;
  display: block;
  margin: 0 auto;
  filter: drop-shadow(0 8px 18px rgba(0,0,0,0.35));
}

.cert-heading h1 {
  margin: 0 0 0.4rem;
  font-family: var(--serif);
  font-size: clamp(1.35rem, 2.4vw, 1.85rem);
  font-weight: 700;
  line-height: 1.25;
}

.cert-heading p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  margin-top: 0.9rem;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.badge.ok,
.badge.status-active {
  color: #8be0b7;
  background: var(--ok-bg);
  border: 1px solid rgba(47, 158, 107, 0.35);
}

.badge.status-withdrawn,
.badge.status-suspended {
  color: #c5cdd8;
  background: rgba(108, 117, 125, 0.18);
  border: 1px solid rgba(108, 117, 125, 0.45);
}

.badge.bad,
.badge.status-revoked {
  color: #f0a3a3;
  background: var(--bad-bg);
  border: 1px solid rgba(196, 91, 91, 0.35);
}

.badge::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
}

.meta-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem 1.25rem;
  margin: 1.5rem 0;
}

.meta-item {
  background: rgba(0,0,0,0.18);
  border: 1px solid rgba(42, 59, 87, 0.8);
  padding: 0.85rem 1rem;
}

.meta-item.full { grid-column: 1 / -1; }

.meta-item .label {
  display: block;
  color: var(--muted);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 0.35rem;
}

.meta-item .value {
  font-size: 0.98rem;
  line-height: 1.45;
  word-break: break-word;
}

.token-box {
  margin-top: 1.25rem;
  padding: 0.9rem 1rem;
  background: var(--accent-soft);
  border: 1px solid rgba(201, 162, 74, 0.35);
}

.token-box .label {
  color: var(--accent);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 0.35rem;
}

.token-box code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.92rem;
  word-break: break-all;
}

.footer-note {
  margin-top: 1.5rem;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.5;
}

.admin-card, .login-card {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 1.5rem;
  box-shadow: var(--shadow);
}

.login-card {
  width: min(420px, 100%);
  margin: 4rem auto;
}

h1, h2 {
  font-family: var(--serif);
}

.flash {
  margin-bottom: 1rem;
  padding: 0.75rem 1rem;
  background: var(--ok-bg);
  border: 1px solid rgba(47, 158, 107, 0.35);
  color: #8be0b7;
  border-radius: 4px;
}

.error {
  margin-bottom: 1rem;
  padding: 0.75rem 1rem;
  background: var(--bad-bg);
  border: 1px solid rgba(196, 91, 91, 0.35);
  color: #f0a3a3;
  border-radius: 4px;
}

label {
  display: block;
  margin: 0.85rem 0 0.35rem;
  color: var(--muted);
  font-size: 0.82rem;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="url"],
select,
textarea {
  width: 100%;
  background: #0d1524;
  border: 1px solid var(--line);
  color: var(--text);
  padding: 0.7rem 0.8rem;
  border-radius: 4px;
  font: inherit;
}

textarea { min-height: 70px; resize: vertical; }

.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 1.25rem;
}

button, .btn {
  appearance: none;
  border: 1px solid transparent;
  background: var(--accent);
  color: #1a1408;
  font-weight: 700;
  padding: 0.65rem 1rem;
  border-radius: 4px;
  cursor: pointer;
  font: inherit;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}

button.secondary, .btn.secondary {
  background: transparent;
  color: var(--text);
  border-color: var(--line);
}

button.danger, .btn.danger {
  background: transparent;
  color: #f0a3a3;
  border-color: rgba(196, 91, 91, 0.45);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}

th, td {
  text-align: left;
  padding: 0.75rem 0.5rem;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

th {
  color: var(--muted);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
}

.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.82rem;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.actions form { display: inline; }

@media (max-width: 720px) {
  .cert-top { grid-template-columns: 1fr; text-align: center; }
  .meta-grid { grid-template-columns: 1fr; }
  .site-header { flex-direction: column; align-items: flex-start; }
  .coo-main { padding: 2rem 0.75rem; }
  .coo-card { padding: 1.5rem 1.15rem; border-radius: 0; }
  .coo-logo { width: 260px; }
  .coo-title { font-size: 1.5rem; line-height: 2rem; }
  .coo-body { font-size: 1.05rem; }
  .coo-footer-seal img { width: 155px; height: 100px; }
}
