/* Gemeinsames Stylesheet aller Seiten (base.html). */
:root {
  --bg: #f6f7f9; --surface: #fff; --text: #1f2430; --muted: #667085; --line: #e3e6eb;
  --primary: #1f4fb8; --primary-dark: #173d91; --primary-soft: #e8effc;
  --danger: #b42318; --danger-soft: #fde8e6; --warn-soft: #fff4e0; --warn-line: #f0c36d;
  --ok-soft: #e6f6ea; --ok-line: #a9d9b4; --info-soft: #eaf2fe; --info-line: #b9d3f5;
  --radius: 10px; --nav-h: 56px;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--nav-h) + 12px); }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body { margin: 0; font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: var(--text);
  background: var(--bg); line-height: 1.5; font-size: 16px; }
a { color: var(--primary); }
a:hover { color: var(--primary-dark); }
:focus-visible { outline: 3px solid #8fb0f5; outline-offset: 2px; border-radius: 4px; }

/* --- Menüband --- */
.skip-link { position: absolute; left: -999px; top: 0; background: #000; color: #fff; padding: .5rem 1rem; z-index: 200; }
.skip-link:focus { left: 0; color: #fff; }
.topbar { position: sticky; top: 0; z-index: 100; background: var(--surface); border-bottom: 1px solid var(--line);
  box-shadow: 0 1px 3px rgba(16,24,40,.06); }
.topbar-in { max-width: 1040px; margin: 0 auto; padding: 0 1rem; min-height: var(--nav-h); display: flex; align-items: center; gap: .5rem; }
.brand { font-weight: 700; color: var(--text); text-decoration: none; margin-right: .8rem; white-space: nowrap; display: flex; align-items: center; gap: .45rem; }
.brand img { width: 24px; height: 24px; }
.brand:hover { color: var(--primary); }
.nav-toggle-box { display: none; }
.nav-toggle { display: none; margin-left: auto; cursor: pointer; padding: .45rem .7rem; border: 1px solid var(--line); border-radius: 8px; font-size: .95rem; user-select: none; }
.nav { display: flex; align-items: center; gap: .15rem; flex: 1; }
.nav a, .nav summary { color: var(--text); text-decoration: none; padding: .45rem .7rem; border-radius: 8px; font-size: .92rem; white-space: nowrap; cursor: pointer; list-style: none; display: block; }
.nav summary::-webkit-details-marker { display: none; }
.nav a:hover, .nav summary:hover { background: var(--bg); color: var(--text); }
.nav a[aria-current="page"], .nav summary.is-active { background: var(--primary-soft); color: var(--primary-dark); font-weight: 600; }
.nav .spacer { flex: 1; }
.menu { position: relative; }
.menu-items { position: absolute; right: 0; top: calc(100% + 4px); min-width: 210px; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: 0 8px 24px rgba(16,24,40,.12); padding: .3rem; z-index: 110; }
.menu-items.left { left: 0; right: auto; }
.menu-items a { display: block; }
.menu-items .who { padding: .45rem .7rem; font-size: .8rem; color: var(--muted); border-bottom: 1px solid var(--line); margin-bottom: .2rem; word-break: break-all; }
.menu summary::after { content: " \25BE"; font-size: .75em; color: var(--muted); }
.nav .cta { background: var(--primary); color: #fff; font-weight: 600; }
.nav .cta:hover { background: var(--primary-dark); color: #fff; }
.subnav { background: var(--surface); border-bottom: 1px solid var(--line); }
.subnav-in { max-width: 1040px; margin: 0 auto; padding: 0 1rem; display: flex; gap: .2rem; overflow-x: auto; }
.subnav a { padding: .6rem .8rem; font-size: .88rem; color: var(--muted); text-decoration: none; border-bottom: 3px solid transparent; white-space: nowrap; }
.subnav a:hover { color: var(--text); }
.subnav a[aria-current="page"] { color: var(--primary-dark); border-bottom-color: var(--primary); font-weight: 600; }
@media (max-width: 860px) {
  .nav-toggle { display: block; }
  .nav { display: none; position: absolute; left: 0; right: 0; top: var(--nav-h); background: var(--surface); flex-direction: column;
    align-items: stretch; padding: .5rem 1rem 1rem; border-bottom: 1px solid var(--line); box-shadow: 0 8px 16px rgba(16,24,40,.1); max-height: calc(100vh - var(--nav-h)); overflow-y: auto; }
  .nav-toggle-box:checked ~ .nav { display: flex; }
  .nav .spacer { display: none; }
  .menu-items { position: static; box-shadow: none; border: none; border-left: 3px solid var(--line); border-radius: 0; margin-left: .7rem; }
}

/* --- Inhalt --- */
.container { max-width: 900px; margin: 0 auto; padding: 1.5rem 1rem 3rem; }
.container.narrow { max-width: 440px; margin-top: 2rem; }
.container.center { text-align: center; }
.container.wide { max-width: 1040px; }
.container.doc { max-width: 760px; }
h1 { font-size: 1.55rem; margin: 0 0 .3rem; line-height: 1.25; }
h2 { font-size: 1.15rem; margin: 1.8rem 0 .5rem; }
h3 { font-size: 1.02rem; margin: 1.6rem 0 .4rem; }
.lead { color: var(--muted); margin: 0 0 1rem; }
.hint, .muted { color: var(--muted); font-size: .85rem; }
.empty { color: var(--muted); }
.auth-card, .card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.2rem; margin-top: 1rem; }
.card h2 { margin-top: 0; }
.auth-card { padding: 1.4rem; }
code { background: #eef0f3; padding: .08rem .35rem; border-radius: 4px; font-size: .9em; }

/* Hinweisboxen (alte und neue Klassennamen) */
.box, .warn-list, .info-box, .ok-box, .error-box, .state-box, .warn-box { border-radius: var(--radius); padding: .8rem 1rem; margin-top: 1rem; font-size: .9rem; border: 1px solid var(--line); background: var(--surface); }
.box.info, .info-box, .state-box { background: var(--info-soft); border-color: var(--info-line); }
.box.ok, .ok-box { background: var(--ok-soft); border-color: var(--ok-line); }
.box.warn, .warn-list, .warn-box { background: var(--warn-soft); border-color: var(--warn-line); }
.box.danger, .error-box { background: var(--danger-soft); border-color: #e9a29b; }
.box ul, .warn-list ul, .info-box ul { margin: .4rem 0 0 1.2rem; padding: 0; }

/* Tabellen */
table { border-collapse: collapse; width: 100%; margin-top: .6rem; background: var(--surface); }
td, th { padding: .55rem .7rem; border-bottom: 1px solid var(--line); text-align: left; font-size: .88rem; vertical-align: top; }
th { color: var(--muted); font-weight: 600; font-size: .78rem; text-transform: uppercase; letter-spacing: .03em; background: #fafbfc; }
td.num, th.num { text-align: right; white-space: nowrap; }
td.files { max-width: 260px; word-break: break-word; font-size: .82rem; color: #444; }
tr:hover td { background: #fafbfd; }
@media (max-width: 700px) { table { display: block; overflow-x: auto; white-space: nowrap; } td.files { white-space: normal; } }

/* Buttons */
button, a.button { display: inline-block; padding: .5rem 1rem; background: var(--primary); color: #fff; border: 1px solid transparent; border-radius: 8px;
  cursor: pointer; font: inherit; font-size: .9rem; font-weight: 600; text-decoration: none; line-height: 1.3; }
button:hover, a.button:hover { background: var(--primary-dark); color: #fff; }
a.button { margin: .15rem .2rem .15rem 0; padding: .35rem .8rem; font-size: .84rem; }
button.light, a.button.light { background: #fff; color: var(--text); border-color: #c9ced6; }
button.light:hover, a.button.light:hover { background: var(--bg); color: var(--text); }
button.danger { background: var(--danger); }
button.danger:hover { background: #8f1b11; }
button.block { width: 100%; padding: .65rem 1rem; font-size: 1rem; margin-top: 1rem; }
button.is-busy { opacity: .6; pointer-events: none; }
button:disabled { opacity: .5; cursor: not-allowed; }

/* Formulare */
label { display: block; margin-top: .8rem; font-weight: 600; font-size: .9rem; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], select, textarea {
  width: 100%; padding: .55rem .65rem; margin-top: .25rem; font: inherit; font-size: .95rem; border: 1px solid #c9ced6; border-radius: 8px; background: #fff; color: var(--text); }
input:focus, select:focus, textarea:focus { border-color: var(--primary); outline: 3px solid #cfdcf7; outline-offset: 0; }
input[type=file] { margin-top: .4rem; max-width: 100%; }
input[type=checkbox] { width: auto; margin-right: .35rem; }
fieldset { border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.2rem; margin: 1rem 0 0; background: var(--surface); }
legend { font-weight: 700; padding: 0 .4rem; }
.checkbox-row { display: flex; align-items: flex-start; gap: .5rem; margin-top: .6rem; }
.checkbox-row label { margin-top: 0; font-weight: normal; }
.links { margin-top: 1rem; font-size: .9rem; text-align: center; }
.pw-toggle { font-size: .8rem; font-weight: normal; color: var(--muted); margin-top: .3rem; }
.pw-toggle input { margin-right: .3rem; }

/* Details / Badges / Fortschritt */
details { margin-top: .6rem; }
summary { cursor: pointer; font-size: .9rem; }
.badge { display: inline-block; padding: .12rem .6rem; border-radius: 999px; font-size: .76rem; font-weight: 600; background: #eee; color: #555; }
.badge.done, .badge.yes { background: #d9f2de; color: #17652a; }
.badge.error, .badge.no { background: #fadbd8; color: #8f1b11; }
.badge.running { background: #e0e7fb; color: #2e3f9e; }
.bar-bg { background: #e4e7ec; border-radius: 999px; height: 12px; overflow: hidden; margin: 1rem 0; }
.bar-fg { background: var(--primary); height: 100%; width: 0%; transition: width .3s; }
.retention-note { color: var(--muted); font-size: .8rem; margin-top: .6rem; }
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: .6rem; margin: 1rem 0; padding: 0; list-style: none; counter-reset: s; }
.steps li { counter-increment: s; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: .7rem .8rem .7rem 2.6rem; position: relative; font-size: .86rem; }
.steps li::before { content: counter(s); position: absolute; left: .7rem; top: .65rem; width: 1.5rem; height: 1.5rem; border-radius: 50%;
  background: var(--primary-soft); color: var(--primary-dark); font-weight: 700; text-align: center; line-height: 1.5rem; font-size: .85rem; }
.steps li.done::before { content: "\2713"; background: var(--ok-soft); color: #17652a; }
@media (max-width: 700px) { .steps { grid-template-columns: 1fr; } }
.file-list { margin: .5rem 0 0; padding: 0; list-style: none; font-size: .85rem; }
.file-list li { padding: .15rem 0; color: var(--muted); }
.page-actions { margin-top: 1.5rem; display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.crumb { font-size: .85rem; margin-bottom: .6rem; }
.crumb a { text-decoration: none; }

/* Fuß / Nach-oben */
.site-footer { max-width: 1040px; margin: 0 auto; padding: 1.2rem 1rem 2.5rem; border-top: 1px solid var(--line); font-size: .78rem; color: var(--muted);
  display: flex; flex-wrap: wrap; gap: .4rem 1.2rem; }
.site-footer a { color: var(--muted); }
#to-top { position: fixed; right: 1rem; bottom: 1rem; width: 46px; height: 46px; padding: 0; border-radius: 50%; font-size: 1.3rem; line-height: 1;
  box-shadow: 0 4px 14px rgba(16,24,40,.25); opacity: 0; transform: translateY(12px); pointer-events: none; transition: opacity .2s, transform .2s; z-index: 90; }
#to-top.show { opacity: 1; transform: none; pointer-events: auto; }
@media print { .topbar, .subnav, #to-top, .site-footer, .page-actions { display: none !important; } body { background: #fff; } }

.plan-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: .2rem .8rem; }
td button, td a.button { padding: .3rem .7rem; font-size: .82rem; }

.menu-items form { margin: 0; }
.menu-btn { display: block; width: 100%; text-align: left; background: none; color: var(--text); font-weight: 400; font-size: .92rem; padding: .45rem .7rem; border-radius: 8px; }
.menu-btn:hover { background: var(--bg); color: var(--text); }
.menu-btn .hint { display: block; font-size: .75rem; }
.job-indicator { background: #fff4e0; color: #7a4a00 !important; border: 1px solid var(--warn-line); font-weight: 600; font-size: .85rem !important; }
.job-indicator[hidden] { display: none; }
.job-indicator .mini-bar { display: inline-block; width: 60px; height: 6px; border-radius: 3px; background: #f3dfb5; vertical-align: middle; margin: 0 .35rem; overflow: hidden; }
.job-indicator .mini-bar i { display: block; height: 100%; background: #e08a00; }
.spin { display: inline-block; animation: spin 1.2s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spin { animation: none; } }
#toasts { position: fixed; left: 1rem; bottom: 1rem; display: flex; flex-direction: column; gap: .5rem; z-index: 95; max-width: calc(100vw - 6rem); }
.toast { background: var(--surface); border: 1px solid var(--line); border-left: 5px solid var(--primary); border-radius: 8px; padding: .7rem .9rem; box-shadow: 0 6px 20px rgba(16,24,40,.2); font-size: .9rem; }
.toast.ok { border-left-color: #1a8a3a; } .toast.err { border-left-color: var(--danger); }
.toast a { font-weight: 600; }
.job-progress { min-width: 150px; }
.job-progress .bar-bg { margin: .3rem 0 0; height: 8px; }
