/* ==========================================================================
   BREAD & BROADSWORD - ALLIANCE SYSTEM: GRAND BASTION STYLES
   Layout Architecture: Grand Royal Bastion (Tabbed Citadel)
   ========================================================================== */

/* Main Container */
.alliance-window {
  width: 100%;
  max-width: 1320px;
  margin: 0 auto;
}

.alliance-main-window {
  position: relative;
  background: #fbf5e8;
  border: 2px solid #5a3d1b;
  border-radius: 4px;
  box-shadow: 0 10px 35px rgba(0, 0, 0, 0.45);
  overflow: hidden;
  font-family: var(--font-primary, 'Marcellus', serif);
}

.alliance-window-body {
  padding: 0;
  background: #f4ebd9;
}

.alliance-bastion-root {
  display: flex;
  flex-direction: column;
}

/* --------------------------------------------------------------------------
   HERO BANNER & CREST
   -------------------------------------------------------------------------- */
.bastion-hero-banner {
  position: relative;
  min-height: 105px;
  background-image: url('assets/banner_alliance.jpg');
  background-size: cover;
  background-position: center 30%;
  border-bottom: 2px solid #8e6d3a;
  box-shadow: inset 0 -20px 30px rgba(0, 0, 0, 0.7);
}

.bastion-hero-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(16, 9, 3, 0.90) 0%, rgba(20, 11, 4, 0.72) 55%, rgba(16, 9, 3, 0.88) 100%);
}

.bastion-hero-content {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 22px;
}

.bastion-shield-emblem {
  width: 62px;
  height: 74px;
  background: linear-gradient(180deg, #781c1c 0%, #3e0c0c 100%);
  border: 2.5px solid #d4a753;
  border-radius: 4px 4px 34px 34px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.6);
  flex-shrink: 0;
}

.bastion-shield-emblem .crest-sigil {
  font-size: 26px;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.5));
}

.bastion-shield-emblem .crest-tag {
  font-family: 'Cinzel', serif;
  font-size: 11px;
  font-weight: 900;
  color: #ffd984;
  letter-spacing: 0.8px;
}

.bastion-identity {
  flex: 1;
}

.bastion-super {
  font-family: 'Cinzel', serif;
  font-size: 11.5px;
  font-weight: 800;
  color: #ffd984;
  letter-spacing: 1.5px;
}

.bastion-title {
  font-family: 'Cinzel', serif;
  margin: 1px 0 4px;
  font-size: 22px;
  font-weight: 900;
  color: #fff6e0;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.8);
}

.bastion-meta-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: #edd9c2;
  flex-wrap: wrap;
}

.bastion-meta-row strong {
  color: #ffdf85;
  font-weight: 800;
}

.bastion-meta-row .bm-sep {
  color: #8f6e3c;
  font-weight: 800;
}

.bastion-meta-row .bm-item.vault {
  background: rgba(56, 36, 12, 0.65);
  border: 1px solid #99783f;
  padding: 2px 8px;
  border-radius: 3px;
  color: #ffe6aa;
}

/* --------------------------------------------------------------------------
   CITADEL TABS BAR
   -------------------------------------------------------------------------- */
.bastion-tabs-bar {
  display: flex;
  background: #2a1608;
  border-bottom: 2px solid #7c5b2a;
}

.bastion-tab-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 13px 18px;
  background: transparent;
  border: none;
  border-right: 1px solid #4a2d12;
  color: #d3be9f;
  font-family: inherit;
  font-size: 14.5px;
  font-weight: 800;
  cursor: pointer;
  transition: all 0.15s ease;
}

.bastion-tab-btn:hover {
  background: rgba(212, 167, 83, 0.15);
  color: #fff;
}

.bastion-tab-btn.active {
  background: #f4ebd9;
  color: #2a1608;
  box-shadow: inset 0 3px 0 #b87c18;
}

.bastion-tab-btn .tab-badge {
  background: rgba(0, 0, 0, 0.35);
  padding: 3px 9px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 900;
}

.bastion-tab-btn.active .tab-badge {
  background: #3a220e;
  color: #ffd984;
}

.bastion-tab-body {
  padding: 22px 26px;
}

/* --------------------------------------------------------------------------
   TAB 1: BASTION & LEVELING (CONCISE GOLD VAULT)
   -------------------------------------------------------------------------- */
.bastion-leveling-card.concise {
  background: #fbf5e8;
  border: 2px solid #8e6d3a;
  border-radius: 4px;
  padding: 18px 22px;
  margin-bottom: 22px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.08);
}

.bl-header-concise {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 14px;
  margin-bottom: 14px;
}

.bl-title-group .bl-sub {
  font-size: 12.5px;
  font-weight: 800;
  color: #8c5b1e;
  letter-spacing: 1px;
  display: block;
}

.bl-title-group .bl-title {
  margin: 2px 0 0;
  font-size: 22px;
  font-weight: 900;
  color: #2c1706;
}

.bl-concise-stats {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.bl-stat-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  background: #ede0c7;
  border: 1.5px solid #bba37a;
  padding: 6px 13px;
  border-radius: 3px;
  font-size: 13.5px;
}

.bl-stat-pill .bsp-label {
  color: #63472a;
  font-weight: 700;
}

