:root{
  --bg:#f5f0e7;
  --card:#fffaf2;
  --ink:#0f2742;
  --muted:#5a6a7a;
  --line:rgba(15,39,66,.12);
  --accent:#0f2742;
  --accent2:#1f4b7a;
  --shadow:0 12px 30px rgba(0,0,0,.10);
  --radius:18px;
}

*{box-sizing:border-box}

body{
  margin:0;
  font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Arial,sans-serif;
  background:radial-gradient(1200px 700px at 20% 0%,#fff 0%,var(--bg) 55%,#efe7da 100%);
  color:var(--ink);
}

.topbar{
  position:sticky;
  top:0;
  z-index:30;
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:14px;
  padding:14px 16px;
  background:rgba(245,240,231,.9);
  backdrop-filter:blur(10px);
  border-bottom:1px solid var(--line);
}

.brand__title{
  font-weight:900;
}

.brand__title span{
  color:var(--accent2);
}

.brand__sub{
  font-size:12px;
  color:var(--muted);
}

.topbar__actions{
  display:flex;
  gap:8px;
  flex-wrap:wrap;
}

.wrap{
  max-width:1120px;
  margin:16px auto;
  padding:0 14px 40px;
}

.grid{
  display:grid;
  grid-template-columns:1.05fr 1fr;
  gap:14px;
}

@media(max-width:980px){
  .grid{
    grid-template-columns:1fr;
  }
  .topbar{
    position:static;
  }
}

.card{
  background:var(--card);
  border:1px solid var(--line);
  border-radius:var(--radius);
  box-shadow:var(--shadow);
  padding:16px;
}

.card--preview{
  position:relative;
}

.h{
  margin:0 0 12px;
  font-size:16px;
}

.form{
  display:flex;
  flex-direction:column;
  gap:12px;
}

.field span{
  display:block;
  margin-bottom:6px;
  font-size:12px;
  color:var(--muted);
  font-weight:800;
}

input,textarea,select{
  width:100%;
  border:1px solid var(--line);
  border-radius:14px;
  padding:12px;
  background:white;
  font-size:15px;
  outline:none;
}

.row2{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:12px;
}

@media(max-width:480px){
  .row2{
    grid-template-columns:1fr;
  }
}

.btn{
  border:1px solid var(--line);
  border-radius:14px;
  padding:10px 12px;
  cursor:pointer;
  font-weight:900;
  background:white;
  color:var(--ink);
}

.btn--primary{
  background:linear-gradient(180deg,var(--accent2),var(--accent));
  color:white;
}

.btn--ghost{
  background:white;
}

.toast{
  position:absolute;
  left:16px;
  bottom:16px;
  padding:10px 12px;
  border-radius:14px;
  background:#102947;
  color:white;
  font-weight:900;
  opacity:0;
  transform:translateY(6px);
  transition:.18s;
  pointer-events:none;
}

.toast.show{
  opacity:1;
  transform:none;
}

.toast--viewer{
  position:fixed;
  left:16px;
  bottom:18px;
  z-index:50;
}

.saveStatus{
  margin-top:12px;
  padding:10px 12px;
  border-radius:14px;
  background:rgba(15,39,66,.08);
  color:var(--muted);
  font-weight:800;
  font-size:13px;
}

.viewer{
  max-width:820px;
  margin:auto;
  padding:14px;
}

.viewer__card--clean{
  background:transparent;
}

.classic{
  background:white;
  border-radius:18px;
  padding:22px 14px;
  text-align:center;
  border:1px solid rgba(15,39,66,.1);
}

.cMain{
  font-family:Georgia,"Times New Roman",serif;
  color:#000;
}

.cTitle{
  font-size:38px;
  font-weight:900;
}

.cDed{
  margin-top:10px;
  font-size:16px;
  font-weight:900;
}

.cRoles{
  font-size:20px;
  font-weight:900;
}

.cName{
  margin-top:18px;
  font-size:44px;
  font-weight:1000;
}

.cProf{
  font-size:18px;
  font-weight:900;
}

.cWhen{
  margin-top:20px;
  font-size:22px;
  font-weight:900;
  line-height:1.6;
}

.cPlace{
  margin-top:14px;
  font-size:22px;
  font-weight:1000;
  line-height:1.7;
}

.cPlace a{
  color:#0b4bd6;
  text-decoration:underline;
}

.cNote{
  margin-top:14px;
  font-size:14px;
  font-weight:800;
}

.cRelCenter{
  margin-top:22px;
  display:flex;
  flex-direction:column;
  gap:14px;
}

.role{
  font-size:18px;
  font-weight:1000;
}

.names{
  font-size:18px;
  font-weight:1000;
  line-height:1.6;
}

.cOffice{
  margin-top:20px;
  padding-top:12px;
  border-top:1px solid rgba(0,0,0,.14);
  font-size:13px;
  font-weight:900;
  line-height:1.55;
}

.cOffice a{
  color:#111;
  text-decoration:underline;
  text-decoration-style:dotted;
}

.relHead{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:10px;
  margin-bottom:12px;
}

.relGroups{
  display:flex;
  flex-direction:column;
  gap:12px;
}

.relCard{
  border:1px solid rgba(15,39,66,.12);
  border-radius:14px;
  padding:12px;
  background:white;
}

.relRow{
  display:grid;
  grid-template-columns:1fr auto;
  gap:10px;
  align-items:center;
}

.history{
  display:flex;
  flex-direction:column;
  gap:10px;
}

.histItem{
  border:1px solid rgba(15,39,66,.12);
  border-radius:14px;
  padding:10px;
  background:white;
}

.histTitle{
  font-weight:900;
}

.histSub{
  font-size:12px;
  color:var(--muted);
}

.histActions{
  margin-top:8px;
  display:flex;
  gap:8px;
}

.fab{
  position:fixed;
  right:16px;
  bottom:16px;
  width:58px;
  height:58px;
  border-radius:999px;
  border:none;
  background:white;
  box-shadow:0 10px 25px rgba(0,0,0,.22);
  font-size:24px;
}