/* ============================================================
   BotaNick — Design-System „Botanische Eleganz" (Desktop-first)
   Display: Fraunces · UI: Hanken Grotesk
   Grüne Sidebar · warmes Papier · Amber-Funke · responsive → Mobile
   ============================================================ */
@import url('https://fonts.googleapis.com/css2?family=Fraunces:ital,opsz,wght@0,9..144,400;0,9..144,500;0,9..144,600;1,9..144,400&family=Hanken+Grotesk:wght@400;500;600;700&display=swap');

:root {
  --paper:    #f4f1e8;
  --paper-2:  #ebe6d8;
  --card:     #fffdf7;
  --ink:      #1d271f;
  --ink-soft: #5f6d61;
  --line:     #e4ddcb;
  --forest:   #1f4733;
  --forest-2: #2c6147;
  --forest-d: #173a29;
  --leaf:     #7b9b62;
  --amber:    #c0763a;
  --amber-bg: #f3e6d3;
  --ok:    #2f6e44;  --ok-bg:   #dcebd9;
  --warn:  #8a5a12;  --warn-bg: #f4e7cf;
  --bad:   #9c3b30;  --bad-bg:  #f2dcd6;
  --info:  #2a5570;  --info-bg: #dde8f0;
  --font-d: "Fraunces", Georgia, "Times New Roman", serif;
  --font-b: "Hanken Grotesk", system-ui, -apple-system, sans-serif;
  --r-sm: 10px; --r: 14px; --r-lg: 22px;
  --sidebar: 250px;
  --sh-1: 0 1px 2px rgba(31,46,31,.05), 0 1px 3px rgba(31,46,31,.04);
  --sh-2: 0 6px 18px rgba(31,46,31,.08), 0 2px 6px rgba(31,46,31,.05);
  --sh-3: 0 18px 40px rgba(31,46,31,.14);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font-family: var(--font-b); font-size: 15px; line-height: 1.5; color: var(--ink);
  background: radial-gradient(120% 60% at 100% 0%, #faf8f1 0%, rgba(250,248,241,0) 55%), var(--paper);
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}

/* ---------- Typografie ---------- */
h1, h2, h3 { font-family: var(--font-d); font-weight: 500; color: var(--ink);
  letter-spacing: -.01em; line-height: 1.12; margin: 0 0 .5em; }
h1 { font-size: clamp(26px, 3.4vw, 34px); margin-top: 0; }
h2 { font-size: 19px; letter-spacing: 0; margin: 0 0 .4em; }
a { color: var(--forest-2); text-decoration: none; }
a:hover { color: var(--forest); }
.muted, .sub { color: var(--ink-soft); }
.sub { font-size: 13px; }
strong { font-weight: 600; }
code { background: var(--paper-2); padding: 1px 6px; border-radius: 6px;
  font-size: 13px; font-family: ui-monospace, "SF Mono", monospace; color: var(--forest); }
hr { border: 0; border-top: 1px solid var(--line); margin: 20px 0; }

/* ============================================================
   SHELL (Desktop-first): Sidebar + Main
   ============================================================ */
.app { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar); flex: none;
  position: fixed; top: 0; bottom: 0; left: 0; z-index: 50;
  display: flex; flex-direction: column; gap: 4px;
  padding: 20px 14px; overflow-y: auto;
  background: var(--forest-d); color: #c6d6c8;
  border-right: 1px solid #11301f;
}
.sidebar .brand { display: inline-flex; align-items: center; gap: 9px; padding: 4px 10px 16px;
  font-family: var(--font-d); font-weight: 600; font-size: 22px; letter-spacing: -.02em; color: #f4f1e8; }
.sidebar .brand .leaf { width: 24px; height: 24px; color: var(--leaf); flex: none; }
.sidebar .brand b { color: var(--amber); }
.nav { display: flex; flex-direction: column; gap: 3px; }
.nav a { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 11px;
  color: #c6d6c8; font-size: 14.5px; font-weight: 500; transition: .15s; white-space: nowrap; }
.nav a svg { width: 21px; height: 21px; stroke-width: 1.75; flex: none; color: #8fae8c; transition: .15s; }
.nav a:hover { background: rgba(255,255,255,.07); color: #fff; }
.nav a:hover svg { color: #c9dcc7; }
.nav a.on { background: rgba(255,255,255,.11); color: #fff; font-weight: 600; }
.nav a.on svg { color: var(--amber); }
.sidebar .logout { margin-top: auto; display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: 11px; color: #93a795; font-size: 14px; font-weight: 500; transition: .15s; }
.sidebar .logout svg { width: 20px; height: 20px; stroke-width: 1.75; }
.sidebar .logout:hover { background: rgba(255,255,255,.06); color: #e6efe4; }

.appbar { display: none; }   /* nur mobil */

.main { flex: 1; min-width: 0; margin-left: var(--sidebar); }
.content { max-width: 1140px; margin: 0 auto; padding: 34px 44px 40px;
  animation: fade-up .4s cubic-bezier(.2,.7,.2,1) both; }

/* öffentliche / Druck-Seiten (ohne Shell): eigene helle Kopfzeile */
.topbar { position: sticky; top: 0; z-index: 50; display: flex; justify-content: space-between;
  align-items: center; padding: 13px 22px; background: rgba(244,241,232,.85);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.topbar .brand { display: inline-flex; align-items: center; gap: 9px; font-family: var(--font-d);
  font-weight: 600; font-size: 20px; letter-spacing: -.02em; color: var(--forest); }
.topbar .brand .leaf { width: 22px; height: 22px; color: var(--leaf); }
.topbar .brand b { color: var(--amber); }
body:not(.app) .content { max-width: 640px; padding: 26px 18px 60px; }

/* ---------- Kacheln / KPI ---------- */
.cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin: 18px 0; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r);
  padding: 18px 18px 16px; box-shadow: var(--sh-1); display: flex; flex-direction: column; gap: 3px; }
a.card { text-decoration: none; color: var(--ink); transition: .2s; }
a.card:hover { transform: translateY(-2px); box-shadow: var(--sh-2); border-color: var(--leaf); }
.card > span:last-child { font-size: 12px; color: var(--ink-soft); text-transform: uppercase;
  letter-spacing: .05em; font-weight: 600; }
.card-num { font-family: var(--font-d); font-size: 32px; font-weight: 500; color: var(--forest);
  line-height: 1; letter-spacing: -.01em; }

/* ---------- Listen / Zeilen ---------- */
.list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 9px; }
.list > li { animation: fade-up .4s ease both; }
.list>li:nth-child(2){animation-delay:.03s}.list>li:nth-child(3){animation-delay:.06s}
.list>li:nth-child(4){animation-delay:.09s}.list>li:nth-child(5){animation-delay:.12s}
.list>li:nth-child(6){animation-delay:.15s}
.row { display: flex; justify-content: space-between; align-items: center; gap: 14px;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r);
  padding: 14px 18px; color: var(--ink); box-shadow: var(--sh-1); transition: .16s; }
a.row:hover { transform: translateY(-1px); box-shadow: var(--sh-2); border-color: var(--leaf); }
.row .sub { display: block; color: var(--ink-soft); font-size: 12.5px; margin-top: 2px; }
.row .price { font-family: var(--font-d); }

/* ---------- Badges ---------- */
.badge { display: inline-block; font-size: 11px; font-weight: 600; padding: 3px 9px;
  border-radius: 999px; letter-spacing: .02em; background: var(--paper-2); color: var(--ink-soft);
  margin-left: 6px; vertical-align: middle; }
.badge.privat   { background: var(--ok-bg);   color: var(--ok); }
.badge.gewerbe  { background: var(--info-bg); color: var(--info); }
.badge.inaktiv  { background: var(--bad-bg);  color: var(--bad); }
.badge.status-anfrage       { background: var(--paper-2); color: #4b554d; }
.badge.status-termin_gebucht{ background: var(--info-bg); color: var(--info); }
.badge.status-in_doku       { background: var(--warn-bg); color: var(--warn); }
.badge.status-angebot       { background: #e8e1f3; color: #5a4488; }
.badge.status-beauftragt    { background: var(--ok-bg);  color: var(--ok); }
.badge.status-durchgefuehrt { background: var(--ok-bg);  color: var(--ok); }
.badge.status-berechnet     { background: var(--amber-bg); color: var(--amber); }
.badge.status-bezahlt       { background: var(--ok-bg);  color: var(--ok); }
.badge.status-storniert     { background: var(--bad-bg); color: var(--bad); }
.badge.r-offen        { background: var(--amber-bg); color: var(--amber); }
.badge.r-teilbezahlt  { background: var(--warn-bg);  color: var(--warn); }
.badge.r-bezahlt      { background: var(--ok-bg);    color: var(--ok); }
.badge.r-ueberfaellig { background: var(--bad-bg);   color: var(--bad); }

/* ---------- Buttons ---------- */
.btn, button[type=submit], form > button {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  font-family: var(--font-b); font-size: 14.5px; font-weight: 600;
  padding: 11px 18px; border-radius: var(--r); border: 1px solid transparent;
  background: var(--forest); color: #f6f4ec; cursor: pointer;
  box-shadow: 0 1px 2px rgba(31,46,31,.18); transition: .16s; text-decoration: none; }
.btn:hover, button[type=submit]:hover, form > button:hover {
  background: var(--forest-2); transform: translateY(-1px); box-shadow: var(--sh-2); color: #fff; }
.btn:active, button[type=submit]:active { transform: translateY(0) scale(.99); }
.btn.sec { background: var(--card); color: var(--forest); border-color: var(--line); box-shadow: var(--sh-1); }
.btn.sec:hover { background: var(--paper-2); border-color: var(--leaf); color: var(--forest); }
.link-del { background: none; border: 0; color: var(--bad); font-size: 17px; width: auto;
  padding: 0 4px; cursor: pointer; box-shadow: none; line-height: 1; }
.link-del:hover { background: none; transform: none; box-shadow: none; }

/* ---------- Toolbar / Chips ---------- */
.toolbar { display: flex; gap: 9px; margin: 16px 0; align-items: center; flex-wrap: wrap; }
.toolbar input[type=search] { flex: 1; margin: 0; min-width: 200px; max-width: 420px; }
.chips { display: flex; flex-wrap: wrap; gap: 7px; margin: 14px 0; }
.chip { font-size: 13px; font-weight: 600; padding: 7px 14px; border-radius: 999px;
  background: var(--card); border: 1px solid var(--line); color: var(--forest);
  text-decoration: none; transition: .15s; box-shadow: var(--sh-1); }
.chip:hover { border-color: var(--leaf); color: var(--forest); }
.chip.on { background: var(--forest); color: #f6f4ec; border-color: var(--forest); }

/* ---------- Formulare ---------- */
form { max-width: 560px; }
form.toolbar, form.posform { max-width: none; }
form label { display: block; margin: 14px 0 0; font-size: 13px; font-weight: 600;
  color: var(--ink-soft); letter-spacing: .01em; }
input, select, textarea { width: 100%; margin-top: 6px; padding: 11px 13px;
  font-family: var(--font-b); font-size: 15px; color: var(--ink);
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r-sm); transition: .15s; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--leaf);
  box-shadow: 0 0 0 3px rgba(123,155,98,.22); }
input::placeholder, textarea::placeholder { color: #a7afa3; }
form > button { margin-top: 18px; }
.posform { background: var(--card); border: 1px solid var(--line); border-radius: var(--r);
  padding: 14px; margin: 12px 0; box-shadow: var(--sh-1); }
.posform .posrow { display: flex; gap: 9px; }
.posform .posrow input { flex: 1; min-width: 0; }
.radio-row { display: flex; gap: 18px; margin-top: 8px; }
.radio-row label { display: flex; align-items: center; gap: 7px; margin: 0; font-weight: 500; color: var(--ink); }
.radio-row input { width: auto; margin: 0; }
details summary { cursor: pointer; list-style: none; display: inline-flex; }
details summary::-webkit-details-marker { display: none; }
details[open] summary { margin-bottom: 4px; }

/* ---------- Detail-Definitionen ---------- */
.detail dl { display: grid; grid-template-columns: auto 1fr; gap: 9px 18px; margin: 14px 0;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r);
  padding: 18px; box-shadow: var(--sh-1); max-width: 640px; }
.detail dt { color: var(--ink-soft); font-size: 13px; font-weight: 600; }
.detail dd { margin: 0; }

/* ---------- Summen / Positionstabelle ---------- */
.postable { width: 100%; border-collapse: collapse; margin: 12px 0; font-size: 14px; }
.postable th, .postable td { padding: 10px 10px; border-bottom: 1px solid var(--line); text-align: left; }
.postable th { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-soft); font-weight: 700; }
.postable th.r, .postable td.r { text-align: right; }
.postable .sub { text-align: center; padding: 16px; }
.summen { margin: 14px 0 14px auto; max-width: 360px; background: var(--card);
  border: 1px solid var(--line); border-radius: var(--r); padding: 16px 18px; box-shadow: var(--sh-1); }
.summen > div { display: flex; justify-content: space-between; padding: 4px 0; font-size: 14px; }
.summen .brutto { font-family: var(--font-d); font-weight: 600; font-size: 19px;
  border-top: 1.5px solid var(--line); margin-top: 6px; padding-top: 9px; color: var(--forest); }
.price { font-family: var(--font-d); font-weight: 500; color: var(--forest); white-space: nowrap; }

/* ---------- Foto-Galerie ---------- */
.gallery { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 10px; }
.gallery img { width: 120px; height: 120px; object-fit: cover; border-radius: var(--r-sm);
  border: 1px solid var(--line); box-shadow: var(--sh-1); transition: .2s; }
.gallery a:hover img { transform: scale(1.03); box-shadow: var(--sh-2); }

/* ---------- Unterschrift-Canvas ---------- */
.sigpad { width: 100%; max-width: 600px; height: 220px; touch-action: none; background: #fffefb;
  border: 2px dashed var(--leaf); border-radius: var(--r); box-shadow: inset 0 1px 6px rgba(31,46,31,.04); }

/* ---------- Preis-Box ---------- */
.preisbox { font-family: var(--font-d); font-size: clamp(28px, 7vw, 44px); font-weight: 500;
  text-align: center; color: #f6f4ec; letter-spacing: -.01em; padding: 30px 20px;
  border-radius: var(--r-lg); margin: 18px 0; max-width: 560px;
  background: linear-gradient(140deg, var(--forest) 0%, var(--forest-2) 70%, var(--leaf) 130%);
  box-shadow: var(--sh-2); }

/* ---------- Ampel / Balken / Zeitkonto ---------- */
.ampel { display: inline-block; width: 11px; height: 11px; border-radius: 50%; margin-right: 8px;
  vertical-align: -1px; box-shadow: 0 0 0 3px rgba(0,0,0,.04); }
.ampel.gruen { background: var(--ok); } .ampel.gelb { background: #d39a2a; }
.ampel.rot { background: var(--bad); } .ampel.grau { background: #aab2a4; }
.bar { background: var(--paper-2); border-radius: 999px; height: 11px; overflow: hidden;
  margin-top: 6px; border: 1px solid var(--line); max-width: 520px; }
.bar > span { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--forest), var(--leaf)); }
.kpi { font-size: 13.5px; color: var(--ink-soft); margin: 6px 0; }
.kpi strong { color: var(--ink); }
.saldo-plus  { color: var(--ok);  font-weight: 700; }
.saldo-minus { color: var(--bad); font-weight: 700; }

/* ---------- Login ---------- */
.login-card { background: var(--card); max-width: 400px; margin: 8vh auto 0; padding: 34px 30px 30px;
  border-radius: var(--r-lg); border: 1px solid var(--line); box-shadow: var(--sh-3);
  animation: fade-up .5s cubic-bezier(.2,.7,.2,1) both; }
.login-card form { max-width: none; }
.login-card h1 { text-align: center; font-size: 32px; color: var(--forest); margin-bottom: .15em; }
.login-card .tagline { text-align: center; color: var(--ink-soft); font-size: 13.5px; margin: 0 0 20px; }
.error { color: var(--bad); font-size: 14px; background: var(--bad-bg); padding: 9px 12px;
  border-radius: var(--r-sm); margin: 6px 0; }

/* ---------- Druck-Dokumente ---------- */
.druck { background: var(--paper); color: var(--ink); padding-bottom: 90px; }
.sheet { max-width: 800px; margin: 26px auto; padding: 44px 50px; background: #fffefb;
  border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--sh-2); }
.sheet h1 { font-size: 27px; margin-top: .3em; }
.briefkopf { display: flex; justify-content: space-between; align-items: flex-start;
  border-bottom: 2px solid var(--forest); padding-bottom: 13px; }
.briefkopf strong { font-family: var(--font-d); font-size: 19px; color: var(--forest); }
.empfaenger { margin: 28px 0 10px; line-height: 1.55; }
.signatur { margin-top: 46px; }
.sig-img { max-height: 92px; display: block; }
.sig-leer { height: 92px; }
.sig-line { border-top: 1px solid var(--ink); max-width: 300px; padding-top: 5px; font-size: 13px; color: var(--ink-soft); }
.druckbar { position: fixed; bottom: 0; left: 0; right: 0; display: flex; gap: 10px; justify-content: center;
  padding: 12px; background: rgba(244,241,232,.92); backdrop-filter: blur(8px); border-top: 1px solid var(--line); }
.r { text-align: right; }

@media print {
  .noprint, .druckbar, .topbar, .sidebar, .appbar { display: none !important; }
  body, .druck { padding: 0; background: #fff; }
  .main { margin: 0 !important; }
  .sheet { max-width: 100%; padding: 0; margin: 0; border: 0; box-shadow: none; }
  .briefkopf { border-bottom-color: #1f4733; }
}

/* ---------- Motion ---------- */
@keyframes fade-up { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* ============================================================
   MOBILE (< 880px): Sidebar -> Bottom-Nav, Appbar oben
   ============================================================ */
@media (max-width: 880px) {
  body.app { display: block; padding-bottom: 84px; }
  .main { margin-left: 0; }
  .content { padding: 18px 16px 24px; max-width: 100%; }

  /* obere App-Leiste */
  .appbar { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px;
    position: sticky; top: 0; z-index: 40; background: rgba(244,241,232,.88);
    backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
  .appbar .brand { display: inline-flex; align-items: center; gap: 9px; font-family: var(--font-d);
    font-weight: 600; font-size: 20px; letter-spacing: -.02em; color: var(--forest); }
  .appbar .brand .leaf { width: 22px; height: 22px; color: var(--leaf); }
  .appbar .brand b { color: var(--amber); }
  .appbar .logout-m { color: var(--ink-soft); display: inline-flex; padding: 6px; }
  .appbar .logout-m svg { width: 22px; height: 22px; stroke-width: 1.8; }

  /* Sidebar -> schwebende Bottom-Nav */
  .sidebar { top: auto; bottom: 12px; left: 50%; right: auto; transform: translateX(-50%);
    width: auto; max-width: calc(100% - 24px); height: auto; flex-direction: row; gap: 2px;
    padding: 6px; border-radius: 999px; border: 0; overflow: visible;
    background: rgba(23,58,41,.95); box-shadow: var(--sh-3); }
  .sidebar .brand, .sidebar .logout, .nav a.sec { display: none; }
  .nav { flex-direction: row; gap: 2px; }
  .nav a { flex-direction: column; gap: 2px; min-width: 60px; padding: 7px 8px 6px;
    border-radius: 999px; font-size: 10.5px; font-weight: 600; }
  .nav a svg { width: 21px; height: 21px; }

  .cards { grid-template-columns: 1fr 1fr; }
  .toolbar input[type=search] { max-width: none; }
}
@media (max-width: 420px) { .cards { grid-template-columns: 1fr; } }
