:root {
  --sage: #7A8C7E;
  --sage-light: #B8C9BB;
  --sage-pale: #EDF2EE;
  --warm-white: #F8F7F4;
  --ink: #2C2C2C;
  --ink-soft: #5A5A5A;
  --ink-muted: #9A9A9A;
  --rust: #A0522D;
  --rust-light: #F0E8E0;
  --border: #D8E0D9;
  --red: #C0392B;
  --red-light: #FDECEA;
  --amber: #B8860B;
  --amber-light: #FBF3DE;
  --green: #4A7C59;
  --green-light: #EAF2EC;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: Georgia, 'Times New Roman', serif;
  background: var(--warm-white);
  color: var(--ink);
  min-height: 100vh;
}
button, input, select, textarea { font-family: Arial, sans-serif; }

header {
  background: var(--sage);
  color: white;
  padding: 16px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 2px 8px rgba(0,0,0,0.12);
}
header h1 { font-size: 1.2rem; font-weight: normal; letter-spacing: 0.03em; }
header .sub { font-family: Arial, sans-serif; font-size: 0.75rem; opacity: 0.8; margin-top: 2px; }
header .actions { display: flex; gap: 10px; }
header .actions button {
  background: rgba(255,255,255,0.15);
  color: white;
  border: 1px solid rgba(255,255,255,0.4);
  padding: 7px 12px;
  border-radius: 5px;
  font-size: 0.78rem;
  cursor: pointer;
}
header .actions button:hover { background: rgba(255,255,255,0.28); }

.app { display: flex; height: calc(100vh - 62px); }

.sidebar {
  width: 300px; min-width: 300px;
  background: white;
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  overflow: hidden;
}
.sidebar-top { padding: 14px; border-bottom: 1px solid var(--border); background: var(--sage-pale); }
.btn-new {
  width: 100%; background: var(--sage); color: white; border: none;
  padding: 10px; border-radius: 6px; font-size: 0.85rem; cursor: pointer; letter-spacing: 0.02em;
}
.btn-new:hover { background: #667a6a; }
.search-box {
  width: 100%; margin-top: 10px; padding: 7px 10px; border: 1px solid var(--border);
  border-radius: 5px; font-size: 0.82rem;
}
.filter-row { display: flex; gap: 6px; margin-top: 8px; }
.filter-row button {
  flex: 1; padding: 5px; border: 1px solid var(--border); background: white; border-radius: 4px;
  font-size: 0.72rem; cursor: pointer; color: var(--ink-soft);
}
.filter-row button.active { background: var(--sage); color: white; border-color: var(--sage); }

.dash-link {
  padding: 12px 16px; cursor: pointer; font-size: 0.85rem; border-bottom: 1px solid var(--border);
  color: var(--ink-soft); font-family: Arial, sans-serif;
}
.dash-link:hover, .dash-link.active { background: var(--sage-pale); color: var(--ink); font-weight: bold; }

.client-list { flex: 1; overflow-y: auto; }
.client-item {
  padding: 12px 16px; border-bottom: 1px solid var(--border); cursor: pointer; position: relative;
}
.client-item:hover { background: var(--sage-pale); }
.client-item.active { background: var(--sage-light); }
.client-item .name { font-size: 0.92rem; }
.client-item .meta { font-family: Arial, sans-serif; font-size: 0.7rem; color: var(--ink-muted); margin-top: 2px; }
.client-item .badges { position: absolute; top: 10px; right: 10px; display: flex; gap: 4px; }
.dot { width: 8px; height: 8px; border-radius: 50%; }
.dot.red { background: var(--red); }
.dot.amber { background: var(--amber); }

.main { flex: 1; overflow-y: auto; padding: 28px 36px; }

.empty-state { color: var(--ink-muted); font-size: 0.95rem; text-align: center; margin-top: 80px; font-family: Arial, sans-serif; }

.client-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 18px; }
.client-header h2 { font-size: 1.5rem; font-weight: normal; }
.client-header .status-tag {
  font-family: Arial, sans-serif; font-size: 0.7rem; padding: 3px 9px; border-radius: 10px; margin-left: 10px;
  background: var(--sage-pale); color: var(--sage); vertical-align: middle;
}
.status-tag.closed { background: var(--rust-light); color: var(--rust); }
.header-btns { display: flex; gap: 8px; }
.header-btns button {
  padding: 7px 13px; border-radius: 5px; font-size: 0.78rem; cursor: pointer; border: 1px solid var(--border); background: white;
}
.header-btns button.danger { color: var(--red); border-color: var(--red-light); }
.header-btns button.danger:hover { background: var(--red-light); }

