/* Eisenbiker – Verwaltungsbereich */
@font-face { font-family: "Anton"; src: url("../fonts/anton.woff") format("woff"); font-display: swap; }
@font-face { font-family: "DM Sans"; src: url("../fonts/dmsans.woff") format("woff"); font-weight: 100 1000; font-display: swap; }

:root {
    --bg: #0d0d0f; --surface: #16161a; --surface-2: #1d1d22; --input: #0f0f12;
    --line: rgba(255,255,255,.09); --line-gold: rgba(214,180,90,.3);
    --text: #ece8df; --muted: #9b968b;
    --gold: #d6b45a; --gold-light: #f2d98e; --gold-grad: linear-gradient(180deg, #f4dc93, #d6b45a 55%, #b08b33);
    --red: #e0564b; --green: #5fbf7a;
    --r: 12px;
    --head: "Anton", "Arial Narrow", Impact, sans-serif;
    --body: "DM Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.55 var(--body); -webkit-font-smoothing: antialiased; }
a { color: var(--gold); text-decoration: none; }
a:hover { color: var(--gold-light); }
img { max-width: 100%; display: block; }
h1, h2, h3 { font-family: var(--head); font-weight: 400; text-transform: uppercase; letter-spacing: .03em; line-height: 1.1; margin: 0 0 .7em; }
h2 { font-size: 1.3rem; }
h3 { font-size: 1.05rem; }
code { background: rgba(255,255,255,.08); padding: .05em .35em; border-radius: 4px; font-size: .92em; }
.muted { color: var(--muted); }
.small { font-size: .87rem; }
.lead { font-size: 1.05rem; margin-top: -8px; }
:focus-visible { outline: 2px solid var(--gold-light); outline-offset: 2px; }

/* Layout */
.admin { display: grid; grid-template-columns: 250px 1fr; min-height: 100vh; }
.admin-guest { display: block; }
.sidebar {
    position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column;
    background: #0a0a0c; border-right: 1px solid var(--line); padding: 22px 14px;
}
.sb-brand { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; padding: 6px 12px 22px; margin-bottom: 10px; border-bottom: 1px solid var(--line); }
.sb-brand img { width: 120px; }
.sb-brand span { font-family: var(--head); text-transform: uppercase; letter-spacing: .2em; font-size: .85rem; color: var(--muted); }
.sb-nav { display: flex; flex-direction: column; gap: 2px; }
.sb-nav a { display: flex; align-items: center; gap: 12px; padding: 11px 12px; border-radius: 10px; color: var(--text); font-weight: 600; transition: background .15s; }
.sb-nav a svg { width: 20px; height: 20px; color: var(--muted); flex: none; }
.sb-nav a:hover { background: rgba(255,255,255,.05); }
.sb-nav a.active { background: rgba(214,180,90,.12); color: var(--gold-light); }
.sb-nav a.active svg { color: var(--gold); }
.sb-foot { margin-top: auto; display: grid; gap: 8px; padding: 14px 12px 0; border-top: 1px solid var(--line); }
.sb-site { font-size: .9rem; font-weight: 600; }
.sb-logout { background: none; border: 0; padding: 0; color: var(--muted); font: inherit; font-size: .9rem; cursor: pointer; text-align: left; }
.sb-logout:hover { color: var(--red); }

.content { padding: 36px clamp(18px, 4vw, 48px) 80px; max-width: 1100px; width: 100%; }
.page-title { font-size: clamp(1.8rem, 4vw, 2.4rem); background: var(--gold-grad); -webkit-background-clip: text; background-clip: text; color: transparent; }

@media (max-width: 860px) {
    .admin { grid-template-columns: 1fr; align-content: start; }
    .sidebar { position: static; height: auto; display: block; padding: 8px; border-right: 0; border-bottom: 1px solid var(--line); }
    .sb-brand, .sb-site { display: none; }
    .sb-nav { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; }
    .sb-nav a { flex-direction: column; gap: 3px; padding: 8px 2px; font-size: .72rem; text-align: center; white-space: nowrap; }
    .sb-foot { margin: 6px 0 0; padding: 6px 4px 0; display: flex; justify-content: flex-end; }
    .sb-logout { font-size: .8rem; }
    .content { padding-top: 22px; }
}

/* Cards & Grids */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 24px; margin-bottom: 22px; }
.card.empty { text-align: center; color: var(--muted); padding: 40px; border-style: dashed; }
.card-todo { border-color: var(--line-gold); background: linear-gradient(135deg, rgba(214,180,90,.1), transparent 60%), var(--surface); }
.todo { margin: 0; padding-left: 1.2em; display: grid; gap: 6px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; align-items: start; }
.grid-2 > .card { margin-bottom: 0; }
@media (max-width: 860px) { .grid-2 { grid-template-columns: 1fr; } }

