/* ============================================================
   Kinderland e.V. – Verwaltung · Stylesheet
   Markenfarben zentral als CSS-Variablen -> hier anpassen,
   sobald die exakten Farben feststehen.
   ============================================================ */
:root {
  --brand:        #4a9b5e;   /* Grün  – Hauptfarbe */
  --brand-dark:   #3c8150;
  --brand-light:  #e8f3ea;
  --accent:       #f39a2b;   /* Orange – Akzent */
  --sky:          #4a90d9;   /* Blau  – sekundär */
  --sun:          #f6c445;   /* Gelb  */

  --bg:           #f5f7f3;
  --surface:      #ffffff;
  --text:         #26302b;
  --muted:        #6b7772;
  --border:       #e3e8e3;
  --danger:       #d64545;
  --danger-bg:    #fbeaea;
  --ok:           #3c8150;
  --info:         #2f6f9f;

  --radius:       14px;
  --radius-sm:    9px;
  --shadow:       0 1px 3px rgba(20, 40, 25, .06), 0 6px 20px rgba(20, 40, 25, .05);
  --shadow-sm:    0 1px 2px rgba(20, 40, 25, .08);
  --font:         system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  font-size: 15px;
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
}

a { color: var(--brand-dark); text-decoration: none; }
a:hover { text-decoration: underline; }

h1 { font-size: 1.5rem; margin: 0 0 .2rem; }
h2 { font-size: 1.1rem; margin: 0 0 .8rem; }

code { background: #eef1ee; padding: .1em .4em; border-radius: 6px; font-size: .9em; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }

/* ---------------- Topbar ---------------- */
.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 1rem;
  height: 58px; padding: 0 1rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: .6rem; color: var(--text); font-weight: 700; }
.brand:hover { text-decoration: none; }
.brand-logo { border-radius: 8px; display: block; }
.brand-text small { display: block; font-weight: 500; font-size: .7rem; color: var(--muted); letter-spacing: .04em; text-transform: uppercase; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: .5rem; }
.user-chip { font-size: .85rem; text-align: right; line-height: 1.15; }
.user-chip small { display: block; color: var(--muted); font-size: .72rem; }
.menu-toggle { display: none; border: 0; background: transparent; font-size: 1.4rem; cursor: pointer; color: var(--text); padding: .2rem .4rem; }

