:root {
  --papal-gold: #c9a227;
  --papal-gold-2: #b8941e;
  --marble: #f7f5ef;
  --parchment: #fffdfa;
  --ink: #1e1c18;
  --statuary: #6b6a66;
  --line: #e6e0cf;
  --accent: #7a5b2c;
  --accent-blue: #2f5aa8;
  --radius: 16px;
  --radius-tight: 14px;
  --shadow-lg: 0 14px 38px rgba(0, 0, 0, 0.12);
  --shadow-md: 0 12px 28px rgba(30, 28, 24, 0.08);
  --shadow: 0 6px 18px rgba(0, 0, 0, 0.08);
  --shadow-sm: 0 3px 10px rgba(0, 0, 0, 0.06);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: "Georgia", "Times New Roman", Times, serif;
  color: var(--ink);
  background: linear-gradient(var(--marble), var(--marble));
}

.skip-link {
  position: absolute;
  left: -999px;
  top: auto;
  width: 1px;
  height: 1px;
  overflow: hidden;
  z-index: 1000;
  background: #0f3057;
  color: #fff;
  padding: 12px 16px;
  border-radius: 10px;
}

.skip-link:focus {
  left: 16px;
  top: 16px;
  width: auto;
  height: auto;
}

.site-header {
  background: #fffdfa;
  border-bottom: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
  position: sticky;
  top: 0;
  z-index: 30;
}

.nav-bar {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 16px;
  padding: 14px 20px;
  max-width: 1200px;
  margin: 0 auto;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 6px 10px;
  border-radius: 12px;
}

.brand:focus-visible,
.primary-nav a:focus-visible,
.nav-toggle:focus-visible,
.user-context:focus-visible {
  outline: 2px solid var(--accent-blue);
  outline-offset: 2px;
}

.brand-mark {
  display: inline-flex;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #ffeaa0 0 28%, var(--papal-gold) 29% 100%);
  border: 2px solid #f4e7b9;
  box-shadow: inset 0 0 0 4px #fff9d9;
  position: relative;
}

.brand .crest {
  width: 40px;
  height: 40px;
  position: relative;
  display: block;
}

.brand-text { display: flex; flex-direction: column; gap: 3px; }
.brand-title { font-weight: 700; letter-spacing: .3px; }
.brand-sub { color: var(--statuary); font-size: 12px; letter-spacing: .2px; text-transform: uppercase; }

.nav-actions {
  display: flex;
  align-items: center;
  gap: 14px;
  justify-self: end;
}

.user-context {
  font-size: 14px;
  color: #463c29;
  background: #f6f0dc;
  border-radius: 12px;
  padding: 8px 12px;
  border: 1px solid #eadfbe;
}

.nav-menu { position: relative; }

.primary-nav {
  position: absolute;
  right: 0;
  top: calc(100% + 10px);
  background: #fffdfa;
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 10px;
  min-width: 220px;
  display: none;
}

.primary-nav ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 4px;
  margin: 0;
  padding: 0;
}

.primary-nav a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-radius: 10px;
  font-weight: 600;
  color: #2d2a24;
}

.primary-nav a:hover,
.primary-nav a:focus-visible,
.primary-nav a:active {
  background: #f2ebd5;
  color: #1e1c18;
}

.primary-nav.is-open { display: block; }

.nav-toggle {
  display: inline-flex;
  border: 1px solid var(--line);
  background: #fffdfa;
  border-radius: 12px;
  padding: 8px 10px;
  cursor: pointer;
  align-items: center;
  gap: 8px;
}

