:root {
    --bg: #090b0e;
    --panel: #111419;
    --panel-2: #171b21;
    --panel-3: #1d222a;
    --line: rgba(255,255,255,.08);
    --text: #f4f5f7;
    --muted: #8d95a3;
    --gold: #d7aa4c;
    --gold-2: #f0ce7a;
    --danger: #e35d65;
    --success: #63c99b;
    --radius: 18px;
    --shadow: 0 24px 70px rgba(0,0,0,.38);
}
* { box-sizing: border-box; }
html { color-scheme: dark; }
body { margin: 0; min-height: 100vh; background: radial-gradient(circle at 75% 0%, rgba(215,170,76,.09), transparent 28%), var(--bg); color: var(--text); font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
button, input { font: inherit; }
button { color: inherit; }
.hidden { display: none !important; }
.eyebrow { display: block; color: var(--gold); font-size: .68rem; font-weight: 800; letter-spacing: .2em; text-transform: uppercase; }
h1,h2,h3,p { margin-top: 0; }
h1 { font-size: clamp(2rem, 4vw, 4.5rem); line-height: .95; }
h2 { margin-bottom: 0; }
h3 { font-size: 1.2rem; }
p { color: var(--muted); line-height: 1.7; }
code { color: var(--gold-2); background: rgba(215,170,76,.08); padding: .16rem .38rem; border-radius: 6px; }

.auth-layout { min-height: 100vh; display: grid; grid-template-columns: minmax(360px, 1.08fr) minmax(420px, .92fr); }
.auth-brand { position: relative; overflow: hidden; display: flex; flex-direction: column; justify-content: center; padding: clamp(3rem, 8vw, 9rem); background: linear-gradient(135deg, rgba(10,12,15,.74), rgba(10,12,15,.96)), linear-gradient(45deg, transparent 48%, rgba(215,170,76,.08) 49%, transparent 51%); border-right: 1px solid var(--line); }
.auth-brand::after { content: "LEGACY"; position: absolute; left: -2rem; bottom: -3rem; font-size: clamp(7rem, 17vw, 18rem); font-weight: 900; letter-spacing: -.08em; color: rgba(255,255,255,.018); pointer-events: none; }
.brand-mark { width: 74px; height: 74px; display: grid; place-items: center; margin-bottom: 2rem; border: 1px solid rgba(215,170,76,.55); border-radius: 20px; background: linear-gradient(145deg, rgba(215,170,76,.2), rgba(215,170,76,.04)); box-shadow: inset 0 0 30px rgba(215,170,76,.08); color: var(--gold-2); font-size: 2rem; font-weight: 900; transform: rotate(-4deg); }
.brand-mark.small { width: 44px; height: 44px; margin: 0; border-radius: 13px; font-size: 1.2rem; }
.auth-brand h1 { margin: .6rem 0 1.25rem; }
.auth-brand > div:nth-child(2) { max-width: 650px; }
.auth-feature-list { position: relative; z-index: 1; display: flex; gap: 1.2rem; margin-top: 3rem; }
.auth-feature-list div { min-width: 150px; padding-top: 1rem; border-top: 1px solid var(--line); }
.auth-feature-list span { color: var(--gold); font: 700 .72rem monospace; }
.auth-feature-list p { margin: .45rem 0 0; font-size: .85rem; }
.auth-panel { display: grid; place-items: center; padding: 3rem; background: rgba(9,11,14,.82); }
.auth-card { width: min(620px, 100%); padding: clamp(1.5rem, 4vw, 3rem); border: 1px solid var(--line); border-radius: 28px; background: linear-gradient(150deg, rgba(27,31,38,.98), rgba(14,17,21,.98)); box-shadow: var(--shadow); }
.auth-tabs { display: flex; gap: .5rem; margin-bottom: 2.3rem; padding: .35rem; border-radius: 13px; background: rgba(0,0,0,.24); }
.auth-tab { flex: 1; padding: .85rem; border: 0; border-radius: 10px; background: transparent; color: var(--muted); cursor: pointer; }
.auth-tab.active { background: var(--panel-3); color: var(--text); box-shadow: 0 8px 22px rgba(0,0,0,.25); }
.form-heading h2 { margin: .5rem 0 .5rem; }
.form-heading p { margin-bottom: 0; }
.form-stack { display: grid; gap: 1.15rem; }
.form-grid { display: grid; gap: 1rem; }
.form-grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
label, .field-title { color: #d9dde4; font-size: .82rem; font-weight: 650; }
input, textarea { width: 100%; margin-top: .48rem; padding: .92rem 1rem; border: 1px solid var(--line); border-radius: 11px; outline: none; background: rgba(4,6,8,.52); color: var(--text); transition: .2s; }
input:focus, textarea:focus { border-color: rgba(215,170,76,.7); box-shadow: 0 0 0 3px rgba(215,170,76,.08); }
small { color: var(--muted); }
label small { display: block; margin-top: .4rem; font-size: .7rem; }
.section-divider { display: flex; align-items: center; gap: 1rem; margin: .4rem 0; color: var(--gold); font-size: .7rem; font-weight: 800; letter-spacing: .15em; }
.section-divider::before,.section-divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.button { min-height: 44px; padding: .78rem 1.15rem; border: 1px solid transparent; border-radius: 11px; font-weight: 750; cursor: pointer; transition: transform .2s, opacity .2s, background .2s; }
.button:hover { transform: translateY(-1px); }
.button:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.button.primary { background: linear-gradient(135deg, var(--gold-2), var(--gold)); color: #17120a; box-shadow: 0 12px 26px rgba(215,170,76,.16); }
.button.secondary { border-color: var(--line); background: var(--panel-2); }
.button.danger { border-color: rgba(227,93,101,.28); background: rgba(227,93,101,.09); color: #ff9aa0; }
.button.mini { min-height: 34px; padding: .5rem .7rem; font-size: .72rem; }

.app-layout { min-height: 100vh; display: grid; grid-template-columns: 270px 1fr; }
.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; padding: 1.4rem; border-right: 1px solid var(--line); background: rgba(12,14,18,.96); backdrop-filter: blur(20px); z-index: 20; }
.sidebar-brand { display: flex; align-items: center; gap: .9rem; padding: .4rem .35rem 2rem; }
.sidebar-brand strong,.sidebar-brand span { display: block; }
.sidebar-brand strong { letter-spacing: .16em; }
.sidebar-brand span { color: var(--muted); font-size: .75rem; }
.nav-list { display: grid; gap: .35rem; }
.nav-item { width: 100%; display: flex; align-items: center; gap: .85rem; padding: .8rem .9rem; border: 1px solid transparent; border-radius: 11px; background: transparent; color: var(--muted); text-align: left; cursor: pointer; }
.nav-item span { width: 22px; color: #b7bdc7; font-size: 1.05rem; text-align: center; }
.nav-item:hover,.nav-item.active { color: var(--text); background: rgba(255,255,255,.045); border-color: var(--line); }
.nav-item.active { box-shadow: inset 3px 0 0 var(--gold); }
.nav-label { margin: 1.5rem .9rem .55rem; color: #59606b; font-size: .62rem; font-weight: 800; letter-spacing: .16em; }
.logout { margin-top: auto; color: #d07b80; }
.main-content { min-width: 0; padding: 0 clamp(1.2rem, 3.4vw, 4rem) 4rem; }
.topbar { min-height: 104px; display: flex; align-items: center; justify-content: space-between; gap: 1rem; border-bottom: 1px solid var(--line); }
.account-chip { display: flex; align-items: center; gap: .8rem; }
.account-chip strong,.account-chip span { display: block; }
.account-chip span { margin-top: .15rem; color: var(--muted); font-size: .72rem; }
.avatar { width: 42px; height: 42px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 12px; background: linear-gradient(145deg, rgba(215,170,76,.22), rgba(215,170,76,.06)); border: 1px solid rgba(215,170,76,.25); color: var(--gold-2); font-weight: 900; }
.page { display: none; padding-top: 2rem; }
.page.active { display: block; animation: fade .22s ease-out; }
@keyframes fade { from { opacity: 0; transform: translateY(5px); } }
.hero-card { position: relative; overflow: hidden; min-height: 260px; display: flex; align-items: center; justify-content: space-between; gap: 3rem; padding: clamp(2rem, 5vw, 4.5rem); border: 1px solid var(--line); border-radius: 25px; background: linear-gradient(110deg, rgba(29,34,42,.96), rgba(16,19,24,.95)), radial-gradient(circle at 85% 30%, rgba(215,170,76,.25), transparent 32%); box-shadow: var(--shadow); }
.hero-card::before { content: ""; position: absolute; inset: 0; background: repeating-linear-gradient(125deg, transparent 0 40px, rgba(255,255,255,.012) 41px 42px); pointer-events: none; }
.hero-card > div { position: relative; z-index: 1; }
.hero-card h1 { margin: .6rem 0 1rem; font-size: clamp(2rem, 4vw, 4rem); }
.hero-card p { max-width: 650px; margin-bottom: 0; }
.hero-seal { width: 145px; height: 145px; flex: 0 0 auto; display: grid; place-items: center; align-content: center; border: 1px solid rgba(215,170,76,.35); border-radius: 50%; box-shadow: inset 0 0 0 8px rgba(215,170,76,.025), inset 0 0 0 9px rgba(215,170,76,.15); color: var(--gold-2); }
.hero-seal span { font-size: 3.4rem; font-weight: 900; line-height: 1; }
.hero-seal small { color: var(--gold); letter-spacing: .25em; }
.stats-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; margin: 1rem 0; }
.stats-grid.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.stat-card,.content-card,.character-card,.admin-card { border: 1px solid var(--line); background: linear-gradient(145deg, rgba(24,28,34,.96), rgba(14,17,21,.96)); box-shadow: 0 16px 40px rgba(0,0,0,.18); }
.stat-card { padding: 1.35rem; border-radius: 16px; }
.stat-card span,.stat-card strong,.stat-card small { display: block; }
.stat-card span { color: var(--muted); font-size: .75rem; }
.stat-card strong { margin: .55rem 0 .2rem; font-size: 2rem; }
.status-good { color: var(--success); }
.content-card { padding: 1.5rem; border-radius: 18px; }
.card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.3rem; }
.card-header h3 { margin: .35rem 0 0; }
.detail-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 1rem; }
.detail-grid div { padding: 1rem; border-radius: 12px; background: rgba(0,0,0,.18); }
.detail-grid span,.detail-grid strong { display: block; }
.detail-grid span { margin-bottom: .45rem; color: var(--muted); font-size: .7rem; }
.page-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1.2rem; }
.page-toolbar h3 { margin: .35rem 0 0; font-size: 1.7rem; }
.page-toolbar.wrap { flex-wrap: wrap; }
.toolbar-actions { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.search-input { width: min(360px, 100%); margin: 0; }
.character-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1.1rem; }
.character-card { position: relative; overflow: hidden; padding: 1.5rem; border-radius: 19px; }
.character-index { position: absolute; right: 1rem; top: .5rem; color: rgba(255,255,255,.035); font-size: 5rem; font-weight: 900; }
.character-head { position: relative; display: flex; align-items: center; gap: .9rem; }
.character-avatar { width: 52px; height: 52px; display: grid; place-items: center; border-radius: 14px; background: rgba(215,170,76,.1); border: 1px solid rgba(215,170,76,.2); color: var(--gold-2); font-weight: 900; }
.character-head span { color: var(--gold); font-size: .62rem; font-weight: 800; letter-spacing: .15em; }
.character-head h3 { margin: .25rem 0 0; }
.identity-number { margin: 1.5rem 0; padding: 1.2rem; border: 1px dashed rgba(215,170,76,.3); border-radius: 13px; background: rgba(215,170,76,.035); }
.identity-number span,.identity-number strong { display: block; }
.identity-number span { margin-bottom: .4rem; color: var(--muted); font-size: .65rem; letter-spacing: .14em; }
.identity-number strong { color: var(--gold-2); font: 800 clamp(1.35rem, 2vw, 1.8rem)/1 monospace; letter-spacing: .09em; }
.character-data { display: grid; gap: .7rem; }
.character-data div { display: flex; justify-content: space-between; gap: 1rem; padding-bottom: .7rem; border-bottom: 1px solid var(--line); }
.character-data span { color: var(--muted); font-size: .75rem; }
.character-data strong { font-size: .8rem; }
.immutable-note { margin-top: 1rem; color: #7c838e; font-size: .69rem; }
.empty-state { grid-column: 1/-1; padding: 4rem; border: 1px dashed var(--line); border-radius: 18px; text-align: center; }
.table-card { padding: 0; overflow: hidden; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th,td { padding: 1rem 1.15rem; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
th { color: #747c88; font-size: .66rem; letter-spacing: .1em; text-transform: uppercase; }
td { color: #cfd4dc; font-size: .8rem; }
tbody tr:hover { background: rgba(255,255,255,.018); }
.row-muted { opacity: .62; }
.table-sub { display: block; margin-top: .3rem; font-size: .64rem; }
.empty-cell { padding: 3rem; color: var(--muted); text-align: center; }
.badge { display: inline-flex; padding: .28rem .5rem; border-radius: 999px; background: rgba(255,255,255,.07); color: #cdd2da; font-size: .63rem; font-weight: 750; }
.badge.gold { background: rgba(215,170,76,.12); color: var(--gold-2); }
.badge.success { background: rgba(99,201,155,.1); color: #83e1b6; }
.badge.danger { background: rgba(227,93,101,.1); color: #ff939a; }
.badge.muted { color: #818994; }
.icon-button { width: 40px; height: 40px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 10px; background: var(--panel-2); cursor: pointer; }
.icon-button.danger { color: var(--danger); }
.admin-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.admin-card { padding: 1.25rem; border-radius: 16px; }
.admin-card-head { display: flex; align-items: center; gap: .8rem; }
.admin-card-head h3 { margin: 0 0 .2rem; }
.admin-card-head > span:last-child { margin-left: auto; }
.admin-card-head div span { color: var(--muted); font-size: .72rem; }
.permission-tags { display: flex; flex-wrap: wrap; gap: .4rem; margin: 1.2rem 0; }
.permission-tags span { padding: .35rem .55rem; border: 1px solid var(--line); border-radius: 8px; color: #aeb5c0; font-size: .65rem; }
.admin-card-footer { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding-top: 1rem; border-top: 1px solid var(--line); }
.admin-card-footer > div { display: flex; gap: .45rem; }
.toggle { display: inline-flex; align-items: center; gap: .6rem; color: var(--muted); cursor: pointer; }
.toggle input { display: none; }
.toggle span { width: 34px; height: 19px; position: relative; display: inline-block; border-radius: 999px; background: #303640; }
.toggle span::after { content:""; position: absolute; width: 13px; height: 13px; left: 3px; top: 3px; border-radius: 50%; background: #aeb5bf; transition: .2s; }
.toggle input:checked + span { background: rgba(215,170,76,.55); }
.toggle input:checked + span::after { transform: translateX(15px); background: var(--gold-2); }
.toggle.line { padding: 1rem; border: 1px solid var(--line); border-radius: 12px; }
.modal { position: fixed; inset: 0; display: grid; place-items: center; padding: 1rem; z-index: 100; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,.72); backdrop-filter: blur(8px); }
.modal-card { position: relative; width: min(560px, 100%); max-height: 92vh; overflow: auto; padding: 2rem; border: 1px solid var(--line); border-radius: 20px; background: #15191f; box-shadow: var(--shadow); }
.modal-card.large { width: min(780px, 100%); }
.modal-card h3 { margin: .5rem 0 1.4rem; font-size: 1.6rem; }
.modal-close { position: absolute; right: 1rem; top: 1rem; width: 36px; height: 36px; border: 1px solid var(--line); border-radius: 9px; background: var(--panel-3); cursor: pointer; }
.modal-actions { display: flex; justify-content: flex-end; gap: .7rem; }
.permission-list { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: .7rem; margin-top: .65rem; }
.permission-list.disabled { opacity: .4; }
.permission-item { display: flex; align-items: flex-start; gap: .65rem; padding: .85rem; border: 1px solid var(--line); border-radius: 11px; background: rgba(0,0,0,.16); cursor: pointer; }
.permission-item input { width: auto; margin: .15rem 0 0; accent-color: var(--gold); }
.permission-item strong,.permission-item small { display: block; }
.permission-item small { margin-top: .3rem; line-height: 1.4; }
.toast { position: fixed; right: 1.25rem; bottom: 1.25rem; max-width: min(420px, calc(100vw - 2.5rem)); padding: 1rem 1.2rem; border: 1px solid rgba(99,201,155,.25); border-radius: 12px; background: #17251f; color: #a7edca; box-shadow: var(--shadow); opacity: 0; transform: translateY(15px); pointer-events: none; transition: .25s; z-index: 200; }
.toast.visible { opacity: 1; transform: none; }
.toast.error { border-color: rgba(227,93,101,.25); background: #2a181b; color: #ffadb2; }
.setup-body { display: grid; place-items: center; padding: 2rem; }
.setup-shell { width: min(760px,100%); }
.setup-shell > .brand-mark { margin-inline: auto; }
.setup-card { width: 100%; }
.warning-box { margin-top: 1.3rem; padding: 1rem; border: 1px solid rgba(227,93,101,.2); border-radius: 11px; background: rgba(227,93,101,.06); color: #e6b3b6; font-size: .78rem; line-height: 1.7; }
.mobile-only { display: none; }

@media (max-width: 1100px) {
    .auth-layout { grid-template-columns: 1fr; }
    .auth-brand { min-height: 42vh; padding: 3rem; border-right: 0; border-bottom: 1px solid var(--line); }
    .auth-feature-list { flex-wrap: wrap; }
    .character-grid,.stats-grid.four { grid-template-columns: repeat(2,minmax(0,1fr)); }
    .detail-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
}
@media (max-width: 800px) {
    .app-layout { display: block; }
    .sidebar { position: fixed; left: 0; width: 270px; transform: translateX(-105%); transition: .25s; box-shadow: var(--shadow); }
    .sidebar-open .sidebar { transform: none; }
    .main-content { padding-inline: 1rem; }
    .mobile-only { display: grid; }
    .topbar { min-height: 86px; }
    .account-chip div:last-child { display: none; }
    .hero-seal { display: none; }
    .stats-grid,.character-grid,.admin-grid { grid-template-columns: 1fr; }
    .permission-list { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
    .auth-panel,.auth-brand { padding: 1.25rem; }
    .auth-feature-list { display: none; }
    .auth-card { padding: 1.25rem; border-radius: 18px; }
    .form-grid.two,.detail-grid { grid-template-columns: 1fr; }
    .page-toolbar { align-items: flex-start; flex-direction: column; }
    .page-toolbar .button,.search-input,.toolbar-actions { width: 100%; }
    .hero-card { padding: 1.5rem; }
    .hero-card h1 { font-size: 2rem; }
    .topbar .eyebrow { display: none; }
    .modal-card { padding: 1.35rem; }
    .modal-actions { flex-direction: column-reverse; }
    .modal-actions .button { width: 100%; }
}

/* Setup-Diagnose */
.setup-note {
    margin-top: 10px;
    padding: 12px 14px;
    border: 1px solid rgba(214, 174, 83, .22);
    border-radius: 12px;
    background: rgba(214, 174, 83, .06);
}

.setup-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.setup-actions .button {
    flex: 1 1 220px;
}

.setup-status {
    display: grid;
    gap: 8px;
    margin: 4px 0;
}

.setup-status.hidden {
    display: none;
}

.setup-check {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 11px 12px;
    border: 1px solid var(--border, rgba(255,255,255,.1));
    border-radius: 12px;
    background: rgba(255,255,255,.025);
}

.setup-check > span {
    display: grid;
    place-items: center;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    font-weight: 800;
}

.setup-check.ok > span {
    background: rgba(72, 187, 120, .15);
    color: #72d69b;
}

.setup-check.error > span {
    background: rgba(245, 101, 101, .15);
    color: #ff8585;
}

.setup-check div {
    display: grid;
    gap: 2px;
}

.setup-check small {
    opacity: .72;
}


/* Charakter-Namensverwaltung */
.table-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: .45rem;
}
.icon-button.edit {
    color: var(--gold-2);
}
.info-box {
    padding: 1rem;
    border: 1px solid rgba(215,170,76,.22);
    border-radius: 12px;
    background: rgba(215,170,76,.06);
    color: #c8cdd5;
    font-size: .76rem;
    line-height: 1.6;
}
.info-box strong { color: var(--gold-2); }

/* V4: kopierbare System-IDs, Berechtigungen und Fraktionen */
.copy-system-id,
.copy-inline {
    border: 0;
    cursor: pointer;
    transition: transform .18s, border-color .18s, background .18s;
}
.copy-system-id:hover,
.copy-inline:hover { transform: translateY(-1px); }
.copy-system-id {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0;
    background: transparent;
    text-align: left;
}
.copy-system-id code {
    padding: 0;
    background: transparent;
    color: var(--gold-2);
    font: 800 clamp(1.35rem, 2vw, 1.8rem)/1 monospace;
    letter-spacing: .09em;
}
.copy-system-id span {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    margin: 0;
    border: 1px solid rgba(215,170,76,.25);
    border-radius: 9px;
    background: rgba(215,170,76,.07);
    color: var(--gold-2);
    font-size: 1rem;
    letter-spacing: normal;
}
.copy-inline {
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    padding: .28rem .45rem;
    border: 1px solid rgba(215,170,76,.16);
    border-radius: 8px;
    background: rgba(215,170,76,.045);
}
.copy-inline code { padding: 0; background: transparent; }
.copy-inline span { color: var(--gold-2); }

.faction-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
}
.faction-card {
    position: relative;
    min-height: 210px;
    overflow: hidden;
    padding: 1.5rem;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: linear-gradient(145deg, rgba(24,28,34,.97), rgba(14,17,21,.97));
    box-shadow: 0 16px 40px rgba(0,0,0,.18);
}
.faction-card::after {
    content: "";
    position: absolute;
    inset: auto -40px -65px auto;
    width: 150px;
    height: 150px;
    border: 1px solid rgba(215,170,76,.1);
    border-radius: 50%;
}
.faction-number {
    position: absolute;
    right: 1rem;
    top: .4rem;
    color: rgba(255,255,255,.035);
    font-size: 4.5rem;
    font-weight: 900;
}
.faction-code {
    display: inline-flex;
    padding: .3rem .55rem;
    border: 1px solid rgba(215,170,76,.18);
    border-radius: 7px;
    background: rgba(215,170,76,.06);
    color: var(--gold-2);
    font: 800 .68rem monospace;
    letter-spacing: .12em;
}
.faction-card h3 {
    position: relative;
    max-width: 85%;
    margin: 1.2rem 0 2.4rem;
    line-height: 1.35;
}
.faction-footer {
    position: absolute;
    left: 1.5rem;
    right: 1.5rem;
    bottom: 1.35rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .8rem;
}
.rank-badge {
    display: inline-flex;
    padding: .38rem .62rem;
    border: 1px solid rgba(215,170,76,.22);
    border-radius: 999px;
    background: rgba(215,170,76,.1);
    color: var(--gold-2);
    font-size: .68rem;
    font-weight: 800;
}
.admin-rank-line {
    display: flex;
    align-items: center;
    gap: .65rem;
    margin-top: 1rem;
}

.permission-overview {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
}
.permission-card {
    min-height: 170px;
    padding: 1.25rem;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: linear-gradient(145deg, rgba(24,28,34,.96), rgba(14,17,21,.96));
}
.permission-card code {
    display: inline-flex;
    margin-bottom: 1rem;
}
.permission-card h3 { margin-bottom: .6rem; }
.permission-card p { margin: 0; font-size: .78rem; line-height: 1.6; }
.empty-state.compact { padding: 1.5rem; }
.modal-actions-spaced { margin-top: 1.35rem; }

@media (max-width: 1100px) {
    .faction-grid,
    .permission-overview { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 800px) {
    .faction-grid,
    .permission-overview { grid-template-columns: 1fr; }
}

/* V5: Static-Sperren und permanente Löschung */
.static-block-card {
    margin-bottom: 1rem;
}
.static-block-form {
    display: grid;
    grid-template-columns: minmax(180px, .7fr) minmax(240px, 1.5fr) auto;
    align-items: end;
    gap: 1rem;
    margin-bottom: 1rem;
}
.static-block-form .button {
    min-height: 48px;
}
.danger-text {
    color: #ff8585 !important;
}

@media (max-width: 900px) {
    .static-block-form {
        grid-template-columns: 1fr;
    }
    .static-block-form .button {
        width: 100%;
    }
}

/* V6: Dynamische Fraktionsverwaltung */
button, input, select, textarea { font: inherit; }
select {
    width: 100%;
    margin-top: .48rem;
    padding: .92rem 1rem;
    border: 1px solid var(--line);
    border-radius: 11px;
    outline: none;
    background: rgba(4,6,8,.72);
    color: var(--text);
    transition: .2s;
}
select:focus { border-color: rgba(215,170,76,.7); box-shadow: 0 0 0 3px rgba(215,170,76,.08); }
select:disabled, input:disabled, textarea:disabled { opacity: .55; cursor: not-allowed; }
#faction-nav { display: grid; gap: .35rem; }
.faction-nav-item .nav-faction-name {
    width: auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: inherit;
    font-size: .78rem;
    text-align: left;
}
.faction-nav-item > span:first-child {
    flex: 0 0 26px;
    width: 26px;
    color: var(--gold-2);
    font-size: .62rem;
    font-weight: 900;
    letter-spacing: .02em;
}
.faction-hero {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 2rem;
    margin-bottom: 1rem;
    padding: clamp(1.7rem, 4vw, 3rem);
    border: 1px solid var(--line);
    border-radius: 22px;
    background:
        linear-gradient(120deg, rgba(27,32,39,.98), rgba(13,16,20,.98)),
        radial-gradient(circle at 90% 20%, rgba(215,170,76,.22), transparent 34%);
    box-shadow: var(--shadow);
}
.faction-hero h1 { margin: .55rem 0 .8rem; font-size: clamp(2rem, 4vw, 3.8rem); }
.faction-hero p { margin: 0; }
.faction-hero-meta { display: grid; justify-items: end; gap: .65rem; text-align: right; }
.faction-hero-meta .rank-badge { max-width: 300px; justify-content: center; padding: .55rem .8rem; }
.subtabs {
    display: flex;
    gap: .5rem;
    margin: 1rem 0 1.4rem;
    padding: .4rem;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: rgba(0,0,0,.2);
    overflow-x: auto;
}
.subtab {
    min-height: 42px;
    padding: .7rem 1rem;
    border: 1px solid transparent;
    border-radius: 10px;
    background: transparent;
    color: var(--muted);
    white-space: nowrap;
    cursor: pointer;
}
.subtab:hover, .subtab.active {
    border-color: var(--line);
    background: var(--panel-3);
    color: var(--text);
}
.faction-tab { display: none; }
.faction-tab.active { display: block; animation: fade .2s ease-out; }
.management-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
}
.management-card {
    display: flex;
    flex-direction: column;
    min-height: 220px;
    padding: 1.25rem;
    border: 1px solid var(--line);
    border-radius: 17px;
    background: linear-gradient(145deg, rgba(24,28,34,.96), rgba(14,17,21,.96));
    box-shadow: 0 16px 40px rgba(0,0,0,.16);
}
.management-card-head { display: flex; align-items: center; gap: .9rem; }
.management-card-head h3 { margin: .3rem 0 0; }
.rank-value, .department-badge {
    width: 52px;
    height: 52px;
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    border: 1px solid rgba(215,170,76,.24);
    border-radius: 14px;
    background: rgba(215,170,76,.08);
    color: var(--gold-2);
    font-weight: 900;
}
.rank-value { font-size: 1.15rem; }
.department-badge { font-size: .75rem; letter-spacing: .06em; }
.management-meta { margin-top: auto; padding-top: 1rem; color: var(--muted); font-size: .72rem; }
.management-actions { display: flex; gap: .5rem; margin-top: .9rem; padding-top: .9rem; border-top: 1px solid var(--line); }
.permission-tags.compact { margin: 1rem 0; }
.permission-tags.compact span { font-size: .61rem; }
#faction-members-limited { margin: 1rem; }
.info-box {
    padding: .9rem 1rem;
    border: 1px solid rgba(215,170,76,.16);
    border-radius: 11px;
    background: rgba(215,170,76,.05);
    color: #c9b98e;
    font-size: .76rem;
    line-height: 1.55;
}
.table-actions { display: flex; justify-content: flex-end; gap: .4rem; }
.icon-button.edit { color: var(--gold-2); }

@media (max-width: 1150px) {
    .management-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 780px) {
    .faction-hero { align-items: flex-start; flex-direction: column; }
    .faction-hero-meta { justify-items: start; text-align: left; }
    .management-grid { grid-template-columns: 1fr; }
    .toolbar-actions { width: 100%; }
    .toolbar-actions .search-input, .toolbar-actions .button { width: 100%; }
}

/* V7 – Fraktionsmitarbeiter */
.employee-table { min-width: 1180px; }
.employee-table th,
.employee-table td { vertical-align: top; }
.service-number {
    display: inline-flex;
    min-width: 72px;
    justify-content: center;
    padding: .38rem .55rem;
    border: 1px solid rgba(215,170,76,.24);
    border-radius: .55rem;
    background: rgba(215,170,76,.08);
    color: var(--gold);
    font-weight: 800;
    letter-spacing: .06em;
}
.member-row-actions {
    display: flex;
    flex-wrap: wrap;
    gap: .4rem;
    margin-top: .65rem;
}
.info-box.compact { margin: 0; padding: .75rem .9rem; }
.leader-rank-card {
    border-color: rgba(215,170,76,.48);
    background: linear-gradient(145deg, rgba(215,170,76,.11), rgba(15,18,23,.96));
}
.leader-rank-card .rank-value {
    box-shadow: 0 0 0 1px rgba(215,170,76,.35), 0 0 25px rgba(215,170,76,.12);
}
.leader-permission-note {
    margin-top: .9rem;
    padding: .7rem .8rem;
    border-radius: .65rem;
    border: 1px solid rgba(215,170,76,.18);
    color: #d8c18c;
    background: rgba(215,170,76,.055);
    font-size: .72rem;
}

/* V9 – Discord-ähnliche Rangreihenfolge */
.rank-order-hint {
    display: flex;
    align-items: center;
    gap: .9rem;
    margin-bottom: 1rem;
    padding: .9rem 1rem;
    border: 1px solid rgba(215,170,76,.18);
    border-radius: 13px;
    background: rgba(215,170,76,.055);
}
.rank-order-hint strong,
.rank-order-hint small { display: block; }
.rank-order-hint strong { color: var(--text); font-size: .82rem; }
.rank-order-hint small { margin-top: .22rem; color: var(--muted); font-size: .72rem; line-height: 1.45; }
.rank-drag-preview,
.rank-drag-handle,
.rank-order-spacer {
    width: 36px;
    min-width: 36px;
    height: 42px;
}
.rank-drag-preview,
.rank-drag-handle {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 4px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: rgba(255,255,255,.025);
}
.rank-drag-preview i,
.rank-drag-handle i {
    width: 17px;
    height: 2px;
    border-radius: 99px;
    background: currentColor;
}
.rank-drag-preview { color: var(--gold-2); }
.rank-order-board,
.rank-sortable-list {
    display: flex;
    flex-direction: column;
    gap: .72rem;
}
.rank-order-board { max-width: 980px; }
.rank-sortable-list {
    min-height: 30px;
    padding: 2px;
    border-radius: 16px;
    transition: background .16s ease, box-shadow .16s ease;
}
.rank-sortable-list.drag-active {
    background: rgba(215,170,76,.04);
    box-shadow: inset 0 0 0 1px rgba(215,170,76,.16);
}
.rank-sortable-list.saving { pointer-events: none; opacity: .72; }
.rank-order-item.management-card {
    display: grid;
    grid-template-columns: 36px minmax(240px, 1fr) auto auto;
    align-items: center;
    gap: .9rem;
    min-height: 0;
    padding: .9rem 1rem;
    transition: transform .16s ease, border-color .16s ease, opacity .16s ease, box-shadow .16s ease;
}
.rank-order-item .management-card-head { min-width: 0; }
.rank-order-item .management-card-head h3 {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.rank-order-item .management-meta {
    margin: 0;
    padding: 0;
    white-space: nowrap;
}
.rank-order-item .management-actions {
    margin: 0;
    padding: 0 0 0 .9rem;
    border-top: 0;
    border-left: 1px solid var(--line);
}
.rank-order-item.dragging {
    opacity: .45;
    border-color: rgba(215,170,76,.55);
    box-shadow: 0 18px 45px rgba(0,0,0,.28);
}
.rank-drag-handle {
    padding: 0;
    color: #7d8490;
    cursor: grab;
    touch-action: none;
}
.rank-drag-handle:hover,
.rank-drag-handle:focus-visible {
    color: var(--gold-2);
    border-color: rgba(215,170,76,.38);
    outline: none;
}
.rank-drag-handle:active { cursor: grabbing; }
.rank-order-fixed .rank-order-spacer { display: block; }
.rank-order-fixed { cursor: default; }

@media (max-width: 780px) {
    .rank-order-item.management-card {
        grid-template-columns: 36px minmax(0, 1fr);
    }
    .rank-order-item .management-meta {
        grid-column: 2;
    }
    .rank-order-item .management-actions {
        grid-column: 2;
        padding: .75rem 0 0;
        border-left: 0;
        border-top: 1px solid var(--line);
    }
}

.modal-card textarea { min-height: 110px; resize: vertical; }
#ui-dialog-message { margin: 0 0 1rem; line-height: 1.65; }
#ui-dialog-reason-wrap { margin-top: .2rem; }

.form-error { margin-top: .45rem; color: #ff939a; font-weight: 700; }


/* V11 – stabile Sidebar, Fraktions-Untermenüs und Webhook-Konfiguration */
.app-layout { grid-template-columns: 310px minmax(0, 1fr); }
.sidebar {
    min-width: 0;
    overflow: hidden;
    padding: 1.25rem 1rem 1rem;
}
.sidebar-brand { flex: 0 0 auto; padding-inline: .55rem; }
.nav-list {
    display: flex;
    flex: 1 1 auto;
    min-height: 0;
    flex-direction: column;
    gap: .35rem;
    overflow-x: hidden;
    overflow-y: auto;
    padding: 0 .35rem .8rem 0;
    scrollbar-width: thin;
    scrollbar-color: rgba(215,170,76,.28) transparent;
}
.nav-list::-webkit-scrollbar { width: 6px; }
.nav-list::-webkit-scrollbar-thumb { border-radius: 99px; background: rgba(215,170,76,.25); }
.nav-item { min-width: 0; flex: 0 0 auto; }
.logout { flex: 0 0 auto; margin-top: .75rem; }
#faction-nav-section { min-width: 0; }
#faction-nav { display: grid; gap: .35rem; min-width: 0; }
.faction-nav-group { min-width: 0; border-radius: 12px; }
.faction-nav-main { position: relative; padding-right: .55rem; }
.faction-nav-main .nav-faction-name { flex: 1 1 auto; }
.faction-nav-main.active { color: var(--text); background: rgba(255,255,255,.045); border-color: var(--line); box-shadow: inset 3px 0 0 var(--gold); }
.faction-nav-chevron {
    width: 18px !important;
    flex: 0 0 18px;
    margin-left: auto;
    color: #737b87 !important;
    font-size: .9rem !important;
    transition: transform .18s ease;
}
.faction-nav-group.expanded .faction-nav-chevron { transform: rotate(90deg); color: var(--gold-2) !important; }
.faction-subnav {
    display: grid;
    gap: .2rem;
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    padding-left: 2.35rem;
    transition: max-height .24s ease, opacity .18s ease, margin .18s ease;
}
.faction-nav-group.expanded .faction-subnav { max-height: 230px; margin: .2rem 0 .45rem; opacity: 1; }
.faction-subnav-item {
    position: relative;
    width: 100%;
    min-width: 0;
    padding: .55rem .7rem .55rem 1rem;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: #7f8793;
    text-align: left;
    font-size: .73rem;
    cursor: pointer;
}
.faction-subnav-item::before { content: ""; position: absolute; left: .1rem; top: 50%; width: 5px; height: 5px; border-radius: 50%; background: #454c56; transform: translateY(-50%); }
.faction-subnav-item:hover,
.faction-subnav-item.active { color: var(--text); background: rgba(255,255,255,.04); }
.faction-subnav-item.active::before { background: var(--gold); box-shadow: 0 0 0 3px rgba(215,170,76,.09); }
.character-card-actions { display: flex; justify-content: flex-end; margin-top: 1rem; }
.webhook-card { max-width: 900px; }
.webhook-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 1.5rem; margin-bottom: 1.3rem; }
.webhook-card-head h3 { margin: .4rem 0 .45rem; }
.webhook-card-head p { max-width: 680px; margin: 0; }
.webhook-actions { display: flex; justify-content: flex-end; gap: .7rem; flex-wrap: wrap; }

@media (max-width: 800px) {
    .sidebar { width: min(320px, 88vw); }
}
@media (max-width: 560px) {
    .webhook-card-head { flex-direction: column; }
    .webhook-actions { flex-direction: column-reverse; }
    .webhook-actions .button { width: 100%; }
}


/* V12 – getrennte Discord-Webhooks für Einstellungen und Kündigungen */
.webhook-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
    align-items: start;
}
.webhook-grid .webhook-card {
    max-width: none;
    min-width: 0;
    position: relative;
    overflow: hidden;
}
.webhook-grid .webhook-card::before {
    content: "";
    position: absolute;
    inset: 0 auto 0 0;
    width: 3px;
}
.webhook-card-hire::before { background: #57f287; }
.webhook-card-termination::before { background: #ed4245; }
.webhook-card-hire .webhook-card-head .eyebrow { color: #75f5a0; }
.webhook-card-termination .webhook-card-head .eyebrow { color: #ff7b7e; }

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

/* V14 – Rang 100 wird als Leader ausgeschrieben. */
.rank-value.leader-label {
    width: auto;
    min-width: 86px;
    padding: 0 .75rem;
    font-size: .78rem;
    letter-spacing: .04em;
    text-transform: uppercase;
}
