/* Personal registers: fixed outer window, readable unframed content. */
html body :is(#modal,.palace-sheet)[data-content="person"] .person-compact .character-details{grid-template-rows:44px minmax(0,1fr)!important;gap:16px!important}
html body :is(#modal,.palace-sheet)[data-content="person"] .person-detail-tabs{gap:8px!important}
html body :is(#modal,.palace-sheet)[data-content="person"] .person-detail-tabs button{font-size:14px!important;min-height:44px!important;padding:8px 6px!important}
html body :is(#modal,.palace-sheet)[data-content="person"] .person-detail-section{gap:18px!important;padding:4px 8px 18px!important;scroll-padding-block:12px}
html body :is(#modal,.palace-sheet)[data-content="person"] .person-compact :is(.birth-identity,.trait-identity,.origin-trait,.income-panel,.residence-identity,.person-stat-details,.health-line,.ability-radar){border:0!important;border-image:none!important;background:transparent!important;box-shadow:none!important;outline:0!important;border-radius:0!important}
html body :is(#modal,.palace-sheet)[data-content="person"] .person-compact .character-identity{grid-template-columns:156px minmax(0,1fr)!important;padding:0!important;gap:5px 16px!important;background:transparent!important;border:0!important;border-image:none!important;box-shadow:none!important}
html body :is(#modal,.palace-sheet)[data-content="person"] .person-compact .character-portrait{width:156px!important;max-width:156px!important;border:0!important;border-image:none!important;background:transparent!important;border-radius:0!important}
html body :is(#modal,.palace-sheet)[data-content="person"] .person-compact .character-portrait img{width:156px!important;height:187px!important;object-fit:cover!important;border-radius:0!important}
html body :is(#modal,.palace-sheet)[data-content="person"] .person-compact .character-portrait button{height:40px!important;min-height:40px!important;font-size:12px!important;line-height:1.4!important;padding:7px 4px!important}
html body :is(#modal,.palace-sheet)[data-content="person"] .person-compact .char-name{font-size:28px!important;line-height:1.3!important}
html body :is(#modal,.palace-sheet)[data-content="person"] .person-compact :is(.courtesy-name,.char-title){font-size:14px!important;line-height:1.55!important}
html body :is(#modal,.palace-sheet)[data-content="person"] .person-compact :is(.character-origin,.char-stamp,.office-regalia-heading span){font-size:12px!important;line-height:1.5!important}
html body :is(#modal,.palace-sheet)[data-content="person"] .person-compact :is(.birth-identity,.trait-identity,.origin-trait,.income-panel,.residence-identity){padding:8px 10px!important}
html body :is(#modal,.palace-sheet)[data-content="person"] .person-compact :is(.birth-identity,.trait-identity,.origin-trait,.income-panel,.residence-identity)>:is(span,small){font-size:12px!important;line-height:1.6!important;color:#b7c8d8!important}
html body :is(#modal,.palace-sheet)[data-content="person"] .person-compact :is(.birth-identity,.trait-identity,.origin-trait)>strong{font-size:22px!important;line-height:1.35!important}
html body :is(#modal,.palace-sheet)[data-content="person"] .person-compact :is(.birth-identity,.trait-identity,.origin-trait,.income-panel,.residence-identity) p{font-size:15px!important;line-height:1.7!important;margin:10px 0!important;padding:0!important}
html body :is(#modal,.palace-sheet)[data-content="person"] .person-compact :is(.text-button,.birth-identity button){font-size:13px!important;line-height:1.5!important;min-height:40px!important;padding:8px 4px!important;width:auto!important}
html body :is(#modal,.palace-sheet)[data-content="person"] .person-compact .birth-identity{gap:8px!important}
html body :is(#modal,.palace-sheet)[data-content="person"] .person-compact .trait-specialty-inventory{gap:10px 18px!important;padding:14px 0 8px!important;margin:8px 0!important}
html body :is(#modal,.palace-sheet)[data-content="person"] .person-compact .specialty-slot-title{font-size:14px!important;line-height:1.5!important}
html body :is(#modal,.palace-sheet)[data-content="person"] .person-compact .specialty-slot-title small{font-size:12px!important}
html body :is(#modal,.palace-sheet)[data-content="person"] .person-compact .specialty-badges>span{font-size:13px!important;padding:6px 0!important;line-height:1.6!important}
html body :is(#modal,.palace-sheet)[data-content="person"] .person-compact .person-stat-details{grid-template-columns:repeat(3,minmax(0,1fr))!important;padding:4px 8px 12px!important;gap:12px 22px!important;font-size:14px!important}
html body :is(#modal,.palace-sheet)[data-content="person"] .person-compact .person-stat-details h3{font-size:16px!important;margin-bottom:2px!important}
html body :is(#modal,.palace-sheet)[data-content="person"] .person-compact .stat-row{font-size:14px!important;line-height:1.5!important}
html body :is(#modal,.palace-sheet)[data-content="person"] .person-compact .stat-row strong{font-size:22px!important}
html body :is(#modal,.palace-sheet)[data-content="person"] .person-compact .health-line{padding:6px 8px!important;font-size:13px!important;line-height:1.5!important}
html body :is(#modal,.palace-sheet)[data-content="person"] .person-compact .health-line strong{font-size:18px!important}

/* Crew allocation is a single work surface, with a candidate list shown only on request. */
html body #modal:has(.crew-management){width:min(720px,calc(100vw - 24px))!important;height:fit-content!important;min-height:0!important;max-height:calc(100dvh - 24px)!important;inset:auto!important;top:50%!important;left:50%!important;transform:translate(-50%,-50%)!important;margin:0!important;overflow:hidden!important;padding:20px 24px!important}
html body #modal:has(.crew-management) #modal-content{display:flex!important;flex-direction:column!important;max-height:calc(100dvh - 72px)!important;min-height:0;overflow:hidden!important;padding:0!important}
html body #modal:has(.crew-management) .window-reading-body{padding:0!important;min-height:0;overflow:hidden!important;flex:1 1 auto}
html body #modal:has(.crew-management) .modal-top{padding:0 0 16px!important;margin:0!important;flex:none}
html body #modal:has(.crew-management) .modal-top h2{font-size:23px!important;margin:0!important}
html body #modal .crew-management{height:min(570px,calc(100dvh - 140px));min-height:0;display:flex;flex-direction:column;gap:14px;color:#f2e7d3;overflow:hidden;font-size:14px;line-height:1.6}
html body #modal .crew-management [hidden]{display:none!important}
html body #modal .crew-management :is(.crew-overview,.crew-picker){flex:1 1 auto;min-height:0;overflow:auto;overscroll-behavior:contain;scrollbar-width:thin;scroll-padding:12px;padding:0 2px}
html body #modal .crew-management :is(.crew-intro,.crew-picker-hint){font-size:13px!important;line-height:1.6!important;margin:0 0 14px!important;color:#b8cad9!important;padding:0!important}
html body #modal .crew-management .crew-slot-list{display:grid;gap:14px}
html body #modal .crew-management .crew-slot{display:grid;grid-template-columns:106px 56px minmax(0,1fr) 66px;align-items:center;gap:14px;min-height:84px;padding:6px 0;box-sizing:border-box;border:0;background:none}
html body #modal .crew-management .crew-role{font-size:14px;line-height:1.45;display:grid;gap:2px}
html body #modal .crew-management .crew-role i{font-style:normal;font-size:23px;color:#d3b87f;line-height:1.2}
html body #modal .crew-management :is(.crew-slot-portrait,.crew-candidate-portrait){display:block;width:56px!important;height:68px!important;object-fit:cover;object-position:top;margin:0;border:0;border-radius:0}
html body #modal .crew-management .crew-slot-empty{height:68px;display:grid;place-items:center;color:#71899b;font-size:24px}
html body #modal .crew-management :is(.crew-slot-copy,.crew-candidate>span){display:flex;flex-direction:column;gap:3px;min-width:0}
html body #modal .crew-management .crew-slot-copy strong{font-size:21px;line-height:1.3;color:#f2e7d3}
html body #modal .crew-management :is(.crew-slot-copy small,.crew-candidate small){font-size:12px;line-height:1.55;color:#b8cad9;word-break:keep-all}
html body #modal .crew-management .crew-slot-copy .crew-support-note{color:#b8d9d2}
html body #modal .crew-management button{box-sizing:border-box;min-height:44px;font-size:14px!important;line-height:1.35;white-space:normal;color:#f5e6c6;box-shadow:none!important;border:6px solid transparent!important;border-image:var(--value-frame) 180 fill / 6px / 0 stretch!important;background:transparent!important;padding:6px 10px!important;border-radius:0!important}
html body #modal .crew-management button:focus-visible{outline:2px solid #f0deb2!important;outline-offset:2px}
html body #modal .crew-management .crew-rules{border:0!important;border-image:none!important;background:transparent!important;margin:18px 0 0;padding:0}
html body #modal .crew-management .crew-rules summary{font-size:13px;line-height:1.5;padding:8px 0;min-height:36px;box-sizing:border-box;color:#d7bd87;cursor:pointer}
html body #modal .crew-management .crew-rules p{font-size:14px!important;line-height:1.75!important;margin:8px 0!important;padding:0!important}
html body #modal .crew-management .crew-actions{display:flex;flex:none;align-items:center;justify-content:space-between;gap:16px;padding:10px 0 2px;background:transparent!important;border:0!important;border-image:none!important}
html body #modal .crew-management .crew-actions>span{font-size:12px;color:#b8cad9}
html body #modal .crew-management .crew-actions button{min-width:138px}
html body #modal .crew-management .crew-picker{display:flex;flex-direction:column;overflow:hidden!important}
html body #modal .crew-management .crew-picker>header{display:flex;flex:none;align-items:center;gap:14px;padding:0 0 12px;background:none;border:0}
html body #modal .crew-management .crew-picker-hint{flex:none}
html body #modal .crew-management .crew-picker h3{font-size:18px;margin:0;color:#f2e7d3}
html body #modal .crew-management .crew-candidates{display:grid;gap:10px;flex:1 1 auto;min-height:0;overflow:auto;align-content:start;scrollbar-width:thin;overscroll-behavior:contain;padding:2px}
html body #modal .crew-management .crew-candidate{display:grid;grid-template-columns:56px minmax(0,1fr) auto;align-items:center;gap:12px;width:100%;min-height:90px;text-align:left;padding:12px!important}
html body #modal .crew-management .crew-candidate strong{font-size:20px;line-height:1.35}
html body #modal .crew-management .crew-candidate em{font-style:normal;font-size:12px;color:#d8bf88;max-width:78px;text-align:center;word-break:keep-all}
html body #modal .crew-management .crew-candidate:disabled{opacity:.48;cursor:not-allowed}
html body #modal .crew-management .crew-unassign{display:flex;align-items:center;justify-content:space-between;min-height:54px}
@media(max-width:700px){
 html body :is(#modal,.palace-sheet)[data-content="person"] .person-compact .character-details{gap:12px!important}
 html body :is(#modal,.palace-sheet)[data-content="person"] .person-detail-section{gap:12px!important;padding:2px 2px 16px!important}
 html body :is(#modal,.palace-sheet)[data-content="person"] .person-detail-tabs{gap:4px!important}
 html body :is(#modal,.palace-sheet)[data-content="person"] .person-detail-tabs button{font-size:12px!important;padding:8px 2px!important}
 html body :is(#modal,.palace-sheet)[data-content="person"] .person-compact .character-identity{grid-template-columns:120px minmax(0,1fr)!important;gap:3px 12px!important}
 html body :is(#modal,.palace-sheet)[data-content="person"] .person-compact .character-portrait{width:120px!important;max-width:120px!important}
 html body :is(#modal,.palace-sheet)[data-content="person"] .person-compact .character-portrait img{width:120px!important;height:144px!important}
 html body :is(#modal,.palace-sheet)[data-content="person"] .person-compact .char-name{font-size:25px!important}
 html body :is(#modal,.palace-sheet)[data-content="person"] .person-compact :is(.birth-identity,.trait-identity,.origin-trait,.income-panel,.residence-identity){padding:6px 8px!important}
 html body :is(#modal,.palace-sheet)[data-content="person"] .person-compact :is(.birth-identity,.trait-identity,.origin-trait,.income-panel,.residence-identity) p{font-size:14px!important;line-height:1.7!important;margin:8px 0!important}
 html body :is(#modal,.palace-sheet)[data-content="person"] .person-compact .trait-specialty-inventory{gap:8px 12px!important;margin:6px 0!important}
 html body :is(#modal,.palace-sheet)[data-content="person"] .person-compact .person-stat-details{grid-template-columns:repeat(2,minmax(0,1fr))!important;gap:10px 16px!important}
 html body #modal:has(.crew-management){width:calc(100vw - 16px)!important;padding:16px!important;max-height:calc(100dvh - 16px)!important}
 html body #modal:has(.crew-management) #modal-content{max-height:calc(100dvh - 52px)!important}
 html body #modal:has(.crew-management) .modal-top{padding-bottom:12px!important}
 html body #modal:has(.crew-management) .modal-top h2{font-size:20px!important}
 html body #modal .crew-management{height:min(590px,calc(100dvh - 118px));gap:8px}
 html body #modal .crew-management .crew-slot{grid-template-columns:48px minmax(0,1fr) 52px;grid-template-rows:auto auto;gap:2px 10px;min-height:92px;padding:4px 0}
 html body #modal .crew-management .crew-role{grid-column:2;grid-row:1;display:flex;gap:5px;align-items:center;font-size:12px}
 html body #modal .crew-management .crew-role i{font-size:15px}
 html body #modal .crew-management :is(.crew-slot-portrait,.crew-slot-empty){grid-row:1/3;grid-column:1;width:48px!important;height:60px!important}
 html body #modal .crew-management .crew-slot-copy{grid-column:2;grid-row:2;gap:2px}
 html body #modal .crew-management .crew-slot-copy strong{font-size:19px}
 html body #modal .crew-management .crew-slot>button{grid-row:1/3;grid-column:3;padding:5px!important;font-size:13px!important}
 html body #modal .crew-management .crew-slot-list{gap:8px}
 html body #modal .crew-management .crew-actions{gap:10px;padding-top:8px}
 html body #modal .crew-management .crew-actions button{min-width:112px}
 html body #modal .crew-management .crew-candidate{grid-template-columns:46px minmax(0,1fr) 44px;gap:9px;padding:10px!important}
 html body #modal .crew-management .crew-candidate-portrait{width:46px!important;height:58px!important}
 html body #modal .crew-management .crew-candidate strong{font-size:19px}
 html body #modal .crew-management .crew-picker h3{font-size:16px}
}
