/* ═════════════════════════════════════════════════════════════════════════
   Certificate Registry — shared styling
   Used by the public verifier and the admin console.
   Paper-and-gold palette, refined to echo the registration page.
   ═════════════════════════════════════════════════════════════════════════ */

:root{
  /* core palette */
  --ink:#10253f;
  --navy:#123455;
  --gold:#d7a944;
  --gold-dim:#b78f2e;
  --gold-soft:#f0c86a;
  --gold-tint:rgba(215,169,68,0.14);

  /* surfaces */
  --paper:#f7f3ea;
  --surface:#ffffff;
  --surface-raised:#fbf9f4;
  --hairline:#dce3ea;

  /* legacy aliases kept so any existing markup keeps working */
  --bg:#f7f3ea;
  --ivory:#10253f;
  --muted:#6b7a89;

  /* semantic states */
  --verified:#2f8f5c;
  --verified-dim:#e3f2e9;
  --invalid:#c24444;
  --invalid-dim:#fbeaea;
  --revoked:#a6791f;
  --revoked-dim:#fdf3dd;
}

*{box-sizing:border-box;}
html,body{margin:0;padding:0;}

body{
  background:
    radial-gradient(ellipse 900px 500px at 50% -10%, rgba(215,169,68,0.10), transparent),
    var(--paper);
  color:var(--ink);
  font-family:'DM Sans','IBM Plex Sans',sans-serif;
  min-height:100vh;
  padding:64px 20px 80px;
  position:relative;
  overflow-x:hidden;
}

/* decorative gold rings behind the content */
body::before,
body::after{
  content:"";
  position:absolute;
  pointer-events:none;
  border:1px solid rgba(215,169,68,0.22);
  border-radius:999px;
  z-index:0;
}
body::before{width:28rem; height:28rem; top:-15rem; left:-10rem;}
body::after {width:24rem; height:24rem; bottom:-15rem; right:-9rem;}

@media (prefers-reduced-motion: reduce){
  *{animation-duration:0.01ms !important; transition-duration:0.01ms !important;}
}

:focus-visible{
  outline:2px solid var(--gold);
  outline-offset:2px;
}

@keyframes fade-in{
  from{opacity:0; transform:translateY(12px);}
  to  {opacity:1; transform:translateY(0);}
}

/* ── Letterhead (public page) ───────────────────────────────────────────── */
.letterhead{max-width:620px; margin:0 auto 40px; text-align:center; position:relative; z-index:1;}
.seal-mark{width:44px; height:44px; margin:0 auto 18px; opacity:0.9;}
.letterhead h1{
  font-family:'Libre Baskerville','Fraunces',serif; font-weight:700;
  font-size:2rem; letter-spacing:0.005em; margin:0 0 10px; color:var(--ink);
}
.letterhead p{
  color:var(--muted); font-size:0.95rem; line-height:1.6;
  margin:0 auto; max-width:440px;
}

/* ── Card / panel ───────────────────────────────────────────────────────── */
.card{
  max-width:560px; margin:0 auto; background:var(--surface);
  border:1px solid var(--hairline); border-radius:18px; position:relative;
  box-shadow:0 25px 65px rgba(16,37,63,0.12); z-index:1;
}
.card::before{
  content:""; position:absolute; inset:8px;
  border:1px solid rgba(215,169,68,0.20);
  border-radius:12px; pointer-events:none;
}
.card-inner{padding:38px 38px 32px;}

.panel{
  background:var(--surface);
  border:1px solid var(--hairline);
  border-radius:18px;
  margin-bottom:28px;
  position:relative;
  box-shadow:0 18px 45px rgba(16,37,63,0.08);
  animation:fade-in 600ms ease both;
  z-index:1;
}
.panel::before{
  content:""; position:absolute; inset:8px;
  border:1px solid rgba(215,169,68,0.16);
  border-radius:12px; pointer-events:none;
}
.panel-inner{padding:30px 32px;}
.panel h2{
  font-family:'Libre Baskerville','Fraunces',serif;
  font-weight:700; font-size:1.15rem;
  margin:0 0 20px; color:var(--ink);
}