.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 22px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 20px; color: var(--text); transition: border-color .2s; }
.stat:hover { border-color: var(--line-gold); color: var(--text); }
.stat strong { display: block; font-family: var(--head); font-size: 2.4rem; font-weight: 400; line-height: 1; color: var(--gold-light); }
.stat span { color: var(--muted); font-size: .9rem; }
@media (max-width: 560px) { .stats { gap: 8px; } .stat { padding: 14px; } .stat strong { font-size: 1.8rem; } .stat span { font-size: .78rem; } }
.quick { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 26px; }

.list { list-style: none; margin: 0; padding: 0; }
.list li { border-top: 1px solid var(--line); }
.list li:first-child { border-top: 0; }
.list a { display: block; padding: 10px 0; color: var(--text); }
.list a:hover { color: var(--gold-light); }
.list strong { color: var(--gold); margin-right: 8px; font-variant-numeric: tabular-nums; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .4em; padding: .75em 1.3em; border-radius: 999px; border: 1px solid transparent; font: 700 .9rem/1.1 var(--body); letter-spacing: .03em; cursor: pointer; transition: transform .15s, background .15s, border-color .15s; text-decoration: none; white-space: nowrap; }
.btn:active { transform: scale(.97); }
.btn-gold { background: var(--gold-grad); color: #17130a; }
.btn-gold:hover { color: #17130a; filter: brightness(1.07); }
.btn-outline { border-color: var(--line-gold); color: var(--gold); background: transparent; }
.btn-outline:hover { background: rgba(214,180,90,.1); }
.btn-ghost { background: rgba(255,255,255,.06); color: var(--text); border-color: var(--line); }
.btn-ghost:hover { background: rgba(255,255,255,.1); color: var(--text); }
.btn-danger { background: rgba(224,86,75,.12); color: #ff8a80; border-color: rgba(224,86,75,.35); }
.btn-danger:hover { background: rgba(224,86,75,.25); color: #ffb0a8; }
.btn-sm { padding: .5em .9em; font-size: .8rem; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

.tag { display: inline-block; font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; padding: .15em .55em; border-radius: 999px; background: rgba(214,180,90,.15); color: var(--gold); vertical-align: middle; }
.tag-red { background: rgba(224,86,75,.15); color: #ff8a80; }

/* Alerts */
.alert { padding: 13px 16px; border-radius: 10px; margin-bottom: 18px; border: 1px solid; font-weight: 500; }
.alert-success { background: rgba(95,191,122,.1); border-color: rgba(95,191,122,.35); color: #a6e8b8; }
.alert-error { background: rgba(224,86,75,.1); border-color: rgba(224,86,75,.4); color: #ffb0a8; }
.alert-info { background: rgba(214,180,90,.08); border-color: var(--line-gold); color: var(--gold-light); }

/* Forms */
.form .row { display: flex; flex-wrap: wrap; gap: 16px; }
.form .row > .field { flex: 1 1 180px; }
.form .row > .field.grow { flex: 3 1 260px; }
.field { margin-bottom: 18px; }
.field > label { display: block; font-weight: 700; font-size: .88rem; margin-bottom: 6px; color: #d9d4c9; }
.req { color: var(--gold); }
input[type=text], input[type=password], input[type=email], input[type=url], input[type=tel], input[type=date], input[type=time], input[type=number], textarea {
    width: 100%; background: var(--input); color: var(--text); border: 1px solid var(--line); border-radius: 10px;
    padding: 12px 14px; font: 16px/1.4 var(--body); transition: border-color .15s, box-shadow .15s;
    color-scheme: dark;
}
textarea { resize: vertical; min-height: 90px; line-height: 1.55; }
input:focus, textarea:focus { outline: 0; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(214,180,90,.18); }
.help { display: block; color: var(--muted); font-size: .8rem; margin-top: 6px; }
.check { display: flex; align-items: center; gap: 10px; cursor: pointer; font-size: .95rem; margin: 6px 0 18px; }
.check input { width: 18px; height: 18px; accent-color: var(--gold); }
.check-red strong { color: #ff8a80; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 8px; }
.sticky-actions { position: sticky; bottom: 0; padding: 14px 0; background: linear-gradient(transparent, var(--bg) 35%); z-index: 5; }

.dropzone {
    position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; text-align: center;
    border: 2px dashed var(--line-gold); border-radius: var(--r); padding: 26px 16px; cursor: pointer;
    background: rgba(214,180,90,.03); transition: background .2s, border-color .2s;
}
.dropzone:hover, .dropzone:focus-within { background: rgba(214,180,90,.08); border-color: var(--gold); }
.dropzone input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; }
.dz-text { font-weight: 700; color: var(--gold-light); }
.dropzone small { color: var(--muted); font-size: .8rem; }
.dropzone-lg { padding: 44px 16px; margin-bottom: 14px; }
.preview { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.preview img { width: 84px; height: 84px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); }
.current-image { display: flex; align-items: center; gap: 16px; margin-bottom: 12px; }
.current-image img { width: 140px; height: 96px; object-fit: cover; border-radius: 10px; border: 1px solid var(--line); }
.current-image.wide img { width: 240px; height: 120px; }
.current-image .check { margin: 0; }

.danger-zone { display: flex; flex-wrap: wrap; gap: 10px; justify-content: space-between; align-items: center; padding: 18px 0; border-top: 1px solid var(--line); }
.danger-zone form { margin-left: auto; }

/* Listen / Tabellen */
.toolbar { display: flex; justify-content: flex-end; gap: 10px; margin-bottom: 16px; }
.toolbar-bulk { justify-content: flex-start; }
.sub { margin-top: 10px; }
.table { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; margin-bottom: 22px; }
.tr { display: flex; align-items: center; gap: 16px; padding: 14px 18px; border-top: 1px solid var(--line); }
.tr:first-child { border-top: 0; }
.tr:hover { background: rgba(255,255,255,.02); }
.td-thumb { width: 64px; height: 46px; flex: none; border-radius: 8px; overflow: hidden; background: var(--surface-2); }
.td-thumb img { width: 100%; height: 100%; object-fit: cover; }
.td-date { width: 56px; flex: none; text-align: center; background: rgba(214,180,90,.1); border: 1px solid var(--line-gold); border-radius: 10px; padding: 6px 0; line-height: 1.1; }
.td-date strong { display: block; font-family: var(--head); font-weight: 400; font-size: 1.4rem; color: var(--gold-light); }
.td-date span { font-size: .7rem; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.td-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.td-title { color: var(--text); font-weight: 700; }
.td-main small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.td-actions { display: flex; gap: 6px; flex: none; }
@media (max-width: 560px) { .td-actions .btn-ghost { display: none; } .tr { gap: 12px; padding: 12px; } }
details.past summary { cursor: pointer; font-family: var(--head); text-transform: uppercase; letter-spacing: .03em; font-size: 1.1rem; color: var(--muted); margin: 10px 0 14px; }

/* Bilder-Verwaltung */
.img-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 14px; }
.img-card { position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.img-card:target { border-color: var(--gold); }
.img-card img { width: 100%; aspect-ratio: 4/3; object-fit: cover; }
.img-select { position: absolute; top: 8px; left: 8px; z-index: 2; background: rgba(0,0,0,.6); border-radius: 6px; padding: 5px; display: flex; }
.img-select input { width: 18px; height: 18px; accent-color: var(--red); margin: 0; }
.img-form { padding: 10px; display: grid; gap: 6px; }
.img-form input[type=text] { padding: 8px 10px; font-size: .88rem; }
.img-actions { display: flex; gap: 6px; justify-content: space-between; }
@media (max-width: 480px) { .img-grid { grid-template-columns: 1fr 1fr; gap: 8px; } .img-actions { flex-direction: column; } }

/* Benutzer */
.users { list-style: none; padding: 0; margin: 0 0 22px; }
.users li { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 12px 0; border-top: 1px solid var(--line); }
.users li:first-child { border-top: 0; }
.add-user { border-top: 1px solid var(--line); padding-top: 18px; }

/* Login */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: radial-gradient(50% 50% at 50% 30%, rgba(214,180,90,.12), transparent 70%); }
.auth-card { width: min(420px, 100%); background: var(--surface); border: 1px solid var(--line-gold); border-radius: 18px; padding: 34px 30px; box-shadow: 0 30px 80px -30px rgba(0,0,0,.8); }
.auth-logo { width: 220px; margin: 0 auto 22px; }
.auth-card h1 { text-align: center; font-size: 1.6rem; margin-bottom: .3em; }
.auth-card > p { text-align: center; margin: 0 0 22px; }
.auth-card .btn-block { margin-top: 6px; padding: 1em; }
.back-link { display: block; text-align: center; margin-top: 18px; font-size: .9rem; color: var(--muted); }
.admin-guest .content { padding: 0; max-width: none; }

/* ==========================================================================
   E-Mail
   ========================================================================== */
select { width: 100%; background: var(--input); color: var(--text); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; font: 16px var(--body); color-scheme: dark; }
input[type=search] { width: 100%; background: var(--input); color: var(--text); border: 1px solid var(--line); border-radius: 999px; padding: 8px 14px; font: 15px var(--body); color-scheme: dark; }
input[type=search]:focus, select:focus { outline: 0; border-color: var(--gold); }
details.adv summary { cursor: pointer; display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; list-style: none; }
details.adv summary::-webkit-details-marker { display: none; }
details.adv summary h2 { margin: 0; }
details.adv summary::before { content: "▸"; color: var(--gold); }
details.adv[open] summary { margin-bottom: 18px; }
details.adv[open] summary::before { content: "▾"; }

.content:has(.mail-layout) { max-width: 1280px; }
.mail-layout { display: grid; grid-template-columns: 210px 1fr; gap: 22px; align-items: start; }
.mail-side { position: sticky; top: 20px; display: grid; gap: 14px; }
.mail-folders { display: grid; gap: 2px; }
.mail-folders a { display: flex; justify-content: space-between; align-items: center; padding: 9px 12px; border-radius: 10px; color: var(--text); font-weight: 600; font-size: .95rem; }
.mail-folders a:hover { background: rgba(255,255,255,.05); }
.mail-folders a.active { background: rgba(214,180,90,.12); color: var(--gold-light); }
.mail-folders b { background: var(--gold); color: #17130a; font-size: .72rem; border-radius: 999px; padding: .1em .55em; }
.mail-settings { font-size: .88rem; color: var(--muted); padding: 0 12px; }
.mail-main { min-width: 0; }
.mail-toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.mail-toolbar form { margin: 0; }
.mail-toolbar .spacer { flex: 1; }
.mail-folder-title { margin: 0; font-size: 1.4rem; }
.mail-search { width: min(260px, 100%); }
.mail-list { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.mail-row { display: grid; grid-template-columns: 200px 1fr auto; gap: 16px; align-items: center; padding: 12px 18px; border-top: 1px solid var(--line); color: var(--muted); }
.mail-row:first-child { border-top: 0; }
.mail-row:hover { background: rgba(255,255,255,.03); color: var(--text); }
.mail-row span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mail-row.unread { color: var(--text); background: rgba(214,180,90,.04); }
.mail-row.unread .mr-from, .mail-row.unread .mr-subject { font-weight: 700; }
.mail-row.unread .mr-from::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--gold); margin-right: 8px; vertical-align: middle; }
.mr-subject i { color: var(--gold); font-style: normal; }
.mr-meta { font-size: .85rem; font-variant-numeric: tabular-nums; }
.mail-pager { display: flex; justify-content: center; align-items: center; gap: 14px; margin-top: 16px; }

.mail-read { padding: 26px; }
.mail-subject { font-family: var(--body); text-transform: none; letter-spacing: 0; font-weight: 700; font-size: 1.35rem; line-height: 1.3; }
.mail-meta { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; margin: 0 0 16px; font-size: .92rem; }
.mail-meta dt { color: var(--muted); }
.mail-meta dd { margin: 0; word-break: break-word; }
.mail-atts { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.att { display: inline-flex; gap: 6px; align-items: center; padding: 7px 12px; border: 1px solid var(--line-gold); border-radius: 999px; font-size: .88rem; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.att small { color: var(--muted); }
.mail-view-toggle { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; padding: 3px; margin-bottom: 12px; }
.mail-view-toggle a { padding: 4px 12px; border-radius: 999px; font-size: .82rem; color: var(--muted); }
.mail-view-toggle a.active { background: rgba(214,180,90,.15); color: var(--gold-light); }
.mail-text { white-space: normal; line-height: 1.6; border-top: 1px solid var(--line); padding-top: 16px; word-break: break-word; }
.mail-frame { width: 100%; height: 70vh; min-height: 420px; border: 0; border-radius: 10px; background: #fff; }
.img-note { background: rgba(214,180,90,.08); border: 1px solid var(--line-gold); border-radius: 8px; padding: 8px 12px; margin: 0 0 10px; }
.move-form { display: flex; align-items: center; gap: 8px; margin-top: 4px; }
.move-form select { width: auto; padding: 6px 10px; font-size: .9rem; }

.compose-from { margin-bottom: 14px; }
.cc-toggle summary { cursor: pointer; color: var(--gold); font-size: .88rem; margin: -8px 0 14px; }
.mail-body { min-height: 300px; font-family: var(--body); }
.file-list { flex-direction: column; gap: 4px; font-size: .9rem; color: var(--muted); }
.mail-badge { display: inline-block; background: var(--gold); color: #17130a; border-radius: 999px; font-size: .8rem; padding: .1em .6em; font-weight: 800; margin-left: 6px; }

@media (max-width: 860px) {
    .mail-layout { grid-template-columns: 1fr; gap: 14px; }
    .mail-side { position: static; gap: 10px; }
    .mail-folders { display: flex; flex-wrap: wrap; gap: 6px; }
    .mail-folders a { padding: 6px 12px; border: 1px solid var(--line); border-radius: 999px; font-size: .88rem; gap: 6px; }
    .mail-folders a.active { border-color: var(--line-gold); }
    .mail-settings { padding: 0; font-size: .82rem; }
    .mail-row { grid-template-columns: 1fr auto; gap: 2px 10px; padding: 12px 14px; }
    .mail-row .mr-from { grid-column: 1; }
    .mail-row .mr-meta { grid-column: 2; grid-row: 1; }
    .mail-row .mr-subject { grid-column: 1 / -1; font-size: .92rem; }
    .mail-search { width: 100%; order: 5; }
    .mail-read { padding: 18px; }
    .mail-frame { height: 65vh; }
}
.stats-4 { grid-template-columns: repeat(4, 1fr); }
.stat-mail { border-color: var(--line-gold); background: linear-gradient(135deg, rgba(214,180,90,.12), transparent 70%), var(--surface); }
@media (max-width: 700px) { .stats-4 { grid-template-columns: repeat(2, 1fr); } }
.gpx-box { border: 1px solid var(--line-gold); border-radius: var(--r); padding: 16px 18px 4px; margin: 4px 0 20px; background: rgba(214,180,90,.03); }
.gpx-box legend { font-family: var(--head); text-transform: uppercase; letter-spacing: .05em; color: var(--gold); padding: 0 8px; }
.gpx-box p { margin: 0 0 12px; }
.gpx-current { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; background: var(--surface-2); border-radius: 10px; padding: 10px 14px; margin-bottom: 10px; }
.gpx-current .check { margin: 0; }
.gpx-box .dropzone { padding: 18px 12px; }
.gpx-box .row { margin-top: 14px; }
.import-card summary { cursor: pointer; list-style: none; }
.import-card summary::-webkit-details-marker { display: none; }
.import-card summary h2 { margin: 0; display: inline; }
.import-card summary::before { content: "▸ "; color: var(--gold); }
.import-card[open] summary { margin-bottom: 16px; }
.import-card[open] summary::before { content: "▾ "; }
.import-card:not([open]) { display: none; }
.import-card:target, .import-card[open] { display: block; }
.sb-nav a.sb-home { color: var(--gold); margin-bottom: 6px; border: 1px solid var(--line-gold); }
.sb-nav a.sb-home svg { color: var(--gold); }
@media (max-width: 860px) { .sb-nav a.sb-home { margin-bottom: 0; } }