/* ---------------- Shell / Sidebar ---------------- */
.shell { display: flex; align-items: flex-start; max-width: 1200px; margin: 0 auto; }
.sidebar {
  position: sticky; top: 58px;
  width: 220px; flex: 0 0 220px;
  height: calc(100vh - 58px);
  padding: 1rem .7rem;
  display: flex; flex-direction: column; gap: .15rem;
}
.nav-item {
  display: flex; align-items: center; gap: .6rem;
  padding: .6rem .75rem; border-radius: var(--radius-sm);
  color: var(--text); font-weight: 500; font-size: .92rem;
}
.nav-item .ni { width: 1.3rem; text-align: center; }
.nav-item:hover { background: var(--brand-light); text-decoration: none; }
.nav-item.active { background: var(--brand); color: #fff; }
.nav-item.disabled { color: var(--muted); cursor: default; }
.nav-item.disabled:hover { background: transparent; }
.nav-sep { font-size: .68rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: .9rem .75rem .3rem; }
.soon { font-size: .62rem; background: var(--sun); color: #6a4b00; padding: .05rem .35rem; border-radius: 20px; margin-left: auto; font-weight: 700; }
.nav-backdrop { display: none; }

/* ---------------- Content ---------------- */
.content { flex: 1 1 auto; min-width: 0; padding: 1.4rem clamp(1rem, 3vw, 2rem); }

.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; margin-bottom: 1.2rem; flex-wrap: wrap; }
.page-head h1 { line-height: 1.2; }
.head-actions { display: flex; gap: .5rem; flex-wrap: wrap; }
.back { display: inline-block; font-size: .85rem; color: var(--muted); margin-bottom: .1rem; }

/* ---------------- Cards ---------------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.2rem;
  margin-bottom: 1.2rem;
}
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: .8rem; }
.card-head h2 { margin: 0; }

.cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; margin-bottom: 1.2rem; }
.stat { text-align: center; padding: 1.1rem .6rem; }
.stat-num { font-size: 2rem; font-weight: 800; color: var(--brand-dark); line-height: 1; }
.stat-label { color: var(--muted); font-size: .85rem; margin-top: .3rem; }

/* ---------------- Tabellen ---------------- */
.table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.table th, .table td { text-align: left; padding: .6rem .7rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table th { font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr.clickable { cursor: pointer; }
.table tbody tr.clickable:hover { background: var(--brand-light); }
.row-actions { text-align: right; white-space: nowrap; }
.row-actions a, .linklike { font-size: .85rem; color: var(--muted); }
.row-actions .inline { display: inline; }

/* ---------------- Badges ---------------- */
.badge { display: inline-block; font-size: .72rem; font-weight: 700; padding: .15rem .55rem; border-radius: 30px; }
.badge-ok { background: var(--brand-light); color: var(--brand-dark); }
.badge-muted { background: #eef1ee; color: var(--muted); }
.badge-danger { background: var(--danger-bg); color: var(--danger); }

/* ---------------- Buttons ---------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  padding: .55rem .95rem; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  font: inherit; font-weight: 600; font-size: .9rem; cursor: pointer;
  transition: background .12s, border-color .12s, transform .02s;
}
.btn:hover { background: #f3f6f2; text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover { background: #b93636; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn-ghost:hover { background: #f0f2ef; color: var(--text); }
.btn-sm { padding: .35rem .7rem; font-size: .82rem; }
.btn-block { width: 100%; }
.linklike { background: none; border: 0; padding: 0; cursor: pointer; font: inherit; }
.linklike:hover { text-decoration: underline; }
.linklike.danger { color: var(--danger); }

/* ---------------- Formulare ---------------- */
.form h2 { margin-top: .4rem; padding-top: .9rem; border-top: 1px solid var(--border); }
.form h2:first-child { border-top: 0; padding-top: 0; }
label { display: block; font-size: .82rem; font-weight: 600; color: #45514b; margin-bottom: .9rem; }
input, select, textarea {
  display: block; width: 100%; margin-top: .3rem;
  padding: .55rem .65rem; font: inherit; font-size: .95rem;
  color: var(--text); background: #fff;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand); outline-offset: -1px; border-color: var(--brand); }
input[readonly] { background: #f4f6f3; color: var(--muted); }
textarea { resize: vertical; }
label.checkbox { display: flex; align-items: center; gap: .5rem; font-weight: 500; }
label.checkbox input { width: auto; margin: 0; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1.1rem; }
.grid2 .col2 { grid-column: 1 / -1; }
.form-actions { margin-top: .6rem; display: flex; gap: .6rem; }
.searchbar { display: flex; gap: .5rem; margin-bottom: 1rem; max-width: 560px; }
.searchbar input { margin: 0; }

.details { display: grid; grid-template-columns: max-content 1fr; gap: .35rem 1.1rem; margin: 0; }
.details dt { color: var(--muted); font-size: .82rem; }
.details dd { margin: 0; }

/* ---------------- Flash ---------------- */
.flash { padding: .7rem 1rem; border-radius: var(--radius-sm); margin-bottom: 1rem; font-size: .9rem; border: 1px solid transparent; }
.flash ul { margin: .2rem 0 0; padding-left: 1.1rem; }
.flash-success { background: var(--brand-light); color: var(--brand-dark); border-color: #cfe6d5; }
.flash-error { background: var(--danger-bg); color: var(--danger); border-color: #f2cccc; }
.flash-info { background: #e9f2f8; color: var(--info); border-color: #cfe2ef; }

/* ---------------- Auth (Login / Setup) ---------------- */
.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 1.5rem; }
.auth-card { width: 100%; max-width: 380px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 2rem; }
.auth-brand { text-align: center; margin-bottom: 1.3rem; }
.auth-logo { width: 60px; height: 60px; }
.auth-brand h1 { font-size: 1.35rem; margin: .5rem 0 0; }
.auth-brand p { margin: .15rem 0 0; }
.stack label { margin-bottom: 1rem; }
.auth-foot { text-align: center; font-size: .75rem; margin: 1.1rem 0 0; }

/* ---------------- Responsive ---------------- */
@media (max-width: 860px) {
  .cards { grid-template-columns: repeat(2, 1fr); }
  .menu-toggle { display: block; }
  .sidebar {
    position: fixed; top: 58px; left: 0; z-index: 40;
    background: var(--surface); border-right: 1px solid var(--border);
    transform: translateX(-100%); transition: transform .2s ease; box-shadow: var(--shadow);
  }
  body.nav-open .sidebar { transform: translateX(0); }
  body.nav-open .nav-backdrop { display: block; position: fixed; inset: 58px 0 0 0; background: rgba(0,0,0,.25); z-index: 35; }
}
@media (max-width: 560px) {
  .grid2 { grid-template-columns: 1fr; }
  .cards { grid-template-columns: 1fr 1fr; }
  .user-chip { display: none; }
  .details { grid-template-columns: 1fr; gap: 0 0; }
  .details dt { margin-top: .5rem; }
}

/* ---------------- Einstellungen ---------------- */
.color-row { display: flex; align-items: center; gap: .5rem; margin-top: .3rem; }
.color-row input[type=color] { width: 46px; height: 38px; padding: 2px; margin: 0; cursor: pointer; }
.color-row .hex { width: 110px; margin: 0; text-transform: lowercase; font-family: ui-monospace, monospace; }
.theme-preview { display: flex; align-items: center; gap: .7rem; margin: .2rem 0 .4rem; flex-wrap: wrap; }
.preview-accent { background: var(--accent); color: #fff; padding: .18rem .6rem; border-radius: 30px; font-size: .72rem; font-weight: 700; }
.media-row { display: flex; gap: 1.2rem; align-items: flex-start; flex-wrap: wrap; }
.media-body { flex: 1 1 260px; }
.media-preview { flex: 0 0 auto; background: #f4f6f3; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: .9rem; display: flex; align-items: center; justify-content: center; min-width: 96px; min-height: 96px; }
.logo-prev { max-width: 120px; max-height: 120px; display: block; }
.favicon-prev { width: 48px; height: 48px; display: block; }
.export-actions { display: flex; gap: .5rem; flex-wrap: wrap; }
input[type=file] { padding: .4rem; background: #fff; font-size: .85rem; }

/* Abrechnung / Gebühren-Editor */
input.numin { width: 76px; text-align: right; margin: 0; padding: .3rem .4rem; font-size: .85rem; }
.table td .numin { display: inline-block; }
.vwz-row td { padding-top: 0; border-top: 0; color: var(--muted); font-size: .8rem; }
.run-amount { font-weight: 800; color: var(--brand-dark); white-space: nowrap; }
.child-lines { font-size: .84rem; line-height: 1.5; }