/* ── Form fields ────────────────────────────────────────────────────────── */
.field-group{margin-bottom:20px;}
.field-row{display:grid; grid-template-columns:1fr 1fr; gap:14px; margin-bottom:20px;}

label{
  display:block; font-size:0.72rem; text-transform:uppercase;
  letter-spacing:0.10em; color:var(--gold-dim);
  margin-bottom:8px; font-weight:700;
}

input[type=text], input[type=password]{
  width:100%;
  background:#ffffff;
  border:1px solid #cfd9e3;
  color:var(--ink);
  font-family:'IBM Plex Mono',monospace;
  font-size:0.92rem;
  padding:11px 13px;
  border-radius:0.55rem;
  transition:border-color 160ms ease, box-shadow 160ms ease;
}
input:focus{
  outline:none;
  border-color:var(--gold);
  box-shadow:0 0 0 3px rgba(215,169,68,0.22);
}
input::placeholder{color:#7d8b99;}

.hint{font-size:0.74rem; color:var(--muted); margin-top:6px; line-height:1.5;}
.hint.warn{color:var(--revoked);}

.dropzone{
  border:1px dashed #c8d3de;
  border-radius:0.75rem;
  padding:22px 16px;
  text-align:center;
  cursor:pointer;
  background:var(--surface-raised);
  transition:border-color 160ms ease, background 160ms ease, box-shadow 160ms ease;
}
.dropzone:hover, .dropzone.drag-over{
  border-color:var(--gold);
  background:#fffaf0;
  box-shadow:0 0 0 3px rgba(215,169,68,0.14);
}
.dropzone.has-file{
  border-color:var(--verified); border-style:solid;
  background:#f3faf5;
}
.dropzone-label{font-size:0.85rem; color:var(--muted);}
.dropzone-filename{
  font-family:'IBM Plex Mono',monospace;
  font-size:0.82rem; color:var(--ink);
  margin-top:6px; word-break:break-all;
}
.dropzone input{display:none;}

/* ── Buttons ────────────────────────────────────────────────────────────── */
button.verify-btn{
  width:100%; margin-top:26px;
  background:var(--gold); color:#1a1508;
  border:none; font-family:'DM Sans',sans-serif; font-weight:700;
  font-size:0.95rem; letter-spacing:0.02em;
  padding:14px; border-radius:0.6rem; cursor:pointer;
  transition:transform 160ms ease, filter 160ms ease, box-shadow 160ms ease;
  box-shadow:0 8px 20px rgba(215,169,68,0.28);
}
button.verify-btn:hover{filter:brightness(1.06); transform:translateY(-1px); box-shadow:0 12px 26px rgba(215,169,68,0.34);}
button.verify-btn:active{transform:translateY(0); box-shadow:0 6px 14px rgba(215,169,68,0.24);}
button.verify-btn:disabled{background:#e5dcc6; color:#9a8f75; cursor:wait; box-shadow:none; transform:none;}

button.action-btn{
  background:var(--gold); color:#1a1508;
  border:none; font-family:'DM Sans',sans-serif; font-weight:700;
  font-size:0.9rem; padding:12px 22px; border-radius:0.6rem;
  cursor:pointer;
  transition:transform 160ms ease, filter 160ms ease, box-shadow 160ms ease;
  box-shadow:0 6px 16px rgba(215,169,68,0.26);
}
button.action-btn:hover{filter:brightness(1.06); transform:translateY(-1px); box-shadow:0 10px 22px rgba(215,169,68,0.34);}
button.action-btn:active{transform:translateY(0);}
button.action-btn:disabled{background:#e5dcc6; color:#9a8f75; cursor:not-allowed; box-shadow:none; transform:none;}
button.action-btn.danger{background:var(--invalid); color:#fff; box-shadow:0 6px 16px rgba(194,68,68,0.28);}
button.action-btn.danger:hover{background:#d04848; box-shadow:0 10px 22px rgba(194,68,68,0.34);}
button.action-btn.small{padding:6px 12px; font-size:0.76rem; margin-right:6px; box-shadow:none;}

button.connect-btn{
  background:var(--gold); color:#1a1508;
  border:none; font-family:'DM Sans',sans-serif; font-weight:700;
  padding:9px 16px; border-radius:0.5rem;
  cursor:pointer; font-size:0.82rem;
  transition:filter 160ms ease, transform 160ms ease, box-shadow 160ms ease;
  box-shadow:0 4px 12px rgba(215,169,68,0.26);
}
button.connect-btn:hover{filter:brightness(1.06); transform:translateY(-1px);}

button.ghost-btn{
  background:none;
  border:1px solid var(--hairline);
  color:var(--muted);
  font-family:'DM Sans',sans-serif; font-weight:600;
  font-size:0.76rem; padding:7px 13px; border-radius:0.5rem;
  cursor:pointer;
  transition:border-color 160ms ease, color 160ms ease, background 160ms ease;
}
button.ghost-btn:hover{
  border-color:var(--gold); color:var(--gold-dim);
  background:rgba(215,169,68,0.06);
}

/* ── Result panel (public page) ─────────────────────────────────────────── */
.result{margin-top:28px; display:none;}
.result.show{display:block;}

.result-panel{
  border-radius:14px;
  padding:26px 26px 24px;
  border:1px solid var(--hairline);
  display:flex; gap:20px; align-items:flex-start;
  box-shadow:0 12px 32px rgba(16,37,63,0.08);
}
.result-panel.state-verified{background:var(--verified-dim); border-color:rgba(47,143,92,0.35);}
.result-panel.state-invalid {background:var(--invalid-dim);  border-color:rgba(194,68,68,0.35);}
.result-panel.state-revoked {background:var(--revoked-dim);  border-color:rgba(166,121,31,0.35);}
.result-panel.state-notfound,
.result-panel.state-error{background:var(--surface-raised); border-color:var(--hairline);}

.stamp{
  width:64px; height:64px; flex-shrink:0;
  animation:stampDrop 0.42s cubic-bezier(.2,1.4,.4,1) both;
}
@keyframes stampDrop{
  0%  {transform:translateY(-18px) rotate(-14deg) scale(1.3); opacity:0;}
  70% {transform:translateY(2px) rotate(-4deg) scale(0.96);    opacity:1;}
  100%{transform:translateY(0) rotate(-6deg) scale(1);         opacity:1;}
}

.result-text h3{
  font-family:'Libre Baskerville','Fraunces',serif;
  font-weight:700; font-size:1.15rem; margin:2px 0 6px;
}
.state-verified .result-text h3{color:var(--verified);}
.state-invalid  .result-text h3{color:var(--invalid);}
.state-revoked  .result-text h3{color:var(--revoked);}
.state-notfound .result-text h3,
.state-error    .result-text h3{color:var(--muted);}
.result-text p{margin:0 0 12px; color:var(--muted); font-size:0.88rem; line-height:1.55;}

.meta-row{
  font-size:0.78rem;
  font-family:'IBM Plex Mono',monospace;
  color:var(--ink);
  display:flex; justify-content:space-between; gap:14px;
  padding:7px 0;
  border-top:1px solid rgba(16,37,63,0.08);
}
.meta-row .meta-key{color:var(--muted); font-family:'DM Sans',sans-serif; flex-shrink:0;}
.meta-row .meta-val{word-break:break-all; text-align:right;}

/* ── Admin topbar ───────────────────────────────────────────────────────── */
.wrap{max-width:820px; margin:0 auto; position:relative; z-index:1;}

.topbar{
  display:flex; justify-content:space-between; align-items:flex-start;
  margin-bottom:40px; flex-wrap:wrap; gap:14px;
  padding-bottom:22px;
  border-bottom:1px solid var(--hairline);
  position:relative;
}
.topbar::after{
  content:""; position:absolute; left:0; bottom:-1px;
  height:2px; width:64px;
  background:var(--gold); border-radius:2px;
}
.topbar h1{
  font-family:'Libre Baskerville','Fraunces',serif;
  font-weight:700; font-size:1.7rem; margin:0; color:var(--ink);
}
.topbar .sub{color:var(--muted); font-size:0.85rem; margin-top:6px;}

.wallet-box{
  display:flex; align-items:center; gap:10px;
  background:var(--surface);
  border:1px solid var(--hairline);
  padding:9px 14px;
  border-radius:0.6rem;
  font-size:0.82rem;
  box-shadow:0 4px 14px rgba(16,37,63,0.06);
}
.wallet-dot{
  width:8px; height:8px; border-radius:50%;
  background:var(--muted);
  box-shadow:0 0 0 3px rgba(107,122,137,0.14);
  transition:background 200ms ease, box-shadow 200ms ease;
}
.wallet-dot.connected{
  background:var(--verified);
  box-shadow:0 0 0 3px rgba(47,143,92,0.18);
}
.wallet-addr{font-family:'IBM Plex Mono',monospace;}

.role-note{font-size:0.78rem; color:var(--muted); margin-top:8px; max-width:280px; text-align:right;}
.role-note.admin {color:var(--gold-dim);  font-weight:600;}
.role-note.issuer{color:var(--verified);  font-weight:600;}
.role-note.none  {color:var(--invalid);   font-weight:600;}

/* ── Status lines ───────────────────────────────────────────────────────── */
.status-line{
  margin-top:14px; font-size:0.82rem;
  padding:11px 14px; border-radius:0.55rem;
  display:none; line-height:1.5;
  border:1px solid transparent;
}
.status-line.show{display:block;}
.status-line.ok     {background:var(--verified-dim); color:var(--verified); border-color:rgba(47,143,92,0.28);}
.status-line.err    {background:var(--invalid-dim);  color:var(--invalid);  border-color:rgba(194,68,68,0.28);}
.status-line.pending{background:var(--surface-raised); color:var(--muted);  border-color:var(--hairline);}

/* ── Ledger table ───────────────────────────────────────────────────────── */
.table-scroll{overflow-x:auto; border-radius:0.6rem;}
table{width:100%; border-collapse:collapse; font-size:0.82rem;}
th{
  text-align:left; font-size:0.7rem; text-transform:uppercase; letter-spacing:0.09em;
  color:var(--muted); font-weight:700;
  font-family:'DM Sans',sans-serif;
  padding:10px 12px;
  border-bottom:1px solid var(--hairline);
  background:var(--surface-raised);
}
td{
  padding:12px;
  border-bottom:1px solid var(--hairline);
  font-family:'IBM Plex Mono',monospace;
  vertical-align:middle;
  color:var(--ink);
}
tbody tr:last-child td{border-bottom:none;}
td.mono-trunc{color:var(--muted);}

.badge{
  font-family:'DM Sans',sans-serif;
  font-size:0.72rem;
  padding:3px 10px;
  border-radius:999px;
  display:inline-block;
  font-weight:700;
  letter-spacing:0.01em;
}
.badge.active {background:var(--verified-dim); color:var(--verified); border:1px solid rgba(47,143,92,0.28);}
.badge.revoked{background:var(--revoked-dim);  color:var(--revoked);  border:1px solid rgba(166,121,31,0.28);}

.empty-row td{
  text-align:center; color:var(--muted);
  font-family:'DM Sans',sans-serif;
  padding:32px 16px;
}

.refresh-row{display:flex; justify-content:space-between; align-items:center; margin-bottom:18px; gap:12px;}
.refresh-row h2{margin:0;}

/* ── Footer ─────────────────────────────────────────────────────────────── */
footer{
  max-width:560px; margin:36px auto 0; text-align:center;
  color:#8b8f9b; font-size:0.76rem; line-height:1.6;
  position:relative; z-index:1;
}
footer a{color:var(--gold-dim); text-decoration:none;}
footer a:hover{text-decoration:underline;}

/* ── Responsive ─────────────────────────────────────────────────────────── */
@media (max-width:560px){
  body{padding:36px 14px 60px;}
  .card-inner, .panel-inner{padding:24px 20px;}
  .field-row{grid-template-columns:1fr;}
  .result-panel{flex-direction:column; gap:14px;}
  .topbar{flex-direction:column; align-items:flex-start;}
  .role-note{text-align:left;}
  button.action-btn{width:100%; margin-bottom:8px;}
  button.action-btn.small{width:auto;}
}