@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@500;600;700&family=Inter:wght@400;500;600;700&display=swap');

:root {
  --bg: #0a0e17; --card: rgba(255,255,255,0.045); --ink: #eef1f8; --muted: #8b93a7;
  --line: rgba(255,255,255,0.09); --accent: #8b7bff; --accent-soft: rgba(139,123,255,0.14);
  --green: #2ee6a6; --green-soft: rgba(46,230,166,0.14);
  --amber: #ffb454; --amber-soft: rgba(255,180,84,0.14);
  --red: #ff5c7a; --red-soft: rgba(255,92,122,0.14);
  --gray: #6b7280; --gray-soft: rgba(255,255,255,0.06);
  --accent2: #22d3ee;
  --radius: 16px;
  --shadow: 0 1px 0 rgba(255,255,255,0.04) inset, 0 10px 30px rgba(0,0,0,0.35);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg); color: var(--ink); min-height: 100vh; -webkit-font-smoothing: antialiased;
  background:
    radial-gradient(circle at 12% 0%, rgba(139,123,255,0.16), transparent 42%),
    radial-gradient(circle at 88% 18%, rgba(34,211,238,0.12), transparent 40%),
    radial-gradient(circle at 50% 100%, rgba(46,230,166,0.06), transparent 50%),
    var(--bg);
  background-attachment: fixed;
}
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, textarea, select { font-family: inherit; font-size: 14px; color: var(--ink); }
a { color: inherit; text-decoration: none; }
h1,h2,h3 { font-family: 'Space Grotesk', 'Inter', sans-serif; letter-spacing: -0.02em; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 10px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.18); }

/* ============ GLASS SURFACE HELPER (angewendet auf Cards, Modals etc.) ============ */
.login-card, .topbar, .cal-toolbar, .week-wrap, .week-table-wrap, .cust-card,
.empty-state, .modal, .kpi-card, .report-table-wrap {
  background: var(--card);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: 1px solid var(--line);
}

/* ============ LOGIN ============ */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.login-card { padding: 44px 40px; border-radius: 20px; box-shadow: var(--shadow); width: 100%; max-width: 400px; }
.login-logo {
  width: 56px; height: 56px; border-radius: 16px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #0a0e17; display: flex; align-items: center; justify-content: center;
  font-size: 26px; font-weight: 700; margin-bottom: 22px;
  box-shadow: 0 0 30px rgba(139,123,255,0.4);
}
.login-card h1 { font-size: 24px; margin-bottom: 6px; font-weight: 700; }
.login-card p { color: var(--muted); font-size: 14px; margin-bottom: 26px; }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; font-weight: 500; color: var(--muted); margin-bottom: 6px; }
.field input, .field textarea, .field select {
  width: 100%; padding: 12px 14px; border: 1.5px solid var(--line); border-radius: 10px;
  font-size: 15px; background: rgba(255,255,255,0.03); color: var(--ink);
}
.field input::placeholder, .field textarea::placeholder { color: var(--gray); }
.field input:focus, .field textarea:focus, .field select:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(139,123,255,0.18);
}
.btn { padding: 12px 20px; border-radius: 10px; font-size: 14px; font-weight: 600; transition: all .15s; display: inline-block; }
.btn-primary {
  background: linear-gradient(135deg, var(--accent), #a78bfa); color: #fff; width: 100%;
  box-shadow: 0 4px 20px rgba(139,123,255,0.35);
}
.btn-primary:hover { filter: brightness(1.12); transform: translateY(-1px); }
.btn-ghost { background: var(--gray-soft); color: var(--ink); border: 1px solid var(--line); }
.btn-ghost:hover { background: rgba(255,255,255,0.1); }
.btn-danger { background: var(--red-soft); color: var(--red); }
.btn-danger:hover { background: rgba(255,92,122,0.22); }
.btn-sm { padding: 8px 14px; font-size: 13px; }
.error { color: var(--red); font-size: 13px; margin-top: 10px; }

/* ============ SHELL ============ */
.topbar {
  padding: 16px 28px; display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; z-index: 10; gap: 16px; flex-wrap: wrap; border-radius: 0;
  border-left: none; border-right: none; border-top: none;
}
.brand { display: flex; align-items: center; gap: 12px; font-weight: 700; }
.brand-mark {
  width: 32px; height: 32px; border-radius: 9px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #0a0e17; display: flex; align-items: center; justify-content: center;
  font-size: 16px; font-weight: 700; box-shadow: 0 0 18px rgba(139,123,255,0.4);
  overflow: hidden; flex-shrink: 0;
}
.nav { display: flex; gap: 4px; background: rgba(255,255,255,0.03); padding: 4px; border-radius: 12px; border: 1px solid var(--line); }
.nav a { padding: 8px 16px; border-radius: 8px; font-size: 14px; font-weight: 500; color: var(--muted); transition: all .15s; }
.nav a:hover { color: var(--ink); }
.nav a.active { background: var(--surface-2, rgba(255,255,255,0.08)); color: var(--ink); box-shadow: inset 0 0 0 1px var(--line); }
.user-chip { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--muted); }
.avatar {
  width: 32px; height: 32px; border-radius: 50%; background: var(--accent-soft); color: var(--accent);
  display: flex; align-items: center; justify-content: center; font-weight: 600; font-size: 13px;
  border: 1px solid rgba(139,123,255,0.3);
}

