/* ============================================================
   Riad Enchanté · Kassenbuch
   Marke: Gold #B09050, Cormorant Garamond + Jost, Creme/Sand.
   Mobile-first; ab 880px Desktop-Layout mit Seitenleiste.
   ============================================================ */
@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:wght@400;500;600&family=Jost:wght@300;400;500&display=swap');

:root {
  --gold: #b09050;
  --gold-dark: #8c6f3c;
  --gold-light: #c9ae7e;
  --gold-soft: #e7d9bf;
  --cream: #faf7f1;
  --sand: #f1e9db;
  --ink: #211e18;
  --ink-soft: #4a443a;
  --charcoal: #1a1712;
  --terracotta: #9e4a3c;
  --green: #3f7d5e;
  --green-soft: #e2efe7;
  --red: #b3402f;
  --red-soft: #f7e3df;
  --amber: #b5862a;
  --amber-soft: #f6ecd4;
  --serif: "Cormorant Garamond", "Times New Roman", serif;
  --sans: "Jost", ui-sans-serif, system-ui, sans-serif;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --shadow: 0 1px 2px rgba(33,30,24,.04), 0 8px 24px rgba(33,30,24,.06);
  --radius: 14px;
  --nav-h: 64px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--cream);
  color: var(--ink);
  font-family: var(--sans);
  font-weight: 300;
  line-height: 1.6;
  letter-spacing: .01em;
  -webkit-font-smoothing: antialiased;
  padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom));
}
h1,h2,h3,h4 { font-family: var(--serif); font-weight: 500; line-height: 1.15; margin: 0; letter-spacing: .005em; }
a { color: var(--gold-dark); }
::selection { background: var(--gold); color: #fff; }

.eyebrow {
  text-transform: uppercase; letter-spacing: .3em; font-size: .68rem;
  color: var(--gold-dark); font-weight: 400;
}
.muted { color: var(--ink-soft); }
.rule-gold { width: 3.5rem; height: 1px; background: var(--gold); border: 0; margin: .5rem 0 1rem; }

/* ---------- Layout ---------- */
.app-shell { min-height: 100vh; }
.topbar {
  display: flex; align-items: center; gap: .7rem;
  padding: .8rem 1.1rem; background: var(--cream);
  border-bottom: 1px solid var(--sand); position: sticky; top: 0; z-index: 20;
  padding-top: calc(.8rem + env(safe-area-inset-top));
}
.topbar .logo { height: 30px; width: auto; object-fit: contain; flex: none; }
.topbar .brand { line-height: 1.05; }
.topbar .brand b { font-family: var(--serif); font-weight: 600; font-size: 1.05rem; display: block; }
.topbar .brand span { font-size: .62rem; letter-spacing: .26em; text-transform: uppercase; color: var(--gold-dark); }
.topbar .spacer { flex: 1; }
.bell { position: relative; border: 0; background: none; color: var(--ink-soft); cursor: pointer; padding: .3rem; margin-right: .3rem; display: inline-flex; }
.bell svg { width: 22px; height: 22px; }
.bell:hover { color: var(--gold-dark); }
.bell-badge { position: absolute; top: -2px; right: -2px; min-width: 16px; height: 16px; padding: 0 3px;
  background: var(--terracotta); color: #fff; border-radius: 999px; font-size: .6rem; line-height: 16px;
  text-align: center; font-weight: 500; }
.txn.unread { background: var(--gold-soft); border-radius: 8px; padding-left: .5rem; padding-right: .5rem; }

.lang-switch { display: flex; gap: .15rem; }
.lang-switch button {
  border: 0; background: none; font-family: var(--sans); font-size: .72rem;
  padding: .25rem .4rem; color: var(--ink-soft); cursor: pointer; border-radius: 6px;
  text-transform: uppercase; letter-spacing: .08em;
}
.lang-switch button.on { color: var(--gold-dark); font-weight: 500; background: var(--sand); }

.content { padding: 1.1rem 1.1rem 2rem; max-width: 1180px; margin: 0 auto; }

/* ---------- Bottom-Nav (mobil) ---------- */
.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0; height: calc(var(--nav-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: #fff; border-top: 1px solid var(--sand); display: flex; z-index: 30;
}
.bottom-nav a {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px; text-decoration: none; color: var(--ink-soft); font-size: .6rem; letter-spacing: .04em;
}
.bottom-nav a svg { width: 22px; height: 22px; }
.bottom-nav a.on { color: var(--gold-dark); }

/* ---------- Sidebar (Desktop) ---------- */
.sidebar { display: none; }
@media (min-width: 880px) {
  body { padding-bottom: 0; }
  .bottom-nav { display: none; }
  .app-shell { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }
  .sidebar {
    display: flex; flex-direction: column; gap: .2rem; background: var(--charcoal);
    color: #e9e2d4; padding: 1.4rem 1rem; position: sticky; top: 0; height: 100vh;
  }
  .sidebar .brand-block { display: flex; align-items: center; gap: .6rem; margin-bottom: 1.4rem; padding: 0 .5rem; }
  .sidebar .brand-block .logo { height: 34px; width: auto; object-fit: contain; }
  .sidebar .brand-block b { font-family: var(--serif); font-size: 1.1rem; color: #fff; display: block; }
  .sidebar .brand-block span { font-size: .58rem; letter-spacing: .24em; text-transform: uppercase; color: var(--gold-light); }
  .sidebar a {
    display: flex; align-items: center; gap: .7rem; padding: .65rem .8rem; border-radius: 10px;
    color: #d8cfbd; text-decoration: none; font-size: .9rem; transition: all .2s var(--ease);
  }
  .sidebar a svg { width: 19px; height: 19px; opacity: .85; }
  .sidebar a:hover { background: rgba(255,255,255,.06); color: #fff; }
  .sidebar a.on { background: var(--gold); color: #fff; }
  .sidebar a.on svg { opacity: 1; }
  .sidebar .sb-foot { margin-top: auto; font-size: .7rem; color: #9c917d; padding: .5rem; }
  .main-area { display: flex; flex-direction: column; }
  .topbar { background: var(--cream); }
  .topbar .logo, .topbar .brand b, .topbar .brand span { display: none; }
  .topbar .mobile-only { display: none; }
  .content { padding: 1.6rem 2rem 3rem; }
}
@media (max-width: 879px) { .desktop-only { display: none !important; } }

/* ---------- Cards / Grid ---------- */
.grid { display: grid; gap: .9rem; }
.grid-2 { grid-template-columns: 1fr; }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
@media (min-width: 620px) { .grid-2 { grid-template-columns: 1fr 1fr; } }
.card {
  background: #fff; border: 1px solid var(--sand); border-radius: var(--radius);
  padding: 1.1rem; box-shadow: var(--shadow);
}
.card h3 { font-size: 1.25rem; margin-bottom: .2rem; }
.section-title { display: flex; align-items: baseline; justify-content: space-between; margin: 1.6rem 0 .7rem; }
.section-title h2 { font-size: 1.5rem; }

/* ---------- Balance cards ---------- */
.bal-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: .7rem; }
.bal {
  background: linear-gradient(160deg, #fff, var(--cream)); border: 1px solid var(--gold-soft);
  border-radius: var(--radius); padding: .85rem .8rem; text-align: center;
}
.bal .cur { font-size: .64rem; letter-spacing: .18em; color: var(--gold-dark); text-transform: uppercase; }
.bal .amt { font-family: var(--serif); font-size: 1.45rem; font-weight: 600; color: var(--ink); margin-top: .15rem; }
.bal .amt.neg { color: var(--red); }
.bal-total { margin-top: .7rem; text-align: center; font-size: .9rem; color: var(--ink-soft); }
.bal-total b { font-family: var(--serif); font-size: 1.15rem; color: var(--gold-dark); }

.kpi-row { display: flex; gap: .7rem; margin-top: .9rem; }
.kpi { flex: 1; background: #fff; border: 1px solid var(--sand); border-radius: var(--radius); padding: .8rem; }
.kpi .lbl { font-size: .68rem; text-transform: uppercase; letter-spacing: .1em; color: var(--ink-soft); }
.kpi .val { font-family: var(--serif); font-size: 1.25rem; font-weight: 600; }
.kpi.income .val { color: var(--green); }
.kpi.expense .val { color: var(--terracotta); }

/* ---------- Quick actions ---------- */
.quick { display: grid; grid-template-columns: 1fr 1fr; gap: .7rem; margin: 1rem 0 1.4rem; }
.quick a {
  display: flex; flex-direction: column; gap: .4rem; padding: 1rem; border-radius: var(--radius);
  text-decoration: none; background: #fff; border: 1px solid var(--sand); color: var(--ink);
  box-shadow: var(--shadow); transition: transform .15s var(--ease);
}
.quick a:active { transform: scale(.98); }
.quick a svg { width: 26px; height: 26px; color: var(--gold-dark); }
.quick a.primary { background: var(--gold); color: #fff; border-color: var(--gold); }
.quick a.primary svg { color: #fff; }
.quick a b { font-size: .95rem; font-weight: 400; }
@media (min-width: 620px) { .quick { grid-template-columns: repeat(3, 1fr); } }

/* ---------- Buttons / Forms ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  font-family: var(--sans); text-transform: uppercase; letter-spacing: .14em; font-size: .74rem;
  padding: .85rem 1.5rem; border: 1px solid transparent; border-radius: 10px; cursor: pointer;
  transition: all .25s var(--ease); background: var(--gold); color: #fff;
}
.btn:hover { background: var(--gold-dark); }
.btn.block { width: 100%; }
.btn.outline { background: transparent; border-color: var(--gold); color: var(--gold-dark); }
.btn.outline:hover { background: var(--gold); color: #fff; }
.btn.ghost { background: transparent; color: var(--ink-soft); border-color: var(--sand); }
.btn.danger { background: var(--red); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn svg { width: 17px; height: 17px; }

.field { margin-bottom: .9rem; }
.field label { display: block; font-size: .76rem; letter-spacing: .04em; color: var(--ink-soft); margin-bottom: .3rem; }
.field input, .field select, .field textarea {
  width: 100%; padding: .75rem .8rem; border: 1px solid var(--gold-soft); border-radius: 10px;
  font-family: var(--sans); font-size: 1rem; background: #fff; color: var(--ink);
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(176,144,80,.15);
}
.field textarea { resize: vertical; min-height: 64px; }
.row { display: flex; gap: .7rem; }
.row > * { flex: 1; }

.seg { display: flex; border: 1px solid var(--gold-soft); border-radius: 10px; overflow: hidden; }
.seg button {
  flex: 1; border: 0; background: #fff; padding: .7rem; cursor: pointer; font-family: var(--sans);
  font-size: .85rem; color: var(--ink-soft);
}
.seg button.on { background: var(--gold); color: #fff; }
.seg.income button.on { background: var(--green); }
.seg.expense button.on { background: var(--terracotta); }

.amount-input { font-family: var(--serif); font-size: 1.8rem !important; text-align: center; font-weight: 600; }

/* ---------- Lists / tables ---------- */
.txn { display: flex; align-items: center; gap: .8rem; padding: .8rem 0; border-bottom: 1px solid var(--sand); }
.txn:last-child { border-bottom: 0; }
.txn .ico { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; flex: none; }
.txn .ico svg { width: 18px; height: 18px; }
.txn .ico.in { background: var(--green-soft); color: var(--green); }
.txn .ico.out { background: var(--red-soft); color: var(--terracotta); }
.txn .ico.x { background: var(--gold-soft); color: var(--gold-dark); }
.txn .meta { flex: 1; min-width: 0; }
.txn .meta b { font-weight: 400; font-size: .95rem; display: block; }
.txn .meta small { color: var(--ink-soft); font-size: .76rem; }
.txn .amt { font-family: var(--serif); font-weight: 600; font-size: 1.05rem; white-space: nowrap; }
.txn .amt.in { color: var(--green); }
.txn .amt.out { color: var(--terracotta); }
.txn.strike .meta b, .txn.strike .amt { text-decoration: line-through; opacity: .55; }

table.data { width: 100%; border-collapse: collapse; font-size: .85rem; }
table.data th { text-align: left; font-weight: 500; color: var(--ink-soft); border-bottom: 1px solid var(--gold-soft); padding: .5rem .4rem; font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; }
table.data td { padding: .55rem .4rem; border-bottom: 1px solid var(--sand); vertical-align: top; }
.num { text-align: right; font-variant-numeric: tabular-nums; }

/* ---------- Badges / pills ---------- */
.badge { display: inline-flex; align-items: center; gap: .3rem; font-size: .68rem; padding: .2rem .55rem; border-radius: 999px; letter-spacing: .03em; }
.badge.ok { background: var(--green-soft); color: var(--green); }
.badge.warn { background: var(--amber-soft); color: var(--amber); }
.badge.crit, .badge.error { background: var(--red-soft); color: var(--red); }
.badge.neutral { background: var(--sand); color: var(--ink-soft); }
.badge.gold { background: var(--gold-soft); color: var(--gold-dark); }

.alert { display: flex; gap: .6rem; align-items: flex-start; padding: .8rem 1rem; border-radius: 10px; margin-bottom: .7rem; font-size: .88rem; }
.alert svg { width: 18px; height: 18px; flex: none; margin-top: 2px; }
.alert.warn { background: var(--amber-soft); color: #6b5114; }
.alert.crit { background: var(--red-soft); color: #722; }
.alert.info { background: var(--green-soft); color: #2c5a42; }

/* ---------- Login ---------- */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 1.5rem;
  background: radial-gradient(120% 80% at 50% -10%, var(--sand), var(--cream)); }
.login-card { width: 100%; max-width: 380px; background: #fff; border: 1px solid var(--gold-soft);
  border-radius: 20px; padding: 2.2rem 1.8rem; box-shadow: var(--shadow); text-align: center; }
.login-card .logo { width: 210px; max-width: 70%; height: auto; margin: 0 auto 1rem; display: block; }
.login-card h1 { font-size: 1.7rem; }
.login-card .eyebrow { display: block; margin-bottom: 1.4rem; }
.login-card .field { text-align: left; }
.login-card .err { color: var(--red); font-size: .85rem; margin-bottom: .6rem; min-height: 1.1em; }
.login-lang { display: flex; justify-content: center; gap: .3rem; margin-top: 1.2rem; }
.login-lang button { border: 1px solid var(--sand); background: #fff; border-radius: 8px; padding: .3rem .7rem;
  font-family: var(--sans); font-size: .75rem; cursor: pointer; color: var(--ink-soft); }
.login-lang button.on { border-color: var(--gold); color: var(--gold-dark); }
.credit { margin-top: 1.4rem; font-size: .7rem; color: var(--ink-soft); letter-spacing: .03em; }

/* Civeloa Entwickler-Credit */
.civeloa-credit { display: inline-flex; align-items: center; gap: .45rem; margin-top: 1.5rem;
  text-decoration: none; opacity: .8; transition: opacity .2s var(--ease); }
.civeloa-credit:hover { opacity: 1; }
.civeloa-credit span { font-size: .68rem; letter-spacing: .04em; color: var(--ink-soft); }
.civeloa-credit img { height: 15px; width: auto; display: block; }
.civeloa-credit.dark { margin-top: .5rem; }
.civeloa-credit.dark span { color: #9c917d; }
.civeloa-credit.dark img { height: 14px; }

/* ---------- Modal / sheet ---------- */
.sheet-bg { position: fixed; inset: 0; background: rgba(26,23,18,.45); z-index: 50; display: flex;
  align-items: flex-end; justify-content: center; }
@media (min-width: 620px) { .sheet-bg { align-items: center; } }
.sheet { background: var(--cream); width: 100%; max-width: 560px; max-height: 92vh; overflow-y: auto;
  border-radius: 20px 20px 0 0; padding: 1.3rem 1.2rem calc(1.3rem + env(safe-area-inset-bottom)); }
@media (min-width: 620px) { .sheet { border-radius: 20px; } }
.sheet h2 { font-size: 1.5rem; margin-bottom: .2rem; }
.sheet .close { float: right; border: 0; background: none; font-size: 1.5rem; cursor: pointer; color: var(--ink-soft); line-height: 1; }

/* ---------- Toast ---------- */
.toast { position: fixed; left: 50%; bottom: calc(var(--nav-h) + 16px); transform: translateX(-50%) translateY(20px);
  background: var(--charcoal); color: #fff; padding: .75rem 1.2rem; border-radius: 10px; font-size: .85rem;
  opacity: 0; pointer-events: none; transition: all .3s var(--ease); z-index: 100; max-width: 90vw; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.error { background: var(--red); }
@media (min-width: 880px) { .toast { bottom: 24px; } }

/* ---------- Kategorien-Verwaltung ---------- */
.cat-block { padding: .7rem 0; border-bottom: 1px solid var(--sand); }
.cat-block.inactive { opacity: .55; }
.cat-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.cat-head b { font-weight: 500; }
.cat-items { margin-top: .5rem; display: flex; flex-wrap: wrap; gap: .35rem; }

.offline-bar { position: fixed; left: 0; right: 0; bottom: calc(var(--nav-h) + env(safe-area-inset-bottom));
  background: var(--amber-soft); color: #6b5114; text-align: center; font-size: .78rem;
  padding: .45rem .8rem; z-index: 40; border-top: 1px solid var(--amber); }
@media (min-width: 880px) { .offline-bar { bottom: 0; } }

.empty { text-align: center; padding: 2.5rem 1rem; color: var(--ink-soft); }
.empty svg { width: 44px; height: 44px; color: var(--gold-light); margin-bottom: .5rem; }
.spinner { width: 28px; height: 28px; border: 3px solid var(--gold-soft); border-top-color: var(--gold);
  border-radius: 50%; animation: spin .8s linear infinite; margin: 2rem auto; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Print (PDF) ---------- */
@media print {
  .topbar, .bottom-nav, .sidebar, .no-print, .toast { display: none !important; }
  body { background: #fff; padding: 0; }
  .app-shell { display: block; }
  .content { max-width: none; padding: 0; }
  .card { box-shadow: none; border: 1px solid #ddd; break-inside: avoid; }
}
