/*
  68-council.css — v46.6 the council (design/council Main, Member, Add, Entry,
  Desktop). Parchment page and sheets, the allegiance colours from Hostile
  (dark red) to Allied (dark green), which also differ in lightness.
*/

#modal .cn-page button, #modal .cn-sheet button { font: inherit; }
.cn-face { display: grid; place-items: center; flex-shrink: 0; border-radius: 999px; background-size: cover; background-position: top center; color: #231a10; font-weight: 800; }
.cn-row-text { flex: 1 1 auto; display: flex; flex-direction: column; gap: 2px; min-width: 0; text-align: left; }
.cn-row-text b { font-size: 15px; color: #231a10; }
.cn-row-text small { font-size: 13px; line-height: 1.35; color: #5c4a30; }
.cn-dead { font-size: 12px; font-weight: 600; color: #8a2f20; }
.cn-note { margin: 0; font-size: 13px; line-height: 1.4; color: #5c4a30; }
.cn-pill { flex-shrink: 0; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; color: #fbf7ec; }
#modal button.cn-link { min-height: 44px !important; padding: 0 4px; border: 0; background: none; box-shadow: none; color: #845c0f; font-size: 15px; font-weight: 600; cursor: pointer; }
#modal button.cn-btn, .codex-overview button.cn-btn { min-height: 48px !important; padding: 0 16px; border-radius: 14px; border: 1px solid #b9a77f; background: #fbf7ec; box-shadow: none; color: #231a10; font-size: 15px; font-weight: 700; cursor: pointer; }
#modal button.cn-btn.is-primary { border-color: #c18a2a; background: #c18a2a; color: #1f1712; }
#modal button.cn-btn.is-danger { border-color: #d9a296; color: #a33a2a; }
#modal button.cn-btn.is-wide { width: 100%; }
#modal button.cn-btn.is-small { min-height: 44px !important; }
#modal button.cn-btn[disabled] { opacity: .5; }

/* The balance */
.cn-bar { display: flex; gap: 3px; height: 12px; overflow: hidden; border-radius: 3px; }
.cn-bar.is-small { height: 8px; }
.cn-balance-line { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; color: #5c4a30; }
.cn-balance-line .is-against { color: #8a2f20; }
.cn-balance-line .is-with { color: #2f6b3f; }
.cn-balance { display: flex; flex-direction: column; gap: 8px; padding: 12px; border-radius: 16px; border: 1px solid #ddd0ab; background: #efe4c3; }
.cn-balance .cn-balance-line { order: -1; }
.cn-balance-sub { display: flex; justify-content: space-between; gap: 8px; font-size: 12px; color: #5c4a30; }

/* The Organisations card (Entry) */
#screen-codex button.cn-card { display: flex; flex-direction: column; gap: 10px; width: 100%; margin: 0 0 10px; padding: 12px; border-radius: 16px; border: 1.5px solid #c18a2a; background: #f4ecd8; box-shadow: none; color: #231a10; font: inherit; text-align: left; cursor: pointer; }
.cn-card-top { display: flex; align-items: center; gap: 12px; }
.cn-card-top > .cx-icon { color: #6e5b40; }
.cn-crest { display: grid; place-items: center; flex-shrink: 0; width: 44px; height: 44px; border-radius: 12px; background: #845c0f; color: #f4ecd8; }
.cn-card-text { flex: 1 1 auto; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.cn-card-text b { font-size: 16px; }
.cn-card-text small { font-size: 13px; color: #5c4a30; }
#screen-codex .cn-card .cn-balance-line { font-size: 12px; font-weight: 700; }

/* The page (Main) */
#modal:has(.cn-page) .modal-head { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.cn-page { display: flex; flex-direction: column; margin: -4px -4px 0; color: #231a10; }
.cn-page-head { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; padding: 0 2px 8px; border-bottom: 1px solid #ddd0ab; font-size: 16px; font-weight: 700; }
.cn-page-head > :first-child { justify-self: start; }
.cn-page-head > :last-child { justify-self: end; }
.cn-page-body { display: flex; flex-direction: column; gap: 12px; padding: 14px 2px 8px; }
.cn-title { display: flex; flex-direction: column; gap: 2px; }
#modal .cn-title h3 { margin: 0; font-size: 24px; font-weight: 700; color: #231a10; }
.cn-title span { font-size: 14px; color: #5c4a30; }
#modal button.cn-headcard { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 64px !important; padding: 10px 12px; border-radius: 16px; border: 1.5px solid #c18a2a; background: #fbf7ec; box-shadow: none; color: #231a10; text-align: left; cursor: pointer; }
.cn-head-face { position: relative; flex-shrink: 0; }
.cn-crown { position: absolute; right: -4px; bottom: -4px; display: grid; place-items: center; width: 22px; height: 22px; border-radius: 999px; background: #c18a2a; color: #1f1712; }
.cn-kicker { font-size: 12px !important; font-weight: 700; color: #845c0f !important; }
.cn-group { display: flex; flex-direction: column; gap: 6px; }
.cn-group-head { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 700; }
.cn-group-head i { width: 10px; height: 10px; flex-shrink: 0; border-radius: 999px; }
.cn-group-head span { margin-left: auto; font-weight: 500; color: #5c4a30; }
.cn-list { overflow: hidden; border-radius: 14px; border: 1px solid #ddd0ab; background: #efe4c3; }
#modal button.cn-row { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 56px !important; padding: 6px 12px; border: 0; border-top: 1px solid #ddd0ab; border-radius: 0; background: none; box-shadow: none; color: #231a10; text-align: left; cursor: pointer; }
#modal button.cn-row:first-child { border-top: 0; }
#modal button.cn-row > .cx-icon { flex-shrink: 0; color: #6e5b40; }
#modal button.cn-fold { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 52px !important; padding: 6px 12px; border-radius: 14px; border: 1px solid #ddd0ab; background: #efe4c3; box-shadow: none; color: #3d2f1d; text-align: left; cursor: pointer; }
.cn-pile { display: flex; flex-shrink: 0; }
.cn-pile .cn-face { border: 2px solid #efe4c3; }
.cn-pile .cn-face + .cn-face { margin-left: -10px; }
.cn-fold-names { flex: 1 1 auto; min-width: 0; overflow: hidden; font-size: 14px; text-overflow: ellipsis; white-space: nowrap; }
.cn-fold b { flex-shrink: 0; font-size: 14px; color: #845c0f; }
.cn-empty { display: flex; flex-direction: column; gap: 12px; padding: 14px; border-radius: 16px; border: 1px dashed #b9a77f; }
.cn-empty p { margin: 0; font-size: 14px; line-height: 1.45; color: #3d2f1d; }

/* A lord (Member) and Add */
.cn-sheet { gap: 14px; }
.cn-member { display: flex; flex-direction: column; gap: 14px; }
.cn-member-top { display: flex; align-items: center; gap: 14px; }
.cn-member-name { font-size: 22px !important; }
.cn-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 2px; }
.cn-chip-tag { padding: 2px 10px; border-radius: 999px; border: 1px solid #b9a77f; font-size: 12px; font-weight: 700; color: #3d2f1d; }
.cn-chip-tag.is-head { border-color: #c18a2a; background: #c18a2a; color: #1f1712; }
.cn-chip-tag.is-warn { border-color: #e3b8ab; background: #f6e1db; color: #8a2f20; }
.cn-field { display: flex; flex-direction: column; gap: 8px; margin: 0; padding: 0; border: 0; }
.cn-field legend { margin-bottom: 8px; padding: 0; font-size: 14px; font-weight: 700; color: #231a10; }
.cn-segs { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 4px; padding: 4px; border-radius: 14px; background: #e8dbb6; }
.cn-seg { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; min-height: 52px; padding: 6px 2px; border-radius: 10px; font-size: 12px; font-weight: 600; color: #5c4a30; cursor: pointer; }
.cn-seg input { position: absolute; opacity: 0; pointer-events: none; }
.cn-seg i { width: 12px; height: 12px; border-radius: 999px; }
.cn-seg.is-on { background: #fbf7ec; box-shadow: 0 1px 2px rgba(0,0,0,.12); font-weight: 700; color: #231a10; }
.cn-seg:focus-within { outline: 2px solid #845c0f; outline-offset: 1px; }
.cn-add .cn-seg { min-height: 44px; }
.cn-switch-row { position: relative; display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 14px; background: #efe4c3; cursor: pointer; }
.cn-switch-row input { position: absolute; opacity: 0; pointer-events: none; }
.cn-switch { position: relative; flex-shrink: 0; width: 52px; height: 32px; border-radius: 999px; background: #b9a77f; transition: background .15s; }
.cn-switch::after { content: ""; position: absolute; left: 3px; top: 3px; width: 26px; height: 26px; border-radius: 999px; background: #fbf7ec; transition: transform .15s; }
.cn-switch-row input:checked + .cn-switch { background: #845c0f; }
.cn-switch-row input:checked + .cn-switch::after { transform: translateX(20px); }
.cn-switch-row:focus-within { outline: 2px solid #845c0f; outline-offset: 1px; }
.cn-actions { display: flex; gap: 10px; }
.cn-actions .cn-btn { flex: 1 1 0; }
.cn-find { display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 0 12px; border-radius: 12px; border: 1px solid #b9a77f; background: #fbf7ec; color: #5c4a30; }
#modal .cn-find input { flex: 1; min-height: 0; padding: 0; border: 0; background: none; box-shadow: none; font: inherit; font-size: 16px; color: #231a10; outline: none; }
.cn-label { font-size: 13px; font-weight: 700; color: #5c4a30; }
.cn-pick-list { max-height: 300px; overflow-y: auto; }
.cn-tick { flex-shrink: 0; color: transparent; }
#modal button.cn-pick.is-on { background: #fbf7ec; }
#modal button.cn-pick.is-on .cn-tick { color: #2f6b3f; }

@layer editor-pilot {
  @media (max-width: 699px) {
    .modal-backdrop.active:has(> #modal .cn-page) { align-items: stretch !important; padding: 0 !important; }
    #modal:has(.cn-page) { width: 100% !important; max-width: none !important; max-height: none !important; min-height: 100% !important; margin: 0 !important; border-radius: 0 !important; }
  }
}

/* Desktop (design/council/Desktop): five columns beside the chosen lord */
#modal:has(.cn-desk) { width: min(1120px, calc(100vw - 48px)); max-width: none; }
.cn-desk-head { display: flex; align-items: center; gap: 14px; padding: 0 2px 12px; border-bottom: 1px solid #ddd0ab; }
#modal .cn-desk-head h3 { margin: 0; font-size: 22px; font-weight: 700; color: #231a10; }
.cn-desk-head > span { font-size: 14px; color: #5c4a30; }
.cn-desk-head .cn-spacer { flex: 1; }
.cn-desk-body { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 20px; padding-top: 16px; }
.cn-board, .cn-side { display: flex; flex-direction: column; gap: 12px; padding: 16px; border-radius: 16px; border: 1px solid #ddd0ab; background: #efe4c3; }
.cn-cols { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; }
.cn-col { display: flex; flex-direction: column; gap: 8px; min-height: 140px; padding: 6px; border-radius: 12px; }
.cn-col:hover { background: rgba(255,255,255,.25); }
.cn-col-head { font-size: 13px; }
#modal button.cn-chip { display: flex; align-items: center; gap: 4px; min-height: 40px !important; padding: 8px; border-radius: 10px; border: 1px solid transparent; background: #f4ecd8; box-shadow: none; color: #231a10; font-size: 13px; font-weight: 600; text-align: left; overflow-wrap: anywhere; cursor: grab; }
#modal button.cn-chip.is-head { border-color: #c18a2a; }
#modal button.cn-chip.is-on { border-color: #845c0f; background: #fbf7ec; font-weight: 700; }
#modal button.cn-chip .cx-icon { flex-shrink: 0; color: #845c0f; }
/* Fixes from the first screenshots */
.cn-seg { font-size: 11px; letter-spacing: -.01em; padding: 6px 0; }
#modal p.cn-note { font-size: 13px; }
.cn-switch-row .cn-row-text small { font-weight: 400; }
#modal .cn-actions button.cn-btn { padding: 0 10px; font-size: 14px; }
#screen-codex .cn-card .cn-balance-line b, #screen-codex .cn-card .cn-card-text small { font-size: 13px; }
#screen-codex .cn-card .cn-card-text b { font-size: 16px; }