.bl-stat-pill .bsp-val {
  color: #211105;
  font-weight: 900;
}

.bl-stat-pill.discount {
  background: #eaf5eb;
  border-color: #81c784;
}

.bl-stat-pill.discount .bsp-label {
  color: #2e7d32;
}

.bl-stat-pill.discount .bsp-val {
  color: #1e7039;
}

.bl-stat-pill.target {
  background: #fff3e0;
  border-color: #ffb74d;
}

.bl-stat-pill.target .bsp-label {
  color: #c25e00;
}

.bl-stat-pill.target .bsp-val {
  color: #b73200;
}

.bl-meter-wrap {
  position: relative;
  height: 25px;
  background: #d8c7a6;
  border: 1.5px solid #8e6d3a;
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 14px;
}

.bl-meter-bar {
  height: 100%;
  background: linear-gradient(90deg, #d4a753 0%, #ffcf68 100%);
  transition: width 0.4s ease;
}

.bl-meter-text {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 900;
  color: #211105;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.4);
}

/* Streamlined Quick Tithe Station */
.bl-quick-tithe-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  background: #ede0c7;
  border: 1.5px solid #bba37a;
  border-radius: 4px;
  padding: 10px 16px;
  margin-top: 10px;
}

.bqt-info {
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.bqt-label {
  font-size: 13px;
  font-weight: 700;
  color: #63472a;
}

.bqt-val {
  font-size: 15px;
  font-weight: 900;
  color: #8c5b1e;
}

.bqt-presets {
  display: flex;
  align-items: center;
  gap: 6px;
}

.bqt-preset-label {
  font-size: 12.5px;
  font-weight: 800;
  color: #63472a;
  margin-right: 2px;
}

.preset-chip {
  padding: 4px 12px;
  background: #fbf5e8;
  border: 1px solid #a8895b;
  border-radius: 3px;
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 800;
  color: #4a2c0f;
  cursor: pointer;
  transition: all 0.15s ease;
}

.preset-chip:hover {
  background: #edd9b9;
  border-color: #8c5b1e;
}

.preset-chip.active {
  background: linear-gradient(180deg, #381f0d 0%, #201005 100%);
  border-color: #d4a753;
  color: #ffd984;
}

.bqt-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.btn-royal-action {
  padding: 8px 18px;
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 800;
  border-radius: 3px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-gold-tithe {
  background: linear-gradient(180deg, #f7d27e 0%, #c48c26 100%);
  border: 1.5px solid #8a5a0f;
  color: #2b1704;
}

.btn-gold-tithe:hover {
  background: linear-gradient(180deg, #ffe094 0%, #db9e2e 100%);
  box-shadow: 0 2px 8px rgba(196, 140, 38, 0.5);
}

.btn-gold-tithe:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn-commission-level {
  background: linear-gradient(180deg, #3d2310 0%, #1f1107 100%);
  border: 1.5px solid #d4a753;
  color: #ffd984;
}

.btn-commission-level.ready {
  background: linear-gradient(180deg, #2e7d32 0%, #1b5e20 100%);
  border-color: #81c784;
  color: #ffffff;
}

/* --------------------------------------------------------------------------
   DOCTRINES SECTION (UNIFIED ROW ALIGNMENT)
   -------------------------------------------------------------------------- */
.bastion-doctrines-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  border-bottom: 1.5px solid #b89a69;
  padding-bottom: 8px;
}

.dh-title {
  margin: 0;
  font-size: 20px;
  font-weight: 900;
  color: #2b1706;
}

.dh-counter {
  display: flex;
  align-items: baseline;
  gap: 3px;
}

.dh-used { font-size: 24px; font-weight: 900; color: #b87c18; }
.dh-slash { font-size: 18px; color: #8e6d3a; }
.dh-total { font-size: 20px; font-weight: 800; color: #4a2c10; }
.dh-label { font-size: 12.5px; font-weight: 700; color: #6b4d2a; margin-left: 4px; }

.doctrines-grid-4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}

@media (max-width: 1150px) {
  .doctrines-grid-4 {
    grid-template-columns: repeat(2, 1fr);
  }
}

.doctrine-card {
  display: flex;
  flex-direction: column;
  background: #fbf5e8;
  border: 1.5px solid #a8895b;
  border-radius: 4px;
  padding: 12px 14px;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.05);
  box-sizing: border-box;
  gap: 8px;
}

.doctrine-card.invested {
  border-color: #c99c44;
  background: linear-gradient(180deg, #fffbee 0%, #f8eed6 100%);
}

.dc-top-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.dc-icon-frame {
  width: 52px;
  height: 52px;
  border-radius: 4px;
  border: 2px solid #8e682d;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
  overflow: hidden;
  flex-shrink: 0;
  background: #201107;
}

.doc-icon-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 2px;
  display: block;
  transform: scale(1.08);
}

.dc-name-block {
  flex: 1;
  min-width: 0;
}

.dc-name {
  margin: 0;
  font-size: 14.5px;
  font-weight: 900;
  color: #2b1706;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.25;
}

.dc-rank-badge {
  display: inline-block;
  background: #2a1608;
  color: #ffd984;
  font-size: 11px;
  font-weight: 900;
  padding: 2px 6px;
  border-radius: 2px;
  margin-bottom: 4px;
  white-space: nowrap;
}

.dc-pips-row {
  display: flex;
  gap: 4px;
}

.doc-pip {
  flex: 1;
  height: 5px;
  background: #d6c5a3;
  border: 1px solid #9c8052;
  border-radius: 2px;
}

.doc-pip.active {
  background: linear-gradient(90deg, #d4a753 0%, #ffd984 100%);
  border-color: #8a6015;
}

.dc-description-wrap {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.dc-description {
  margin: 0;
  font-size: 13px;
  line-height: 1.4;
  color: #3b2512;
}

.dc-applies-scope {
  font-size: 12px;
  color: #6e4e2a;
}

.dc-applies-scope strong {
  color: #241407;
}

.dc-current-buff {
  background: rgba(212, 167, 83, 0.15);
  border: 1px solid #d4a753;
  padding: 6px 10px;
  border-radius: 3px;
  font-size: 13px;
  color: #2a1608;
  display: flex;
  flex-direction: column;
}

.dc-current-buff .buff-tag {
  font-size: 11px;
  color: #7a501a;
  margin-bottom: 1px;
}

.dc-next-preview {
  font-size: 12px;
  color: #6d4f2c;
  border-top: 1px dashed #c4ad86;
  padding-top: 6px;
  margin-top: auto;
}

.dc-next-preview strong {
  color: #1e7039;
}

/* --------------------------------------------------------------------------
   TAB 2: FEUDAL ROSTER
   -------------------------------------------------------------------------- */
.roster-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  background: #ede0c7;
  border: 1px solid #bba37a;
  padding: 9px 16px;
  border-radius: 3px;
  font-size: 13.5px;
}

.rt-summary strong { color: #211105; }

.rt-military {
  display: flex;
  gap: 12px;
}

.mil-badge {
  padding: 4px 10px;
  border-radius: 3px;
  font-weight: 800;
  font-size: 13px;
}

.mil-badge.atk { background: #feebe8; border: 1px solid #e09589; color: #8f2010; }
.mil-badge.def { background: #eaf3ff; border: 1px solid #8cb6eb; color: #164f99; }

.roster-table-wrap {
  background: #fbf5e8;
  border: 1.5px solid #8e6d3a;
  border-radius: 4px;
  overflow-x: auto;
}

.roster-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

.roster-table th {
  background: linear-gradient(180deg, #381f0d 0%, #201005 100%);
  color: #fcefd6;
  font-size: 13px;
  font-weight: 800;
  text-align: left;
  padding: 10px 14px;
  border-bottom: 2px solid #8e6d3a;
}

.roster-table td {
  padding: 10px 14px;
  border-bottom: 1px solid #dec8a2;
  color: #2b1706;
}

.roster-table tr:hover {
  background: #f3e5ca;
}

.roster-table tr.is-you-row {
  background: #fff5db;
  font-weight: 700;
}

.member-name-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
}

.m-name { font-weight: 800; }

.you-tag {
  background: #b87c18;
  color: #fff;
  font-size: 10.5px;
  font-weight: 900;
  padding: 2px 6px;
  border-radius: 2px;
}

.title-badge {
  font-size: 12.5px;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: 3px;
}

.title-badge.grand-marshal { background: #ffeaae; border: 1px solid #d4a753; color: #5a3809; }
.title-badge.treasurer { background: #e3f2fd; border: 1px solid #90caf9; color: #0d47a1; }
.title-badge.peasant { background: #ece7de; border: 1px solid #b8b1a3; color: #4e483e; }

.spec-pill {
  font-size: 12px;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 2px;
}

.spec-pill.warrior { background: #fde8e5; color: #9c2717; }
.spec-pill.trader { background: #fef7e0; color: #8a6005; }
.spec-pill.farmer { background: #e8f5e9; color: #2e7d32; }

.lvl-cell { font-weight: 800; }
.pts-cell { font-weight: 800; color: #4a2d10; }
.pts-cell .sub-lvl { font-size: 12px; color: #785a3a; font-weight: 600; margin-left: 4px; }

.mil-cell {
  font-weight: 800;
  text-align: center;
  font-size: 13px;
  white-space: nowrap;
}

.mil-cell .mil-atk { color: #8f2010; font-weight: 800; }
.mil-cell .mil-sep { color: #9c8262; margin: 0 4px; }
.mil-cell .mil-def { color: #164f99; font-weight: 800; }

.status-orb {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  margin-right: 4px;
}

.status-orb.online { background: #2e7d32; }
.status-orb.away { background: #9e9e9e; }

.status-text { font-size: 12px; color: #555; }

.action-btn-group {
  display: flex;
  gap: 4px;
  justify-content: flex-end;
}

.btn-micro-action {
  font-family: inherit;
  font-size: 11.5px;
  font-weight: 800;
  padding: 4px 9px;
  background: #fbf5e8;
  border: 1px solid #8e6d3a;
  border-radius: 2px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-micro-action:hover {
  background: #e8d7b7;
}

.btn-roster-horn {
  background: linear-gradient(180deg, #b22e1b 0%, #751a0c 100%);
  border: 1px solid #5a1105;
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  padding: 4px 10px;
  border-radius: 3px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-roster-horn:hover {
  background: linear-gradient(180deg, #cc3b25 0%, #8f2312 100%);
}

/* --------------------------------------------------------------------------
   TAB 3: WAR & DIPLOMACY
   -------------------------------------------------------------------------- */
.war-active-card {
  background: #fbf5e8;
  border: 2px solid #b22222;
  border-radius: 4px;
  padding: 20px 24px;
  margin-bottom: 24px;
  box-shadow: 0 4px 14px rgba(178, 34, 34, 0.15);
}

.wac-badge {
  display: inline-block;
  background: #b22222;
  color: #fff;
  font-size: 12px;
  font-weight: 900;
  padding: 3px 10px;
  border-radius: 3px;
  letter-spacing: 0.5px;
  margin-bottom: 14px;
}

.wac-clash-header {
  display: flex;
  align-items: center;
  justify-content: space-around;
  margin-bottom: 20px;
  border-bottom: 1px solid #e0c8a6;
  padding-bottom: 16px;
}

.wac-side {
  text-align: center;
}

.wac-shield {
  font-size: 44px;
  margin-bottom: 4px;
}

.wac-name {
  font-family: 'Cinzel', serif;
  font-size: 20px;
  font-weight: 900;
  color: #211105;
}

.wac-rank {
  font-size: 13px;
  color: #634320;
}

.wac-vs {
  font-family: 'Cinzel', serif;
  font-size: 28px;
  font-weight: 900;
  color: #b22222;
  font-style: italic;
}

.war-metrics-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

.war-metric-box {
  background: #ede0c7;
  border: 1px solid #bba37a;
  border-radius: 3px;
  padding: 12px 16px;
}

.wm-title {
  font-size: 13.5px;
  font-weight: 800;
  color: #4a2c0f;
  margin-bottom: 8px;
}

.wm-split {
  display: flex;
  align-items: center;
  justify-content: space-around;
  margin-bottom: 10px;
}

.wm-side {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.wm-val {
  font-size: 22px;
  font-weight: 900;
}

.wm-side.our .wm-val { color: #1e7039; }
.wm-side.enemy .wm-val { color: #b22222; }

.wm-sub {
  font-size: 12px;
  color: #664f33;
}

.wm-div {
  font-size: 13.5px;
  font-weight: 800;
  color: #8c6a3e;
}

.wm-bar-wrap {
  display: flex;
  height: 8px;
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 8px;
}

.wm-bar.our { background: #2e7d32; }
.wm-bar.enemy { background: #b22222; }

.wm-footer {
  font-size: 12.5px;
  font-weight: 700;
  text-align: center;
}

.wm-footer.success { color: #1e7039; }
.wm-footer.alert { color: #8a3c0e; }

.pacts-title {
  margin: 0 0 12px;
  font-size: 18px;
  font-weight: 900;
  color: #2b1706;
}

.pacts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 14px;
}

.pact-card {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #fbf5e8;
  border: 1.5px solid #a8895b;
  border-radius: 4px;
  padding: 10px 14px;
}

.pc-crest { font-size: 26px; }

.pc-info { flex: 1; }
.pc-name { margin: 0; font-size: 15px; font-weight: 900; color: #211105; }
.pc-sub { font-size: 12px; color: #6d4f2c; }

.pc-status { text-align: right; }
.nap-badge {
  display: inline-block;
  background: #e8f5e9;
  border: 1px solid #81c784;
  color: #2e7d32;
  font-size: 11.5px;
  font-weight: 900;
  padding: 1px 6px;
  border-radius: 2px;
}
.pc-days { display: block; font-size: 12px; color: #555; margin-top: 2px; }

/* --------------------------------------------------------------------------
   TAB 4: ROYAL CHRONICLE (CLEAN READ-ONLY TIMELINE)
   -------------------------------------------------------------------------- */
.chronicle-timeline {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.chronicle-item {
  position: relative;
  background: #fbf5e8;
  border: 1px solid #d5c29f;
  border-left-width: 4px;
  border-radius: 3px;
  padding: 10px 14px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
}

.ci-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
  font-size: 12.5px;
}

.ci-cat { font-weight: 900; }
.ci-author { color: #4a2c0f; }
.ci-time { margin-left: auto; color: #777; font-size: 12px; }

.ci-body {
  font-size: 13.5px;
  color: #2c1706;
  line-height: 1.45;
}

/* --------------------------------------------------------------------------
   FOUND NEW ALLIANCE ENTRY BUTTON IN HERO BANNER
   -------------------------------------------------------------------------- */
.bastion-hero-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  align-self: center;
  z-index: 2;
  gap: 8px;
}

.btn-found-alliance-entry {
  display: flex;
  align-items: center;
  gap: 7px;
  background: linear-gradient(180deg, #781c1c 0%, #3e0c0c 100%);
  border: 1.5px solid #d4a753;
  border-radius: 3px;
  padding: 8px 14px;
  color: #ffd984;
  font-family: 'Cinzel', Georgia, serif;
  font-size: 12px;
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.45);
  transition: all 0.15s ease;
  letter-spacing: 0.5px;
}

.btn-found-alliance-entry:hover {
  background: linear-gradient(180deg, #992828 0%, #521212 100%);
  border-color: #ffe699;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.6);
}

.btn-leave-alliance {
  background: linear-gradient(180deg, #501717 0%, #2f0c0c 100%);
  border: 1px solid #9c3c3c;
  color: #ffc2c2;
  font-size: 11px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 3px;
  cursor: pointer;
  transition: all 0.12s ease;
}

.btn-leave-alliance:hover {
  background: linear-gradient(180deg, #782020 0%, #441010 100%);
  color: #ffffff;
  border-color: #ff6b6b;
}

.btn-header-back {
  background: #3b200b;
  border: 1px solid #8e682d;
  color: #ffd984;
  width: 26px;
  height: 26px;
  border-radius: 3px;
  cursor: pointer;
  font-size: 14px;
  line-height: 24px;
  text-align: center;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-header-back:hover {
  background: #542d0e;
  border-color: #ffd984;
}

/* --------------------------------------------------------------------------
   ALLIANCE DIRECTORY SCREEN (UNALLIED BROWSE & APPLY)
   -------------------------------------------------------------------------- */
.alliances-directory-root {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 16px;
  background: #f4ebd9;
  box-sizing: border-box;
}

.dir-hero-banner {
  position: relative;
  background: linear-gradient(180deg, #2b1708 0%, #150a04 100%);
  border: 1.5px solid #8e682d;
  border-radius: 4px;
  overflow: hidden;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4);
}

.dir-hero-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(16, 9, 3, 0.94) 0%, rgba(32, 17, 6, 0.85) 60%, rgba(16, 9, 3, 0.92) 100%);
  z-index: 1;
}

.dir-hero-content {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 18px 24px;
}

.dir-hero-text {
  flex: 1;
}

.dir-hero-tag {
  font-family: 'Cinzel', Georgia, serif;
  font-size: 11px;
  font-weight: 900;
  color: #ffd984;
  letter-spacing: 1.2px;
  display: block;
  margin-bottom: 4px;
}

.dir-hero-title {
  margin: 0;
  font-family: 'Cinzel', Georgia, serif;
  font-size: 20px;
  font-weight: 900;
  color: #fff4d1;
  letter-spacing: 0.6px;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.8);
}

.dir-hero-desc {
  margin: 5px 0 0 0;
  font-size: 13px;
  color: #d8c4a4;
  line-height: 1.4;
  max-width: 780px;
}

.dir-hero-action {
  flex-shrink: 0;
}

.btn-create-alliance-top {
  display: flex;
  align-items: center;
  gap: 8px;
  background: linear-gradient(180deg, #b8860b 0%, #7c5804 100%);
  border: 1.5px solid #ffe394;
  border-radius: 4px;
  padding: 11px 20px;
  color: #ffffff;
  font-family: 'Cinzel', Georgia, serif;
  font-size: 13.5px;
  font-weight: 900;
  letter-spacing: 0.8px;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
  transition: all 0.15s ease;
}

.btn-create-alliance-top:hover {
  background: linear-gradient(180deg, #d4a01c 0%, #8e6505 100%);
  border-color: #fff1b8;
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.65);
}

.dir-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  background: #ebdcc2;
  border: 1px solid #bba37a;
  border-radius: 4px;
  padding: 8px 14px;
}

.dir-search-wrap {
  flex: 1;
  max-width: 420px;
}

.dir-search-input {
  width: 100%;
  font-family: var(--font-primary, 'Marcellus', Georgia, serif);
  font-size: 13px;
  background: #fffcf5;
  border: 1px solid #9c7f53;
  border-radius: 3px;
  padding: 6px 12px;
  color: #2b1706;
  outline: none;
  box-sizing: border-box;
}

.dir-search-input:focus {
  border-color: #b8860b;
  box-shadow: 0 0 5px rgba(184, 134, 11, 0.3);
}

.dir-stats-wrap {
  font-size: 12.5px;
  color: #5c3c1a;
}

.dir-table-wrap {
  background: #fbf5e8;
  border: 1.5px solid #a8895b;
  border-radius: 4px;
  overflow: hidden;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.05);
}

.dir-table {
  width: 100%;
  border-collapse: collapse;
}

.dir-table th {
  background: #2a1608;
  color: #ffd984;
  font-family: 'Cinzel', Georgia, serif;
  font-size: 11.5px;
  font-weight: 900;
  padding: 10px 14px;
  border-right: 1px solid #4a2d12;
  letter-spacing: 0.6px;
  text-align: left;
}

.dir-table th:last-child {
  border-right: none;
}

.dir-table td {
  padding: 10px 14px;
  border-bottom: 1px solid #e2d1b0;
  vertical-align: middle;
  font-size: 13px;
  color: #2b1706;
}

.dir-table tr:nth-child(even) td {
  background: rgba(42, 22, 8, 0.025);
}

.dir-table tr:hover td {
  background: rgba(212, 167, 83, 0.12);
}

.col-crest {
  text-align: center;
  padding: 6px 10px;
}

.dir-tag-name {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 3px;
}

.dir-tag {
  font-family: 'Cinzel', Georgia, serif;
  font-size: 11px;
  font-weight: 900;
  color: #ffd984;
  background: #2b1706;
  padding: 2px 6px;
  border-radius: 2px;
}

.dir-name {
  font-size: 14.5px;
  font-weight: 900;
  color: #2b1706;
}

.dir-meta {
  font-size: 12px;
  color: #6d4f2c;
  display: flex;
  align-items: center;
  gap: 6px;
}

.dir-meta strong {
  color: #3b220c;
}

.dir-sep {
  color: #bfa57b;
}

.dir-motto {
  font-style: italic;
  color: #7a5830;
}

.dir-lvl-badge {
  display: inline-block;
  background: #3b220d;
  color: #ffd984;
  font-size: 11px;
  font-weight: 900;
  padding: 2px 7px;
  border-radius: 2px;
}

.dir-mem-count strong {
  color: #211105;
}

.dir-power-val {
  font-weight: 700;
  color: #7a3a0e;
}

.btn-dir-apply {
  background: linear-gradient(180deg, #3e220f 0%, #201006 100%);
  border: 1px solid #a8813a;
  color: #ffd984;
  font-family: 'Cinzel', Georgia, serif;
  font-size: 12px;
  font-weight: 900;
  padding: 6px 16px;
  border-radius: 3px;
  cursor: pointer;
  transition: all 0.12s ease;
  letter-spacing: 0.5px;
  box-shadow: 0 2px 5px rgba(0,0,0,0.3);
}

.btn-dir-apply:hover {
  background: linear-gradient(180deg, #613719 0%, #361c0c 100%);
  border-color: #ffd984;
  transform: translateY(-1px);
  box-shadow: 0 3px 8px rgba(0,0,0,0.45);
}

.btn-dir-applied {
  background: #d8c7a6;
  border: 1px solid #9c8056;
  color: #553e20;
  font-size: 11px;
  font-weight: 700;
  padding: 5px 12px;
  border-radius: 3px;
  cursor: default;
}

/* --------------------------------------------------------------------------
   APPLY FOR ALLIANCE MODAL POPUP
   -------------------------------------------------------------------------- */
.apply-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(12, 6, 2, 0.75);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  backdrop-filter: blur(2px);
}

.apply-modal-card {
  width: 100%;
  max-width: 500px;
  background: #fbf5e8;
  border: 2px solid #5a3d1b;
  border-radius: 5px;
  box-shadow: 0 10px 35px rgba(0, 0, 0, 0.7);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.am-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #2a1608;
  border-bottom: 2px solid #8e682d;
  padding: 12px 18px;
}

.am-title {
  margin: 0;
  font-family: 'Cinzel', Georgia, serif;
  font-size: 16px;
  font-weight: 900;
  color: #ffd984;
}

.am-subtitle {
  font-size: 11.5px;
  color: #cfbe9e;
  display: block;
}

.am-close-btn {
  background: transparent;
  border: none;
  color: #ffd984;
  font-size: 16px;
  cursor: pointer;
  padding: 4px 8px;
}

.am-close-btn:hover {
  color: #ffffff;
}

.am-alliance-preview {
  display: flex;
  align-items: center;
  gap: 14px;
  background: linear-gradient(180deg, #ede0c6 0%, #e2d2b0 100%);
  border-bottom: 1px solid #baa27c;
  padding: 12px 18px;
}

.am-crest {
  width: 48px;
  height: 58px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.am-all-name {
  font-family: 'Cinzel', Georgia, serif;
  font-size: 15px;
  font-weight: 900;
  color: #2b1706;
}

.am-all-meta {
  font-size: 12px;
  color: #63431f;
  margin-top: 2px;
}

.am-body {
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.am-label {
  font-size: 12.5px;
  font-weight: 700;
  color: #3b220d;
}

.apply-message-input {
  width: 100%;
  font-family: var(--font-primary, 'Marcellus', Georgia, serif);
  font-size: 13px;
  background: #fffcf5;
  border: 1px solid #9c7f53;
  border-radius: 3px;
  padding: 8px 10px;
  color: #2b1706;
  resize: vertical;
  box-sizing: border-box;
}

.apply-message-input:focus {
  border-color: #b8860b;
  outline: none;
}

.am-hint {
  font-size: 11.5px;
  color: #7a5830;
  line-height: 1.35;
}

.am-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  background: #ebdcc2;
  border-top: 1px solid #baa27c;
  padding: 10px 18px;
}

.btn-am-cancel {
  background: transparent;
  border: 1px solid #9c8056;
  color: #553a1f;
  font-size: 12px;
  font-weight: 700;
  padding: 6px 14px;
  border-radius: 3px;
  cursor: pointer;
}

.btn-am-cancel:hover {
  background: #ded0b4;
}

.btn-am-submit {
  display: flex;
  align-items: center;
  gap: 6px;
  background: linear-gradient(180deg, #b8860b 0%, #7c5804 100%);
  border: 1px solid #ffe394;
  color: #ffffff;
  font-family: 'Cinzel', Georgia, serif;
  font-size: 12.5px;
  font-weight: 900;
  padding: 7px 16px;
  border-radius: 3px;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
}

.btn-am-submit:hover {
  background: linear-gradient(180deg, #d4a01c 0%, #8e6505 100%);
  border-color: #fff1b8;
}

/* --------------------------------------------------------------------------
   CREATE ALLIANCE SCREEN (HERALDRY ATELIER & CHARTER CONSECRATION)
   -------------------------------------------------------------------------- */
.create-alliance-root {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 16px;
  background: #f4ebd9;
  box-sizing: border-box;
}

.ca-header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: linear-gradient(180deg, #361f0e 0%, #1e0f06 100%);
  border: 1.5px solid #8e682d;
  border-radius: 4px;
  padding: 12px 18px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.45);
}

.ca-hb-title-block {
  flex: 1;
}

.ca-main-title {
  margin: 0;
  font-family: 'Cinzel', Georgia, serif;
  font-size: 19px;
  font-weight: 900;
  color: #ffd984;
  letter-spacing: 0.8px;
  text-shadow: 0 2px 4px rgba(0,0,0,0.8);
}

.ca-main-sub {
  margin: 3px 0 0 0;
  font-size: 12.5px;
  color: #d1bfa0;
  line-height: 1.35;
}

.ca-btn-return {
  background: #45260f;
  border: 1px solid #9c783c;
  border-radius: 3px;
  color: #ffe6a3;
  font-family: 'Cinzel', Georgia, serif;
  font-size: 12px;
  font-weight: 700;
  padding: 7px 14px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.ca-btn-return:hover {
  background: #5e3415;
  border-color: #ffd984;
}

.ca-columns-grid {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 16px;
  align-items: start;
}

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

.ca-panel-box {
  background: #fbf5e8;
  border: 1.5px solid #a8895b;
  border-radius: 4px;
  padding: 16px;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.05);
  box-sizing: border-box;
}

.ca-panel-title {
  margin: 0 0 12px 0;
  font-family: 'Cinzel', Georgia, serif;
  font-size: 16px;
  font-weight: 900;
  color: #2b1706;
  border-bottom: 1px solid #d5c29f;
  padding-bottom: 8px;
}

.ca-panel-desc {
  margin: 0 0 14px 0;
  font-size: 12.5px;
  line-height: 1.4;
  color: #553a1f;
}

/* Left Column: Live Showcase */
.ca-live-showcase {
  display: flex;
  align-items: center;
  gap: 16px;
  background: linear-gradient(180deg, #eee3cb 0%, #e2d2b1 100%);
  border: 1px solid #bba175;
  border-radius: 4px;
  padding: 14px;
  margin-bottom: 14px;
  box-shadow: inset 0 1px 3px rgba(0,0,0,0.06);
}

.ca-live-shield-wrap {
  width: 110px;
  height: 132px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ca-live-identity {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ca-input-group {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.ca-input-group label {
  font-size: 11.5px;
  font-weight: 700;
  color: #63431e;
  letter-spacing: 0.3px;
}

.ca-text-input {
  font-family: var(--font-primary, 'Marcellus', Georgia, serif);
  font-size: 13.5px;
  color: #2b1706;
  background: #fffcf5;
  border: 1px solid #9c7f53;
  border-radius: 3px;
  padding: 6px 10px;
  box-sizing: border-box;
  outline: none;
  transition: border-color 0.15s ease;
}

.ca-text-input:focus {
  border-color: #b8860b;
  box-shadow: 0 0 5px rgba(184, 134, 11, 0.3);
}

.ca-tag-input {
  text-transform: uppercase;
  font-weight: 900;
  letter-spacing: 1.5px;
  font-family: 'Cinzel', Georgia, serif;
}

.ca-input-row {
  display: flex;
  gap: 10px;
}

.input-tag-group {
  width: 110px;
  flex-shrink: 0;
}

.input-motto-group {
  flex: 1;
}

/* Customizer Sections */
.ca-customizer-section {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px dashed #cbb692;
}

.ca-sec-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.ca-sec-title {
  font-size: 12.5px;
  font-weight: 900;
  color: #2e1807;
  font-family: 'Cinzel', Georgia, serif;
}

.ca-sec-count {
  font-size: 11px;
  color: #7a5a32;
}

/* Shapes Grid (20 Shapes) */
.ca-shapes-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
  max-height: 200px;
  overflow-y: auto;
  padding: 6px;
  background: #e8d9bd;
  border: 1px solid #bca377;
  border-radius: 4px;
}

.ca-shape-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 5px 3px;
  background: #fbf5e8;
  border: 1px solid #bda57b;
  border-radius: 3px;
  cursor: pointer;
  transition: all 0.15s ease;
  box-sizing: border-box;
}

.ca-shape-card:hover {
  background: #fffdf8;
  border-color: #8c651e;
}

.ca-shape-card.active {
  background: #fff8e3;
  border: 2px solid #b8860b;
  box-shadow: 0 0 8px rgba(212, 167, 83, 0.7);
}

.ca-sc-preview {
  display: flex;
  align-items: center;
  justify-content: center;
}

.ca-sc-name {
  font-size: 9px;
  font-weight: 700;
  color: #3b220c;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  line-height: 1.1;
}

/* Tinctures & Metals Swatches */
.ca-swatches-grid, .ca-metals-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.ca-color-swatch, .ca-metal-swatch {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  background: #f4e8d3;
  border: 1px solid #bba277;
  border-radius: 3px;
  cursor: pointer;
  transition: all 0.12s ease;
}

.ca-color-swatch:hover, .ca-metal-swatch:hover {
  background: #fffbf2;
  border-color: #8c651e;
}

.ca-color-swatch.active, .ca-metal-swatch.active {
  background: #fff6db;
  border: 1.5px solid #b8860b;
  box-shadow: 0 0 6px rgba(184, 134, 11, 0.4);
}

.swatch-circle {
  width: 15px;
  height: 15px;
  border-radius: 50%;
  border: 1px solid rgba(0,0,0,0.35);
  box-shadow: inset 0 1px 2px rgba(255,255,255,0.4);
}

.swatch-label {
  font-size: 11px;
  font-weight: 700;
  color: #38200d;
}

/* Charges Grid (20 Icons) */
.ca-charges-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
  max-height: 200px;
  overflow-y: auto;
  padding: 6px;
  background: #e8d9bd;
  border: 1px solid #bca377;
  border-radius: 4px;
}

.ca-charge-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 5px 3px;
  background: #fbf5e8;
  border: 1px solid #bda57b;
  border-radius: 3px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.ca-charge-card:hover {
  background: #fffdf8;
  border-color: #8c651e;
}

.ca-charge-card.active {
  background: #fff8e3;
  border: 2px solid #b8860b;
  box-shadow: 0 0 8px rgba(212, 167, 83, 0.7);
}

.ca-charge-icon-wrap {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ca-charge-img {
  width: 32px;
  height: 32px;
  object-fit: contain;
  border-radius: 3px;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.5));
}

.ca-charge-symbol {
  font-size: 20px;
  line-height: 1.2;
}

.ca-charge-name {
  font-size: 9px;
  font-weight: 700;
  color: #3b220c;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

/* Right Column: Doctrines Picker */
.ca-doctrines-picker {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 16px;
}

.ca-doctrine-card {
  background: #f8f1e2;
  border: 1.5px solid #bda37a;
  border-radius: 4px;
  padding: 10px 12px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.ca-doctrine-card:hover {
  background: #fffbf3;
  border-color: #8a6015;
}

.ca-doctrine-card.selected {
  background: linear-gradient(180deg, #fffcf5 0%, #f6ebd0 100%);
  border: 2px solid #c99c44;
  box-shadow: 0 3px 10px rgba(184, 134, 11, 0.25);
}

.cad-header {
  display: flex;
  align-items: center;
  gap: 10px;
}

.cad-icon-frame {
  width: 44px;
  height: 44px;
  border-radius: 3px;
  border: 1.5px solid #8e682d;
  background: #201107;
  overflow: hidden;
  flex-shrink: 0;
}

.cad-info {
  flex: 1;
  min-width: 0;
}

.cad-badge {
  font-size: 10.5px;
  font-weight: 700;
  color: #7a501a;
  display: block;
}

.cad-title {
  margin: 0;
  font-size: 14px;
  font-weight: 900;
  color: #2b1706;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cad-radio-indicator {
  font-family: 'Cinzel', Georgia, serif;
  font-size: 10.5px;
  font-weight: 900;
  padding: 3px 8px;
  border-radius: 2px;
  background: #3b220d;
  color: #ffd984;
  white-space: nowrap;
}

.ca-doctrine-card.selected .cad-radio-indicator {
  background: #b8860b;
  color: #ffffff;
  box-shadow: 0 0 6px rgba(184, 134, 11, 0.5);
}

.cad-body {
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.cad-scope-line {
  font-size: 11.5px;
  color: #6e4e2a;
}

.cad-scope-line strong {
  color: #241407;
}

.cad-desc {
  margin: 0;
  font-size: 12.5px;
  line-height: 1.35;
  color: #3b2512;
}

.cad-bonus-box {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(212, 167, 83, 0.16);
  border: 1px solid #d4a753;
  padding: 5px 8px;
  border-radius: 3px;
  font-size: 12px;
  color: #2b1706;
  margin-top: 2px;
}

.cbb-tag {
  color: #7a501a;
  font-size: 11px;
}

.cbb-val {
  color: #1e7039;
  font-weight: 900;
}

/* Right Column: Seal & Consecrate Box */
.ca-seal-box {
  background: linear-gradient(180deg, #2b1709 0%, #170b04 100%);
  border: 2px solid #9c783c;
  border-radius: 4px;
  padding: 14px 16px;
  color: #ffd984;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.5);
}

.csb-row {
  display: flex;
  justify-content: space-between;
  font-size: 12.5px;
  margin-bottom: 6px;
}

.csb-label {
  color: #cfbe9e;
}

.csb-val {
  color: #ffd984;
  font-weight: 700;
}

.csb-action-row {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px dashed rgba(212, 167, 83, 0.4);
}

.btn-ca-found {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 14px;
  padding: 13px 18px;
  background: linear-gradient(180deg, #b8860b 0%, #7c5804 100%);
  border: 1.5px solid #ffe394;
  border-radius: 4px;
  color: #ffffff;
  font-family: 'Cinzel', Georgia, serif;
  font-size: 14px;
  font-weight: 900;
  letter-spacing: 0.8px;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
  transition: all 0.15s ease;
}

.btn-ca-found:hover {
  background: linear-gradient(180deg, #d4a01c 0%, #8e6505 100%);
  border-color: #fff1b8;
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.65);
}
