/* Vereinsbüro – Oberfläche im Stil moderner Buchhaltungs-Apps */
:root {
  --nav-bg: #13213a;
  --nav-fg: #c5d0e3;
  --nav-active: #1f6feb;
  --bg: #f3f5f9;
  --card: #ffffff;
  --text: #1b2433;
  --muted: #667085;
  --line: #e4e8ef;
  --primary: #1f6feb;
  --primary-dark: #1557c0;
  --green: #12a150;
  --green-bg: #e6f6ed;
  --red: #d92d20;
  --red-bg: #fdecea;
  --orange: #d97706;
  --orange-bg: #fff4e0;
  --blue-bg: #e8f0fe;
  --gray-bg: #eef1f5;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
  font-size: 15px;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg); color: var(--text); line-height: 1.45;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.55rem; margin: 0; font-weight: 650; letter-spacing: -.01em; }
h2 { font-size: 1.1rem; margin: 0 0 .8rem; font-weight: 620; }
h3 { font-size: .95rem; margin: 0 0 .6rem; font-weight: 620; }
.i { width: 18px; height: 18px; flex-shrink: 0; vertical-align: middle; }
.i.big { width: 42px; height: 42px; color: #b5bfcd; }

/* ---------- Grundgerüst ---------- */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: 250px; background: var(--nav-bg); color: var(--nav-fg); display: flex; flex-direction: column;
  position: fixed; inset: 0 auto 0 0; z-index: 40; transition: transform .2s;
}
.brand { display: flex; gap: .7rem; align-items: center; padding: 1.1rem 1.1rem 1rem; color: #fff; text-decoration: none !important; border-bottom: 1px solid rgba(255,255,255,.07); }
.brand-mark { width: 36px; height: 36px; border-radius: 9px; background: var(--nav-active); display: grid; place-items: center; color: #fff; flex-shrink: 0; }
.brand-mark .i { width: 20px; height: 20px; }
.brand-text { display: flex; flex-direction: column; min-width: 0; }
.brand-text strong { font-size: .92rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-text small { color: #8ea0bf; font-size: .75rem; }
.nav { flex: 1; overflow-y: auto; padding: .6rem .6rem 1rem; }
.nav-label { font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; color: #7488aa; padding: 1rem .7rem .35rem; }
.nav-item { display: flex; align-items: center; gap: .7rem; padding: .52rem .7rem; border-radius: 8px; color: var(--nav-fg); font-size: .9rem; text-decoration: none !important; }
.nav-item:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav-item.active { background: var(--nav-active); color: #fff; }
.sidebar-foot { border-top: 1px solid rgba(255,255,255,.07); padding: .8rem; display: flex; align-items: center; gap: .5rem; }
.me { display: flex; align-items: center; gap: .6rem; color: #fff; flex: 1; min-width: 0; text-decoration: none !important; }
.me-text { display: flex; flex-direction: column; min-width: 0; }
.me-text strong { font-size: .85rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me-text small { font-size: .72rem; color: #8ea0bf; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: #2b3f63; color: #fff; display: grid; place-items: center; font-size: .78rem; font-weight: 600; flex-shrink: 0; }
.sidebar .icon-btn { color: var(--nav-fg); }
.sidebar .icon-btn:hover { background: rgba(255,255,255,.08); color: #fff; }

.main { flex: 1; margin-left: 250px; min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 1rem; padding: .7rem 1.8rem; background: rgba(243,245,249,.92); backdrop-filter: blur(6px); border-bottom: 1px solid var(--line); }
.search { flex: 1; max-width: 560px; display: flex; align-items: center; gap: .5rem; background: #fff; border: 1px solid var(--line); border-radius: 9px; padding: 0 .75rem; color: var(--muted); }
.search input { border: 0; outline: 0; padding: .55rem 0; flex: 1; font-size: .92rem; background: transparent; }
.topbar .dropdown { margin-left: auto; }
.menu-btn { display: none; }
.content { padding: 1.6rem 1.8rem 3rem; max-width: 1400px; width: 100%; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; margin-bottom: 1.3rem; flex-wrap: wrap; }
.page-actions { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.subtitle { margin: .25rem 0 0; color: var(--muted); }
.back { display: inline-flex; align-items: center; gap: .3rem; font-size: .85rem; color: var(--muted); margin-bottom: .35rem; }

/* ---------- Karten & Raster ---------- */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); border: 1px solid var(--line); }
.card-body { padding: 1.2rem 1.3rem; }
.card-head { padding: .95rem 1.3rem; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; gap: .6rem; }
.card-head h2, .card-head h3 { margin: 0; }
.card + .card, .card + .grid, .grid + .card, .grid + .grid { margin-top: 1.2rem; }
.grid { display: grid; gap: 1.2rem; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-main { grid-template-columns: minmax(0, 1fr) 340px; align-items: start; }
.grid-split { grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); align-items: start; }
#exp-items td { padding: .45rem .4rem; }
#exp-items input, #exp-items select { min-width: 72px; }
#exp-items .e-cat { min-width: 150px; }
#exp-items .e-desc { min-width: 110px; }
.stack > * + * { margin-top: 1.2rem; }

.kpi { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1rem 1.2rem; display: flex; flex-direction: column; gap: .2rem; color: inherit; text-decoration: none !important; }
a.kpi:hover { border-color: #c9d3e3; }
.kpi-label { color: var(--muted); font-size: .82rem; }
.kpi-value { font-size: 1.45rem; font-weight: 650; letter-spacing: -.01em; }
.kpi-sub { font-size: .8rem; color: var(--muted); }
.kpi.red .kpi-value { color: var(--red); }
.kpi.green .kpi-value { color: var(--green); }

/* ---------- Tabellen ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th { text-align: left; font-weight: 600; font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); padding: .65rem .9rem; border-bottom: 1px solid var(--line); background: #fafbfc; white-space: nowrap; }
td { padding: .7rem .9rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
tbody tr.click { cursor: pointer; }
tbody tr.click:hover td { background: #f7f9fc; }
td.num, th.num { text-align: right; white-space: nowrap; }
td.nowrap { white-space: nowrap; }
td.actions { text-align: right; white-space: nowrap; }
tfoot td { font-weight: 600; background: #fafbfc; }
.muted { color: var(--muted); }
.small { font-size: .82rem; }
.amount.neg { color: var(--red); }
.amount.pos { color: var(--green); }
.strong { font-weight: 600; }

/* ---------- Badges ---------- */
.badge { display: inline-block; padding: .16rem .55rem; border-radius: 999px; font-size: .75rem; font-weight: 600; white-space: nowrap; }
.badge-gray { background: var(--gray-bg); color: #475467; }
.badge-blue { background: var(--blue-bg); color: #1d4ed8; }
.badge-green { background: var(--green-bg); color: #067647; }
.badge-red { background: var(--red-bg); color: #b42318; }
.badge-orange { background: var(--orange-bg); color: #b54708; }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; gap: .4rem; border: 1px solid transparent; border-radius: 8px; padding: .5rem .9rem; font-size: .88rem; font-weight: 550; cursor: pointer; text-decoration: none !important; line-height: 1.2; background: none; font-family: inherit; white-space: nowrap; }
.btn .i { width: 16px; height: 16px; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-success { background: var(--green); color: #fff; }
.btn-success:hover { background: #0e8a44; }
.btn-secondary { background: #fff; color: var(--text); border-color: #d0d7e2; }
.btn-secondary:hover { background: #f5f7fa; }
.btn-danger { background: #fff; color: var(--red); border-color: #f1c1bc; }
.btn-danger:hover { background: var(--red-bg); }
.btn-ghost { color: var(--muted); }
.btn-ghost:hover { background: #eef1f5; color: var(--text); }
.btn-sm { padding: .32rem .6rem; font-size: .8rem; }
.icon-btn { background: none; border: 0; padding: .4rem; border-radius: 7px; cursor: pointer; color: var(--muted); display: inline-grid; place-items: center; }
.icon-btn:hover { background: #e9edf3; color: var(--text); }
form.inline { display: inline; margin: 0; }

/* ---------- Dropdown ---------- */
.dropdown { position: relative; display: inline-block; }
.dropdown-menu { display: none; position: absolute; top: calc(100% + 6px); left: 0; min-width: 230px; background: #fff; border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 10px 30px rgba(16,24,40,.14); padding: .35rem; z-index: 50; }
.dropdown-menu.right { left: auto; right: 0; }
.dropdown.open .dropdown-menu { display: block; }
.dropdown-menu a, .dropdown-menu button { display: flex; align-items: center; gap: .6rem; width: 100%; padding: .5rem .65rem; border-radius: 7px; color: var(--text); font-size: .88rem; text-decoration: none !important; background: none; border: 0; cursor: pointer; text-align: left; font-family: inherit; }
.dropdown-menu a:hover, .dropdown-menu button:hover { background: #f2f5f9; }
.dropdown-menu hr { border: 0; border-top: 1px solid var(--line); margin: .3rem 0; }
.dropdown-menu form { margin: 0; }

/* ---------- Formulare ---------- */
.form-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: .9rem 1rem; }
.form-grid > .field { grid-column: span 6; }
.form-grid > .c-12 { grid-column: span 12; }
.form-grid > .c-8 { grid-column: span 8; }
.form-grid > .c-4 { grid-column: span 4; }
.form-grid > .c-3 { grid-column: span 3; }
.form-grid > .c-2 { grid-column: span 2; }
.field { display: flex; flex-direction: column; gap: .3rem; }
.field .label { font-size: .8rem; font-weight: 600; color: #344054; }
.field .label em { color: var(--red); font-style: normal; margin-left: 2px; }
.hint { color: var(--muted); font-size: .76rem; }
input[type=text], input[type=email], input[type=password], input[type=search], input[type=date], input[type=number], input[type=tel], input[type=url], input:not([type]), select, textarea {
  width: 100%; border: 1px solid #d0d7e2; border-radius: 8px; padding: .52rem .7rem; font-size: .9rem; font-family: inherit; background: #fff; color: var(--text);
}
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(31,111,235,.25); border-color: var(--primary); }
textarea { resize: vertical; }
input[readonly] { background: #f6f7f9; }
.check { display: flex; gap: .5rem; align-items: center; font-size: .9rem; cursor: pointer; }
.form-actions { display: flex; gap: .6rem; justify-content: flex-end; margin-top: 1.2rem; flex-wrap: wrap; }
fieldset { border: 0; padding: 0; margin: 0; }
details.more > summary { cursor: pointer; color: var(--primary); font-size: .88rem; margin: .5rem 0; }
.section-title { font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 1.2rem 0 .6rem; grid-column: span 12; font-weight: 600; }

/* ---------- Tabs & Filter ---------- */
.tabs { display: flex; gap: .2rem; border-bottom: 1px solid var(--line); padding: 0 1rem; overflow-x: auto; }
.tab { padding: .8rem .9rem; color: var(--muted); font-size: .88rem; font-weight: 550; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; text-decoration: none !important; }
.tab:hover { color: var(--text); }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); }
.tab .count { background: var(--gray-bg); color: #475467; border-radius: 999px; padding: .05rem .45rem; font-size: .72rem; margin-left: .35rem; }
.tab.active .count { background: var(--blue-bg); color: var(--primary); }
.filters { display: flex; gap: .6rem; padding: .9rem 1rem; flex-wrap: wrap; align-items: center; border-bottom: 1px solid var(--line); }
.filters input, .filters select { width: auto; min-width: 150px; }
.filters .grow { flex: 1; min-width: 200px; }

/* ---------- Hinweise ---------- */
.alert { display: flex; gap: .7rem; align-items: flex-start; padding: .8rem 1rem; border-radius: 9px; margin-bottom: 1.2rem; font-size: .9rem; border: 1px solid; }
.alert-success { background: var(--green-bg); border-color: #b4e2c5; color: #05603a; }
.alert-error { background: var(--red-bg); border-color: #f5c2bd; color: #912018; }
.alert-info { background: var(--blue-bg); border-color: #c4d6fb; color: #1e3a8a; }
.alert-warn { background: var(--orange-bg); border-color: #fcd9a5; color: #93370d; }
.empty { text-align: center; padding: 3rem 1rem; color: var(--muted); }
.empty p { margin: .6rem 0 1rem; }
.pager { display: flex; justify-content: space-between; align-items: center; padding: .7rem 1rem; color: var(--muted); font-size: .85rem; border-top: 1px solid var(--line); }

/* ---------- Dokument-Editor ---------- */
.doc-editor .items { width: 100%; }
.doc-editor .items th, .doc-editor .items td { padding: .45rem .4rem; }
.doc-editor .items td { vertical-align: top; border-bottom: 1px solid var(--line); }
.doc-editor .items input, .doc-editor .items select, .doc-editor .items textarea { padding: .42rem .5rem; font-size: .86rem; }
.doc-editor .items .c-pos { width: 34px; color: var(--muted); padding-top: .9rem; text-align: center; }
.doc-editor .items .c-qty { width: 86px; }
.doc-editor .items .c-unit { width: 98px; }
.doc-editor .items .c-price { width: 118px; }
.doc-editor .items .c-tax { width: 150px; }
.doc-editor .items .c-total { width: 110px; text-align: right; padding-top: .9rem; font-weight: 600; white-space: nowrap; }
.doc-editor .items .c-act { width: 70px; white-space: nowrap; padding-top: .55rem; }
.doc-editor .items textarea { margin-top: .35rem; min-height: 38px; }
.doc-editor .item-extra { display: none; gap: .5rem; margin-top: .35rem; }
.doc-editor tr.show-extra .item-extra { display: grid; grid-template-columns: 1fr 1fr 90px; }
.totals { margin-left: auto; width: min(380px, 100%); font-size: .92rem; }
.totals div { display: flex; justify-content: space-between; padding: .3rem 0; }
.totals .grand { border-top: 2px solid var(--text); margin-top: .3rem; padding-top: .55rem; font-weight: 700; font-size: 1.05rem; }
.pdf-frame { width: 100%; height: 78vh; border: 1px solid var(--line); border-radius: 8px; background: #525659; }
.meta-list { display: grid; grid-template-columns: auto 1fr; gap: .45rem 1rem; font-size: .88rem; margin: 0; }
.meta-list dt { color: var(--muted); }
.meta-list dd { margin: 0; text-align: right; font-weight: 500; }
.timeline { list-style: none; padding: 0; margin: 0; font-size: .84rem; }
.timeline li { padding: .45rem 0; border-bottom: 1px dashed var(--line); display: flex; justify-content: space-between; gap: .6rem; }
.timeline li:last-child { border-bottom: 0; }
.chip { display: inline-flex; gap: .3rem; align-items: center; background: var(--gray-bg); border-radius: 999px; padding: .15rem .6rem; font-size: .78rem; color: #475467; }

/* ---------- Diagramm ---------- */
.chart { width: 100%; height: auto; }
.chart .bar-in { fill: #1f6feb; }
.chart .bar-out { fill: #f59e0b; }
.chart text { font-size: 11px; fill: #667085; }
.chart line { stroke: #e4e8ef; }
.legend { display: flex; gap: 1rem; font-size: .8rem; color: var(--muted); }
.legend span::before { content: ""; display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: .35rem; vertical-align: -1px; }
.legend .in::before { background: #1f6feb; }
.legend .out::before { background: #f59e0b; }

/* ---------- Login ---------- */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 1rem; background: linear-gradient(135deg, #13213a 0%, #1f3b6e 100%); }
.login-card { width: min(410px, 100%); background: #fff; border-radius: 14px; padding: 2rem 2rem 1.6rem; box-shadow: 0 20px 50px rgba(0,0,0,.25); }
.login-card h1 { font-size: 1.35rem; margin-bottom: .3rem; }
.login-card .brand-mark { margin-bottom: 1rem; }
.login-card form > * + * { margin-top: .9rem; }
.login-card .btn { width: 100%; justify-content: center; padding: .7rem; }

/* ---------- Responsiv ---------- */
@media (max-width: 1100px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-main, .grid-split { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: none; box-shadow: 0 0 40px rgba(0,0,0,.35); }
  .main { margin-left: 0; }
  .menu-btn { display: inline-grid; }
  .content { padding: 1.1rem 1rem 3rem; }
  .topbar { padding: .6rem 1rem; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .form-grid > .field, .form-grid > .c-8, .form-grid > .c-4, .form-grid > .c-3, .form-grid > .c-2 { grid-column: span 12; }
  .topbar .btn span { display: none; }
}
@media print {
  .sidebar, .topbar, .page-actions, .no-print { display: none !important; }
  .main { margin: 0; }
  .card { box-shadow: none; }
}

/* Text-/Hinweiszeilen im Dokument-Editor (Menge 0) */
.doc-editor tr.is-text td { background: #fafbfe; }
.doc-editor tr.is-text .c-pos { font-size: .7rem; text-transform: uppercase; letter-spacing: .04em; color: var(--primary); }
.doc-editor tr.is-text .f-unit, .doc-editor tr.is-text .f-price, .doc-editor tr.is-text .f-tax { opacity: .35; }

.spinner { width: 20px; height: 20px; border: 3px solid #d7e2f7; border-top-color: var(--primary); border-radius: 50%; animation: spin .8s linear infinite; flex-shrink: 0; }
@keyframes spin { to { transform: rotate(360deg); } }
