/* Sect hub dialogs (Techniques, Buildings, Elders, Missions, Recruitment, Army, Inventory, Shop).
   Shared primitives use the sh- prefix; they sit on top of the sect-* design system. */
.sh {
    display: flex;
    flex-direction: column;
    gap: var(--sp-3, 12px);
    padding: var(--sp-3, 12px);
    max-height: 75vh;
    overflow-y: auto;
}

/* Hero / summary */
.sh-hero {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 12px 14px;
    background: radial-gradient(ellipse at 0% 0%, rgba(255, 215, 0, 0.10), transparent 65%), var(--sect-surface-2, rgba(0, 0, 0, 0.25));
    border: 1px solid rgba(255, 215, 0, 0.35);
    border-radius: var(--r-md, 8px);
}
.sh-hero__row { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.sh-hero__title { margin: 0; font-size: 1.05em; font-weight: 700; color: var(--ui-gold, #ffd700); }
.sh-hero__chips { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.sh-hint { margin: 0; font-size: 0.82em; line-height: 1.45; color: var(--sect-text-dim, #9ca3af); }
.sh-bar { height: 6px; border-radius: 999px; background: rgba(255, 255, 255, 0.08); overflow: hidden; }
.sh-bar > i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--ui-teal, #4ecdc4), #9be7df); }
.sh-bar--gold > i { background: linear-gradient(90deg, #b8860b, var(--ui-gold, #ffd700)); }

/* Cards */
.sh-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr)); gap: var(--sp-3, 12px); }
.sh-card {
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-width: 0;
    padding: 12px;
    background: var(--sect-surface-2, rgba(0, 0, 0, 0.25));
    border: 1px solid var(--sect-border, #333);
    border-radius: var(--r-md, 8px);
    transition: border-color 0.15s ease;
}
.sh-card--active { border-color: rgba(78, 205, 196, 0.45); }
.sh-card--active:hover { border-color: var(--ui-teal, #4ecdc4); }
.sh-card--locked { align-items: center; justify-content: center; gap: 4px; min-height: 120px; text-align: center; border-style: dashed; background: transparent; }
.sh-card__head { display: flex; align-items: center; gap: 8px; }
.sh-card__body { display: flex; flex-direction: column; gap: 6px; }
.sh-card__foot { display: flex; flex-direction: column; gap: 8px; padding-top: 10px; border-top: 1px solid rgba(255, 255, 255, 0.08); }
.sh-badge {
    flex: 0 0 auto; min-width: 24px; height: 24px; padding: 0 8px; display: inline-grid; place-items: center;
    font-size: 11px; font-weight: 700; color: #04201d; background: var(--ui-teal, #4ecdc4); border-radius: 999px;
}
.sh-badge--gold { color: #231a00; background: var(--ui-gold, #ffd700); }
.sh-input {
    flex: 1 1 auto; min-width: 0; padding: 5px 9px; font-family: inherit; font-size: 0.92em; font-weight: 700;
    color: var(--sect-text, #fff); background: transparent; border: 1px solid transparent; border-radius: var(--r-sm, 6px);
}
.sh-input:hover { border-color: var(--sect-border-strong, #444); }
.sh-input:focus { outline: none; border-color: var(--ui-teal, #4ecdc4); background: var(--sect-surface-1, rgba(0, 0, 0, 0.4)); }
.sh-label { font-size: 11px; font-weight: 700; letter-spacing: 0.7px; text-transform: uppercase; color: var(--sect-text-dim, #9ca3af); }
.sh-meta { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; font-size: 0.85em; color: var(--sect-text-dim, #9ca3af); }
.sh-meta b { color: var(--sect-text, #fff); font-size: 1.05em; }
.sh-meta span:last-child { font-variant-numeric: tabular-nums; }

.sh-list { display: flex; flex-direction: column; gap: 2px; }
.sh-line { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 4px 0; font-size: 0.85em; color: var(--sect-text, #ddd); }
.sh-pills { display: flex; flex-wrap: wrap; gap: 4px; }
.sh-muted { font-size: 0.85em; color: var(--sect-text-dim, #9ca3af); }
.sh-locked-title { font-size: 0.95em; font-weight: 700; color: var(--sect-text, #ddd); }
.sh-lock { font-size: 1.4em; opacity: 0.6; }
.sh-kbd { padding: 0 6px; font-size: 0.9em; background: rgba(255, 255, 255, 0.08); border: 1px solid var(--sect-border, #333); border-radius: 4px; }
.sh-kbds { display: flex; flex-wrap: wrap; gap: 6px 12px; font-size: 0.8em; color: var(--sect-text-dim, #9ca3af); }

/* Empty state */
.sh-empty { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 28px 12px; text-align: center; border: 1px dashed var(--sect-border, #333); border-radius: var(--r-md, 8px); color: var(--sect-text-dim, #9ca3af); }
.sh-empty__icon { font-size: 1.8em; opacity: 0.6; }
.sh-empty__title { font-weight: 700; color: var(--sect-text, #ddd); }
.sh-empty__text { font-size: 0.85em; max-width: 42ch; }

/* Buff rows (Techniques edit) */
.sh-buff { display: flex; flex-direction: column; gap: 6px; padding: 8px 2px; border-bottom: 1px solid rgba(255, 255, 255, 0.05); }
.sh-buff:last-child { border-bottom: 0; }
.sh-buff__name { font-size: 0.92em; line-height: 1.3; color: var(--sect-text, #fff); overflow-wrap: anywhere; }
.sh-buff__row { display: flex; align-items: center; gap: 8px; }
.sh-buff__pts { margin-left: auto; font-size: 0.8em; color: var(--sect-text-dim, #9ca3af); white-space: nowrap; }

@media (max-width: 520px) { .sh-grid { grid-template-columns: 1fr; } }
.sh-grid--narrow { grid-template-columns: repeat(auto-fill, minmax(min(240px, 100%), 1fr)); }
.sh-label--gold { color: var(--ui-gold, #ffd700); }
.sh .sect-segment__btn { min-width: 34px; }

/* Buildings */
.sh--fill { max-height: none; height: 100%; }
.sh-resources { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-3, 12px); }
.sh-resource { display: flex; flex-direction: column; gap: 2px; padding: 10px 14px; background: var(--sect-surface-2, rgba(0, 0, 0, 0.25)); border: 1px solid var(--sect-border, #333); border-radius: var(--r-md, 8px); }
.sh-resource__value { font-size: 1.3em; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--sect-text, #fff); }
.sh-resource__value--gold { color: var(--ui-gold, #ffd700); }
.sh-card__title { font-size: 1.02em; font-weight: 700; color: var(--sect-text, #fff); }
.sh-card__head { justify-content: space-between; }
.sh-card__row { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.sh-card--max { border-color: rgba(255, 215, 0, 0.45); background: linear-gradient(180deg, rgba(255, 215, 0, 0.06), transparent); }
.sh-effects { display: flex; flex-direction: column; gap: 6px; padding: 8px 10px; background: rgba(0, 0, 0, 0.18); border-radius: var(--r-sm, 6px); font-size: 0.88em; }
.sh-effect { display: grid; grid-template-columns: 44px minmax(0, 1fr); gap: 8px; align-items: baseline; color: var(--sect-text-dim, #9ca3af); }
.sh-effect--next { color: var(--ui-gold, #ffd700); }
.sh-costs { display: flex; flex-wrap: wrap; gap: 8px; }
.sh-cost { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; font-size: 0.85em; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--sect-text-dim, #9ca3af); background: var(--sect-surface-1, rgba(0, 0, 0, 0.3)); border: 1px solid var(--sect-border, #333); border-radius: 999px; }
.sh-cost--missing { color: #ff8a8a; border-color: rgba(255, 107, 107, 0.5); background: rgba(255, 107, 107, 0.08); }
.sh-maxed { padding: 8px; text-align: center; font-size: 0.9em; font-weight: 700; color: var(--ui-gold, #ffd700); }

/* Elders, guardian, empty states */
.sh-lock { opacity: 0.55; color: var(--sect-text-dim, #9ca3af); }
.sh-who { display: flex; align-items: center; gap: 8px; min-width: 0; flex-wrap: wrap; }
.sh-art { width: 44px; height: 44px; flex: 0 0 auto; line-height: 0; }
.sh-name { font-size: 0.98em; font-weight: 700; overflow-wrap: anywhere; }
.sh-section { display: flex; flex-direction: column; gap: 8px; }
.sh-section__head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.sh-danger { color: #ff8a8a; border-color: rgba(255, 107, 107, 0.45); }
.sh-empty::before { content: ""; width: 36px; height: 1px; margin-bottom: 4px; background: linear-gradient(90deg, transparent, var(--sect-border-strong, #555), transparent); }
.sh-empty { padding: 22px 12px; gap: 6px; }
.sh-hero--toolbar { margin-bottom: 12px; padding: 8px 12px; }
.disciple-missions-modal .sect-chip b { margin-left: 4px; color: var(--sect-text, #fff); }

/* Recruitment */
.sh-split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--sp-3, 12px); align-items: start; }
.sh-resource--danger { border-color: rgba(255, 107, 107, 0.5); }
.sh-resource__value--danger { color: #ff8a8a; }
.sh-danger-text { font-size: 0.8em; font-weight: 700; color: #ff8a8a; }
.sh-big { font-size: 1.3em; color: var(--ui-gold, #ffd700); }
.sh-scale { display: flex; justify-content: space-between; font-size: 0.75em; color: var(--sect-text-dim, #9ca3af); }
.sh-field { display: flex; align-items: center; gap: 10px; }
.sh-input--boxed { background: var(--sect-surface-1, rgba(0, 0, 0, 0.4)); border: 1px solid var(--sect-border-strong, #444); color: var(--ui-gold, #ffd700); text-align: right; font-variant-numeric: tabular-nums; }
.sh-chances { display: flex; flex-direction: column; gap: 8px; }
.sh-chance { display: grid; grid-template-columns: 118px minmax(0, 1fr) 52px; align-items: center; gap: 10px; }
.sh-chance__name { font-size: 0.88em; font-weight: 700; text-transform: capitalize; }
.sh-chance__track { height: 8px; background: rgba(255, 255, 255, 0.08); border-radius: 999px; overflow: hidden; }
.sh-chance__track .sect-bar__fill { height: 100%; border-radius: 999px; transition: width 0.3s; }
.sh-chance__pct { font-size: 0.88em; font-weight: 700; text-align: right; font-variant-numeric: tabular-nums; }
.sh-cta { padding: 10px; font-size: 1em; }
@media (max-width: 760px) { .sh-split { grid-template-columns: 1fr; } }

/* Army */
.sh-resources--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.sh-slots { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.sh-slot { position: relative; flex: 1 1 140px; min-width: 130px; max-width: 190px; align-items: center; text-align: center; gap: 4px; padding: 12px 8px; }
.sh-slot--empty { border-style: dashed; background: transparent; justify-content: center; min-height: 96px; cursor: pointer; color: var(--sect-text-dim, #9ca3af); transition: border-color 0.15s ease, color 0.15s ease; }
.sh-slot--empty:hover { border-color: var(--ui-teal, #4ecdc4); color: var(--sect-text, #fff); }
.sh-slot--empty > div:first-child { font-size: 1.6em; line-height: 1; color: var(--ui-teal, #4ecdc4); }
.army-elder-remove { position: absolute; top: 4px; right: 6px; padding: 2px 6px; font-size: 1em; line-height: 1; color: #ff8a8a; background: none; border: 0; border-radius: 4px; cursor: pointer; }
.army-elder-remove:hover { background: rgba(255, 107, 107, 0.15); }
.sh-split--army { align-items: stretch; }
@media (max-width: 760px) { .sh-resources--3 { grid-template-columns: 1fr; } }

/* Sect inventory */
.sh-grid--cards { grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); gap: 12px; padding: 2px; }
.sh-xfer { display: flex; align-items: center; gap: 8px; }
.sh-xfer .game-slider { flex: 1; margin: 0; height: 6px; }
.sh-xfer__pct { min-width: 40px; text-align: right; font-size: 0.85em; font-weight: 700; color: var(--ui-gold, #ffd700); font-variant-numeric: tabular-nums; }
.sh-xfer--presets { justify-content: flex-end; gap: 6px; }
.sh-xfer--actions .sect-btn { flex: 1; }
.sect-inventory-modal [data-action="sectInvPreset"] { padding: 3px 10px; font-size: 0.78em; }
.sect-inventory-modal .sect-segment { margin-bottom: 12px; }

/* Pavilions (css-only pass over the crafting markup) */
.crafting-modal .workshop-card { gap: 12px; padding: 14px; }
.crafting-modal .workshop-header { margin: 0; }
.crafting-modal .workshop-name { font-size: 1.15em; }
.crafting-modal .workshop-workers { margin: 0; font-size: 0.92em; color: var(--sect-text-dim, #9ca3af); }
.crafting-modal .workshop-stats { flex-direction: column; gap: 4px; margin: 0; padding: 8px 10px; font-size: 0.88em; background: rgba(0, 0, 0, 0.18); border-radius: var(--r-sm, 6px); }
.crafting-modal .workshop-resources { margin: 0; font-size: 0.9em; }
.crafting-modal .workshop-intensity { margin: 0; font-size: 0.92em; }
.crafting-modal .pavilion-recipes { margin: 0 !important; padding: 10px !important; background: rgba(0, 0, 0, 0.15); }
.crafting-modal .intensity-labels { font-size: 0.75em; opacity: 0.8; }

/* Buildings: equal-size cards with the cost row and button pinned to the bottom */
.buildings-grid { grid-auto-rows: 1fr; align-items: stretch; }
.buildings-grid .sh-card { height: 100%; }
.buildings-grid .sh-hint { min-height: 2.9em; margin: 0; }
.buildings-grid .sh-effects { flex: 1 1 auto; align-content: start; }
.buildings-grid .sh-effect { min-height: 2.7em; }
.buildings-grid .sh-costs { min-height: 30px; }
.buildings-grid .sh-card > .sect-btn,
.buildings-grid .sh-card > .sh-maxed { margin-top: 0; min-height: 40px; }
.buildings-grid .sh-maxed { display: grid; place-items: center; border: 1px solid rgba(255, 215, 0, 0.35); border-radius: var(--r-sm, 6px); background: rgba(255, 215, 0, 0.06); }

/* Army: realm list + detail */
.sh-realms { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 12px; min-height: 340px; max-height: 460px; }
.sh-realms--mobile { grid-template-columns: 1fr; max-height: none; }
.sh-realm-list { display: flex; flex-direction: column; gap: 6px; overflow-y: auto; padding-right: 4px; min-width: 0; }
.sh-realms--mobile .sh-realm-list { flex-direction: row; flex-wrap: wrap; }
.sh-realm-list .sect-btn { justify-content: space-between; min-width: 0; }
.sh-realms > .sect-card { overflow-y: auto; min-height: 0; }