.tabs { display: flex; gap: 2px; border-bottom: 2px solid var(--border); margin-bottom: 22px; flex-wrap: wrap; }
.tab {
  padding: 9px 16px; cursor: pointer; font-family: Arial, sans-serif; font-size: 0.83rem;
  color: var(--ink-muted); border-bottom: 2px solid transparent; margin-bottom: -2px;
}
.tab:hover { color: var(--ink); }
.tab.active { color: var(--sage); border-bottom-color: var(--sage); font-weight: bold; }

.card { background: white; border: 1px solid var(--border); border-radius: 8px; padding: 20px; margin-bottom: 18px; }
.card h3 { font-size: 1rem; font-weight: normal; color: var(--sage); margin-bottom: 14px; border-bottom: 1px solid var(--sage-pale); padding-bottom: 8px; }

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.field { margin-bottom: 12px; }
.field label {
  display: block; font-family: Arial, sans-serif; font-size: 0.72rem; color: var(--ink-muted);
  margin-bottom: 4px; letter-spacing: 0.02em; text-transform: uppercase;
}
.field input, .field select, .field textarea {
  width: 100%; padding: 8px 10px; border: 1px solid var(--border); border-radius: 5px; font-size: 0.88rem; color: var(--ink);
  background: white; font-family: Georgia, serif;
}
.field textarea { resize: vertical; min-height: 60px; font-family: Georgia, serif; }
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--sage); }
.checkbox-field { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.checkbox-field input { width: auto; }
.checkbox-field label { font-family: Arial, sans-serif; font-size: 0.82rem; color: var(--ink); text-transform: none; }

.btn {
  padding: 8px 15px; border-radius: 5px; font-family: Arial, sans-serif; font-size: 0.8rem; cursor: pointer; border: 1px solid var(--border); background: white;
}
.btn-primary { background: var(--sage); color: white; border-color: var(--sage); }
.btn-primary:hover { background: #667a6a; }
.btn-small { padding: 4px 9px; font-size: 0.72rem; }
.btn-text { border: none; background: none; color: var(--sage); text-decoration: underline; cursor: pointer; font-family: Arial, sans-serif; font-size: 0.78rem; padding: 2px; }
.btn-text.danger { color: var(--red); }

.entry { border: 1px solid var(--border); border-radius: 7px; padding: 14px 16px; margin-bottom: 12px; background: var(--warm-white); }
.entry-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.entry-head .title { font-size: 0.95rem; }
.entry-head .tags { display: flex; gap: 6px; }
.tag { font-family: Arial, sans-serif; font-size: 0.68rem; padding: 2px 8px; border-radius: 9px; }
.tag.geplant { background: var(--sage-pale); color: var(--sage); }
.tag.durchgefuehrt { background: var(--green-light); color: var(--green); }
.tag.abgesagt { background: var(--red-light); color: var(--red); }
.tag.verschoben { background: var(--amber-light); color: var(--amber); }
.tag.bezahlt { background: var(--green-light); color: var(--green); }
.tag.offen { background: var(--amber-light); color: var(--amber); }
.tag.ueberfaellig { background: var(--red-light); color: var(--red); }
.tag.abgerechnet { background: var(--sage-pale); color: var(--sage); }
.entry-detail { font-family: Arial, sans-serif; font-size: 0.8rem; color: var(--ink-soft); line-height: 1.5; }
.entry-detail div { margin-bottom: 3px; }
.entry-actions { margin-top: 8px; display: flex; gap: 10px; }

table.overview { width: 100%; border-collapse: collapse; font-family: Arial, sans-serif; font-size: 0.82rem; }
table.overview th { text-align: left; padding: 8px 10px; border-bottom: 2px solid var(--border); color: var(--ink-muted); font-weight: normal; font-size: 0.72rem; text-transform: uppercase; }
table.overview td { padding: 9px 10px; border-bottom: 1px solid var(--border); }
table.overview tr:hover td { background: var(--sage-pale); cursor: pointer; }

.stat-row { display: flex; gap: 14px; margin-bottom: 24px; flex-wrap: wrap; }
.stat-box { flex: 1; min-width: 140px; background: white; border: 1px solid var(--border); border-radius: 8px; padding: 16px; }
.stat-box .num { font-size: 1.7rem; color: var(--sage); }
.stat-box .label { font-family: Arial, sans-serif; font-size: 0.72rem; color: var(--ink-muted); text-transform: uppercase; margin-top: 4px; }
.stat-box.warn .num { color: var(--red); }

.divider { border: none; border-top: 1px solid var(--border); margin: 16px 0; }
.hint { font-family: Arial, sans-serif; font-size: 0.72rem; color: var(--ink-muted); font-style: italic; margin-top: 6px; }
.modal-bg {
  position: fixed; inset: 0; background: rgba(0,0,0,0.35); display: flex; align-items: center; justify-content: center; z-index: 50;
}
.modal { background: white; border-radius: 8px; padding: 24px; max-width: 420px; width: 90%; }
.modal h3 { margin-bottom: 12px; font-weight: normal; }
.modal p { font-family: Arial, sans-serif; font-size: 0.85rem; color: var(--ink-soft); margin-bottom: 18px; line-height: 1.5; }
.modal .modal-btns { display: flex; gap: 10px; justify-content: flex-end; }

.cal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; flex-wrap: wrap; gap: 10px; }
.cal-nav { display: flex; align-items: center; gap: 8px; font-family: Arial, sans-serif; }
.cal-nav .btn { padding: 5px 11px; }
.cal-title { font-size: 0.95rem; min-width: 140px; text-align: center; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.cal-grid.cal-weekdays { margin-bottom: 6px; }
.cal-weekday { font-family: Arial, sans-serif; font-size: 0.7rem; text-transform: uppercase; color: var(--ink-muted); text-align: center; padding-bottom: 4px; }
.cal-cell {
  min-height: 96px; background: white; border: 1px solid var(--border); border-radius: 6px; padding: 6px;
  display: flex; flex-direction: column; gap: 3px; overflow: hidden;
}
.cal-cell.empty { background: transparent; border: none; }
.cal-cell.today { border-color: var(--sage); box-shadow: inset 0 0 0 1px var(--sage); }
.cal-daynum { font-family: Arial, sans-serif; font-size: 0.78rem; color: var(--ink-muted); margin-bottom: 2px; }
.cal-chip {
  font-family: Arial, sans-serif; font-size: 0.68rem; padding: 2px 5px; border-radius: 4px; cursor: pointer;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.cal-chip.geplant { background: var(--sage-pale); color: var(--sage); }
.cal-chip.durchgefuehrt { background: var(--green-light); color: var(--green); }
.cal-chip.abgesagt { background: var(--red-light); color: var(--red); text-decoration: line-through; }
.cal-chip.verschoben { background: var(--amber-light); color: var(--amber); }

/* --- Login / Setup --- */
.auth-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.auth-box { background: white; border: 1px solid var(--border); border-radius: 10px; padding: 36px 32px; width: 90%; max-width: 380px; box-shadow: 0 4px 16px rgba(0,0,0,0.06); }
.auth-box h1 { font-weight: normal; font-size: 1.4rem; margin-bottom: 4px; }
.auth-hint { font-family: Arial, sans-serif; font-size: 0.82rem; color: var(--ink-muted); margin-bottom: 20px; }
.auth-error { font-family: Arial, sans-serif; font-size: 0.82rem; color: var(--red); background: var(--red-light); padding: 10px 12px; border-radius: 6px; margin-bottom: 16px; }
.auth-success { font-family: Arial, sans-serif; font-size: 0.85rem; color: var(--green); background: var(--green-light); padding: 12px; border-radius: 6px; margin-bottom: 16px; line-height: 1.5; }
.auth-box .btn { width: 100%; margin-top: 6px; text-align: center; display: block; text-decoration: none; }
