:root {
  --bg: #0c0b09; --panel: #151310; --panel2: #1d1a15; --line: #34291b; --line2: #4a3a22;
  --gold: #d69a1f; --gold-hi: #f6c94a; --text: #ece4d3; --muted: #a09580;
  --ok: #62b06d; --bad: #dc5a54; --warn: #e3a72a; --info: #6f8fb0;
  --serif: Georgia, 'Times New Roman', serif;
  --sans: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { background: var(--bg); }
body { margin: 0; color: var(--text); font: 15px/1.5 var(--sans);
  background: radial-gradient(1200px 500px at 50% -200px, rgba(214,154,31,.16), transparent 70%), var(--bg); min-height: 100vh; }
a { color: var(--gold-hi); }
h1, h2, h3 { font-family: var(--serif); font-weight: 600; letter-spacing: .02em; margin: 0; }
h1 { font-size: 1.9rem; } h2 { font-size: 1.35rem; } h3 { font-size: 1.05rem; }
.boot { text-align: center; padding: 4rem; color: var(--muted); }
.muted { color: var(--muted); } .small { font-size: .85rem; }

/* Kopfzeile */
.top { display: flex; align-items: center; gap: 1rem; padding: .8rem 1.4rem; border-bottom: 1px solid var(--line); background: rgba(12,11,9,.85); backdrop-filter: blur(6px); position: sticky; top: 0; z-index: 30; }
.brand { display: flex; align-items: center; gap: .7rem; text-decoration: none; color: var(--text); font-family: var(--serif); font-size: 1.15rem; }
.brand img { width: 34px; height: 34px; border-radius: 8px; }
.brand b { color: var(--gold-hi); font-weight: 600; }
.top .grow { flex: 1; }
.user { display: flex; align-items: center; gap: .6rem; }
.user img, .avatar { width: 28px; height: 28px; border-radius: 50%; background: var(--panel2); object-fit: cover; }
.wrap { max-width: 1180px; margin: 0 auto; padding: 1.6rem 1.4rem 6rem; }
.crumbs { display: flex; gap: .5rem; align-items: center; color: var(--muted); margin-bottom: 1rem; font-size: .92rem; }
.crumbs a { color: var(--muted); text-decoration: none; } .crumbs a:hover { color: var(--gold-hi); }

/* Buttons */
button, .btn { font: inherit; cursor: pointer; border-radius: 8px; border: 1px solid var(--line2); background: var(--panel2); color: var(--text); padding: .5rem .95rem; text-decoration: none; display: inline-flex; align-items: center; gap: .4rem; transition: border-color .15s, background .15s; }
button:hover:not(:disabled), .btn:hover { border-color: var(--gold); }
button:focus-visible, .btn:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, summary:focus-visible { outline: 2px solid var(--gold-hi); outline-offset: 2px; }
button:disabled { opacity: .45; cursor: not-allowed; }
.primary { background: linear-gradient(180deg, var(--gold-hi), var(--gold)); color: #1a1200; border-color: var(--gold); font-weight: 600; }
.primary:hover:not(:disabled) { filter: brightness(1.08); }
.danger { color: #ff9a94; border-color: #5a2a27; }
.ghost { background: transparent; }
.icon { padding: .3rem .55rem; }

/* Serverliste */
.hero { margin: .6rem 0 1.6rem; } .hero p { color: var(--muted); margin: .4rem 0 0; max-width: 60ch; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 1rem; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 1.1rem; display: flex; flex-direction: column; gap: .8rem; }
.card .row { display: flex; align-items: center; gap: .8rem; }
.gicon { width: 52px; height: 52px; border-radius: 14px; background: var(--panel2); display: grid; place-items: center; font-family: var(--serif); font-size: 1.3rem; color: var(--gold-hi); object-fit: cover; flex: none; }
.card .name { font-weight: 600; overflow-wrap: anywhere; }
.pill { font-size: .75rem; padding: .1rem .5rem; border-radius: 99px; border: 1px solid var(--line2); color: var(--muted); }
.pill.ok { color: var(--ok); border-color: #2d5133; } .pill.bad { color: var(--bad); border-color: #5a2a27; } .pill.warn { color: var(--warn); border-color: #5b4513; }

/* Banner */
.banner { border: 1px solid #5b4513; background: rgba(227,167,42,.09); border-radius: 12px; padding: .9rem 1.1rem; margin-bottom: 1.2rem; display: flex; gap: 1rem; align-items: center; flex-wrap: wrap; }
.banner.bad { border-color: #5a2a27; background: rgba(220,90,84,.09); }
.banner .grow { flex: 1; min-width: 220px; }

/* Modul-Boxen */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1rem; }
.box { position: relative; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 1.1rem 1.1rem 1rem; cursor: pointer; display: flex; flex-direction: column; gap: .5rem; min-height: 150px; transition: transform .15s, border-color .15s; }
.box:hover { border-color: var(--gold); transform: translateY(-2px); }
.box.on { border-color: #6b5220; background: linear-gradient(180deg, rgba(214,154,31,.09), var(--panel) 60%); }
.box .head { display: flex; align-items: center; gap: .6rem; }
.box .ico { font-size: 1.5rem; } .box h3 { flex: 1; }
.box p { margin: 0; color: var(--muted); font-size: .9rem; flex: 1; }
.box .foot { display: flex; justify-content: space-between; align-items: center; color: var(--muted); font-size: .82rem; }
.box.locked { opacity: .42; filter: grayscale(.8); pointer-events: none; }
.box.pending { outline: 2px dashed var(--gold); outline-offset: 3px; }
.box.owner { border-style: dashed; border-color: #6f5a8a; }

/* Schalter */
.switch { position: relative; width: 44px; height: 24px; flex: none; display: inline-block; }
.switch input { position: absolute; inset: 0; opacity: 0; cursor: pointer; margin: 0; z-index: 1; }
.switch span { position: absolute; inset: 0; border-radius: 99px; background: #2a251d; border: 1px solid var(--line2); transition: background .15s; }
.switch span::after { content: ''; position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%; background: var(--muted); transition: transform .15s, background .15s; }
.switch input:checked + span { background: #5a4313; border-color: var(--gold); }
.switch input:checked + span::after { transform: translateX(20px); background: var(--gold-hi); }
.switch input:focus-visible + span { outline: 2px solid var(--gold-hi); outline-offset: 2px; }
.switch input:disabled { cursor: not-allowed; }

/* Speichern-Leiste */
.savebar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; display: flex; justify-content: center; padding: .9rem; pointer-events: none; transform: translateY(120%); transition: transform .2s; }
.savebar.show { transform: none; }
.savebar .in { pointer-events: auto; display: flex; align-items: center; gap: .9rem; background: #211b11; border: 1px solid var(--gold); border-radius: 14px; padding: .6rem .7rem .6rem 1.1rem; box-shadow: 0 10px 40px rgba(0,0,0,.6); }

/* Formulare */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 1.2rem 1.3rem; }
.form { display: flex; flex-direction: column; gap: 1rem; }
.field { display: flex; flex-direction: column; gap: .3rem; }
.field > label, .field > .lbl { font-size: .88rem; color: var(--muted); }
.field.inlinef { flex-direction: row; align-items: center; justify-content: space-between; gap: 1rem; padding: .15rem 0; }
.field.inlinef > .lbl { color: var(--text); font-size: .95rem; }
.hint { font-size: .8rem; color: var(--muted); }
input[type=text], input[type=url], input[type=number], input[type=date], input[type=time], select, textarea {
  font: inherit; color: var(--text); background: #100e0b; border: 1px solid var(--line2); border-radius: 8px; padding: .5rem .65rem; width: 100%; }
input[type=color] { width: 54px; height: 34px; padding: 2px; background: #100e0b; border: 1px solid var(--line2); border-radius: 8px; cursor: pointer; }
textarea { min-height: 84px; resize: vertical; }
fieldset { border: 1px solid var(--line); border-radius: 12px; padding: .9rem 1rem 1rem; margin: 0; display: flex; flex-direction: column; gap: .9rem; min-width: 0; }
legend { font-family: var(--serif); color: var(--gold-hi); padding: 0 .4rem; }
.colorrow { display: flex; gap: .6rem; align-items: center; }
.chips { display: flex; gap: .4rem; flex-wrap: wrap; }
.chip { cursor: pointer; user-select: none; }
.chip input { position: absolute; opacity: 0; pointer-events: none; }
.chip span { display: inline-block; padding: .3rem .7rem; border: 1px solid var(--line2); border-radius: 99px; font-size: .88rem; background: #100e0b; }
.chip input:checked + span { background: #5a4313; border-color: var(--gold); color: var(--gold-hi); }
.chip input:focus-visible + span { outline: 2px solid var(--gold-hi); }
details.multi { border: 1px solid var(--line2); border-radius: 8px; background: #100e0b; }
details.multi summary { padding: .5rem .65rem; cursor: pointer; }
.checklist { max-height: 220px; overflow: auto; padding: .3rem .65rem .6rem; display: grid; gap: .15rem; border-top: 1px solid var(--line); }
.checklist label { display: flex; gap: .5rem; align-items: center; cursor: pointer; }

/* Listen (Repeater) */
.list { display: flex; flex-direction: column; gap: .6rem; }
.item { border: 1px solid var(--line); border-radius: 10px; background: var(--panel2); }
.item > summary { display: flex; align-items: center; gap: .5rem; padding: .55rem .7rem; cursor: pointer; list-style: none; }
.item > summary::-webkit-details-marker { display: none; }
.item > summary::before { content: '▸'; color: var(--gold); transition: transform .15s; }
.item[open] > summary::before { transform: rotate(90deg); }
.item .t { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item .body { padding: .3rem .9rem 1rem; display: flex; flex-direction: column; gap: .9rem; }
.empty { color: var(--muted); font-style: italic; padding: .3rem 0; }

/* Embed-Vorschau */
.embedwrap { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1rem; }
@media (min-width: 980px) { .embedwrap.wide { grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); } }
.preview { background: #2b2d31; border-radius: 6px; padding: .8rem; align-self: start; position: sticky; top: 76px; }
.preview .lbl { font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; color: #949ba4; margin-bottom: .5rem; }
.pv { display: grid; grid-template-columns: 4px 1fr; border-radius: 4px; background: #232428; overflow: hidden; }
.pv .bar { background: var(--gold); }
.pv .c { padding: .6rem .8rem .8rem; color: #dbdee1; display: grid; gap: .3rem; position: relative; font-family: var(--sans); font-size: .9rem; min-width: 0; }
.pv .tt { font-weight: 700; color: #fff; overflow-wrap: anywhere; } .pv .ds { white-space: pre-wrap; overflow-wrap: anywhere; }
.pv .fl { display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem; }
.pv .fl > div { min-width: 0; } .pv .fl .n { font-weight: 700; font-size: .85rem; color: #fff; } .pv .fl .v { white-space: pre-wrap; overflow-wrap: anywhere; font-size: .85rem; }
.pv .fl > div.full { grid-column: 1 / -1; }
.pv img.big { max-width: 100%; border-radius: 4px; } .pv img.th { position: absolute; right: .6rem; top: .6rem; width: 56px; height: 56px; object-fit: cover; border-radius: 4px; }
.pv .ft { font-size: .75rem; color: #949ba4; }

/* Tabs */
.tabs { display: flex; gap: .4rem; margin: 0 0 1.2rem; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.tab { background: none; border: none; border-bottom: 2px solid transparent; border-radius: 0; padding: .6rem 1rem; color: var(--muted); }
.tab.active { color: var(--gold-hi); border-bottom-color: var(--gold-hi); }
.pagehead { display: flex; align-items: center; gap: 1rem; margin-bottom: 1.2rem; flex-wrap: wrap; }
.pagehead .grow { flex: 1; }

/* Event-Karten */
.plan { display: grid; gap: .6rem; }
.plan .meta { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.dates { display: flex; flex-wrap: wrap; gap: .4rem; }
.date { border: 1px solid var(--line2); border-radius: 8px; padding: .25rem .6rem; font-size: .85rem; background: #100e0b; }
.date.skip { text-decoration: line-through; color: var(--muted); }
.skipcheck { display: flex; flex-wrap: wrap; gap: .5rem; }
.skipcheck label { display: flex; gap: .4rem; align-items: center; border: 1px solid var(--line2); border-radius: 8px; padding: .3rem .6rem; font-size: .88rem; cursor: pointer; background: #100e0b; }

/* Anwesenheits-Tabelle */
.sheetbar { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; margin-bottom: .8rem; }
.seg { display: inline-flex; border: 1px solid var(--line2); border-radius: 8px; overflow: hidden; }
.seg button { border: none; border-radius: 0; background: #100e0b; } .seg button.on { background: #5a4313; color: var(--gold-hi); }
.sheetbar .range { font-family: var(--serif); font-size: 1.05rem; min-width: 190px; text-align: center; }
.presence { display: flex; align-items: center; gap: .4rem; margin-left: auto; color: var(--muted); font-size: .85rem; }
.presence .avatar { margin-left: -8px; border: 2px solid var(--bg); } .presence .avatar:first-of-type { margin-left: 0; }
.legend { display: flex; flex-wrap: wrap; gap: .4rem 1rem; font-size: .83rem; color: var(--muted); margin: .8rem 0 0; }
.legend span { display: inline-flex; gap: .4rem; align-items: center; }
.sheetscroll { overflow: auto; max-height: 70vh; border: 1px solid var(--line2); border-radius: 12px; background: #0f0d0a; }
table.sheet { border-collapse: separate; border-spacing: 0; font: 13px/1.3 var(--sans); min-width: 100%; }
.sheet th, .sheet td { border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 0; text-align: center; }
.sheet thead th { position: sticky; top: 0; background: #1a160f; z-index: 3; padding: .45rem .5rem; min-width: 84px; font-weight: 500; }
.sheet thead th small { display: block; color: var(--muted); font-size: .72rem; }
.sheet thead th.lock::after { content: ' 🔒'; font-size: .7rem; }
.sheet .namecol { position: sticky; left: 0; z-index: 2; background: #151209; text-align: left; padding: .35rem .7rem; min-width: 210px; max-width: 260px; }
.sheet thead th.namecol { z-index: 4; background: #1a160f; }
.namecell { display: flex; align-items: center; gap: .55rem; } .namecell .avatar { width: 24px; height: 24px; }
.namecell .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .namecell small { color: var(--muted); display: block; font-size: .72rem; }
.sheet td.cell { height: 40px; font-size: 1.05rem; user-select: none; position: relative; }
.sheet td.cell.edit { cursor: pointer; } .sheet td.cell.edit:hover { background: rgba(246,201,74,.1); }
.s-yes { color: var(--ok); background: rgba(98,176,109,.12); } .s-no { color: var(--bad); background: rgba(220,90,84,.12); }
.s-maybe { color: var(--warn); background: rgba(227,167,42,.12); font-weight: 700; } .s-none { color: #6d6556; }
.s-notyet { color: var(--info); background: repeating-linear-gradient(135deg, rgba(111,143,176,.14) 0 6px, transparent 6px 12px); }
.s-left { color: #8a6f6f; background: repeating-linear-gradient(135deg, rgba(138,111,111,.16) 0 6px, transparent 6px 12px); }
.s-noaccess { color: #5d5648; background: repeating-linear-gradient(45deg, rgba(120,120,120,.1) 0 6px, transparent 6px 12px); }
.cell .ed { position: absolute; top: 2px; right: 4px; font-size: .6rem; color: var(--gold); }
.cell.flash { animation: flash 1.2s ease-out; } @keyframes flash { from { box-shadow: inset 0 0 0 3px var(--gold-hi); } to { box-shadow: inset 0 0 0 0 transparent; } }
.cell .who { position: absolute; left: 0; top: -1px; font-size: .62rem; padding: 0 .3rem; background: var(--gold); color: #1a1200; z-index: 2; white-space: nowrap; border-radius: 0 0 4px 0; }
.cell.focused { outline: 2px solid var(--gold-hi); outline-offset: -2px; }
.sheet tfoot td, .sheet tfoot th { position: sticky; bottom: 0; background: #1a160f; padding: .35rem .4rem; font-size: .78rem; color: var(--muted); z-index: 3; }
.sheet tfoot th.namecol { z-index: 5; }
.menu { position: fixed; z-index: 60; background: #211b11; border: 1px solid var(--gold); border-radius: 10px; padding: .3rem; display: grid; gap: .15rem; min-width: 190px; box-shadow: 0 10px 40px rgba(0,0,0,.6); }
.menu button { border: none; background: transparent; justify-content: flex-start; } .menu button:hover { background: #2f2616; }

/* Toasts */
#toasts { position: fixed; top: 70px; right: 1rem; z-index: 80; display: grid; gap: .5rem; }
.toast { background: #211b11; border: 1px solid var(--gold); border-radius: 10px; padding: .6rem .9rem; max-width: 380px; box-shadow: 0 8px 30px rgba(0,0,0,.5); }
.toast.bad { border-color: var(--bad); } .toast.ok { border-color: var(--ok); }

.login { max-width: 520px; margin: 12vh auto; text-align: center; display: grid; gap: 1.2rem; justify-items: center; }
.login img { width: 84px; border-radius: 18px; }
@media (max-width: 640px) { .wrap { padding: 1rem .8rem 6rem; } .top { padding: .6rem .8rem; } .sheet .namecol { min-width: 150px; } }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* Tabellen (Rangliste, Einträge, Tickets) */
table.tbl { border-collapse: collapse; width: 100%; font-size: .92rem; }
.tbl th, .tbl td { padding: .55rem .8rem; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl thead th { position: sticky; top: 0; background: #1a160f; color: var(--muted); font-weight: 500; font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; }
.tbl .warnc { color: var(--warn); font-weight: 700; }
.qbar { position: relative; min-width: 130px; height: 22px; border-radius: 6px; background: #100e0b; border: 1px solid var(--line2); overflow: hidden; }
.qbar span { position: absolute; inset: 0 auto 0 0; background: rgba(98,176,109,.35); }
.qbar b { position: relative; padding-left: .5rem; line-height: 20px; font-size: .8rem; }
