/* Adminbereich – baut auf css/style.css auf (Farben, Schriften, Körnung) */

body.admin { min-height: 100vh; color-scheme: dark; }
[hidden] { display: none !important; }

body.admin .nav { width: min(1240px, 100% - 2.5rem); }
.admin-tag {
    font: 700 .7rem/1 var(--font-cond); font-stretch: 75%; letter-spacing: .08em; text-transform: uppercase;
    background: var(--red-dark); color: #fff; padding: .25rem .45rem; margin-left: .15rem;
}
.admin-back { color: var(--text); text-decoration: none; font: 700 1rem var(--font-cond); font-stretch: 75%; }
.admin-back:hover { color: #fff; text-decoration: underline; }

.admin-main { width: min(1240px, 100% - 2.5rem); margin: 0 auto; padding: 1.5rem 0 4rem; }
.admin-title { font: 400 clamp(2.2rem, 5vw, 3rem)/1.1 var(--font-black); color: #fff; margin: 1rem 0 1.25rem; }
.admin-main h2 { font-size: 1.8rem; color: #fff; }

.notice {
    border-left: 4px solid var(--red-dark); background: rgba(0, 0, 0, .25);
    padding: .75rem 1rem; font-size: .92rem; color: var(--text-muted);
}
.notice strong { color: var(--text); }

/* ---------- Buttons ---------- */
.btn--small { padding: .45rem 1rem; font-size: .98rem; cursor: pointer; }
button.btn { font-family: var(--font-cond); }
.icon-btn {
    width: 2.4rem; height: 2.4rem; border: 1px solid var(--line); background: transparent; color: var(--text);
    font-size: 1.4rem; line-height: 1; cursor: pointer;
}
.icon-btn:hover { border-color: #fff; color: #fff; }
.btn-danger {
    background: transparent; border: 1px solid #a85050; color: #e9a1a1; padding: .4rem .9rem;
    font: 700 .95rem var(--font-cond); font-stretch: 75%; cursor: pointer;
}
.btn-danger:hover { background: #7d2326; border-color: #7d2326; color: #fff; }

/* ---------- Werkzeugleiste ---------- */
.toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; }
.toolbar__nav, .toolbar__right { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.toolbar__month { margin: 0 .4rem; min-width: 11ch; text-align: center; font-family: var(--font-black); font-size: 2rem !important; font-weight: 400; }

.segmented { display: inline-flex; border: 1px solid var(--line); }
.segmented button {
    background: transparent; color: var(--text-muted); border: 0; padding: .45rem .9rem; cursor: pointer;
    font: 700 .95rem var(--font-cond); font-stretch: 75%;
}
.segmented button + button { border-left: 1px solid var(--line); }
.segmented button:hover { color: #fff; }
.segmented button[aria-pressed="true"] { background: var(--red-dark); color: #fff; }

/* ---------- Monatsansicht ---------- */
.admin-grid { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 1.5rem; align-items: start; }

.month__weekdays, .month__days { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.month__weekdays span {
    padding: .4rem .5rem; font: 700 .85rem var(--font-cond); font-stretch: 75%; color: var(--text-muted);
    border: 1px solid var(--line); border-bottom: 0; background: rgba(0, 0, 0, .2);
}
.month__weekdays span + span { border-left: 0; }
.month__days { border-top: 1px solid var(--line); border-left: 1px solid var(--line); }

.day {
    min-height: 118px; padding: .3rem .35rem; background: var(--bg-panel);
    border-right: 1px solid var(--line); border-bottom: 1px solid var(--line);
    display: flex; flex-direction: column; gap: 3px; cursor: pointer; min-width: 0;
}
.day:hover { background: #4d4d4d; }
.day--other { background: #3a3a3a; }
.day--other .day__num { color: #a7aba3; }
.day--selected { outline: 2px solid var(--red); outline-offset: -2px; position: relative; z-index: 1; }
.day__num {
    align-self: flex-start; min-width: 1.7rem; height: 1.7rem; padding: 0 .35rem; display: grid; place-items: center;
    background: none; border: 0; color: var(--text); font: 600 .9rem var(--font-body); cursor: pointer;
}
.day--today .day__num { background: var(--red-dark); color: #fff; }

.chip {
    display: flex; align-items: center; gap: .35rem; width: 100%; min-width: 0; text-align: left;
    padding: 2px 6px; background: rgba(255, 255, 255, .08); border: 0; border-left: 3px solid var(--accent-light);
    color: var(--text); font: 500 .78rem/1.35 var(--font-body); cursor: pointer;
}
.chip:hover { background: rgba(255, 255, 255, .16); }
.chip--public { border-left-color: var(--red); background: rgba(142, 27, 31, .38); }
.chip--public:hover { background: rgba(142, 27, 31, .6); }
.chip__text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
.chip__time { color: var(--text-muted); font-variant-numeric: tabular-nums; }
.chip__web { font: 700 .6rem/1 var(--font-cond); letter-spacing: .06em; color: #f0b3b0; }
.more { font-size: .75rem; color: var(--text-muted); padding-left: 6px; background: none; border: 0; text-align: left; cursor: pointer; }
.more:hover { color: #fff; }
.dots { display: none; gap: 3px; flex-wrap: wrap; }
.dot-mark { width: 7px; height: 7px; background: var(--accent-light); }
.dot-mark--public { background: var(--red); }

.legend { display: flex; flex-wrap: wrap; gap: 1.25rem; margin: .75rem 0 0; font-size: .85rem; color: var(--text-muted); }
.swatch { display: inline-block; width: .8rem; height: .8rem; margin-right: .35rem; vertical-align: -1px; }
.swatch--public { background: var(--red); }
.swatch--internal { background: var(--accent-light); }

/* ---------- Tagesansicht ---------- */
.day-panel { background: var(--bg-panel); border: 1px solid var(--line); padding: 1rem 1.1rem 1.25rem; position: sticky; top: 76px; }
.day-panel__title { font-family: var(--font-cond) !important; font-stretch: 75%; font-weight: 700; font-size: 1.25rem !important; margin-bottom: .75rem; }
.day-list { list-style: none; margin: 0 0 1rem; padding: 0; display: grid; gap: .6rem; }
.day-list__empty { color: var(--text-muted); font-size: .92rem; }
.day-item { border: 1px solid var(--line); border-left: 4px solid var(--accent-light); padding: .6rem .7rem; }
.day-item--public { border-left-color: var(--red); }
.day-item__title { font-weight: 700; margin: 0; }
.day-item__meta { margin: .1rem 0 0; font-size: .85rem; color: var(--text-muted); }
.day-item__notes { margin: .4rem 0 0; font-size: .85rem; white-space: pre-wrap; }
.day-item__actions { margin-top: .5rem; }
.link-btn { background: none; border: 0; padding: 0; color: var(--text); font: 600 .85rem var(--font-body); text-decoration: underline; text-decoration-color: var(--red-dark); text-underline-offset: 3px; cursor: pointer; }
.link-btn:hover { color: #fff; }
.badge { display: inline-block; font: 700 .7rem/1 var(--font-cond); font-stretch: 75%; letter-spacing: .05em; text-transform: uppercase; padding: .2rem .4rem; background: var(--red-dark); color: #fff; }
.badge--internal { background: transparent; border: 1px solid var(--text-muted); color: var(--text-muted); }

/* ---------- Anstehende Termine ---------- */
.upcoming, .datatools { margin-top: 3rem; }
.up-list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.up-item {
    display: grid; grid-template-columns: 9.5rem 7rem minmax(0, 1.6fr) minmax(0, 1fr) 12rem auto;
    gap: .25rem 1rem; align-items: baseline; padding: .7rem .25rem; border-bottom: 1px dashed var(--line);
}
.up-item__date { font: 700 1.1rem var(--font-cond); font-stretch: 75%; color: #fff; }
.up-item__time, .up-item__loc { color: var(--text-muted); font-size: .92rem; }
.up-item__title { font-weight: 700; }
.up-item__series { font-weight: 400; color: var(--text-muted); font-size: .8rem; margin-left: .35rem; }
.up-item__vis { font-size: .88rem; }
.up-empty { color: var(--text-muted); padding: .75rem 0; }

.datatools p { color: var(--text-muted); max-width: 62ch; }
.datatools__buttons { display: flex; gap: .6rem; flex-wrap: wrap; }

/* ---------- Dialog ---------- */
.dlg {
    color-scheme: dark; scrollbar-color: #7a7a7a #2e2e2e;
    width: min(600px, calc(100% - 1.5rem)); max-height: calc(100vh - 2rem); overflow: auto;
    background: #424242; color: var(--text); border: 1px solid var(--line); border-top: 3px solid var(--red-dark); padding: 1.5rem 1.6rem;
}
.dlg::backdrop { background: rgba(0, 0, 0, .7); }
.dlg h2 { font-size: 2rem; margin-bottom: 1rem; }
.field { display: grid; gap: .3rem; margin-bottom: .9rem; min-width: 0; }
.field label, .field legend { font: 700 .92rem var(--font-cond); font-stretch: 75%; color: var(--text); }
.field small { color: var(--text-muted); font-size: .8rem; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: .9rem; }
.dlg input[type="text"], .dlg input:not([type]), .dlg input[type="date"], .dlg input[type="time"], .dlg select, .dlg textarea {
    width: 100%; background: #2e2e2e; color: var(--text); border: 1px solid rgba(225, 230, 221, .3);
    padding: .55rem .7rem; font: 400 1rem var(--font-body); border-radius: 2px;
}
.dlg textarea { resize: vertical; }
.dlg input:focus-visible, .dlg select:focus-visible, .dlg textarea:focus-visible { outline: 2px solid var(--red); outline-offset: 0; border-color: transparent; }
.dlg input[aria-invalid="true"] { border-color: var(--red); }
.public-box { border: 1px solid var(--line); background: rgba(0, 0, 0, .15); padding: .8rem .9rem .1rem; margin: .4rem 0 1.1rem; }
.public-box .check { margin-bottom: .8rem; }
.public-box .field:last-child { margin-bottom: .8rem; }
.check { display: flex; align-items: center; gap: .6rem; font-weight: 600; cursor: pointer; }
.check input { width: 1.15rem; height: 1.15rem; accent-color: var(--red-dark); }

.form-error { background: rgba(216, 53, 47, .16); border-left: 4px solid var(--red); padding: .55rem .8rem; margin: 0 0 1rem; font-size: .92rem; }
.series-note { background: rgba(0, 0, 0, .2); border-left: 4px solid var(--accent-light); padding: .55rem .8rem; margin: 0 0 1rem; font-size: .88rem; color: var(--text-muted); }
.dlg-actions { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.dlg-actions .spacer { flex: 1; }
.dlg-confirm { background: rgba(0, 0, 0, .25); padding: .7rem .8rem; border-left: 4px solid var(--red); }

/* ---------- Hinweis-Einblendung ---------- */
.toast {
    position: fixed; left: 50%; bottom: 1.5rem; transform: translate(-50%, 20px); z-index: 200;
    background: #202323; color: #fff; border-left: 4px solid var(--red-dark); padding: .65rem 1.1rem;
    opacity: 0; pointer-events: none; transition: opacity .25s, transform .25s;
}
.toast.is-shown { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Responsive ---------- */
@media (max-width: 1000px) {
    .admin-grid { grid-template-columns: 1fr; }
    .day-panel { position: static; }
    .up-item { grid-template-columns: 8.5rem minmax(0, 1fr) auto; }
    .up-item__time, .up-item__loc { grid-column: 2; }
    .up-item__vis { grid-column: 2; }
    .up-item__edit { grid-row: 1; grid-column: 3; }
    .up-item__title { grid-column: 2; grid-row: 1; }
}
@media (max-width: 700px) {
    .day { min-height: 54px; padding: .2rem; align-items: center; }
    .day__num { align-self: center; }
    .chip, .more { display: none; }
    .dots { display: flex; justify-content: center; }
    .month__weekdays span { text-align: center; padding: .35rem 0; }
    .toolbar__month { font-size: 1.6rem !important; min-width: 0; }
    .row2 { grid-template-columns: 1fr; gap: 0; }
    .up-item { grid-template-columns: minmax(0, 1fr) auto; }
    .up-item__date { grid-column: 1; }
    .up-item__title, .up-item__time, .up-item__loc, .up-item__vis { grid-column: 1; grid-row: auto; }
    .up-item__edit { grid-column: 2; grid-row: 1 / span 2; }
}
@media (prefers-reduced-motion: reduce) { .toast { transition: none; } }

/* ---------- Anmeldung / Benutzerleiste ---------- */
.nav__right { display: flex; align-items: center; gap: 1.5rem; flex-wrap: wrap; justify-content: flex-end; }
.userbar { display: flex; align-items: center; gap: .6rem; font-size: .95rem; }
.userbar__name { font-weight: 700; color: #fff; }
.login { max-width: 460px; margin: 2rem auto 0; }
.login__hint { color: var(--text-muted); font-size: .92rem; margin-bottom: 1.25rem; }
.login input, .login select {
    width: 100%; background: #2e2e2e; color: var(--text); border: 1px solid rgba(225, 230, 221, .3);
    padding: .55rem .7rem; font: 400 1rem var(--font-body); border-radius: 2px;
}
.login input:focus-visible, .login select:focus-visible { outline: 2px solid var(--red); outline-offset: 0; }
.dlg input:disabled, .dlg select:disabled, .dlg textarea:disabled { opacity: .75; cursor: not-allowed; }
@media (max-width: 700px) { .nav__right { gap: .6rem; } .userbar { font-size: .85rem; } }

/* ---------- Bedienung & Standards ---------- */
.req { color: var(--red-text); }
.dlg__hint { margin: 0 0 1rem; font-size: .85rem; color: var(--text-muted); }
.dlg { position: relative; }
.dlg__close {
    position: absolute; top: .6rem; right: .6rem; width: 44px; height: 44px; border: 1px solid transparent;
    background: transparent; color: var(--text); font-size: 1.8rem; line-height: 1; cursor: pointer;
}
.dlg__close:hover { border-color: var(--line); color: #fff; }
.up-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem 1rem; margin-bottom: .75rem; }
.up-head h2 { margin: 0; }
.day__num { min-width: 2rem; height: 2rem; }
.day__num:focus-visible { outline-offset: -2px; }
.icon-btn { width: 2.75rem; height: 2.75rem; }
.segmented button { min-height: 44px; }
.link-btn { min-height: 44px; padding-inline: .25rem; }
.up-item .link-btn { min-height: 44px; }
.check { min-height: 44px; }
.btn-danger { min-height: 44px; }
@media (max-width: 700px) { .day__num { min-width: 2.25rem; height: 2.25rem; } }
.up-head__tools { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1.25rem; }

/* ---------- Anmeldung mit Zweitem Faktor, Mitglieder ---------- */
.login__buttons { display: flex; gap: .75rem; flex-wrap: wrap; margin: 0 0 1rem; }
.steps { padding-left: 1.2rem; margin: 0 0 1.25rem; }
.steps li { margin-bottom: .75rem; }
.secret { display: block; margin: .4rem 0; padding: .6rem .8rem; background: #2e2e2e; border: 1px solid var(--line);
    font: 600 1.15rem/1.3 ui-monospace, "SFMono-Regular", Consolas, monospace; letter-spacing: .08em; word-break: break-all; user-select: all; }
.recovery { list-style: none; margin: 0 0 1rem; padding: 1rem; display: grid; grid-template-columns: repeat(2, 1fr); gap: .4rem 1.5rem;
    background: #2e2e2e; border: 1px solid var(--line); font: 600 1.05rem ui-monospace, "SFMono-Regular", Consolas, monospace; user-select: all; }
.members { margin-top: 3rem; }
.member-list { border-top: 1px solid var(--line); }
.member { display: grid; grid-template-columns: minmax(0, 1.4fr) auto minmax(0, 1.4fr) minmax(0, 1.6fr); gap: .25rem 1rem; align-items: center;
    padding: .7rem .25rem; border-bottom: 1px dashed var(--line); }
.member__user { color: var(--text-muted); font-size: .9rem; }
.member__status { color: var(--text-muted); font-size: .92rem; }
.member__actions { display: flex; flex-wrap: wrap; gap: .25rem 1rem; justify-content: flex-end; }
@media (max-width: 1000px) { .member { grid-template-columns: 1fr auto; } .member__status, .member__actions { grid-column: 1 / -1; justify-content: flex-start; } }