.container { max-width: 1280px; margin: 0 auto; padding: 28px; }
.page-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; gap: 16px; flex-wrap: wrap; }
.page-head h2 { font-size: 22px; font-weight: 600; }
.page-head .sub { color: var(--muted); font-size: 14px; margin-top: 2px; }

/* ============ KALENDER-TOOLBAR ============ */
.cal-toolbar {
  display: flex; align-items: center; gap: 12px; margin-bottom: 16px;
  padding: 12px 16px; border-radius: var(--radius); box-shadow: var(--shadow); flex-wrap: wrap;
}
.date-nav { display: flex; gap: 6px; }
.date-nav button {
  width: 34px; height: 34px; border-radius: 8px; background: var(--gray-soft);
  font-size: 16px; border: 1px solid var(--line); color: var(--ink);
}
.date-nav button:hover { background: rgba(255,255,255,0.1); }
.current-date { font-weight: 600; font-size: 15px; min-width: 260px; }
.today-btn { margin-left: auto; }
.legend { display: flex; gap: 16px; margin-bottom: 16px; font-size: 12px; color: var(--muted); flex-wrap: wrap; }
.legend span { display: flex; align-items: center; gap: 6px; }
.dot { width: 10px; height: 10px; border-radius: 3px; box-shadow: 0 0 8px currentColor; }

