:root {
  /* MAIN CIPHER v2.1 — light theme, deep-blue contour */
  --bg: #ffffff; --panel: #f8fafc; --ink: #0f172a; --muted: #64748b;
  --line: #e6eaf0; --hit: #bf3322; --ok: #1a7f45; --pending: #b45309;
  --accent: #1a56db; --accent-soft: #eef3ff;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI",
    Roboto, Helvetica, Arial, sans-serif;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, "Times New Roman", serif;
  --mono: ui-monospace, "SFMono-Regular", "JetBrains Mono", Menlo, Consolas, monospace;
}
* { box-sizing: border-box; }
body {
  margin: 0; background: linear-gradient(180deg, #ffffff, var(--panel));
  min-height: 100vh; color: var(--ink);
  font-family: var(--sans); font-size: 15px; line-height: 1.6;
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  font-feature-settings: "cv05", "ss01", "cv11"; letter-spacing: 0.1px;
}
header {
  display: flex; align-items: center; gap: 1.5rem; flex-wrap: wrap;
  padding: 0.9rem 1.5rem; border-bottom: 1px solid var(--line); background: #ffffff;
}
.brand { display: flex; align-items: center; gap: 0.6rem; }
.logo-mark { display: block; border-radius: 7px; box-shadow: 0 2px 8px rgba(26,86,219,0.28); }
.brand-name { font-family: var(--mono); font-weight: 600; font-size: 1.02rem;
  letter-spacing: 0.34em; text-transform: uppercase; color: var(--ink); }
nav { display: flex; gap: 0.4rem; flex-wrap: wrap; }
.tab {
  background: transparent; color: var(--muted); border: 1px solid var(--line);
  padding: 0.4rem 0.9rem; border-radius: 4px; cursor: pointer; font: inherit;
  text-transform: uppercase; font-size: 0.72rem; letter-spacing: 0.12em;
}
.tab.active { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }
.controls { margin-left: auto; display: flex; align-items: center; gap: 1rem; }
.lang { display: flex; gap: 0.25rem; }
.langbtn { background: transparent; color: var(--muted); border: 1px solid var(--line);
  border-radius: 4px; padding: 0.2rem 0.5rem; cursor: pointer; font: 0.72rem var(--mono); }
.langbtn.active { color: var(--accent); border-color: var(--accent); }
.demo { color: var(--muted); font-size: 0.8rem; display: flex; align-items: center; gap: 0.35rem; }
main { padding: 1.75rem 1.5rem; max-width: 1000px; margin: 0 auto; }
.workspace.hidden { display: none; }
.hidden { display: none; }
h2 { font-family: var(--serif); font-size: 1.5rem; font-weight: 600; letter-spacing: -0.01em;
  color: var(--ink); margin: 0.2rem 0 1.2rem; }
textarea, input, select {
  width: 100%; background: #ffffff; color: var(--ink); border: 1px solid var(--line);
  border-radius: 5px; padding: 0.6rem 0.7rem; font: inherit; outline: none;
}
textarea:focus, input:focus, select:focus { border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(26,86,219,0.12); }
.row { display: flex; gap: 0.5rem; margin: 0.7rem 0; flex-wrap: wrap; }
.row input { flex: 1; } .row input#alpha { max-width: 110px; flex: none; font-family: var(--mono); }
.field { margin: 0.7rem 0; } .field label { display: block; color: var(--muted);
  font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.1em; margin-bottom: 0.3rem; }
button {
  background: var(--accent); color: #fff; border: 0; border-radius: 5px;
  padding: 0.55rem 1.1rem; cursor: pointer; font: inherit; font-weight: 600;
  text-transform: uppercase; font-size: 0.74rem; letter-spacing: 0.1em;
}
button:hover { filter: brightness(1.08); }
button.ghost { background: transparent; color: var(--accent); border: 1px solid var(--accent); }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.seg button { background: #fff; color: var(--muted); border-radius: 0; }
.seg button.active { background: var(--accent-soft); color: var(--accent); }
/* content-origin radio group: a labelled dot before each option */
.origin { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.origin button { display: inline-flex; align-items: center; gap: 0.5rem;
  background: #fff; color: var(--muted); border: 1px solid var(--line);
  border-radius: 6px; padding: 0.5rem 0.85rem; text-transform: none;
  letter-spacing: 0; font-weight: 500; font-size: 0.85rem; }
.origin button::before { content: ""; width: 12px; height: 12px; border-radius: 50%;
  border: 2px solid var(--line); box-sizing: border-box; flex: none; transition: all .12s; }
.origin button.active { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }
.origin button.active::before { border-color: var(--accent);
  box-shadow: inset 0 0 0 3px var(--accent); }
.result { margin-top: 1.25rem; }
.verdict { font-weight: 700; padding: 0.55rem 0.9rem; border-radius: 5px; display: inline-block;
  text-transform: uppercase; letter-spacing: 0.1em; font-size: 0.78rem; font-family: var(--mono); }
.verdict.hit { background: rgba(191,51,34,0.08); color: var(--hit); border: 1px solid rgba(191,51,34,0.4); }
.verdict.miss { background: #f1f5f9; color: var(--muted); border: 1px solid var(--line); }
.verify { margin: 0.8rem 0; padding: 0.45rem 0.7rem; border-radius: 5px; font-family: var(--mono);
  font-size: 0.8rem; border: 1px solid var(--line); }
.verify.pending { color: var(--muted); }
.verify.ok { color: var(--ok); border-color: rgba(26,127,69,0.4); background: rgba(26,127,69,0.06); }
.verify.bad { color: var(--hit); border-color: rgba(191,51,34,0.4); background: rgba(191,51,34,0.06); }
table { border-collapse: collapse; width: 100%; margin: 0.8rem 0; }
th, td { text-align: left; padding: 0.45rem 0.7rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 500; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.08em; }
table.stats th { width: 250px; }
table.stats td, table.passport td { font-family: var(--mono); font-size: 0.86rem; }
.highlight { background: var(--panel); border: 1px solid var(--line); border-radius: 6px;
  padding: 0.85rem; white-space: pre-wrap; line-height: 1.8; }
mark.wm { background: rgba(26,86,219,0.16); color: var(--ink); border-radius: 3px;
  padding: 0 2px; box-shadow: 0 0 0 1px rgba(26,86,219,0.35); }
.badge { padding: 0.12rem 0.55rem; border-radius: 999px; font-size: 0.74rem; font-family: var(--mono); }
.badge.ok { background: rgba(26,127,69,0.1); color: var(--ok); border: 1px solid rgba(26,127,69,0.4); }
.badge.pending { background: rgba(180,83,9,0.1); color: var(--pending); border: 1px solid rgba(180,83,9,0.4); }
.export { margin-top: 1.1rem; background: #0f172a; }
.error { color: var(--hit); }
/* generated confirmation code + inline plaque preview */
.code-out { font-family: var(--mono); font-size: 1.4rem; letter-spacing: 0.14em; color: var(--accent);
  border: 1px dashed var(--accent); border-radius: 6px; padding: 0.7rem 1rem; display: inline-block; margin: 0.6rem 0; }
.plaque-preview { display: inline-flex; align-items: center; gap: 9px; margin-top: 0.6rem;
  padding: 9px 14px; background: #ffffff; border: 1px solid var(--accent); border-radius: 6px;
  color: var(--accent); font: 13px/1.3 Georgia, "Times New Roman", serif; }
.plaque-preview.bad { border-color: var(--hit); color: var(--hit); }
.passport { border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.passport .p-head { background: var(--accent-soft); color: var(--accent); padding: 0.7rem 1rem;
  font-weight: 700; letter-spacing: 0.06em; border-bottom: 1px solid var(--line); }
footer { color: var(--muted); text-align: center; padding: 1.1rem; border-top: 1px solid var(--line);
  font-size: 0.74rem; letter-spacing: 0.06em; }

/* v2.1 polish */
.tab:hover { color: var(--accent); }
.chip { font-family: var(--mono); font-size: 0.82rem; background: var(--accent-soft);
  color: var(--accent); border: 1px solid #dbe4ff; border-radius: 5px; padding: 0.12rem 0.5rem; }
.chip.muted { background: #f1f5f9; color: var(--muted); border-color: var(--line); }
.muted-label { color: var(--muted); font-size: 0.72rem; text-transform: uppercase;
  letter-spacing: 0.1em; margin: 0.9rem 0 0.35rem; }
.code-row { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; }
.code-out { margin: 0; }
.pl-code { font-family: var(--mono); letter-spacing: 0.08em; opacity: 0.88; }
.empty { color: var(--muted); }
button.ghost { text-transform: none; letter-spacing: 0; font-weight: 500; padding: 0.5rem 0.85rem; }
.result { animation: mc-fade 0.24s ease; }
@keyframes mc-fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
table.registry td { font-size: 0.9rem; }

/* passport export target (print-to-PDF) */
#print-area { display: none; }
.pa-brand { font-family: var(--mono); letter-spacing: 0.3em; font-weight: 700; color: var(--accent); font-size: 18px; }
.pa-sub { color: var(--muted); margin-top: 4px; }
@media print {
  body > header, body > main, body > footer { display: none !important; }
  #print-area { display: block !important; padding: 26px; color: var(--ink); font-family: var(--serif); }
  .pa-head { border-bottom: 2px solid var(--accent); padding-bottom: 12px; margin-bottom: 22px; }
  #print-area .passport { border: 1px solid var(--accent); }
  #print-area .p-head { background: var(--accent-soft); color: var(--accent); }
}

/* responsive / mobile */
#registry-result { overflow-x: auto; }
@media (max-width: 680px) {
  header { gap: 0.75rem 1rem; padding: 0.8rem 1rem; }
  .controls { margin-left: 0; width: 100%; justify-content: space-between; }
  main { padding: 1.25rem 1rem; }
  h2 { font-size: 1.28rem; margin-bottom: 0.9rem; }
  .seg { display: flex; width: 100%; }
  .seg button { flex: 1; font-size: 0.64rem; padding: 0.4rem 0.4rem; }
  .row { flex-direction: column; }
  .row input#alpha { max-width: none; }
  .code-out { font-size: 1.1rem; letter-spacing: 0.08em; }
  table.stats th { width: 42%; }
  .brand-name { font-size: 0.9rem; letter-spacing: 0.24em; }
  .tab { font-size: 0.66rem; padding: 0.35rem 0.6rem; }
}

/* version chain (Trust Center) */
.history { border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.history-row { display: flex; align-items: center; gap: 0.8rem; padding: 0.55rem 1rem;
  border-bottom: 1px solid var(--line); font-size: 0.85rem; }
.history-row:last-child { border-bottom: none; }
.history-row.current { background: var(--accent-soft); }
.history-v { color: var(--muted); font-family: var(--mono); min-width: 2.2em; }
.history-code { font-family: var(--mono); letter-spacing: 0.06em; color: var(--accent);
  background: none; border: none; padding: 0; cursor: pointer; text-decoration: underline;
  text-transform: none; font-size: 0.85rem; font-weight: 600; }
.history-date { color: var(--muted); font-family: var(--mono); font-size: 0.78rem; }
.history-note { margin-left: auto; color: var(--muted); font-size: 0.75rem;
  font-family: var(--mono); }

/* personal cabinet */
.profile-card { border: 1px solid var(--line); border-radius: 10px; padding: 1.2rem 1.4rem;
  margin-top: 1.4rem; max-width: 480px; background: #fff; }
.profile-card h3 { margin: 0 0 0.9rem; font-size: 1rem; }
.profile-card button { margin-top: 0.4rem; }
.ok-note { color: #1a7f45; font-size: 0.9rem; margin: 0.6rem 0 0; }
#profile-info table.passport { max-width: 480px; width: 100%; }
.login-hint { color: var(--muted); font-size: 0.8rem; text-align: center;
  margin: 0.9rem 0 0; line-height: 1.5; }

/* login gate + account */
.login { max-width: 420px; margin: 3.5rem auto; padding: 0 1rem; }
.login-card { border: 1px solid var(--line); border-radius: 12px; padding: 1.6rem; background: #fff; box-shadow: 0 6px 24px rgba(15,23,42,.06); }
.login-card h2 { margin: 0 0 1rem; }
.login-card .seg { display: flex; width: 100%; margin-bottom: 1rem; }
.login-card .seg button { flex: 1; }
.login .field { margin: 0.6rem 0; }
#au-submit { width: 100%; margin-top: 0.6rem; }
.login-demo { text-align: center; margin-top: 1rem; }
.login-demo a { color: var(--muted); font-size: 0.85rem; }
.account-chip { font-family: var(--mono); font-size: 0.78rem; color: var(--accent); background: var(--accent-soft); border: 1px solid #dbe4ff; border-radius: 6px; padding: 0.2rem 0.55rem; }
#logout { text-transform: none; letter-spacing: 0; font-weight: 500; padding: 0.3rem 0.7rem; font-size: 0.75rem; }