.nav-toggle-box { display: inline-flex; flex-direction: column; gap: 4px; }
.nav-toggle-bar { width: 20px; height: 2px; background: #3b3525; display: block; border-radius: 999px; }
.nav-toggle-text { font-weight: 600; color: #3b3525; }

.breadcrumbs {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px 12px;
}

.breadcrumbs nav { display: inline-block; }

.breadcrumbs ol {
  list-style: none;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 10px;
  margin: 0;
  background: #f6f0dc;
  border-radius: 12px;
  border: 1px solid #eadfbe;
}

.breadcrumbs li + li::before {
  content: "›";
  color: #8b816d;
  padding: 0 6px;
}

.breadcrumbs a { color: inherit; font-weight: 600; }
.breadcrumbs li { font-size: 14px; }
.breadcrumbs li[aria-current="page"] { color: #5b5242; font-weight: 700; }

.page-shell {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px 20px 48px;
}

.page-login .site-header {
  position: static;
  width: 100%;
  box-shadow: var(--shadow);
}

.page-login .nav-bar {
  max-width: none;
  width: 100%;
  padding: 14px 24px;
}

.page-login .page-shell {
  width: min(640px, 100%);
  padding: 0 12px 24px;
  display: flex;
  justify-content: center;
}

@media (max-width: 960px) {
  .nav-bar {
    grid-template-columns: 1fr auto;
    align-items: start;
  }

  .nav-actions {
    flex-direction: column;
    align-items: flex-start;
    width: 100%;
    gap: 12px;
  }

  .nav-toggle {
    justify-self: end;
  }

  .nav-menu { width: 100%; }

  .primary-nav {
    position: static;
    width: 100%;
  }

  .user-context { width: 100%; }
}

a { color: inherit; text-decoration: none; }

body.page-login {
  background:
    radial-gradient(900px 500px at 120% -10%, #efe7cc 0, transparent 60%),
    radial-gradient(900px 500px at -20% -20%, #ffffff 0, transparent 65%),
    linear-gradient(var(--marble), var(--marble));
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px 16px;
  gap: 16px;
}

body.page-dashboard {
  background:
    radial-gradient(1400px 700px at 120% -40%, #f7efd0 0, transparent 55%),
    radial-gradient(1400px 700px at -10% -20%, #ffffff 0, transparent 60%),
    linear-gradient(var(--marble), var(--marble));
}

body.page-lookup {
  background:
    radial-gradient(900px 500px at 120% -10%, #efe7cc 0, transparent 60%),
    radial-gradient(900px 500px at -20% -20%, #ffffff 0, transparent 65%),
    linear-gradient(var(--marble), var(--marble));
  font: 15px/1.5 "Georgia", "Times New Roman", Times, serif;
}

.wrap-dashboard {
  max-width: 960px;
  margin: 48px auto 64px;
  padding: 0 20px;
}

.wrap-lookup {
  max-width: 1100px;
  margin: 36px auto 48px;
  padding: 0 20px;
}

.card {
  background: var(--parchment);
  border: 1px solid var(--line);
  border-radius: var(--radius-tight);
  box-shadow: var(--shadow-sm);
  padding: 24px 26px;
  margin-top: 26px;
}

.card-spaced { margin-top: 32px; }

.auth-card {
  width: min(420px, 100%);
  border-radius: var(--radius);
  padding: 36px 32px;
  box-shadow: var(--shadow-lg);
  margin-top: 0;
}

.panel-section {
  margin-top: 46px;
  background: #fffdfa;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 28px 32px;
  box-shadow: var(--shadow-md);
}

.panel-grid {
  margin-top: 38px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 18px;
}

.panel-grid > h2 {
  grid-column: 1 / -1;
  margin: 0;
  font-size: 22px;
  letter-spacing: .4px;
}

.panel-card {
  background: #fffdfa;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px 26px;
  box-shadow: var(--shadow-md);
  display: flex;
  flex-direction: column;
  gap: 12px;
  position: relative;
}

.panel-card h3 { margin: 0; font-size: 20px; letter-spacing: .3px; }
.panel-card p { margin: 0; color: #5b5242; line-height: 1.55; font-size: 15px; }
.panel-card .btn { align-self: flex-start; margin-top: 6px; }
.panel-section ul { margin: 16px 0 0; padding-left: 20px; color: #615844; line-height: 1.55; font-size: 15px; }

.masthead { text-align: center; margin-bottom: 28px; }
.seal {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  margin: 0 auto 14px;
  background: radial-gradient(circle at 35% 35%, #ffeaa0 0 28%, var(--papal-gold) 29% 100%);
  position: relative;
  border: 2px solid #f4e7b9;
  box-shadow: inset 0 0 0 4px #fff9d9;
}
.crest { width: 72px; height: 72px; display: block; }

h1 { margin: 0; font-size: 24px; letter-spacing: .3px; }
.subtitle { margin-top: 6px; color: var(--statuary); font-size: 13px; letter-spacing: .2px; text-transform: uppercase; }

form { display: grid; gap: 18px; }
.field label {
  display: block;
  font-size: 12px;
  letter-spacing: .2px;
  color: var(--statuary);
  margin-bottom: 6px;
  text-transform: uppercase;
}


input[type="text"],
select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  font: 14px/1.4 "Georgia", "Times New Roman", Times, serif;
  color: var(--ink);
  appearance: none;
}

select {
  background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="10" viewBox="0 0 16 10"><polyline points="1,1 8,8 15,1" fill="none" stroke="%236b6a66" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg>');
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 12px auto;
  padding-right: 36px;
}

.field input[type="text"],
.field input[type="password"] {
  padding: 12px 14px;
  border-radius: 12px;
  font: 15px/1.4 "Georgia", "Times New Roman", Times, serif;
}

.field input:focus,
input:focus,
select:focus {
  outline: 2px solid rgba(201, 162, 39, .35);
  outline-offset: 1px;
}

.alert-banner {
  padding: 14px 18px;
  border-radius: 14px;
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
  font-size: 14px;
  display: grid;
  gap: 6px;
}

.alert-banner.is-success { border-color: #cfe5d6; background: #f1faf3; color: #1f5f3a; }
.alert-banner.is-error { border-color: #f2c7c7; background: #fbe9e9; color: #8a1f1f; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 16px;
  border-radius: 12px;
  border: 1px solid transparent;
  background: #fff;
  color: var(--ink);
  font-weight: 600;
  font-size: 15px;
  cursor: pointer;
  transition: filter .12s ease, transform .12s ease, box-shadow .16s ease;
  text-decoration: none;
}

.btn:not([disabled]):hover { filter: brightness(1.05); transform: translateY(-1px); }
.btn:focus-visible { outline: 3px solid rgba(201, 162, 39, .5); outline-offset: 2px; }

.btn-primary { background: var(--papal-gold); border-color: var(--papal-gold-2); color: #fff; }
.btn-secondary { background: #fff; border-color: var(--line); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--accent); }
.btn-link { background: transparent; border-color: transparent; color: var(--accent-blue); }
.btn-inline { padding: 6px 10px; font-size: 12px; border-radius: 8px; }

.btn-pill {
  padding: 12px 22px;
  border-radius: 999px;
  border: 1px solid rgba(0, 0, 0, .08);
  box-shadow: 0 6px 16px rgba(0, 0, 0, .12);
}

.btn-pill:hover { box-shadow: 0 12px 26px rgba(0, 0, 0, .16); }

.btn-icon { display: inline-flex; align-items: center; justify-content: center; width: 18px; height: 18px; }
.btn-icon svg { width: 18px; height: 18px; stroke: currentColor; stroke-width: 1.8; fill: none; stroke-linecap: round; stroke-linejoin: round; }

.links { margin-top: 18px; text-align: center; font-size: 14px; }
.links a { color: var(--accent); font-weight: 600; text-decoration: none; }
.links a:hover { text-decoration: underline; }

.msg-error {
  background: #f9e7e4;
  color: #8a2a1e;
  border: 1px solid #edc5bd;
  padding: 12px 14px;
  border-radius: 12px;
  margin-bottom: 8px;
  font-size: 14px;
  text-align: center;
  box-shadow: var(--shadow-sm);
}

.dashboard-header {
  background: #fffdfa;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 28px 32px;
  box-shadow: var(--shadow-md);
  text-align: center;
}

.dashboard-header h1 { margin: 0; font-size: 32px; letter-spacing: .6px; }
.dashboard-header .lead { margin: 12px auto 0; max-width: 620px; color: #5b5242; line-height: 1.6; font-size: 16px; }
.dashboard-header .actions { margin-top: 34px; display: flex; justify-content: center; gap: 16px; flex-wrap: wrap; }

.userbar { margin-top: 18px; font-size: 14px; color: #5c503a; display: flex; justify-content: center; align-items: center; gap: 12px; flex-wrap: wrap; }
.logout-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  border-radius: 999px;
  border: 1px solid rgba(201, 162, 39, .45);
  background: var(--papal-gold);
  color: #fff;
  font-weight: 600;
  text-decoration: none;
  box-shadow: 0 6px 16px rgba(0, 0, 0, .12);
  transition: transform .12s ease, box-shadow .16s ease, filter .12s ease;
}
.logout-btn:hover { transform: translateY(-1px); box-shadow: 0 12px 26px rgba(0, 0, 0, .18); filter: brightness(1.05); }

.restricted-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 22px;
  border-radius: 999px;
  background: #e3dcc4;
  color: #6c634f;
  font-weight: 600;
  font-size: 15px;
}

.panel-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: #f4edd4;
  border: 1px solid #e2d5aa;
  display: grid;
  place-items: center;
  margin-bottom: 8px;
}
.panel-icon svg { width: 24px; height: 24px; stroke: #6b5420; stroke-width: 1.6; fill: none; stroke-linecap: round; stroke-linejoin: round; }

.footer-note { margin-top: 38px; color: #6f6a60; text-align: center; font-size: 12px; }

.lookup-header {
  background: var(--parchment);
  border: 1px solid var(--line);
  border-radius: var(--radius-tight);
  box-shadow: var(--shadow);
  padding: 22px 26px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}
.lookup-header .header-title { display: flex; align-items: center; gap: 16px; }
.lookup-header h1 { margin: 0; font-size: 24px; letter-spacing: .3px; }
.lookup-header .subtitle { font-size: 13px; color: var(--statuary); letter-spacing: .2px; margin-top: 4px; text-transform: none; }

.lookup-actions { display: flex; gap: 10px; flex-wrap: wrap; }

.banner { padding: 12px 14px; border-radius: 12px; margin: 14px 0; border: 1px solid var(--line); font-size: 14px; }
.banner.ok { background: #f0f6e9; border-color: #dce8c9; color: #2f5f3a; }
.banner.warn { background: #fff4dd; border-color: #ffe3ad; color: #8a5a10; }
.banner.err,
.banner.error { background: #fbe9e9; border-color: #f2c7c7; color: #8a1f1f; }

.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 18px 22px; }
.label { font-size: 12px; color: var(--statuary); display: block; margin-bottom: 6px; letter-spacing: .2px; text-transform: uppercase; }
.hint { font-size: 12px; color: var(--statuary); margin-top: 4px; }

.actions { margin-top: 18px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.note { font-size: 12px; color: var(--statuary); }

.table { width: 100%; border-collapse: collapse; margin-top: 18px; font-size: 14px; }
.table th,
.table td { padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: left; }
.table th { font-size: 12px; color: var(--statuary); text-transform: uppercase; letter-spacing: .2px; }

.muted { color: var(--statuary); }
.pill { display: inline-flex; align-items: center; padding: 4px 10px; border-radius: 999px; font-size: 12px; border: 1px solid var(--line); background: #f4efdb; color: var(--accent); text-transform: uppercase; }
.pill.status-issued { background: #e6f4ea; color: #1f5f3a; border-color: #c3e6cc; }
.pill.status-voided,
.pill.status-revoked,
.pill.status-deleted { background: #fbe8e8; color: #7c1f1f; border-color: #f0c2c2; }
.pill.status-reissued { background: #e9f3f0; color: #1f6652; border-color: #c6e6da; }

.row-valid { background: #f5fbf1; }
.row-valid td { border-bottom: 1px solid var(--line); }

.hash { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.hash-control { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.hash-control .hash { word-break: break-all; }
.hash-control[data-revealed="true"] [data-hash-mask] { display: none; }
.hash-control[data-revealed="false"] [data-hash-value] { display: none; }
.hash-copy-feedback { font-size: 12px; color: var(--accent); opacity: 0; transition: opacity .2s ease; }
.hash-copy-feedback.visible { opacity: 1; }

.hash-status { display: inline-flex; align-items: center; gap: 8px; padding: 4px 8px; border-radius: 999px; border: 1px solid var(--line); background: #fff; font-size: 12px; font-weight: 600; letter-spacing: .2px; text-transform: uppercase; }
.hash-status[data-status="pending"] { background: #fdf6e6; border-color: #f1d8ab; color: #8a5a10; }
.hash-status[data-status="pass"] { background: #e6f4ea; border-color: #c3e6cc; color: #1f5f3a; }
.hash-status[data-status="fail"] { background: #fbe9e9; border-color: #f2c7c7; color: #8a1f1f; }
.hash-status[data-status="missing"] { background: #f0f0f0; border-color: #dedede; color: #6b6a66; }
.hash-status [data-hash-status-icon] { display: inline-flex; align-items: center; justify-content: center; width: 18px; height: 18px; border-radius: 50%; font-size: 0; background: rgba(0, 0, 0, .08); color: #fff; }
.hash-status[data-status="pending"] [data-hash-status-icon] { background: #d6a94f; }
.hash-status[data-status="pass"] [data-hash-status-icon] { background: #1f5f3a; }
.hash-status[data-status="fail"] [data-hash-status-icon] { background: #8a1f1f; }
.hash-status[data-status="missing"] [data-hash-status-icon] { background: #6b6a66; }
.hash-status [data-hash-status-icon] svg { width: 12px; height: 12px; display: block; }
.hash-status [data-hash-status-text] { font-size: 11px; font-weight: 600; }

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.empty { text-align: center; color: var(--statuary); padding: 20px; }

.valid-summary { display: flex; flex-wrap: wrap; gap: 12px 18px; align-items: center; border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; margin: 18px 0 10px; transition: background-color .2s ease, border-color .2s ease, color .2s ease; }
.valid-summary.valid { background: #e6f4ea; border-color: #c3e6cc; color: #1f5f3a; }
.valid-summary.missing { background: #fbe9e9; border-color: #f2c7c7; color: #8a1f1f; }
.valid-summary.blockchain-fail { background: #fbe9e9; border-color: #f2c7c7; color: #8a1f1f; }
.valid-summary.blockchain-fail .valid-label { color: inherit; opacity: .75; }
.valid-summary.blockchain-fail .valid-value { color: #8a1f1f; }
.valid-summary.blockchain-fail [data-valid-details] { display: none; }
.valid-summary.blockchain-fail [data-blockchain-status-message] { display: block; }
.valid-label { font-size: 12px; letter-spacing: .2px; text-transform: uppercase; opacity: .8; }
.valid-label.spaced { margin-bottom: 4px; display: block; }
.valid-value { font-size: 16px; font-weight: 600; }
.valid-summary.missing .valid-value { text-transform: uppercase; }
.valid-detail { font-size: 13px; color: var(--statuary); }

.result-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; }

.section-heading { margin: 0 0 12px; font-size: 20px; }
.section-subtitle { margin: 4px 0 16px; color: var(--statuary); }
.section-header { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }

.hash-detail { margin-top: 10px; }

.footer { margin-top: 38px; color: #6f6a60; text-align: center; font-size: 12px; }

/* Shared layout wrappers */
.page-shell,
.wrap { max-width: 1160px; margin: 36px auto 56px; padding: 0 22px 48px; }

.wrap-narrow { max-width: 920px; }

.page-shell-tight { max-width: 880px; }

.mast,
.masthead,
.workspace-header,
.page-header-card {
  background: var(--parchment);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  padding: 22px 26px;
}

.mast,
.page-header-card,
.workspace-header { display: flex; align-items: center; justify-content: space-between; gap: 18px; flex-wrap: wrap; }

.masthead,
.workspace-header { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 18px; align-items: center; }

.masthead-main,
.header-info,
.brand { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }

.masthead-actions,
.header-actions { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }

.workspace-header .title,
.page-header-card h1,
.masthead h1,
.mast h1 { margin: 0; font-size: 24px; letter-spacing: .35px; color: var(--accent); }

.page-header-card .subtitle,
.masthead .subtitle,
.mast .subtitle,
.workspace-header .subtitle { margin: 4px 0 0; font-size: 13px; color: var(--statuary); letter-spacing: .2px; }

.seal { width: 64px; height: 64px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #ffeaa0 0 28%, var(--papal-gold) 29% 100%); position: relative; border: 2px solid #f4e7b9; box-shadow: inset 0 0 0 3px #fff9d9; flex: 0 0 auto; }
.seal.seal-lg { width: 72px; height: 72px; }
.seal.seal-sm { width: 56px; height: 56px; }
.seal .crest { width: 100%; height: 100%; position: absolute; inset: 0; display: block; }

/* Cards & grids */
.card .hd { padding: 22px 26px; border-bottom: 1px solid var(--line); text-transform: uppercase; letter-spacing: .35px; font-weight: 600; color: var(--statuary); background: rgba(255, 253, 250, .92); }
.card .bd { padding: 24px 26px; display: flex; flex-direction: column; gap: 18px; }

.grid,
.card-grid,
.requirements-grid,
.status-grid { display: grid; gap: 18px; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }

.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }

.card-link { text-decoration: none; color: inherit; display: block; }

.icon,
.status-icon { width: 42px; height: 42px; border-radius: 9px; border: 1px solid #ecdcae; background: #fff7d8; display: grid; place-items: center; margin-bottom: 10px; }
.icon svg,
.status-icon svg { width: 24px; height: 24px; stroke: #6b5420; stroke-width: 1.6; fill: none; stroke-linecap: round; stroke-linejoin: round; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin-top: 12px; }
.stat { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; box-shadow: var(--shadow-sm); }
.stat-title { font-size: 12px; color: var(--statuary); text-transform: uppercase; letter-spacing: .25px; margin-bottom: 4px; }
.stat-value { font-size: 18px; font-weight: 700; }

/* Alerts & helpers */
.alert,
.flash { padding: 14px 18px; border-radius: 14px; border: 1px solid var(--line); box-shadow: var(--shadow-sm); font-size: 14px; }
.alert.success,
.flash.success { border-color: #cfe5d6; background: #f1faf3; color: #1f5f3a; }
.alert.error,
.flash.error { border-color: #f2c7c7; background: #fbe9e9; color: #8a1f1f; }
.alert.warn,
.flash.warn { border-color: #ffe3ad; background: #fff4dd; color: #8a5a10; }
.alert.info,
.flash.info { border-color: #dce8c9; background: #f0f6e9; color: #2f5f3a; }

.note { font-size: 13px; color: var(--statuary); }
.muted { font-size: 13px; color: var(--statuary); line-height: 1.6; }
.small { font-size: 12px; color: var(--statuary); }
.tip { font-size: 12px; color: var(--statuary); margin-top: 4px; }

/* Forms */
label,
.field-label { display: block; font-size: 12px; letter-spacing: .25px; text-transform: uppercase; color: var(--statuary); margin-bottom: 6px; font-weight: 600; }

input[type="text"],
input[type="password"],
input[type="email"],
select,
textarea { width: 100%; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line); background: #fff; font: 15px/1.45 "Georgia", "Times New Roman", serif; color: var(--ink); }

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

input:disabled,
select:disabled,
textarea:disabled { background: #f3f1e9; cursor: not-allowed; }

.help,
.hint { font-size: 12px; color: var(--statuary); margin-top: 4px; }

.form-field { display: grid; gap: 6px; }
.form-label { font-size: 12px; letter-spacing: .25px; text-transform: uppercase; color: var(--statuary); font-weight: 600; }
.form-input,
.form-select {
  width: 100%;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #fff;
  font: 15px/1.45 "Georgia", "Times New Roman", serif;
  color: var(--ink);
}

.form-select {
  background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="10" viewBox="0 0 16 10"><polyline points="1,1 8,8 15,1" fill="none" stroke="%236b6a66" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg>');
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 12px auto;
  padding-right: 36px;
  appearance: none;
}

.form-input:focus,
.form-select:focus {
  outline: 2px solid rgba(47, 90, 168, .45);
  outline-offset: 2px;
}

.form-hint { font-size: 12px; color: var(--statuary); }
.form-error { font-size: 12px; color: #8a1f1f; }
.form-field.is-invalid .form-input,
.form-field.is-invalid .form-select { border-color: #e0a1a1; box-shadow: 0 0 0 2px rgba(242, 199, 199, .35); }

.actions { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.actions .btn { box-shadow: var(--shadow-sm); }
.actions-end { justify-content: flex-end; }

/* Buttons */
.btn.primary { background: var(--papal-gold); border-color: var(--papal-gold-2); color: #fff; }
.btn.secondary { background: #fff; border-color: var(--line); color: var(--ink); }
.btn.ghost { background: rgba(255, 255, 255, .92); border-color: rgba(0, 0, 0, .06); color: var(--accent); }
.btn.danger { background: #8a1f1f; border-color: #6c1818; color: #fff; }
.btn[disabled] { opacity: .6; cursor: not-allowed; box-shadow: none; transform: none; }

.back-action { display: inline-flex; align-items: center; gap: 8px; padding: 10px 16px; border-radius: 999px; border: 1px solid var(--line); background: #fff; font-weight: 600; font-size: 14px; box-shadow: var(--shadow-sm); text-decoration: none; }
.back-action:hover { transform: translateY(-1px); filter: brightness(1.04); }

/* Tables */
.table-wrapper,
.table-scroll { width: 100%; overflow-x: auto; }

.table-meta { display: flex; justify-content: space-between; gap: 12px; align-items: center; margin: 12px 0; color: var(--statuary); font-size: 13px; }

.table-wrapper .table { margin: 0; }

/* Key/value display */
.kv { display: grid; grid-template-columns: 160px 1fr; gap: 8px 16px; margin-top: 12px; font-size: 14px; }
.kv .k { color: var(--statuary); text-transform: uppercase; letter-spacing: .25px; font-weight: 600; }
.kv .v { word-break: break-word; }

.kv-row { display: flex; gap: 10px; align-items: baseline; }
.kv-label { min-width: 140px; font-size: 12px; color: var(--statuary); letter-spacing: .25px; text-transform: uppercase; }
.kv-value { flex: 1; }

.dl { display: grid; grid-template-columns: minmax(160px, 1fr) 2fr; gap: 8px 12px; margin: 0; padding: 0; }
.dl dt { font-weight: 700; color: var(--statuary); }
.dl dd { margin: 0; }

.codepill { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; background: #221f17; color: #fff; border-radius: 12px; padding: 10px 14px; letter-spacing: .4px; box-shadow: inset 0 1px 0 rgba(255, 255, 255, .12); }

.codebox { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }

/* Modals */
.modal { position: fixed; inset: 0; display: grid; place-items: center; z-index: 10; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, .5); }
.modal-panel { position: relative; background: var(--parchment); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-lg); width: min(720px, 96vw); max-height: 92vh; overflow: auto; }
.modal-title { margin: 0; font-size: 18px; letter-spacing: .2px; }
.modal-header { padding: 18px 22px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.modal-body { padding: 20px 22px; display: grid; gap: 14px; }
.modal-footer { padding: 16px 22px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 10px; }
.modal-close { background: transparent; border: none; font-size: 16px; cursor: pointer; }

/* Panels */
.panel { background: var(--parchment); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); padding: 18px 20px; }
.panel-section { margin-top: 32px; }

.section-title { margin: 0 0 12px; font-size: 20px; letter-spacing: .2px; }

/* Tables & validation */
.status-label { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: .25px; }
.status-card { border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; box-shadow: var(--shadow-sm); background: #fff; display: grid; gap: 8px; }
.status-grid { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }

.status-badge { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; border: 1px solid var(--line); font-size: 12px; font-weight: 700; letter-spacing: .25px; text-transform: uppercase; }
.status-badge.status-issued { background: #e6f4ea; border-color: #c3e6cc; color: #1f5f3a; }
.status-badge.status-voided,
.status-badge.status-denied { background: #fbe9e9; border-color: #f2c7c7; color: #8a1f1f; }
.status-badge.status-confirmed { background: #fff4dd; border-color: #ffe3ad; color: #8a5a10; }

.payload { background: #111; color: #f4eedc; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; padding: 12px 14px; border-radius: 12px; overflow: auto; }
.payload-raw { white-space: pre-wrap; word-break: break-word; }

.json-block { background: #111; color: #e6e1d7; border-radius: 12px; padding: 14px 16px; overflow: auto; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; box-shadow: var(--shadow-sm); }

.table-scroll .table { min-width: 720px; }

/* Toggles */
.toggle { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.toggle-icon { display: inline-flex; align-items: center; justify-content: center; width: 18px; height: 18px; border-radius: 4px; border: 1px solid var(--line); background: #fff; }
.toggle-icon svg { width: 12px; height: 12px; }

.pagination { display: flex; gap: 10px; align-items: center; }
.pagination .btn { padding: 8px 12px; font-size: 13px; }

/* Page helpers */
.header-title,
.header-info { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }

.meta-line { color: var(--statuary); font-size: 13px; margin: 2px 0; }

.columns { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 18px; align-items: start; }

.dup-list { display: grid; gap: 12px; }
.dup-item { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; background: #fff; box-shadow: var(--shadow-sm); }
.dup-row { display: flex; flex-wrap: wrap; gap: 12px; font-weight: 600; }

.checkbox-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; }
.checkbox { display: flex; align-items: flex-start; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: #fff; box-shadow: var(--shadow-sm); }
.checkbox span { display: block; color: var(--statuary); font-size: 13px; }

.badge { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border: 1px solid var(--line); border-radius: 10px; background: #f4efdb; font-weight: 700; font-size: 12px; letter-spacing: .2px; text-transform: uppercase; }
.badge.genesis { background: #e6f4ea; border-color: #c3e6cc; color: #1f5f3a; }
.badge.head { background: #fff4dd; border-color: #ffe3ad; color: #8a5a10; }

.table-wrapper + .note { margin-top: 8px; }

.foot { margin: 28px 0 8px; text-align: center; color: #6e6a60; font-size: 12px; }

/* Blockchain & ledger */
.chain-viewport { margin-top: 22px; }
.chain { display: grid; gap: 12px; }
.block { border: 1px solid var(--line); border-radius: var(--radius); background: #fffdfa; box-shadow: var(--shadow-sm); overflow: hidden; }
.block summary { padding: 16px 18px; display: flex; align-items: center; justify-content: space-between; gap: 12px; cursor: pointer; }
.block summary::-webkit-details-marker { display: none; }
.summary-content { display: grid; gap: 8px; }
.summary-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.summary-meta { display: flex; align-items: center; gap: 8px; color: var(--statuary); font-size: 13px; }
.summary-toggle { font-size: 12px; color: var(--accent); text-transform: uppercase; letter-spacing: .2px; display: grid; gap: 2px; }
.summary-toggle .close { display: none; }
.block[open] .summary-toggle .open { display: none; }
.block[open] .summary-toggle .close { display: inline; }
.block-body { padding: 0 18px 18px; display: grid; gap: 14px; border-top: 1px solid var(--line); background: #fff; }

.value { font-weight: 700; }
.timestamp { color: var(--statuary); }

/* Detail overlays */
.detail-overlay { position: fixed; inset: 0; display: none; align-items: center; justify-content: center; background: rgba(0, 0, 0, .55); padding: 18px; z-index: 12; }
.detail-overlay:not([hidden]) { display: flex; }
.detail-panel { background: var(--parchment); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-lg); width: min(920px, 96vw); max-height: 92vh; overflow: auto; padding: 18px 20px; display: grid; gap: 12px; position: relative; }
.detail-header { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.detail-close { background: transparent; border: none; font-size: 20px; cursor: pointer; }
.detail-content { display: grid; gap: 14px; }
.detail-list { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.detail-warnings { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.detail-warning { background: #fff4dd; border: 1px solid #ffe3ad; border-radius: 10px; padding: 10px 12px; color: #8a5a10; }
.detail-status { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; }

/* Miscellaneous components */
.table-meta,
.meta { color: var(--statuary); font-size: 13px; }

.table-meta strong { color: var(--ink); }

.table-scroll + .actions { margin-top: 12px; }

.requirement-card { border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; background: #fff; box-shadow: var(--shadow-sm); }

.section.layout { display: grid; gap: 12px; }

.hidden { display: none; }
.mt-4 { margin-top: 4px; }
.mt-6 { margin-top: 6px; }
.mt-10 { margin-top: 10px; }
.mt-14 { margin-top: 14px; }
.mt-16 { margin-top: 16px; }
.mt-18 { margin-top: 18px; }
.text-success { color: #1f5f3a; }
.text-warn { color: #8a5a10; }
.fw-600 { font-weight: 600; }

@media (max-width: 720px) {
  .lookup-header { padding: 18px 20px; }
  .lookup-header h1 { font-size: 22px; }
  .dashboard-header h1 { font-size: 28px; }
  .dashboard-header .lead { font-size: 15px; }
  .actions { flex-direction: column; align-items: flex-start; }
  .table { font-size: 13px; }
}

@media (max-width: 520px) {
  body.page-login { padding: 24px 12px; }
  .auth-card { padding: 28px 24px; }
}
