:root {
  --ink: #302b24;
  --muted: #716b60;
  --navy: #49252a;
  --navy2: #623036;
  --teal: #a5212d;
  --gold: #d6a12c;
  --line: #e5d9c6;
  --paper: #f7f3eb;
  --shadow: 0 18px 42px #57341b12;
}

body { background: var(--paper); color: var(--ink); }
a:hover { color: #a5212d; }
.topbar { min-height: 82px; background: #fffdf9; border-bottom: 1px solid var(--line); }
.topbar:before { content: ""; position: absolute; top: 0; left: 0; right: 0; height: 4px; background: linear-gradient(90deg,#9d1d29 0 42%,#e4b531 42% 58%,#9d1d29 58%); }
.brand { gap: 10px; }
.brand-crest { width: 39px; height: 46px; object-fit: contain; }
.brand-text { letter-spacing: .105em; color: #39282a; }
.brand-text small { color: #918476; }
.topbar nav a { color: #655b50; }
.topbar nav a.active { color: #982330; border-color: #cda03b; }
.topbar nav .nav-login,.topbar nav .nav-account { background: #92222d; border-radius: 6px; }
.site-footer { background: #fffdf9; border-color: var(--line); color: #786f63; }
.eyebrow { color: #a5212d!important; }
.card { border-color: #e9dfcf; border-radius: 10px; background: #fffdf9; }
.button,.button:visited { border-radius: 6px; }
.button.primary { background: #a3232d; }
.button.primary:hover { background: #7d1b27; }
.button.secondary { background: #f5e8ce; color: #79242b; }
.button.subtle { background: #f1eae1; color: #5a5148; }
.button.light { color: #84232b; }
.dashboard-hero,.profile-hero { background: linear-gradient(115deg,#6d212c,#9e2631 62%,#782a31); border-radius: 10px; }
.dashboard-hero p:not(.eyebrow) { color: #f6e9e0; }
.page-heading h1,.dashboard-hero h1,.tree-top h1 { font-family: Georgia,"Times New Roman",serif; font-weight: 500; letter-spacing: -.035em; }
.content-page,.form-page { max-width: 1320px; padding-left: clamp(18px,3.5vw,48px); padding-right: clamp(18px,3.5vw,48px); }
.back-link { color: #982330; }
label { color: #4b4138; }
input:not([type=checkbox]):not([type=hidden]):not([type=file]),select,textarea { border-color: #d9ccba; border-radius: 6px; background: #fffefa; }
input:focus,select:focus,textarea:focus { border-color: #a3232d!important; box-shadow: 0 0 0 3px #a3232d22; }

/* Entrada: brasão e texto editorial, com formulário simples e amplo. */
.espana-auth { grid-template-columns: minmax(0,1.08fr) minmax(410px,.92fr); min-height: calc(100svh - 148px); }
.espana-auth .auth-art { display: block; padding: clamp(28px,4vw,58px) clamp(28px,5vw,84px); background: #f4e9d5; color: #362d26; border-right: 1px solid #e5d3af; }
.espana-auth .auth-art:after { display: none; }
.auth-art-inner { width: min(100%,650px); height: 100%; min-height: 590px; margin: auto; display: flex; flex-direction: column; align-items: center; }
.auth-origin { align-self: stretch; display: flex; justify-content: space-between; gap: 20px; padding-bottom: 14px; border-bottom: 1px solid #d2b984; margin: 0; color: #8c2a31; font-size: 11px; font-weight: 800; letter-spacing: .17em; }
.auth-origin span { color: #796947; font-weight: 600; }
.crest-frame { flex: 1; min-height: 275px; width: 100%; display: flex; align-items: center; justify-content: center; padding: 14px 0; }
.crest-frame img { display: block; width: auto; height: min(44vh,440px); max-width: 100%; object-fit: contain; mix-blend-mode: multiply; }
.auth-story { width: 100%; max-width: 560px; align-self: flex-start; padding-bottom: 4px; }
.auth-story .eyebrow { margin-bottom: 10px!important; }
.espana-auth .auth-story h1 { max-width: 580px; font: 500 clamp(34px,3.4vw,54px)/1.07 Georgia,"Times New Roman",serif; letter-spacing: -.045em; color: #39292a; }
.espana-auth .auth-story h1 em { color: #9e2631; font-weight: 500; }
.espana-auth .auth-story p:not(.eyebrow) { max-width: 530px; margin: 16px 0 0; color: #66574c; line-height: 1.6; font-size: 14px; }
.auth-panel { display: grid; align-items: center; padding: clamp(30px,5vw,80px) clamp(24px,5vw,88px); background: #fffdf9; }
.espana-auth .auth-card { width: 100%; max-width: 445px; padding: 0; margin: auto; }
.auth-kicker { display: inline-flex; align-items: center; gap: 10px; color: #9c2530; font-size: 10px; font-weight: 800; letter-spacing: .17em; }
.auth-kicker i { width: 4px; height: 4px; background: #d2a531; border-radius: 50%; }
.espana-auth .auth-card h2 { margin: 15px 0 10px; font: 500 clamp(34px,3.4vw,51px)/1.05 Georgia,"Times New Roman",serif; letter-spacing: -.045em; color: #392b29; }
.espana-auth .auth-card>p:not(.auth-privacy) { margin: 0 0 25px; color: #6b6259; font-size: 14px; line-height: 1.6; }
.espana-auth .auth-card label { margin-top: 17px; font-size: 12px; }
.espana-auth .auth-card input { min-height: 47px; padding: 12px 13px; }
.espana-auth .auth-card .button { min-height: 48px; margin-top: 25px; font-size: 13px; }
.auth-next { margin-top: 27px; padding-top: 20px; border-color: var(--line); color: #71675e; }
.auth-next a { color: #9d2230; text-decoration: underline; text-underline-offset: 3px; }
.auth-privacy { margin: 25px 0 0; color: #8c8176; font-size: 11px; line-height: 1.5; }
.register-page { max-width: 760px; }
.register-page .page-heading { position: relative; padding-right: 115px; }
.register-crest { position: absolute; right: 0; top: 0; width: 86px; height: auto; mix-blend-mode: multiply; }
.register-page .card { padding: clamp(22px,4vw,36px); }

/* O conteúdo privado herda a identidade sem perder o contraste do mapa. */
.tree-top h1 em { color: #a3232d; }
.tree-workspace { border-radius: 10px; box-shadow: 0 22px 55px #53222124; background: #43282c; }
.tree-sidebar,.detail-panel { background: #512c31; }
.tree-canvas { background-color: #35282a; background-image: radial-gradient(#f2dbb515 .7px,transparent .7px); }
.canvas-toolbar { background: #42292d; }
.search-wrap { background: #633b3e; border-color: #8e6060; }
.search-wrap input { background: transparent!important; border: 0!important; color: #fff!important; }
.search-wrap input:focus { box-shadow: none!important; }
.person-node { background: #6a4143; border-color: #986d66; color: #fff7eb; }
.person-node:hover { border-color: #e7bf62; }
.person-node.focus { background: #fff9ea; border-color: #dfb857; color: #48292b; box-shadow: 0 0 0 6px #dfb85722,0 18px 38px #0004; }
.person-node.focus .node-kicker { color: #9c2630; }
.person-node .node-kicker,.person-node small { color: #dbc2bb; }
.person-node.focus small { color: #79695e; }
.graph-column h3,.canvas-hint,.detail-group small { color: #e6c982; }
.detail-tag,.detail-group button:hover { color: #e8c773; }
.detail-panel p { color: #ddc6c0; }
.detail-group div,.detail-group button { color: #fff4e9; }
.detail-link { border-color: #af8883; color: #fff8ed; }

@media (max-width: 900px) {
  .espana-auth { grid-template-columns: minmax(0,1fr) minmax(330px,1fr); }
  .espana-auth .auth-art { padding: 30px; }
  .auth-panel { padding: 35px; }
  .crest-frame img { height: min(38vh,330px); }
}
@media (max-width: 700px) {
  .topbar { min-height: 68px; }
  .brand-crest { width: 32px; height: 39px; }
  .espana-auth { display: block; min-height: 0; }
  .espana-auth .auth-art { padding: 18px 24px 23px; border-right: 0; border-bottom: 1px solid #e5d3af; }
  .auth-art-inner { min-height: 0; display: grid; grid-template-columns: 105px 1fr; gap: 12px 18px; }
  .auth-origin { grid-column: 1/-1; font-size: 9px; }
  .crest-frame { width: 105px; min-height: 0; padding: 0; grid-row: 2; }
  .crest-frame img { width: 105px; height: 125px; }
  .auth-story { grid-column: 2; grid-row: 2; align-self: center; padding: 0; }
  .auth-story .eyebrow { font-size: 8px!important; }
  .espana-auth .auth-story h1 { font-size: clamp(24px,5vw,32px); }
  .espana-auth .auth-story p:not(.eyebrow) { display: none; }
  .auth-panel { padding: 33px 25px 42px; }
  .espana-auth .auth-card h2 { font-size: 38px; }
  .register-page .page-heading { padding-right: 0; }
  .register-crest { display: none; }
}
@media (max-width: 430px) {
  .auth-origin span { letter-spacing: .08em; }
  .auth-art-inner { grid-template-columns: 82px 1fr; gap: 9px 13px; }
  .crest-frame,.crest-frame img { width: 82px; }
  .crest-frame img { height: 106px; }
  .espana-auth .auth-story h1 { font-size: 23px; }
  .auth-panel { padding: 29px 21px 38px; }
}