/* ============ WOCHEN-GRID + TABELLE ============ */
.week-wrap { border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.week-scroll { max-height: 78vh; overflow-y: auto; overflow-x: hidden; }
.week-header {
  display: grid; grid-template-columns: 70px repeat(7, 1fr);
  border-bottom: 1px solid var(--line); background: rgba(255,255,255,0.02); position: sticky; top: 0; z-index: 5;
}
.week-corner { border-right: 1px solid var(--line); }
.week-day-head { padding: 12px 8px; text-align: center; border-left: 1px solid var(--line); }
.week-day-head .wd { font-size: 11px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }
.week-day-head .dd { font-size: 18px; font-weight: 700; margin-top: 2px; }
.week-day-head.today { background: var(--accent-soft); }
.week-day-head.today .wd, .week-day-head.today .dd { color: var(--accent); }

#weekBody { display: block; }
.week-row { display: grid; grid-template-columns: 70px repeat(7, 1fr); border-bottom: 1px solid var(--line); min-height: 48px; }
.week-row.hour-start { border-top: 1.5px solid var(--line); }
.week-time {
  padding: 8px 10px; font-size: 12px; color: var(--muted); font-weight: 500;
  border-right: 1px solid var(--line); background: rgba(255,255,255,0.015); text-align: right;
}
.week-cell { border-left: 1px solid var(--line); padding: 3px; cursor: pointer; position: relative; transition: background 0.12s; min-width: 0; }
.week-cell.empty .plus { color: var(--gray); font-size: 16px; opacity: 0; display: flex; align-items: center; justify-content: center; height: 100%; min-height: 40px; }
.week-cell.empty:hover { background: var(--accent-soft); }
.week-cell.empty:hover .plus { opacity: 1; color: var(--accent); }
.week-cell.today-col { background: rgba(139,123,255,0.04); }
.week-cell.booked { cursor: pointer; padding: 2px; }
.week-cell.booked .cell-inner { border-radius: 6px; padding: 4px 6px; height: 100%; display: flex; flex-direction: column; justify-content: center; overflow: hidden; }
.week-cell.booked.pending .cell-inner { background: var(--amber-soft); border-left: 3px solid var(--amber); }
.week-cell.booked.confirmed .cell-inner { background: var(--green-soft); border-left: 3px solid var(--green); }
.week-cell.booked.noshow .cell-inner { background: var(--red-soft); border-left: 3px solid var(--red); text-decoration: line-through; opacity: 0.75; }
.week-cell.booked.cancelled .cell-inner { background: var(--gray-soft); border-left: 3px solid var(--gray); text-decoration: line-through; opacity: 0.6; }
.cell-name { font-size: 11px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cell-svc { font-size: 10px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.week-table-wrap { border-top: 1px solid var(--line); border-radius: 0; }
.week-table-head {
  display: flex; align-items: center; justify-content: space-between; padding: 16px 20px;
  border-bottom: 1px solid var(--line);
}
.week-table-head h3 { font-size: 15px; }
.week-table-head .muted { font-size: 13px; color: var(--muted); }
.week-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.week-table thead th {
  text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted);
  font-weight: 600; padding: 10px 16px; background: rgba(255,255,255,0.02); border-bottom: 1px solid var(--line);
}
.week-table tbody tr { border-bottom: 1px solid var(--line); cursor: pointer; transition: background 0.12s; }
.week-table tbody tr:last-child { border-bottom: none; }
.week-table tbody tr:hover { background: rgba(255,255,255,0.03); }
.week-table tbody td { padding: 12px 16px; vertical-align: middle; }
.week-table .cell-day { white-space: nowrap; }
.week-table .cell-day .muted { font-size: 11px; color: var(--muted); }
.week-table .cell-time { white-space: nowrap; font-variant-numeric: tabular-nums; }
.week-table .cell-name { font-weight: 600; }
.week-table .cell-phone { color: var(--muted); font-variant-numeric: tabular-nums; }
.week-table .cell-svc { color: var(--muted); }
.week-table .empty-row td { text-align: center; padding: 40px; color: var(--muted); font-style: italic; }
.rem-yes { color: var(--green); font-weight: 600; font-size: 12px; }
.rem-no { color: var(--gray); font-size: 14px; }
.cell-action { text-align: right; }
.btn-mini { padding: 6px 10px; font-size: 12px; font-weight: 600; background: var(--gray-soft); color: var(--ink); border-radius: 7px; border: 1px solid var(--line); }
.btn-mini:hover { background: rgba(255,255,255,0.1); }

.badge { font-size: 11px; font-weight: 600; padding: 3px 8px; border-radius: 20px; display: inline-block; }
.badge.confirmed { background: var(--green-soft); color: var(--green); box-shadow: 0 0 10px rgba(46,230,166,0.15); }
.badge.pending { background: var(--amber-soft); color: var(--amber); box-shadow: 0 0 10px rgba(255,180,84,0.15); }
.badge.noshow { background: var(--red-soft); color: var(--red); box-shadow: 0 0 10px rgba(255,92,122,0.15); }
.badge.cancelled { background: var(--gray-soft); color: var(--muted); }

/* ============ KUNDENSUCHE ============ */
.cust-search { position: relative; }
.cust-search > input[type="text"] {
  width: 100%; padding: 12px 14px; border: 1.5px solid var(--line); border-radius: 10px;
  font-size: 15px; background: rgba(255,255,255,0.03); color: var(--ink);
}
.cust-search > input[type="text"]:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(139,123,255,0.18); }
.cust-results {
  position: absolute; top: calc(100% + 4px); left: 0; right: 0;
  background: #10162a; border: 1.5px solid var(--line); border-radius: 10px;
  box-shadow: 0 16px 40px rgba(0,0,0,0.5); max-height: 260px; overflow-y: auto; z-index: 50; display: none;
}
.cust-results.open { display: block; }
.cust-result { padding: 10px 14px; cursor: pointer; display: flex; justify-content: space-between; gap: 12px; border-bottom: 1px solid var(--line); transition: background 0.12s; }
.cust-result:last-child { border-bottom: none; }
.cust-result:hover, .cust-result.active { background: var(--accent-soft); }
.cust-result .r-name { font-size: 14px; font-weight: 600; }
.cust-result .r-phone { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; align-self: center; }
.cust-result.no-hit { padding: 16px; color: var(--muted); font-size: 13px; text-align: center; cursor: default; }
.cust-result.no-hit:hover { background: transparent; }

/* ============ SERVICES (Custom Checkbox) ============ */
.services-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 4px; }
.svc {
  position: relative; display: block; padding: 11px 14px 11px 44px;
  border: 1.5px solid var(--line); border-radius: 10px; cursor: pointer;
  font-size: 13px; font-weight: 500; background: rgba(255,255,255,0.02);
  transition: all 0.14s; user-select: none; line-height: 1.3;
}
.svc:hover { border-color: var(--accent); background: var(--accent-soft); }
.svc input { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; opacity: 0; margin: 0; padding: 0; cursor: pointer; z-index: 2; }
.svc::before {
  content: ''; position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
  width: 18px; height: 18px; border: 1.5px solid var(--gray); border-radius: 5px;
  background: rgba(255,255,255,0.03); transition: all 0.14s; pointer-events: none;
}
.svc:hover::before { border-color: var(--accent); }
.svc::after {
  content: ''; position: absolute; left: 19px; top: 50%; width: 5px; height: 10px;
  border: solid #0a0e17; border-width: 0 2px 2px 0;
  transform: translateY(-65%) rotate(45deg) scale(0); transition: transform 0.14s; pointer-events: none;
}
.svc:has(input:checked)::before { background: var(--accent); border-color: var(--accent); box-shadow: 0 0 10px rgba(139,123,255,0.5); }
.svc:has(input:checked)::after { transform: translateY(-65%) rotate(45deg) scale(1); }
.svc span { display: block; }
.svc:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.svc:has(input:checked) span { color: var(--accent); font-weight: 600; }

/* ============ KUNDEN ============ */
.cust-grid { display: grid; gap: 10px; }
.cust-card { border-radius: var(--radius); padding: 16px 20px; box-shadow: var(--shadow); display: flex; align-items: center; gap: 16px; cursor: pointer; transition: transform 0.15s, border-color 0.15s; }
.cust-card:hover { transform: translateY(-1px); border-color: rgba(139,123,255,0.3); }
.cust-avatar {
  width: 42px; height: 42px; border-radius: 50%; background: var(--accent-soft); color: var(--accent);
  display: flex; align-items: center; justify-content: center; font-weight: 600; font-size: 15px; flex-shrink: 0;
  border: 1px solid rgba(139,123,255,0.3);
}
.cust-main { flex: 1; min-width: 0; }
.cust-main .name { font-weight: 600; font-size: 15px; }
.cust-main .phone { font-size: 13px; color: var(--muted); }
.cust-main .default-svc { font-size: 12px; color: var(--muted); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cust-tags { display: flex; gap: 6px; flex-shrink: 0; }
.tag { font-size: 11px; font-weight: 600; padding: 4px 10px; border-radius: 20px; }
.tag.consent-yes { background: var(--green-soft); color: var(--green); }
.tag.consent-no { background: var(--red-soft); color: var(--red); }
.empty-state { border-radius: var(--radius); padding: 60px 20px; text-align: center; box-shadow: var(--shadow); }
.empty-state .icon { margin-bottom: 14px; opacity: 0.6; color: var(--accent); display: flex; justify-content: center; }
.empty-state h3 { font-size: 17px; margin-bottom: 6px; font-weight: 600; }
.empty-state p { color: var(--muted); font-size: 14px; }

/* ============ MODAL ============ */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(5,7,14,0.65); display: none;
  align-items: center; justify-content: center; padding: 24px; z-index: 100; backdrop-filter: blur(4px);
}
.modal-overlay.open { display: flex; }
.modal { border-radius: 20px; width: 100%; max-width: 520px; max-height: 90vh; overflow-y: auto; box-shadow: 0 30px 80px rgba(0,0,0,0.6); }
.modal-head { padding: 22px 28px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; }
.modal-head h3 { font-size: 18px; font-weight: 600; }
.modal-close { width: 32px; height: 32px; border-radius: 8px; background: var(--gray-soft); font-size: 18px; color: var(--muted); border: 1px solid var(--line); }
.modal-close:hover { color: var(--ink); background: rgba(255,255,255,0.1); }
.modal-body { padding: 24px 28px; }
.modal-foot { padding: 18px 28px; border-top: 1px solid var(--line); display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.consent-box {
  background: var(--accent-soft); border: 1px solid rgba(139,123,255,0.25);
  border-radius: 12px; padding: 16px; margin-top: 8px; font-size: 13px; line-height: 1.5; color: var(--ink);
}
.consent-box strong { color: var(--accent); }
.checkbox-row { display: flex; gap: 10px; align-items: flex-start; margin-top: 14px; }
.checkbox-row input { margin-top: 3px; width: 16px; height: 16px; accent-color: var(--accent); }
.checkbox-row label { font-size: 13px; line-height: 1.5; }

/* ============ TOAST ============ */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(100px);
  background: #10162a; color: var(--ink); border: 1px solid var(--line);
  padding: 14px 22px; border-radius: 12px; font-size: 14px; font-weight: 500;
  transition: transform .3s cubic-bezier(.2,.8,.2,1); z-index: 200;
  box-shadow: 0 10px 40px rgba(0,0,0,0.5);
}
.toast.show { transform: translateX(-50%) translateY(0); }

/* ============ SMS BUTTON ============ */
.btn-send { background: var(--accent-soft); color: var(--accent); border: 1px solid rgba(139,123,255,0.3); }
.btn-send:hover { background: var(--accent); color: #0a0e17; box-shadow: 0 0 16px rgba(139,123,255,0.4); }
.btn-send:disabled { opacity: 0.5; cursor: default; }
.rem-response { display: inline-block; margin-left: 6px; font-weight: 600; font-size: 11px; padding: 2px 6px; border-radius: 6px; }
.rem-response.rem-ja { background: var(--green-soft); color: var(--green); }
.rem-response.rem-nein { background: var(--red-soft); color: var(--red); }

/* ============ REPORT ============ */
.report-range { display: flex; gap: 6px; flex-wrap: wrap; }

.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; margin-bottom: 24px; }
.kpi-card { border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px 24px; }
.kpi-card.kpi-highlight {
  background: linear-gradient(135deg, rgba(139,123,255,0.14), rgba(34,211,238,0.08));
  border: 1.5px solid rgba(139,123,255,0.4);
  box-shadow: 0 0 30px rgba(139,123,255,0.15);
}
.kpi-label { font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); font-weight: 600; margin-bottom: 8px; }
.kpi-card.kpi-highlight .kpi-label { color: var(--accent); }
.kpi-value { font-size: 32px; font-weight: 700; letter-spacing: -0.02em; line-height: 1; margin-bottom: 6px; font-family: 'Space Grotesk', sans-serif; }
.kpi-card.kpi-highlight .kpi-value {
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.kpi-sub { font-size: 13px; color: var(--muted); }

.report-table-wrap { border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.report-table-head { padding: 16px 20px; border-bottom: 1px solid var(--line); }
.report-table-head h3 { font-size: 15px; font-weight: 600; }

/* ============ RESPONSIVE ============ */
@media (max-width: 900px) {
  .week-header, .week-row { grid-template-columns: 56px repeat(7, minmax(80px, 1fr)); }
  .week-scroll { overflow-x: auto; }
  .week-header { min-width: 700px; }
  .week-row { min-width: 700px; }
  .week-table-wrap { min-width: 700px; }
}
@media (max-width: 800px) {
  .week-table thead th:nth-child(4),
  .week-table tbody td:nth-child(4) { display: none; }
}
@media (max-width: 640px) {
  .container { padding: 16px; }
  .topbar { padding: 12px 16px; }
  .nav a { padding: 8px 12px; font-size: 13px; }
  .row2 { grid-template-columns: 1fr; }
  .current-date { min-width: auto; font-size: 14px; }
  .services-grid { grid-template-columns: 1fr; }
}

/* ============ LOGO GRÖSSER, OHNE SCHRIFTZUG ============ */
.topbar { padding-top: 10px; padding-bottom: 10px; }
.brand-mark {
  width: 188px;
  height: auto;
  border-radius: 14px;
  box-shadow: none;
  background: transparent;
}
.login-logo {
  width: 140px;
  height: auto;
  border-radius: 20px;
  box-shadow: none;
  background: transparent;
}